-
Notifications
You must be signed in to change notification settings - Fork 75
[ETCM-43][ETCM-46] Add opt-out field #675
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
Conversation
3f62ec0
to
0bea179
Compare
0bea179
to
da98f44
Compare
be1e679
to
a97f773
Compare
@@ -11,6 +11,8 @@ | |||
atlantis-block-number = "0" | |||
agharta-block-number = "0" | |||
phoenix-block-number = "0" | |||
# FIXME: Once the testnet is up an running we should determine this value |
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.
maybe we should provide a new file especially for the new testnet, WDTY?
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.
Should we still keep the configurations for a private testnet? It could get a bit messy given that we have private.conf, private.json and private-testnet.conf
We could have for our chains/ files:
- Keep private-testnet.conf (current private.conf) and private-testnet.json (current private.json), with private-testnet.conf having ecip1098 activated at block 0 as currently
- Add internal-testnet.conf and internal-tesnet.json for our testnet
We could have for our conf/ files:
- Have a testnet-changes.conf file with the testnet configuration overrides (i.e. disabling pruning and discovery)
- Have a private-testnet.conf and a internal-testnet.conf that would just select the correct chain
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.
maybe we could discuss this in a call.
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.
Conclusion from call: #681
val isEcip1098Activated = blockHeader.number >= blockchainConfig.ecip1098BlockNumber | ||
val isOptOutDefined = blockHeader.optOut.isDefined | ||
|
||
if(isEcip1098Activated && isOptOutDefined) Right(BlockHeaderValid) |
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.
(formatting) if (
val emptyOmmerHash = ByteString(Hex.decode("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")) | ||
|
||
def getEncodedWithoutNonce(blockHeader: BlockHeader): Array[Byte] = { | ||
val rlpEncoded = blockHeader.toRLPEncodable match { | ||
case rlpList: RLPList => | ||
case rlpList: RLPList if rlpList.items.length == (NumberOfFields - 1) => |
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.
i prefer something like: if (isPreviousToEcip1089(rlpList) =>
WDYT?
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.
I found a way I preferred most, to not require the NumberOfFields value, I'll soon push it
RLPList(rlpList.items.dropRight(2): _*) | ||
|
||
case rlpList: RLPList if rlpList.items.length == NumberOfFields => |
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.
ditto
@@ -73,8 +81,17 @@ object BlockHeader { | |||
implicit class BlockHeaderEnc(blockHeader: BlockHeader) extends RLPSerializable { |
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.
A comment regarding the reason behind optOut match {
will help future generations i guess..hehe.
val headerWithOptOutInvalidlyOn = validBlockHeader.copy(optOut = Some(true)) | ||
|
||
val validationResult = blockHeaderValidator.validate(headerWithOptOutInvalidlyOn, validParentBlockHeader) | ||
validationResult shouldBe Left(HeaderOptOutError) |
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.
(minor) maybe we could provide differenciation between this scenario and the following one, i mean in terms of HeaderOptOutError
description. Still not sure if is worthy, wdyt?
…more details to opt-out validation error
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.
LGTM!
src/main/scala/io/iohk/ethereum/consensus/ConsensusConfig.scala
Outdated
Show resolved
Hide resolved
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.
LGTM!
@@ -135,7 +135,7 @@ class GenesisDataLoader( | |||
extraData = genesisData.extraData, | |||
mixHash = genesisData.mixHash.getOrElse(zeros(hashLength)), | |||
nonce = genesisData.nonce, | |||
optOut = None | |||
treasuryOptOut = None |
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.
👍
Description
First changes for supporting treasury (as specified here)
Depends on #674Proposed Solution
Pending
Testing