-
Notifications
You must be signed in to change notification settings - Fork 801
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
Enforce Optimistic Sync Conditions & CLI Tests #2986
Conversation
The defaults appear to match what the spec has as long as |
ded85a5
to
0ef3771
Compare
Talked to @ethDreamer, he said this one's ready for review, the unchecked tasks are for out of scope CLI tests |
Co-authored-by: realbigsean <[email protected]>
Co-authored-by: realbigsean <[email protected]>
Co-authored-by: realbigsean <[email protected]>
Co-authored-by: realbigsean <[email protected]>
9e329cb
to
e6863c1
Compare
Hey @paulhauner, perhaps you wanna review the optimistic sync conditions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick look at the CLI tests and they seem pretty good to me.
I left a few suggestions but they are pretty minor so feel free to ignore them 🙂
lighthouse/src/main.rs
Outdated
.map_err(|e| format!("Failed to create dumped chain config: {:?}", e))?; | ||
serde_yaml::to_writer(&mut file, &chain_config) | ||
.map_err(|e| format!("Error serializing chain config: {:?}", e))?; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge deal, but there's starting to be a bit of duplication between the BN and VC with some of the code that runs here.
It might be worth spinning it out into dump_config
and dump_chain_config
functions which can be reused between both the BN and VC? If it lived in clap_utils
(or somewhere else appropriate) they might also be able to be used for the boot_node
's dump-chain-config
flag. (Although you may run into type issues)
If you wanted to get extra fancy, it would be really cool if it was just 1 function which was generic over different Config
's but that's probably more work than it's worth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function that's generic over some config: T
where T: serde::Serialize
would be pretty simple and do the trick, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Let me know what you guys think 👀 @paulhauner @macladson
for url in urls.into_iter().skip(1) { | ||
endpoint_arg.push(','); | ||
endpoint_arg.push_str(url); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be misunderstanding, but you can probably just do:
let endpoint_arg = urls.join(",");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@macladson agreed.. this is how I had tried to write it initially. But join
isn't a function. What we need is intersperse
, which is currently nightly-only :/
When that becomes available, this code nicely simplifies to just:
let endpoint_arg = urls.into_iter().intersperse(',').collect::<String>();
I tried opting into using intersperse, but our CI tests prevent me from committing that for release tests :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a Vec
of &str
's (or String
's) you can use join
: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.join
join
is also used elsewhere in the tests.
I could be wrong, but I think that should work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Only a few changes, I think we're pretty close!
lighthouse/src/main.rs
Outdated
.map_err(|e| format!("Failed to create dumped chain config: {:?}", e))?; | ||
serde_yaml::to_writer(&mut file, &chain_config) | ||
.map_err(|e| format!("Error serializing chain config: {:?}", e))?; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function that's generic over some config: T
where T: serde::Serialize
would be pretty simple and do the trick, I think.
Co-authored-by: Paul Hauner <[email protected]>
Suggestions for `optimistic_conditions` branch
a9f6008
to
dbedc93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
bors r+
Merge conflict. |
I think this will fix CI :) |
Fix merge conflict
Looks like I missed something! I'll let you sort it out :) |
Sorry, I forgot you're AFK this week 🙏 I'm resolving the little conflict over in #3050. Closed in favor of #3050. All of @ethDreamer's hard work will be merged there. |
## Description This PR adds a single, trivial commit (f5d2b27) atop #2986 to resolve a tests compile error. The original author (@ethDreamer) is AFK so I'm getting this one merged☺️ Please see #2986 for more information about the other, significant changes in this PR. Co-authored-by: Mark Mackey <[email protected]> Co-authored-by: ethDreamer <[email protected]>
commit 6370edd Author: Paul Hauner <[email protected]> Date: Wed Mar 2 16:31:18 2022 +1100 Update testing/execution_engine_integration/src/build_geth.rs Co-authored-by: Michael Sproul <[email protected]> commit f5a1dee Author: Paul Hauner <[email protected]> Date: Wed Mar 2 16:24:03 2022 +1100 Fix proto-array bug commit 4f7610f Author: Paul Hauner <[email protected]> Date: Wed Mar 2 16:23:52 2022 +1100 Fix payload tests commit cd7a0f5 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 15:22:54 2022 +1100 Implement consensus-specs/2844 commit 5313364 Merge: d5e84a5 668115a Author: Paul Hauner <[email protected]> Date: Wed Mar 2 14:23:19 2022 +1100 Merge branch 'unstable' into prev-randao-rename commit d5e84a5 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 13:31:45 2022 +1100 Fix windows test errors commit 668115a Author: Akihito Nakano <[email protected]> Date: Wed Mar 2 01:05:08 2022 +0000 Rename Eth1/Eth2 in documents (sigp#3021) ## Issue Addressed Resolves sigp#3019 ## Proposed Changes - Eth2 Eth2.0 Ethereum 2.0 -> Ethereum consensus - Eth2 network -> consensus layer - Ethereum 2.0 specification -> Ethereum proof-of-stake consensus specification - Eth2 deposit contract -> Staking deposit contract - Eth1 -> execution client ## Additional Info The description needs to be updated by someone who has permission to do. 📝 <img width="487" alt="image" src="https://user-images.githubusercontent.com/1885716/153995211-816d9561-751e-4810-abb9-83d979379783.png"> commit e34524b Author: Age Manning <[email protected]> Date: Wed Mar 2 01:05:07 2022 +0000 Increase default target-peer count to 80 (sigp#3005) Increase the default peer count from 50 to 80 commit db2e3ae Author: Paul Hauner <[email protected]> Date: Wed Mar 2 11:08:40 2022 +1100 Fix yaml indenting commit a2f99e5 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 11:05:57 2022 +1100 Specify go version in github actions commit 0c5e9c6 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 11:04:15 2022 +1100 Switch EE tests to be a binary commit 7f07fa5 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 10:22:32 2022 +1100 Print output of failed make command commit fa20696 Author: Paul Hauner <[email protected]> Date: Wed Mar 2 10:01:00 2022 +1100 Bump spec tests version commit c2d7677 Author: Paul Hauner <[email protected]> Date: Sat Feb 26 10:17:14 2022 +1100 Add auth port commit 540337a Author: Paul Hauner <[email protected]> Date: Sat Feb 26 10:10:06 2022 +1100 Use `merge-kiln-v2` branch for geth commit 1a3d32e Author: Paul Hauner <[email protected]> Date: Fri Feb 25 15:08:38 2022 +1100 Revert "Add serde "random" alias" This reverts commit bb02c2f. commit 63376bd Author: Paul Hauner <[email protected]> Date: Fri Feb 25 14:59:26 2022 +1100 Add serde "random" alias commit 375aa32 Author: Paul Hauner <[email protected]> Date: Fri Feb 25 10:09:38 2022 +1100 Rename random to prev_randao commit b6493d5 Author: Paul Hauner <[email protected]> Date: Tue Mar 1 22:56:47 2022 +0000 Enforce Optimistic Sync Conditions & CLI Tests (v2) (sigp#3050) ## Description This PR adds a single, trivial commit (f5d2b27) atop sigp#2986 to resolve a tests compile error. The original author (@ethDreamer) is AFK so I'm getting this one merged☺️ Please see sigp#2986 for more information about the other, significant changes in this PR. Co-authored-by: Mark Mackey <[email protected]> Co-authored-by: ethDreamer <[email protected]>
Issue Addressed
Lighthouse will no longer import blocks optimistically that fail the optimistic sync conditions. This PR also addresses #2982.
Proposed Changes
The validation for the optimistic sync conditions is done inside block verification.
Additional Info
I added tests for most of the CLI flags added since v2.0.1:
lighthouse/src/main.rs
These would require significant modifications to test harness code
account_manager/src/validator/exit.rs (requires building test harness)
account_manager/src/validator/slashing_protection.rs (requires building test harness)
beacon_node/src/cli.rs
lcli/src/main.rs (requires building test harness, no lcli flags have tests)