import { CycleRecord } from '@shardeum-foundation/lib-types/build/src/p2p/CycleCreatorTypes';
import { Logger as log4jLogger } from 'log4js';
import StateManager from '.';
import Crypto from '../crypto';
import Logger from '../logger';
import { P2PModuleContext as P2P } from '../p2p/Context';
import * as Shardus from '../shardus/shardus-types';
import { TimestampReceipt } from '../shardus/shardus-types';
import Storage from '../storage';
import { Ordering } from '../utils';
import Profiler from '../utils/profiler';
import { AppliedVote, AppliedVoteHash, ConfirmOrChallengeMessage, QueueEntry, Proposal, SignedReceipt } from './state-manager-types';
declare class TransactionConsenus {
    app: Shardus.App;
    crypto: Crypto;
    config: Shardus.StrictServerConfiguration;
    profiler: Profiler;
    logger: Logger;
    p2p: P2P;
    storage: Storage;
    stateManager: StateManager;
    mainLogger: log4jLogger;
    seqLogger: log4jLogger;
    fatalLogger: log4jLogger;
    shardLogger: log4jLogger;
    statsLogger: log4jLogger;
    statemanager_fatal: (key: string, log: string) => void;
    txTimestampCache: Map<number | string, Map<string, TimestampReceipt>>;
    txTimestampCacheByTxId: Map<string, TimestampReceipt>;
    seenTimestampRequests: Set<string>;
    produceBadVote: boolean;
    produceBadChallenge: boolean;
    debugFailPOQo: number;
    constructor(stateManager: StateManager, profiler: Profiler, app: Shardus.App, logger: Logger, storage: Storage, p2p: P2P, crypto: Crypto, config: Shardus.StrictServerConfiguration);
    /***
     *    ######## ##    ## ########  ########   #######  #### ##    ## ########  ######
     *    ##       ###   ## ##     ## ##     ## ##     ##  ##  ###   ##    ##    ##    ##
     *    ##       ####  ## ##     ## ##     ## ##     ##  ##  ####  ##    ##    ##
     *    ######   ## ## ## ##     ## ########  ##     ##  ##  ## ## ##    ##     ######
     *    ##       ##  #### ##     ## ##        ##     ##  ##  ##  ####    ##          ##
     *    ##       ##   ### ##     ## ##        ##     ##  ##  ##   ###    ##    ##    ##
     *    ######## ##    ## ########  ##         #######  #### ##    ##    ##     ######
     */
    setupHandlers(): void;
    verifyAppliedReceipt(receipt: SignedReceipt, executionGroupNodes: Set<string>): boolean;
    poqoVoteSendLoop(queueEntry: QueueEntry, appliedVoteHash: AppliedVoteHash): Promise<void>;
    getOrGenerateTimestampReceiptFromCache(txId: string, cycleMarker: string, cycleCounter: CycleRecord['counter']): TimestampReceipt;
    pruneTxTimestampCache(): void;
    askTxnTimestampFromNode(txId: string): Promise<Shardus.TimestampReceipt | null>;
    private getTxTimestampGeneratingNode;
    /**
     * shareAppliedReceipt
     * gossip the appliedReceipt to the transaction group
     * @param queueEntry
     */
    /**
     * hasAppliedReceiptMatchingPreApply
     * check if our data matches our vote
     * If the vote was for an appliable, on failed result then check if our local data
     * that is ready to be committed will match the receipt
     *
     * @param queueEntry
     */
    hasAppliedReceiptMatchingPreApply(queueEntry: QueueEntry, signedReceipt: SignedReceipt): boolean;
    /**
     * tryProduceReceipt
     * try to produce an AppliedReceipt
     * if we can't do that yet return null
     *
     * @param queueEntry
     */
    tryProduceReceipt(queueEntry: QueueEntry): Promise<SignedReceipt>;
    robustQueryBestVote(queueEntry: QueueEntry): Promise<AppliedVote>;
    robustQueryAccountData(consensNodes: Shardus.Node[], accountId: string, txId: string): Promise<Shardus.WrappedData>;
    sortByAccountId(first: Shardus.WrappedResponse, second: Shardus.WrappedResponse): Ordering;
    checkAccountIntegrity(queueEntry: QueueEntry): Promise<boolean>;
    /**
     * createAndShareVote
     * create an AppliedVote
     * gossip the AppliedVote
     * @param queueEntry
     */
    createAndShareVote(queueEntry: QueueEntry): Promise<unknown>;
    calculateVoteHash(vote: Proposal): string;
    addPendingConfirmOrChallenge(queueEntry: QueueEntry, confirmOrChallenge: ConfirmOrChallengeMessage): void;
    /**
     * tryAppendVote
     * if we have not seen this vote yet search our list of votes and append it in
     * the correct spot sorted by signer's id
     * @param queueEntry
     * @param vote
     */
    tryAppendVote(queueEntry: QueueEntry, vote: AppliedVote): boolean;
    tryAppendVoteHash(queueEntry: QueueEntry, voteHash: AppliedVoteHash): boolean;
}
export default TransactionConsenus;
