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

Return initial difficulty for when the previous block is Genesis #1136

Merged
merged 11 commits into from
Aug 8, 2023

Conversation

alfiedotwtf
Copy link
Contributor

More info in #1002

@alfiedotwtf
Copy link
Contributor Author

CI failed on Ubuntu, but I don't capture the error. I'll update all the blockprod tests so we can see what's happening when they fail.

@alfiedotwtf alfiedotwtf marked this pull request as ready for review August 5, 2023 08:01
@alfiedotwtf
Copy link
Contributor Author

alfiedotwtf commented Aug 5, 2023

The failed test in CI was cancel_received() in blockprod/src/detail/test.rs. This test creates a new Genesis with an initial difficulty of zero...

The 57ee633 commit was supposed to return the chain config's current PoW limit i.e zero, however after following the call stack, it was never using the overridden value, as seen in get_proof_of_work_config() from commit e2b9d75.

These last few commits creates a PoWChainConfig builder which allows the caller to override chain settings -as is done now in get_proof_of_work_config() to override the difficulty by looking at NetUpgrades (if available) rather than straight to the default value.

@alfiedotwtf alfiedotwtf marked this pull request as draft August 5, 2023 14:05
@alfiedotwtf alfiedotwtf marked this pull request as ready for review August 7, 2023 12:30
common/src/chain/config/builder.rs Outdated Show resolved Hide resolved
common/src/chain/config/mod.rs Show resolved Hide resolved
@alfiedotwtf alfiedotwtf merged commit 8b0038d into master Aug 8, 2023
23 checks passed
@alfiedotwtf alfiedotwtf deleted the alfie/genesis-ongoing branch August 8, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants