-
Notifications
You must be signed in to change notification settings - Fork 839
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
Clique block period transition #6596
Conversation
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
|
…locks Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
...ensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
…locks Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
…locks Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
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.
looks good, just would avoid having the mutable config class, and minor stuffs
config/src/main/java/org/hyperledger/besu/config/JsonCliqueConfigOptions.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockScheduler.java
Outdated
Show resolved
Hide resolved
...reation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/DefaultBlockScheduler.java
Outdated
Show resolved
Hide resolved
final MutableCliqueConfigOptions cliqueConfigOptions = | ||
new MutableCliqueConfigOptions(lastSpec.getValue()); | ||
|
||
fork.getBlockPeriodSeconds().ifPresent(cliqueConfigOptions::setBlockPeriodSeconds); | ||
|
||
return cliqueConfigOptions; |
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.
From what I see, there should not be a need for this mutable object, since if you use immutables annotation for CliqueConfigOptions
then you can do something like this
var next = ImmutableCliqueConfigOptions.builder().from(lastSpec.getValue());
fork.getBlockPeriodSeconds().ifPresent(next::blockPeriodSeconds);
return next.build();
and avoid having mutable objects around, since the conf should newer change once it is created.
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.
This Mutable*ConfigOptions approach is pretty ingrained in the transition functionality used throughout the codebase, ie for BFT too. Can spike this out unless @jframe already knows there would be an issue with this?
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 be fine to change it using a builder. It's only mutable for building the CliqueConfigOptions from the transitions.
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.
done this for Clique, but not BFT
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.
fine, the other part could be done later
…locks Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
…locks Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Add BFT-style transitions to Clique, modelled with ForksSchedule<CliqueConfigOptions> Add ability to transition the blockperiodseconds config. --------- Signed-off-by: Jason Frame <jason.frame@consensys.net> Signed-off-by: Simon Dudley <simon.dudley@consensys.net> Co-authored-by: Jason Frame <jason.frame@consensys.net>
Add BFT-style transitions to Clique, modelled with
ForksSchedule<CliqueConfigOptions>
CliqueMiningAcceptanceTest heavily inspired by BftBlockRewardPaymentAcceptanceTest
Preparatory story to #6290 - a
createemptyblocks
transition will be added in the next PR.Create genesis config transitions: