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

verkle test: count the code chunks in the witness #102

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down Expand Up @@ -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")
Expand All @@ -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)
}
}