Report filtered delayed transactions to filtering-report service - NIT-4644#4632
Report filtered delayed transactions to filtering-report service - NIT-4644#4632mahdy-nasr wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends delayed-transaction filtering to emit structured FilteredTxReport payloads to the filtering-report service (in addition to reporting hashes to the transaction-filterer), replacing the prior “just collect tx hashes” approach in delayed sequencing.
Changes:
- Replace
FilteredTxHashes []common.HashwithpendingFilteredTxReports []FilteredTxReportin delayed sequencing hooks and enrich reports with tx RLP + delayed inbox request id. - Add non-blocking reporting of structured filtered-tx reports to the filtering-report RPC service while still reporting hashes to the transaction-filterer RPC.
- Adjust a system test call-value constant and update
FilteredTxReport.PositionInBlocktype.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| system_tests/retryable_tickets_filtering_test.go | Updates a call-value constant used in a delayed filtering cascade system test. |
| execution/gethexec/executionengine.go | Builds and reports FilteredTxReport entries for filtered delayed txs; continues reporting hashes to the filterer; halts delayed sequencing on filtered activity. |
| execution/gethexec/addressfilter/filter_report.go | Changes PositionInBlock type on the report struct. |
| changelog/mnasr-nit-4644.md | Adds changelog entry for structured filtered delayed-tx reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4632 +/- ##
==========================================
- Coverage 55.94% 48.80% -7.15%
==========================================
Files 506 506
Lines 73739 73800 +61
==========================================
- Hits 41252 36015 -5237
- Misses 27271 32788 +5517
+ Partials 5216 4997 -219 |
❌ 9 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
| } else { | ||
| report.TxRLP = hexutil.Bytes(txRLP) | ||
| } | ||
| } |
There was a problem hiding this comment.
nit: Add a log when the hash is not found
There was a problem hiding this comment.
in this else branch, tx.MarshalBinary() succeeded. So we won't need logging. the if part that handle failed case already do logging.
There was a problem hiding this comment.
I meant the case where txByHash does not contain report.TxHash (the outer if tx, ok := txByHash[report.TxHash]; ok check). Even if that path is unreachable with the current code, the logic is spread across components, so adding a log in the else branch would make it less fragile and easier to debug
diegoximenes
left a comment
There was a problem hiding this comment.
Let's extend some filtering tests to check that cmd/filtering-report is properly logging filtered transactions.
In a future PR those tests will be extended to check if the external endpoint, that cmd/filtering-report calls, received the filtered transaction report.
There was a problem hiding this comment.
I didn't do a full review round this time, but as discussed here and in a meeting, since design review can take a while, let's implement the discussed test scenarios in this PR
|
I updated the PR split the txFilteredHashes from reporting lists. But I have one concern came to my mind (in case this error scenario of But anyway, lets stick these changes so we can move forward. |
diegoximenes
left a comment
There was a problem hiding this comment.
- There is an issue reported by the CI that should be addressed.
- Master was updated, chain id is now included in the report struct, which affects this PR
| PreTxFilter(*params.ChainConfig, *types.Header, *state.StateDB, *arbosState.ArbosState, *types.Transaction, *arbitrum_types.ConditionalOptions, common.Address, *L1Info) error | ||
| // PostTxFilter rejects a tx after execution. | ||
| PostTxFilter(*types.Header, *state.StateDB, *arbosState.ArbosState, *types.Transaction, common.Address, uint64, *core.ExecutionResult) error | ||
| // PreTxFilter rejects a tx before execution. positionInBlock is len(receipts) at call time. |
There was a problem hiding this comment.
Better to remove this positionInBlock comment.
Arguments are not named here.
| PostTxFilter(*types.Header, *state.StateDB, *arbosState.ArbosState, *types.Transaction, common.Address, uint64, *core.ExecutionResult) error | ||
| // PreTxFilter rejects a tx before execution. positionInBlock is len(receipts) at call time. | ||
| PreTxFilter(*params.ChainConfig, *types.Header, *state.StateDB, *arbosState.ArbosState, *types.Transaction, *arbitrum_types.ConditionalOptions, common.Address, *L1Info, int) error | ||
| // PostTxFilter rejects a tx after execution. positionInBlock is len(receipts) at call time. |
There was a problem hiding this comment.
Better to remove this positionInBlock comment.
Arguments are not named here.
|
|
||
| // mockFilteringReportAPI is a test mock that records reports received via the | ||
| // filteringreport_reportFilteredTransactions RPC endpoint. | ||
| type mockFilteringReportAPI struct { |
There was a problem hiding this comment.
We can use the mocked external endpoint instead of mocked filtering report api.
|
|
||
| // Core identity | ||
| require.Equal(t, txHash, report.TxHash) | ||
| require.NotEmpty(t, report.ID) |
| require.NotNil(t, report.DelayedReportData, "delayed report data should be set") | ||
|
|
||
| // TxRLP should be populated | ||
| require.NotEmpty(t, report.TxRLP, "TxRLP should be populated") |
There was a problem hiding this comment.
Check it can be unmarshalled.
| require.Equal(t, txHash, report.TxHash) | ||
| require.NotEmpty(t, report.ID) | ||
| require.True(t, report.IsDelayed) | ||
| require.NotNil(t, report.DelayedReportData, "delayed report data should be set") |
There was a problem hiding this comment.
Check content of the field.
| delayedBridge, err := arbnode.NewDelayedBridge(builder.L1.Client, builder.L1Info.GetAddress("Bridge"), 0) | ||
| require.NoError(t, err) | ||
|
|
||
| lookupL2Tx := func(l1Receipt *types.Receipt) *types.Transaction { |
There was a problem hiding this comment.
There is a getLookupL2Tx func already, can't be used here?
| // TxRLP should be populated | ||
| require.NotEmpty(t, report.TxRLP, "TxRLP should be populated") | ||
|
|
||
| // Block metadata: block number non-zero, parent block hash matches block N-1 |
There was a problem hiding this comment.
Abstract that into a function
FilteredTxHashes []common.HashwithpendingFilteredTxReports []FilteredTxReportinDelayedFilteringSequencingHookscloses #NIT-4644