Skip to content

Commit

Permalink
fix(reth): use reth instead of geth (#1410)
Browse files Browse the repository at this point in the history
## What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `zk spellcheck`.
- [ ] Linkcheck has been run via `zk linkcheck`.

---------

Signed-off-by: Danil <deniallugo@gmail.com>
  • Loading branch information
Deniallugo authored Mar 14, 2024
1 parent 1422481 commit bd98dc7
Show file tree
Hide file tree
Showing 31 changed files with 156 additions and 471 deletions.
6 changes: 1 addition & 5 deletions bin/ci_localnet_up
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@ set -e

cd $ZKSYNC_HOME

mkdir -p ./volumes/postgres ./volumes/geth/keystore ./volumes/prysm/beacon ./volumes/prysm/validator
cp ./docker/prysm/config.yml ./volumes/prysm/config.yml
cp ./docker/geth/jwtsecret ./volumes/geth/jwtsecret
cp ./docker/geth/password.sec ./volumes/geth/password.sec
cp ./docker/geth/keystore/UTC--2019-04-06T21-13-27.692266000Z--8a91dc2d28b689474298d91899f0c1baf62cb85b ./volumes/geth/keystore/
mkdir -p ./volumes/postgres ./volumes/reth/data
docker-compose --profile runner up -d --wait
1 change: 1 addition & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ OversizedData
M5
eth_sign
geth
reth
ethers
js
recovery_id
Expand Down
2 changes: 1 addition & 1 deletion contracts
14 changes: 12 additions & 2 deletions core/lib/eth_client/src/clients/http/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,18 @@ impl EthInterface for QueryClient {
.web3
.eth()
.block(BlockId::Number(BlockNumber::Pending))
.await?
.expect("Pending block should always exist");
.await?;
let block = if let Some(block) = block {
block
} else {
// Fallback for local reth. Because of artificial nature of producing blocks in local reth setup
// there may be no pending block
self.web3
.eth()
.block(BlockId::Number(BlockNumber::Latest))
.await?
.expect("Latest block always exists")
};

latency.observe();
// base_fee_per_gas always exists after London fork
Expand Down
2 changes: 1 addition & 1 deletion core/tests/loadnext/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn default_l1_rpc_address() -> String {

fn default_master_wallet_pk() -> String {
// Use this key only for localhost because it is compromised!
// Using this key for Rinkeby will result in losing Rinkeby ETH.
// Using this key for Testnet will result in losing Testnet ETH.
// Corresponding wallet is `0x36615Cf349d7F6344891B1e7CA7C72883F5dc049`
let result = "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110".to_string();
tracing::info!("Using default MASTER_WALLET_PK: {result}");
Expand Down
30 changes: 22 additions & 8 deletions core/tests/revert-test/tests/revert-and-restart-en.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,35 @@ describe('Block reverting test', function () {
const lastExecuted: BigNumber = await main_contract.getTotalBlocksExecuted();
// One is not enough to test the reversion of sk cache because
// it gets updated with some batch logs only at the start of the next batch.
for (let i = 0; i < 2; i++) {
const h: zkweb3.types.PriorityOpResponse = await extNode.tester.syncWallet.deposit({
token: zkweb3.utils.ETH_ADDRESS,
amount: depositAmount,
to: alice.address
});
await h.waitL1Commit();
const initialL1BatchNumber = (await main_contract.getTotalBlocksCommitted()).toNumber();
const firstDepositHandle = await extNode.tester.syncWallet.deposit({
token: zkweb3.utils.ETH_ADDRESS,
amount: depositAmount,
to: alice.address
});

await firstDepositHandle.wait();
while ((await extNode.tester.web3Provider.getL1BatchNumber()) <= initialL1BatchNumber) {
await utils.sleep(0.1);
}

const secondDepositHandle = await extNode.tester.syncWallet.deposit({
token: zkweb3.utils.ETH_ADDRESS,
amount: depositAmount,
to: alice.address
});
await secondDepositHandle.wait();
while ((await extNode.tester.web3Provider.getL1BatchNumber()) <= initialL1BatchNumber + 1) {
await utils.sleep(0.3);
}

while (true) {
const lastCommitted: BigNumber = await main_contract.getTotalBlocksCommitted();
console.log(`lastExecuted = ${lastExecuted}, lastCommitted = ${lastCommitted}`);
if (lastCommitted.sub(lastExecuted).gte(2)) {
break;
}
await utils.sleep(1);
await utils.sleep(0.3);
}
const alice2 = await alice.getBalance();
console.log('Terminate the main node');
Expand Down
4 changes: 2 additions & 2 deletions core/tests/ts-integration/tests/custom-erc20-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ describe('Tests for the custom bridge behavior', () => {
const gasPrice = await scaledGasPrice(alice);

let l1Bridge = await l1bridgeFactory.deploy(process.env.CONTRACTS_DIAMOND_PROXY_ADDR!);
await l1Bridge.deployTransaction.wait(2);
await l1Bridge.deployTransaction.wait();
let l1BridgeProxyFactory = new TransparentUpgradeableProxyFactory(alice._signerL1());
let l1BridgeProxy = await l1BridgeProxyFactory.deploy(l1Bridge.address, bob.address, '0x');
const amount = 1000; // 1000 wei is enough.
await l1BridgeProxy.deployTransaction.wait(2);
await l1BridgeProxy.deployTransaction.wait();

const isLocalSetup = process.env.ZKSYNC_LOCAL_SETUP;
const baseCommandL1 = isLocalSetup
Expand Down
20 changes: 15 additions & 5 deletions docker-compose-cpu-runner.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
version: '3.2'
services:
geth:
image: "matterlabs/geth:latest"
environment:
- PLUGIN_CONFIG
reth:
restart: always
image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2"
volumes:
- type: bind
source: ./volumes/reth/data
target: /rethdata
- type: bind
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

zk:
image: "matterlabs/zk-environment:latest2.0-lightweight-nightly"
depends_on:
- geth
- reth
- postgres
security_opt:
- seccomp:unconfined
Expand Down
24 changes: 17 additions & 7 deletions docker-compose-gpu-runner-cuda-12-0.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
version: '3.2'
services:
geth:
image: "matterlabs/geth:latest"
environment:
- PLUGIN_CONFIG
reth:
restart: always
image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2"
volumes:
- type: bind
source: ./volumes/reth/data
target: /rethdata
- type: bind
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

zk:
image: matterlabs/zk-environment:cuda-12-0-latest
depends_on:
- geth
- reth
- postgres
security_opt:
- seccomp:unconfined
Expand All @@ -27,7 +37,7 @@ services:
- SCCACHE_GCS_RW_MODE=READ_WRITE
- CI=1
- GITHUB_WORKSPACE=$GITHUB_WORKSPACE
# We set CUDAARCHS for l4 gpu's
# We set CUDAARCHS for l4 gpu's
- CUDAARCHS=89
# We need to forward all nvidia-devices, as due to bug with cgroups and nvidia-container-runtime (https://github.com/NVIDIA/libnvidia-container/issues/176#issuecomment-1159454366), cgroups are disabled and thou GPU isn't properly forwarded to dind
devices:
Expand All @@ -43,7 +53,7 @@ services:
resources:
reservations:
devices:
- capabilities: [gpu]
- capabilities: [ gpu ]
postgres:
image: "postgres:14"
command: postgres -c 'max_connections=200'
Expand Down
22 changes: 16 additions & 6 deletions docker-compose-gpu-runner.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
version: '3.2'
services:
geth:
image: "matterlabs/geth:latest"
environment:
- PLUGIN_CONFIG
reth:
restart: always
image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2"
volumes:
- type: bind
source: ./volumes/reth/data
target: /rethdata
- type: bind
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

zk:
image: "matterlabs/zk-environment:cuda-11-8-latest"
container_name: zk
depends_on:
- geth
- reth
- postgres
security_opt:
- seccomp:unconfined
Expand All @@ -34,7 +44,7 @@ services:
resources:
reservations:
devices:
- capabilities: [gpu]
- capabilities: [ gpu ]
postgres:
image: "postgres:14"
command: postgres -c 'max_connections=200'
Expand Down
24 changes: 2 additions & 22 deletions docker-compose-runner-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,7 @@ services:
file: docker-compose.yml
service: postgres

geth:
reth:
extends:
file: docker-compose.yml
service: geth

create-beacon-chain-genesis:
extends:
file: docker-compose.yml
service: create-beacon-chain-genesis

validator:
extends:
file: docker-compose.yml
service: validator

beacon:
extends:
file: docker-compose.yml
service: beacon

geth-genesis:
extends:
file: docker-compose.yml
service: geth-genesis
service: reth
113 changes: 13 additions & 100 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,107 +1,20 @@
version: '3.2'
services:
create-beacon-chain-genesis:
image: "gcr.io/prysmaticlabs/prysm/cmd/prysmctl:HEAD-c6801d"
command:
- testnet
- generate-genesis
- --fork=deneb
- --num-validators=64
- --genesis-time-delay=5
- --output-ssz=/consensus/genesis.ssz
- --chain-config-file=/prysm/config.yml
- --geth-genesis-json-in=/geth/standard-dev.json
- --geth-genesis-json-out=/execution/genesis.json
reth:
restart: always
image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2"
volumes:
- ./docker/geth:/geth/:ro
- ./docker/prysm:/prysm/:ro
- ./volumes/geth:/execution
- ./volumes/prysm:/consensus
geth-genesis:
image: "ethereum/client-go:v1.13.5"
command: --datadir=/execution init /execution/genesis.json
volumes:
- ./volumes/geth:/execution
depends_on:
create-beacon-chain-genesis:
condition: service_completed_successfully
geth:
image: "ethereum/client-go:v1.13.5"
ports:
- 8551:8551
- 8545:8545
- 8546:8546
volumes:
- ./volumes/geth:/var/lib/geth/data
- ./docker/geth/:/geth/:ro
command:
- --networkid=9
- --datadir=/var/lib/geth/data
- --http
- --http.api=engine,eth,web3,personal,net,debug
- --http.addr=0.0.0.0
- --http.corsdomain=*
- --http.vhosts=*
- --ws
- --ws.addr=0.0.0.0
- --ws.port=8546
- --ws.origins=*
- --nodiscover
- --authrpc.addr=0.0.0.0
- --authrpc.vhosts=*
- --authrpc.jwtsecret=/var/lib/geth/data/jwtsecret
- --allow-insecure-unlock
- --unlock=0x8a91dc2d28b689474298d91899f0c1baf62cb85b
- --password=/var/lib/geth/data/password.sec
- --syncmode=full
depends_on:
beacon:
condition: service_started
geth-genesis:
condition: service_completed_successfully
beacon:
image: "gcr.io/prysmaticlabs/prysm/beacon-chain:HEAD-c6801d"
command:
- --datadir=/consensus/beacon/
- --min-sync-peers=0
- --genesis-state=/consensus/genesis.ssz
- --bootstrap-node=
- --interop-eth1data-votes
- --chain-config-file=/consensus/config.yml
- --contract-deployment-block=0
- --chain-id=9
- --rpc-host=0.0.0.0
- --grpc-gateway-host=0.0.0.0
- --execution-endpoint=http://geth:8551
- --accept-terms-of-use
- --jwt-secret=/execution/jwtsecret
- --suggested-fee-recipient=0x8a91dc2d28b689474298d91899f0c1baf62cb85b
- --minimum-peers-per-subnet=0
- --enable-debug-rpc-endpoints
- type: bind
source: ./volumes/reth/data
target: /rethdata
- type: bind
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 4000:4000
- 3500:3500
- 6060:6060
volumes:
- ./volumes/prysm:/consensus
- ./volumes/geth:/execution
depends_on:
create-beacon-chain-genesis:
condition: service_completed_successfully
validator:
image: "gcr.io/prysmaticlabs/prysm/validator:HEAD-c6801d"
command:
- --beacon-rpc-provider=beacon:4000
- --datadir=/consensus/validatordata
- --accept-terms-of-use
- --interop-num-validators=64
- --interop-start-index=0
- --chain-config-file=/consensus/config.yml
depends_on:
beacon:
condition: service_started
volumes:
- ./volumes/prysm:/consensus
- 127.0.0.1:8545:8545

postgres:
image: "postgres:14"
command: postgres -c 'max_connections=200'
Expand Down
13 changes: 0 additions & 13 deletions docker/geth/Dockerfile

This file was deleted.

Loading

0 comments on commit bd98dc7

Please sign in to comment.