Skip to content

Commit c41d752

Browse files
Merge pull request #368 from ava-labs/local-genesis
Upgrade local genesis to include apricot phase 1 block timestamp
2 parents 54e703f + 2f4e689 commit c41d752

File tree

7 files changed

+69
-6
lines changed

7 files changed

+69
-6
lines changed

.ci/run_e2e_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ AVALANCHE_IMAGE="$AVALANCHE_IMAGE_REPO:$AVALANCHE_IMAGE_TAG"
1717
echo "Using Avalanche Image: $AVALANCHE_IMAGE"
1818

1919
DOCKER_REPO="avaplatform"
20-
BYZANTINE_IMAGE="$DOCKER_REPO/avalanche-byzantine:v0.1.5-rc.1"
21-
TEST_SUITE_IMAGE="$DOCKER_REPO/avalanche-testing:v0.10.5-rc.3"
20+
BYZANTINE_IMAGE="$DOCKER_REPO/avalanche-byzantine:v0.2.0-rc.1"
21+
TEST_SUITE_IMAGE="$DOCKER_REPO/avalanche-testing:v0.11.0-rc.1"
2222

2323
# Kurtosis Environment Parameters
2424
KURTOSIS_CORE_CHANNEL="1.0.3"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ keys/staker.*
5353
plugins/
5454

5555
scripts/ansible/*inventory.yml
56+
scripts/.build_image_gopath/

genesis/genesis_local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var (
8686
"delegationFee": 62500
8787
}
8888
],
89-
"cChainGenesis": "{\"config\":{\"chainId\":43112,\"homesteadBlock\":0,\"daoForkBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip150Hash\":\"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0\",\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x5f5e100\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0100000000000000000000000000000000000000\":{\"code\":\"0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80631e010439146042578063b6510bb314606e575b600080fd5b605c60048036036020811015605657600080fd5b503560b1565b60408051918252519081900360200190f35b818015607957600080fd5b5060af60048036036080811015608e57600080fd5b506001600160a01b03813516906020810135906040810135906060013560b6565b005b30cd90565b836001600160a01b031681836108fc8690811502906040516000604051808303818888878c8acf9550505050505015801560f4573d6000803e3d6000fd5b505050505056fea26469706673582212201eebce970fe3f5cb96bf8ac6ba5f5c133fc2908ae3dcd51082cfee8f583429d064736f6c634300060a0033\",\"balance\":\"0x0\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}",
89+
"cChainGenesis": "{\"config\":{\"chainId\":43112,\"homesteadBlock\":0,\"daoForkBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip150Hash\":\"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0\",\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"apricotPhase1BlockTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x5f5e100\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0100000000000000000000000000000000000000\":{\"code\":\"0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80631e010439146042578063b6510bb314606e575b600080fd5b605c60048036036020811015605657600080fd5b503560b1565b60408051918252519081900360200190f35b818015607957600080fd5b5060af60048036036080811015608e57600080fd5b506001600160a01b03813516906020810135906040810135906060013560b6565b005b30cd90565b836001600160a01b031681836108fc8690811502906040516000604051808303818888878c8acf9550505050505015801560f4573d6000803e3d6000fd5b505050505056fea26469706673582212201eebce970fe3f5cb96bf8ac6ba5f5c133fc2908ae3dcd51082cfee8f583429d064736f6c634300060a0033\",\"balance\":\"0x0\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}",
9090
"message": "{{ fun_quote }}"
9191
}`
9292

genesis/genesis_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func TestGenesis(t *testing.T) {
271271
},
272272
"local": {
273273
networkID: constants.LocalID,
274-
expected: "d036edc78cee38f003c529fa2ca3f95da47c7b87f5f3c0e126c9bf34e7f2285a",
274+
expected: "a3c68cdeed559645a1de90e7ad5a4adf691e9d2094dbfb4dd5d9515fa567258b",
275275
},
276276
"local (with custom specified)": {
277277
networkID: constants.LocalID,
@@ -376,7 +376,7 @@ func TestVMGenesis(t *testing.T) {
376376
},
377377
{
378378
vmID: evm.ID,
379-
expectedID: "26sSDdFXoKeShAqVfvugUiUQKhMZtHYDLeBqmBfNfcdjziTrZA",
379+
expectedID: "2XFHbWN57HrjHW1JqhP9wzj92eYHpiH7EGLnY9mNfWn9w9CvWR",
380380
},
381381
},
382382
},

scripts/build_coreth.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BUILD_DIR="$AVALANCHE_PATH/build" # Where binaries go
1313
PLUGIN_DIR="$BUILD_DIR/plugins" # Where plugin binaries (namely coreth) go
1414
BINARY_PATH="$PLUGIN_DIR/evm"
1515

16-
CORETH_VER="v0.3.27"
16+
CORETH_VER="v0.4.0-rc.7"
1717

1818
CORETH_PATH="$GOPATH/pkg/mod/github.com/ava-labs/coreth@$CORETH_VER"
1919

scripts/build_local_dep_image.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
echo "Building docker image based off of most recent local commits of avalanchego and coreth"
8+
9+
AVALANCHE_REMOTE="git@github.com:ava-labs/avalanchego.git"
10+
CORETH_REMOTE="git@github.com:ava-labs/coreth.git"
11+
DOCKERHUB_REPO="avaplatform/avalanchego"
12+
13+
DOCKER="${DOCKER:-docker}"
14+
SCRIPT_DIRPATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
15+
ROOT_DIRPATH="$(dirname "${SCRIPT_DIRPATH}")"
16+
17+
AVA_LABS_RELATIVE_PATH="src/github.com/ava-labs"
18+
EXISTING_GOPATH="$GOPATH"
19+
20+
export GOPATH="$SCRIPT_DIRPATH/.build_image_gopath"
21+
WORKPREFIX="$GOPATH/src/github.com/ava-labs"
22+
23+
# Clone the remotes and checkout the desired branch/commits
24+
AVALANCHE_CLONE="$WORKPREFIX/avalanchego"
25+
CORETH_CLONE="$WORKPREFIX/coreth"
26+
27+
# Replace the WORKPREFIX directory
28+
rm -rf "$WORKPREFIX"
29+
mkdir -p "$WORKPREFIX"
30+
31+
32+
AVALANCHE_COMMIT_HASH="$(git -C "$EXISTING_GOPATH/$AVA_LABS_RELATIVE_PATH/avalanchego" rev-parse --short HEAD)"
33+
CORETH_COMMIT_HASH="$(git -C "$EXISTING_GOPATH/$AVA_LABS_RELATIVE_PATH/coreth" rev-parse --short HEAD)"
34+
35+
git config --global credential.helper cache
36+
37+
git clone "$AVALANCHE_REMOTE" "$AVALANCHE_CLONE"
38+
git -C "$AVALANCHE_CLONE" checkout "$AVALANCHE_COMMIT_HASH"
39+
40+
git clone "$CORETH_REMOTE" "$CORETH_CLONE"
41+
git -C "$CORETH_CLONE" checkout "$CORETH_COMMIT_HASH"
42+
43+
CONCATENATED_HASHES="$AVALANCHE_COMMIT_HASH-$CORETH_COMMIT_HASH"
44+
45+
"$DOCKER" build -t "$DOCKERHUB_REPO:$CONCATENATED_HASHES" "$WORKPREFIX" -f "$SCRIPT_DIRPATH/local.Dockerfile"

scripts/local.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# syntax=docker/dockerfile:experimental
2+
3+
# This Dockerfile is meant to be used with the build_local_dep_image.sh script
4+
# in order to build an image using the local version of coreth
5+
FROM golang:1.15.5-buster
6+
7+
RUN mkdir -p /go/src/github.com/ava-labs
8+
9+
WORKDIR $GOPATH/src/github.com/ava-labs
10+
COPY avalanchego avalanchego
11+
COPY coreth coreth
12+
13+
WORKDIR $GOPATH/src/github.com/ava-labs/avalanchego
14+
RUN ./scripts/build_avalanche.sh
15+
RUN ./scripts/build_coreth.sh ../coreth $PWD/build/plugins/evm
16+
17+
RUN ln -sv $GOPATH/src/github.com/ava-labs/avalanche-byzantine/ /avalanchego

0 commit comments

Comments
 (0)