Skip to content

note(txverifier): EVM Transfer Verifier Improvements - #5110

Open
pleasew8t wants to merge 8 commits into
wormhole-foundation:mainfrom
pleasew8t:evm-transfer-verifier-improvements
Open

pleasew8t wants to merge 8 commits into
wormhole-foundation:mainfrom
pleasew8t:evm-transfer-verifier-improvements

Conversation

@pleasew8t

Copy link
Copy Markdown
Contributor

This pull request brings some improvements to the EVM transfer verifier in preparation for enabling it.

Summary of Changes By Commit

Move nil-checks prior to dereferences

  • There were two instances where pointers were being dereferenced before their nil-checks.

Add thread-safe map wrapper and apply to decimalsCache

  • Introduces a new lockedMap type, which is a thread-safe wrapper around maps.
  • Applies the wrapper to the decimalsCache cache, as a first phase.

Apply lockedMap thread-safe wrapper to chainId, isWrapped and nativeContract caches

  • Applies the lockedMap type to the remaining caches.
  • This also removes the old deleteEntries function (including its tests).
  • The deleteEntries pruning feature is replaced by the PruneIfFull method on the lockedMap.

Add specialized evaluation lockedMap to support pruning block-relative receipts

  • Addresses the cache concurrency issues associated with the evaluations cache.
  • The reason for the specialized type is so that it can include the special PruneOlderThan method.
  • Added SetIfAbsent to atomically add a new key if it doesn't exist.

Make lastBlockNumber thread-safe

  • Makes lastBlockNumber an atomic uint64.
  • Adds the new updateLastBlockNumber function to the TransferVerifier.
  • updateLastBlockNumber's goal is to ensure that the lastBlockNumber is monotonically increasing, and covers an edge cases where a racing goroutine could set the value to lower than what is actually latest.

Ensure the originAddr is compared to a full 32-byte zero word

  • Prior to this fix, the zero-check in nativeContract() would actually always evaluate to false.
  • This is because ZERO_ADDRESS is 20 bytes, versus the 32-byte word returned from the RPC call.

Ensure only relevant deposits and ERC20 transfers are processed by updateReceiptDetails

  • There was an issue where a flaky getDecimals() or isWrapped() call could result in a transfer getting delayed by the Notary.
  • This commit ensures that any deposits or ERC20 transfers that aren't relevant to the bridge transfer are removed from this path.
  • This change has the added benefit of ignoring RPC calls for irrelevant tokens.

Update evaluation keying to include blockhash and avoid unwanted reorg behaviour

  • Prior to this change, the EVM transfer verifier was keying evaluations using transaction hash alone.
  • Following a reorg, the same transaction hash could represent a different message ID, and resulted in ErrCachedReceiptHasNoDataForMessage being returned.
  • The only caveat is that a transaction receipt is now retrieved over RPC before checking the cache, which may be necessary when a receipt isn't supplied.

Review Notes

The commits have been structured to follow the changes listed above, so that reviewing each commit in order groups together changes linked to the same idea. The changes to pay special attention to include the lockedMap implementation, the lastBlockNumber thread-safety changes, and the last two commits that touch relevance-checking and evaluation-keying.

@pleasew8t pleasew8t changed the title EVM Transfer Verifier Improvements note(txverifier): EVM Transfer Verifier Improvements Nov 11, 2026

This branch has not been deployed

No deployments
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.

1 participant