Commit 0d4147a
committed
Address filtering for retryable submissions, redeems, and delayed events
Extend address filtering to cover ArbitrumSubmitRetryableTx, retryable
redeem execution, and event-based filtering in the delayed message path.
What was missing
----------------
ArbitrumSubmitRetryableTx filtering: PostTxFilter touches sender and tx.To()
but not the retryable-specific fields (Beneficiary, FeeRefundAddr, RetryTo).
When the onchain filter contains the tx hash, StartTxHook had no handling
for the retryable case, so funds would flow to filtered addresses.
Redeem inner execution filtering: When a retryable is redeemed (auto or
manual), the ArbitrumRetryTx runs with hooks = nil in the block processor,
so PostTxFilter never fires. The EVM execution touches filtered addresses
via PushContract/opSelfdestruct but nobody checks IsAddressFiltered()
afterwards.
Event filter in delayed path: The event filter (Transfer, TransferSingle,
TransferBatch log scanning) only ran in the sequencer's postTxFilter, not
in DelayedFilteringSequencingHooks.PostTxFilter.
Solution
--------
Filtered retryable redirect: In StartTxHook for ArbitrumSubmitRetryableTx,
when the tx hash is in the onchain filter, redirect Beneficiary and
FeeRefundAddr to a configurable filteredFundsRecipient (new ArbOS state
field, with ArbOwner precompile accessors, fallback to networkFeeAccount).
Skip auto-redeem scheduling. Set ErrFilteredTx as result.Err so PostTxFilter
knows to skip re-halting.
RedeemFilter: New RedeemFilter(*state.StateDB) error method on the
SequencingHooks interface. Called in the block processor's result filter
closure when the current tx is a redeem. Runs the event filter on logs then
checks IsAddressFiltered(). Returns ErrArbTxFilter to revert the snapshot
and drop the redeem from the block.
Delayed event filter: Pass the event filter to
DelayedFilteringSequencingHooks. Shared applyEventFilter() helper called in
both PostTxFilter and RedeemFilter.
PostTxFilter retryable field touching: New touchRetryableAddresses() helper
touches Beneficiary, FeeRefundAddr, RetryTo, and their de-aliased versions
(InverseRemapL1Address). Called in both sequencer and delayed PostTxFilter.
Design Decisions
----------------
Redirect instead of reject: Retryable submissions are L1 delayed messages
that cannot be rejected. Funds are already deposited on L2. Rejecting would
leave them stuck in escrow with an unreachable beneficiary.
Skip auto-redeem for filtered retryables: The RetryData calldata may target
filtered addresses. The redirected beneficiary can manually redeem if
appropriate.
ErrFilteredTx in result.Err: Without this marker, PostTxFilter sees the
original (still-filtered) Beneficiary via touchRetryableAddresses and
re-halts. The error signals that the onchain filter already handled this tx.
RedeemFilter via sequencingHooks not hooks: hooks is intentionally nil for
redeems - it gates sequencer policies (PreTxFilter nonce checking,
PostTxFilter nonce cache updates/revert gas rejection, InsertLastTxError,
DiscardInvalidTxsEarly) that don't apply to protocol-scheduled transactions.
RedeemFilter is called on sequencingHooks (the function parameter, always
non-nil) directly to get only the narrow redeem filtering behavior.
Dropping redeems is safe: State reverts via RevertToSnapshot. The retryable
ticket survives (DeleteRetryable only runs on successful redeem in
EndTxHook). Ticket can be manually redeemed later or expires to beneficiary.
This is a sequencing-level decision - NoopSequencingHooks.RedeemFilter
returns nil during replay/validation.
De-aliased address touching: The L1 Inbox aliases contract addresses for
Beneficiary and FeeRefundAddr. We touch both the aliased and original
(InverseRemapL1Address) versions so filtering catches the L1 address.
DeleteFree commented out: For symmetry with other filtered tx paths,
deletion from the onchain filter is handled by the external tx authority
service.
Tests (11 new):
---------------
Retryable redirect (halt-and-wait pattern):
- TestFilteredRetryableRedirectWithExplicitRecipient
- TestFilteredRetryableRedirectFallbackToNetworkFee
- TestFilteredRetryableNoRedirectWhenNotFiltered
- TestFilteredRetryableWithCallValue
- TestFilteredRetryableSequencerDoesNotReHalt
RedeemFilter (verify redeem dropped, ticket survives):
- TestRetryableAutoRedeemCallsFilteredAddress
- TestRetryableAutoRedeemCreatesAtFilteredAddress
- TestRetryableAutoRedeemSelfDestructsToFilteredAddress
- TestRetryableAutoRedeemStaticCallsFilteredAddress
- TestRetryableAutoRedeemEmitsTransferToFilteredAddress
- TestDelayedMessageFilterCatchesEventFilter
Delayed event filter:
- TestDelayedMessageFilterCatchesEventFilter1 parent 10838b6 commit 0d4147a
File tree
6 files changed
+1008
-27
lines changed- arbos
- contracts-local/src/mocks
- execution/gethexec
- system_tests
6 files changed
+1008
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
156 | 161 | | |
157 | 162 | | |
158 | 163 | | |
| |||
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| 269 | + | |
263 | 270 | | |
264 | 271 | | |
265 | 272 | | |
| |||
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
378 | 393 | | |
379 | 394 | | |
380 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
210 | 235 | | |
211 | 236 | | |
212 | 237 | | |
| |||
306 | 331 | | |
307 | 332 | | |
308 | 333 | | |
309 | | - | |
| 334 | + | |
310 | 335 | | |
311 | 336 | | |
312 | 337 | | |
| |||
323 | 348 | | |
324 | 349 | | |
325 | 350 | | |
326 | | - | |
| 351 | + | |
327 | 352 | | |
328 | 353 | | |
329 | 354 | | |
330 | 355 | | |
331 | 356 | | |
332 | 357 | | |
333 | 358 | | |
334 | | - | |
| 359 | + | |
335 | 360 | | |
336 | 361 | | |
337 | 362 | | |
| |||
348 | 373 | | |
349 | 374 | | |
350 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
351 | 384 | | |
352 | 385 | | |
353 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | | - | |
101 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
| |||
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
| 118 | + | |
| 119 | + | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
| |||
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
127 | 171 | | |
128 | 172 | | |
129 | 173 | | |
| |||
170 | 214 | | |
171 | 215 | | |
172 | 216 | | |
| 217 | + | |
173 | 218 | | |
174 | 219 | | |
175 | 220 | | |
| |||
828 | 873 | | |
829 | 874 | | |
830 | 875 | | |
831 | | - | |
| 876 | + | |
832 | 877 | | |
833 | 878 | | |
834 | 879 | | |
| |||
1238 | 1283 | | |
1239 | 1284 | | |
1240 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1241 | 1290 | | |
1242 | 1291 | | |
1243 | 1292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
783 | 784 | | |
784 | 785 | | |
785 | 786 | | |
| 787 | + | |
786 | 788 | | |
787 | 789 | | |
788 | 790 | | |
| |||
810 | 812 | | |
811 | 813 | | |
812 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
813 | 823 | | |
814 | 824 | | |
815 | 825 | | |
| |||
962 | 972 | | |
963 | 973 | | |
964 | 974 | | |
| 975 | + | |
965 | 976 | | |
966 | 977 | | |
967 | 978 | | |
| |||
1068 | 1079 | | |
1069 | 1080 | | |
1070 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1071 | 1089 | | |
1072 | 1090 | | |
1073 | 1091 | | |
| |||
1080 | 1098 | | |
1081 | 1099 | | |
1082 | 1100 | | |
| 1101 | + | |
1083 | 1102 | | |
1084 | 1103 | | |
1085 | 1104 | | |
| |||
1089 | 1108 | | |
1090 | 1109 | | |
1091 | 1110 | | |
| 1111 | + | |
1092 | 1112 | | |
1093 | 1113 | | |
1094 | 1114 | | |
| |||
1113 | 1133 | | |
1114 | 1134 | | |
1115 | 1135 | | |
| 1136 | + | |
1116 | 1137 | | |
1117 | 1138 | | |
1118 | 1139 | | |
| |||
1370 | 1391 | | |
1371 | 1392 | | |
1372 | 1393 | | |
| 1394 | + | |
1373 | 1395 | | |
1374 | 1396 | | |
1375 | 1397 | | |
| |||
0 commit comments