Skip to content

Index Ethereum transactions submitted through revive.ethTransact - #339

Closed
F-OBrien wants to merge 1 commit into
PolymeshAssociation:alphafrom
F-OBrien:ethTransact
Closed

Index Ethereum transactions submitted through revive.ethTransact#339
F-OBrien wants to merge 1 commit into
PolymeshAssociation:alphafrom
F-OBrien:ethTransact

Conversation

@F-OBrien

Copy link
Copy Markdown
Contributor

Description

revive.ethTransact is included as an unsigned extrinsic wrapping an RLP encoded Ethereum
transaction. The indexer recorded it with address: null, so nothing could be attributed to the
Ethereum-derived account that sent it, breaking downstream transaction-history reads.

Changes

  • Sender recovery (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 its 0xEE-padded SS58 account.
    All failure modes log-and-skip; handlers never throw into the pipeline.
  • Attribution: Extrinsic.address now carries the recovered account (signed stays 0,
    marking an ECDSA-recovered sender), plus new ethAddress / ethTxHash columns. Runtime calls
    targeting modlpy/paddr are normalised to the pallet/call actually dispatched, and reverted
    transactions are marked unsuccessful via revive.EthExtrinsicRevert.
  • New entities: EvmTransaction (full decoded transaction incl. calldata, gas fields,
    revert state) and EvmAccountMapping (H160 → AccountId32 mappings from revive.mapAccount
    extrinsics and genesis config). Account gains keyType / evmAddress.
  • Backfill (scripts/backfill/eth-transact-senders.ts): recovers historical senders offline
    from stored payloads and upserts accounts. Dry-run by default, --apply to write.

Deployment notes

  • New tables/columns are auto-created by the node; migration 19_evm_transactions.sql only adds
    indexes/backfills columns for existing tables.
  • Run the backfill once after deploying the forward fix.

Testing

  • New unit suites cover all three transaction formats (incl. access-list re-encoding),
    malformed-payload handling, revert flagging and account indexing.
  • yarn lint && yarn build && yarn test:unit green (178 tests).

Breaking Changes

JIRA Link

Checklist

  • Updated the Readme.md (if required) ?

`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.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Security Rating on New Code (required ≥ A)
17 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Comment thread scripts/index-one.sh

# 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
@F-OBrien
F-OBrien changed the base branch from develop to alpha August 24, 2026 11:41
@F-OBrien
F-OBrien requested a review from a team as a code owner August 24, 2026 11:41
@F-OBrien F-OBrien closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants