Merge pull request #312 from XinFinOrg/dev-upgrade

CI Upgrade
This commit is contained in:
Liam 2023-08-25 23:53:28 +10:00 committed by GitHub
commit a05b3dab82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 775 additions and 196 deletions

View file

@ -6,10 +6,12 @@ Describe the big picture of your changes here to communicate to the maintainers
What types of changes does your code introduce to XDC network?
_Put an `✅` in the boxes that apply_
- [ ] Bugfix
- [ ] New feature
- [ ] Documentation Update or any other KTLO
- [ ] Not sure (Please specify below)
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update (if none of the other choices apply)
- [ ] Regular KTLO or any of the maintaince work. e.g code style
- [ ] CICD Improvement
## Impacted Components
Which part of the codebase this PR will touch base on,
@ -30,4 +32,6 @@ _Put an `✅` in the boxes once you have confirmed below actions (or provide rea
- [ ] This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
- [ ] Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
- [ ] Tested the backwards compatibility.
- [ ] Relevant documentation has been updated as part of this PR
- [ ] Tested with XDC nodes running this version co-exist with those running the previous version.
- [ ] Relevant documentation has been updated as part of this PR
- [ ] N/A

2
.gitignore vendored
View file

@ -50,5 +50,5 @@ profile.cov
**/yarn-error.log
coverage.txt
go.sum
cicd/devnet/terraform/.terraform
cicd/devnet/terraform/.terraform*
cicd/devnet/tmp

View file

@ -1,10 +1,12 @@
sudo: required
language: go
go_import_path: github.com/XinFinOrg/XDPoSChain
branches:
only:
- master
- dev-upgrade
on:
branches:
- master
- dev-upgrade
tags: true
env:
global:
@ -88,9 +90,33 @@ jobs:
env:
- GO111MODULE=auto
name: T-Z tests
- stage: TAG Build
if: tag IS present
services:
- docker
install: skip
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker --version # document the version travis is using
- docker build -t xinfinorg/xdposchain:$TRAVIS_TAG -f cicd/Dockerfile .
script:
- docker push xinfinorg/xdposchain:$TRAVIS_TAG
- stage: (Devnet) Build, and push images
if: branch = dev-upgrade AND type = push AND tag IS blank
services:
- docker
install: skip
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker --version # document the version travis is using
- docker build -t xinfinorg/devnet:latest -f cicd/Dockerfile .
script:
- docker push xinfinorg/devnet:latest
- stage: (Devnet)Terraform plan
if: branch = dev-upgrade AND type = pull_request
if: branch = dev-upgrade AND type = push AND tag IS blank
dist: xenial
language: bash
install:
@ -105,21 +131,8 @@ jobs:
- terraform init $tf_init_cli_options
- terraform validate $tf_validation_cli_options
- terraform plan $tf_plan_cli_options
- stage: (Devnet) Build, and push images
if: branch = dev-upgrade AND type = push AND tag IS blank
services:
- docker
install: skip
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker --version # document the version travis is using
- docker build -t xdc-devnet -f cicd/devnet/Dockerfile .
script:
- docker tag xdc-devnet:latest xinfinorg/devnet:latest # Always push to the latest
- docker push xinfinorg/devnet:latest
- stage: Terraform apply
- stage: (Devnet) Terraform apply
if: branch = dev-upgrade AND type = push AND tag IS blank
dist: xenial
language: bash
@ -129,7 +142,9 @@ jobs:
- unzip terraform_"$tf_version"_linux_amd64.zip
- sudo mv terraform /usr/local/bin/
- rm terraform_"$tf_version"_linux_amd64.zip
- pip install --user awscli # install aws cli w/o sudo
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip
- sudo ./aws/install
- export PATH=$PATH:$HOME/.local/bin # put aws in the path
script:
- echo "Merge detected, executing changes(Devnet)"
@ -137,19 +152,19 @@ jobs:
# Terraform init and then apply changes to environment
- terraform init $tf_init_cli_options
- terraform apply $tf_apply_cli_options
- sleep 20
- sleep 5
- |
source .env
for ((i=$us_east_2_start;i<$us_east_2_end;i++)); do
echo "Force deploy xdc-$i"
sleep 5 && aws ecs update-service --region us-east-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
aws ecs update-service --region us-east-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment --no-cli-pager;
done
for ((i=$eu_west_1_start;i<$eu_west_1_end;i++)); do
echo "Force deploy xdc-$i"
sleep 5 && aws ecs update-service --region eu-west-1 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
aws ecs update-service --region eu-west-1 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment --no-cli-pager;
done
for ((i=$ap_southeast_2_start;i<$ap_southeast_2_end;i++)); do
echo "Force deploy xdc-$i"
sleep 5 && aws ecs update-service --region ap-southeast-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
aws ecs update-service --region ap-southeast-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment --no-cli-pager;
done

1
cicd/.dockerignore Normal file
View file

@ -0,0 +1 @@
Dockerfile

41
cicd/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
FROM golang:1.14-alpine as builder
RUN apk add make build-base linux-headers
COPY . /builder
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-mainnet
RUN mv /builder/common/constants/constants.go.devnet /builder/common/constants.go
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-devnet
RUN mv /builder/common/constants/constants.go.testnet /builder/common/constants.go
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-testnet
# The runtime image
FROM alpine:3
WORKDIR /work
RUN apk add --no-cache bash curl
COPY --from=builder /builder/build/bin/XDC-devnet /usr/bin
COPY --from=builder /builder/build/bin/XDC-testnet /usr/bin
COPY --from=builder /builder/build/bin/XDC-mainnet /usr/bin
# # Copy over files
ADD cicd/devnet /work/devnet
ADD cicd/testnet /work/testnet
ADD cicd/mainnet /work/mainnet
ADD cicd/entry.sh /work/
# Create an empty pwd file
RUN touch /work/.pwd
# rpc
EXPOSE 8545
# ws
EXPOSE 8555
# port
EXPOSE 30303
ENTRYPOINT ["bash","/work/entry.sh"]

View file

@ -1,52 +1,10 @@
# CI/CD pipeline for XDC
This directory contains CI/CD scripts used for each of the XDC environments.
# Docker Command
## How to deploy more nodes
Adjust the number of variable `num_of_nodes` under file `.env`. (**Maximum supported is 58**)
## Devnet
Each PR merged into `dev-upgrade` will trigger below actions:
- Tests
- Terraform to apply infrascture changes(if any)
- Docker build of XDC with devnet configurations with tag of `:latest`
- Docker push to docker hub. https://hub.docker.com/repository/docker/xinfinorg/devnet
- Deployment of the latest XDC image(from above) to devnet run by AWS ECS
### First time set up an new environment
1. Pre-generate a list of node private keys in below format
## Docker Build
```
{
"xdc0": {
"pk": {{PRIVATE KEY}},
"address": {{XDC wallet address}},
"imageTag": {{Optional field to run different version of XDC}},
"logLevel": {{Optional field to adjust the log level for the container}}
},
"xdc1": {...},
"xdc{{NUMBER}}: {...}
}
docker build -f cicd/Dockerfile .
```
2. Access to aws console, create a bucket with name `tf-devnet-bucket`:
- You can choose any name, just make sure update the name in the s3 bucket name variable in `variables.tf`
- And update the name of the terraform.backend.s3.bucket from `s3.tf`
3. Upload the file from step 1 into the above bucket with name `node-config.json`
4. In order to allow pipeline able to push and deploy via ECR and ECS, we require below environment variables to be injected into the CI pipeline:
1. DOCKER_USERNAME
2. DOCKER_PASSWORD
3. AWS_ACCESS_KEY_ID
4. AWS_SECRET_ACCESS_KEY
You are all set!
## How to run different version of XDC on selected nodes
1. Create a new image tag:
- Check out the repo
- Run docker build `docker build -t xdc-devnet -f cicd/devnet/Dockerfile .`
- Run docker tag `docker tag xdc-devnet:latest xinfinorg/devnet:test-{{put your version number here}}`
- Run docker push `docker push xinfinorg/devnet:test-{{Version number from step above}}`
2. Adjust node-config.json
- Download the node-config.json from s3
- Add/update the `imageTag` field with value of `test-{{version number you defined in step 1}}` for the selected number of nodes you want to test with
- Optional: Adjust the log level by add/updating the field of `logLevel`
- Save and upload to s3
3. Make a dummy PR and get merged. Wait it to be updated.
## Docker Run
```
docker run -it -e NETWORK=devnet -e PRIVATE_KEYS=$KEY $IMAGE
``

View file

@ -1,36 +0,0 @@
FROM golang:1.14 as builder
RUN apt-get update && apt-get install -y git build-essential
COPY . /builder
RUN mv /builder/common/constants/constants.go.devnet /builder/common/constants.go
RUN cd /builder && make
# The actual image for devnet containers
FROM golang:1.14
RUN apt-get update && apt-get install -y git build-essential
WORKDIR /work
COPY --from=builder /builder/build/bin/XDC /usr/bin
RUN chmod +x /usr/bin/XDC
# Copy over files
ADD cicd/devnet/genesis.json /work/genesis.json
ADD cicd/devnet/bootnodes.list /work/bootnodes.list
ADD cicd/devnet/start.sh /work/start.sh
# Create an empty pwd file
RUN touch /work/.pwd
# rpc
EXPOSE 8545
# ws
EXPOSE 8555
# port
EXPOSE 30303
ENTRYPOINT ["bash","/work/start.sh"]

52
cicd/devnet/README.md Normal file
View file

@ -0,0 +1,52 @@
# CI/CD pipeline for XDC
This directory contains CI/CD scripts used for each of the XDC environments.
## How to deploy more nodes
Adjust the number of variable `num_of_nodes` under file `.env`. (**Maximum supported is 58**)
## Devnet
Each PR merged into `dev-upgrade` will trigger below actions:
- Tests
- Terraform to apply infrascture changes(if any)
- Docker build of XDC with devnet configurations with tag of `:latest`
- Docker push to docker hub. https://hub.docker.com/repository/docker/xinfinorg/devnet
- Deployment of the latest XDC image(from above) to devnet run by AWS ECS
### First time set up an new environment
1. Pre-generate a list of node private keys in below format
```
{
"xdc0": {
"pk": {{PRIVATE KEY}},
"address": {{XDC wallet address}},
"imageTag": {{Optional field to run different version of XDC}},
"logLevel": {{Optional field to adjust the log level for the container}}
},
"xdc1": {...},
"xdc{{NUMBER}}: {...}
}
```
2. Access to aws console, create a bucket with name `tf-devnet-bucket`:
- You can choose any name, just make sure update the name in the s3 bucket name variable in `variables.tf`
- And update the name of the terraform.backend.s3.bucket from `s3.tf`
3. Upload the file from step 1 into the above bucket with name `node-config.json`
4. In order to allow pipeline able to push and deploy via ECR and ECS, we require below environment variables to be injected into the CI pipeline:
1. DOCKER_USERNAME
2. DOCKER_PASSWORD
3. AWS_ACCESS_KEY_ID
4. AWS_SECRET_ACCESS_KEY
You are all set!
## How to run different version of XDC on selected nodes
1. Create a new image tag:
- Check out the repo
- Run docker build `docker build -t xdc-devnet -f cicd/devnet/Dockerfile .`
- Run docker tag `docker tag xdc-devnet:latest xinfinorg/devnet:test-{{put your version number here}}`
- Run docker push `docker push xinfinorg/devnet:test-{{Version number from step above}}`
2. Adjust node-config.json
- Download the node-config.json from s3
- Add/update the `imageTag` field with value of `test-{{version number you defined in step 1}}` for the selected number of nodes you want to test with
- Optional: Adjust the log level by add/updating the field of `logLevel`
- Save and upload to s3
3. Make a dummy PR and get merged. Wait it to be updated.

View file

@ -18,11 +18,11 @@ then
echo "${private_key}" >> ./tmp/key
echo "Creating a new wallet"
wallet=$(../../build/bin/XDC account import --password ./tmp/.pwd --datadir ./tmp/xdcchain ./tmp/key | awk -v FS="({|})" '{print $2}')
wallet=$(../../build/bin/XDC account import --password ./tmp/.pwd --datadir ./tmp/xdcchain ./tmp/key | sed -n 's/Address: {\(.*\)}/\1/p')
../../build/bin/XDC --datadir ./tmp/xdcchain init ./genesis.json
else
echo "Wallet already exist, re-use the same one. If you have changed the private key, please manually inspect the key if matches. Otherwise, delete the 'tmp' directory and start again!"
wallet=$(../../build/bin/XDC account list --datadir ./tmp/xdcchain | head -n 1 | awk -v FS="({|})" '{print $2}')
wallet=$(../../build/bin/XDC account list --datadir ./tmp/xdcchain | head -n 1 | sed -n 's/Address: {\(.*\)}/\1/p')
fi
input="./bootnodes.list"

View file

@ -1,8 +1,9 @@
#!/bin/bash
echo "Preparing to start the XDC chain, it's likely to take up to 1 minute"
# Update AWS Max Health can resolve below issue, and it's already addressed
# echo "Preparing to start the XDC chain, it's likely to take up to 1 minute"
# Sleep for > 30 as we need to wait for the ECS tasks container being killed by fargate. Otherwise it will ended up with two same nodes running on a single /work/xdcchain directory
sleep 60
# sleep 60
if [ ! -d /work/xdcchain/XDC/chaindata ]
then
@ -17,11 +18,11 @@ then
echo "${private_key}" >> /tmp/key
echo "Creating a new wallet"
wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -v FS="({|})" '{print $2}')
wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -F '[{}]' '{print $2}')
XDC --datadir /work/xdcchain init /work/genesis.json
else
echo "Wallet already exist, re-use the same one"
wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -v FS="({|})" '{print $2}')
wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -F '[{}]' '{print $2}')
fi
input="/work/bootnodes.list"
@ -55,13 +56,13 @@ echo "Starting nodes with $bootnodes ..."
# Note: --gcmode=archive means node will store all historical data. This will lead to high memory usage. Only needed if you need the node to perform historical operations
XDC --ethstats ${netstats} --gcmode=full \
--nat extip:${INSTANCE_IP} \
--bootnodes ${bootnodes} --syncmode fast \
--bootnodes ${bootnodes} --syncmode full \
--datadir /work/xdcchain --networkid 551 \
-port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \
--rpcport 8545 \
--rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \
--rpcapi admin,db,eth,debug,net,shh,txpool,personal,web3,XDPoS \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--periodicprofile --debugdatadir /work/xdcchain \
--ws --wsaddr=0.0.0.0 --wsport 8555 \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee --append /work/xdcchain/xdc.log
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

View file

@ -1,43 +0,0 @@
[
{
"name": "tfXdcNode",
"image": "xinfinorg/${xdc_environment}:${image_tag}",
"environment": [
{"name": "PRIVATE_KEYS", "value": "${private_keys}"},
{"name": "LOG_LEVEL", "value": "${log_level}"},
{"name": "NODE_NAME", "value": "${node_name}"}
],
"essential": true,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${cloudwatch_group}",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"portMappings": [
{
"hostPort": 8555,
"protocol": "tcp",
"containerPort": 8555
},
{
"hostPort": 8545,
"protocol": "tcp",
"containerPort": 8545
},
{
"hostPort": 30303,
"protocol": "tcp",
"containerPort": 30303
}
],
"mountPoints": [
{
"containerPath": "/work/xdcchain",
"sourceVolume": "efs"
}
]
}
]

View file

@ -2,11 +2,9 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.16"
version = "~> 5.13.1"
}
}
required_version = ">= 1.2.0"
}
# Default

View file

@ -5,7 +5,8 @@
"environment": [
{"name": "PRIVATE_KEYS", "value": "${private_keys}"},
{"name": "LOG_LEVEL", "value": "${log_level}"},
{"name": "NODE_NAME", "value": "${node_name}"}
{"name": "NODE_NAME", "value": "${node_name}"},
{"name": "NETWORK", "value": "${chain_network}"}
],
"essential": true,
"logConfiguration": {

View file

@ -10,6 +10,7 @@ data template_file devnet_container_definition {
cloudwatch_group = "tf-${each.key}"
cloudwatch_region = "${var.region}"
log_level = "${lookup(each.value, "logLevel", "${var.logLevel}")}"
chain_network = "devnet"
}
}
@ -29,8 +30,8 @@ resource "aws_ecs_task_definition" "devnet_task_definition_group" {
# Please set it back to cpu 256 and memory of 2048 after sync is done to save the cost
# cpu = 256
# memory = 2048
cpu = 512
memory = 3072
cpu = 1024
memory = 4096
volume {
name = "efs"
@ -81,7 +82,7 @@ resource "aws_ecs_service" "devnet_ecs_service" {
aws_default_security_group.devnet_xdcnode_security_group.id
]
}
deployment_circuit_breaker {
enable = true
rollback = false

View file

@ -2,18 +2,16 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.16"
version = "~> 5.13.1"
}
}
required_version = ">= 1.2.0"
}
resource "aws_vpc" "devnet_vpc" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
enable_dns_hostnames = true
tags = {
Name = "TfDevnetVpc"
}

13
cicd/entry.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
if test -z "$NETWORK"
then
echo "NETWORK env Must be set, mainnet/testnet/devnet"
exit 1
fi
echo "Select to run $NETWORK..."
ln -s /usr/bin/XDC-$NETWORK /usr/bin/XDC
cp /work/$NETWORK/* /work
echo "Start Node..."
/work/start.sh

View file

@ -0,0 +1,36 @@
enode://11299e930438a12a7171d540e7ed594172babd7856aa518c4ca0a25564d6cf7fe4abaf74a68fd626118c205095f5aa40badf5f16f9651e1743383040f74323ca@154.53.57.144:30303
enode://4ebfb7b3dd8d335fb5160410b9d4b494224caf7e2b5a2630f000a69b9edc83382b7c45536981a60e217876a1f553ed351846f14623e969df0796fb2d5d55b947@209.126.1.10:30303
enode://ad638c179f9f72565bd78db98aa68d3c33b3a476421faeb07e185b18fa95d5999e72c15b9811526a65c0cf27573d25dc1905a5bf09d7de634b5fc5ef1cd661de@209.126.11.108:30303
enode://1e331800102e30f83418b5b6eb59a7e325aaa05f9efb9756e6c6ba1624c8e17ba1dd4334a32c87f9022afe2bb3a53410d9f96a0b4ae3aecd574b08785d5f6014@209.126.2.33:30303
enode://70e471eb021a3bca37407fabe461873380f100823a1ad610d564dd11514e7db2a9c79a74456adda3e3a48f6364ee08f390e3e0df9288eaceae1fc2d084647c92@209.126.0.250:30303
enode://4406a66a21b7c242c4fa9605301e889419e4c0d4f503baed88b24f7521dc783a9259f9fb23ca4748cbad8d48cf59164419438b317a889488cc7bcf0d44023296@161.97.164.153:30303
enode://021fb5b586c865f31db4fc82c9aa9e21110328fe88e1e99a65ca87031bcd6544785c68d47efe15e106c71b0066509d94a1379fb2a95ecdebab77d518b222422f@161.97.131.6:30303
enode://25ce413f1f20ec9099d7c93ea583c749454f0523e906a4d2ad835fbd12eaf296976bd89a3ff1ab7a34d7afe25cc61572a4da5cd6f72c0551240c590f5a1affa2@161.97.131.145:30303
enode://25faf1b866535701790398623ac86705a91dff419a6e460eaf80325220dc2525c97bbf0812085fd8dc9745d1d2a7ff024b7b36aa27f6e4fcb7a10ac508e3078a@161.97.172.27:30303
enode://fc0caeb94dc942f06c56885e07206a0431f6f1045a46de6f7c65a93826220c84f1b72894ffae9091e2e05472f7926b59ed159ffc145ac0225dfb2ac1325b3629@161.97.128.201:30303
enode://6358dd8ba702f8666259d07513f760d897739956e7b8ee4da29cc2461020f04c1d80f3d17becf69f1f0b9bfe5ed83754a5ebbad5a193e9d56266c668cf0ab4ba@161.97.129.254:30303
enode://c5ab74d3cc2a7f68cf16b421ec0c19d1de2aa10de20d6fd4b6589174b216c81e930a7d395cd64099218838f7adb2fd9302a9b5d0650123930ce3ec553369e32b@212.38.189.120:30303
enode://7698c7dd2f5ca348c2237bc62751c3bd8432d89cf082233540d9512a4d49b6d90fea395f0a2d79ccb90ef663c1cb9baa5204a494b904acb91fb42d7ef2991c1b@212.38.189.121:30303
enode://7698c7dd2f5ca348c2237bc62751c3bd8432d89cf082233540d9512a4d49b6d90fea395f0a2d79ccb90ef663c1cb9baa5204a494b904acb91fb42d7ef2991c1b@212.38.189.122:30303
enode://7923727ebf54d1fc9d9fef1508df7235b123b7d74a7dbd900f78ce169e5e3f30171291f22e7c9ea7c66e97ea405f75ad460073434e6f282b0c902fd0eb99047f@23.111.13.177:30303
enode://c225c4954add10563b34f230ef9ae076760fb3cb347f15b2629ca94054b2c7b92593ae198830beb601a5515ca464af709229c7cbbaa0512bca4d3ef113ac8241@103.101.130.85:30303
enode://c225c4954add10563b34f230ef9ae076760fb3cb347f15b2629ca94054b2c7b92593ae198830beb601a5515ca464af709229c7cbbaa0512bca4d3ef113ac8241@103.101.130.199:30303
enode://f9b52fa47ef04a94d71b0e9723df4a453f42cb359573175acdc2eb693c36cd64c0afb697a04ad2c61d74bd3e60fb84d3077e3ce92d5bcaa642177064e77f4587@103.101.129.198:30303
enode://c225c4954add10563b34f230ef9ae076760fb3cb347f15b2629ca94054b2c7b92593ae198830beb601a5515ca464af709229c7cbbaa0512bca4d3ef113ac8241@103.101.130.199:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@154.53.42.5:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@194.146.12.183:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@194.146.12.181:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@154.53.56.28:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@144.126.150.58:30303
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@107.191.63.81:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@108.61.208.82:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@137.220.52.242:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@137.220.53.156:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@139.180.188.238:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@139.180.207.188:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@149.248.57.56:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@149.248.7.129:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@155.138.129.23:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@155.138.132.39:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@155.138.135.5:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@155.138.136.247:30301

113
cicd/mainnet/genesis.json Normal file

File diff suppressed because one or more lines are too long

62
cicd/mainnet/start.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
if [ ! -d /work/xdcchain/XDC/chaindata ]
then
# Randomly select a key from environment variable, seperated by ','
if test -z "$PRIVATE_KEYS"
then
echo "PRIVATE_KEYS environment variable has not been set. You need to pass at least one PK, or you can pass multiple PK seperated by ',', we will randomly choose one for you"
exit 1
fi
IFS=', ' read -r -a private_keys <<< "$PRIVATE_KEYS"
private_key=${private_keys[ $RANDOM % ${#private_keys[@]} ]}
echo "${private_key}" >> /tmp/key
echo "Creating a new wallet"
wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -F '[{}]' '{print $2}')
XDC --datadir /work/xdcchain init /work/genesis.json
else
echo "Wallet already exist, re-use the same one"
wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -F '[{}]' '{print $2}')
fi
input="/work/bootnodes.list"
bootnodes=""
while IFS= read -r line
do
if [ -z "${bootnodes}" ]
then
bootnodes=$line
else
bootnodes="${bootnodes},$line"
fi
done < "$input"
log_level=3
if test -z "$LOG_LEVEL"
then
echo "Log level not set, default to verbosity of 3"
else
echo "Log level found, set to $LOG_LEVEL"
log_level=$LOG_LEVEL
fi
INSTANCE_IP=$(curl https://checkip.amazonaws.com)
netstats="${NODE_NAME}-${wallet}-${INSTANCE_IP}:xinfin_xdpos_hybrid_network_stats@stats.xinfin.network:3000"
echo "Running a node with wallet: ${wallet} at IP: ${INSTANCE_IP}"
echo "Starting nodes with $bootnodes ..."
# Note: --gcmode=archive means node will store all historical data. This will lead to high memory usage. Only needed if you need the node to perform historical operations
XDC --ethstats ${netstats} --gcmode=full \
--nat extip:${INSTANCE_IP} \
--bootnodes ${bootnodes} --syncmode full \
--datadir /work/xdcchain --networkid 50 \
-port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \
--rpcport 8545 \
--rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--periodicprofile --debugdatadir /work/xdcchain \
--ws --wsaddr=0.0.0.0 --wsport 8555 \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

View file

@ -0,0 +1,9 @@
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@188.227.164.51:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@95.179.217.201:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@149.28.167.190:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@194.233.77.19:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@144.91.108.231:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@207.244.240.232:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@66.94.121.62:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@144.126.150.69:30301
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@161.97.93.168:30301

141
cicd/testnet/genesis.json Normal file

File diff suppressed because one or more lines are too long

63
cicd/testnet/start.sh Executable file
View file

@ -0,0 +1,63 @@
#!/bin/bash
if [ ! -d /work/xdcchain/XDC/chaindata ]
then
# Randomly select a key from environment variable, seperated by ','
if test -z "$PRIVATE_KEYS"
then
echo "PRIVATE_KEYS environment variable has not been set. You need to pass at least one PK, or you can pass multiple PK seperated by ',', we will randomly choose one for you"
exit 1
fi
IFS=', ' read -r -a private_keys <<< "$PRIVATE_KEYS"
private_key=${private_keys[ $RANDOM % ${#private_keys[@]} ]}
echo "${private_key}" >> /tmp/key
echo "Creating a new wallet"
wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -F '[{}]' '{print $2}')
XDC --datadir /work/xdcchain init /work/genesis.json
else
echo "Wallet already exist, re-use the same one"
wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -F '[{}]' '{print $2}')
fi
input="/work/bootnodes.list"
bootnodes=""
while IFS= read -r line
do
if [ -z "${bootnodes}" ]
then
bootnodes=$line
else
bootnodes="${bootnodes},$line"
fi
done < "$input"
log_level=3
if test -z "$LOG_LEVEL"
then
echo "Log level not set, default to verbosity of 3"
else
echo "Log level found, set to $LOG_LEVEL"
log_level=$LOG_LEVEL
fi
INSTANCE_IP=$(curl https://checkip.amazonaws.com)
netstats="${NODE_NAME}-${wallet}-${INSTANCE_IP}:xdc_xinfin_apothem_network_stats@stats.apothem.network:2000"
echo "Running a node with wallet: ${wallet} at IP: ${INSTANCE_IP}"
echo "Starting nodes with $bootnodes ..."
# Note: --gcmode=archive means node will store all historical data. This will lead to high memory usage. Only needed if you need the node to perform historical operations
XDC --ethstats ${netstats} --gcmode=full \
--nat extip:${INSTANCE_IP} \
--bootnodes ${bootnodes} --syncmode full \
--datadir /work/xdcchain --networkid 51 \
-port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \
--rpcport 8545 \
--rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--periodicprofile --debugdatadir /work/xdcchain \
--ws --wsaddr=0.0.0.0 --wsport 8555 \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

View file

@ -0,0 +1,150 @@
package common
import (
"math/big"
)
const (
RewardMasterPercent = 90
RewardVoterPercent = 0
RewardFoundationPercent = 10
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
EpocBlockSecret = 800
EpocBlockOpening = 850
EpocBlockRandomize = 900
MaxMasternodes = 18
MaxMasternodesV2 = 108
LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10
DefaultMinGasPrice = 250000000
MergeSignRange = 15
RangeReturnSigner = 150
MinimunMinerBlockPerEpoch = 1
OneYear = uint64(365 * 86400)
LiquidateLendingTradeBlock = uint64(100)
)
var Rewound = uint64(0)
var TIP2019Block = big.NewInt(1)
var TIPSigning = big.NewInt(3000000)
var TIPRandomize = big.NewInt(3464000)
var TIPV2SwitchBlock = big.NewInt(99999999999)
var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block.
var TIPNoHalvingMNReward = big.NewInt(23779191) // hardfork no halving masternodes reward
var BlackListHFNumber = uint64(23779191)
var TIPXDCX = big.NewInt(23779191)
var TIPXDCXLending = big.NewInt(23779191)
var TIPXDCXCancellationFee = big.NewInt(23779191)
var TIPXDCXCancellationFeeTestnet = big.NewInt(23779191)
var TIPXDCXTestnet = big.NewInt(23779191)
var IsTestnet bool = false
var Enable0xPrefix bool = false
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var RelayerFee = big.NewInt(1000000000000000) // 0.001
var XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
var XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
var RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
var BaseLendingInterest = big.NewInt(100000000) // 1e8
var MinGasPrice = big.NewInt(DefaultMinGasPrice)
var RelayerRegistrationSMC = "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"
var RelayerRegistrationSMCTestnet = "0xA1996F69f47ba14Cb7f661010A7C31974277958c"
var LendingRegistrationSMC = "0x7d761afd7ff65a79e4173897594a194e3c506e57"
var LendingRegistrationSMCTestnet = "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"
var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F")
var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee")
var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53")
var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0")
var TRC21GasPriceBefore = big.NewInt(2500)
var TRC21GasPrice = big.NewInt(250000000)
var RateTopUp = big.NewInt(90) // 90%
var BaseTopUp = big.NewInt(100)
var BaseRecall = big.NewInt(100)
var TIPTRC21Fee = big.NewInt(23779191)
var TIPTRC21FeeTestnet = big.NewInt(23779191)
var LimitTimeFinality = uint64(30) // limit in 30 block
var IgnoreSignerCheckBlockArray = map[uint64]bool{
uint64(1032300): true,
uint64(1033200): true,
uint64(27307800): true,
uint64(28270800): true,
}
var Blacklist = map[Address]bool{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): true,
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): true,
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): true,
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): true,
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): true,
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): true,
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): true,
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): true,
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): true,
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): true,
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): true,
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): true,
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): true,
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): true,
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): true,
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): true,
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): true,
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): true,
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): true,
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): true,
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): true,
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): true,
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): true,
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): true,
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): true,
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): true,
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): true,
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): true,
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): true,
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): true,
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): true,
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): true,
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): true,
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): true,
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): true,
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): true,
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): true,
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): true,
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): true,
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): true,
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): true,
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): true,
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): true,
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): true,
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): true,
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): true,
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): true,
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): true,
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): true,
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): true,
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): true,
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): true,
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): true,
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): true,
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): true,
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): true,
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): true,
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): true,
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): true,
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): true,
HexToAddress("0x0000000000000000000000000000000000000011"): true,
}

View file

@ -459,7 +459,7 @@ func (x *XDPoS) GetSnapshot(chain consensus.ChainReader, header *types.Header) (
func (x *XDPoS) GetAuthorisedSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) {
switch x.config.BlockConsensusVersion(header.Number, header.Extra, ExtraFieldCheck) {
case params.ConsensusEngineVersion2:
return []common.Address{}, nil
return x.EngineV2.GetSignersFromSnapshot(chain, header)
default: // Default "v1"
return x.EngineV1.GetAuthorisedSignersFromSnapshot(chain, header)
}

View file

@ -5,6 +5,7 @@ import (
"github.com/XinFinOrg/XDPoSChain/accounts"
"github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/consensus"
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
"github.com/XinFinOrg/XDPoSChain/core/types"
"github.com/XinFinOrg/XDPoSChain/crypto"
@ -157,3 +158,8 @@ func (x *XDPoS_v2) GetRoundNumber(header *types.Header) (types.Round, error) {
return decodedExtraField.Round, nil
}
}
func (x *XDPoS_v2) GetSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) {
snap, err := x.getSnapshot(chain, header.Number.Uint64(), false)
return snap.NextEpochMasterNodes, err
}

View file

@ -47,7 +47,7 @@ var (
ErrInvalidCheckpointPenalties = errors.New("invalid penalty list on checkpoint block")
ErrValidatorsNotLegit = errors.New("validators does not match what's stored in snapshot minutes its penalty")
ErrValidatorsNotLegit = errors.New("validators does not match what's stored in snapshot minus its penalty")
ErrPenaltiesNotLegit = errors.New("penalties does not match")
// errInvalidMixDigest is returned if a block's mix digest is non-zero.

View file

@ -3035,6 +3035,9 @@ func GetSignersFromBlocks(b Backend, blockNumber uint64, blockHash common.Hash,
return addrs, err
}
blockData, err := b.BlockByNumber(nil, rpc.BlockNumber(i))
if err != nil {
return addrs, err
}
signTxs := engine.CacheSigningTxs(header.Hash(), blockData.Transactions())
for _, signtx := range signTxs {
blkHash := common.BytesToHash(signtx.Data()[len(signtx.Data())-32:])

View file

@ -47,21 +47,14 @@ var (
TimeoutPeriod: 60,
MinePeriod: 10,
},
9999999999: {
SwitchRound: 9999999999,
CertThreshold: 73, // based on masternode is 108
TimeoutSyncThreshold: 3,
TimeoutPeriod: 60,
MinePeriod: 10,
},
}
TestnetV2Configs = map[uint64]*V2Config{
Default: {
SwitchRound: 0,
CertThreshold: 3,
TimeoutSyncThreshold: 2,
TimeoutPeriod: 4,
CertThreshold: 7,
TimeoutSyncThreshold: 3,
TimeoutPeriod: 60,
MinePeriod: 2,
},
}
@ -159,10 +152,9 @@ var (
Gap: 450,
FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"),
V2: &V2{
SwitchBlock: common.TIPV2SwitchBlock,
CurrentConfig: TestnetV2Configs[0],
AllConfigs: TestnetV2Configs,
SkipV2Validation: true,
SwitchBlock: common.TIPV2SwitchBlock,
CurrentConfig: TestnetV2Configs[0],
AllConfigs: TestnetV2Configs,
},
},
}