Add Forkchoice changes for ePBS#502
Add Forkchoice changes for ePBS#502Subhasish-Behera wants to merge 2 commits intograndinetech:epbsfrom
Conversation
7740b80 to
9723120
Compare
fork_choice_control/src/mutator.rs
Outdated
| ) -> Result<()> { | ||
| match *result { | ||
| Ok(BlockAction::Accept(mut chain_link, attester_slashing_results)) => { | ||
| eprintln!("DEBUG: BlockAction::Accept for root={:?}", block_root); |
There was a problem hiding this comment.
Remove eprintln! from PR, if you want to add permanent debug info to fork choice, use trace_with_peers!
fork_choice_store/src/store.rs
Outdated
| /// | ||
| /// This uses get_location() which prefers full variant when both exist. | ||
| #[must_use] | ||
| pub fn chain_link_prefer_full(&self, block_root: H256) -> Option<&ChainLink<P>> { |
There was a problem hiding this comment.
Method body is the same as Store::chain_link. Remove the duplicate
There was a problem hiding this comment.
Code still contains duplicate methods with different names
fork_choice_store/src/store.rs
Outdated
| /// 3. Both maps keyed by same beacon_block_root, so no conversion needed | ||
| #[must_use] | ||
| fn get_location(&self, block_root: H256) -> Option<Location> { | ||
| // Check full variant first (prefer it if exists) |
There was a problem hiding this comment.
Can we do that? What if validators vote for node with no payload and the node with no payload has bigger weight?
|
@povi , this PR is currently a bit hacky,the get_location usage is not correct. using it everywhere rightnow gives wrong result as the priority is fixed in get location. so i have a updated version which works better locally. I was waiting for ethereum/consensus-specs#4489 to be merged as running it locally revealed the right flow. But as you have started reviewing, I will update this soon. |
9723120 to
bb88d6f
Compare
bb88d6f to
8cad66e
Compare
|
hey @povi I have updated the PR for 1.7 spec. please give it a review |
| } | ||
|
|
||
| /// Check if execution payload envelope has been seen for block_root. | ||
| pub fn has_envelope(&self, block_root: H256) -> bool { |
There was a problem hiding this comment.
Duplicate method definition in Controller
| } | ||
|
|
||
| /// Check if blob data is available for block_root. | ||
| pub fn is_data_available(&self, block_root: H256) -> bool { |
There was a problem hiding this comment.
Duplicate method definition in Controller
| } | ||
|
|
||
| /// Get the slot of a block by its root. | ||
| pub fn block_slot(&self, block_root: H256) -> Option<Slot> { |
There was a problem hiding this comment.
Duplicate method definition in Controller
|
I won't proceed with reviewing since the code doesn't even compile, even |
|
Hey @povi, yeah, it has a currently duplicate block( |
Then what is this that you requested me to review? Reviewing takes time and effort in large PR like this. If you don't even bother to review your own changes for obvious logical errors/code style/code validity (any of these) then it is plainly unacceptable, very much so for core part of the application. |
0c2f20c to
e52dfd1
Compare
|
command to run kurtosis: use a patched version of geth: currently dosent show any forkchoice tests fails at |
ccce655 to
460071a
Compare
|
hey @povi I have updated the PR, the commit 460071a passes build, tests as well as kurtosis local setup This commit apart from forkchoice adaptations, adds the implementation to fix those potential bugs(along with a few other bugs):
Also uses the same format of |
seems like it will work with after the support of new beacon api additions |
|
Identified some additional problems with attestation packing, which is currently not resolved correctly in the PR(current PR used execution state for external attestsions which is wrong. so need a structure to store pre-pool attestation's payload_status to be later used)- worked for kurtosis live as attestations were same slot attestations. Fix incoming |
460071a to
9fb358d
Compare
9fb358d to
686ff22
Compare
Major changes:
The whole logic is based on the idea that it doesn't matter how you reach the segment-level identifiers. i.e though ePBS introduces a separate envelope object, but the same segment structure can be followed. So the difference between a envelope(full block)/ empty block is which state is read from that block. One of the ways to do that is by following the existing pattern of keeping a chunk of the Store fields inside Chainlink
The changed structure of empty/full block pretty much behave as siblings if it is looked from view of part of forkchoice calculation which depends on reading parent information.
so the the most common structure that is going to happen is:
both weight propagation purposes as well as the insertion purpose of full/empty block of arrival, the choice of introducing dual maps is much easier than differentiation at
unfinalized_blocklevel or usingchain_linkfields.the key currently for both the map is
block_root. A previous approach was made to keep unfinalized_locations_full maps key asexecution_hashand unfinalized_locations_empty throughblock_root. But there was significant overhead in terms of number of conversion calla/reverse lookup for hash to root and viceversa. plus as only one variant of full/empty per blockroot can reach till forkchoice, there is ideally no problem with having the same keys.a way to move forward with the changes is to look at in which scenarios(insertion into segment, calculation supporting vote, tiebraker , weight propagtion/childern filter/setting
ForkChoicePayloadStatus) empty vs full is preferred across spec and current code.