From 5975b444dc4d787b716cd877b71badce77352886 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Mon, 9 May 2022 09:55:44 +0200 Subject: [PATCH] verkle test: count the code chunks in the witness (#102) --- core/state_processor_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 6ef451f55bf7..d2a9932395a6 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -491,7 +491,7 @@ func TestProcessVerkleCodeDeployExec(t *testing.T) { gen.AddTx(tx) } else { // Call the contract's `store` function in block #2 - tx, _ := types.SignTx(types.NewTransaction(1, contractAddr, big.NewInt(16), 3000000, big.NewInt(875000000), callStoreInput), signer, testKey) + tx, _ := types.SignTx(types.NewTransaction(1, contractAddr, big.NewInt(0), 3000000, big.NewInt(875000000), callStoreInput), signer, testKey) gen.AddTx(tx) } }) @@ -536,9 +536,11 @@ func TestProcessVerkleCodeDeployExec(t *testing.T) { } hascode = false + codeCount := 0 for _, kv := range b2.Header().VerkleKeyVals { if bytes.Equal(contractStem[:], kv.Key[:31]) && kv.Key[31] >= 128 { hascode = true + codeCount++ if len(kv.Value) == 0 { t.Fatal("chunk value for called code should not be empty in witness") @@ -558,4 +560,8 @@ func TestProcessVerkleCodeDeployExec(t *testing.T) { if !hascode { t.Fatal("could not find contract code in the witness of the calling block") } + + if codeCount != 10 { + t.Fatalf("got %d code chunks, expected 10", codeCount) + } }