Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump up relayer version to 0.5.3 #28

Merged
merged 18 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- name: lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.53
args: --timeout=5m0s
version: v1.58
# still using the deprecated types in ibc-go v8
args: --timeout=5m0s --disable staticcheck
- name: test
run: go test -v ./...
e2e:
Expand All @@ -33,13 +34,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- name: test
working-directory: e2e
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BSC_IBC_PROTO ?= ../parlia-elc/proto/definitions

DOCKER := $(shell which docker)

protoVer=0.13.1
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --user 0 --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

Expand Down
5 changes: 3 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.PHONY:chain
chain:
make -C chains build
make -C chains network
# For Apple Silicon explicit declaration 'linux/amd64' is required
DOCKER_DEFAULT_PLATFORM=linux/amd64 make -C chains build
DOCKER_DEFAULT_PLATFORM=linux/amd64 make -C chains network
# Wait for one epoch to use BEP-126 validator
sleep 60

Expand Down
4 changes: 2 additions & 2 deletions e2e/chains/bsc/Dockerfile.bsc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.19-alpine
FROM golang:1.21-alpine

ARG GIT_SOURCE
ARG GIT_CHECKOUT_BRANCH

RUN apk add --no-cache make cmake gcc musl-dev linux-headers git bash build-base libc-dev
RUN apk add --no-cache make cmake gcc musl-dev linux-headers git bash build-base libc-dev jq

ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
Expand Down
18 changes: 3 additions & 15 deletions e2e/chains/bsc/config/config-bsc-rpc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ EnablePreimageRecording = false
[Eth.Miner]
GasFloor = 30000000
GasCeil = 40000000
GasPrice = 5000000000
GasPrice = 3000000000
Recommit = 10000000000
Noverify = false

[Eth.Ethash]
CacheDir = ""
CachesInMem = 0
CachesOnDisk = 0
CachesLockMmap = false
DatasetDir = ""
DatasetsInMem = 0
DatasetsOnDisk = 0
DatasetsLockMmap = false
PowMode = 0

[Eth.TxPool]
Locals = []
NoLocals = true
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 5000000000
PriceLimit = 3000000000
PriceBump = 10
AccountSlots = 128
GlobalSlots = 10000
Expand Down Expand Up @@ -64,4 +52,4 @@ EnableMsgEvents = false
[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000
IdleTimeout = 120000000000
16 changes: 2 additions & 14 deletions e2e/chains/bsc/config/config-validator.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@ EVMInterpreter = ""
[Eth.Miner]
GasFloor = 30000000
GasCeil = 40000000
GasPrice = 5000000000
GasPrice = 3000000000
Recommit = 10000000000
Noverify = false

[Eth.Ethash]
CacheDir = ""
CachesInMem = 0
CachesOnDisk = 0
CachesLockMmap = false
DatasetDir = ""
DatasetsInMem = 0
DatasetsOnDisk = 0
DatasetsLockMmap = false
PowMode = 0

[Eth.GPO]
Blocks = 20
Expand All @@ -55,4 +43,4 @@ EnableMsgEvents = false

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
WriteTimeout = 30000000000
4 changes: 1 addition & 3 deletions e2e/chains/bsc/docker-compose.bsc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
version: "3.8"

services:
bsc-geth:
build:
context: .
dockerfile: Dockerfile.bsc
args:
GIT_SOURCE: https://github.com/binance-chain/bsc.git
GIT_CHECKOUT_BRANCH: v1.2.10
GIT_CHECKOUT_BRANCH: v1.4.5
image: bsc-geth:docker-local
4 changes: 0 additions & 4 deletions e2e/chains/bsc/docker-compose.simple.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

volumes:
bsc-rpc:
bsc-validator1-1:
Expand Down Expand Up @@ -34,7 +32,6 @@ services:
- ./scripts:/root/scripts
- ./config:/root/config
- ./init-holders:/root/init-holders
- ./validators/bls:/root/validators/bls
- ./validators/keystore:/root/validators/keystore
command: /root/scripts/bootstrap.sh

Expand All @@ -57,7 +54,6 @@ services:
- ./scripts:/root/scripts
- ./config:/root/config
- ./init-holders:/root/init-holders
- ./validators/bls:/root/validators/bls
- ./validators/keystore:/root/validators/keystore
command: /root/scripts/bootstrap.sh

Expand Down
78 changes: 38 additions & 40 deletions e2e/chains/bsc/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
#!/usr/bin/env bash

workspace=$(
cd $(dirname $0)
pwd
cd $(dirname $0)
pwd
)/..

function prepare() {
if ! [[ -f /usr/local/bin/geth ]]; then
echo "geth do not exist!"
exit 1
fi
# run `make clean` to remove files
cd ${workspace}/genesis
rm -rf validators.conf
if ! [[ -f /usr/local/bin/geth ]]; then
echo "geth do not exist!"
exit 1
fi
# run `make clean` to remove files
cd ${workspace}/genesis
rm -rf validators.conf
}

function init_validator() {
node_id=$1
node_id=$1

# set validator address
mkdir -p ${workspace}/storage/${node_id}/keystore
cp ${workspace}/validators/keystore/${node_id} ${workspace}/storage/${node_id}/keystore/${node_id}
mkdir -p ${workspace}/storage/${node_id}/keystore
cp ${workspace}/validators/keystore/${node_id} ${workspace}/storage/${node_id}/keystore/${node_id}
validatorAddr=0x$(cat ${workspace}/storage/${node_id}/keystore/${node_id} | jq .address | sed 's/"//g')
echo ${validatorAddr} >${workspace}/storage/${node_id}/address
echo ${validatorAddr} >${workspace}/storage/${node_id}/address

# import BLS vote address
echo password01 > ${workspace}/storage/${node_id}/blspassword.txt
geth --datadir ${workspace}/storage/${node_id} bls account import ${workspace}/validators/bls/${node_id} --blspassword ${workspace}/storage/${node_id}/blspassword.txt --blsaccountpassword ${workspace}/storage/${node_id}/blspassword.txt
geth --datadir ${workspace}/storage/${node_id} bls account list --blspassword ${workspace}/storage/${node_id}/blspassword.txt
voteAddr=0x$(cat ${workspace}/validators/bls/${node_id} | jq .pubkey | sed 's/"//g')
# create new BLS vote address
expect ${workspace}/scripts/create_bls_key.sh ${workspace}/storage/${node_id}
voteAddr=0x$(cat ${workspace}/storage/${node_id}/bls/keystore/*json| jq .pubkey | sed 's/"//g')
siburu marked this conversation as resolved.
Show resolved Hide resolved
echo $voteAddr

echo "${validatorAddr},${validatorAddr},${validatorAddr},0x0000000010000000,${voteAddr}" >>${workspace}/genesis/validators.conf
echo "${validatorAddr},${validatorAddr},${validatorAddr},0x0000000010000000,${voteAddr}" >>${workspace}/genesis/validators.conf
}

function generate_genesis() {
INIT_HOLDER_ADDRESSES=$(ls ${workspace}/init-holders | tr '\n' ',')
INIT_HOLDER_ADDRESSES=${INIT_HOLDER_ADDRESSES/%,/}
echo "blocks per epoch = ${BLOCKS_PER_EPOCH}"
sed "s/{{BLOCKS_PER_EPOCH}}/${BLOCKS_PER_EPOCH}/g" ${workspace}/genesis/genesis-template.template >${workspace}/genesis/genesis-template.json
sed "s/{{INIT_HOLDER_ADDRESSES}}/${INIT_HOLDER_ADDRESSES}/g" ${workspace}/genesis/init_holders.template | sed "s/{{INIT_HOLDER_BALANCE}}/${INIT_HOLDER_BALANCE}/g" >${workspace}/genesis/init_holders.js
node generate-validator.js
chainIDHex=$(printf '%04x\n' ${BSC_CHAIN_ID})
node generate-genesis.js --chainid ${BSC_CHAIN_ID} --bscChainId ${chainIDHex}
INIT_HOLDER_ADDRESSES=$(ls ${workspace}/init-holders | tr '\n' ',')
INIT_HOLDER_ADDRESSES=${INIT_HOLDER_ADDRESSES/%,/}
echo "blocks per epoch = ${BLOCKS_PER_EPOCH}"
sed "s/{{BLOCKS_PER_EPOCH}}/${BLOCKS_PER_EPOCH}/g" ${workspace}/genesis/genesis-template.template >${workspace}/genesis/genesis-template.json
sed "s/{{INIT_HOLDER_ADDRESSES}}/${INIT_HOLDER_ADDRESSES}/g" ${workspace}/genesis/init_holders.template | sed "s/{{INIT_HOLDER_BALANCE}}/${INIT_HOLDER_BALANCE}/g" >${workspace}/genesis/init_holders.js
node generate-validator.js
chainIDHex=$(printf '%04x\n' ${BSC_CHAIN_ID})
node generate-genesis.js --chainid ${BSC_CHAIN_ID} --bscChainId ${chainIDHex}
}

function init_genesis_data() {
node_type=$1
node_id=$2
geth --datadir ${workspace}/storage/${node_id} init ${workspace}/genesis/genesis.json
cp ${workspace}/config/config-${node_type}.toml ${workspace}/storage/${node_id}/config.toml
sed -i -e "s/{{NetworkId}}/${BSC_CHAIN_ID}/g" ${workspace}/storage/${node_id}/config.toml
if [ "${node_id}" == "bsc-rpc" ]; then
cp ${workspace}/init-holders/* ${workspace}/storage/${node_id}/keystore
cp ${workspace}/genesis/genesis.json ${workspace}/storage/${node_id}
cp ${workspace}/config/bootstrap.key ${workspace}/storage/${node_id}/geth/nodekey
fi
node_type=$1
node_id=$2
geth --datadir ${workspace}/storage/${node_id} init --state.scheme hash --db.engine=leveldb ${workspace}/genesis/genesis.json
cp ${workspace}/config/config-${node_type}.toml ${workspace}/storage/${node_id}/config.toml
sed -i -e "s/{{NetworkId}}/${BSC_CHAIN_ID}/g" ${workspace}/storage/${node_id}/config.toml
if [ "${node_id}" == "bsc-rpc" ]; then
cp ${workspace}/init-holders/* ${workspace}/storage/${node_id}/keystore
cp ${workspace}/genesis/genesis.json ${workspace}/storage/${node_id}
cp ${workspace}/config/bootstrap.key ${workspace}/storage/${node_id}/geth/nodekey
fi
}

prepare

# First, generate config for each validator
for ((i = 1; i <= ${NUMS_OF_VALIDATOR}; i++)); do
init_validator "bsc-validator${i}"
generate_validator_conf "bsc-validator${i}"
init_validator "bsc-validator${i}"
done

# Then, use validator configs to generate genesis file
Expand All @@ -72,5 +70,5 @@ generate_genesis
init_genesis_data bsc-rpc bsc-rpc

for ((i = 1; i <= ${NUMS_OF_VALIDATOR}; i++)); do
init_genesis_data validator "bsc-validator${i}"
init_genesis_data validator "bsc-validator${i}"
done
2 changes: 1 addition & 1 deletion e2e/chains/bsc/scripts/bsc-rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ done

ETHSTATS=""
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
--verbosity ${VERBOSE} --nousb ${ETHSTATS} \
--state.scheme=hash --db.engine=leveldb --verbosity ${VERBOSE} --nousb ${ETHSTATS} \
--unlock ${unlock_sequences} --password /dev/null --ipcpath /gethipc
6 changes: 3 additions & 3 deletions e2e/chains/bsc/scripts/bsc-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ echo "validator id: ${HOST_IP}"

ETHSTATS=""
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
--verbosity ${VERBOSE} --nousb ${ETHSTATS} \
--verbosity ${VERBOSE} --nousb ${ETHSTATS} --state.scheme=hash --db.engine=leveldb \
--bootnodes enode://${BOOTSTRAP_PUB_KEY}@${BOOTSTRAP_IP}:${BOOTSTRAP_TCP_PORT} \
--mine -unlock ${VALIDATOR_ADDR} --password /dev/null \
--mine --miner.etherbase=${VALIDATOR_ADDR} -unlock ${VALIDATOR_ADDR} --password /dev/null --blspassword /scripts/wallet_password.txt \
--light.serve 50 --pprof.addr 0.0.0.0 --metrics \
--rpc.allow-unprotected-txs --txlookuplimit 15768000 \
--rpc.allow-unprotected-txs --history.transactions 15768000 \
--pprof --ipcpath /gethipc --vote
8 changes: 1 addition & 7 deletions e2e/chains/bsc/scripts/create_bls_key.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#!/usr/bin/expect
# 6 num wanted
set wallet_password 123456
# 10 characters at least wanted
set account_password 1234567890
set wallet_password 1234567890

set timeout 5
spawn geth bls account new --datadir [lindex $argv 0]
expect "*assword:*"
send "$wallet_password\r"
expect "*assword:*"
send "$wallet_password\r"
expect "*assword:*"
send "$account_password\r"
expect "*assword:*"
send "$account_password\r"
expect EOF
11 changes: 10 additions & 1 deletion e2e/chains/bsc/scripts/genesis-template.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@
"muirGlacierBlock": 0,
"ramanujanBlock": 0,
"nielsBlock": 0,
"mirrorSyncBlock":1,
"mirrorSyncBlock":0,
"brunoBlock": 1,
"eulerBlock": 2,
"gibbsBlock": 3,
"moranBlock": 4,
"planckBlock": 5,
"lubanBlock": 6,
"platoBlock": 7,
"berlinBlock": 8,
"londonBlock": 8,
"hertzBlock": 8,
"hertzfixBlock": 8,
"shanghaiTime": 0,
"keplerTime": 0,
"feynmanTime": 0,
"feynmanFixTime": 0,
"cancunTime": 0,
"parlia": {
"period": 3,
"epoch": {{BLOCKS_PER_EPOCH}}
Expand Down
1 change: 1 addition & 0 deletions e2e/chains/bsc/scripts/wallet_password.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1234567890
31 changes: 0 additions & 31 deletions e2e/chains/bsc/validators/bls/bsc-validator1

This file was deleted.

Loading