Skip to content
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

Client: hive Cancun fixes #3099

Merged
merged 18 commits into from
Oct 23, 2023
Merged

Client: hive Cancun fixes #3099

merged 18 commits into from
Oct 23, 2023

Conversation

jochem-brouwer
Copy link
Member

@jochem-brouwer jochem-brouwer commented Oct 10, 2023

The goal of this PR is to fix most (all?) of failing hive cancun tests. Before this PR: 55 failing tests. After this PR: 30 failing tests

To run:

./hive --client ethereumjs --sim ethereum/engine --sim.parallelism 8 --sim.limit="engine-cancun"

(change parallelism and ensure hive is at latest master)

Fixes:

  • ./hive --client ethereumjs --sim ethereum/engine --sim.parallelism 8 --sim.limit="engine-cancun/Bad Hash on NewPayload" 104e6e8, this fixes 3 tests.
  • Inconsistent Head in ForkchoiceState in b525804, this commit fixes 10 tests. If recursivelyFindParents hits genesis block then we should stop finding more parents, we now have a full reorg back to genesis (?)
  • Pre-Merge Fork Number > 0 : Off by one check in common f2aedca
  • Unique PayloadID - Withdrawals: Ensure that different withdrawals result in a different payload ID 14b60a4

Open failing tests (with notes):

  • Invalid PayloadAttributes: Missing BeaconRoot -> This test seems wrong, it FCUs without a parentBlockBeaconRoot but then expects us to report that blockhash as head hash
  • Invalid Missing Ancestor ReOrg -> have to do with reorgs, will open a separate PR for this.

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #3099 (53574ed) into master (d282e2e) will decrease coverage by 0.08%.
The diff coverage is 82.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.78% <ø> (ø)
blockchain 92.27% <62.06%> (-0.35%) ⬇️
client 87.59% <90.00%> (-0.14%) ⬇️
common 98.19% <100.00%> (ø)
ethash ∅ <ø> (∅)
evm 71.87% <ø> (ø)
rlp ∅ <ø> (?)
statemanager 90.30% <ø> (ø)
trie 90.32% <ø> (ø)
tx 96.36% <ø> (ø)
util 86.97% <ø> (ø)
vm 76.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@jochem-brouwer
Copy link
Member Author

A client test will fail, this expects us to set finalized/safe to the genesis block if it is not yet set. I am not sure if this is correct. Remainder of this is ready for review, other failing hive tests have to do with reorgs, will open a separate PR for that.

@@ -384,7 +384,7 @@ export class Common {
if (mergeIndex >= 0 && td !== undefined && td !== null) {
if (hfIndex >= mergeIndex && BigInt(hfs[mergeIndex].ttd!) > td) {
throw Error('Maximum HF determined by total difficulty is lower than the block number HF')
} else if (hfIndex < mergeIndex && BigInt(hfs[mergeIndex].ttd!) <= td) {
} else if (hfIndex < mergeIndex && BigInt(hfs[mergeIndex].ttd!) < td) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this change triggers a Common test. I am pretty sure this is ok, we should check for < not <=?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should be fine to me. I guess theoretically our hardfork could have the same total difficulty as the merge TTD if the intent is for them to occur on the same exact block. @g11tech, would you agree?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah and I forgot to note: this change was triggered by a hive test with thus this exact scenario of hitting the TTD exactly.

acolytec3
acolytec3 previously approved these changes Oct 21, 2023
Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've previously verified that the specified hive tests do indeed pass.

@@ -384,7 +384,7 @@ export class Common {
if (mergeIndex >= 0 && td !== undefined && td !== null) {
if (hfIndex >= mergeIndex && BigInt(hfs[mergeIndex].ttd!) > td) {
throw Error('Maximum HF determined by total difficulty is lower than the block number HF')
} else if (hfIndex < mergeIndex && BigInt(hfs[mergeIndex].ttd!) <= td) {
} else if (hfIndex < mergeIndex && BigInt(hfs[mergeIndex].ttd!) < td) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should be fine to me. I guess theoretically our hardfork could have the same total difficulty as the merge TTD if the intent is for them to occur on the same exact block. @g11tech, would you agree?

@jochem-brouwer
Copy link
Member Author

Hmm, I have reran the client tests twice now since I thought this would be a random timeout, but maybe this is not the case (have just retriggered, if it does not pass then I should investigate)

@jochem-brouwer
Copy link
Member Author

Ok, tests seems failing into a context which I thought was not relevant, will take a look!

@jochem-brouwer jochem-brouwer marked this pull request as draft October 21, 2023 13:22
// finalized and safe are always blocks since they have to have valid execution
// before they can be saved in chain
headers.finalized = (await this.getCanonicalFinalizedBlock()).header
headers.safe = (await this.getCanonicalSafeBlock()).header
if (blocks.finalized !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (blocks.finalized !== null) {
headers.finalized = blocks.finalized?.header ?? null

should be cleaner and simlarly for safe

headers.finalized = (await this.getCanonicalFinalizedBlock()).header
headers.safe = (await this.getCanonicalSafeBlock()).header
headers.finalized = blocks.finalized?.header ?? null
headers.safe = blocks.safe?.header ?? null
headers.vm = (await this.getCanonicalVmHead()).header

blocks.latest = await this.getCanonicalHeadBlock()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so in this file if one first does gets all the blocks and then the headers, then a sync test fails. If one updates this to the original (see 586868b ) then it passes. Test in question is integration/lightclient.spec.ts

@holgerd77
Copy link
Member

Reading from the thread it seems this can be merged and will therefore do. If I accidentally merged with some todo still left please eventually just do in a small follow-up PR, but seems convenient to have this in.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holgerd77 holgerd77 merged commit ff14395 into master Oct 23, 2023
43 checks passed
@holgerd77 holgerd77 deleted the hive-cancun branch October 23, 2023 07:58
@holgerd77
Copy link
Member

(so: pretty cool work with so many Hive fixes! 🤩 🎉)

@jochem-brouwer
Copy link
Member Author

Great, thanks 😄 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants