supervisor and testing: interop: reorg-testing: reorg a chain with invalid exec msg#15662
supervisor and testing: interop: reorg-testing: reorg a chain with invalid exec msg#15662protolambda merged 7 commits intodevelopfrom
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
634b813 to
84e2be5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #15662 +/- ##
============================================
- Coverage 81.40% 0 -81.41%
============================================
Files 161 0 -161
Lines 8812 0 -8812
============================================
- Hits 7173 0 -7173
+ Misses 1506 0 -1506
+ Partials 133 0 -133
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
0d7179d to
45f199e
Compare
45f199e to
0083532
Compare
|
An identifier that has a chain id not in the dep set should 100% trigger a reorg, it is a bug if it does not |
|
@tynes thanks for the clarification, I will investigate further why no reorg is triggered and see how to fix this! For reference, the relevant part of the code is: https://github.com/ethereum-optimism/optimism/pull/15662/files#diff-9a44438696e317ca53bc4a82b8bfc9fc1b6de6da787d3230aa4464ebf3ca79e8R157-R160 |
dffc484 to
bc0f703
Compare
291557a to
3cc0939
Compare
446514d to
5bd6ece
Compare
axelKingsley
left a comment
There was a problem hiding this comment.
Thank you for diving into this! I don't think we want to handle this in the Chain Processor, but rather the indexer should be permissive of adding Executing Messages with bad Chain IDs (it errors currently). It should allow those messages in, and then rely on the cross package to fail the interop invariants and issue invalidation/replacement like it does in other cases.
da20c5c to
3d77432
Compare
op-supervisor/supervisor/backend/processors/executing_message.go
Outdated
Show resolved
Hide resolved
1e7787e to
58410aa
Compare
|
Following the merge of the parent PR, rebased this one onto |
protolambda
left a comment
There was a problem hiding this comment.
Good to see new testing, but I think this could really use some DSL for a more maintainable/readable test. I'm open to merging it like this, if you can create a github issue to track the needed DSL.
op-acceptance-tests/tests/interop/reorgs/invalid_exec_msg_test.go
Outdated
Show resolved
Hide resolved
op-supervisor/supervisor/backend/processors/executing_message.go
Outdated
Show resolved
Hide resolved
1b1b898 to
179c47c
Compare
Agree that tests can be more readable, but I'd rather we have a few more tests, before introducing more DSL, so that we avoid having DSL that is used once, and only introduces indirection. Follow up issue: #15843 |
I'd strongly suggest introducing DSL from the very start. Good DSL pays off even if it's only used once by making the test easier to read, and it's pretty rare for things to be refactored into a good DSL later - the verbose code just winds up being duplicated a lot (see the op-e2e tests...). It doesn't have to be complex DSL, but just enough to make the test high level and read more declaratively with the detail of how things actually work in the DSL. |
|
I added a follow up ticket with a few TODOs / improvements to all of the new tests - #15843. I'd rather these fixes happen outside of this PR, in order to keep the scope limited to the fix with the depset check within the supervisor. |
daec670 to
9723be3
Compare
…valid exec msg (ethereum-optimism#15662) * add test for reorging a chain with invalid exec msg * change 1000 eth to 1 eth, and send transfers to 1 gwei * annotate workers * check for top bit * additional check for types.ErrUnknownChain * do not hydrate depset with chains with top bit set * rebase on develop
Description
This PR is adding 3 changes - reorg tests, happy interop init/exec msg test and modification to
DecodeExecutingMessageLogbehavior.1. Reorg test
Adding tests for the reorg functionality of the supervisor when it detects an invalid exec msg:
This implies the sequencer is malicious. To cover this scenario, we use the
op-test-sequencerto force in the bad tx.2. Modification to DecodeExecutingMessageLog behavior
DepSetnow includes a reserved ChainIndex for an unknown chain. We make sure that no chain is using that index when hydrating/initialising the set from config.Conversion of
ChainIDtoChainIndexwithinDecodeExecutingMessageLogremains, during parsing ofExecutingMessage (EM)but if we see an unknown chain, we convertChainIDto the reserved chain index for unknown chain, essentially losing the value within our internal database. Later thatEMis discarded the same way we discard otherEMsfor other validation errors.This way the supervisor correctly triggers a reorg of the chain, and issues a similar error as other validation problems (such as
invalid block number, orinvalid log index, etc.)3. Happy-path interop init/exec msg test
Confirming the changes in behavior in point 2. are not affecting correctly formatted
EMsMetadata
Fixes: #15500