-
Notifications
You must be signed in to change notification settings - Fork 861
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
Change test to tease NPEs during DefaultBlockchain.<init>() caused by initilization order #7607
Change test to tease NPEs during DefaultBlockchain.<init>() caused by initilization order #7607
Conversation
ddd5b0e
to
4d53a01
Compare
4d53a01
to
3e6da91
Compare
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.
Non-blocking style comment. Otherwise LGTM
gasUsedCounter = | ||
metricsSystem.createCounter( | ||
BesuMetricCategory.BLOCKCHAIN, "chain_head_gas_used_counter", "Counter for Gas used"); | ||
|
||
numberOfTransactionsCounter = | ||
metricsSystem.createCounter( | ||
BesuMetricCategory.BLOCKCHAIN, | ||
"chain_head_transaction_count_counter", | ||
"Counter for the number of transactions"); |
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.
Seem to me it would be tidier to have these in the createGauges() (perhaps rename createMetrics()) method or similar, and declutter the constructor.
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.
Or have another method, createCounters if we want to separate Counters from Gauges ;)
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.
sure, I think I didn't put those in a method because I would have to drop the final qualifier from the fields.
But I'll go with @ahamlat's suggestion and create another method for counters
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 small comment related to using the ArrayDeque instead of ArrayList, but it is not blocking.
ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchainTest.java
Show resolved
Hide resolved
gasUsedCounter = | ||
metricsSystem.createCounter( | ||
BesuMetricCategory.BLOCKCHAIN, "chain_head_gas_used_counter", "Counter for Gas used"); | ||
|
||
numberOfTransactionsCounter = | ||
metricsSystem.createCounter( | ||
BesuMetricCategory.BLOCKCHAIN, | ||
"chain_head_transaction_count_counter", | ||
"Counter for the number of transactions"); |
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.
Or have another method, createCounters if we want to separate Counters from Gauges ;)
… initilization order Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
…used by initilization order move counters into their own method Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
12c254d
to
ab90a1b
Compare
PR description
This complements PR #7601 to make sure possible NPEs are checked during unit tests around
DefaultBlockchain
when the right order of initialization is not followed.Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests