From d8dcf1d96572ed4f4b477e7fe7cbab4a38f130f4 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Wed, 27 Sep 2023 17:48:39 -0700 Subject: [PATCH] rebase, and document BonsaiReferenceTestWorldState bypass of stateroot check. Signed-off-by: garyschulte --- .../referencetests/BonsaiReferenceTestWorldState.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BonsaiReferenceTestWorldState.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BonsaiReferenceTestWorldState.java index 6e61c0dc39f..0e23f5406af 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BonsaiReferenceTestWorldState.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BonsaiReferenceTestWorldState.java @@ -75,9 +75,18 @@ public ReferenceTestWorldState copy() { layerCopy, cachedMerkleTrieLoader, trieLogManager, preImageProxy); } + /** + * If the supplied header has a non-zero state root, verify. Else we assume that stateroot is an + * output instead of an input for this reference test and we bypass the state root check. + * + *

Besu reference-test style test cases should supply a stateroot to verify to prevent bonsai + * regressions. + * + * @param calculatedStateRoot state root calculated during bonsai persist step. + * @param header supplied reference test block header. + */ @Override protected void verifyWorldStateRoot(final Hash calculatedStateRoot, final BlockHeader header) { - // if the supplied header has a non-zero state root, verify. Else bypass if (!header.getStateRoot().equals(Hash.ZERO)) { super.verifyWorldStateRoot(calculatedStateRoot, header); }