!5321perf/evm-receipts-logsbloom-gate → develop7474e33dc4

Skip BSC receipts when the bloom and tx fields rule out observations

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

1commits
2files
794lines changed
110lines to read
BSConly chain changed
3verify flags

Where the diff is

Where the gate sits

BSC blocks now pass a gate before the receipts call.

getTxInevery BSC blockgasPricesWithoutReceiptsbloom, then tx fieldsunsuregetTxInOptimizedone receipts callobservationsand gas pricescleargas prices only, no RPC
new

3-minute explainer

What changed

The wasted call

Every block fetches receipts; 7 of 2,500 sampled had a router log.

Why the bloom

Whitelist off: a deposit's vault appears only in the router's log.

Four checks

Skip only if bloom, to, transfer recipient and sender are all clear.

  • router not in bloom
  • to not router or vault
  • transfer not to vault
  • sender not vault

If in doubt, fetch

Anything the block can't settle takes the old path.

Same chores

Skipped blocks clean signed items and report tip plus base fee.

Cheap senders

Reads the RPC's from, recovers on a miss, trusts the provider.

Live comparison

Author's run: 0 missed across 445 blocks; not re-run here.

Line by line · every changed logic line, narrated

4:48runtime
13code chapters
100%logic lines narrated (81/81)
7flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

Direct ERC20 inbound
A plain token transfer to a vault, observed from its Transfer log without the router. direct_erc20_transfer.go ↗
EVMDisableContractWhitelist
Mimir that, at 1, lets deposits arrive through any contract, so tx.To can't identify them.
logsBloom
A 2,048-bit filter in each block header over log addresses and topics. A miss proves absence; a hit may be false.
Observation
A tx Bifrost reports to THORChain, built here by receiptToTxInItem. evm_block_scanner.go ↗
Router
THORChain's EVM contract that takes deposits and emits the logs Bifrost parses. smartcontract_log_parser.go ↗
Signed tx item
Bifrost's record of an outbound it signed, removed once the tx appears in a block.
TSS
Threshold signing. The author's runs used a stub of the private module, so TSS-linked tests need CI.
Vault
An address controlled by THORChain's signers. Txs to or from one are observed. pubkey_manager.go ↗