Index Ethereum transactions submitted through revive.ethTransact - #342
Open
F-OBrien wants to merge 5 commits into
Open
Index Ethereum transactions submitted through revive.ethTransact#342F-OBrien wants to merge 5 commits into
revive.ethTransact#342F-OBrien wants to merge 5 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
`eth_transact` is an unsigned extrinsic wrapping an RLP encoded Ethereum transaction, so its sender was never recorded. Decode the payload, recover the signing key with secp256k1 and attribute the extrinsic to the derived `0xEE` padded account, alongside a new EvmTransaction entity capturing the decoded transaction and an EvmAccountMapping entity for `revive.mapAccount`. Includes an offline backfill script for historical rows.
…bles - only read/write current revisions (upper(_block_range) is null); closed revisions untouched so point-in-time queries keep their era - keyset pagination on _id (id is not unique under historical mode) - account insert supplies _id/_block_range explicitly and replaces ON CONFLICT (no unique constraint on id) with an existence check, counted via returning id - batched transactions, precise --limit, DB creds via DB_* env only - extract the constraints into a shared scripts/backfill/historical.ts helper
Migration 20 defaulted every pre-existing account to `substrate`, but Ethereum keys were attributed long before eth_transact was indexed - registering a DID or joining an identity emits the 0xEE padded SS58 like any other key. Postgres cannot tell them apart, so the backfill decodes every account offline: all get the evm_address pallet_revive addresses them by, and the 0xEE padded ones get key_type = 'ethereum'.
Three call sites repeated `isEthTransact(x) ? resolveEthTransact(x) : undefined`. Moving the check inside the resolver collapses them to a plain call, drops a nested conditional in handleExtrinsic, and skips the memo for non-eth extrinsics.
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
revive.ethTransactis included as an unsigned extrinsic wrapping an RLP encoded Ethereumtransaction. The indexer recorded it with
address: null, so nothing could be attributed to theEthereum-derived account that sent it, breaking downstream transaction-history reads.
Changes
src/utils/ethTransaction.ts,src/utils/eth.ts): RLP-decode legacy(pre-EIP-155 & EIP-155), EIP-2930 and EIP-1559 payloads, reconstruct the signing payload,
recover the signer via
secp256k1Recover, and map the H160 to its0xEE-padded SS58 account.All failure modes log-and-skip; handlers never throw into the pipeline.
Extrinsic.addressnow carries the recovered account (signedstays0,marking an ECDSA-recovered sender), plus new
ethAddress/ethTxHashcolumns. Runtime callstargeting
modlpy/paddrare normalised to the pallet/call actually dispatched, and revertedtransactions are marked unsuccessful via
revive.EthExtrinsicRevert.EvmTransaction(full decoded transaction incl. calldata, gas fields,revert state) and
EvmAccountMapping(H160 → AccountId32 mappings fromrevive.mapAccountextrinsics and genesis config).
AccountgainskeyType/evmAddress.scripts/backfill/eth-transact-senders.ts): recovers historical senders offlinefrom stored payloads and upserts accounts. Dry-run by default,
--applyto write.Deployment notes
20_evm_transactions.sqlonly addsindexes/backfills columns for existing tables.
yarn ts-node scripts/backfill/eth-transact-senders.ts(dry run first, then--apply).Testing
malformed-payload handling, revert flagging and account indexing.
yarn lint && yarn build && yarn test:unitgreen (178 tests).Breaking Changes
JIRA Link
Checklist