Index Ethereum transactions submitted through revive.ethTransact - #339
Closed
F-OBrien wants to merge 1 commit into
Closed
Index Ethereum transactions submitted through revive.ethTransact#339F-OBrien wants to merge 1 commit into
revive.ethTransact#339F-OBrien wants to merge 1 commit into
Conversation
`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.
|
|
|
||
| # Fetch actual Chain ID from endpoint | ||
| echo "Fetching actual Chain ID..." | ||
| ACTUAL_CHAIN_ID=$(curl -k -s -H "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getBlockHash", "params":[0]}' "$HTTP_RPC" | jq -r '.result') |
| cache: 'yarn' | ||
|
|
||
| - name: install dependencies | ||
| run: yarn --immutable |
| cache: 'yarn' | ||
| cache-dependency-path: 'yarn.lock' | ||
| - name: install dependencies | ||
| run: yarn --immutable |
| START_BLOCK: 1 | ||
| NETWORK_ENDPOINT: 'ws://host.docker.internal:9944' | ||
| NETWORK_CHAIN_ID: '0xda7f2072787bfd0b09f7e12fca619afb6041b3d620f39f3a508814869100bf01' | ||
| run: yarn --immutable |
| cache: 'yarn' | ||
| - name: install dependencies | ||
| run: yarn --frozen-lockfile | ||
| run: yarn --immutable |
|
|
||
| # Install integration test packages | ||
| cd "$INTEGRATION_DIR" | ||
| yarn |
|
|
||
| # Install SQ packages | ||
| cd "$SQ_DIR" | ||
| yarn |
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
19_evm_transactions.sqlonly addsindexes/backfills columns for existing tables.
Testing
malformed-payload handling, revert flagging and account indexing.
yarn lint && yarn build && yarn test:unitgreen (178 tests).Breaking Changes
JIRA Link
Checklist