From 22a43e2ec9043259982f78cb7f10d5cda309fbb2 Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 17:24:08 +0800 Subject: [PATCH 01/20] Include feature evm test suites into CI workflow --- .github/workflows/tests-evm-rpc.yaml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index b94afa4e4d..ce7682ca26 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -2,19 +2,24 @@ name: Tests - EVM on: workflow_dispatch: env: - NODE_URL: "http://35.187.53.161:20551/" + NODE_URL: "http://127.0.0.1:19551/" AUTH_ID: ${{ secrets.INFURA_GOERLI_PROJECT_ID }} AUTH_PASS: ${{ secrets.INFURA_GOERLI_API_KEY }} jobs: node-rpc-tests: - name: E2E tests runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - uses: actions/checkout@v3 - with: - repository: 'DeFiCh/go-ethlibs' - - name: Run e2e tests - run: go test -v ./node/rpc_test.go + - uses: actions/checkout@v3 + + - name: Build and run defid node + run: TARGET="x86_64-pc-linux-gnu" ./make.sh build && ./build/x86_64-pc-linux-gnu/src/defid -regtest --daemon + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '^1.17.0' + - name: Run EVM RPC tests + uses: actions/checkout@v3 + with: + repository: 'DeFiCh/go-ethlibs' + run: go test -v ./node/rpc_meta_test.go From bb86c5667a4b4a53e6d460e48994e4e37ff2193a Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 17:29:14 +0800 Subject: [PATCH 02/20] Fix indentation --- .github/workflows/tests-evm-rpc.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index ce7682ca26..a9f1d0693b 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -1,10 +1,13 @@ name: Tests - EVM + on: workflow_dispatch: + env: NODE_URL: "http://127.0.0.1:19551/" AUTH_ID: ${{ secrets.INFURA_GOERLI_PROJECT_ID }} AUTH_PASS: ${{ secrets.INFURA_GOERLI_API_KEY }} + jobs: node-rpc-tests: runs-on: ubuntu-latest From f5c1c39f4f711b9f761a8b1510ad1f6ccc20ec6a Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 17:39:39 +0800 Subject: [PATCH 03/20] Include workflow trigger when PR is made into feature/evm branch --- .github/workflows/tests-evm-rpc.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index a9f1d0693b..24d78a14e4 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -2,6 +2,9 @@ name: Tests - EVM on: workflow_dispatch: + pull_request: + branches: + - feature/evm env: NODE_URL: "http://127.0.0.1:19551/" From 55216e1045b8d0638b44420f39a08c7c5b08da1b Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 17:48:03 +0800 Subject: [PATCH 04/20] Fix dependency bug --- .github/workflows/tests-evm-rpc.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 24d78a14e4..929943dc33 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -17,6 +17,9 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install dependencies + run: ./make.sh pkg-install-deps && ./make.sh pkg-install-llvm + - name: Build and run defid node run: TARGET="x86_64-pc-linux-gnu" ./make.sh build && ./build/x86_64-pc-linux-gnu/src/defid -regtest --daemon From 5de37746f20c6faf22e0749994256ac018d1d9d8 Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 17:51:30 +0800 Subject: [PATCH 05/20] Fix superuser privileges --- .github/workflows/tests-evm-rpc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 929943dc33..eada9df19a 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies - run: ./make.sh pkg-install-deps && ./make.sh pkg-install-llvm + run: sudo ./make.sh pkg-install-deps && sudo ./make.sh pkg-install-llvm - name: Build and run defid node run: TARGET="x86_64-pc-linux-gnu" ./make.sh build && ./build/x86_64-pc-linux-gnu/src/defid -regtest --daemon From c8c92ebf427032e992a26e7135d4f7eea2a6fd87 Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 29 May 2023 23:37:39 +0800 Subject: [PATCH 06/20] fix indentation and filepath --- .github/workflows/tests-evm-rpc.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index eada9df19a..e2955c16d9 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -20,13 +20,17 @@ jobs: - name: Install dependencies run: sudo ./make.sh pkg-install-deps && sudo ./make.sh pkg-install-llvm - - name: Build and run defid node - run: TARGET="x86_64-pc-linux-gnu" ./make.sh build && ./build/x86_64-pc-linux-gnu/src/defid -regtest --daemon + - name: Build binaries + run: TARGET="x86_64-pc-linux-gnu" ./make.sh build + + - name: Run defid node + run: ./build/src/defid -regtest --daemon - name: Set up Go uses: actions/setup-go@v3 with: go-version: '^1.17.0' + - name: Run EVM RPC tests uses: actions/checkout@v3 with: From 071575a9f880b10f0317f01ef9d7eb933b5b739e Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 30 May 2023 00:29:23 +0800 Subject: [PATCH 07/20] Separate build stage and rpc tests into different jobs --- .github/workflows/tests-evm-rpc.yaml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index e2955c16d9..e6ce6f14af 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -12,7 +12,7 @@ env: AUTH_PASS: ${{ secrets.INFURA_GOERLI_API_KEY }} jobs: - node-rpc-tests: + build-binaries: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -23,9 +23,29 @@ jobs: - name: Build binaries run: TARGET="x86_64-pc-linux-gnu" ./make.sh build + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: defibins + path: | + build/src/defid + build/src/defi-cli + + node-rpc-tests: + runs-on: ubuntu-latest + needs: build-binaries + steps: + - name: Download binaries + uses: actions/download-artifact@v3 + with: + name: defibins + - name: Run defid node - run: ./build/src/defid -regtest --daemon - + run: | + chmod 777 defid + chmod 777 defi-cli + ./defid -regtest --daemon + - name: Set up Go uses: actions/setup-go@v3 with: From 10fef7454b2d1106ff64735f2b3f04ca4f1390fb Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 30 May 2023 08:40:28 +0800 Subject: [PATCH 08/20] Fix bug for running test suite --- .github/workflows/tests-evm-rpc.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index e6ce6f14af..0372f15170 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -51,8 +51,10 @@ jobs: with: go-version: '^1.17.0' - - name: Run EVM RPC tests + - name: Set up go eth test suites library uses: actions/checkout@v3 with: repository: 'DeFiCh/go-ethlibs' - run: go test -v ./node/rpc_meta_test.go + + - name: Run EVM RPC tests + run: go test -v ./node/rpc_meta_test.go From 480f7b1704119fb00dbbd5c242a15be20abc3cca Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 30 May 2023 09:59:45 +0800 Subject: [PATCH 09/20] Debug log --- .github/workflows/tests-evm-rpc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 0372f15170..bd8eb9bb44 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -57,4 +57,4 @@ jobs: repository: 'DeFiCh/go-ethlibs' - name: Run EVM RPC tests - run: go test -v ./node/rpc_meta_test.go + run: ls -R && go test -v ./node/rpc_meta_test.go From 098eb5cf9bf0fc64ad711a6a9f54aa33b879aec7 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 10:40:31 +0800 Subject: [PATCH 10/20] add fixtures.sh --- .github/workflows/tests-evm-rpc.yaml | 10 ++++- scripts/fixtures.sh | 56 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100755 scripts/fixtures.sh diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index bd8eb9bb44..c61929f601 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -28,8 +28,9 @@ jobs: with: name: defibins path: | - build/src/defid - build/src/defi-cli + build/src/defid + build/src/defi-cli + scripts/fixtures.sh node-rpc-tests: runs-on: ubuntu-latest @@ -46,6 +47,11 @@ jobs: chmod 777 defi-cli ./defid -regtest --daemon + - name: Push fixtures + run: | + chmod 777 fixtures.sh + ./fixtures.sh + - name: Set up Go uses: actions/setup-go@v3 with: diff --git a/scripts/fixtures.sh b/scripts/fixtures.sh new file mode 100755 index 0000000000..4c1f67936e --- /dev/null +++ b/scripts/fixtures.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# setup_var +ownerauthaddr="mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU" +alice="0x9b8a4af42140d8a4c153a822f02571a1dd037e89" +bob="0x6c34cbb9219d8caa428835d2073e8ec88ba0a110" +privkey_alice="af990cc3ba17e776f7f57fcc59942a82846d75833fa17d2ba59ce6858d886e23" +privkey_bob="17b8cb134958b3d8422b6c43b0732fcdb8c713b524df2d45de12f0c7e214ba35" +contract_counter="0x60c0604052600760808190526621b7bab73a32b960c91b60a090815261002891600091906100ab565b50600060025534801561003a57600080fd5b50600180546001600160a01b031916331790556040517ff15da729ec5b36e9bda8b3f71979cdac5d0f3169f8590778ac0cd82cc5cc1d4a9061009e906020808252600e908201526d2432b63637961021b7bab73a32b960911b604082015260600190565b60405180910390a161017f565b8280546100b790610144565b90600052602060002090601f0160209004810192826100d9576000855561011f565b82601f106100f257805160ff191683800117855561011f565b8280016001018555821561011f579182015b8281111561011f578251825591602001919060010190610104565b5061012b92915061012f565b5090565b5b8082111561012b5760008155600101610130565b60028104600182168061015857607f821691505b6020821081141561017957634e487b7160e01b600052602260045260246000fd5b50919050565b6103e68061018e6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146100f4578063a87d942c1461011f578063c8a4ac9c14610127578063d14e62b81461013a578063ee82ac5e1461014d5761009e565b806306fdde03146100a3578063119fbbd4146100c15780631a93d1c3146100cb578063672d5d3b146100db5780638361ff9c146100e1575b600080fd5b6100ab61015f565b6040516100b891906102d5565b60405180910390f35b6100c96101ed565b005b455b6040519081526020016100b8565b436100cd565b6100cd6100ef36600461029c565b610207565b600154610107906001600160a01b031681565b6040516001600160a01b0390911681526020016100b8565b6002546100cd565b6100cd6101353660046102b4565b61026d565b6100c961014836600461029c565b610280565b6100cd61015b36600461029c565b4090565b6000805461016c9061035f565b80601f01602080910402602001604051908101604052809291908181526020018280546101989061035f565b80156101e55780601f106101ba576101008083540402835291602001916101e5565b820191906000526020600020905b8154815290600101906020018083116101c857829003601f168201915b505050505081565b6001600260008282546102009190610328565b9091555050565b6000600a8211156102695760405162461bcd60e51b815260206004820152602260248201527f56616c7565206d757374206e6f742062652067726561746572207468616e2031604482015261181760f11b606482015260840160405180910390fd5b5090565b60006102798284610340565b9392505050565b6001546001600160a01b0316331461029757600080fd5b600255565b6000602082840312156102ad578081fd5b5035919050565b600080604083850312156102c6578081fd5b50508035926020909101359150565b6000602080835283518082850152825b81811015610301578581018301518582016040015282016102e5565b818111156103125783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561033b5761033b61039a565b500190565b600081600019048311821515161561035a5761035a61039a565b500290565b60028104600182168061037357607f821691505b6020821081141561039457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220698216ef3f0a0eede3cc4f13017b1d1699d56b3aa4aa8491a3f47fc2d37ac22164736f6c63430008020033" +contract_countercaller="0x608060405234801561001057600080fd5b5060405161025c38038061025c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6101cb806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806360598c0114610046578063a87d942c14610050578063c3da42b81461006b575b600080fd5b61004e610096565b005b6100586100f1565b6040519081526020015b60405180910390f35b60005461007e906001600160a01b031681565b6040516001600160a01b039091168152602001610062565b6000805460408051630467eef560e21b815290516001600160a01b039092169263119fbbd49260048084019382900301818387803b1580156100d757600080fd5b505af11580156100eb573d6000803e3d6000fd5b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663a87d942c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610178919061017d565b905090565b60006020828403121561018e578081fd5b505191905056fea2646970667358221220220b50dea2907d54fd36279d0583e05fe9868a78b29df0e8d111fabac5ef1d9564736f6c63430008020033" + +# push fixtures +defi-cli -regtest importprivkey $privkey_alice owner true +defi-cli -regtest importprivkey $privkey_bob operator true +defi-cli -regtest generatetoaddress 100 $ownerauthaddr + +defi-cli -regtest utxostoaccount '{"'"$ownerauthaddr"'":"5000@DFI"}' +defi-cli -regtest generatetoaddress 1 $ownerauthaddr + +defi-cli -regtest setgov '{"ATTRIBUTES":{"v0/params/feature/evm":"true"}}' +defi-cli -regtest generatetoaddress 1 $ownerauthaddr + +defi-cli -regtest transferdomain 1 '{"'"$ownerauthaddr"'":["2000@DFI"]}' '{"'"$alice"'":["2000@DFI"]}' +defi-cli -regtest generatetoaddress 1 $ownerauthaddr + +curl http://localhost:19551 \ + -H 'content-type:application/json' \ + --data-binary \ + '{ + "jsonrpc":"2.0", + "id":"fixture", + "method":"eth_sendTransaction", + "params":[{ + "data":"'"$contract_counter"'", + "value":"0x00", + "gas":"0x7a120", + "gasPrice": "0x22ecb25c00" + }] + }' +defi-cli -regtest generatetoaddress 1 $ownerauthaddr + +curl http://localhost:19551 \ + -H 'content-type:application/json' \ + --data-binary \ + '{ + "jsonrpc":"2.0", + "id":"fixture", + "method":"eth_sendTransaction", + "params":[{ + "data":"'"$contract_countercaller"'", + "value":"0x00", + "gas":"0x7a120", + "gasPrice": "0x22ecb25c00" + }] + }' +defi-cli -regtest generatetoaddress 1 $ownerauthaddr From e924e1b418acf33193d4b223584384af46a0e9cf Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 10:41:58 +0800 Subject: [PATCH 11/20] on trigger push & target tag evm --- .github/workflows/tests-evm-rpc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index c61929f601..a5a3ab5878 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -5,6 +5,13 @@ on: pull_request: branches: - feature/evm + tags: + - evm + push: + branches: + - feature/evm + tags: + - evm env: NODE_URL: "http://127.0.0.1:19551/" From 83c0711fad90674ad1e5e43140784727f7cf60ef Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 10:43:14 +0800 Subject: [PATCH 12/20] pump required flags for defid cmd --- .github/workflows/tests-evm-rpc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index a5a3ab5878..1ea1ecd416 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -52,7 +52,7 @@ jobs: run: | chmod 777 defid chmod 777 defi-cli - ./defid -regtest --daemon + RUST_LOG=debug ./defid -debug=rpc -printtoconsole -regtest -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -txnotokens=0 -amkheight=50 -bayfrontheight=51 -eunosheight=80 -fortcanningheight=82 -fortcanninghillheight=84 -fortcanningroadheight=86 -fortcanningcrunchheight=88 -fortcanningspringheight=90 -fortcanninggreatworldheight=94 -fortcanningepilogueheight=96 -grandcentralheight=101 -nextnetworkupgradeheight=105 -subsidytest=1 -txindex=1 - name: Push fixtures run: | From 400c3a32f03c912d6e10c46dc52f841ac17568cd Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 30 May 2023 11:01:23 +0800 Subject: [PATCH 13/20] Remove debug logs --- .github/workflows/tests-evm-rpc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 1ea1ecd416..1c9a7afa66 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -70,4 +70,4 @@ jobs: repository: 'DeFiCh/go-ethlibs' - name: Run EVM RPC tests - run: ls -R && go test -v ./node/rpc_meta_test.go + run: go test -v ./node/rpc_meta_test.go From f279cec6f80113e168466b2a6274eba36454606b Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 11:55:17 +0800 Subject: [PATCH 14/20] clean --- .github/workflows/tests-evm-rpc.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 1c9a7afa66..dbe5b4d9f3 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -5,8 +5,6 @@ on: pull_request: branches: - feature/evm - tags: - - evm push: branches: - feature/evm @@ -15,8 +13,6 @@ on: env: NODE_URL: "http://127.0.0.1:19551/" - AUTH_ID: ${{ secrets.INFURA_GOERLI_PROJECT_ID }} - AUTH_PASS: ${{ secrets.INFURA_GOERLI_API_KEY }} jobs: build-binaries: From 49763041fdf835e1b460fe919f9137b513841975 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 20:06:20 +0800 Subject: [PATCH 15/20] path correction & some refined --- .github/workflows/tests-evm-rpc.yaml | 12 +++++++----- scripts/fixtures.sh | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index dbe5b4d9f3..9dae98e1e8 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -43,17 +43,19 @@ jobs: uses: actions/download-artifact@v3 with: name: defibins + + - name: Chores + run: | + chmod uog+x build/src/defid build/src/defi-cli scripts/fixtures.sh - name: Run defid node run: | - chmod 777 defid - chmod 777 defi-cli - RUST_LOG=debug ./defid -debug=rpc -printtoconsole -regtest -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -txnotokens=0 -amkheight=50 -bayfrontheight=51 -eunosheight=80 -fortcanningheight=82 -fortcanninghillheight=84 -fortcanningroadheight=86 -fortcanningcrunchheight=88 -fortcanningspringheight=90 -fortcanninggreatworldheight=94 -fortcanningepilogueheight=96 -grandcentralheight=101 -nextnetworkupgradeheight=105 -subsidytest=1 -txindex=1 + RUST_LOG=debug ./build/src/defid -daemon -debug=rpc -printtoconsole -regtest -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -txnotokens=0 -amkheight=50 -bayfrontheight=51 -eunosheight=80 -fortcanningheight=82 -fortcanninghillheight=84 -fortcanningroadheight=86 -fortcanningcrunchheight=88 -fortcanningspringheight=90 -fortcanninggreatworldheight=94 -fortcanningepilogueheight=96 -grandcentralheight=101 -nextnetworkupgradeheight=105 -subsidytest=1 -txindex=1 - name: Push fixtures run: | - chmod 777 fixtures.sh - ./fixtures.sh + sleep 5 + ./scripts/fixtures.sh - name: Set up Go uses: actions/setup-go@v3 diff --git a/scripts/fixtures.sh b/scripts/fixtures.sh index 4c1f67936e..1533792d54 100755 --- a/scripts/fixtures.sh +++ b/scripts/fixtures.sh @@ -10,18 +10,18 @@ contract_counter="0x60c0604052600760808190526621b7bab73a32b960c91b60a09081526100 contract_countercaller="0x608060405234801561001057600080fd5b5060405161025c38038061025c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6101cb806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806360598c0114610046578063a87d942c14610050578063c3da42b81461006b575b600080fd5b61004e610096565b005b6100586100f1565b6040519081526020015b60405180910390f35b60005461007e906001600160a01b031681565b6040516001600160a01b039091168152602001610062565b6000805460408051630467eef560e21b815290516001600160a01b039092169263119fbbd49260048084019382900301818387803b1580156100d757600080fd5b505af11580156100eb573d6000803e3d6000fd5b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663a87d942c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610178919061017d565b905090565b60006020828403121561018e578081fd5b505191905056fea2646970667358221220220b50dea2907d54fd36279d0583e05fe9868a78b29df0e8d111fabac5ef1d9564736f6c63430008020033" # push fixtures -defi-cli -regtest importprivkey $privkey_alice owner true -defi-cli -regtest importprivkey $privkey_bob operator true -defi-cli -regtest generatetoaddress 100 $ownerauthaddr +./build/src/defi-cli -regtest importprivkey $privkey_alice owner true +./build/src/defi-cli -regtest importprivkey $privkey_bob operator true +./build/src/defi-cli -regtest generatetoaddress 100 $ownerauthaddr -defi-cli -regtest utxostoaccount '{"'"$ownerauthaddr"'":"5000@DFI"}' -defi-cli -regtest generatetoaddress 1 $ownerauthaddr +./build/src/defi-cli -regtest utxostoaccount '{"'"$ownerauthaddr"'":"5000@DFI"}' +./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr -defi-cli -regtest setgov '{"ATTRIBUTES":{"v0/params/feature/evm":"true"}}' -defi-cli -regtest generatetoaddress 1 $ownerauthaddr +./build/src/defi-cli -regtest setgov '{"ATTRIBUTES":{"v0/params/feature/evm":"true"}}' +./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr -defi-cli -regtest transferdomain 1 '{"'"$ownerauthaddr"'":["2000@DFI"]}' '{"'"$alice"'":["2000@DFI"]}' -defi-cli -regtest generatetoaddress 1 $ownerauthaddr +./build/src/defi-cli -regtest transferdomain 1 '{"'"$ownerauthaddr"'":["2000@DFI"]}' '{"'"$alice"'":["2000@DFI"]}' +./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr curl http://localhost:19551 \ -H 'content-type:application/json' \ @@ -37,7 +37,7 @@ curl http://localhost:19551 \ "gasPrice": "0x22ecb25c00" }] }' -defi-cli -regtest generatetoaddress 1 $ownerauthaddr +./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr curl http://localhost:19551 \ -H 'content-type:application/json' \ @@ -53,4 +53,4 @@ curl http://localhost:19551 \ "gasPrice": "0x22ecb25c00" }] }' -defi-cli -regtest generatetoaddress 1 $ownerauthaddr +./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr From 5387b4a137effba3388b9532d60cb94dc01c548d Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 20:25:55 +0800 Subject: [PATCH 16/20] pretty print defid --- .github/workflows/tests-evm-rpc.yaml | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 9dae98e1e8..e0d1f6c7c8 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -50,7 +50,38 @@ jobs: - name: Run defid node run: | - RUST_LOG=debug ./build/src/defid -daemon -debug=rpc -printtoconsole -regtest -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -txnotokens=0 -amkheight=50 -bayfrontheight=51 -eunosheight=80 -fortcanningheight=82 -fortcanninghillheight=84 -fortcanningroadheight=86 -fortcanningcrunchheight=88 -fortcanningspringheight=90 -fortcanninggreatworldheight=94 -fortcanningepilogueheight=96 -grandcentralheight=101 -nextnetworkupgradeheight=105 -subsidytest=1 -txindex=1 + ./build/src/defid + -regtest + -daemon + -debug=rpc + -printtoconsole + -rpcallowip=0.0.0.0/0 + -rpcbind=0.0.0.0 + -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy + -masternode_operator=mps7BdmwEF2vQ9DREDyNPibqsuSRZ8LuwQ + -masternode_operator=bcrt1qmfvw3dp3u6fdvqkdc0y3lr0e596le9cf22vtsv + -masternode_operator=bcrt1qurwyhta75n2g75u2u5nds9p6w9v62y8wr40d2r + -dummypos=0 + -subsidytest=1 + -txnotokens=0 + -txindex=1 + -amkheight=0 + -bayfrontheight=1 + -clarkequayheight=3 + -dakotaheight=4 + -dakotacrescentheight=5 + -eunosheight=6 + -eunospayaheight=7 + -fortcanningheight=8 + -fortcanningmuseumheight=9 + -fortcanninghillheight=10 + -fortcanningroadheight=11 + -fortcanningcrunchheight=12 + -fortcanningspringheight=13 + -fortcanninggreatworldheight=14 + -fortcanningepilogueheight=15 + -grandcentralheight=16 + -nextnetworkupgradeheight=17 - name: Push fixtures run: | From 8469c349ef41b9b14a591f664a4b37ab77ebe6e8 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 20:37:03 +0800 Subject: [PATCH 17/20] add foundation member fixtures --- scripts/fixtures.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/fixtures.sh b/scripts/fixtures.sh index 1533792d54..cea919427c 100755 --- a/scripts/fixtures.sh +++ b/scripts/fixtures.sh @@ -2,6 +2,9 @@ # setup_var ownerauthaddr="mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU" +ownerauthpriv="cRiRQ9cHmy5evDqNDdEV8f6zfbK6epi9Fpz4CRZsmLEmkwy54dWz" +operatorauthaddr="mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy" +operatorauthpriv="cPGEaz8AGiM71NGMRybbCqFNRcuUhg3uGvyY4TFE1BZC26EW2PkC" alice="0x9b8a4af42140d8a4c153a822f02571a1dd037e89" bob="0x6c34cbb9219d8caa428835d2073e8ec88ba0a110" privkey_alice="af990cc3ba17e776f7f57fcc59942a82846d75833fa17d2ba59ce6858d886e23" @@ -9,9 +12,13 @@ privkey_bob="17b8cb134958b3d8422b6c43b0732fcdb8c713b524df2d45de12f0c7e214ba35" contract_counter="0x60c0604052600760808190526621b7bab73a32b960c91b60a090815261002891600091906100ab565b50600060025534801561003a57600080fd5b50600180546001600160a01b031916331790556040517ff15da729ec5b36e9bda8b3f71979cdac5d0f3169f8590778ac0cd82cc5cc1d4a9061009e906020808252600e908201526d2432b63637961021b7bab73a32b960911b604082015260600190565b60405180910390a161017f565b8280546100b790610144565b90600052602060002090601f0160209004810192826100d9576000855561011f565b82601f106100f257805160ff191683800117855561011f565b8280016001018555821561011f579182015b8281111561011f578251825591602001919060010190610104565b5061012b92915061012f565b5090565b5b8082111561012b5760008155600101610130565b60028104600182168061015857607f821691505b6020821081141561017957634e487b7160e01b600052602260045260246000fd5b50919050565b6103e68061018e6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146100f4578063a87d942c1461011f578063c8a4ac9c14610127578063d14e62b81461013a578063ee82ac5e1461014d5761009e565b806306fdde03146100a3578063119fbbd4146100c15780631a93d1c3146100cb578063672d5d3b146100db5780638361ff9c146100e1575b600080fd5b6100ab61015f565b6040516100b891906102d5565b60405180910390f35b6100c96101ed565b005b455b6040519081526020016100b8565b436100cd565b6100cd6100ef36600461029c565b610207565b600154610107906001600160a01b031681565b6040516001600160a01b0390911681526020016100b8565b6002546100cd565b6100cd6101353660046102b4565b61026d565b6100c961014836600461029c565b610280565b6100cd61015b36600461029c565b4090565b6000805461016c9061035f565b80601f01602080910402602001604051908101604052809291908181526020018280546101989061035f565b80156101e55780601f106101ba576101008083540402835291602001916101e5565b820191906000526020600020905b8154815290600101906020018083116101c857829003601f168201915b505050505081565b6001600260008282546102009190610328565b9091555050565b6000600a8211156102695760405162461bcd60e51b815260206004820152602260248201527f56616c7565206d757374206e6f742062652067726561746572207468616e2031604482015261181760f11b606482015260840160405180910390fd5b5090565b60006102798284610340565b9392505050565b6001546001600160a01b0316331461029757600080fd5b600255565b6000602082840312156102ad578081fd5b5035919050565b600080604083850312156102c6578081fd5b50508035926020909101359150565b6000602080835283518082850152825b81811015610301578581018301518582016040015282016102e5565b818111156103125783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561033b5761033b61039a565b500190565b600081600019048311821515161561035a5761035a61039a565b500290565b60028104600182168061037357607f821691505b6020821081141561039457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220698216ef3f0a0eede3cc4f13017b1d1699d56b3aa4aa8491a3f47fc2d37ac22164736f6c63430008020033" contract_countercaller="0x608060405234801561001057600080fd5b5060405161025c38038061025c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6101cb806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806360598c0114610046578063a87d942c14610050578063c3da42b81461006b575b600080fd5b61004e610096565b005b6100586100f1565b6040519081526020015b60405180910390f35b60005461007e906001600160a01b031681565b6040516001600160a01b039091168152602001610062565b6000805460408051630467eef560e21b815290516001600160a01b039092169263119fbbd49260048084019382900301818387803b1580156100d757600080fd5b505af11580156100eb573d6000803e3d6000fd5b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663a87d942c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610178919061017d565b905090565b60006020828403121561018e578081fd5b505191905056fea2646970667358221220220b50dea2907d54fd36279d0583e05fe9868a78b29df0e8d111fabac5ef1d9564736f6c63430008020033" +# foundation members +./build/src/defi-cli -regtest importprivkey $ownerauthpriv owner true +./build/src/defi-cli -regtest importprivkey $operatorauthpriv operator true + # push fixtures -./build/src/defi-cli -regtest importprivkey $privkey_alice owner true -./build/src/defi-cli -regtest importprivkey $privkey_bob operator true +./build/src/defi-cli -regtest importprivkey $privkey_alice +./build/src/defi-cli -regtest importprivkey $privkey_bob ./build/src/defi-cli -regtest generatetoaddress 100 $ownerauthaddr ./build/src/defi-cli -regtest utxostoaccount '{"'"$ownerauthaddr"'":"5000@DFI"}' From 786576553656587e45d1a7ee53e75eed52a3fb38 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 21:21:20 +0800 Subject: [PATCH 18/20] revert pretty print defid --- .github/workflows/tests-evm-rpc.yaml | 33 +--------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index e0d1f6c7c8..7558a71b06 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -50,38 +50,7 @@ jobs: - name: Run defid node run: | - ./build/src/defid - -regtest - -daemon - -debug=rpc - -printtoconsole - -rpcallowip=0.0.0.0/0 - -rpcbind=0.0.0.0 - -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy - -masternode_operator=mps7BdmwEF2vQ9DREDyNPibqsuSRZ8LuwQ - -masternode_operator=bcrt1qmfvw3dp3u6fdvqkdc0y3lr0e596le9cf22vtsv - -masternode_operator=bcrt1qurwyhta75n2g75u2u5nds9p6w9v62y8wr40d2r - -dummypos=0 - -subsidytest=1 - -txnotokens=0 - -txindex=1 - -amkheight=0 - -bayfrontheight=1 - -clarkequayheight=3 - -dakotaheight=4 - -dakotacrescentheight=5 - -eunosheight=6 - -eunospayaheight=7 - -fortcanningheight=8 - -fortcanningmuseumheight=9 - -fortcanninghillheight=10 - -fortcanningroadheight=11 - -fortcanningcrunchheight=12 - -fortcanningspringheight=13 - -fortcanninggreatworldheight=14 - -fortcanningepilogueheight=15 - -grandcentralheight=16 - -nextnetworkupgradeheight=17 + ./build/src/defid -regtest -daemon -debug=rpc -printtoconsole -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_operator=mps7BdmwEF2vQ9DREDyNPibqsuSRZ8LuwQ -masternode_operator=bcrt1qmfvw3dp3u6fdvqkdc0y3lr0e596le9cf22vtsv -masternode_operator=bcrt1qurwyhta75n2g75u2u5nds9p6w9v62y8wr40d2r -dummypos=0 -subsidytest=1 -txnotokens=0 -txindex=1 -amkheight=0 -bayfrontheight=1 -clarkequayheight=3 -dakotaheight=4 -dakotacrescentheight=5 -eunosheight=6 -eunospayaheight=7 -fortcanningheight=8 -fortcanningmuseumheight=9 -fortcanninghillheight=10 -fortcanningroadheight=11 -fortcanningcrunchheight=12 -fortcanningspringheight=13 -fortcanninggreatworldheight=14 -fortcanningepilogueheight=15 -grandcentralheight=16 -nextnetworkupgradeheight=17 - name: Push fixtures run: | From 9e25ec5fde81cd378f4f5b14c1b885e2616e4500 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 30 May 2023 22:13:44 +0800 Subject: [PATCH 19/20] fix defid --- .github/workflows/tests-evm-rpc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-evm-rpc.yaml b/.github/workflows/tests-evm-rpc.yaml index 7558a71b06..5b44ec7e56 100644 --- a/.github/workflows/tests-evm-rpc.yaml +++ b/.github/workflows/tests-evm-rpc.yaml @@ -50,7 +50,7 @@ jobs: - name: Run defid node run: | - ./build/src/defid -regtest -daemon -debug=rpc -printtoconsole -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_operator=mps7BdmwEF2vQ9DREDyNPibqsuSRZ8LuwQ -masternode_operator=bcrt1qmfvw3dp3u6fdvqkdc0y3lr0e596le9cf22vtsv -masternode_operator=bcrt1qurwyhta75n2g75u2u5nds9p6w9v62y8wr40d2r -dummypos=0 -subsidytest=1 -txnotokens=0 -txindex=1 -amkheight=0 -bayfrontheight=1 -clarkequayheight=3 -dakotaheight=4 -dakotacrescentheight=5 -eunosheight=6 -eunospayaheight=7 -fortcanningheight=8 -fortcanningmuseumheight=9 -fortcanninghillheight=10 -fortcanningroadheight=11 -fortcanningcrunchheight=12 -fortcanningspringheight=13 -fortcanninggreatworldheight=14 -fortcanningepilogueheight=15 -grandcentralheight=16 -nextnetworkupgradeheight=17 + ./build/src/defid -regtest -daemon -debug=rpc -printtoconsole -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -subsidytest=1 -txnotokens=0 -txindex=1 -amkheight=0 -bayfrontheight=1 -clarkequayheight=3 -dakotaheight=4 -dakotacrescentheight=5 -eunosheight=6 -eunospayaheight=7 -fortcanningheight=8 -fortcanningmuseumheight=9 -fortcanninghillheight=10 -fortcanningroadheight=11 -fortcanningcrunchheight=12 -fortcanningspringheight=13 -fortcanninggreatworldheight=14 -fortcanningepilogueheight=15 -grandcentralheight=16 -nextnetworkupgradeheight=17 - name: Push fixtures run: | From a21f9ac85aef3854d769620d0ee36bf4813d3f90 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Wed, 31 May 2023 00:23:00 +0800 Subject: [PATCH 20/20] pre-note contract addr --- scripts/fixtures.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/fixtures.sh b/scripts/fixtures.sh index cea919427c..aa168cb3a7 100755 --- a/scripts/fixtures.sh +++ b/scripts/fixtures.sh @@ -45,6 +45,8 @@ curl http://localhost:19551 \ }] }' ./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr +# contract address +# 0x966aaec51a95a737d086d21f015a6991dd5559ae curl http://localhost:19551 \ -H 'content-type:application/json' \ @@ -61,3 +63,5 @@ curl http://localhost:19551 \ }] }' ./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr +# contract address +# 0x007138e9d5bdb3f0b7f3abf2d46ad4f9184ef99d