-
Notifications
You must be signed in to change notification settings - Fork 24
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
Optimistic Sync tests proposal #28
Comments
I strongly support the creation of these tests. I think though the format may be forced to be a little more complicated. When importing block In fact there may be arbitrarily many calls to FCU, since if we are following a branch in a tree with I thus propose that the format has a map |
+1 from lodestar |
This is reasonable, and useful, as long as the tests are strongly distinguished from current consensus-spec tests which are are all
The CL tests that exist are partly useful because they essentially never (as close to 0% as feasible -- sometimes, there are CI runner infrastructure failures, etc) create false-positive failures. Therefore, when I look at why a commit might have failed CI, I look at the |
By "strongly distinguished": I mean, not just one more superficially similar-looking test in a folder of otherwise-self-contained-deterministic/etc test which has some new flag to treat it differently. These should be put elsewhere in the repo organization so that they can be reasonably run separately without continuously having to sort/filter which are the guaranteed reliable tests and which are the potentially flakier tests. |
I would have expected these tests to meet these conditions as long as you consider the test runner part of the CL code. The test runner is just being augmented to be able to return additional execution payload statuses - not just VALID or INVALID but also SYNCING and ACCEPTED and it can now return the latestValidHash value when the response is INVALID. You wouldn't actually be running an EL for these tests. |
Sure, seems reasonable and useful. |
I've been wondering if it's not worth also to allow "timeout" to be a response. That's borderline implementation dependent more than spec-domain, but this is also a source of bugs if the CL acts on an optimistic head depending on the status when the EL timesout |
Thank you @mkalinin for the proposal! It also bothers me that there are no tests cover optimistic sync specs. 😅
Is it correct to say, for the existing Bellatrix fork choice tests, clients take all payloads as
And then write new tests of the invalid/syncing cases? |
I think we should rather leave |
I am not sure if we want to maintain this level of complexity. My gut is that we can get to any desirable state by adding one more block to a branch of a block tree and pass required payload status in it. Having a specification of method calls and responses for each Engine API method might be valuable, currently we have {
payload_block_hash: block.body.execution_payload.block_hash,
engine_api_responses: {
"engine_newPayloadV1": {status: "VALID", latestValidHash: blockHash, validationError: null},
"engine_forkchoiceUpdatedV1": {payloadStatus: {status: "VALID", latestValidHash: blockHash, validationError: null}, payloadId: null}
}
} This format has two properties: i) we can have different payload status returned by |
The kind of situation that worries me about optimistic sync tests is if clients agree on head/justified information after a block is deemed
The last block is 13, and at this point the EL catches up and replies INVALID, LVH pointing to block 2. What is our Head? But the issue here is that in runtime this is not all we do when we import block 13. The right answer to the question "what is our head?" depends on the optimistic status of the remaining blocks. If they are still optimistic the answer would be just as the previous package, but the EL has just catched up, so it could well be that the forkchoice head is I see several possible bugs here, among them This is why I consider valuable to make sure we agree on behavior in these more complicated situations. |
We may achieve the necessary level of flexibility by adding artificial - {payload_status: {block_hash: '0x...', status: {status: 'VALID', latestValidHash: blockHash, validationError: null}}} This step will need to precede the corresponding - {payload_status: {block_hash: '0x...', status: {status: 'VALID', latestValidHash: blockHash, validationError: null}}}
- {block: block_0x..., valid: true/false} |
This may work if these are interpreted not as current values returned from the EL but rather setting up the mock, so that when |
Yes, exactly this way. And it makes it easier to implement I guess and keep the format backwards compatible to the fork choice tests format. So, any changes to that format may be easily applied to optimistic sync tests as well |
@hwwhww does the following format make sense to you: - {payload_status: {block_hash: '0x...', status: {status: 'VALID', latestValidHash: blockHash, validationError: null}}}
- {block: block_0x..., valid: true/false} |
@mkalinin |
I like |
Implemented in ethereum/consensus-specs#2965 and ethereum/consensus-specs#2982 |
Optimistic sync is an extension of consensus specs, but it seems valuable to feature consensus-spec-tests with a few test cases checking CL client's behaviour in complicated scenarios. Hive is the main testing tool that currently does this job. Debugging cross-layer (CL + EL) Hive test is difficult, writing Hive tests employing sophisticated re-org scenarios is even harder while both should be much easier if handled by consensus-spec-tests suite.
As optimistic sync is an opt-in backwards compatible extension, test format should follow the same principle. A subset of tests separated from the others and utilizing
fork_choice
test format seems like a reasonable approach. Clients that are not supporting optimistic sync (tho there is no such clients to date) may not support this subset at all.It is proposed to extend fork choice tests format with
PayloadStatusV1
responses which EL would return whennewPayload
orforkchoiceUpdated
method is called for a corresponding block. CL clients that are implementing opti sync tests will have to mock EL clients accordingly.Format extension for
on_block
handlerShould the
PayloadStatus
be ever updated in a backwards incompatible way these tests will have to be updated accordingly. Though, this is unlikely to happen outside of a hard fork on CL side, thus, tests may be aligned as well supporting the old status structure for previous hard forks.Example scenario
It is also proposed that
valid
flag for each ofB1' ... B4'
blocks is set tofalse
indicating that these blocks are invalid allowing this test to result in the same outcome on CI and when run by a client without optimistic sync support. CL clients that do support optimistic sync should omit this flag and rely onpayload_status
instead.cc @hwwhww @djrtwo @potuz @ajsutton @tersec @paulhauner
The text was updated successfully, but these errors were encountered: