Skip to content

Commit 6d11cee

Browse files
authored
Merge pull request #54 from datachainlab/feature/rolentz_msec
Support msec timestamp and 500 epoch length in BEP520
2 parents 73492e8 + b74c1ca commit 6d11cee

35 files changed

+1210
-744
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ jobs:
5454
run: |
5555
make chain
5656
make contracts
57-
sleep 20
57+
# epoch is 200, 400, 500, 1000
58+
# must wait for 400 block (1.5sec * 400)
59+
sleep 600
5860
make relayer
5961
make test
6062
- name: integration-test

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
![CI](https://github.com/datachainlab/ibc-parlia-relay/workflows/CI/badge.svg?branch=main)
44

55
## Supported Versions
6-
- [yui-relayer v0.5.3](https://github.com/hyperledger-labs/yui-relayer/releases/tag/v0.5.3)
7-
- [ethereum-ibc-relay-chain v0.3.4](https://github.com/datachainlab/ethereum-ibc-relay-chain/releases/tag/v0.3.4)
6+
- [yui-relayer v0.5.11](https://github.com/hyperledger-labs/yui-relayer/releases/tag/v0.5.11)
7+
- [ethereum-ibc-relay-chain v0.3.16](https://github.com/datachainlab/ethereum-ibc-relay-chain/releases/tag/v0.3.6)
88

99
## Setup Relayer
1010

@@ -29,14 +29,6 @@ func main() {
2929
}
3030
```
3131

32-
## Change blocks per epoch
33-
34-
* You can change blocks per epoch by build arguments.
35-
* This is only for local net.
36-
```
37-
go build -tags dev -ldflags="-X github.com/datachainlab/ibc-parlia-relay/module/constant.blocksPerEpoch=20" -o testrly .
38-
```
39-
4032
## Development
4133

4234
Generate proto buf with protobuf definition of [parlia-elc](https://github.com/datachainlab/parlia-elc).
@@ -48,3 +40,12 @@ cd ibc-parlia-relay
4840
make proto-import
4941
make proto-gen
5042
```
43+
44+
## About ForkSpec
45+
46+
1. Set HF height as soon as possible
47+
As soon as the HF height is determined, please modify the timestamp in the ForkSpec to the height as soon as possible.
48+
HF height is calculated from timestamp, but the further away from the HF, the longer it takes to calculate.
49+
50+
2. Limitation of the CreateClient
51+
When the latest HF height is not set it is impossible to create client if the latest finalize header is after latest HF timestamp

e2e/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ contracts:
1313
.PHONY:relayer
1414
relayer:
1515
rm -rf .testrly
16-
go build -tags dev -ldflags="-X github.com/datachainlab/ibc-parlia-relay/module/constant.blocksPerEpoch=20" -o testrly .
17-
# go build -o testrly .
16+
go build -o testrly .
1817
./testrly config init --home .testrly
1918
./testrly chains add-dir config/demo/ --home .testrly
2019
./testrly paths add ibc0 ibc1 ibc01 --file=config/path.json --home .testrly

e2e/chains/bsc/Dockerfile.bootstrap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM ghcr.io/foundry-rs/foundry:nightly-462b2ac6c038dc24b8f38b0c59b664d0740604c2
33
RUN apk add --d --no-cache ca-certificates npm nodejs bash alpine-sdk expect jq curl bash python3
44
RUN curl -sSL https://install.python-poetry.org | python3 -
55

6-
RUN git clone https://github.com/bnb-chain/bsc-genesis-contract -b v1.2.4 /root/genesis \
7-
&& cd /root/genesis && npm ci
6+
RUN git clone https://github.com/bnb-chain/bsc-genesis-contract -b develop /root/genesis \
7+
&& cd /root/genesis && git checkout 44ebc6c17a00bd24db3240141a78091528dcebbb && npm ci
88

99
RUN cd /root/genesis && /root/.local/bin/poetry install
1010
RUN cd /root/genesis && forge install --no-git --no-commit foundry-rs/forge-std@v1.7.3

e2e/chains/bsc/docker-compose.bsc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ services:
55
dockerfile: Dockerfile.bsc
66
args:
77
GIT_SOURCE: https://github.com/bnb-chain/bsc
8-
GIT_CHECKOUT_BRANCH: v1.5.5
8+
GIT_CHECKOUT_BRANCH: v1.5.9
99
image: bsc-geth:docker-local

e2e/chains/bsc/docker-compose.simple.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ services:
1919
dockerfile: Dockerfile.bootstrap
2020
env_file: .env
2121
environment:
22-
BLOCKS_PER_EPOCH: 20
2322
INIT_HOLDER_BALANCE: "500000000000000000000"
2423
NUMS_OF_VALIDATOR: 5
2524
INIT_NUM_OF_CABINETS: 4
@@ -42,7 +41,6 @@ services:
4241
dockerfile: Dockerfile.bootstrap
4342
env_file: .env2
4443
environment:
45-
BLOCKS_PER_EPOCH: 20
4644
INIT_HOLDER_BALANCE: "500000000000000000000"
4745
NUMS_OF_VALIDATOR: 3
4846
INIT_NUM_OF_CABINETS: 2

e2e/chains/bsc/genesis/contracts/BSCValidatorSet.sol

Lines changed: 52 additions & 384 deletions
Large diffs are not rendered by default.

e2e/chains/bsc/genesis/genesis-template.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"bohrTime": 0,
3636
"pascalTime": 0,
3737
"pragueTime": 0,
38+
"lorentzTime": 0,
3839
"blobSchedule": {
3940
"cancun": {
4041
"target": 3,
@@ -48,8 +49,6 @@
4849
}
4950
},
5051
"parlia": {
51-
"period": 3,
52-
"epoch": {{BLOCKS_PER_EPOCH}}
5352
}
5453
},
5554
"nonce": "0x0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const web3 = require("web3")
22

33
const addresses = "{{INIT_HOLDER_ADDRESSES}}"
4-
const balance = web3.utils.toBN("{{INIT_HOLDER_BALANCE}}").toString("hex")
4+
const balance = BigInt("{{INIT_HOLDER_BALANCE}}").toString(16)
55
const init_holders = addresses.split(",").map(address => ({ address, balance }));
66

77
exports = module.exports = init_holders

e2e/chains/bsc/scripts/bootstrap.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ function init_validator() {
3535
function generate_genesis() {
3636
INIT_HOLDER_ADDRESSES=$(ls ${workspace}/init-holders | tr '\n' ',')
3737
INIT_HOLDER_ADDRESSES=${INIT_HOLDER_ADDRESSES/%,/}
38-
echo "blocks per epoch = ${BLOCKS_PER_EPOCH}"
3938

4039
echo "replace genesis-template.template"
41-
sed "s/{{BLOCKS_PER_EPOCH}}/${BLOCKS_PER_EPOCH}/g" genesis-template.template >genesis-template.json
40+
cp genesis-template.template genesis-template.json
4241

4342
echo "replace init_holders.template"
4443
sed "s/{{INIT_HOLDER_ADDRESSES}}/${INIT_HOLDER_ADDRESSES}/g" scripts/init_holders.template | sed "s/{{INIT_HOLDER_BALANCE}}/${INIT_HOLDER_BALANCE}/g" >scripts/init_holders.js
@@ -49,7 +48,7 @@ function generate_genesis() {
4948

5049
echo "replace generate.py"
5150
sed "s/dev_chain_id: int = 714/dev_chain_id: int = ${BSC_CHAIN_ID}/g" scripts/generate.py > scripts/generate.py.out
52-
sed "s/epoch: str = \"200\"/epoch: str = \"${BLOCKS_PER_EPOCH}\"/g" scripts/generate.py.out > scripts/generate.py
51+
cp scripts/generate.py.out scripts/generate.py
5352

5453
echo "start generate validators"
5554
node scripts/generate-validator.js

0 commit comments

Comments
 (0)