chain/ethereum: OR-merge receipt requirements in EthereumLogFilter#6558
Open
incrypto32 wants to merge 2 commits intomasterfrom
Open
chain/ethereum: OR-merge receipt requirements in EthereumLogFilter#6558incrypto32 wants to merge 2 commits intomasterfrom
incrypto32 wants to merge 2 commits intomasterfrom
Conversation
Cover all six insertion sites (from_data_sources arms, from_mapping, extend) and assert OR semantics across the three internal collections (contracts_and_events_graph, wildcard_events, events_with_topic_filters). Tests use two assertion helpers (assert_from_data_sources_or_merges and assert_extend_or_merges) parameterized over the match-arm or collection variant. Each helper runs both insertion orders so order-independence is verified per variant. The OR-semantics property test catches any flag-sequence regression.
Wrap the three EthereumLogFilter collections in MergeMap and MergeGraph newtypes whose only mutators (or_insert / or_add_edge) OR-combine the bool weight with any existing value at the same key. The inner HashMap and GraphMap are private, so callers cannot bypass the merge by going through HashMap::insert or GraphMap::add_edge. When two handlers collide on the same filter key with differing receipt flags, the merged value is now the logical OR rather than the last write. Handlers that declared receipt: true now reliably receive transaction receipts even when another handler at the same key declared receipt: false.
b843c69 to
a82f63d
Compare
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.
Summary
EthereumLogFiltermerged per-handlerreceipt: boolflags using overwrite semantics, so when two handlers collided on the same filter key with differentreceiptflags, a laterfalsewould silently drop a priortrue. Handlers that declaredreceipt: truethen ran withevent.receipt == null.Wrap the three internal collections in
MergeMap/MergeGraphnewtypes whose only mutators OR-combine values, and updatefrom_data_sources,from_mapping, andextendto use them.Triggers when a manifest has two handlers at the same effective filter key (e.g. same
(contract, event)) with differentreceiptflags.