polygon-edge icon indicating copy to clipboard operation
polygon-edge copied to clipboard

v3 smart contracts integration

Open Stefan-Ethernal opened this issue 3 years ago • 1 comments

Description

This PR integrates v3 smart contracts for sidechain. V3 smart contracts are introduced to Edge codebase as git submodule.

Changes include

  • [ ] Bugfix (non-breaking change that solves an issue)
  • [ ] Hotfix (change that solves an urgent issue, and requires immediate attention)
  • [x] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • [x] I have assigned this PR to myself
  • [x] I have added at least 1 reviewer
  • [x] I have added the relevant labels
  • [ ] I have updated the official documentation
  • [ ] I have added sufficient documentation in code

Testing

  • [ ] I have tested this code with the official test suite
  • [x] I have tested this code manually

Manual tests

Setup

initialize v3-contracts repo

  • git submodule init
  • git submodule update

compile v3-contracts

  • cd v3-contracts && npm install && npm run compile

SC integration workflow

  1. Initialize test accounts
go run main.go polybft-secrets --data-dir test-chain- --num 4
  1. Initialize genesis configuration
go run . genesis --block-gas-limit 10000000 --validator-set-size=4 --consensus polybft --epoch-size 10
  1. Run validator nodes
go run main.go server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :9545 --seal --log-level DEBUG
go run main.go server --data-dir ./test-chain-2 --chain genesis.json --grpc-address :5002 --libp2p :30302 --jsonrpc :10002 --seal --log-level DEBUG
go run main.go server --data-dir ./test-chain-3 --chain genesis.json --grpc-address :5003 --libp2p :30303 --jsonrpc :10003 --seal --log-level DEBUG
go run main.go server --data-dir ./test-chain-4 --chain genesis.json --grpc-address :5004 --libp2p :30304 --jsonrpc :10004 --seal --log-level DEBUG
  1. Blocks are being produced without any errors.

Register new validator workflow

Note: Validators from above still need to be up and running before running following steps

  1. Create new account
go run main.go polybft-secrets --data-dir test-chain-5
  1. Register validator
go run main.go register-validator --data-dir test-chain-5

Stefan-Ethernal avatar Oct 13 '22 13:10 Stefan-Ethernal

Codecov Report

:exclamation: No coverage uploaded for pull request base (feature/v3-parity@d862307). Click here to learn what that means. The diff coverage is n/a.

@@                 Coverage Diff                  @@
##             feature/v3-parity     #796   +/-   ##
====================================================
  Coverage                     ?   46.44%           
====================================================
  Files                        ?      162           
  Lines                        ?    21242           
  Branches                     ?        0           
====================================================
  Hits                         ?     9866           
  Misses                       ?    10657           
  Partials                     ?      719           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Oct 14 '22 11:10 codecov[bot]

Just a note that the contract repository has now moved into this org.

QEDK avatar Oct 20 '22 11:10 QEDK

Just a note that the contract repository has now moved into this org.

Yep, we've already accommodated it: 54880bb. Tnx for reminding anyways 🙂

Stefan-Ethernal avatar Oct 20 '22 12:10 Stefan-Ethernal