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

Fix some failing hive tests in the devp2p/snap sync test suite #3847

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions packages/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@
)
}

// Terminal total difficulty logic is not supported any more as the merge has been completed
// so the Merge/Paris hardfork block must be 0
if (
config.terminalTotalDifficulty !== undefined &&
(BigInt(difficulty) < BigInt(config.terminalTotalDifficulty) ||
config.terminalTotalDifficultyPassed === false)
) {
throw new Error('nonzero terminal total difficulty is not supported')
}

const params = {
name,
chainId,
Expand Down Expand Up @@ -144,6 +134,9 @@
[Hardfork.MuirGlacier]: { name: 'muirGlacierBlock' },
[Hardfork.Berlin]: { name: 'berlinBlock' },
[Hardfork.London]: { name: 'londonBlock' },
[Hardfork.ArrowGlacier]: { name: 'arrowGlacierBlock' },
[Hardfork.GrayGlacier]: { name: 'grayGlacierBlock' },
[Hardfork.Paris]: { name: 'mergeForkBlock', postMerge: true },
[Hardfork.MergeForkIdTransition]: { name: 'mergeForkBlock', postMerge: true },
[Hardfork.Shanghai]: { name: 'shanghaiTime', postMerge: true, isTimestamp: true },
[Hardfork.Cancun]: { name: 'cancunTime', postMerge: true, isTimestamp: true },
Expand Down Expand Up @@ -195,10 +188,10 @@
}

if (config.terminalTotalDifficulty !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this entire if block should be removed. We don't care about terminalTotalDifficulty anymore. Note that if mergeForkBlock is set in the config, then both the Paris and the MergeForkIdTransition will point to that block (thus it is not necessary to set it again).

(But please re-test the hive test if this is changed :) )

// Merge fork must be placed at 0 since ttd logic is no longer supported
// Merge fork must be placed at mergeFork block since ttd logic is no longer supported
const mergeConfig = {
name: Hardfork.Paris,
block: 0,
block: params.hardforks.filter((hf) => hf.name === Hardfork.MergeForkIdTransition)[0].block,
timestamp: undefined,
}

Expand Down Expand Up @@ -242,7 +235,7 @@
}
return parseGethParams(finalJSON)
} catch (e: any) {
throw new Error(`Error parsing parameters file: ${e.message}`)

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / common / test-common

test/utils.spec.ts > [Utils/Parse] > should generate expected hash with london block zero and base fee per gas defined

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ Module.parseGethGenesis src/utils.ts:238:11 ❯ test/utils.spec.ts:48:20

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / common / test-common

test/utils.spec.ts > [Utils/Parse] > should successfully parse genesis file with no extraData

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ Module.parseGethGenesis src/utils.ts:238:11 ❯ test/utils.spec.ts:53:20

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / common / test-common

test/utils.spec.ts > [Utils/Parse] > should set merge to block 0 when terminalTotalDifficultyPassed is true

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ Module.parseGethGenesis src/utils.ts:238:11 ❯ Module.createCommonFromGethGenesis src/constructors.ts:45:25 ❯ test/utils.spec.ts:62:20

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / common / test-common

test/utils.spec.ts > [Utils/Parse] > should successfully assign mainnet deposit contract address when none provided

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ Module.parseGethGenesis src/utils.ts:238:11 ❯ Module.createCommonFromGethGenesis src/constructors.ts:45:25 ❯ test/utils.spec.ts:79:20

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / common / test-common

test/utils.spec.ts > [Utils/Parse] > should correctly parse deposit contract address

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ Module.parseGethGenesis src/utils.ts:238:11 ❯ Module.createCommonFromGethGenesis src/constructors.ts:45:25 ❯ test/utils.spec.ts:99:20

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / browser / test-all-browser

test/utils.spec.ts > [Utils/Parse] > should generate expected hash with london block zero and base fee per gas defined

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ parseGethGenesis src/utils.ts:238:10 ❯ test/utils.spec.ts:48:19

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / browser / test-all-browser

test/utils.spec.ts > [Utils/Parse] > should successfully parse genesis file with no extraData

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ parseGethGenesis src/utils.ts:238:10 ❯ test/utils.spec.ts:53:19

Check failure on line 238 in packages/common/src/utils.ts

View workflow job for this annotation

GitHub Actions / browser / test-all-browser

test/utils.spec.ts > [Utils/Parse] > should set merge to block 0 when terminalTotalDifficultyPassed is true

Error: Error parsing parameters file: Cannot read properties of undefined (reading 'block') ❯ parseGethGenesis src/utils.ts:238:10 ❯ createCommonFromGethGenesis src/constructors.ts:45:24 ❯ test/utils.spec.ts:62:19
}
}

Expand Down
Loading