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

common: add forkHash tests #2961

Merged
merged 1 commit into from
Aug 15, 2023
Merged

common: add forkHash tests #2961

merged 1 commit into from
Aug 15, 2023

Conversation

jochem-brouwer
Copy link
Member

This PR:

  • Adds forkHash tests for fork configs where a fork is scheduled at exactly the genesis block time (this should not change forkHash as discovered by hive, see: common: handle forkHash on timestamp == genesis timestamp #2959)
  • Adds the nonce field to required Geth fields (otherwise one gets a non-descriptive error)
  • Makes the "missing fields" error message more descriptive

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #2961 (39c1e93) into master (8cde93d) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.66% <ø> (ø)
blockchain 92.58% <ø> (ø)
client 87.61% <ø> (+0.10%) ⬆️
common 98.56% <100.00%> (+<0.01%) ⬆️
ethash ∅ <ø> (∅)
evm 70.43% <ø> (ø)
rlp ∅ <ø> (∅)
statemanager 84.43% <ø> (ø)
trie 89.89% <ø> (+0.10%) ⬆️
tx 95.88% <ø> (ø)
util 86.78% <ø> (ø)
vm 79.20% <ø> (ø)

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

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm

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.

From my side too, LGTM!

const required = ['config', 'difficulty', 'gasLimit', 'nonce', 'alloc']
if (required.some((field) => !(field in json))) {
const missingField = required.filter((field) => !(field in json))
throw new Error(`Invalid format, expected geth genesis field "${missingField}" missing`)
Copy link
Member

Choose a reason for hiding this comment

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

Ugh. That was an urgent one. 🤯

("hey, you dumb user, you are missing a field here, but I won't tell you what it is!" 😂)

@g11tech g11tech merged commit b153bc6 into master Aug 15, 2023
41 checks passed
@jochem-brouwer jochem-brouwer deleted the forkhash-tests branch August 15, 2023 10:24
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.

3 participants