-
Notifications
You must be signed in to change notification settings - Fork 721
Report filtered delayed transactions to filtering-report service - NIT-4644 #4632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
5d91439
2a36d7a
da4fbe2
50934a3
a615380
a19760a
0fd2625
110d981
01a3b5d
08f6070
53017e1
177a108
b5e169d
3ec0fd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import ( | |
| "math" | ||
| "math/big" | ||
|
|
||
| "github.com/ethereum/go-ethereum/arbitrum/filter" | ||
| "github.com/ethereum/go-ethereum/arbitrum_types" | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/core" | ||
|
|
@@ -42,9 +43,16 @@ var EmitTicketCreatedEvent func(*vm.EVM, [32]byte) error | |
|
|
||
| // ErrFilteredCascadingRedeem is returned via TxFailed when a redeem's | ||
| // inner execution touches a filtered address, requiring the entire tx group | ||
| // (originating user tx + all its redeems) to be reverted. | ||
| // (originating user tx + all its redeems) to be reverted. All fields are | ||
| // captured before the group rollback so TxFailed can build a fully populated | ||
| // FilteredTxReport without late-filling. | ||
| type ErrFilteredCascadingRedeem struct { | ||
| OriginatingTxHash common.Hash | ||
| OriginatingTx *types.Transaction | ||
| FilteredAddresses []filter.FilteredAddressRecord | ||
| BlockNumber uint64 | ||
| ParentBlockHash common.Hash | ||
| PositionInBlock int // receipt index of the originating user tx | ||
| } | ||
|
|
||
| func (e *ErrFilteredCascadingRedeem) Error() string { | ||
|
|
@@ -213,10 +221,10 @@ type SequencingHooks interface { | |
| // SupportsGroupRollback returns whether the hooks support checkpointing and | ||
| // rolling back a group of transactions (user tx + its scheduled redeems). | ||
| SupportsGroupRollback() bool | ||
| // PreTxFilter rejects a tx before execution. | ||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to remove this positionInBlock comment. |
||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to remove this positionInBlock comment. |
||
| PostTxFilter(*types.Header, *state.StateDB, *arbosState.ArbosState, *types.Transaction, common.Address, uint64, *core.ExecutionResult, int) error | ||
| // BlockFilter rejects an entire block after all txs have been applied. | ||
| BlockFilter(*types.Header, *state.StateDB, types.Transactions, types.Receipts) error | ||
| // TxSucceeded records that the last user tx from NextTxToSequence executed successfully. | ||
|
|
@@ -244,11 +252,11 @@ func (n *NoopSequencingHooks) NextTxToSequence() (*types.Transaction, *arbitrum_ | |
|
|
||
| func (n *NoopSequencingHooks) CanDiscardTx() bool { return false } | ||
|
|
||
| func (n *NoopSequencingHooks) PreTxFilter(config *params.ChainConfig, header *types.Header, db *state.StateDB, a *arbosState.ArbosState, transaction *types.Transaction, options *arbitrum_types.ConditionalOptions, address common.Address, info *L1Info) error { | ||
| func (n *NoopSequencingHooks) PreTxFilter(config *params.ChainConfig, header *types.Header, db *state.StateDB, a *arbosState.ArbosState, transaction *types.Transaction, options *arbitrum_types.ConditionalOptions, address common.Address, info *L1Info, positionInBlock int) error { | ||
| return nil | ||
| } | ||
|
|
||
| func (n *NoopSequencingHooks) PostTxFilter(header *types.Header, db *state.StateDB, a *arbosState.ArbosState, transaction *types.Transaction, address common.Address, u uint64, result *core.ExecutionResult) error { | ||
| func (n *NoopSequencingHooks) PostTxFilter(header *types.Header, db *state.StateDB, a *arbosState.ArbosState, transaction *types.Transaction, address common.Address, u uint64, result *core.ExecutionResult, positionInBlock int) error { | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -426,7 +434,7 @@ func ProduceBlockAdvanced( | |
|
|
||
| // Writes to statedb object should be avoided to prevent invalid state from permeating as statedb snapshot is not taken | ||
| if isUserTx { | ||
| if err = sequencingHooks.PreTxFilter(chainConfig, header, buildState.statedb, buildState.arbState, tx, options, sender, l1Info); err != nil { | ||
| if err = sequencingHooks.PreTxFilter(chainConfig, header, buildState.statedb, buildState.arbState, tx, options, sender, l1Info, len(buildState.receipts)); err != nil { | ||
| return nil, nil, err | ||
| } | ||
| } | ||
|
|
@@ -489,7 +497,7 @@ func ProduceBlockAdvanced( | |
| &header.GasUsed, | ||
| runCtx, | ||
| func(result *core.ExecutionResult) error { | ||
| if err := sequencingHooks.PostTxFilter(header, buildState.statedb, buildState.arbState, tx, sender, dataGas, result); err != nil { | ||
| if err := sequencingHooks.PostTxFilter(header, buildState.statedb, buildState.arbState, tx, sender, dataGas, result, len(buildState.receipts)); err != nil { | ||
| return err | ||
| } | ||
| // Additional post-transaction validity check | ||
|
|
@@ -519,11 +527,21 @@ func ProduceBlockAdvanced( | |
| // active group checkpoint, roll back the entire group (user tx + all | ||
| // redeems) to the pre-group state. | ||
| if !isUserTx && buildState.activeGroupCP != nil && errors.Is(err, state.ErrArbTxFilter) { | ||
| userTxHash := buildState.activeGroupCP.userTxHash | ||
| // Capture everything before rollback — addressCheckerStateß | ||
| cp := buildState.activeGroupCP | ||
| _, filteredAddresses := buildState.statedb.IsAddressFiltered() | ||
| originatingTx := buildState.complete[cp.completeLen] | ||
|
mahdy-nasr marked this conversation as resolved.
Outdated
|
||
| if err := buildState.rollbackToGroupCheckpoint(header); err != nil { | ||
| return nil, nil, nil, err | ||
| } | ||
| sequencingHooks.TxFailed(&ErrFilteredCascadingRedeem{OriginatingTxHash: userTxHash}) | ||
| sequencingHooks.TxFailed(&ErrFilteredCascadingRedeem{ | ||
| OriginatingTxHash: cp.userTxHash, | ||
| OriginatingTx: originatingTx, | ||
| FilteredAddresses: filteredAddresses, | ||
| BlockNumber: header.Number.Uint64(), | ||
| ParentBlockHash: header.ParentHash, | ||
| PositionInBlock: cp.receiptsLen, | ||
| }) | ||
| continue | ||
| } | ||
| if isUserTx { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ### Added | ||
| - Report filtered delayed transactions to filtering-report service with structured FilteredTxReport |
Uh oh!
There was an error while loading. Please reload this page.