-
Notifications
You must be signed in to change notification settings - Fork 2.2k
parse different versions of genesis config #4973
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4973 +/- ##
===========================================
- Coverage 61.08% 61.05% -0.04%
===========================================
Files 350 350
Lines 28303 28359 +56
Branches 2889 2885 -4
===========================================
+ Hits 17290 17315 +25
- Misses 10049 10091 +42
+ Partials 964 953 -11 |
What is the benefit of having a new format? |
@@ -77,10 +77,13 @@ struct ChainOperationParams | |||
/// General chain params. | |||
private: | |||
u256 m_blockReward; | |||
bool m_allowRewardOverwrite; //allow overwrite of the block reward that is set in genesis.json |
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.
Why do you need this hack?
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.
without this, Byzantium blockreward is reset to non zero value even if I want to run Byzantium tests with 0 mining reward that I set in chain params.
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.
You're not running Byzantium rules then. Maybe create another config similar to Byzantium but without block reward?
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.
well then I do not run any rules then. because I use 0 block reward for all tests with NoProof
the issue is that Byzantium set is overwriting the block reward and I dont have any means to prevent it from config.
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.
You need to create new EVMSchedule
in EVMSchedule.h
, add it to ChainOperationParams::scheduleForBlockNumber()
, then use new param like "byzantiumTestForkBlock" in actual chain config
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.
isn't it too much just for the test purpose?
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.
Well ad-hoc hacking lower-level data structures and mechanisms just for the test purpose seems too much to me
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.
it is not really a hack. its an option to set mining reward in genesis config
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.
To make it work you could also try just overriding NoProof::blockReward()
and always returning 0 from there.
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.
Though I wouldn't fully support such change, because it makes NoProof
engine further away from real network mechanics and for unit tests I would like it to stay closer. But if you'd made another engine just for your tests like NoProofZeroRewards
that would be fine I guess.
@pirapira this is a minimalistic genesis format for running a test. |
Still not clear what's exactly wrong for you with our regular genesis format. Provide an example of new format please |
so basically there should be setGenesis method which allows you to enable/disable or set mining algorythm (PoW, NoProof) and initial state and genesis block header. the issue is that currently each client has its own genesis config format |
So is this a special kind of config where instead of fork block numbers you just set which fork it is and it is in effect for the whole chain starting from genesis? |
yes and no. we define so I see, you mean that chain options like forkBlock number should also be set in this method probably. the issue is still that such transition block option names are depend on a client. |
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.
Anyway I don't think it should be merged until format in ethereum/retesteth#4 is finalized
Looks like the current set_chainParams method. (chain param init function) needs refactoring. |
parse test genesis format
ethereum/retesteth#4