Skip to content

Commit

Permalink
common: configure kaustinen6 network
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Apr 15, 2024
1 parent 7d960df commit 1d44193
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as td from 'testdouble'
import { assert, describe, it } from 'vitest'

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

import type { Chain } from '../../../src/blockchain'
Expand All @@ -16,13 +16,17 @@ const genesisVerkleStateRoot = '0x382960711d9ccf58b9db20122e2253eb9bfa99d513f8c9
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)
* One can run this test in this format:
* 1. Directly pull slots from a kaustinen beacon url
* `TEST_ONLINE_SLOTS=15 PEER_BEACON_URL=https://beacon.verkle-gen-devnet-6.ethpandaops.io DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen6.spec.ts`
*
* However there are other ways to run the test with save data and testvectors but they are from old versions but
* can be updated to make it work
*
* a. On the saved blocks, comma separated (were produced for kaustinen4 )
* `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=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/kaustinen5.spec.ts`
* b. Geth produced testvectors (were produced for kaustinen5)
* `TEST_GETH_VEC_DIR=test/testdata/gethk5vecs DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen6.spec.ts`
*/

const originalValidate = (BlockHeader as any).prototype._consensusFormatValidation
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": "1711712640"
"timestamp": "1712848560"
}
10 changes: 5 additions & 5 deletions packages/common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,23 +570,23 @@ export const chains: ChainsDict = {
'enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.holesky.ethdisco.net',
],
},
kaustinen5: {
name: 'kaustinen5',
kaustinen6: {
name: 'kaustinen6',
chainId: 69420,
networkId: 69420,
defaultHardfork: 'prague',
consensus: {
type: 'pos',
algorithm: 'casper',
},
comment: 'Verkle kaustinen testnet 3 (likely temporary, do not hard-wire into production code)',
comment: 'Verkle kaustinen testnet 6 (likely temporary, do not hard-wire into production code)',
url: 'https://github.com/eth-clients/kaustinen/',
genesis: {
difficulty: '0x01',
extraData: '0x',
gasLimit: '0x17D7840',
nonce: '0x0000000000001234',
timestamp: '0x6606a9bc',
timestamp: '0x6617feb0',
},
hardforks: [
{
Expand Down Expand Up @@ -646,7 +646,7 @@ export const chains: ChainsDict = {
{
name: 'prague',
block: null,
timestamp: '1711712640',
timestamp: '1712848500',
},
],
bootstrapNodes: [],
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export enum Chain {
Goerli = 5,
Sepolia = 11155111,
Holesky = 17000,
Kaustinen5 = 69420,
Kaustinen6 = 69420,
}

/**
Expand Down Expand Up @@ -44,8 +44,8 @@ export const ChainGenesis: Record<Chain, GenesisState> = {
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783'),
},
[Chain.Kaustinen5]: {
name: 'kaustinen5',
[Chain.Kaustinen6]: {
name: 'kaustinen6',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0x382960711d9ccf58b9db20122e2253eb9bfa99d513f8c9d4e85b55971721f4de'),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/genesis/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('genesis test', () => {
const chainIds = Object.keys(ChainGenesis)
for (const chainId of chainIds) {
// Kaustinen can have an empty genesis state since verkle blocks contain their pre-state
if (Number(chainId) === Chain.Kaustinen5) continue
if (Number(chainId) === Chain.Kaustinen6) continue

const { name, stateRoot: expectedRoot } = ChainGenesis[chainId as unknown as Chain]

Expand Down

0 comments on commit 1d44193

Please sign in to comment.