Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FirstUnprocessedBlock = `` /* 510-byte string literal not displayed */ UnlockBlocksForProcessing = `` /* 153-byte string literal not displayed */ // TakeXactLock acquires an exclusive lock (with lock ID $1), with custom semantics. // The lock is automatically unlocked at the end of the db transaction. TakeXactLock = ` SELECT pg_advisory_xact_lock($1)` PickBlocksForProcessing = `` /* 2253-byte string literal not displayed */ ProcessedSubrangeInfo = `` /* 941-byte string literal not displayed */ IsBlockProcessedBySlowSync = `` /* 197-byte string literal not displayed */ SoftEnqueueGapsInProcessedBlocks = `` /* 884-byte string literal not displayed */ IndexingProgress = `` /* 143-byte string literal not displayed */ NodeHeight = ` SELECT height FROM chain.latest_node_heights WHERE layer = $1` NodeHeightUpsert = `` /* 175-byte string literal not displayed */ ConsensusBlockUpsert = `` /* 627-byte string literal not displayed */ ConsensusBlockAddSigners = ` UPDATE chain.blocks SET signer_entity_ids = $2 WHERE height = $1` ConsensusEpochUpsert = `` /* 266-byte string literal not displayed */ ConsensusFastSyncEpochHeightInsert = ` INSERT INTO todo_updates.epochs (epoch, height) VALUES ($1, $2)` ConsensusEpochsRecompute = `` /* 375-byte string literal not displayed */ ConsensusTransactionInsert = `` /* 200-byte string literal not displayed */ ConsensusAccountUpsert = `` /* 769-byte string literal not displayed */ ConsensusAccountNonceUpsert = ` INSERT INTO chain.accounts(address, nonce) VALUES ($1, $2) ON CONFLICT (address) DO UPDATE SET nonce = $2` ConsensusAccountFirstActivityUpsert = `` /* 201-byte string literal not displayed */ ConsensusAccountsFirstActivityRecompute = `` /* 666-byte string literal not displayed */ ConsensusCommissionsUpsert = `` /* 159-byte string literal not displayed */ ConsensusEventInsert = `` /* 202-byte string literal not displayed */ ConsensusEscrowEventInsert = `` /* 162-byte string literal not displayed */ ConsensusRoothashMessageScheduleUpsert = `` /* 323-byte string literal not displayed */ ConsensusRoothashMessageFinalizeUpsert = `` /* 335-byte string literal not displayed */ ConsensusAccountRelatedTransactionInsert = ` INSERT INTO chain.accounts_related_transactions (account_address, tx_block, tx_index) VALUES ($1, $2, $3)` ConsensusAccountRelatedEventInsert = `` /* 146-byte string literal not displayed */ ConsensusRuntimeUpsert = `` /* 316-byte string literal not displayed */ ConsensusRuntimeSuspendedUpdate = ` UPDATE chain.runtimes SET suspended = $2 WHERE id = $1` ConsensusClaimedNodeInsert = ` INSERT INTO chain.claimed_nodes (entity_id, node_id) VALUES ($1, $2) ON CONFLICT (entity_id, node_id) DO NOTHING` ConsensusEntityUpsert = `` /* 201-byte string literal not displayed */ ConsensusNodeUpsert = `` /* 900-byte string literal not displayed */ ConsensusRuntimeNodesUpsert = ` INSERT INTO chain.runtime_nodes (runtime_id, node_id) VALUES ($1, $2) ON CONFLICT (runtime_id, node_id) DO NOTHING` ConsensusRuntimeNodesDelete = ` DELETE FROM chain.runtime_nodes WHERE node_id = $1` ConsensusNodeDelete = ` DELETE FROM chain.nodes WHERE id = $1` ConsensusEntityMetaUpsert = `` /* 188-byte string literal not displayed */ ConsensusIncreaseGeneralBalanceUpsert = `` /* 180-byte string literal not displayed */ ConsensusDecreaseGeneralBalanceUpsert = ` UPDATE chain.accounts SET general_balance = general_balance - $2 WHERE address = $1` ConsensusAddEscrowBalanceUpsert = `` /* 323-byte string literal not displayed */ ConsensusAddDelegationsUpsert = `` /* 189-byte string literal not displayed */ ConsensusTakeEscrowUpdateGuessRatio = `` /* 357-byte string literal not displayed */ ConsensusTakeEscrowUpdateExact = `` /* 186-byte string literal not displayed */ ConsensusDebondingStartEscrowBalanceUpdate = `` /* 332-byte string literal not displayed */ ConsensusDebondingStartDelegationsUpdate = ` UPDATE chain.delegations SET shares = shares - $3 WHERE delegatee = $1 AND delegator = $2` DELETE FROM chain.delegations WHERE delegatee = $1 AND delegator = $2 AND shares = 0` ConsensusDebondingStartDebondingDelegationsUpsert = `` /* 237-byte string literal not displayed */ ConsensusReclaimEscrowBalanceUpdate = `` /* 202-byte string literal not displayed */ // debond_end IN ($4::bigint, $4::bigint - 1, 0) is used because: // - Network upgrades delays debonding by 1 epoch. // - Some very old events might not have the debond_end set, so we have 0 in the Db. // This should not be problematic in practice since nowadays we have fast-sync where // we skip inserting debonding delegations for old epochs, so we should not encounter this. ConsensusDeleteDebondingDelegations = `` /* 156-byte string literal not displayed */ ConsensusAllowanceChangeDelete = ` DELETE FROM chain.allowances WHERE owner = $1 AND beneficiary = $2` ConsensusAllowanceOwnerUpsert = ` INSERT INTO chain.accounts (address) VALUES ($1) ON CONFLICT (address) DO NOTHING` ConsensusAllowanceChangeUpdate = `` /* 179-byte string literal not displayed */ ConsensusValidatorNodeResetVotingPowers = ` UPDATE chain.nodes SET voting_power = 0` ConsensusValidatorNodeUpdateVotingPower = ` UPDATE chain.nodes SET voting_power = $2 WHERE id = $1` ConsensusCommitteeMemberInsert = ` INSERT INTO chain.committee_members (node, valid_for, runtime, kind, role) VALUES ($1, $2, $3, $4, $5)` ConsensusCommitteeMembersTruncate = ` TRUNCATE chain.committee_members` ConsensusProposalSubmissionInsert = `` /* 280-byte string literal not displayed */ ConsensusProposalSubmissionCancelInsert = `` /* 186-byte string literal not displayed */ ConsensusProposalSubmissionChangeParametersInsert = `` /* 227-byte string literal not displayed */ ConsensusProposalExecutionsUpdate = ` UPDATE chain.proposals SET executed = true WHERE id = $1` ConsensusProposalUpdate = ` UPDATE chain.proposals SET state = $2 WHERE id = $1` ConsensusProposalInvalidVotesUpdate = ` UPDATE chain.proposals SET invalid_votes = $2 WHERE id = $1` ConsensusVoteUpsert = `` /* 197-byte string literal not displayed */ ValidatorStakingHistoryUnprocessedEpochs = `` /* 356-byte string literal not displayed */ ValidatorBalanceInsert = `` /* 213-byte string literal not displayed */ ValidatorStakingRewardUpdate = ` UPDATE history.validators SET staking_rewards = $3 WHERE id = $1 AND epoch = $2` EpochValidatorsUpdate = ` UPDATE chain.epochs SET validators = $2 WHERE id = $1` ValidatorStakingHistoryUnprocessedCount = `` /* 195-byte string literal not displayed */ RuntimeBlockInsert = `` /* 261-byte string literal not displayed */ RuntimeTransactionSignerInsert = `` /* 152-byte string literal not displayed */ RuntimeRelatedTransactionInsert = `` /* 128-byte string literal not displayed */ RuntimeAccountNumTxsUpsert = `` /* 193-byte string literal not displayed */ // Recomputes the number of related transactions for all runtime account in runtime $1. // Inteded for use after fast-sync that ran up to height $2 (inclusive). RuntimeAccountNumTxsRecompute = `` /* 422-byte string literal not displayed */ RuntimeAccountTotalSentUpsert = `` /* 201-byte string literal not displayed */ RuntimeAccountTotalSentRecompute = `` /* 431-byte string literal not displayed */ RuntimeAccountTotalReceivedUpsert = `` /* 213-byte string literal not displayed */ // $3 should be the symbol of the _native_ token. RuntimeAccountTotalReceivedRecompute = `` /* 473-byte string literal not displayed */ RuntimeTransactionInsert = `` /* 791-byte string literal not displayed */ // We use COALESCE here to avoid overwriting existing data with null values. RuntimeTransactionEvmParsedFieldsUpdate = `` /* 336-byte string literal not displayed */ RuntimeEventInsert = `` /* 241-byte string literal not displayed */ // We use COALESCE here to avoid overwriting existing data with null values. RuntimeEventEvmParsedFieldsUpdate = `` /* 335-byte string literal not displayed */ RuntimeMintInsert = `` /* 131-byte string literal not displayed */ RuntimeBurnInsert = `` /* 131-byte string literal not displayed */ RuntimeTransferInsert = `` /* 129-byte string literal not displayed */ RuntimeNativeBalanceUpsert = `` /* 220-byte string literal not displayed */ RuntimeNativeBalanceAbsoluteUpsert = `` /* 199-byte string literal not displayed */ AddressPreimageInsert = `` /* 158-byte string literal not displayed */ RuntimeEVMContractCreationUpsert = `` /* 245-byte string literal not displayed */ RuntimeEVMContractRuntimeBytecodeUpsert = `` /* 189-byte string literal not displayed */ RuntimeAccountGasForCallingUpsert = `` /* 214-byte string literal not displayed */ // Recomputes the total gas used for calling every runtime contract in runtime $1. // Inteded for use after fast-sync that ran up to height $2 (inclusive). RuntimeAccountGasForCallingRecompute = `` /* 546-byte string literal not displayed */ RuntimeEVMContractCodeAnalysisInsert = `` /* 149-byte string literal not displayed */ RuntimeEVMContractCodeAnalysisSetIsContract = ` UPDATE analysis.evm_contract_code SET is_contract = $3 WHERE runtime = $1 AND contract_candidate = $2` RuntimeEVMContractCodeAnalysisStale = `` /* 612-byte string literal not displayed */ RuntimeEVMContractCodeAnalysisStaleCount = `` /* 176-byte string literal not displayed */ RuntimeEVMTokenBalanceUpdate = `` /* 248-byte string literal not displayed */ RuntimeEVMTokenBalanceAnalysisMutateRoundUpsert = `` /* 331-byte string literal not displayed */ RuntimeFastSyncEVMTokenBalanceAnalysisMutateRoundInsert = `` /* 149-byte string literal not displayed */ // Recomputes the last round at which a token balance was known to mutate. // Inteded for use after fast-sync. RuntimeEVMTokenBalanceAnalysisMutateRoundRecompute = `` /* 492-byte string literal not displayed */ RuntimeEVMTokenAnalysisStale = `` /* 616-byte string literal not displayed */ RuntimeEVMTokenAnalysisStaleCount = `` /* 202-byte string literal not displayed */ // Upserts a new EVM token, but the column values are treated as deltas (!) to the existing values. // NOTE: Passing a 0 for last_mutate round causes that field to not be updated, effectively signalling // "this upsert does not create a need for a subsequent download of info from the EVM runtime". RuntimeEVMTokenDeltaUpsert = `` /* 354-byte string literal not displayed */ RuntimeFastSyncEVMTokenDeltaInsert = `` /* 154-byte string literal not displayed */ RuntimeEVMTokenRecompute = `` /* 646-byte string literal not displayed */ // Upserts a new EVM token with information that was downloaded from the EVM runtime (as opposed to dead-reckoned). RuntimeEVMTokenDownloadedUpsert = `` /* 503-byte string literal not displayed */ // Updates the total_supply of an EVM token with information that was downloaded from the EVM runtime (as opposed to dead-reckoned). RuntimeEVMTokenDownloadedTotalSupplyUpdate = ` UPDATE chain.evm_tokens SET total_supply = $3 WHERE runtime = $1 AND token_address = $2` // Updates the last_download_round of an EVM token. RuntimeEVMTokenDownloadRoundUpdate = ` UPDATE chain.evm_tokens SET last_download_round = $3 WHERE runtime = $1 AND token_address = $2` RuntimeEVMNFTUpdate = `` /* 277-byte string literal not displayed */ RuntimeEVMNFTUpsert = `` /* 215-byte string literal not displayed */ RuntimeEVMNFTUpdateTransfer = `` /* 169-byte string literal not displayed */ RuntimeEVMNFTAnalysisStale = `` /* 950-byte string literal not displayed */ RuntimeEVMNFTAnalysisStaleCount = `` /* 170-byte string literal not displayed */ RuntimeEVMTokenBalanceAnalysisStale = fmt.Sprintf(` WITH max_processed_round AS ( SELECT MAX(height) AS height FROM analysis.processed_blocks WHERE analyzer = ($1::runtime)::text AND processed_time IS NOT NULL ), stale_evm_tokens AS ( SELECT balance_analysis.token_address, balance_analysis.account_address, evm_tokens.token_type, COALESCE(evm_token_balances.balance, 0) AS balance, -- evm_token_balances entry can be absent in fast-sync mode token_preimage.context_identifier, token_preimage.context_version, token_preimage.address_data, account_preimage.context_identifier, account_preimage.context_version, account_preimage.address_data, max_processed_round.height AS download_round FROM max_processed_round, analysis.evm_token_balances AS balance_analysis -- No LEFT JOIN; we need to know the token's type to query its balance. -- We do not exclude tokens with type=0 (unsupported) so that we can move them off the DB index of stale tokens. JOIN chain.evm_tokens USING (runtime, token_address) LEFT JOIN chain.evm_token_balances USING (runtime, token_address, account_address) LEFT JOIN chain.address_preimages AS token_preimage ON token_preimage.address = balance_analysis.token_address LEFT JOIN chain.address_preimages AS account_preimage ON account_preimage.address = balance_analysis.account_address WHERE evm_tokens.token_type IS NOT NULL AND balance_analysis.runtime = $1 AND ( balance_analysis.last_download_round IS NULL OR balance_analysis.last_mutate_round > balance_analysis.last_download_round ) ), stale_native_tokens AS ( SELECT balance_analysis.token_address, balance_analysis.account_address, %d AS token_type, COALESCE(balances.balance, 0) AS balance, '' AS token_context_identifier, -1 AS token_context_version, ''::BYTEA AS token_address_data, account_preimage.context_identifier, account_preimage.context_version, account_preimage.address_data, max_processed_round.height AS download_round FROM max_processed_round, analysis.evm_token_balances AS balance_analysis LEFT JOIN chain.runtime_sdk_balances AS balances ON ( balances.runtime = balance_analysis.runtime AND balances.account_address = balance_analysis.account_address AND balances.symbol = $2 ) LEFT JOIN chain.address_preimages AS account_preimage ON account_preimage.address = balance_analysis.account_address WHERE balance_analysis.runtime = $1 AND balance_analysis.token_address = '%s' AND -- Native token "address" ( balance_analysis.last_download_round IS NULL OR balance_analysis.last_mutate_round > balance_analysis.last_download_round ) ) SELECT * FROM ( SELECT * FROM stale_evm_tokens UNION ALL SELECT * FROM stale_native_tokens ) foo LIMIT $3`, common.TokenTypeNative, evm.NativeRuntimeTokenAddress, ) RuntimeEVMTokenBalanceAnalysisStaleCount = `` /* 288-byte string literal not displayed */ RuntimeEVMTokenBalanceAnalysisUpdate = `` /* 167-byte string literal not displayed */ RuntimeEVMSwapPairUpsertCreated = `` /* 349-byte string literal not displayed */ RuntimeEVMSwapPairUpsertSync = `` /* 309-byte string literal not displayed */ RuntimeEVMUnverfiedContracts = `` /* 538-byte string literal not displayed */ RuntimeEVMVerifiedContracts = `` /* 186-byte string literal not displayed */ RuntimeEVMVerifyContractUpsert = `` /* 519-byte string literal not displayed */ RuntimeEvmVerifiedContractTxs = `` /* 821-byte string literal not displayed */ RuntimeEvmVerifiedContractEvents = `` /* 783-byte string literal not displayed */ RuntimeConsensusAccountTransactionStatusUpdate = `` /* 1309-byte string literal not displayed */ RuntimeConsensusAccountTransactionStatusUpdateFastSync = `` /* 194-byte string literal not displayed */ RuntimeTransactionStatusUpdatesRecompute = `` /* 1685-byte string literal not displayed */ )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.