-
Notifications
You must be signed in to change notification settings - Fork 775
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
Changes from 11 commits
104e6e8
b525804
3ba3799
9660573
ce1f9d0
77f9f53
a616855
0b3cc67
f2aedca
14b60a4
3c2f820
fd3ce1e
5bc2fac
80c2624
3f85b82
da48eca
586868b
53574ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -294,18 +294,26 @@ export class Chain { | |||||
height: BIGINT_0, | ||||||
} | ||||||
|
||||||
headers.latest = await this.getCanonicalHeadHeader() | ||||||
blocks.latest = await this.getCanonicalHeadBlock() | ||||||
blocks.finalized = (await this.getCanonicalFinalizedBlock()) ?? null | ||||||
blocks.safe = (await this.getCanonicalSafeBlock()) ?? null | ||||||
blocks.vm = await this.getCanonicalVmHead() | ||||||
|
||||||
headers.latest = blocks.latest.header | ||||||
// 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) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
should be cleaner and simlarly for |
||||||
headers.finalized = blocks.finalized.header | ||||||
} else { | ||||||
headers.finalized = null | ||||||
} | ||||||
if (blocks.safe !== null) { | ||||||
headers.safe = blocks.safe.header | ||||||
} else { | ||||||
headers.safe = null | ||||||
} | ||||||
headers.vm = (await this.getCanonicalVmHead()).header | ||||||
|
||||||
blocks.latest = await this.getCanonicalHeadBlock() | ||||||
blocks.finalized = await this.getCanonicalFinalizedBlock() | ||||||
blocks.safe = await this.getCanonicalSafeBlock() | ||||||
blocks.vm = await this.getCanonicalVmHead() | ||||||
|
||||||
headers.height = headers.latest.number | ||||||
blocks.height = blocks.latest.header.number | ||||||
|
||||||
|
@@ -513,17 +521,17 @@ export class Chain { | |||||
/** | ||||||
* Gets the latest block in the canonical chain | ||||||
*/ | ||||||
async getCanonicalSafeBlock(): Promise<Block> { | ||||||
async getCanonicalSafeBlock(): Promise<Block | undefined> { | ||||||
holgerd77 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
if (!this.opened) throw new Error('Chain closed') | ||||||
return this.blockchain.getIteratorHead('safe') | ||||||
return this.blockchain.getIteratorHeadSafe('safe') | ||||||
} | ||||||
|
||||||
/** | ||||||
* Gets the latest block in the canonical chain | ||||||
*/ | ||||||
async getCanonicalFinalizedBlock(): Promise<Block> { | ||||||
async getCanonicalFinalizedBlock(): Promise<Block | undefined> { | ||||||
if (!this.opened) throw new Error('Chain closed') | ||||||
return this.blockchain.getIteratorHead('finalized') | ||||||
return this.blockchain.getIteratorHeadSafe('finalized') | ||||||
} | ||||||
|
||||||
/** | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
throw Error('HF determined by block number is lower than the minimum total difficulty HF') | ||
} | ||
} | ||
|
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.
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