-
Notifications
You must be signed in to change notification settings - Fork 6
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
Tests should run Besu with zero-second block time #105
Comments
Clique
consensus with zero-second block timeClique
with zero-second block time
To address this, I attempted to switch to the Clique consensus algorithm, which allows for a configurable block period. The idea was to try and set Here’s how I set the config:
Unfortunately, as expected, setting
Further FindingsEven when setting blockperiodseconds to 1, I didn’t notice a significant reduction in CPU usage of the Besu container, which indicates that switching to the Clique consensus algorithm alone might not be a sufficient solution. Next StepsI’ve opened a draft PR (#125) with the code changes to switch to Clique consensus for review. This is just for reference, and we will close the PR if we decide not to pursue this solution further. cc @matthew1001 |
I'm not aware of Besu having any option to run with It would be interesting (and maybe not a huge amount of work?) to add an option to Besu to allow sub-second blocks purely for development purposes. I think Ethereum blocks have a timestamp that's only at second granularity so maybe there would be some weird side effects? Getting an OSS PR merged with anything that's too hacky isn't going to be easy but a patch on our fork with a hard-coded 100ms block time or something might be doable. |
Yes, I believe this is beyond the scope of this issue. |
😢 - I do think we want to be testing with Besu (rather than Geth/Quorum) in this repo... but practically it's going to be an absolutely nightmare if we can't write full blockchain tests. @matthew1001 going to ask for your input here from the Besu maintainer perspective |
I've just opened draft PR hyperledger/besu#7588 which checks for env var E.g. for
I'll start a discussion on discord about how amenable the community are to this sort of dev/ci-cd oriented feature. I did have to hack the block-header timestamp verifier because it assumes a block < 1 second older than its parent never happens. |
TL;DRCreating an empty block every 300ms is highly demanding in terms of both memory and CPU resources. OverviewI built an image from the fork and tested it with both consensus algorithms. Clique ConfigurationHere’s how I set up the Clique configuration: Here’s the docker-compose file for Clique:
QBFT ConfigurationHere is how I configured QBFT: Here’s the docker-compose file for QBFT:
Results:The CPU usage clearly indicates that the consumption is far higher with the current setup, making it less efficient. |
Clique
with zero-second block time
The code here https://github.com/kaleido-io/paladin/tree/main/testinfra/besu_bootstrap starts up Hyperledger Besu as part of the
startTestInfra
with the production grade and strategic QBFT consensus algorithm.However, the shortest block time available for that algorithm (currently) is 1 second, even in a development environment.
This makes tests really slow that do actual blockchain transactions - because they need to wait for up to 2 seconds for their transactions to make it into a block and be confirmed, and sometime there are multiple sequential transactions required.
So even though it's deprecated it would be great to have an alternative set of code in
besu_bootstrap
that tries configuring Besu using Clique withblockperiodseconds
and hyperledger/besu#6082:https://besu.hyperledger.org/23.4.0/private-networks/how-to/configure/consensus/clique
Note: I'm not 100% sure personally that Hyperledger Besu works like go-ethereum has always has done for Clique, where this zero-second block time means "mine on demand" - but the easiest way to find out is to try it!
The text was updated successfully, but these errors were encountered: