review5 evm-mapping-bot integration - #199
Closed
tibfox wants to merge 3 commits into
Closed
Conversation
miloridenour
force-pushed
the
develop
branch
2 times, most recently
from
June 2, 2026 00:25
2928dea to
75c384f
Compare
…hardening) The contract's deposit-proof reader expects PER-RECEIPT logIndex (position within the tx's own Logs list, 0..N-1). The bare upstream bot wrote eth_getLogs's BLOCK-LEVEL index into the deposit payload — that's correct only by accident when a tx emits exactly one matching log. A multi-Transfer-log tx (e.g. one deposit that also triggers a token-side side-effect Transfer to the same vault) maps both logs to block-level indices that the contract treats as nonsense per-receipt positions -> deposit either crashes parsing or credits the wrong sender/amount, and on the surviving path collides on IsObserved -> permanently uncreditable. Fix lifted from review5 W4-A CRIT vsc-eco#14 + the wetransfer F2-bot hardening: - New lookupPerReceiptLogIndex(rpc, txHash, tokenAddr, vaultPaddedTopic, blockLogIndex) function. Fetches the receipt, finds the SPECIFIC log whose block-level logIndex matches the eth_getLogs entry, returns its per-receipt array position. Sanity-checks address/topics so a stale receipt or RPC mistake surfaces as an error rather than mis-resolving. - Caller (the scanBlock ERC-20 deposit emit loop) now calls lookupPerReceiptLogIndex and writes the resolved position. Skips the deposit with a slog.Warn on lookup failure (will be re-detected on the next scan of the same height). - F2 hardening: a non-standard RPC returning a log with no logIndex is rejected explicitly (hexToUint64("")==0 would otherwise silently match only block index 0, mis-resolving every multi-log tx). Reuses upstream's existing rpc.getReceipt + TransferEventSig + hexToUint64 (no new helpers introduced). Build clean: go build ./cmd/evm-mapping-bot/.
miloridenour
force-pushed
the
tibfox/review5-with-bot
branch
from
June 8, 2026 18:25
ee60617 to
0f4f60e
Compare
Collaborator
|
incorporated into #154 |
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.
Brings
cmd/evm-mapping-bot/onto currentdevelopplus the per-receiptlogIndexfix the contract reader requires.Commits on top of
develop@1ddfc681642371d2feature/evm-mapping-bot)488cd080ee606170Why the CRIT #C14 patch
eth_getLogsreturns BLOCK-levellogIndex; the deposit-proof contract reader expects PER-RECEIPT index (0..N-1 within the tx's own logs list). The bare bot writes block-level → wrong by accident when a tx has one matching log, broken when a tx emits twoTransfer(token → vault)logs (both deposits collide onIsObserved, second is permanently uncreditable).Adds
lookupPerReceiptLogIndex(...)to fetch the receipt, match the SPECIFIC log by its block-level index, and return its per-receipt array position. Reuses upstream's existingrpc.getReceipt/TransferEventSig/hexToUint64— no new helpers. F2 hardening: rejects non-standard RPCs that omitlogIndex(would otherwise silently match block index 0).Scope / coupling
go build ./cmd/evm-mapping-bot/clean;gofmtclean.cmd/evm-mapping-bot/.vsc-eco/account-mapping— must ship together.