Skip to content

Commit e696120

Browse files
ryaniog11tech
andauthored
merge: kiln v2 updates (#1750)
* update random to prevRandao * improve optimistic sync todo note * add engine_exchangeTransitionConfigurationV1 * remove kintusgi folder and add wip kiln folder * update newPayload test (random -> prevRandao) * update exchangeTransitionConfiguration * add tests for exchangeTransitionConfigurationV1 * only parse jwtSecret if rpcEngine && rpcEngineAuth * devnet5 instructions (#1766) * client: increase json parser size (#1769) * improve/clarify kiln readme * touch ups Co-authored-by: g11tech <76567250+g11tech@users.noreply.github.com>
1 parent da0c698 commit e696120

25 files changed

+173
-1863
lines changed

packages/block/src/header.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ export class BlockHeader {
6666
}
6767

6868
/**
69-
* EIP-4399: Post-PoS merge, `mixHash` supplanted as `random`
69+
* EIP-4399: After merge to PoS, `mixHash` supplanted as `prevRandao`
7070
*/
71-
get random() {
71+
get prevRandao() {
7272
if (!this._common.isActivatedEIP(4399)) {
7373
const msg = this._errorMsg(
74-
'The random parameter can only be accessed when EIP-4399 is activated'
74+
'The prevRandao parameter can only be accessed when EIP-4399 is activated'
7575
)
7676
throw new Error(msg)
7777
}

packages/block/test/mergeBlock.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ tape('[Header]: Casper PoS / The Merge Functionality', function (t) {
105105
st.end()
106106
})
107107

108-
t.test('EIP-4399: random should return mixHash value', function (st) {
108+
t.test('EIP-4399: prevRando should return mixHash value', function (st) {
109109
const mixHash = Buffer.alloc(32, 3)
110110
let block = Block.fromBlockData({ header: { mixHash } }, { common })
111-
st.ok(block.header.random.equals(mixHash), 'random should return mixHash value')
111+
st.ok(block.header.prevRandao.equals(mixHash), 'prevRandao should return mixHash value')
112112

113113
const commonLondon = common.copy()
114114
commonLondon.setHardfork(Hardfork.London)
115115
block = Block.fromBlockData({ header: { mixHash } }, { common: commonLondon })
116116
try {
117-
block.header.random
117+
block.header.prevRandao
118118
st.fail('should have thrown')
119119
} catch (e: any) {
120-
st.pass('random should throw if EIP-4399 is not activated')
120+
st.pass('prevRandao should throw if EIP-4399 is not activated')
121121
}
122122
st.end()
123123
})

packages/client/bin/startRpc.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export function startRPCServers(client: EthereumClient, args: RPCArgs) {
108108
rpcCors,
109109
} = args
110110
const manager = new RPCManager(client, config)
111-
const jwtSecret = parseJwtSecret(config, jwtSecretPath)
111+
const jwtSecret =
112+
rpcEngine && rpcEngineAuth ? parseJwtSecret(config, jwtSecretPath) : Buffer.from([])
112113

113114
if (rpc || ws) {
114115
const withEngineMethods = rpcEngine && rpcEnginePort === rpcport && rpcEngineAddr === rpcaddr
@@ -148,7 +149,7 @@ export function startRPCServers(client: EthereumClient, args: RPCArgs) {
148149
withEngineMiddleware: withEngineMethods && rpcEngineAuth ? { jwtSecret } : undefined,
149150
}
150151
if (rpcaddr === wsAddr && rpcport === wsPort) {
151-
// We want to loadon the websocket upgrade request to the same server
152+
// We want to load the websocket upgrade request to the same server
152153
Object.assign(opts, { httpServer: rpcHttpServer })
153154
}
154155

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM node:16-alpine as build
22
WORKDIR /usr/app
33
RUN apk update && apk add --no-cache bash git && rm -rf /var/cache/apk/*
44

5-
RUN git clone --depth 1 --branch merge-kintsugi https://github.com/ethereumjs/ethereumjs-monorepo.git
5+
RUN git clone --depth 1 --branch merge-kiln-v2 https://github.com/ethereumjs/ethereumjs-monorepo.git
66

77
WORKDIR /usr/app/ethereumjs-monorepo
88
RUN npm i

packages/client/kiln/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# kiln v2 instructions
2+
3+
kiln v2 spec merge-devnet-5 has been bootstrapped.
4+
5+
The config files can be downloaded from https://github.com/eth-clients/merge-testnets/tree/main/merge-devnet-5
6+
7+
## Execution - EthereumJS Setup
8+
9+
Please ensure you have Node 12.x+ installed.
10+
11+
1. `git clone --depth 1 --branch merge-kiln-v2 https://github.com/ethereumjs/ethereumjs-monorepo.git`
12+
1. `cd ethereumjs-monorepo`
13+
1. `npm i`
14+
1. `cd packages/client`
15+
16+
### Download the config
17+
18+
1. `cd kiln`
19+
2. `git init && git remote add -f origin https://github.com/eth-clients/merge-testnets.git && git config core.sparseCheckout true && echo "merge-devnet-5/*" >> .git/info/sparse-checkout && git pull --depth=1 origin main`
20+
21+
This will download the config files to `kiln/merge-devnet-5`.
22+
23+
### Run client
24+
25+
1. `npm run client:start -- --datadir kiln/datadir --gethGenesis kiln/merge-devnet-5/genesis.json --saveReceipts --rpc --ws --rpcEngine --rpcEnginePort=8545 --bootnodes=`
26+
27+
Starting the client will write a `kiln/datadir/jwtsecret` file with a randomly generated secret to be used in conjunction with a CL client. To prevent the secret to be re-generated next time you restart the client, pass the file as an argument to read from via `--jwt-secret=kiln/datadir/jwtsecret`.
28+
29+
#### Docker
30+
31+
Or try it in Docker.
32+
33+
In `packages/client/kiln` run:
34+
35+
`docker-compose --file docker-compose.ethereumjs.yml up`
36+
37+
## Consensus
38+
39+
### Lodestar
40+
41+
#### Beacon
42+
43+
1. Use lodestar branch `master` and run `yarn && yarn build`
44+
2. Export path of the downloaded config dir `export CONFIG_PATH=/path/to/ethereumjs-monorepo/packages/client/kiln/merge-devnet-5`
45+
3. Export path of the written jwt secret file `export JWT_SECRET_PATH=/path/to/ethereumjs-monorepo/packages/client/kiln/datadir/jwtsecret`
46+
4. Run cmd: `./lodestar beacon --rootDir kiln/temp --paramsFile $CONFIG_PATH/config.yaml --genesisStateFile $CONFIG_PATH/genesis.ssz --bootnodesFile $CONFIG_PATH/boot_enr.yaml --network.connectToDiscv5Bootnodes --network.discv5.enabled true --eth1.enabled true --eth1.providerUrls=http://localhost:8545 --execution.urls=http://localhost:8545 --eth1.disableEth1DepositDataTracker true --jwt-secret $JWT_SECRET_PATH`
47+
48+
#### Validator
49+
50+
1. Run cmd: `./lodestar validator --rootDir=kiln/temp_validatordata --paramsFile=$CONFIG_PATH/config.yaml --keystoresDir=kiln/keystores --secretsDir=kiln/secrets`
51+
52+
Also, one will need to remove `--eth1.disableEth1DepositDataTracker true` and instead provide `--eth1.depositContractDeployBlock <block number>` in the previous beacon start command. The block number can be extracted from `kiln/merge-devnet-5/deposit_contract_block.txt`
53+
54+
### Lighthouse
55+
56+
### Beacon
57+
58+
1. Use lighthouse branch `unstable` and run `make`
59+
1. Make dir `lighthouse/kiln` and copy in from the downloaded config dir: `config.yaml`, `genesis.ssz`, `deploy_block.txt`, `deposit_contract.txt`, `deposit_contract_block.txt`
60+
1. Run cmd: `lighthouse --debug-level=info --datadir=kiln/datadir --testnet-dir=kiln beacon_node --disable-enr-auto-update --dummy-eth1 --boot-nodes="enr:" --merge --http-allow-sync-stalled --metrics --disable-packet-filter --execution-endpoints=http://127.0.0.1:8545 --terminal-total-difficulty-override=`

0 commit comments

Comments
 (0)