Conversation
93a7e67 to
8e5ef55
Compare
9945c5d to
0413a31
Compare
Codecov Report
@@ Coverage Diff @@
## master #5741 +/- ##
=========================================
Coverage ? 64.08%
=========================================
Files ? 360
Lines ? 30830
Branches ? 3425
=========================================
Hits ? 19756
Misses ? 9844
Partials ? 1230 |
980b658 to
a0b0cb9
Compare
2b96438 to
7add7e2
Compare
30bf23d to
e019753
Compare
|
Rebased. |
|
You mentioned in the issue that the syntax for specifying at runtime which EIPs to enable is a delimited list of EIPs - is there a chance that different EIPs can change the same settings so the ordering of the EIPs in the list matters? Or is this generally not a concern? |
|
What happens if someone specifies an eip not in the "AdditionalEIPs" struct? Presumably we get some sort of error? |
libethereum/ChainParams.cpp
Outdated
|
|
||
| ChainParams ChainParams::addEIPs(AdditionalEIPs const& _eips) const | ||
| { | ||
| ChainParams cp(*this); |
libethereum/ChainParams.h
Outdated
| ChainParams loadConfig(std::string const& _json, h256 const& _stateRoot = {}, | ||
| const boost::filesystem::path& _configPath = {}) const; | ||
|
|
||
| /// Activatie additional EIPs on top of the last fork block |
There was a problem hiding this comment.
Typo (Activatie -> Activate)
| { | ||
| // network name may be network+EIPs | ||
| vector<string> networkAndEIPs; | ||
| boost::algorithm::split(networkAndEIPs, _networkName, boost::is_any_of("+")); |
There was a problem hiding this comment.
There's no appropriate STL function that we can use?
There was a problem hiding this comment.
Not really, string functions are pretty low-level and/or verbose (like you could of course string::find in a loop)
I like boost string functions because they create higher-level code, e.g. similar to split/join functions of other languages.
(We're probably going to get split via ranges in C++20 https://stackoverflow.com/questions/48402558/how-to-split-a-stdstring-into-a-range-v3-of-stdstring-views)
| for(auto const& tr : m_transactions) | ||
| { | ||
| if (network == netIdToString(tr.netId) || network == "ALL") | ||
| if (network == tr.netId || network == "ALL") |
There was a problem hiding this comment.
(Nit) Perhaps we should make this comparison case-insensitive?
There was a problem hiding this comment.
It's case-sensitive everywhere in testeth, I'd leave it like this.
(these strings are actually field names test JSON files, so proper behaviour depends on whether field names are case-sensitive in JSON, are they?)
There was a problem hiding this comment.
Makes sense, if it's already case sensitive everywhere else let's leave it alone.
libethereum/ChainParams.cpp
Outdated
| *this = loadConfig(_json, _stateRoot); | ||
| } | ||
|
|
||
| ChainParams::ChainParams(std::string const& _s, AdditionalEIPs const& _additionalEIPs) |
There was a problem hiding this comment.
(Nit) Can we choose a name for the _s arg which reflects the semantics of the data it contains?
libethereum/ChainParams.cpp
Outdated
| ChainParams::ChainParams(std::string const& _s, AdditionalEIPs const& _additionalEIPs) | ||
| : ChainParams(_s) | ||
| { | ||
| *this = addEIPs(_additionalEIPs); |
There was a problem hiding this comment.
I think this approach is a little confusing (calling another ctor which sets some state and then overwriting the current instance) - I'd prefer if the addEIPs function either updates the current instances state (i.e. it's non-const) or we turn this ctor into a static function which calls addEIPs and returns the result.
There was a problem hiding this comment.
Agree, this is complicated. I originally added only addEIPs and made it similar to loadConfig and loadGenesis (which create new instance out of the current one)
But now I think I should remove addEIPs and leave only this constructor.
@halfalicious In theory it's possible, even if not about the same settings, some rules might be interrelated so that the order of applying matters... But I think the complexity of handling such flexibility is not worth the trouble for now (that is, EIPs in close areas will be applied in hard-coded order)
Not sure if I understand the question, but if someone implements an EIP, there will be some kind of check against chainParams to activate it - like without this individual activation the check looked like |
9e40e7b to
2844787
Compare
| ChainParams::ChainParams(std::string const& _configJson, AdditionalEIPs const& _additionalEIPs) | ||
| : ChainParams(_configJson) | ||
| { | ||
| lastForkAdditionalEIPs = _additionalEIPs; |
There was a problem hiding this comment.
(Nit) Can we initialize this as a part of the initializers list?
libethcore/EVMSchedule.h
Outdated
| { | ||
| EVMSchedule(): tierStepGas(std::array<unsigned, 8>{{0, 2, 3, 5, 8, 10, 20, 0}}) {} | ||
| EVMSchedule(bool _efcd, bool _hdc, unsigned const& _txCreateGas): exceptionalFailedCodeDeposit(_efcd), haveDelegateCall(_hdc), tierStepGas(std::array<unsigned, 8>{{0, 2, 3, 5, 8, 10, 20, 0}}), txCreateGas(_txCreateGas) {} | ||
| // consturct schedule with additional EIPs on top |
halfalicious
left a comment
There was a problem hiding this comment.
A couple of minor suggestions, otherwise looks good!
2844787 to
b35adb5
Compare
Addresses #5789
It introduces support for individual EIP activation without fork, then moves EIP-2046 implementation from Berlin fork definition to this new individual model of activation.
How this is supposed to be used
Implementing new EIP
AdditionalEIPsstruct https://github.com/ethereum/aleth/pull/5741/files#diff-c93cb246fbbc22300c737cb7ce2a2741R57-R60ChainOperationParams::isEIPXXXXEnabledwould be helpful https://github.com/ethereum/aleth/pull/5741/files#diff-c93cb246fbbc22300c737cb7ce2a2741R72-R75EVMSchedulein the functionaddEIPsToSchedulehttps://github.com/ethereum/aleth/pull/5741/files#diff-363b4e07ecbf6ed5a7eb650e5cb69bcbR12-R19Including EIP into the new fork definition, after it's accepted
AdditionalEIPsstructChainOperationParams::isEIPXXXXEnabledhelper https://github.com/ethereum/aleth/pull/5741/files#diff-c93cb246fbbc22300c737cb7ce2a2741R76-R80addEIPsToScheduleand add to the fork'sEVMScheduleinstanceWriting a unit test
ChainParamswith additional EIPs activated usingChainParams(string, AdditionalEIPs)constructor https://github.com/ethereum/aleth/pull/5741/files#diff-bca8e2c5f9ec26d6b11f9fd86abd6338R815-R817Writing consensus state test
Forkname+EIPXXXXinstead of regular fork name.See example test for EIP2046 that I created ethereum/tests@8bbbd48
(based on existing
CallIdentitiy_1test)Limitations / future improvements (if needed)
These should be fairly easy to support though.
@winsvega please review the changes in testeth. Basically it operates now with a network name string (which can possibly contain additional EIP numbers) in the places where it used to use
eth::Network. Then createsChainParamsbased on this string, when it needs to execute the transaction.