Skip to content

Commit

Permalink
common: configure and sync/fix verkle kaustinen5 (#3343)
Browse files Browse the repository at this point in the history
* common: configure and sync/fix verkle kaustinen5

* apply fixes for 2020 sload cost removal and storage comparision when non existent storage written with zero

* review 4762 and refactor/apply access fixes as well as partial account contract related fixed

* debug and add contract complete accesses even when contract is created with no initcode

* debug and fix the warm sload cost

* debug failing block 114 and 157 and add missing accesses for codehash and balance

* debug and fix the 2935 ringbuffer access

* cleanup and commit the k5 fixes

* lint fix
  • Loading branch information
g11tech authored Apr 11, 2024
1 parent df50617 commit 6eccff7
Show file tree
Hide file tree
Showing 19 changed files with 717 additions and 1,057 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import * as td from 'testdouble'
import { assert, describe, it } from 'vitest'

import blocks from '../../testdata/blocks/kaustinen4.json'
import genesisJSON from '../../testdata/geth-genesis/kaustinen4.json'
import genesisJSON from '../../testdata/geth-genesis/kaustinen5.json'
import { getRpcClient, setupChain } from '../helpers.js'

import type { Chain } from '../../../src/blockchain'
import type { BeaconPayloadJson } from '@ethereumjs/block'
import type { Common } from '@ethereumjs/common'
import type { HttpClient } from 'jayson/promise'
const genesisVerkleStateRoot = '0x382960711d9ccf58b9db20122e2253eb9bfa99d513f8c9d4e85b55971721f4de'
const genesisVerkleBlockHash = '0x8493ed97fd4314acb6ed519867b086dc698e25df37ebe8f2bc77313537710744'
const genesisVerkleBlockHash = '0x086326f2922364dba375e7c9bed375d622845615c0974ffd1d3be0e34edbfbc3'

/**
* One can run this test in two formats:
* 1. On the saved blocks, comma separated which are limited (353,368,374,467)
* `TEST_SAVED_NUMBERS=353,368,374,467 npx vitest run test/rpc/engine/kaustinen4.spec.ts`
* `TEST_SAVED_NUMBERS=353,368,374,467 npx vitest run test/rpc/engine/kaustinen5.spec.ts`
* 2. Directly pull slots from a kaustinen beacon url
* `TEST_ONLINE_SLOTS=345,353..360 PEER_BEACON_URL=https://beacon.verkle-gen-devnet-4.ethpandaops.io npx vitest run test/rpc/engine/kaustinen4.spec.ts`
* `TEST_ONLINE_SLOTS=15 PEER_BEACON_URL=https://beacon.verkle-gen-devnet-5.ethpandaops.io DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen5.spec.ts`
* 3. Geth produced testvectors
* `TEST_GETH_VEC_DIR=test/testdata/gethk5vecs DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen4.spec.ts`
* `TEST_GETH_VEC_DIR=test/testdata/gethk5vecs DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen5.spec.ts`
*/

const originalValidate = (BlockHeader as any).prototype._consensusFormatValidation
Expand Down Expand Up @@ -108,8 +108,11 @@ describe(`valid verkle network setup`, async () => {
for (let i = startSlot; i <= endSlot; i++) {
const execute = await fetchExecutionPayload(process.env.PEER_BEACON_URL, i)
it(`run fetched block slot: ${i} number: ${execute.block_number}`, async () => {
await runBlock({ common, chain, rpc }, { parent, execute }, true)
parent = execute
try {
await runBlock({ common, chain, rpc }, { parent, execute }, true)
} finally {
parent = execute
}
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,5 +897,5 @@
"nonce": "0x1234",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "1707215400"
"timestamp": "1711712640"
}
2 changes: 1 addition & 1 deletion packages/client/test/testdata/gethk5vecs/block2.rlp.hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f90b57f90219a08e7e37a7664e1d835638e774cc86cf76c10c205057761512066ca88155e6d8aca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a05832f8c71d85786b0d9120398af8c0f7127492ace63e9abe21560718ddef172da002010f59e092529d1f2b457e7c1911a08cdf728a14ac1088ea9615dce3b87447a087acc91f5561bb4a9b68e34b0399003c74a3a428dad7d1151f8aa055c9141f93b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080028347e7c483041a6f1480a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842dcf2261a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f90936f8650384342770c08252089401020300000000000000000000000000000000008203e78026a0b1dc957ad929efeadb591bd77121aea2a1808c8a82e460d671aaccce2e96855aa038de06965d668cfaeb7d33d97e3c8e03380aac057741afa265756b32d07c43b0f8650484342770c08252089400000000000000000000000000000000000000008203e78025a013c16fdd3018f4cdd2db8cd0cdf694973de65df7179bbb0c10de42583acaed7aa0633d469034029959d960c23d3b028ae68360c1a4a66663f4d841aaca69b0c6ebf8630584342770c0825208940000000000000000000000000000000000000000808025a0640b2c69c75bedf0b9388e5b60e40ea6f4ea0a084b6660ab27ace0c66dfc04c7a052dc3febc7ca404f37b267a961de42ea35e6de362fcefc6f6928a830837f0ce5f86a0684342770c0832dc6c080109a6060604052600a8060106000396000f360606040526008565b0026a0e909f28a02715713732d38899d8dfe97688ffa3dc7a96a5072b367bac35badcba061e24f56eab4f791158b16ca771b7914d85d401f549618329624be3d546adef9f907940784342770c0832dc6c08080b9074260806040526040516100109061017b565b604051809103906000f08015801561002c573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561007857600080fd5b5060008067ffffffffffffffff8111156100955761009461024a565b5b6040519080825280601f01601f1916602001820160405280156100c75781602001600182028036833780820191505090505b50905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506020600083833c81610101906101e3565b60405161010d90610187565b61011791906101a3565b604051809103906000f080158015610133573d6000803e3d6000fd5b50600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505061029b565b60d58061046783390190565b6102068061053c83390190565b61019d816101d9565b82525050565b60006020820190506101b86000830184610194565b92915050565b6000819050602082019050919050565b600081519050919050565b6000819050919050565b60006101ee826101ce565b826101f8846101be565b905061020381610279565b925060208210156102435761023e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8360200360080261028e565b831692505b5050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600061028582516101d9565b80915050919050565b600082821b905092915050565b6101bd806102aa6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f566852414610030575b600080fd5b61003861004e565b6040516100459190610146565b60405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166381ca91d36040518163ffffffff1660e01b815260040160206040518083038186803b1580156100b857600080fd5b505afa1580156100cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f0919061010a565b905090565b60008151905061010481610170565b92915050565b6000602082840312156101205761011f61016b565b5b600061012e848285016100f5565b91505092915050565b61014081610161565b82525050565b600060208201905061015b6000830184610137565b92915050565b6000819050919050565b600080fd5b61017981610161565b811461018457600080fd5b5056fea2646970667358221220a6a0e11af79f176f9c421b7b12f441356b25f6489b83d38cc828a701720b41f164736f6c63430008070033608060405234801561001057600080fd5b5060b68061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ab5ed15014602d575b600080fd5b60336047565b604051603e9190605d565b60405180910390f35b60006001905090565b6057816076565b82525050565b6000602082019050607060008301846050565b92915050565b600081905091905056fea26469706673582212203a14eb0d5cd07c277d3e24912f110ddda3e553245a99afc4eeefb2fbae5327aa64736f6c63430008070033608060405234801561001057600080fd5b5060405161020638038061020683398181016040528101906100329190610063565b60018160001c6100429190610090565b60008190555050610145565b60008151905061005d8161012e565b92915050565b60006020828403121561007957610078610129565b5b60006100878482850161004e565b91505092915050565b600061009b826100f0565b91506100a6836100f0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156100db576100da6100fa565b5b828201905092915050565b6000819050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b610137816100e6565b811461014257600080fd5b50565b60b3806101536000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806381ca91d314602d575b600080fd5b60336047565b604051603e9190605a565b60405180910390f35b60005481565b6054816073565b82525050565b6000602082019050606d6000830184604d565b92915050565b600081905091905056fea26469706673582212209bff7098a2f526de1ad499866f27d6d0d6f17b74a413036d6063ca6a0998ca4264736f6c6343000807003326a0e910089d33abf2c4fbc11ae870a94928bceb63362c2df12d88769e40132c69aba04c148c16c0b06a51ccf2f9644552a4510cce5dda2626c1912b0ddb8a738020a2c0c0
f90b57f90219a08e7e37a7664e1d835638e774cc86cf76c10c205057761512066ca88155e6d8aca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a055642da29f7dc1fc26acc9402343ba000849ec7c0e4f4f4305a9a07ce5cd4c60a002010f59e092529d1f2b457e7c1911a08cdf728a14ac1088ea9615dce3b87447a013f13a8cb9b8b9ad01f1b891c6b56b212f86b01f61541167d30cd2fd23d27bedb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080028347e7c48303ea631480a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842dcf2261a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f90936f8650384342770c08252089401020300000000000000000000000000000000008203e78026a0b1dc957ad929efeadb591bd77121aea2a1808c8a82e460d671aaccce2e96855aa038de06965d668cfaeb7d33d97e3c8e03380aac057741afa265756b32d07c43b0f8650484342770c08252089400000000000000000000000000000000000000008203e78025a013c16fdd3018f4cdd2db8cd0cdf694973de65df7179bbb0c10de42583acaed7aa0633d469034029959d960c23d3b028ae68360c1a4a66663f4d841aaca69b0c6ebf8630584342770c0825208940000000000000000000000000000000000000000808025a0640b2c69c75bedf0b9388e5b60e40ea6f4ea0a084b6660ab27ace0c66dfc04c7a052dc3febc7ca404f37b267a961de42ea35e6de362fcefc6f6928a830837f0ce5f86a0684342770c0832dc6c080109a6060604052600a8060106000396000f360606040526008565b0026a0e909f28a02715713732d38899d8dfe97688ffa3dc7a96a5072b367bac35badcba061e24f56eab4f791158b16ca771b7914d85d401f549618329624be3d546adef9f907940784342770c0832dc6c08080b9074260806040526040516100109061017b565b604051809103906000f08015801561002c573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561007857600080fd5b5060008067ffffffffffffffff8111156100955761009461024a565b5b6040519080825280601f01601f1916602001820160405280156100c75781602001600182028036833780820191505090505b50905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506020600083833c81610101906101e3565b60405161010d90610187565b61011791906101a3565b604051809103906000f080158015610133573d6000803e3d6000fd5b50600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505061029b565b60d58061046783390190565b6102068061053c83390190565b61019d816101d9565b82525050565b60006020820190506101b86000830184610194565b92915050565b6000819050602082019050919050565b600081519050919050565b6000819050919050565b60006101ee826101ce565b826101f8846101be565b905061020381610279565b925060208210156102435761023e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8360200360080261028e565b831692505b5050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600061028582516101d9565b80915050919050565b600082821b905092915050565b6101bd806102aa6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f566852414610030575b600080fd5b61003861004e565b6040516100459190610146565b60405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166381ca91d36040518163ffffffff1660e01b815260040160206040518083038186803b1580156100b857600080fd5b505afa1580156100cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f0919061010a565b905090565b60008151905061010481610170565b92915050565b6000602082840312156101205761011f61016b565b5b600061012e848285016100f5565b91505092915050565b61014081610161565b82525050565b600060208201905061015b6000830184610137565b92915050565b6000819050919050565b600080fd5b61017981610161565b811461018457600080fd5b5056fea2646970667358221220a6a0e11af79f176f9c421b7b12f441356b25f6489b83d38cc828a701720b41f164736f6c63430008070033608060405234801561001057600080fd5b5060b68061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ab5ed15014602d575b600080fd5b60336047565b604051603e9190605d565b60405180910390f35b60006001905090565b6057816076565b82525050565b6000602082019050607060008301846050565b92915050565b600081905091905056fea26469706673582212203a14eb0d5cd07c277d3e24912f110ddda3e553245a99afc4eeefb2fbae5327aa64736f6c63430008070033608060405234801561001057600080fd5b5060405161020638038061020683398181016040528101906100329190610063565b60018160001c6100429190610090565b60008190555050610145565b60008151905061005d8161012e565b92915050565b60006020828403121561007957610078610129565b5b60006100878482850161004e565b91505092915050565b600061009b826100f0565b91506100a6836100f0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156100db576100da6100fa565b5b828201905092915050565b6000819050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b610137816100e6565b811461014257600080fd5b50565b60b3806101536000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806381ca91d314602d575b600080fd5b60336047565b604051603e9190605a565b60405180910390f35b60005481565b6054816073565b82525050565b6000602082019050606d6000830184604d565b92915050565b600081905091905056fea26469706673582212209bff7098a2f526de1ad499866f27d6d0d6f17b74a413036d6063ca6a0998ca4264736f6c6343000807003326a0e910089d33abf2c4fbc11ae870a94928bceb63362c2df12d88769e40132c69aba04c148c16c0b06a51ccf2f9644552a4510cce5dda2626c1912b0ddb8a738020a2c0c0
Loading

0 comments on commit 6eccff7

Please sign in to comment.