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: use a default chain name in fromGethGenesis if no chain name specified #2319

Merged
merged 4 commits into from Sep 29, 2022

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Sep 28, 2022

seems like files might not have name property in them and hence would cause common constructor to error when undefined chain name gets passed.

To prevent this scenario chain representing custom chain name is now mandatory field

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Merging #2319 (a2c0f3d) into master (9d885c9) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 92.86% <ø> (ø)
blockchain 90.21% <ø> (ø)
client 86.97% <ø> (ø)
common 98.35% <0.00%> (-0.10%) ⬇️
devp2p 92.37% <ø> (-0.11%) ⬇️
ethash ∅ <ø> (∅)
evm 79.23% <ø> (ø)
rlp ∅ <ø> (?)
statemanager 88.43% <ø> (ø)
trie 90.36% <ø> (ø)
tx 97.98% <ø> (ø)
util 88.99% <ø> (ø)
vm 85.31% <ø> (ø)

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

@acolytec3
Copy link
Contributor

Should we make the chain name mandatory or just pass in a default name in the common constructor? You could just do const common = new Common ({ chain: genesisParams.name ?? 'testnet'... or something like that. I doubt most people are going to care too much about the chain name in these custom parameters situations.

@g11tech
Copy link
Contributor Author

g11tech commented Sep 28, 2022

hmm, can pass custom less people have to type better it is

@@ -157,7 +157,7 @@ export class Common extends EventEmitter {
/**
* Static method to load and set common from a geth genesis json
* @param genesisJson json of geth configuration
* @param { chain, genesisHash, hardfork } to futher configure the common instance
* @param { chain, genesisHash, hardfork } to futher configure the common instance, mandatory option: `chain` representing custom chain name`
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is no longer relevant.

@g11tech g11tech changed the title common: make chain name mandatory in fromGethGenesis common: handle missing name in genesis json for common.fromGethGenesis Sep 28, 2022
@g11tech g11tech changed the title common: handle missing name in genesis json for common.fromGethGenesis common: use a default chain name in fromGethGenesis if no chain name specified Sep 28, 2022
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

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 88bd15d into master Sep 29, 2022
@holgerd77 holgerd77 deleted the g11tech/fix-from-geth-genesis-opts branch September 29, 2022 08:24
ScottyPoi pushed a commit that referenced this pull request Sep 29, 2022
…specified (#2319)

* common: make chain name mandatory in fromGethGenesis

* improve comment

* change startegy to just pass name custom

* undo comment
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.

None yet

3 participants