import { Database } from '../database/database'; import { Chain } from '../models/engine-types'; import { MerklerootValidator } from '../models/merkletree-types'; import { Merkletree } from './merkletree'; import { TXIDMerkletreeData, RailgunTransactionWithHash, MerkleProof } from '../models/formatted-types'; import { TXIDVersion } from '../models'; type POILaunchSnapshotNode = { hash: string; index: number; }; export declare class TXIDMerkletree extends Merkletree { protected merkletreePrefix: string; protected merkletreeType: string; shouldStoreMerkleroots: boolean; shouldSavePOILaunchSnapshot: boolean; savedPOILaunchSnapshot: Optional; private constructor(); /** * Wallet validates merkleroots against POI Nodes. */ static createForWallet(db: Database, chain: Chain, txidVersion: TXIDVersion, merklerootValidator: MerklerootValidator): Promise; /** * POI Node is the source of truth, so it will not validate merkleroots. * Instead, it will process every tree update individually, and store each in the database. */ static createForPOINode(db: Database, chain: Chain, txidVersion: TXIDVersion): Promise; /** * Gets Railgun Transaction data from txid tree. */ getRailgunTransaction(tree: number, index: number): Promise>; getGlobalUTXOTreePositionForRailgunTransactionCommitment(tree: number, index: number, commitmentHash: string): Promise; getRailgunTxidCurrentMerkletreeData(railgunTxid: string): Promise; getMerkleProofWithSnapshot(snapshotLeaf: POILaunchSnapshotNode, tree: number, index: number): Promise; railgunTxidOccurredBeforeBlockNumber(tree: number, index: number, blockNumber: number): Promise; getLatestRailgunTransaction(): Promise>; queueRailgunTransactions(railgunTransactionsWithTxids: RailgunTransactionWithHash[], maxTxidIndex: Optional): Promise; static isOutOfBounds(tree: number, index: number, maxTxidIndex?: number): boolean; static nextTreeAndIndex(tree: number, index: number): { tree: number; index: number; }; private savePOILaunchSnapshotIfNecessary; private hasSavedPOILaunchSnapshot; getPOILaunchSnapshotNode(level: number): Promise>; private static getRightmostNonzeroIndices; private savePOILaunchSnapshot; clearLeavesForInvalidVerificationHash(numLeavesToClear: number): Promise; clearLeavesAfterTxidIndex(txidIndex: number): Promise; getCurrentTxidIndex(): Promise; protected validRootCallback(): Promise; protected invalidRootCallback(): Promise; private getPOILaunchSnapshotNodeDBPath; private getRailgunTxidLookupDBPath; getTxidIndexByRailgunTxid(railgunTxid: string): Promise>; getRailgunTransactionByTxid(railgunTxid: string): Promise>; /** * Durable resume point for the Action-event RPC scan. * * The tree stores records, not scanned blocks, so without this every sync restarts the * scan at the newest record's block and re-walks [newest-record-block, chain tip] from * scratch. On a sparse chain that is the dominant recurring cost - arbitrum carries ~0.4 * records per 1,000 blocks, so the re-walk is almost entirely empty. * * Durability is exactly what makes this dangerous if it is ever ahead of the records it * claims to account for, so it is cleared on every rewind (clearLeavesAfterTxidIndex) * and on a full wipe (clearDataForMerkletree). Absent means "resume from the record * cursor", which is always safe and is what the engine did before this existed. */ private getActionScanBlockDBPath; /** * A full wipe removes every record the block cursor was accounting for. */ clearDataForMerkletree(): Promise; getActionScanBlock(): Promise>; setActionScanBlock(blockNumber: number): Promise; clearActionScanBlock(): Promise; private getHistoricalMerklerootDBPath; protected newLeafRootTrigger(tree: number, index: number, leaf: string, merkleroot: string): Promise; getHistoricalMerkleroot(tree: number, index: number): Promise>; getHistoricalMerklerootForTxidIndex(txidIndex: number): Promise>; } export {};