From 32f81c11070aa9dbfe5e10810abea530ddfca884 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Thu, 28 Sep 2023 14:51:15 +0200 Subject: [PATCH 01/27] Update README --- README.md | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 92452384..1457908c 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,15 @@ -# Chainbridge Core +# Sygma Core discord - - docs - go   -Chainbridge-Core was born from and built to improve the maintainability and modularity of the existing version of [ChainBridge](https://github.com/ChainSafe/chainbridge). The fundamental distinction between the two is that Chainbridge-Core is more of a framework rather than a stand-alone application. +Sygma-Core encompasses reusable modules to easily build relayers based on Sygma contracts.   @@ -28,37 +25,12 @@ Chainbridge-Core was born from and built to improve the maintainability and modu 4. [Contributing](#contributing) -## Installation -Refer to the [installation](https://github.com/ChainSafe/chainbridge-docs/blob/develop/docs/installation.md) guide for assistance with installing the ChainBridge binary. - -## Usage -Since ChainBridge-Core is a library it will require writing some code to get it running. - -You can find some examples [here](https://github.com/ChainSafe/chainbridge-core-example). - -The deployment scripts of this version uses the V2.1.3 solidity scripts from https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 - -  - -## Local Setup - -This section allows developers with a way to quickly and with minimal effort stand-up a local development environment in order to test out functionality of the ChainBridge. - -### Example -The example developer setup can be run with the `make example` command which will create a 3 relayer setup with 2 EVM networks with already preconfigured ERC20, ERC721 and Generic handlers and appropriate assets. - -##### ^ this command will execute a shell script that contains instructions for running two EVM chains via [Docker](https://www.docker.com/) (`docker-compose`). Note: this entire process will likely take a few minutes to run. - - -  - -You can also review our [Local Setup Guide](https://github.com/ChainSafe/chainbridge-docs/blob/develop/docs/guides/local-setup-guide.md) for a more detailed example of setting up a local development environment manually.   ## Contributing -Chainbridge-core is a open project and welcomes contributions of all kinds: code, docs, and more. If you wish to submit more complex changes, +Sygma-core is a open project and welcomes contributions of all kinds: code, docs, and more. If you wish to submit more complex changes, please check up with the core devs first on our [Discord Server](https://discord.gg/ykXsJKfhgq) (look for CHAINBRIDGE category) or submit an issue on the repo to ensure those changes are in line with the general philoshophy of the project or get some early feedback. From 721f49b64594e0de7ff6c1f6922f6448bd89be95 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Thu, 28 Sep 2023 14:53:42 +0200 Subject: [PATCH 02/27] Rename chainbridge-core module to sygma-core --- .github/workflows/update-core-example.yml | 19 ----------- Makefile | 2 +- chains/evm/calls/calls.go | 2 +- chains/evm/calls/contracts/bridge/bridge.go | 16 ++++----- .../evm/calls/contracts/bridge/bridge_test.go | 12 +++---- .../calls/contracts/centrifuge/assetStore.go | 11 +++--- .../contracts/centrifuge/assetStore_test.go | 7 ++-- chains/evm/calls/contracts/contract.go | 5 +-- chains/evm/calls/contracts/contract_test.go | 15 ++++---- chains/evm/calls/contracts/erc20/erc20.go | 9 ++--- .../evm/calls/contracts/erc20/erc20Handler.go | 11 +++--- .../evm/calls/contracts/erc20/erc20_test.go | 8 ++--- chains/evm/calls/contracts/erc721/erc721.go | 9 ++--- .../calls/contracts/erc721/erc721Handler.go | 11 +++--- .../evm/calls/contracts/erc721/erc721_test.go | 8 ++--- .../calls/contracts/forwarder/forwarder.go | 6 ++-- .../calls/contracts/generic/genericHandler.go | 11 +++--- chains/evm/calls/events/events.go | 2 +- chains/evm/calls/events/listener.go | 2 +- chains/evm/calls/events/listener_test.go | 6 ++-- chains/evm/calls/evmgaspricer/london_test.go | 2 +- chains/evm/calls/evmgaspricer/static_test.go | 2 +- chains/evm/calls/evmtransaction/evm-tx.go | 2 +- .../evm/calls/evmtransaction/evm-tx_test.go | 6 ++-- chains/evm/calls/mock/calls.go | 2 +- chains/evm/calls/transactor/itx/itx.go | 2 +- chains/evm/calls/transactor/itx/itx_test.go | 8 ++--- .../calls/transactor/itx/minimalForwarder.go | 4 +-- .../transactor/itx/minimalForwarder_test.go | 12 +++---- chains/evm/calls/transactor/itx/mock/itx.go | 2 +- .../transactor/itx/mock/minimalForwarder.go | 2 +- chains/evm/calls/transactor/mock/transact.go | 2 +- .../calls/transactor/monitored/monitored.go | 4 +-- .../transactor/monitored/monitored_test.go | 10 +++--- .../evm/calls/transactor/prepare/prepare.go | 2 +- .../calls/transactor/prepare/prepare_test.go | 10 +++--- .../transactor/signAndSend/signAndSend.go | 4 +-- .../signAndSend/signAndSend_test.go | 10 +++--- chains/evm/calls/util_test.go | 7 ++-- chains/evm/chain.go | 4 +-- chains/evm/cli/account/account.go | 2 +- chains/evm/cli/account/flagVars.go | 6 ++-- chains/evm/cli/account/generate-key-pair.go | 4 +-- chains/evm/cli/account/transfer.go | 14 ++++---- chains/evm/cli/admin/add-admin.go | 6 ++-- chains/evm/cli/admin/add-relayer.go | 14 ++++---- chains/evm/cli/admin/admin.go | 2 +- chains/evm/cli/admin/flagVars.go | 6 ++-- chains/evm/cli/admin/get-threshold.go | 12 +++---- chains/evm/cli/admin/is-relayer.go | 12 +++---- chains/evm/cli/admin/pause.go | 14 ++++---- chains/evm/cli/admin/remove-admin.go | 6 ++-- chains/evm/cli/admin/remove-relayer.go | 6 ++-- chains/evm/cli/admin/set-deposit-nonce.go | 14 ++++---- chains/evm/cli/admin/set-fee.go | 6 ++-- chains/evm/cli/admin/set-threshold.go | 14 ++++---- chains/evm/cli/admin/unpause.go | 14 ++++---- chains/evm/cli/admin/withdraw.go | 16 ++++----- chains/evm/cli/bridge/bridge.go | 2 +- chains/evm/cli/bridge/cancel-proposal.go | 6 ++-- chains/evm/cli/bridge/flagVars.go | 8 ++--- chains/evm/cli/bridge/mock/vote-proposal.go | 4 +-- chains/evm/cli/bridge/query-proposal.go | 6 ++-- chains/evm/cli/bridge/query-resource.go | 6 ++-- .../cli/bridge/register-generic-resource.go | 18 +++++----- chains/evm/cli/bridge/register-resource.go | 14 ++++---- chains/evm/cli/bridge/set-burn.go | 14 ++++---- chains/evm/cli/bridge/vote-proposal.go | 16 ++++----- chains/evm/cli/bridge/vote-proposal_test.go | 12 +++---- chains/evm/cli/centrifuge/centrifuge.go | 2 +- chains/evm/cli/centrifuge/deploy.go | 10 +++--- chains/evm/cli/centrifuge/flagVars.go | 6 ++-- chains/evm/cli/centrifuge/get-hash.go | 14 ++++---- chains/evm/cli/cli.go | 18 +++++----- chains/evm/cli/deploy/deploy.go | 24 ++++++------- chains/evm/cli/erc20/add-minter.go | 14 ++++---- chains/evm/cli/erc20/approve.go | 16 ++++----- chains/evm/cli/erc20/balance.go | 12 +++---- chains/evm/cli/erc20/deposit.go | 16 ++++----- chains/evm/cli/erc20/erc20.go | 2 +- chains/evm/cli/erc20/flagVars.go | 8 ++--- chains/evm/cli/erc20/get-allowance.go | 12 +++---- chains/evm/cli/erc20/mint.go | 16 ++++----- chains/evm/cli/erc721/add-minter.go | 12 +++---- chains/evm/cli/erc721/approve.go | 14 ++++---- chains/evm/cli/erc721/deposit.go | 14 ++++---- chains/evm/cli/erc721/erc721.go | 2 +- chains/evm/cli/erc721/flagVars.go | 4 +-- chains/evm/cli/erc721/mint.go | 14 ++++---- chains/evm/cli/erc721/owner.go | 12 +++---- chains/evm/cli/flags/utils.go | 8 ++--- chains/evm/cli/initialize/initialize.go | 14 ++++---- chains/evm/cli/local/deploy.go | 22 ++++++------ chains/evm/cli/local/local.go | 4 +-- chains/evm/cli/logger/logger.go | 2 +- chains/evm/cli/logger/logger_test.go | 4 +-- chains/evm/cli/utils/hash-list.go | 6 ++-- chains/evm/cli/utils/simulate.go | 8 ++--- chains/evm/cli/utils/utils.go | 4 +-- chains/evm/executor/message-handler.go | 6 ++-- chains/evm/executor/message-handler_test.go | 6 ++-- chains/evm/executor/mock/voter.go | 10 +++--- chains/evm/executor/proposal/proposal.go | 4 +-- chains/evm/executor/voter.go | 10 +++--- chains/evm/executor/voter_test.go | 8 ++--- chains/evm/listener/deposit-handler.go | 6 ++-- chains/evm/listener/deposit-handler_test.go | 8 ++--- chains/evm/listener/event-handler.go | 6 ++-- chains/evm/listener/event-handler_test.go | 10 +++--- chains/evm/listener/listener.go | 4 +-- chains/evm/listener/listener_test.go | 6 ++-- chains/evm/listener/mock/listener.go | 6 ++-- config/chain/config.go | 2 +- config/chain/evm_test.go | 2 +- config/config.go | 2 +- config/config_test.go | 4 +-- e2e/dummy/gas-pricer.go | 2 +- e2e/evm/evm_test.go | 26 +++++++------- e2e/evm/util.go | 4 +-- example/app/app.go | 34 +++++++++---------- example/cmd/cmd.go | 8 ++--- example/main.go | 2 +- go.mod | 2 +- keystore/decrypt.go | 6 ++-- keystore/encrypt.go | 6 ++-- keystore/encrypt_test.go | 4 +-- keystore/keyring.go | 6 ++-- keystore/keystore.go | 7 ++-- opentelemetry/metrics.go | 2 +- relayer/message/message.go | 2 +- relayer/mock/relayer.go | 2 +- relayer/relayer.go | 2 +- relayer/relayer_test.go | 4 +-- store/blockstore_test.go | 4 +-- store/noncestore_test.go | 4 +-- 135 files changed, 537 insertions(+), 547 deletions(-) delete mode 100644 .github/workflows/update-core-example.yml diff --git a/.github/workflows/update-core-example.yml b/.github/workflows/update-core-example.yml deleted file mode 100644 index aab2eebe..00000000 --- a/.github/workflows/update-core-example.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Update ChainBridge core-example - -on: - push: - branches: - - 'main' - -jobs: - update-core-example: - runs-on: ubuntu-latest - steps: - - name: Trigger chainbridge-core-example update event - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.PUBLIC_REPO_PAM }} - # Repository to which to dispatch the event - repository: ChainSafe/chainbridge-core-example - event-type: push-core-to-main-branch - client-payload: '{"sha": "${{ github.sha }}"}' diff --git a/Makefile b/Makefile index 30cb182c..59543d16 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ genmocks: mockgen -destination=./relayer/mock/relayer.go -source=./relayer/relayer.go mockgen -source=chains/evm/calls/calls.go -destination=chains/evm/calls/mock/calls.go mockgen -source=chains/evm/calls/transactor/transact.go -destination=chains/evm/calls/transactor/mock/transact.go - mockgen -destination=chains/evm/executor/mock/voter.go github.com/ChainSafe/chainbridge-core/chains/evm/executor ChainClient,MessageHandler,BridgeContract + mockgen -destination=chains/evm/executor/mock/voter.go github.com/ChainSafe/sygma-core/chains/evm/executor ChainClient,MessageHandler,BridgeContract mockgen -destination=./chains/evm/calls/transactor/itx/mock/itx.go -source=./chains/evm/calls/transactor/itx/itx.go mockgen -destination=./chains/evm/calls/transactor/itx//mock/minimalForwarder.go -source=./chains/evm/calls/transactor/itx/minimalForwarder.go mockgen -destination=chains/evm/cli/bridge/mock/vote-proposal.go -source=./chains/evm/cli/bridge/vote-proposal.go diff --git a/chains/evm/calls/calls.go b/chains/evm/calls/calls.go index fa658c4c..4a037ac3 100644 --- a/chains/evm/calls/calls.go +++ b/chains/evm/calls/calls.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/calls/contracts/bridge/bridge.go b/chains/evm/calls/contracts/bridge/bridge.go index a77a69cd..44b87dd2 100644 --- a/chains/evm/calls/contracts/bridge/bridge.go +++ b/chains/evm/calls/contracts/bridge/bridge.go @@ -6,16 +6,16 @@ import ( "strconv" "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/deposit" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/deposit" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" diff --git a/chains/evm/calls/contracts/bridge/bridge_test.go b/chains/evm/calls/contracts/bridge/bridge_test.go index 5c53b313..a4b642f0 100644 --- a/chains/evm/calls/contracts/bridge/bridge_test.go +++ b/chains/evm/calls/contracts/bridge/bridge_test.go @@ -6,13 +6,13 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/relayer/message" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/contracts/centrifuge/assetStore.go b/chains/evm/calls/contracts/centrifuge/assetStore.go index 90242836..4436e9ad 100644 --- a/chains/evm/calls/contracts/centrifuge/assetStore.go +++ b/chains/evm/calls/contracts/centrifuge/assetStore.go @@ -1,14 +1,15 @@ package centrifuge import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "strings" + + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/rs/zerolog/log" - "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ) diff --git a/chains/evm/calls/contracts/centrifuge/assetStore_test.go b/chains/evm/calls/contracts/centrifuge/assetStore_test.go index 7c257fe8..69d2b6ce 100644 --- a/chains/evm/calls/contracts/centrifuge/assetStore_test.go +++ b/chains/evm/calls/contracts/centrifuge/assetStore_test.go @@ -2,11 +2,12 @@ package centrifuge_test import ( "errors" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/centrifuge" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" "testing" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/contracts/contract.go b/chains/evm/calls/contracts/contract.go index 8c8a7070..71548c7a 100644 --- a/chains/evm/calls/contracts/contract.go +++ b/chains/evm/calls/contracts/contract.go @@ -3,8 +3,9 @@ package contracts import ( "context" "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/calls/contracts/contract_test.go b/chains/evm/calls/contracts/contract_test.go index db9000a5..aed507b1 100644 --- a/chains/evm/calls/contracts/contract_test.go +++ b/chains/evm/calls/contracts/contract_test.go @@ -2,17 +2,18 @@ package contracts import ( "errors" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" + "math/big" + "strings" + "testing" + + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" - "math/big" - "strings" - "testing" ) type ContractTestSuite struct { diff --git a/chains/evm/calls/contracts/erc20/erc20.go b/chains/evm/calls/contracts/erc20/erc20.go index e7bc3c12..7b451173 100644 --- a/chains/evm/calls/contracts/erc20/erc20.go +++ b/chains/evm/calls/contracts/erc20/erc20.go @@ -1,13 +1,14 @@ package erc20 import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" "math/big" "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" diff --git a/chains/evm/calls/contracts/erc20/erc20Handler.go b/chains/evm/calls/contracts/erc20/erc20Handler.go index 65faae15..94db6a82 100644 --- a/chains/evm/calls/contracts/erc20/erc20Handler.go +++ b/chains/evm/calls/contracts/erc20/erc20Handler.go @@ -1,13 +1,14 @@ package erc20 import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "strings" + + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "strings" ) type ERC20HandlerContract struct { diff --git a/chains/evm/calls/contracts/erc20/erc20_test.go b/chains/evm/calls/contracts/erc20/erc20_test.go index 1a98cda2..6aac8339 100644 --- a/chains/evm/calls/contracts/erc20/erc20_test.go +++ b/chains/evm/calls/contracts/erc20/erc20_test.go @@ -4,10 +4,10 @@ import ( "math/big" "testing" - erc20 "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" + erc20 "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/contracts/erc721/erc721.go b/chains/evm/calls/contracts/erc721/erc721.go index 50120edc..9d0a8871 100644 --- a/chains/evm/calls/contracts/erc721/erc721.go +++ b/chains/evm/calls/contracts/erc721/erc721.go @@ -1,13 +1,14 @@ package erc721 import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" "math/big" "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" diff --git a/chains/evm/calls/contracts/erc721/erc721Handler.go b/chains/evm/calls/contracts/erc721/erc721Handler.go index 0ebb5f47..a4a8ef0a 100644 --- a/chains/evm/calls/contracts/erc721/erc721Handler.go +++ b/chains/evm/calls/contracts/erc721/erc721Handler.go @@ -1,13 +1,14 @@ package erc721 import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "strings" + + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "strings" ) type ERC721HandlerContract struct { diff --git a/chains/evm/calls/contracts/erc721/erc721_test.go b/chains/evm/calls/contracts/erc721/erc721_test.go index 039b06ee..2e711c5a 100644 --- a/chains/evm/calls/contracts/erc721/erc721_test.go +++ b/chains/evm/calls/contracts/erc721/erc721_test.go @@ -4,11 +4,11 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/contracts/forwarder/forwarder.go b/chains/evm/calls/contracts/forwarder/forwarder.go index 122a1ebe..2fee4bb7 100644 --- a/chains/evm/calls/contracts/forwarder/forwarder.go +++ b/chains/evm/calls/contracts/forwarder/forwarder.go @@ -4,9 +4,9 @@ import ( "math/big" "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ) diff --git a/chains/evm/calls/contracts/generic/genericHandler.go b/chains/evm/calls/contracts/generic/genericHandler.go index ddd8180b..c52ccd4f 100644 --- a/chains/evm/calls/contracts/generic/genericHandler.go +++ b/chains/evm/calls/contracts/generic/genericHandler.go @@ -1,13 +1,14 @@ package generic import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "strings" + + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "strings" ) type GenericHandlerContract struct { diff --git a/chains/evm/calls/events/events.go b/chains/evm/calls/events/events.go index e2560c9f..edf6409d 100644 --- a/chains/evm/calls/events/events.go +++ b/chains/evm/calls/events/events.go @@ -1,7 +1,7 @@ package events import ( - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" ) diff --git a/chains/evm/calls/events/listener.go b/chains/evm/calls/events/listener.go index ca85c108..12ac8297 100644 --- a/chains/evm/calls/events/listener.go +++ b/chains/evm/calls/events/listener.go @@ -5,7 +5,7 @@ import ( "math/big" "strings" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ethTypes "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/calls/events/listener_test.go b/chains/evm/calls/events/listener_test.go index ace64d0f..2d0ae7a6 100644 --- a/chains/evm/calls/events/listener_test.go +++ b/chains/evm/calls/events/listener_test.go @@ -5,9 +5,9 @@ import ( "strings" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/evmgaspricer/london_test.go b/chains/evm/calls/evmgaspricer/london_test.go index d62c38ae..3813e75d 100644 --- a/chains/evm/calls/evmgaspricer/london_test.go +++ b/chains/evm/calls/evmgaspricer/london_test.go @@ -4,7 +4,7 @@ import ( "math/big" "testing" - mock_evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer/mock" + mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/evmgaspricer/static_test.go b/chains/evm/calls/evmgaspricer/static_test.go index 2df7090c..848c3696 100644 --- a/chains/evm/calls/evmgaspricer/static_test.go +++ b/chains/evm/calls/evmgaspricer/static_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - mock_evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer/mock" + mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" "github.com/golang/mock/gomock" diff --git a/chains/evm/calls/evmtransaction/evm-tx.go b/chains/evm/calls/evmtransaction/evm-tx.go index b19de647..73bd18ce 100644 --- a/chains/evm/calls/evmtransaction/evm-tx.go +++ b/chains/evm/calls/evmtransaction/evm-tx.go @@ -4,7 +4,7 @@ import ( "context" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/calls/evmtransaction/evm-tx_test.go b/chains/evm/calls/evmtransaction/evm-tx_test.go index 2d758cfd..b5d6eeda 100644 --- a/chains/evm/calls/evmtransaction/evm-tx_test.go +++ b/chains/evm/calls/evmtransaction/evm-tx_test.go @@ -4,12 +4,12 @@ import ( "math/big" "testing" - evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" - mock_evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer/mock" + evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" + mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" "github.com/ethereum/go-ethereum/core/types" - "github.com/ChainSafe/chainbridge-core/keystore" + "github.com/ChainSafe/sygma-core/keystore" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/calls/mock/calls.go b/chains/evm/calls/mock/calls.go index 1f3dab31..1fa608b5 100644 --- a/chains/evm/calls/mock/calls.go +++ b/chains/evm/calls/mock/calls.go @@ -9,7 +9,7 @@ import ( big "math/big" reflect "reflect" - evmclient "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" + evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" common "github.com/ethereum/go-ethereum/common" types "github.com/ethereum/go-ethereum/core/types" gomock "github.com/golang/mock/gomock" diff --git a/chains/evm/calls/transactor/itx/itx.go b/chains/evm/calls/transactor/itx/itx.go index c30da259..d33bb559 100644 --- a/chains/evm/calls/transactor/itx/itx.go +++ b/chains/evm/calls/transactor/itx/itx.go @@ -5,7 +5,7 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" diff --git a/chains/evm/calls/transactor/itx/itx_test.go b/chains/evm/calls/transactor/itx/itx_test.go index 71573b20..6b2cfb3c 100644 --- a/chains/evm/calls/transactor/itx/itx_test.go +++ b/chains/evm/calls/transactor/itx/itx_test.go @@ -6,10 +6,10 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/itx" - mock_itx "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/itx/mock" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx" + mock_itx "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx/mock" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/transactor/itx/minimalForwarder.go b/chains/evm/calls/transactor/itx/minimalForwarder.go index 896b19a7..ad9f8260 100644 --- a/chains/evm/calls/transactor/itx/minimalForwarder.go +++ b/chains/evm/calls/transactor/itx/minimalForwarder.go @@ -5,8 +5,8 @@ import ( "math/big" "sync" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/forwarder" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" diff --git a/chains/evm/calls/transactor/itx/minimalForwarder_test.go b/chains/evm/calls/transactor/itx/minimalForwarder_test.go index 69683e1e..c879e66b 100644 --- a/chains/evm/calls/transactor/itx/minimalForwarder_test.go +++ b/chains/evm/calls/transactor/itx/minimalForwarder_test.go @@ -6,12 +6,12 @@ import ( "strings" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/forwarder" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/itx" - mock_forwarder "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/itx/mock" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx" + mock_forwarder "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx/mock" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" diff --git a/chains/evm/calls/transactor/itx/mock/itx.go b/chains/evm/calls/transactor/itx/mock/itx.go index 2638ded3..bac29f91 100644 --- a/chains/evm/calls/transactor/itx/mock/itx.go +++ b/chains/evm/calls/transactor/itx/mock/itx.go @@ -9,7 +9,7 @@ import ( big "math/big" reflect "reflect" - transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" common "github.com/ethereum/go-ethereum/common" gomock "github.com/golang/mock/gomock" ) diff --git a/chains/evm/calls/transactor/itx/mock/minimalForwarder.go b/chains/evm/calls/transactor/itx/mock/minimalForwarder.go index d4d13164..78564a69 100644 --- a/chains/evm/calls/transactor/itx/mock/minimalForwarder.go +++ b/chains/evm/calls/transactor/itx/mock/minimalForwarder.go @@ -8,7 +8,7 @@ import ( big "math/big" reflect "reflect" - forwarder "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/forwarder" + forwarder "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" common "github.com/ethereum/go-ethereum/common" gomock "github.com/golang/mock/gomock" ) diff --git a/chains/evm/calls/transactor/mock/transact.go b/chains/evm/calls/transactor/mock/transact.go index 78ff9faf..de0d7309 100644 --- a/chains/evm/calls/transactor/mock/transact.go +++ b/chains/evm/calls/transactor/mock/transact.go @@ -7,7 +7,7 @@ package mock_transactor import ( reflect "reflect" - transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" common "github.com/ethereum/go-ethereum/common" gomock "github.com/golang/mock/gomock" ) diff --git a/chains/evm/calls/transactor/monitored/monitored.go b/chains/evm/calls/transactor/monitored/monitored.go index f8925396..716e63f0 100644 --- a/chains/evm/calls/transactor/monitored/monitored.go +++ b/chains/evm/calls/transactor/monitored/monitored.go @@ -10,8 +10,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog/log" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" ) type RawTx struct { diff --git a/chains/evm/calls/transactor/monitored/monitored_test.go b/chains/evm/calls/transactor/monitored/monitored_test.go index 9b14083d..0c4363bc 100644 --- a/chains/evm/calls/transactor/monitored/monitored_test.go +++ b/chains/evm/calls/transactor/monitored/monitored_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/monitored" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" diff --git a/chains/evm/calls/transactor/prepare/prepare.go b/chains/evm/calls/transactor/prepare/prepare.go index bce364b1..c1fe21d0 100644 --- a/chains/evm/calls/transactor/prepare/prepare.go +++ b/chains/evm/calls/transactor/prepare/prepare.go @@ -3,7 +3,7 @@ package prepare import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/common" ) diff --git a/chains/evm/calls/transactor/prepare/prepare_test.go b/chains/evm/calls/transactor/prepare/prepare_test.go index a3fbf1aa..8129dbab 100644 --- a/chains/evm/calls/transactor/prepare/prepare_test.go +++ b/chains/evm/calls/transactor/prepare/prepare_test.go @@ -3,11 +3,11 @@ package prepare_test import ( "testing" - erc20 "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/prepare" + erc20 "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/prepare" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend.go b/chains/evm/calls/transactor/signAndSend/signAndSend.go index 97bdad43..0caa570c 100644 --- a/chains/evm/calls/transactor/signAndSend/signAndSend.go +++ b/chains/evm/calls/transactor/signAndSend/signAndSend.go @@ -4,8 +4,8 @@ import ( "context" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend_test.go b/chains/evm/calls/transactor/signAndSend/signAndSend_test.go index aadca789..341e9970 100644 --- a/chains/evm/calls/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/calls/transactor/signAndSend/signAndSend_test.go @@ -4,11 +4,11 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" diff --git a/chains/evm/calls/util_test.go b/chains/evm/calls/util_test.go index 2b5b0c9d..99f1edc2 100644 --- a/chains/evm/calls/util_test.go +++ b/chains/evm/calls/util_test.go @@ -1,12 +1,13 @@ package calls_test import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - mock_calls "github.com/ChainSafe/chainbridge-core/chains/evm/calls/mock" "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" diff --git a/chains/evm/chain.go b/chains/evm/chain.go index fc832ff1..7d201ee0 100644 --- a/chains/evm/chain.go +++ b/chains/evm/chain.go @@ -8,8 +8,8 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/store" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/store" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/cli/account/account.go b/chains/evm/cli/account/account.go index 635f00de..1a7c0832 100644 --- a/chains/evm/cli/account/account.go +++ b/chains/evm/cli/account/account.go @@ -3,7 +3,7 @@ package account import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/account/flagVars.go b/chains/evm/cli/account/flagVars.go index c8794530..86e16608 100644 --- a/chains/evm/cli/account/flagVars.go +++ b/chains/evm/cli/account/flagVars.go @@ -3,12 +3,12 @@ package account import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum/common" ) -//flag vars +// flag vars var ( PrivateKey string Pass string @@ -17,7 +17,7 @@ var ( Decimals uint64 ) -//processed flag vars +// processed flag vars var ( RecipientAddress common.Address WeiAmount *big.Int diff --git a/chains/evm/cli/account/generate-key-pair.go b/chains/evm/cli/account/generate-key-pair.go index 5e7f9862..3ad56ec8 100644 --- a/chains/evm/cli/account/generate-key-pair.go +++ b/chains/evm/cli/account/generate-key-pair.go @@ -1,8 +1,8 @@ package account import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/account/transfer.go b/chains/evm/cli/account/transfer.go index 3b857ebc..6a1065f5 100644 --- a/chains/evm/cli/account/transfer.go +++ b/chains/evm/cli/account/transfer.go @@ -7,13 +7,13 @@ import ( "os" "strings" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/add-admin.go b/chains/evm/cli/admin/add-admin.go index 2180826c..bf5ee830 100644 --- a/chains/evm/cli/admin/add-admin.go +++ b/chains/evm/cli/admin/add-admin.go @@ -3,9 +3,9 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/add-relayer.go b/chains/evm/cli/admin/add-relayer.go index 09edd409..fc43f808 100644 --- a/chains/evm/cli/admin/add-relayer.go +++ b/chains/evm/cli/admin/add-relayer.go @@ -3,14 +3,14 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/admin.go b/chains/evm/cli/admin/admin.go index 5a4a4710..020fcb13 100644 --- a/chains/evm/cli/admin/admin.go +++ b/chains/evm/cli/admin/admin.go @@ -3,7 +3,7 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/admin/flagVars.go b/chains/evm/cli/admin/flagVars.go index 4064ed4c..dcd6d5d2 100644 --- a/chains/evm/cli/admin/flagVars.go +++ b/chains/evm/cli/admin/flagVars.go @@ -3,12 +3,12 @@ package admin import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum/common" ) -//flag vars +// flag vars var ( Admin string Relayer string @@ -25,7 +25,7 @@ var ( Bridge string ) -//processed flag vars +// processed flag vars var ( BridgeAddr common.Address HandlerAddr common.Address diff --git a/chains/evm/cli/admin/get-threshold.go b/chains/evm/cli/admin/get-threshold.go index 32702f18..04507341 100644 --- a/chains/evm/cli/admin/get-threshold.go +++ b/chains/evm/cli/admin/get-threshold.go @@ -3,13 +3,13 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/is-relayer.go b/chains/evm/cli/admin/is-relayer.go index 82c75346..d5b4ad5a 100644 --- a/chains/evm/cli/admin/is-relayer.go +++ b/chains/evm/cli/admin/is-relayer.go @@ -3,13 +3,13 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/pause.go b/chains/evm/cli/admin/pause.go index 87c6b6bd..664fd03e 100644 --- a/chains/evm/cli/admin/pause.go +++ b/chains/evm/cli/admin/pause.go @@ -3,14 +3,14 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/remove-admin.go b/chains/evm/cli/admin/remove-admin.go index b050f763..3d4abdf1 100644 --- a/chains/evm/cli/admin/remove-admin.go +++ b/chains/evm/cli/admin/remove-admin.go @@ -3,9 +3,9 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/remove-relayer.go b/chains/evm/cli/admin/remove-relayer.go index 39af94b4..2724d1d4 100644 --- a/chains/evm/cli/admin/remove-relayer.go +++ b/chains/evm/cli/admin/remove-relayer.go @@ -3,9 +3,9 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/set-deposit-nonce.go b/chains/evm/cli/admin/set-deposit-nonce.go index 9e0e9c77..d113cbce 100644 --- a/chains/evm/cli/admin/set-deposit-nonce.go +++ b/chains/evm/cli/admin/set-deposit-nonce.go @@ -3,13 +3,13 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/set-fee.go b/chains/evm/cli/admin/set-fee.go index 108a4a62..9601bcff 100644 --- a/chains/evm/cli/admin/set-fee.go +++ b/chains/evm/cli/admin/set-fee.go @@ -3,9 +3,9 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/set-threshold.go b/chains/evm/cli/admin/set-threshold.go index b5725831..7e9184a3 100644 --- a/chains/evm/cli/admin/set-threshold.go +++ b/chains/evm/cli/admin/set-threshold.go @@ -3,13 +3,13 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/unpause.go b/chains/evm/cli/admin/unpause.go index c4ebe824..f6b5de57 100644 --- a/chains/evm/cli/admin/unpause.go +++ b/chains/evm/cli/admin/unpause.go @@ -3,14 +3,14 @@ package admin import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/admin/withdraw.go b/chains/evm/cli/admin/withdraw.go index 67efbdf4..16c2cec4 100644 --- a/chains/evm/cli/admin/withdraw.go +++ b/chains/evm/cli/admin/withdraw.go @@ -5,15 +5,15 @@ import ( "fmt" "math/big" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/bridge.go b/chains/evm/cli/bridge/bridge.go index 356cf810..45ea7fdc 100644 --- a/chains/evm/cli/bridge/bridge.go +++ b/chains/evm/cli/bridge/bridge.go @@ -3,7 +3,7 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/bridge/cancel-proposal.go b/chains/evm/cli/bridge/cancel-proposal.go index a1c35901..4bfcd216 100644 --- a/chains/evm/cli/bridge/cancel-proposal.go +++ b/chains/evm/cli/bridge/cancel-proposal.go @@ -3,9 +3,9 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/flagVars.go b/chains/evm/cli/bridge/flagVars.go index 5642aac5..978c7c12 100644 --- a/chains/evm/cli/bridge/flagVars.go +++ b/chains/evm/cli/bridge/flagVars.go @@ -3,12 +3,12 @@ package bridge import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" ) -//flag vars +// flag vars var ( Bridge string DataHash string @@ -25,7 +25,7 @@ var ( TokenContract string ) -//processed flag vars +// processed flag vars var ( BridgeAddr common.Address ResourceIdBytesArr types.ResourceID diff --git a/chains/evm/cli/bridge/mock/vote-proposal.go b/chains/evm/cli/bridge/mock/vote-proposal.go index f4a40a13..9769dc1c 100644 --- a/chains/evm/cli/bridge/mock/vote-proposal.go +++ b/chains/evm/cli/bridge/mock/vote-proposal.go @@ -7,8 +7,8 @@ package mock_bridge import ( reflect "reflect" - transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - proposal "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" + transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + proposal "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" common "github.com/ethereum/go-ethereum/common" gomock "github.com/golang/mock/gomock" ) diff --git a/chains/evm/cli/bridge/query-proposal.go b/chains/evm/cli/bridge/query-proposal.go index f3c15089..73133cec 100644 --- a/chains/evm/cli/bridge/query-proposal.go +++ b/chains/evm/cli/bridge/query-proposal.go @@ -3,9 +3,9 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/query-resource.go b/chains/evm/cli/bridge/query-resource.go index ffa6f54c..ea286e39 100644 --- a/chains/evm/cli/bridge/query-resource.go +++ b/chains/evm/cli/bridge/query-resource.go @@ -3,9 +3,9 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/register-generic-resource.go b/chains/evm/cli/bridge/register-generic-resource.go index c9413908..475cd693 100644 --- a/chains/evm/cli/bridge/register-generic-resource.go +++ b/chains/evm/cli/bridge/register-generic-resource.go @@ -5,15 +5,15 @@ import ( "fmt" "math/big" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/util" - - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/util" + + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/register-resource.go b/chains/evm/cli/bridge/register-resource.go index d00ae5b0..234a4825 100644 --- a/chains/evm/cli/bridge/register-resource.go +++ b/chains/evm/cli/bridge/register-resource.go @@ -3,13 +3,13 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/set-burn.go b/chains/evm/cli/bridge/set-burn.go index f3c4e176..32a251aa 100644 --- a/chains/evm/cli/bridge/set-burn.go +++ b/chains/evm/cli/bridge/set-burn.go @@ -3,13 +3,13 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/vote-proposal.go b/chains/evm/cli/bridge/vote-proposal.go index 5c17fe7d..f4b4d450 100644 --- a/chains/evm/cli/bridge/vote-proposal.go +++ b/chains/evm/cli/bridge/vote-proposal.go @@ -3,14 +3,14 @@ package bridge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/bridge/vote-proposal_test.go b/chains/evm/cli/bridge/vote-proposal_test.go index 81b07ba1..4799c55b 100644 --- a/chains/evm/cli/bridge/vote-proposal_test.go +++ b/chains/evm/cli/bridge/vote-proposal_test.go @@ -5,12 +5,12 @@ import ( "errors" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/bridge" - mock_bridge "github.com/ChainSafe/chainbridge-core/chains/evm/cli/bridge/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli" + "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge" + mock_bridge "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge/mock" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/spf13/cobra" diff --git a/chains/evm/cli/centrifuge/centrifuge.go b/chains/evm/cli/centrifuge/centrifuge.go index e80cfafe..98022d7f 100644 --- a/chains/evm/cli/centrifuge/centrifuge.go +++ b/chains/evm/cli/centrifuge/centrifuge.go @@ -3,7 +3,7 @@ package centrifuge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/centrifuge/deploy.go b/chains/evm/cli/centrifuge/deploy.go index 11e27c3b..eaf98afb 100644 --- a/chains/evm/cli/centrifuge/deploy.go +++ b/chains/evm/cli/centrifuge/deploy.go @@ -3,11 +3,11 @@ package centrifuge import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/centrifuge/flagVars.go b/chains/evm/cli/centrifuge/flagVars.go index 49713458..36087ba9 100644 --- a/chains/evm/cli/centrifuge/flagVars.go +++ b/chains/evm/cli/centrifuge/flagVars.go @@ -3,17 +3,17 @@ package centrifuge import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ethereum/go-ethereum/common" ) -//flag vars +// flag vars var ( Hash string Address string ) -//processed flag vars +// processed flag vars var ( StoreAddr common.Address ByteHash [32]byte diff --git a/chains/evm/cli/centrifuge/get-hash.go b/chains/evm/cli/centrifuge/get-hash.go index 55f6edbf..474a69c1 100644 --- a/chains/evm/cli/centrifuge/get-hash.go +++ b/chains/evm/cli/centrifuge/get-hash.go @@ -4,14 +4,14 @@ import ( "errors" "fmt" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/cli.go b/chains/evm/cli/cli.go index 523aef19..ef14dff2 100644 --- a/chains/evm/cli/cli.go +++ b/chains/evm/cli/cli.go @@ -1,15 +1,15 @@ package cli import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/account" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/admin" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/centrifuge" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/deploy" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/utils" + "github.com/ChainSafe/sygma-core/chains/evm/cli/account" + "github.com/ChainSafe/sygma-core/chains/evm/cli/admin" + "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/cli/centrifuge" + "github.com/ChainSafe/sygma-core/chains/evm/cli/deploy" + "github.com/ChainSafe/sygma-core/chains/evm/cli/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/cli/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/utils" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/chains/evm/cli/deploy/deploy.go b/chains/evm/cli/deploy/deploy.go index 1605308e..06a6c3b5 100644 --- a/chains/evm/cli/deploy/deploy.go +++ b/chains/evm/cli/deploy/deploy.go @@ -5,19 +5,19 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/generic" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/generic" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/utils" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/utils" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/add-minter.go b/chains/evm/cli/erc20/add-minter.go index 9aba50b2..9193b927 100644 --- a/chains/evm/cli/erc20/add-minter.go +++ b/chains/evm/cli/erc20/add-minter.go @@ -3,13 +3,13 @@ package erc20 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/approve.go b/chains/evm/cli/erc20/approve.go index 68b3f63a..a26d1416 100644 --- a/chains/evm/cli/erc20/approve.go +++ b/chains/evm/cli/erc20/approve.go @@ -4,15 +4,15 @@ import ( "errors" "math/big" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/balance.go b/chains/evm/cli/erc20/balance.go index e68ec417..87ba330c 100644 --- a/chains/evm/cli/erc20/balance.go +++ b/chains/evm/cli/erc20/balance.go @@ -3,13 +3,13 @@ package erc20 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/deposit.go b/chains/evm/cli/erc20/deposit.go index 7e716590..5954e980 100644 --- a/chains/evm/cli/erc20/deposit.go +++ b/chains/evm/cli/erc20/deposit.go @@ -4,15 +4,15 @@ import ( "fmt" "math/big" - callsUtil "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/erc20.go b/chains/evm/cli/erc20/erc20.go index 42c6b522..3f747e31 100644 --- a/chains/evm/cli/erc20/erc20.go +++ b/chains/evm/cli/erc20/erc20.go @@ -3,7 +3,7 @@ package erc20 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/erc20/flagVars.go b/chains/evm/cli/erc20/flagVars.go index b5ebf11d..6e5d1dea 100644 --- a/chains/evm/cli/erc20/flagVars.go +++ b/chains/evm/cli/erc20/flagVars.go @@ -3,13 +3,13 @@ package erc20 import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" ) -//flag vars +// flag vars var ( Amount string Decimals uint64 @@ -26,7 +26,7 @@ var ( Priority string ) -//processed flag vars +// processed flag vars var ( RecipientAddress common.Address RealAmount *big.Int diff --git a/chains/evm/cli/erc20/get-allowance.go b/chains/evm/cli/erc20/get-allowance.go index 65228bdd..86ae7b29 100644 --- a/chains/evm/cli/erc20/get-allowance.go +++ b/chains/evm/cli/erc20/get-allowance.go @@ -3,12 +3,12 @@ package erc20 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/util" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc20/mint.go b/chains/evm/cli/erc20/mint.go index 335932fb..07a13592 100644 --- a/chains/evm/cli/erc20/mint.go +++ b/chains/evm/cli/erc20/mint.go @@ -4,15 +4,15 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc721/add-minter.go b/chains/evm/cli/erc721/add-minter.go index ea487ad3..9831f3e9 100644 --- a/chains/evm/cli/erc721/add-minter.go +++ b/chains/evm/cli/erc721/add-minter.go @@ -3,13 +3,13 @@ package erc721 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc721/approve.go b/chains/evm/cli/erc721/approve.go index 46e50a09..e6a8ce62 100644 --- a/chains/evm/cli/erc721/approve.go +++ b/chains/evm/cli/erc721/approve.go @@ -4,14 +4,14 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc721/deposit.go b/chains/evm/cli/erc721/deposit.go index 4ff0cee2..22510f0d 100644 --- a/chains/evm/cli/erc721/deposit.go +++ b/chains/evm/cli/erc721/deposit.go @@ -5,14 +5,14 @@ import ( "math/big" "strconv" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc721/erc721.go b/chains/evm/cli/erc721/erc721.go index 5862dcfa..23cbc6bd 100644 --- a/chains/evm/cli/erc721/erc721.go +++ b/chains/evm/cli/erc721/erc721.go @@ -3,7 +3,7 @@ package erc721 import ( "fmt" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/erc721/flagVars.go b/chains/evm/cli/erc721/flagVars.go index 06d2ad00..938e5db6 100644 --- a/chains/evm/cli/erc721/flagVars.go +++ b/chains/evm/cli/erc721/flagVars.go @@ -3,8 +3,8 @@ package erc721 import ( "math/big" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" ) diff --git a/chains/evm/cli/erc721/mint.go b/chains/evm/cli/erc721/mint.go index ab1fa463..6addaecd 100644 --- a/chains/evm/cli/erc721/mint.go +++ b/chains/evm/cli/erc721/mint.go @@ -4,14 +4,14 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/erc721/owner.go b/chains/evm/cli/erc721/owner.go index 198df1c3..366de884 100644 --- a/chains/evm/cli/erc721/owner.go +++ b/chains/evm/cli/erc721/owner.go @@ -4,13 +4,13 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/initialize" - "github.com/ChainSafe/chainbridge-core/util" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" + "github.com/ChainSafe/sygma-core/util" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/chains/evm/cli/flags/utils.go b/chains/evm/cli/flags/utils.go index 40c1a601..5d27df6e 100644 --- a/chains/evm/cli/flags/utils.go +++ b/chains/evm/cli/flags/utils.go @@ -5,12 +5,12 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/keystore" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/keystore" + "github.com/ChainSafe/sygma-core/types" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/initialize/initialize.go b/chains/evm/cli/initialize/initialize.go index 4c763002..b059bb85 100644 --- a/chains/evm/cli/initialize/initialize.go +++ b/chains/evm/cli/initialize/initialize.go @@ -4,13 +4,13 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/prepare" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/prepare" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/cli/local/deploy.go b/chains/evm/cli/local/deploy.go index 2d66870b..daa69122 100644 --- a/chains/evm/cli/local/deploy.go +++ b/chains/evm/cli/local/deploy.go @@ -6,17 +6,17 @@ package local import ( "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/generic" - evmgaspricer "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/chainbridge-core/keystore" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/generic" + evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/keystore" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/cli/local/local.go b/chains/evm/cli/local/local.go index 9ef725fa..f18f5a31 100644 --- a/chains/evm/cli/local/local.go +++ b/chains/evm/cli/local/local.go @@ -4,8 +4,8 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/logger/logger.go b/chains/evm/cli/logger/logger.go index cec60cb8..efa3d955 100644 --- a/chains/evm/cli/logger/logger.go +++ b/chains/evm/cli/logger/logger.go @@ -5,7 +5,7 @@ import ( "os" "time" - "github.com/ChainSafe/chainbridge-core/logger" + "github.com/ChainSafe/sygma-core/logger" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/pflag" diff --git a/chains/evm/cli/logger/logger_test.go b/chains/evm/cli/logger/logger_test.go index 2bf471f2..6b612ccf 100644 --- a/chains/evm/cli/logger/logger_test.go +++ b/chains/evm/cli/logger/logger_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/spf13/cobra" "github.com/stretchr/testify/suite" ) diff --git a/chains/evm/cli/utils/hash-list.go b/chains/evm/cli/utils/hash-list.go index 0071f2ed..23926ded 100644 --- a/chains/evm/cli/utils/hash-list.go +++ b/chains/evm/cli/utils/hash-list.go @@ -6,10 +6,10 @@ import ( "math/big" "strconv" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) diff --git a/chains/evm/cli/utils/simulate.go b/chains/evm/cli/utils/simulate.go index 48caaa36..94499d2a 100644 --- a/chains/evm/cli/utils/simulate.go +++ b/chains/evm/cli/utils/simulate.go @@ -4,11 +4,11 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/flags" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/logger" + "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" + "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/rs/zerolog/log" diff --git a/chains/evm/cli/utils/utils.go b/chains/evm/cli/utils/utils.go index b9b43df6..c300823d 100644 --- a/chains/evm/cli/utils/utils.go +++ b/chains/evm/cli/utils/utils.go @@ -1,8 +1,8 @@ package utils import ( - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" "github.com/spf13/cobra" ) diff --git a/chains/evm/executor/message-handler.go b/chains/evm/executor/message-handler.go index 36eadd64..c387f823 100644 --- a/chains/evm/executor/message-handler.go +++ b/chains/evm/executor/message-handler.go @@ -6,9 +6,9 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/executor/message-handler_test.go b/chains/evm/executor/message-handler_test.go index b12a29f2..bc6d29e7 100644 --- a/chains/evm/executor/message-handler_test.go +++ b/chains/evm/executor/message-handler_test.go @@ -5,8 +5,8 @@ import ( "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/chains/evm/executor" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" ) @@ -20,7 +20,7 @@ var errIncorrectRecipient = errors.New("wrong payload recipient format") var errIncorrectTokenID = errors.New("wrong payload tokenID format") var errIncorrectMetadata = errors.New("wrong payload metadata format") -//ERC20 +// ERC20 type Erc20HandlerTestSuite struct { suite.Suite } diff --git a/chains/evm/executor/mock/voter.go b/chains/evm/executor/mock/voter.go index dc08358a..757bcff0 100644 --- a/chains/evm/executor/mock/voter.go +++ b/chains/evm/executor/mock/voter.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/chainbridge-core/chains/evm/executor (interfaces: ChainClient,MessageHandler,BridgeContract) +// Source: github.com/ChainSafe/sygma-core/chains/evm/executor (interfaces: ChainClient,MessageHandler,BridgeContract) // Package mock_executor is a generated GoMock package. package mock_executor @@ -9,10 +9,10 @@ import ( big "math/big" reflect "reflect" - evmclient "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - transactor "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - proposal "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - message "github.com/ChainSafe/chainbridge-core/relayer/message" + evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + proposal "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + message "github.com/ChainSafe/sygma-core/relayer/message" common "github.com/ethereum/go-ethereum/common" types "github.com/ethereum/go-ethereum/core/types" rpc "github.com/ethereum/go-ethereum/rpc" diff --git a/chains/evm/executor/proposal/proposal.go b/chains/evm/executor/proposal/proposal.go index 8622a6c1..162f0418 100644 --- a/chains/evm/executor/proposal/proposal.go +++ b/chains/evm/executor/proposal/proposal.go @@ -1,8 +1,8 @@ package proposal import ( - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" ) diff --git a/chains/evm/executor/voter.go b/chains/evm/executor/voter.go index 04bae862..a5f3cd46 100644 --- a/chains/evm/executor/voter.go +++ b/chains/evm/executor/voter.go @@ -11,12 +11,12 @@ import ( "strings" "time" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ethereumTypes "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/executor/voter_test.go b/chains/evm/executor/voter_test.go index 62bd4628..cfaf5398 100644 --- a/chains/evm/executor/voter_test.go +++ b/chains/evm/executor/voter_test.go @@ -5,10 +5,10 @@ import ( "testing" "time" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor" - mock_voter "github.com/ChainSafe/chainbridge-core/chains/evm/executor/mock" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor/proposal" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/chains/evm/executor" + mock_voter "github.com/ChainSafe/sygma-core/chains/evm/executor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/listener/deposit-handler.go b/chains/evm/listener/deposit-handler.go index 1a0baabe..32f80d33 100644 --- a/chains/evm/listener/deposit-handler.go +++ b/chains/evm/listener/deposit-handler.go @@ -4,8 +4,8 @@ import ( "errors" "math/big" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/rs/zerolog/log" "github.com/ethereum/go-ethereum/common" @@ -80,7 +80,7 @@ func Erc20DepositHandler(sourceID, destId uint8, nonce uint64, resourceID types. // lenRecipientAddress: second 32 bytes of calldata [32:64] // does not need to be derived because it is being calculated // within ERC20MessageHandler - // https://github.com/ChainSafe/chainbridge-core/blob/main/chains/evm/voter/message-handler.go#L108 + // https://github.com/ChainSafe/sygma-core/blob/main/chains/evm/voter/message-handler.go#L108 // 32-64 is recipient address length recipientAddressLength := big.NewInt(0).SetBytes(calldata[32:64]) diff --git a/chains/evm/listener/deposit-handler_test.go b/chains/evm/listener/deposit-handler_test.go index 4000f2bf..d121fd7d 100644 --- a/chains/evm/listener/deposit-handler_test.go +++ b/chains/evm/listener/deposit-handler_test.go @@ -5,10 +5,10 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/deposit" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/chains/evm/listener" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/deposit" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/listener" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/stretchr/testify/suite" diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go index a7ad9fa3..220dfe90 100644 --- a/chains/evm/listener/event-handler.go +++ b/chains/evm/listener/event-handler.go @@ -5,9 +5,9 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/listener/event-handler_test.go b/chains/evm/listener/event-handler_test.go index 978c8078..6a363345 100644 --- a/chains/evm/listener/event-handler_test.go +++ b/chains/evm/listener/event-handler_test.go @@ -5,11 +5,11 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/chains/evm/listener" - mock_listener "github.com/ChainSafe/chainbridge-core/chains/evm/listener/mock" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/listener" + mock_listener "github.com/ChainSafe/sygma-core/chains/evm/listener/mock" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/listener/listener.go b/chains/evm/listener/listener.go index 84408ac6..814511e9 100644 --- a/chains/evm/listener/listener.go +++ b/chains/evm/listener/listener.go @@ -8,8 +8,8 @@ import ( "math/big" "time" - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/store" + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/store" "github.com/rs/zerolog" "github.com/rs/zerolog/log" diff --git a/chains/evm/listener/listener_test.go b/chains/evm/listener/listener_test.go index c4787475..d28bbb6b 100644 --- a/chains/evm/listener/listener_test.go +++ b/chains/evm/listener/listener_test.go @@ -5,9 +5,9 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/chains/evm/listener" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/listener" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" diff --git a/chains/evm/listener/mock/listener.go b/chains/evm/listener/mock/listener.go index 342315bd..534eece1 100644 --- a/chains/evm/listener/mock/listener.go +++ b/chains/evm/listener/mock/listener.go @@ -9,9 +9,9 @@ import ( big "math/big" reflect "reflect" - events "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - message "github.com/ChainSafe/chainbridge-core/relayer/message" - types "github.com/ChainSafe/chainbridge-core/types" + events "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + message "github.com/ChainSafe/sygma-core/relayer/message" + types "github.com/ChainSafe/sygma-core/types" common "github.com/ethereum/go-ethereum/common" gomock "github.com/golang/mock/gomock" ) diff --git a/config/chain/config.go b/config/chain/config.go index 88957a01..764c3f4f 100644 --- a/config/chain/config.go +++ b/config/chain/config.go @@ -3,7 +3,7 @@ package chain import ( "fmt" - "github.com/ChainSafe/chainbridge-core/flags" + "github.com/ChainSafe/sygma-core/flags" "github.com/spf13/viper" ) diff --git a/config/chain/evm_test.go b/config/chain/evm_test.go index 1714ed35..0ea64136 100644 --- a/config/chain/evm_test.go +++ b/config/chain/evm_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/ChainSafe/chainbridge-core/config/chain" + "github.com/ChainSafe/sygma-core/config/chain" "github.com/stretchr/testify/suite" ) diff --git a/config/config.go b/config/config.go index db55907c..e20d6456 100644 --- a/config/config.go +++ b/config/config.go @@ -3,7 +3,7 @@ package config import ( "fmt" - "github.com/ChainSafe/chainbridge-core/config/relayer" + "github.com/ChainSafe/sygma-core/config/relayer" "github.com/creasty/defaults" "github.com/spf13/viper" ) diff --git a/config/config_test.go b/config/config_test.go index 05aff022..d1f02886 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/ChainSafe/chainbridge-core/config" - "github.com/ChainSafe/chainbridge-core/config/relayer" + "github.com/ChainSafe/sygma-core/config" + "github.com/ChainSafe/sygma-core/config/relayer" "github.com/stretchr/testify/suite" ) diff --git a/e2e/dummy/gas-pricer.go b/e2e/dummy/gas-pricer.go index 290fba12..208ca588 100644 --- a/e2e/dummy/gas-pricer.go +++ b/e2e/dummy/gas-pricer.go @@ -3,7 +3,7 @@ package dummy import ( "math/big" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" ) type GasPricer interface { diff --git a/e2e/evm/evm_test.go b/e2e/evm/evm_test.go index a62f74f5..f320e8b2 100644 --- a/e2e/evm/evm_test.go +++ b/e2e/evm/evm_test.go @@ -5,22 +5,22 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/chainbridge-core/e2e/dummy" - "github.com/ChainSafe/chainbridge-core/e2e/evm" + "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/e2e/dummy" + "github.com/ChainSafe/sygma-core/e2e/evm" substrateTypes "github.com/centrifuge/go-substrate-rpc-client/types" "github.com/ethereum/go-ethereum/common" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/local" - "github.com/ChainSafe/chainbridge-core/keystore" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" + "github.com/ChainSafe/sygma-core/chains/evm/cli/local" + "github.com/ChainSafe/sygma-core/keystore" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/core/types" diff --git a/e2e/evm/util.go b/e2e/evm/util.go index 17a9a5f4..aa5df1b8 100644 --- a/e2e/evm/util.go +++ b/e2e/evm/util.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/consts" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" "github.com/rs/zerolog/log" "github.com/ethereum/go-ethereum" diff --git a/example/app/app.go b/example/app/app.go index b59af007..9981d86f 100644 --- a/example/app/app.go +++ b/example/app/app.go @@ -15,23 +15,23 @@ import ( secp256k1 "github.com/ethereum/go-ethereum/crypto" - "github.com/ChainSafe/chainbridge-core/chains/evm" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/events" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/chainbridge-core/chains/evm/calls/transactor/monitored" - "github.com/ChainSafe/chainbridge-core/chains/evm/executor" - "github.com/ChainSafe/chainbridge-core/chains/evm/listener" - "github.com/ChainSafe/chainbridge-core/config" - "github.com/ChainSafe/chainbridge-core/config/chain" - secp256k12 "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/e2e/dummy" - "github.com/ChainSafe/chainbridge-core/flags" - "github.com/ChainSafe/chainbridge-core/lvldb" - "github.com/ChainSafe/chainbridge-core/opentelemetry" - "github.com/ChainSafe/chainbridge-core/relayer" - "github.com/ChainSafe/chainbridge-core/store" + "github.com/ChainSafe/sygma-core/chains/evm" + "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" + "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" + "github.com/ChainSafe/sygma-core/chains/evm/executor" + "github.com/ChainSafe/sygma-core/chains/evm/listener" + "github.com/ChainSafe/sygma-core/config" + "github.com/ChainSafe/sygma-core/config/chain" + secp256k12 "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/e2e/dummy" + "github.com/ChainSafe/sygma-core/flags" + "github.com/ChainSafe/sygma-core/lvldb" + "github.com/ChainSafe/sygma-core/opentelemetry" + "github.com/ChainSafe/sygma-core/relayer" + "github.com/ChainSafe/sygma-core/store" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" "github.com/spf13/viper" diff --git a/example/cmd/cmd.go b/example/cmd/cmd.go index 97e6c680..b2b1da2d 100644 --- a/example/cmd/cmd.go +++ b/example/cmd/cmd.go @@ -4,10 +4,10 @@ package cmd import ( - evmCLI "github.com/ChainSafe/chainbridge-core/chains/evm/cli" - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/local" - "github.com/ChainSafe/chainbridge-core/example/app" - "github.com/ChainSafe/chainbridge-core/flags" + evmCLI "github.com/ChainSafe/sygma-core/chains/evm/cli" + "github.com/ChainSafe/sygma-core/chains/evm/cli/local" + "github.com/ChainSafe/sygma-core/example/app" + "github.com/ChainSafe/sygma-core/flags" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) diff --git a/example/main.go b/example/main.go index 04cd5184..fd1a36fb 100644 --- a/example/main.go +++ b/example/main.go @@ -4,7 +4,7 @@ package main import ( - "github.com/ChainSafe/chainbridge-core/example/cmd" + "github.com/ChainSafe/sygma-core/example/cmd" ) func main() { diff --git a/go.mod b/go.mod index cf9384de..d436f7b4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ChainSafe/chainbridge-core +module github.com/ChainSafe/sygma-core go 1.19 diff --git a/keystore/decrypt.go b/keystore/decrypt.go index 13ee414c..c53dcfc1 100644 --- a/keystore/decrypt.go +++ b/keystore/decrypt.go @@ -10,9 +10,9 @@ import ( "os" "path/filepath" - "github.com/ChainSafe/chainbridge-core/crypto" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/crypto/sr25519" + "github.com/ChainSafe/sygma-core/crypto" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/sr25519" ) // Decrypt uses AES to decrypt ciphertext with the symmetric key deterministically created from `password` diff --git a/keystore/encrypt.go b/keystore/encrypt.go index 0962feca..72a33bdd 100644 --- a/keystore/encrypt.go +++ b/keystore/encrypt.go @@ -14,9 +14,9 @@ import ( "os" "syscall" - "github.com/ChainSafe/chainbridge-core/crypto" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/crypto/sr25519" + "github.com/ChainSafe/sygma-core/crypto" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/sr25519" "golang.org/x/crypto/blake2b" terminal "golang.org/x/term" ) diff --git a/keystore/encrypt_test.go b/keystore/encrypt_test.go index c3cc5fff..ea8cf4d5 100644 --- a/keystore/encrypt_test.go +++ b/keystore/encrypt_test.go @@ -11,8 +11,8 @@ import ( "reflect" "testing" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/crypto/sr25519" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/sr25519" ) func TestEncryptAndDecrypt(t *testing.T) { diff --git a/keystore/keyring.go b/keystore/keyring.go index 9dcdf584..6f88c89d 100644 --- a/keystore/keyring.go +++ b/keystore/keyring.go @@ -6,9 +6,9 @@ package keystore import ( "fmt" - "github.com/ChainSafe/chainbridge-core/crypto" - "github.com/ChainSafe/chainbridge-core/crypto/secp256k1" - "github.com/ChainSafe/chainbridge-core/crypto/sr25519" + "github.com/ChainSafe/sygma-core/crypto" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ChainSafe/sygma-core/crypto/sr25519" "github.com/centrifuge/go-substrate-rpc-client/signature" ) diff --git a/keystore/keystore.go b/keystore/keystore.go index 5a93891c..875b325e 100644 --- a/keystore/keystore.go +++ b/keystore/keystore.go @@ -4,7 +4,7 @@ /* The keystore package is used to load keys from keystore files, both for live use and for testing. -The Keystore +# The Keystore The keystore file is used as a file representation of a key. It contains 4 parts: - The key type (secp256k1, sr25519) @@ -16,12 +16,11 @@ This keystore also requires a password to decrypt into a usable key. The keystore library can be used to both encrypt keys into keystores, and decrypt keystore into keys. For more information on how to encrypt and decrypt from the command line, reference the README: https://github.com/ChainSafe/ChainBridge -The Keyring +# The Keyring The keyring provides predefined secp256k1 and srr25519 keys to use in testing. These keys are automatically provided during runtime and stored in memory rather than being stored on disk. There are 5 keys currenty supported: Alice, Bob, Charlie, Dave, and Eve. - */ package keystore @@ -29,7 +28,7 @@ import ( "fmt" "os" - "github.com/ChainSafe/chainbridge-core/crypto" + "github.com/ChainSafe/sygma-core/crypto" ) const EnvPassword = "KEYSTORE_PASSWORD" diff --git a/opentelemetry/metrics.go b/opentelemetry/metrics.go index 18afc23c..a20b6e54 100644 --- a/opentelemetry/metrics.go +++ b/opentelemetry/metrics.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/relayer/message" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" "go.opentelemetry.io/otel/metric" diff --git a/relayer/message/message.go b/relayer/message/message.go index dff076e6..bacfa690 100644 --- a/relayer/message/message.go +++ b/relayer/message/message.go @@ -7,7 +7,7 @@ import ( "math/big" "strconv" - "github.com/ChainSafe/chainbridge-core/types" + "github.com/ChainSafe/sygma-core/types" ) type TransferType string diff --git a/relayer/mock/relayer.go b/relayer/mock/relayer.go index 3b6fef4a..58d26f6b 100644 --- a/relayer/mock/relayer.go +++ b/relayer/mock/relayer.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - message "github.com/ChainSafe/chainbridge-core/relayer/message" + message "github.com/ChainSafe/sygma-core/relayer/message" gomock "github.com/golang/mock/gomock" ) diff --git a/relayer/relayer.go b/relayer/relayer.go index f420762e..548776ee 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -7,7 +7,7 @@ import ( "context" "fmt" - "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/sygma-core/relayer/message" "github.com/rs/zerolog/log" ) diff --git a/relayer/relayer_test.go b/relayer/relayer_test.go index 20699bf8..373f5257 100644 --- a/relayer/relayer_test.go +++ b/relayer/relayer_test.go @@ -5,8 +5,8 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/relayer/message" - mock_relayer "github.com/ChainSafe/chainbridge-core/relayer/mock" + "github.com/ChainSafe/sygma-core/relayer/message" + mock_relayer "github.com/ChainSafe/sygma-core/relayer/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" ) diff --git a/store/blockstore_test.go b/store/blockstore_test.go index dbbf11c0..a3a9cb96 100644 --- a/store/blockstore_test.go +++ b/store/blockstore_test.go @@ -5,8 +5,8 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/store" - mock_store "github.com/ChainSafe/chainbridge-core/store/mock" + "github.com/ChainSafe/sygma-core/store" + mock_store "github.com/ChainSafe/sygma-core/store/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/syndtr/goleveldb/leveldb" diff --git a/store/noncestore_test.go b/store/noncestore_test.go index 8ec282d6..951caecc 100644 --- a/store/noncestore_test.go +++ b/store/noncestore_test.go @@ -5,8 +5,8 @@ import ( "math/big" "testing" - "github.com/ChainSafe/chainbridge-core/store" - mock_store "github.com/ChainSafe/chainbridge-core/store/mock" + "github.com/ChainSafe/sygma-core/store" + mock_store "github.com/ChainSafe/sygma-core/store/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/syndtr/goleveldb/leveldb" From e42d14a41026b87085aa4694ff37aceefe96a212 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 13:59:52 +0200 Subject: [PATCH 03/27] Remove all extra code --- chains/evm/calls/calls.go | 43 +- .../evm-client.go => client/client.go} | 47 +- chains/evm/calls/consts/bridge.go | 6 - chains/evm/calls/consts/centrifuge.go | 6 - chains/evm/calls/consts/erc20Handler.go | 6 - .../calls/consts/erc20PresetMinterPauser.go | 6 - chains/evm/calls/consts/erc721Handler.go | 6 - .../calls/consts/erc721PresetMinterPauser.go | 6 - chains/evm/calls/consts/generic.go | 6 - chains/evm/calls/consts/minimalForwarder.go | 6 - chains/evm/calls/contracts/bridge/bridge.go | 348 -------------- .../evm/calls/contracts/bridge/bridge_test.go | 415 ----------------- .../calls/contracts/centrifuge/assetStore.go | 42 -- .../contracts/centrifuge/assetStore_test.go | 87 ---- chains/evm/calls/contracts/deposit/deposit.go | 50 --- chains/evm/calls/contracts/erc20/erc20.go | 78 ---- .../evm/calls/contracts/erc20/erc20Handler.go | 26 -- .../evm/calls/contracts/erc20/erc20_test.go | 121 ----- chains/evm/calls/contracts/erc721/erc721.go | 74 --- .../calls/contracts/erc721/erc721Handler.go | 26 -- .../evm/calls/contracts/erc721/erc721_test.go | 160 ------- .../calls/contracts/forwarder/forwarder.go | 54 --- .../calls/contracts/generic/genericHandler.go | 26 -- chains/evm/calls/events/events.go | 5 +- chains/evm/calls/events/listener.go | 64 --- chains/evm/calls/events/listener_test.go | 52 --- .../calls/{evmgaspricer => gas}/gas-pricer.go | 0 .../evm/calls/{evmgaspricer => gas}/london.go | 0 .../{evmgaspricer => gas}/london_test.go | 0 .../{evmgaspricer => gas}/mock/gas-pricer.go | 0 .../evm/calls/{evmgaspricer => gas}/static.go | 0 .../{evmgaspricer => gas}/static_test.go | 0 .../{evmtransaction => transaction}/evm-tx.go | 0 .../evm-tx_test.go | 0 chains/evm/calls/transactor/itx/itx.go | 175 -------- chains/evm/calls/transactor/itx/itx_test.go | 204 --------- .../calls/transactor/itx/minimalForwarder.go | 197 -------- .../transactor/itx/minimalForwarder_test.go | 141 ------ chains/evm/calls/transactor/itx/mock/itx.go | 226 ---------- .../transactor/itx/mock/minimalForwarder.go | 133 ------ chains/evm/calls/transactor/mock/transact.go | 51 --- .../transactor/monitored/monitored_test.go | 14 +- .../evm/calls/transactor/prepare/prepare.go | 34 -- .../calls/transactor/prepare/prepare_test.go | 60 --- .../transactor/signAndSend/signAndSend.go | 2 +- chains/evm/cli/account/account.go | 28 -- chains/evm/cli/account/flagVars.go | 33 -- chains/evm/cli/account/generate-key-pair.go | 27 -- chains/evm/cli/account/transfer.go | 109 ----- chains/evm/cli/account/transfer_test.go | 55 --- chains/evm/cli/admin/add-admin.go | 90 ---- chains/evm/cli/admin/add-relayer.go | 83 ---- chains/evm/cli/admin/admin.go | 38 -- chains/evm/cli/admin/admin_test.go | 423 ------------------ chains/evm/cli/admin/flagVars.go | 45 -- chains/evm/cli/admin/get-threshold.go | 80 ---- chains/evm/cli/admin/is-relayer.go | 92 ---- chains/evm/cli/admin/pause.go | 81 ---- chains/evm/cli/admin/remove-admin.go | 94 ---- chains/evm/cli/admin/remove-relayer.go | 89 ---- chains/evm/cli/admin/set-deposit-nonce.go | 84 ---- chains/evm/cli/admin/set-fee.go | 89 ---- chains/evm/cli/admin/set-threshold.go | 81 ---- chains/evm/cli/admin/unpause.go | 82 ---- chains/evm/cli/admin/withdraw.go | 120 ----- chains/evm/cli/bridge/bridge.go | 33 -- chains/evm/cli/bridge/bridge_test.go | 219 --------- chains/evm/cli/bridge/cancel-proposal.go | 95 ---- chains/evm/cli/bridge/flagVars.go | 47 -- chains/evm/cli/bridge/mock/vote-proposal.go | 66 --- chains/evm/cli/bridge/query-proposal.go | 94 ---- chains/evm/cli/bridge/query-resource.go | 86 ---- .../cli/bridge/register-generic-resource.go | 135 ------ chains/evm/cli/bridge/register-resource.go | 104 ----- chains/evm/cli/bridge/set-burn.go | 92 ---- chains/evm/cli/bridge/vote-proposal.go | 105 ----- chains/evm/cli/bridge/vote-proposal_test.go | 176 -------- chains/evm/cli/centrifuge/centrifuge.go | 28 -- chains/evm/cli/centrifuge/centrifuge_test.go | 55 --- chains/evm/cli/centrifuge/deploy.go | 54 --- chains/evm/cli/centrifuge/flagVars.go | 28 -- chains/evm/cli/centrifuge/get-hash.go | 90 ---- chains/evm/cli/cli.go | 94 ---- chains/evm/cli/deploy/deploy.go | 280 ------------ chains/evm/cli/erc20/add-minter.go | 83 ---- chains/evm/cli/erc20/approve.go | 108 ----- chains/evm/cli/erc20/balance.go | 86 ---- chains/evm/cli/erc20/deposit.go | 115 ----- chains/evm/cli/erc20/erc20.go | 32 -- chains/evm/cli/erc20/erc20_test.go | 223 --------- chains/evm/cli/erc20/flagVars.go | 47 -- chains/evm/cli/erc20/get-allowance.go | 117 ----- chains/evm/cli/erc20/mint.go | 104 ----- chains/evm/cli/erc721/add-minter.go | 88 ---- chains/evm/cli/erc721/approve.go | 94 ---- chains/evm/cli/erc721/deposit.go | 120 ----- chains/evm/cli/erc721/erc721.go | 31 -- chains/evm/cli/erc721/erc721_test.go | 183 -------- chains/evm/cli/erc721/flagVars.go | 45 -- chains/evm/cli/erc721/mint.go | 101 ----- chains/evm/cli/erc721/owner.go | 87 ---- chains/evm/cli/flags/utils.go | 91 ---- chains/evm/cli/initialize/initialize.go | 50 --- chains/evm/cli/local/deploy.go | 270 ----------- chains/evm/cli/local/local.go | 123 ----- chains/evm/cli/logger/logger.go | 47 -- chains/evm/cli/logger/logger_test.go | 53 --- chains/evm/cli/utils/flagVars.go | 19 - chains/evm/cli/utils/hash-list.go | 88 ---- chains/evm/cli/utils/simulate.go | 97 ---- chains/evm/cli/utils/utils.go | 25 -- chains/evm/cli/utils/utils_test.go | 77 ---- chains/evm/executor/mock/voter.go | 381 ---------------- chains/evm/executor/proposal/proposal.go | 43 -- chains/evm/executor/voter.go | 252 ----------- chains/evm/executor/voter_test.go | 155 ------- e2e/evm/evm_test.go | 37 +- e2e/evm/util.go | 48 +- example/cmd/cmd.go | 4 +- go.mod | 3 +- go.sum | 2 - keystore/decrypt.go | 95 ---- keystore/encrypt.go | 120 ----- keystore/encrypt_test.go | 151 ------- keystore/keystore.go | 66 --- relayer/message/message_processors.go | 53 --- relayer/message/message_processors_test.go | 42 -- relayer/relayer.go | 20 +- relayer/relayer_test.go | 23 - scripts/header.txt | 2 +- sender/secp256sender/sender.go | 19 - sender/sender.go | 10 - 132 files changed, 90 insertions(+), 10747 deletions(-) rename chains/evm/calls/{evmclient/evm-client.go => client/client.go} (91%) delete mode 100644 chains/evm/calls/consts/bridge.go delete mode 100644 chains/evm/calls/consts/centrifuge.go delete mode 100644 chains/evm/calls/consts/erc20Handler.go delete mode 100644 chains/evm/calls/consts/erc20PresetMinterPauser.go delete mode 100644 chains/evm/calls/consts/erc721Handler.go delete mode 100644 chains/evm/calls/consts/erc721PresetMinterPauser.go delete mode 100644 chains/evm/calls/consts/generic.go delete mode 100644 chains/evm/calls/consts/minimalForwarder.go delete mode 100644 chains/evm/calls/contracts/bridge/bridge.go delete mode 100644 chains/evm/calls/contracts/bridge/bridge_test.go delete mode 100644 chains/evm/calls/contracts/centrifuge/assetStore.go delete mode 100644 chains/evm/calls/contracts/centrifuge/assetStore_test.go delete mode 100644 chains/evm/calls/contracts/deposit/deposit.go delete mode 100644 chains/evm/calls/contracts/erc20/erc20.go delete mode 100644 chains/evm/calls/contracts/erc20/erc20Handler.go delete mode 100644 chains/evm/calls/contracts/erc20/erc20_test.go delete mode 100644 chains/evm/calls/contracts/erc721/erc721.go delete mode 100644 chains/evm/calls/contracts/erc721/erc721Handler.go delete mode 100644 chains/evm/calls/contracts/erc721/erc721_test.go delete mode 100644 chains/evm/calls/contracts/forwarder/forwarder.go delete mode 100644 chains/evm/calls/contracts/generic/genericHandler.go delete mode 100644 chains/evm/calls/events/listener.go delete mode 100644 chains/evm/calls/events/listener_test.go rename chains/evm/calls/{evmgaspricer => gas}/gas-pricer.go (100%) rename chains/evm/calls/{evmgaspricer => gas}/london.go (100%) rename chains/evm/calls/{evmgaspricer => gas}/london_test.go (100%) rename chains/evm/calls/{evmgaspricer => gas}/mock/gas-pricer.go (100%) rename chains/evm/calls/{evmgaspricer => gas}/static.go (100%) rename chains/evm/calls/{evmgaspricer => gas}/static_test.go (100%) rename chains/evm/calls/{evmtransaction => transaction}/evm-tx.go (100%) rename chains/evm/calls/{evmtransaction => transaction}/evm-tx_test.go (100%) delete mode 100644 chains/evm/calls/transactor/itx/itx.go delete mode 100644 chains/evm/calls/transactor/itx/itx_test.go delete mode 100644 chains/evm/calls/transactor/itx/minimalForwarder.go delete mode 100644 chains/evm/calls/transactor/itx/minimalForwarder_test.go delete mode 100644 chains/evm/calls/transactor/itx/mock/itx.go delete mode 100644 chains/evm/calls/transactor/itx/mock/minimalForwarder.go delete mode 100644 chains/evm/calls/transactor/mock/transact.go delete mode 100644 chains/evm/calls/transactor/prepare/prepare.go delete mode 100644 chains/evm/calls/transactor/prepare/prepare_test.go delete mode 100644 chains/evm/cli/account/account.go delete mode 100644 chains/evm/cli/account/flagVars.go delete mode 100644 chains/evm/cli/account/generate-key-pair.go delete mode 100644 chains/evm/cli/account/transfer.go delete mode 100644 chains/evm/cli/account/transfer_test.go delete mode 100644 chains/evm/cli/admin/add-admin.go delete mode 100644 chains/evm/cli/admin/add-relayer.go delete mode 100644 chains/evm/cli/admin/admin.go delete mode 100644 chains/evm/cli/admin/admin_test.go delete mode 100644 chains/evm/cli/admin/flagVars.go delete mode 100644 chains/evm/cli/admin/get-threshold.go delete mode 100644 chains/evm/cli/admin/is-relayer.go delete mode 100644 chains/evm/cli/admin/pause.go delete mode 100644 chains/evm/cli/admin/remove-admin.go delete mode 100644 chains/evm/cli/admin/remove-relayer.go delete mode 100644 chains/evm/cli/admin/set-deposit-nonce.go delete mode 100644 chains/evm/cli/admin/set-fee.go delete mode 100644 chains/evm/cli/admin/set-threshold.go delete mode 100644 chains/evm/cli/admin/unpause.go delete mode 100644 chains/evm/cli/admin/withdraw.go delete mode 100644 chains/evm/cli/bridge/bridge.go delete mode 100644 chains/evm/cli/bridge/bridge_test.go delete mode 100644 chains/evm/cli/bridge/cancel-proposal.go delete mode 100644 chains/evm/cli/bridge/flagVars.go delete mode 100644 chains/evm/cli/bridge/mock/vote-proposal.go delete mode 100644 chains/evm/cli/bridge/query-proposal.go delete mode 100644 chains/evm/cli/bridge/query-resource.go delete mode 100644 chains/evm/cli/bridge/register-generic-resource.go delete mode 100644 chains/evm/cli/bridge/register-resource.go delete mode 100644 chains/evm/cli/bridge/set-burn.go delete mode 100644 chains/evm/cli/bridge/vote-proposal.go delete mode 100644 chains/evm/cli/bridge/vote-proposal_test.go delete mode 100644 chains/evm/cli/centrifuge/centrifuge.go delete mode 100644 chains/evm/cli/centrifuge/centrifuge_test.go delete mode 100644 chains/evm/cli/centrifuge/deploy.go delete mode 100644 chains/evm/cli/centrifuge/flagVars.go delete mode 100644 chains/evm/cli/centrifuge/get-hash.go delete mode 100644 chains/evm/cli/cli.go delete mode 100644 chains/evm/cli/deploy/deploy.go delete mode 100644 chains/evm/cli/erc20/add-minter.go delete mode 100644 chains/evm/cli/erc20/approve.go delete mode 100644 chains/evm/cli/erc20/balance.go delete mode 100644 chains/evm/cli/erc20/deposit.go delete mode 100644 chains/evm/cli/erc20/erc20.go delete mode 100644 chains/evm/cli/erc20/erc20_test.go delete mode 100644 chains/evm/cli/erc20/flagVars.go delete mode 100644 chains/evm/cli/erc20/get-allowance.go delete mode 100644 chains/evm/cli/erc20/mint.go delete mode 100644 chains/evm/cli/erc721/add-minter.go delete mode 100644 chains/evm/cli/erc721/approve.go delete mode 100644 chains/evm/cli/erc721/deposit.go delete mode 100644 chains/evm/cli/erc721/erc721.go delete mode 100644 chains/evm/cli/erc721/erc721_test.go delete mode 100644 chains/evm/cli/erc721/flagVars.go delete mode 100644 chains/evm/cli/erc721/mint.go delete mode 100644 chains/evm/cli/erc721/owner.go delete mode 100644 chains/evm/cli/flags/utils.go delete mode 100644 chains/evm/cli/initialize/initialize.go delete mode 100644 chains/evm/cli/local/deploy.go delete mode 100644 chains/evm/cli/local/local.go delete mode 100644 chains/evm/cli/logger/logger.go delete mode 100644 chains/evm/cli/logger/logger_test.go delete mode 100644 chains/evm/cli/utils/flagVars.go delete mode 100644 chains/evm/cli/utils/hash-list.go delete mode 100644 chains/evm/cli/utils/simulate.go delete mode 100644 chains/evm/cli/utils/utils.go delete mode 100644 chains/evm/cli/utils/utils_test.go delete mode 100644 chains/evm/executor/mock/voter.go delete mode 100644 chains/evm/executor/proposal/proposal.go delete mode 100644 chains/evm/executor/voter.go delete mode 100644 chains/evm/executor/voter_test.go delete mode 100644 keystore/decrypt.go delete mode 100644 keystore/encrypt.go delete mode 100644 keystore/encrypt_test.go delete mode 100644 keystore/keystore.go delete mode 100644 relayer/message/message_processors.go delete mode 100644 relayer/message/message_processors_test.go delete mode 100644 sender/secp256sender/sender.go delete mode 100644 sender/sender.go diff --git a/chains/evm/calls/calls.go b/chains/evm/calls/calls.go index 4a037ac3..fcee556d 100644 --- a/chains/evm/calls/calls.go +++ b/chains/evm/calls/calls.go @@ -2,14 +2,11 @@ package calls import ( "context" - "encoding/hex" "math/big" "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" ) type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (evmclient.CommonTransaction, error) @@ -28,7 +25,7 @@ type GasPricer interface { } type ClientDispatcher interface { - WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) + TxReceipt(h common.Hash) (*types.Receipt, error) SignAndSendTransaction(ctx context.Context, tx evmclient.CommonTransaction) (common.Hash, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error) @@ -44,41 +41,3 @@ type ContractCallerDispatcher interface { ClientDispatcher ContractChecker } - -type SimulateCaller interface { - ContractCaller - TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error) -} - -// Simulate function gets transaction info by hash and then executes a message call transaction, which is directly executed in the VM -// of the node, but never mined into the blockchain. Execution happens against provided block. -func Simulate(c SimulateCaller, block *big.Int, txHash common.Hash, from common.Address) ([]byte, error) { - tx, _, err := c.TransactionByHash(context.TODO(), txHash) - if err != nil { - log.Debug().Msgf("[client] tx by hash error: %v", err) - return nil, err - } - - log.Debug().Msgf("from: %v to: %v gas: %v gasPrice: %v value: %v data: %v", from, tx.To(), tx.Gas(), tx.GasPrice(), tx.Value(), tx.Data()) - - msg := ethereum.CallMsg{ - From: from, - To: tx.To(), - Gas: tx.Gas(), - GasPrice: tx.GasPrice(), - Value: tx.Value(), - Data: tx.Data(), - } - res, err := c.CallContract(context.TODO(), ToCallArg(msg), block) - if err != nil { - log.Debug().Msgf("[client] call contract error: %v", err) - return nil, err - } - bs, err := hex.DecodeString(common.Bytes2Hex(res)) - if err != nil { - log.Debug().Msgf("[client] decode string error: %v", err) - return nil, err - } - log.Debug().Msg(string(bs)) - return bs, nil -} diff --git a/chains/evm/calls/evmclient/evm-client.go b/chains/evm/calls/client/client.go similarity index 91% rename from chains/evm/calls/evmclient/evm-client.go rename to chains/evm/calls/client/client.go index 08435d8d..920eba16 100644 --- a/chains/evm/calls/evmclient/evm-client.go +++ b/chains/evm/calls/client/client.go @@ -58,10 +58,6 @@ func NewEVMClient(url string, signer Signer) (*EVMClient, error) { return c, nil } -func (c *EVMClient) SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error) { - return c.gethClient.SubscribePendingTransactions(ctx, ch) -} - // LatestBlock returns the latest block from the current chain func (c *EVMClient) LatestBlock() (*big.Int, error) { var head *headerNumber @@ -94,23 +90,6 @@ func (h *headerNumber) UnmarshalJSON(input []byte) error { return nil } -func (c *EVMClient) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { - retry := 50 - for retry > 0 { - receipt, err := c.Client.TransactionReceipt(context.Background(), h) - if err != nil { - retry-- - time.Sleep(5 * time.Second) - continue - } - if receipt.Status != 1 { - return receipt, fmt.Errorf("transaction failed on chain. Receipt status %v", receipt.Status) - } - return receipt, nil - } - return nil, errors.New("tx did not appear") -} - func (c *EVMClient) GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error) { return c.Client.TransactionByHash(context.Background(), h) } @@ -154,15 +133,6 @@ func (c *EVMClient) CallContext(ctx context.Context, target interface{}, rpcMeth return nil } -func (c *EVMClient) PendingCallContract(ctx context.Context, callArgs map[string]interface{}) ([]byte, error) { - var hex hexutil.Bytes - err := c.rpClient.CallContext(ctx, &hex, "eth_call", callArgs, "pending") - if err != nil { - return nil, err - } - return hex, nil -} - func (c *EVMClient) From() common.Address { return c.signer.CommonAddress() } @@ -185,8 +155,21 @@ func (c *EVMClient) SignAndSendTransaction(ctx context.Context, tx CommonTransac return tx.Hash(), nil } -func (c *EVMClient) RelayerAddress() common.Address { - return c.signer.CommonAddress() +func (c *EVMClient) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { + retry := 50 + for retry > 0 { + receipt, err := c.Client.TransactionReceipt(context.Background(), h) + if err != nil { + retry-- + time.Sleep(5 * time.Second) + continue + } + if receipt.Status != 1 { + return receipt, fmt.Errorf("transaction failed on chain. Receipt status %v", receipt.Status) + } + return receipt, nil + } + return nil, errors.New("tx did not appear") } func (c *EVMClient) LockNonce() { diff --git a/chains/evm/calls/consts/bridge.go b/chains/evm/calls/consts/bridge.go deleted file mode 100644 index 93c7bf8a..00000000 --- a/chains/evm/calls/consts/bridge.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const BridgeABI = `[{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"address[]","name":"initialRelayers","type":"address[]"},{"internalType":"uint256","name":"initialRelayerThreshold","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"handlerResponse","type":"bytes"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"lowLevelData","type":"bytes"}],"name":"FailedHandlerExecution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"RelayerThresholdChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RELAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_depositCounts","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_domainID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_expiry","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_relayerThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToHandlerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"getRoleMemberIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isValidForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint72","name":"destNonce","type":"uint72"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"_hasVotedOnProposal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"renounceAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminPauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminUnpauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"adminChangeRelayerThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminAddRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminRemoveRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"depositFunctionSig","type":"bytes4"},{"internalType":"uint256","name":"depositFunctionDepositerOffset","type":"uint256"},{"internalType":"bytes4","name":"executeFunctionSig","type":"bytes4"}],"name":"adminSetGenericResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"adminSetDepositNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"bool","name":"valid","type":"bool"}],"name":"adminSetForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"originDomainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"getProposal","outputs":[{"components":[{"internalType":"enum Bridge.ProposalStatus","name":"_status","type":"uint8"},{"internalType":"uint200","name":"_yesVotes","type":"uint200"},{"internalType":"uint8","name":"_yesVotesTotal","type":"uint8"},{"internalType":"uint40","name":"_proposedBlock","type":"uint40"}],"internalType":"struct Bridge.Proposal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalRelayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"adminChangeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"voteProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"cancelProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bool","name":"revertOnFail","type":"bool"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"addrs","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const BridgeBin = "0x60806040523480156200001157600080fd5b5060405162003622380380620036228339810160408190526200003491620004db565b6000805460ff199081169091556002805490911660ff871617905562000066836200018a602090811b62001ef917901c565b600260016101000a81548160ff021916908360ff1602179055506200009682620001e760201b62001f501760201c565b6002806101000a8154816001600160801b0302191690836001600160801b03160217905550620000d1816200023e60201b62001fa51760201c565b6002805464ffffffffff92909216600160901b0264ffffffffff60901b199092169190911790556200010e60006200010862000297565b620002da565b60005b84518110156200017e57620001697fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4868381518110620001555762000155620005e4565b6020026020010151620002ea60201b60201c565b806200017581620005fa565b91505062000111565b50505050505062000624565b60006101008210620001e35760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e203820626974730000000060448201526064015b60405180910390fd5b5090565b6000600160801b8210620001e35760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401620001da565b6000650100000000008210620001e35760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401620001da565b60003360143610801590620002c457506001600160a01b03811660009081526005602052604090205460ff165b15620002d5575060131936013560601c5b919050565b620002e6828262000377565b5050565b60008281526001602052604090206002015462000311906200030b62000297565b620003f2565b620002da5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401620001da565b60008281526001602090815260409091206200039e91839062001ffc62000421821b17901c565b15620002e657620003ae62000297565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526001602090815260408220620004189184906200201162000438821b17901c565b90505b92915050565b600062000418836001600160a01b0384166200045b565b6001600160a01b0381166000908152600183016020526040812054151562000418565b6000818152600183016020526040812054620004a4575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200041b565b5060006200041b565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002d557600080fd5b600080600080600060a08688031215620004f457600080fd5b855160ff811681146200050657600080fd5b602087810151919650906001600160401b03808211156200052657600080fd5b818901915089601f8301126200053b57600080fd5b815181811115620005505762000550620004ad565b8060051b604051601f19603f83011681018181108582111715620005785762000578620004ad565b60405291825284820192508381018501918c8311156200059757600080fd5b938501935b82851015620005c057620005b085620004c3565b845293850193928501926200059c565b60408c015160608d01516080909d01519b9e919d509b9a9950975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200061d57634e487b7160e01b600052601160045260246000fd5b5060010190565b612fee80620006346000396000f3fe6080604052600436106102465760003560e01c806391c404ac11610139578063c5b37c22116100b6578063d15ef64e1161007a578063d15ef64e1461074f578063d547741f1461076f578063d7a9cd791461078f578063edc20c3c146107ae578063f8c39e44146107ce578063ffaac0eb146107fe57600080fd5b8063c5b37c2214610676578063c5ec8970146106b4578063ca15c873146106ef578063cb10f2151461070f578063cdb0f73a1461072f57600080fd5b80639debb3bd116100fd5780639debb3bd146105df578063a217fddf146105f4578063a9cf69fa14610609578063bd2a182014610636578063c0331b3e1461065657600080fd5b806391c404ac1461053157806391d1485414610551578063926d7d7f146105715780639d82dd63146105935780639dd694f4146105b357600080fd5b8063541d5548116101c7578063802aabe81161018b578063802aabe81461047957806380ae1c281461048e57806384db809f146104a35780638c0c2631146104f15780639010d07c1461051157600080fd5b8063541d5548146103d15780635a1ad87c146104015780635c975abb146104215780635e1fab0f146104395780637febe63f1461045957600080fd5b806336568abe1161020e57806336568abe146103035780634603ae38146103235780634b0b919d146103435780634e056005146103915780634e0df3f6146103b157600080fd5b806305e2ca171461024b57806317f03ce514610260578063206a98fd14610280578063248a9ca3146102a05780632f2ff15d146102e3575b600080fd5b61025e6102593660046126c3565b610813565b005b34801561026c57600080fd5b5061025e61027b366004612733565b610a0e565b34801561028c57600080fd5b5061025e61029b36600461277f565b610ca1565b3480156102ac57600080fd5b506102d06102bb3660046127fb565b60009081526001602052604090206002015490565b6040519081526020015b60405180910390f35b3480156102ef57600080fd5b5061025e6102fe366004612829565b610f29565b34801561030f57600080fd5b5061025e61031e366004612829565b610fb9565b34801561032f57600080fd5b5061025e61033e36600461289d565b611043565b34801561034f57600080fd5b5061037961035e3660046128fc565b6003602052600090815260409020546001600160401b031681565b6040516001600160401b0390911681526020016102da565b34801561039d57600080fd5b5061025e6103ac3660046127fb565b6110e7565b3480156103bd57600080fd5b506102d06103cc366004612829565b61114a565b3480156103dd57600080fd5b506103f16103ec366004612917565b611176565b60405190151581526020016102da565b34801561040d57600080fd5b5061025e61041c36600461294c565b611190565b34801561042d57600080fd5b5060005460ff166103f1565b34801561044557600080fd5b5061025e610454366004612917565b611246565b34801561046557600080fd5b506103f16104743660046129aa565b6112d2565b34801561048557600080fd5b506102d0611378565b34801561049a57600080fd5b5061025e611396565b3480156104af57600080fd5b506104d96104be3660046127fb565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b3480156104fd57600080fd5b5061025e61050c3660046129fa565b6113b0565b34801561051d57600080fd5b506104d961052c366004612a28565b61141c565b34801561053d57600080fd5b5061025e61054c3660046127fb565b61143b565b34801561055d57600080fd5b506103f161056c366004612829565b6114d5565b34801561057d57600080fd5b506102d0600080516020612f9983398151915281565b34801561059f57600080fd5b5061025e6105ae366004612917565b6114ed565b3480156105bf57600080fd5b506002546105cd9060ff1681565b60405160ff90911681526020016102da565b3480156105eb57600080fd5b506102d060c881565b34801561060057600080fd5b506102d0600081565b34801561061557600080fd5b50610629610624366004612733565b6115a2565b6040516102da9190612a82565b34801561064257600080fd5b5061025e610651366004612b38565b611670565b34801561066257600080fd5b5061025e610671366004612bca565b6116a6565b34801561068257600080fd5b5060025461069c906201000090046001600160801b031681565b6040516001600160801b0390911681526020016102da565b3480156106c057600080fd5b506002546106d990600160901b900464ffffffffff1681565b60405164ffffffffff90911681526020016102da565b3480156106fb57600080fd5b506102d061070a3660046127fb565b611bc1565b34801561071b57600080fd5b5061025e61072a366004612c38565b611bd8565b34801561073b57600080fd5b5061025e61074a366004612917565b611c6c565b34801561075b57600080fd5b5061025e61076a366004612c58565b611d72565b34801561077b57600080fd5b5061025e61078a366004612829565b611da5565b34801561079b57600080fd5b506002546105cd90610100900460ff1681565b3480156107ba57600080fd5b5061025e6107c9366004612c8d565b611e28565b3480156107da57600080fd5b506103f16107e9366004612917565b60056020526000908152604090205460ff1681565b34801561080a57600080fd5b5061025e611ee1565b61081b612033565b6002546201000090046001600160801b031634146108795760405162461bcd60e51b8152602060048201526016602482015275125b98dbdc9c9958dd08199959481cdd5c1c1b1a595960521b60448201526064015b60405180910390fd5b6000838152600460205260409020546001600160a01b0316806108de5760405162461bcd60e51b815260206004820181905260248201527f7265736f757263654944206e6f74206d617070656420746f2068616e646c65726044820152606401610870565b60ff8516600090815260036020526040812080548290610906906001600160401b0316612ccd565b91906101000a8154816001600160401b0302191690836001600160401b03160217905590506000610935612079565b60405163b07e54bb60e01b815290915083906000906001600160a01b0383169063b07e54bb9061096f908b9087908c908c90600401612d1d565b6000604051808303816000875af115801561098e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109b69190810190612d82565b9050826001600160a01b03167f17bc3181e17a9620a479c24e6c606e474ba84fc036877b768926872e8cd0e11f8a8a878b8b876040516109fb96959493929190612e1b565b60405180910390a2505050505050505050565b610a166120ba565b60ff838116600884901b68ffffffffffffffff0016176000818152600660209081526040808320868452909152808220815160808101909252805493949293919290918391166004811115610a6d57610a6d612a4a565b6004811115610a7e57610a7e612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015280519091506001816004811115610ad157610ad1612a4a565b1480610aee57506002816004811115610aec57610aec612a4a565b145b610b3a5760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2063616e6e6f742062652063616e63656c6c6564000000006044820152606401610870565b600254606083015164ffffffffff600160901b909204821691610b5f9143911661213e565b64ffffffffff1611610bb35760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206e6f7420617420657870697279207468726573686f6c646044820152606401610870565b600480835268ffffffffffffffffff841660009081526006602090815260408083208884529091529020835181548593839160ff1916906001908490811115610bfe57610bfe612a4a565b02179055506020820151815460408085015160609095015164ffffffffff16600160d81b026001600160d81b0360ff909616600160d01b0260ff60d01b196001600160c81b039095166101000294909416610100600160d81b031990931692909217929092179390931692909217905551600080516020612f7983398151915290610c9190889088906004908990612e6c565b60405180910390a1505050505050565b610ca9612180565b610cb1612033565b60008281526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff0060088a901b1660ff8b1617929091610cf99185918a918a9101612ea1565b60408051601f19818403018152918152815160209283012068ffffffffffffffffff851660009081526006845282812082825290935291209091506002815460ff166004811115610d4c57610d4c612a4a565b14610d995760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206d757374206861766520506173736564207374617475736044820152606401610870565b805460ff19166003178155838515610e125760405163712467f960e11b81526001600160a01b0382169063e248cff290610ddb908a908d908d90600401612ecd565b600060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b50505050610eef565b60405163712467f960e11b81526001600160a01b0382169063e248cff290610e42908a908d908d90600401612ecd565b600060405180830381600087803b158015610e5c57600080fd5b505af1925050508015610e6d575060015b610eef573d808015610e9b576040519150601f19603f3d011682016040523d82523d6000602084013e610ea0565b606091505b50825460ff191660021783556040517fbd37c1f0d53bb2f33fe4c2104de272fcdeb4d2fef3acdbf1e4ddc3d6833ca37690610edc908390612ee7565b60405180910390a1505050505050610f21565b600080516020612f798339815191528b8b600386604051610f139493929190612e6c565b60405180910390a150505050505b505050505050565b600082815260016020526040902060020154610f479061056c612079565b610fab5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401610870565b610fb582826121e6565b5050565b610fc1612079565b6001600160a01b0316816001600160a01b0316146110395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610870565b610fb5828261224f565b61104b6122b8565b60005b838110156110e05784848281811061106857611068612efa565b905060200201602081019061107d9190612917565b6001600160a01b03166108fc84848481811061109b5761109b612efa565b905060200201359081150290604051600060405180830381858888f193505050501580156110cd573d6000803e3d6000fd5b50806110d881612f10565b91505061104e565b5050505050565b6110ef6122b8565b6110f881611ef9565b6002805460ff929092166101000261ff00199092169190911790556040518181527fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c8906020015b60405180910390a150565b60008281526001602081815260408084206001600160a01b038616855290920190529020545b92915050565b6000611170600080516020612f99833981519152836114d5565b6111986122b8565b60008581526004602081905260409182902080546001600160a01b0319166001600160a01b038a8116918217909255925163de319d9960e01b8152918201889052861660248201526001600160e01b03198086166044830152606482018590528316608482015287919063de319d999060a401600060405180830381600087803b15801561122557600080fd5b505af1158015611239573d6000803e3d6000fd5b5050505050505050505050565b61124e6122b8565b6000611258612079565b9050816001600160a01b0316816001600160a01b031614156112bc5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656e6f756e6365206f6e6573656c660000000000000000006044820152606401610870565b6112c7600083610f29565b610fb5600082610fb9565b68ffffffffffffffffff831660009081526006602090815260408083208584529091528082208151608081019092528054611370929190829060ff16600481111561131f5761131f612a4a565b600481111561133057611330612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015283612311565b949350505050565b6000611391600080516020612f99833981519152611bc1565b905090565b61139e6122b8565b6113ae6113a9612079565b612334565b565b6113b86122b8565b6040516307b7ed9960e01b81526001600160a01b0382811660048301528391908216906307b7ed99906024015b600060405180830381600087803b1580156113ff57600080fd5b505af1158015611413573d6000803e3d6000fd5b50505050505050565b60008281526001602052604081206114349083612382565b9392505050565b6114436122b8565b6002546201000090046001600160801b03168114156114a45760405162461bcd60e51b815260206004820152601f60248201527f43757272656e742066656520697320657175616c20746f206e657720666565006044820152606401610870565b6114ad81611f50565b6002806101000a8154816001600160801b0302191690836001600160801b0316021790555050565b60008281526001602052604081206114349083612011565b611505600080516020612f99833981519152826114d5565b6115515760405162461bcd60e51b815260206004820152601f60248201527f6164647220646f65736e277420686176652072656c6179657220726f6c6521006044820152606401610870565b611569600080516020612f9983398151915282611da5565b6040516001600160a01b03821681527f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b9060200161113f565b60408051608081018252600080825260208201819052918101829052606081019190915260ff848116600885901b68ffffffffffffffff0016176000818152600660209081526040808320878452909152908190208151608081019092528054929391929091839116600481111561161c5761161c612a4a565b600481111561162d5761162d612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015295945050505050565b6116786122b8565b60405163025a3c9960e21b815282906001600160a01b03821690630968f264906113e5908590600401612ee7565b6116ae612180565b6116b6612033565b60008381526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff00600889901b1660ff8a16179290916116fe9185918891889101612ea1565b60408051601f19818403018152828252805160209182012068ffffffffffffffffff861660009081526006835283812082825290925282822060808501909352825490945090929190829060ff16600481111561175d5761175d612a4a565b600481111561176e5761176e612a4a565b8152905461010081046001600160c81b0316602080840191909152600160d01b820460ff16604080850191909152600160d81b90920464ffffffffff1660609093019290925260008a815260049092529020549091506001600160a01b03166118195760405162461bcd60e51b815260206004820152601960248201527f6e6f2068616e646c657220666f72207265736f757263654944000000000000006044820152606401610870565b60028151600481111561182e5761182e612a4a565b141561184c57611843898988888b6001610ca1565b505050506110e0565b6000611856612079565b905060018260000151600481111561187057611870612a4a565b11156118ca5760405162461bcd60e51b815260206004820152602360248201527f70726f706f73616c20616c72656164792065786563757465642f63616e63656c6044820152621b195960ea1b6064820152608401610870565b6118d48282612311565b156119195760405162461bcd60e51b81526020600482015260156024820152741c995b185e595c88185b1c9958591e481d9bdd1959605a1b6044820152606401610870565b60008251600481111561192e5761192e612a4a565b141561198e576040805160808101825260018082526000602083018190528284015264ffffffffff431660608301529151909350600080516020612f7983398151915291611981918d918d918890612e6c565b60405180910390a16119f0565b600254606083015164ffffffffff600160901b9092048216916119b39143911661213e565b64ffffffffff1611156119f0576004808352604051600080516020612f79833981519152916119e7918d918d918890612e6c565b60405180910390a15b600482516004811115611a0557611a05612a4a565b14611ad557611a2a611a168261238e565b83602001516001600160c81b0316176123bc565b6001600160c81b0316602083015260408201805190611a4882612f2b565b60ff1690525081516040517f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b957434364091611a84918d918d918890612e6c565b60405180910390a1600254604083015160ff6101009092048216911610611ad5576002808352604051600080516020612f7983398151915291611acc918d918d918890612e6c565b60405180910390a15b68ffffffffffffffffff8416600090815260066020908152604080832086845290915290208251815484929190829060ff19166001836004811115611b1c57611b1c612a4a565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b0319909216919091179190911792909216919091179055600282516004811115611ba057611ba0612a4a565b1415611bb557611bb58a8a89898c6000610ca1565b50505050505050505050565b600081815260016020526040812061117090612411565b611be06122b8565b60008281526004602081905260409182902080546001600160a01b0319166001600160a01b038781169182179092559251635c7d1b9b60e11b81529182018590528316602482015284919063b8fa373690604401600060405180830381600087803b158015611c4e57600080fd5b505af1158015611c62573d6000803e3d6000fd5b5050505050505050565b611c84600080516020612f99833981519152826114d5565b15611cd15760405162461bcd60e51b815260206004820152601e60248201527f6164647220616c7265616479206861732072656c6179657220726f6c652100006044820152606401610870565b60c8611cdb611378565b10611d215760405162461bcd60e51b81526020600482015260166024820152751c995b185e595c9cc81b1a5b5a5d081c995858da195960521b6044820152606401610870565b611d39600080516020612f9983398151915282610f29565b6040516001600160a01b03821681527f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c59060200161113f565b611d7a6122b8565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600082815260016020526040902060020154611dc39061056c612079565b6110395760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b6064820152608401610870565b611e306122b8565b60ff82166000908152600360205260409020546001600160401b0390811690821611611ead5760405162461bcd60e51b815260206004820152602660248201527f446f6573206e6f7420616c6c6f772064656372656d656e7473206f6620746865604482015265206e6f6e636560d01b6064820152608401610870565b60ff919091166000908152600360205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b611ee96122b8565b6113ae611ef4612079565b61241b565b60006101008210611f4c5760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e20382062697473000000006044820152606401610870565b5090565b6000600160801b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401610870565b6000650100000000008210611f4c5760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401610870565b6000611434836001600160a01b038416612466565b6001600160a01b03811660009081526001830160205260408120541515611434565b60005460ff16156113ae5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610870565b600033601436108015906120a557506001600160a01b03811660009081526005602052604090205460ff165b156120b5575060131936013560601c5b919050565b60006120c4612079565b90506120d16000826114d5565b806120ef57506120ef600080516020612f99833981519152826114d5565b61213b5760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206973206e6f742072656c61796572206f722061646d696e00006044820152606401610870565b50565b600061143483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124b5565b61219a600080516020612f9983398151915261056c612079565b6113ae5760405162461bcd60e51b815260206004820181905260248201527f73656e64657220646f65736e277420686176652072656c6179657220726f6c656044820152606401610870565b60008281526001602052604090206121fe9082611ffc565b15610fb55761220b612079565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260016020526040902061226790826124ef565b15610fb557612274612079565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6122c5600061056c612079565b6113ae5760405162461bcd60e51b815260206004820152601e60248201527f73656e64657220646f65736e277420686176652061646d696e20726f6c6500006044820152606401610870565b60008083602001516001600160c81b031661232b8461238e565b16119392505050565b61233c612033565b6000805460ff191660011790556040516001600160a01b03821681527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200161113f565b60006114348383612504565b60006123b26123ab600080516020612f998339815191528461114a565b600161213e565b6001901b92915050565b6000600160c81b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20323030206269747300006044820152606401610870565b6000611170825490565b61242361252e565b6000805460ff191690556040516001600160a01b03821681527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200161113f565b60008181526001830160205260408120546124ad57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611170565b506000611170565b600081848411156124d95760405162461bcd60e51b81526004016108709190612ee7565b5060006124e68486612f4b565b95945050505050565b6000611434836001600160a01b038416612577565b600082600001828154811061251b5761251b612efa565b9060005260206000200154905092915050565b60005460ff166113ae5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610870565b6000818152600183016020526040812054801561266057600061259b600183612f4b565b85549091506000906125af90600190612f4b565b90508181146126145760008660000182815481106125cf576125cf612efa565b90600052602060002001549050808760000184815481106125f2576125f2612efa565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061262557612625612f62565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611170565b6000915050611170565b803560ff811681146120b557600080fd5b60008083601f84011261268d57600080fd5b5081356001600160401b038111156126a457600080fd5b6020830191508360208285010111156126bc57600080fd5b9250929050565b600080600080606085870312156126d957600080fd5b6126e28561266a565b93506020850135925060408501356001600160401b0381111561270457600080fd5b6127108782880161267b565b95989497509550505050565b80356001600160401b03811681146120b557600080fd5b60008060006060848603121561274857600080fd5b6127518461266a565b925061275f6020850161271c565b9150604084013590509250925092565b803580151581146120b557600080fd5b60008060008060008060a0878903121561279857600080fd5b6127a18761266a565b95506127af6020880161271c565b945060408701356001600160401b038111156127ca57600080fd5b6127d689828a0161267b565b909550935050606087013591506127ef6080880161276f565b90509295509295509295565b60006020828403121561280d57600080fd5b5035919050565b6001600160a01b038116811461213b57600080fd5b6000806040838503121561283c57600080fd5b82359150602083013561284e81612814565b809150509250929050565b60008083601f84011261286b57600080fd5b5081356001600160401b0381111561288257600080fd5b6020830191508360208260051b85010111156126bc57600080fd5b600080600080604085870312156128b357600080fd5b84356001600160401b03808211156128ca57600080fd5b6128d688838901612859565b909650945060208701359150808211156128ef57600080fd5b5061271087828801612859565b60006020828403121561290e57600080fd5b6114348261266a565b60006020828403121561292957600080fd5b813561143481612814565b80356001600160e01b0319811681146120b557600080fd5b60008060008060008060c0878903121561296557600080fd5b863561297081612814565b955060208701359450604087013561298781612814565b935061299560608801612934565b9250608087013591506127ef60a08801612934565b6000806000606084860312156129bf57600080fd5b833568ffffffffffffffffff811681146129d857600080fd5b92506020840135915060408401356129ef81612814565b809150509250925092565b60008060408385031215612a0d57600080fd5b8235612a1881612814565b9150602083013561284e81612814565b60008060408385031215612a3b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60058110612a7e57634e487b7160e01b600052602160045260246000fd5b9052565b6000608082019050612a95828451612a60565b60018060c81b03602084015116602083015260ff604084015116604083015264ffffffffff606084015116606083015292915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612b0957612b09612acb565b604052919050565b60006001600160401b03821115612b2a57612b2a612acb565b50601f01601f191660200190565b60008060408385031215612b4b57600080fd5b8235612b5681612814565b915060208301356001600160401b03811115612b7157600080fd5b8301601f81018513612b8257600080fd5b8035612b95612b9082612b11565b612ae1565b818152866020838501011115612baa57600080fd5b816020840160208301376000602083830101528093505050509250929050565b600080600080600060808688031215612be257600080fd5b612beb8661266a565b9450612bf96020870161271c565b93506040860135925060608601356001600160401b03811115612c1b57600080fd5b612c278882890161267b565b969995985093965092949392505050565b600080600060608486031215612c4d57600080fd5b83356129d881612814565b60008060408385031215612c6b57600080fd5b8235612c7681612814565b9150612c846020840161276f565b90509250929050565b60008060408385031215612ca057600080fd5b612ca98361266a565b9150612c846020840161271c565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b0380831681811415612cea57612cea612cb7565b6001019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160a01b0384166020820152606060408201819052600090612d489083018486612cf4565b9695505050505050565b60005b83811015612d6d578181015183820152602001612d55565b83811115612d7c576000848401525b50505050565b600060208284031215612d9457600080fd5b81516001600160401b03811115612daa57600080fd5b8201601f81018413612dbb57600080fd5b8051612dc9612b9082612b11565b818152856020838501011115612dde57600080fd5b6124e6826020830160208601612d52565b60008151808452612e07816020860160208601612d52565b601f01601f19169290920160200192915050565b60ff871681528560208201526001600160401b038516604082015260a060608201526000612e4d60a083018587612cf4565b8281036080840152612e5f8185612def565b9998505050505050505050565b60ff851681526001600160401b038416602082015260808101612e926040830185612a60565b82606083015295945050505050565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b8381526040602082015260006124e6604083018486612cf4565b6020815260006114346020830184612def565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612f2457612f24612cb7565b5060010190565b600060ff821660ff811415612f4257612f42612cb7565b60010192915050565b600082821015612f5d57612f5d612cb7565b500390565b634e487b7160e01b600052603160045260246000fdfe968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d5e2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4a2646970667358221220b709f2194f4c148f513f57a45e4ba5a064bdbf9c8e2385faecd3a9e498f2bc3164736f6c634300080b0033" diff --git a/chains/evm/calls/consts/centrifuge.go b/chains/evm/calls/consts/centrifuge.go deleted file mode 100644 index 05eaaf42..00000000 --- a/chains/evm/calls/consts/centrifuge.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const CentrifugeAssetStoreABI = `[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"asset","type":"bytes32"}],"name":"AssetStored","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_assetsStored","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"asset","type":"bytes32"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const CentrifugeAssetStoreBin = "0x608060405234801561001057600080fd5b5061017c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063654cf88c1461003b57806396add60014610050575b600080fd5b61004e61004936600461012d565b610087565b005b61007361005e36600461012d565b60006020819052908152604090205460ff1681565b604051901515815260200160405180910390f35b60008181526020819052604090205460ff16156100ea5760405162461bcd60e51b815260206004820152601760248201527f617373657420697320616c72656164792073746f726564000000000000000000604482015260640160405180910390fd5b600081815260208190526040808220805460ff191660011790555182917f08ae553713effae7116be03743b167b8b803449ee8fb912c2ec43dc2c824f53591a250565b60006020828403121561013f57600080fd5b503591905056fea26469706673582212209c9d6578770cabe853461fb518f0de90a3d20c6312f7b412a9005d3860abce0764736f6c634300080b0033" diff --git a/chains/evm/calls/consts/erc20Handler.go b/chains/evm/calls/consts/erc20Handler.go deleted file mode 100644 index 5f064dd7..00000000 --- a/chains/evm/calls/consts/erc20Handler.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const ERC20HandlerABI = `[{"inputs":[{"internalType":"address","name":"bridgeAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"_bridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_burnList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToTokenContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_tokenContractAddressToResourceID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"depositer","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const ERC20HandlerBin = "0x60a060405234801561001057600080fd5b50604051610cb6380380610cb683398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610c246100926000396000818161011601526104670152610c246000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80637f79bea8116100665780637f79bea81461016b578063b07e54bb1461018e578063b8fa3736146101ae578063c8ba6c87146101c1578063e248cff2146101ef57600080fd5b806307b7ed99146100a35780630968f264146100b85780630a6d55d8146100cb578063318c136e146101115780636a70d08114610138575b600080fd5b6100b66100b136600461082f565b610202565b005b6100b66100c6366004610869565b610216565b6100f46100d936600461091a565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f47f000000000000000000000000000000000000000000000000000000000000000081565b61015b61014636600461082f565b60036020526000908152604090205460ff1681565b6040519015158152602001610108565b61015b61017936600461082f565b60026020526000908152604090205460ff1681565b6101a161019c36600461097c565b61024f565b6040516101089190610a04565b6100b66101bc366004610a37565b6102ff565b6101e16101cf36600461082f565b60016020526000908152604090205481565b604051908152602001610108565b6100b66101fd366004610a67565b610354565b61020a61045c565b610213816104d6565b50565b61021e61045c565b6000806000838060200190518101906102379190610ab3565b9194509250905061024983838361056e565b50505050565b606061025961045c565b60006102678385018561091a565b600087815260208181526040808320546001600160a01b03168084526002909252909120549192509060ff166102b85760405162461bcd60e51b81526004016102af90610af6565b60405180910390fd5b6001600160a01b03811660009081526003602052604090205460ff16156102e9576102e481878461057a565b6102f5565b6102f5818730856105dc565b5050949350505050565b61030761045c565b60008281526020818152604080832080546001600160a01b0319166001600160a01b039590951694851790559282526001808252838320949094556002905220805460ff19169091179055565b61035c61045c565b600080606061036d84860186610b3e565b9093509150846040856103808583610b60565b9261038d93929190610b86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508a81526020818152604080832054828801516001600160a01b039091168085526002909352922054959650909490935060ff16915061041090505760405162461bcd60e51b81526004016102af90610af6565b6001600160a01b03811660009081526003602052604090205460ff16156104445761043f818360601c876105f0565b610452565b610452818360601c8761056e565b5050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104d45760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206d7573742062652062726964676520636f6e7472616374000060448201526064016102af565b565b6001600160a01b03811660009081526002602052604090205460ff1661054a5760405162461bcd60e51b8152602060048201526024808201527f70726f766964656420636f6e7472616374206973206e6f742077686974656c696044820152631cdd195960e21b60648201526084016102af565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b82610249818484610628565b60405163079cc67960e41b81526001600160a01b038381166004830152602482018390528491908216906379cc6790906044015b600060405180830381600087803b1580156105c857600080fd5b505af1158015610452573d6000803e3d6000fd5b836105e981858585610690565b5050505050565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018390528491908216906340c10f19906044016105ae565b6040516001600160a01b03831660248201526044810182905261068b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526106c8565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526102499085906323b872dd60e01b90608401610654565b813b8061070f5760405162461bcd60e51b8152602060048201526015602482015274115490cc8c0e881b9bdd08184818dbdb9d1c9858dd605a1b60448201526064016102af565b600080846001600160a01b03168460405161072a9190610bb0565b6000604051808303816000865af19150503d8060008114610767576040519150601f19603f3d011682016040523d82523d6000602084013e61076c565b606091505b5091509150816107b35760405162461bcd60e51b8152602060048201526012602482015271115490cc8c0e8818d85b1b0819985a5b195960721b60448201526064016102af565b8051156105e957808060200190518101906107ce9190610bcc565b6105e95760405162461bcd60e51b815260206004820181905260248201527f45524332303a206f7065726174696f6e20646964206e6f74207375636365656460448201526064016102af565b6001600160a01b038116811461021357600080fd5b60006020828403121561084157600080fd5b813561084c8161081a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561087b57600080fd5b813567ffffffffffffffff8082111561089357600080fd5b818401915084601f8301126108a757600080fd5b8135818111156108b9576108b9610853565b604051601f8201601f19908116603f011681019083821181831017156108e1576108e1610853565b816040528281528760208487010111156108fa57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60006020828403121561092c57600080fd5b5035919050565b60008083601f84011261094557600080fd5b50813567ffffffffffffffff81111561095d57600080fd5b60208301915083602082850101111561097557600080fd5b9250929050565b6000806000806060858703121561099257600080fd5b8435935060208501356109a48161081a565b9250604085013567ffffffffffffffff8111156109c057600080fd5b6109cc87828801610933565b95989497509550505050565b60005b838110156109f35781810151838201526020016109db565b838111156102495750506000910152565b6020815260008251806020840152610a238160408501602087016109d8565b601f01601f19169190910160400192915050565b60008060408385031215610a4a57600080fd5b823591506020830135610a5c8161081a565b809150509250929050565b600080600060408486031215610a7c57600080fd5b83359250602084013567ffffffffffffffff811115610a9a57600080fd5b610aa686828701610933565b9497909650939450505050565b600080600060608486031215610ac857600080fd5b8351610ad38161081a565b6020850151909350610ae48161081a565b80925050604084015190509250925092565b60208082526028908201527f70726f766964656420746f6b656e41646472657373206973206e6f74207768696040820152671d195b1a5cdd195960c21b606082015260800190565b60008060408385031215610b5157600080fd5b50508035926020909101359150565b60008219821115610b8157634e487b7160e01b600052601160045260246000fd5b500190565b60008085851115610b9657600080fd5b83861115610ba357600080fd5b5050820193919092039150565b60008251610bc28184602087016109d8565b9190910192915050565b600060208284031215610bde57600080fd5b8151801515811461084c57600080fdfea2646970667358221220fc9db7b9b0e755940cc336d885a45dac2acdd25d8d97cac2c03237eb505ad99f64736f6c634300080b0033" diff --git a/chains/evm/calls/consts/erc20PresetMinterPauser.go b/chains/evm/calls/consts/erc20PresetMinterPauser.go deleted file mode 100644 index 047bf850..00000000 --- a/chains/evm/calls/consts/erc20PresetMinterPauser.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const ERC20PresetMinterPauserABI = `[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const ERC20PresetMinterPauserBin = "0x60806040523480156200001157600080fd5b5060405162001d9538038062001d958339810160408190526200003491620003b5565b8151829082906200004d90600590602085019062000242565b5080516200006390600690602084019062000242565b50506007805460ff19169055506200007d600033620000dd565b620000a97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000dd565b620000d57f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000dd565b50506200045c565b620000e98282620000ed565b5050565b6200010482826200013060201b6200096e1760201c565b60008281526001602090815260409091206200012b918390620009f2620001d0821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e9576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200018c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620001e7836001600160a01b038416620001f0565b90505b92915050565b60008181526001830160205260408120546200023957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001ea565b506000620001ea565b82805462000250906200041f565b90600052602060002090601f016020900481019282620002745760008555620002bf565b82601f106200028f57805160ff1916838001178555620002bf565b82800160010185558215620002bf579182015b82811115620002bf578251825591602001919060010190620002a2565b50620002cd929150620002d1565b5090565b5b80821115620002cd5760008155600101620002d2565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200031057600080fd5b81516001600160401b03808211156200032d576200032d620002e8565b604051601f8301601f19908116603f01168101908282118183101715620003585762000358620002e8565b816040528381526020925086838588010111156200037557600080fd5b600091505b838210156200039957858201830151818301840152908201906200037a565b83821115620003ab5760008385830101525b9695505050505050565b60008060408385031215620003c957600080fd5b82516001600160401b0380821115620003e157600080fd5b620003ef86838701620002fe565b935060208501519150808211156200040657600080fd5b506200041585828601620002fe565b9150509250929050565b600181811c908216806200043457607f821691505b602082108114156200045657634e487b7160e01b600052602260045260246000fd5b50919050565b611929806200046c6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a457c2d711610097578063d539139311610071578063d5391393146103af578063d547741f146103d6578063dd62ed3e146103e9578063e63ab1e91461042257600080fd5b8063a457c2d714610376578063a9059cbb14610389578063ca15c8731461039c57600080fd5b80639010d07c116100d35780639010d07c1461032857806391d148541461035357806395d89b4114610366578063a217fddf1461036e57600080fd5b806370a08231146102e457806379cc67901461030d5780638456cb591461032057600080fd5b8063313ce567116101665780633f4ba83a116101405780633f4ba83a146102ab57806340c10f19146102b357806342966c68146102c65780635c975abb146102d957600080fd5b8063313ce5671461027657806336568abe14610285578063395093511461029857600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022b578063248a9ca31461023e5780632f2ff15d1461026157600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d73660046115cf565b610449565b60405190151581526020015b60405180910390f35b6101f9610474565b6040516101e89190611625565b6101dc610214366004611674565b610506565b6004545b6040519081526020016101e8565b6101dc61023936600461169e565b61051e565b61021d61024c3660046116da565b60009081526020819052604090206001015490565b61027461026f3660046116f3565b610542565b005b604051601281526020016101e8565b6102746102933660046116f3565b61056d565b6101dc6102a6366004611674565b6105f0565b61027461062f565b6102746102c1366004611674565b6106d5565b6102746102d43660046116da565b610774565b60075460ff166101dc565b61021d6102f236600461171f565b6001600160a01b031660009081526002602052604090205490565b61027461031b366004611674565b610781565b610274610796565b61033b61033636600461173a565b61083a565b6040516001600160a01b0390911681526020016101e8565b6101dc6103613660046116f3565b610859565b6101f9610882565b61021d600081565b6101dc610384366004611674565b610891565b6101dc610397366004611674565b610923565b61021d6103aa3660046116da565b610931565b61021d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102746103e43660046116f3565b610948565b61021d6103f736600461175c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61021d7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006001600160e01b03198216635a05180f60e01b148061046e575061046e82610a07565b92915050565b60606005805461048390611786565b80601f01602080910402602001604051908101604052809291908181526020018280546104af90611786565b80156104fc5780601f106104d1576101008083540402835291602001916104fc565b820191906000526020600020905b8154815290600101906020018083116104df57829003601f168201915b5050505050905090565b600033610514818585610a3c565b5060019392505050565b60003361052c858285610b60565b610537858585610bf2565b506001949350505050565b60008281526020819052604090206001015461055e8133610dcb565b6105688383610e2f565b505050565b6001600160a01b03811633146105e25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105ec8282610e51565b5050565b3360008181526003602090815260408083206001600160a01b0387168452909152812054909190610514908290869061062a9087906117d7565b610a3c565b6106597f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610859565b6106cb5760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105d9565b6106d3610e73565b565b6106ff7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610859565b61076a5760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105d9565b6105ec8282610f06565b61077e3382610ff1565b50565b61078c823383610b60565b6105ec8282610ff1565b6107c07f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610859565b6108325760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105d9565b6106d361114b565b600082815260016020526040812061085290836111c6565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606006805461048390611786565b3360008181526003602090815260408083206001600160a01b0387168452909152812054909190838110156109165760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105d9565b6105378286868403610a3c565b600033610514818585610bf2565b600081815260016020526040812061046e906111d2565b6000828152602081905260409020600101546109648133610dcb565b6105688383610e51565b6109788282610859565b6105ec576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556109ae3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610852836001600160a01b0384166111dc565b60006001600160e01b03198216637965db0b60e01b148061046e57506301ffc9a760e01b6001600160e01b031983161461046e565b6001600160a01b038316610a9e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d9565b6001600160a01b038216610aff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d9565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600360209081526040808320938616835292905220546000198114610bec5781811015610bdf5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105d9565b610bec8484848403610a3c565b50505050565b6001600160a01b038316610c565760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d9565b6001600160a01b038216610cb85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d9565b610cc383838361122b565b6001600160a01b03831660009081526002602052604090205481811015610d3b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105d9565b6001600160a01b03808516600090815260026020526040808220858503905591851681529081208054849290610d729084906117d7565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dbe91815260200190565b60405180910390a3610bec565b610dd58282610859565b6105ec57610ded816001600160a01b03166014611236565b610df8836020611236565b604051602001610e099291906117ef565b60408051601f198184030181529082905262461bcd60e51b82526105d991600401611625565b610e39828261096e565b600082815260016020526040902061056890826109f2565b610e5b82826113d2565b60008281526001602052604090206105689082611437565b60075460ff16610ebc5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105d9565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610f5c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105d9565b610f686000838361122b565b8060046000828254610f7a91906117d7565b90915550506001600160a01b03821660009081526002602052604081208054839290610fa79084906117d7565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166110515760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105d9565b61105d8260008361122b565b6001600160a01b038216600090815260026020526040902054818110156110d15760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105d9565b6001600160a01b0383166000908152600260205260408120838303905560048054849290611100908490611864565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60075460ff16156111915760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105d9565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ee93390565b6000610852838361144c565b600061046e825490565b60008181526001830160205260408120546112235750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561046e565b50600061046e565b610568838383611476565b6060600061124583600261187b565b6112509060026117d7565b67ffffffffffffffff8111156112685761126861189a565b6040519080825280601f01601f191660200182016040528015611292576020820181803683370190505b509050600360fc1b816000815181106112ad576112ad6118b0565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106112dc576112dc6118b0565b60200101906001600160f81b031916908160001a905350600061130084600261187b565b61130b9060016117d7565b90505b6001811115611383576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061133f5761133f6118b0565b1a60f81b828281518110611355576113556118b0565b60200101906001600160f81b031916908160001a90535060049490941c9361137c816118c6565b905061130e565b5083156108525760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d9565b6113dc8282610859565b156105ec576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610852836001600160a01b0384166114dc565b6000826000018281548110611463576114636118b0565b9060005260206000200154905092915050565b60075460ff16156105685760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105d9565b600081815260018301602052604081205480156115c5576000611500600183611864565b855490915060009061151490600190611864565b9050818114611579576000866000018281548110611534576115346118b0565b9060005260206000200154905080876000018481548110611557576115576118b0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061158a5761158a6118dd565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061046e565b600091505061046e565b6000602082840312156115e157600080fd5b81356001600160e01b03198116811461085257600080fd5b60005b838110156116145781810151838201526020016115fc565b83811115610bec5750506000910152565b60208152600082518060208401526116448160408501602087016115f9565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461166f57600080fd5b919050565b6000806040838503121561168757600080fd5b61169083611658565b946020939093013593505050565b6000806000606084860312156116b357600080fd5b6116bc84611658565b92506116ca60208501611658565b9150604084013590509250925092565b6000602082840312156116ec57600080fd5b5035919050565b6000806040838503121561170657600080fd5b8235915061171660208401611658565b90509250929050565b60006020828403121561173157600080fd5b61085282611658565b6000806040838503121561174d57600080fd5b50508035926020909101359150565b6000806040838503121561176f57600080fd5b61177883611658565b915061171660208401611658565b600181811c9082168061179a57607f821691505b602082108114156117bb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156117ea576117ea6117c1565b500190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516118278160178501602088016115f9565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516118588160288401602088016115f9565b01602801949350505050565b600082821015611876576118766117c1565b500390565b6000816000190483118215151615611895576118956117c1565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118d5576118d56117c1565b506000190190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220bae3c8fa2cbf779ea7b42e35284a76579a8a5958ffcec2fe816eda805f8e039d64736f6c634300080b0033" diff --git a/chains/evm/calls/consts/erc721Handler.go b/chains/evm/calls/consts/erc721Handler.go deleted file mode 100644 index 7801e23c..00000000 --- a/chains/evm/calls/consts/erc721Handler.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.4 -// compiler: 0.8.11, optimization-runs: 200 -const ERC721HandlerABI = `[{"inputs":[{"internalType":"address","name":"bridgeAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"_bridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_burnList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToTokenContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_tokenContractAddressToResourceID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[{"internalType":"bytes","name":"metaData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const ERC721HandlerBin = "0x60a060405234801561001057600080fd5b50604051610f1c380380610f1c83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610e8a6100926000396000818161011601526105860152610e8a6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80637f79bea8116100665780637f79bea81461016b578063b07e54bb1461018e578063b8fa3736146101ae578063c8ba6c87146101c1578063e248cff2146101ef57600080fd5b806307b7ed99146100a35780630968f264146100b85780630a6d55d8146100cb578063318c136e146101115780636a70d08114610138575b600080fd5b6100b66100b13660046109a6565b610202565b005b6100b66100c6366004610a39565b610216565b6100f46100d9366004610ab9565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f47f000000000000000000000000000000000000000000000000000000000000000081565b61015b6101463660046109a6565b60036020526000908152604090205460ff1681565b6040519015158152602001610108565b61015b6101793660046109a6565b60026020526000908152604090205460ff1681565b6101a161019c366004610b1b565b610250565b6040516101089190610bcf565b6100b66101bc366004610be2565b610392565b6101e16101cf3660046109a6565b60016020526000908152604090205481565b604051908152602001610108565b6100b66101fd366004610c12565b6103e7565b61020a61057b565b610213816105f5565b50565b61021e61057b565b6000806000838060200190518101906102379190610c5e565b9194509250905061024a8330848461068d565b50505050565b606061025a61057b565b600061026883850185610ab9565b600087815260208181526040808320546001600160a01b03168084526002909252909120549192509060ff166102b95760405162461bcd60e51b81526004016102b090610ca1565b60405180910390fd5b6102d36001600160a01b038216635b5e139f60e01b610702565b1561034b5760405163c87b56dd60e01b81526004810183905281906001600160a01b0382169063c87b56dd90602401600060405180830381865afa15801561031f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103479190810190610ce9565b9350505b6001600160a01b03811660009081526003602052604090205460ff161561037c57610377818784610727565b610388565b6103888187308561068d565b5050949350505050565b61039a61057b565b60008281526020818152604080832080546001600160a01b0319166001600160a01b039590951694851790559282526001808252838320949094556002905220805460ff19169091179055565b6103ef61057b565b600080606081808261040387890189610d60565b9096509450610413856040610d82565b9250610422836040898b610da8565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509296506104689250899150859050818b610da8565b8101906104759190610ab9565b91508787610484856020610d82565b9084610491876020610d82565b61049b9190610d82565b926104a893929190610da8565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506020898101518f83528282526040808420546001600160a01b0316808552600290935290922054959650909490935060ff16915061052a90505760405162461bcd60e51b81526004016102b090610ca1565b6001600160a01b03811660009081526003602052604090205460ff161561055f5761055a818360601c8a86610843565b61056e565b61056e81308460601c8b61068d565b5050505050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105f35760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206d7573742062652062726964676520636f6e7472616374000060448201526064016102b0565b565b6001600160a01b03811660009081526002602052604090205460ff166106695760405162461bcd60e51b8152602060048201526024808201527f70726f766964656420636f6e7472616374206973206e6f742077686974656c696044820152631cdd195960e21b60648201526084016102b0565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528591908216906323b872dd906064015b600060405180830381600087803b1580156106e357600080fd5b505af11580156106f7573d6000803e3d6000fd5b505050505050505050565b600061070d83610875565b801561071e575061071e83836108a8565b90505b92915050565b6040516331a9108f60e11b81526004810182905283906001600160a01b038481169190831690636352211e90602401602060405180830381865afa158015610773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107979190610dd2565b6001600160a01b0316146107e35760405162461bcd60e51b8152602060048201526013602482015272213ab937103737ba10333937b69037bbb732b960691b60448201526064016102b0565b604051630852cd8d60e31b8152600481018390526001600160a01b038216906342966c6890602401600060405180830381600087803b15801561082557600080fd5b505af1158015610839573d6000803e3d6000fd5b5050505050505050565b6040516334ff261960e21b815284906001600160a01b0382169063d3fc9864906106c990879087908790600401610def565b6000610888826301ffc9a760e01b6108a8565b801561072157506108a1826001600160e01b03196108a8565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061090f908690610e16565b6000604051808303818686fa925050503d806000811461094b576040519150601f19603f3d011682016040523d82523d6000602084013e610950565b606091505b509150915060208151101561096b5760009350505050610721565b8180156109875750808060200190518101906109879190610e32565b9695505050505050565b6001600160a01b038116811461021357600080fd5b6000602082840312156109b857600080fd5b81356109c381610991565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610a0957610a096109ca565b604052919050565b600067ffffffffffffffff821115610a2b57610a2b6109ca565b50601f01601f191660200190565b600060208284031215610a4b57600080fd5b813567ffffffffffffffff811115610a6257600080fd5b8201601f81018413610a7357600080fd5b8035610a86610a8182610a11565b6109e0565b818152856020838501011115610a9b57600080fd5b81602084016020830137600091810160200191909152949350505050565b600060208284031215610acb57600080fd5b5035919050565b60008083601f840112610ae457600080fd5b50813567ffffffffffffffff811115610afc57600080fd5b602083019150836020828501011115610b1457600080fd5b9250929050565b60008060008060608587031215610b3157600080fd5b843593506020850135610b4381610991565b9250604085013567ffffffffffffffff811115610b5f57600080fd5b610b6b87828801610ad2565b95989497509550505050565b60005b83811015610b92578181015183820152602001610b7a565b8381111561024a5750506000910152565b60008151808452610bbb816020860160208601610b77565b601f01601f19169290920160200192915050565b60208152600061071e6020830184610ba3565b60008060408385031215610bf557600080fd5b823591506020830135610c0781610991565b809150509250929050565b600080600060408486031215610c2757600080fd5b83359250602084013567ffffffffffffffff811115610c4557600080fd5b610c5186828701610ad2565b9497909650939450505050565b600080600060608486031215610c7357600080fd5b8351610c7e81610991565b6020850151909350610c8f81610991565b80925050604084015190509250925092565b60208082526028908201527f70726f766964656420746f6b656e41646472657373206973206e6f74207768696040820152671d195b1a5cdd195960c21b606082015260800190565b600060208284031215610cfb57600080fd5b815167ffffffffffffffff811115610d1257600080fd5b8201601f81018413610d2357600080fd5b8051610d31610a8182610a11565b818152856020838501011115610d4657600080fd5b610d57826020830160208601610b77565b95945050505050565b60008060408385031215610d7357600080fd5b50508035926020909101359150565b60008219821115610da357634e487b7160e01b600052601160045260246000fd5b500190565b60008085851115610db857600080fd5b83861115610dc557600080fd5b5050820193919092039150565b600060208284031215610de457600080fd5b81516109c381610991565b60018060a01b0384168152826020820152606060408201526000610d576060830184610ba3565b60008251610e28818460208701610b77565b9190910192915050565b600060208284031215610e4457600080fd5b815180151581146109c357600080fdfea264697066735822122044d066d185b2d49206e012db937a35a5befb4c501d07f2e6275d4b89d423660b64736f6c634300080b0033" diff --git a/chains/evm/calls/consts/erc721PresetMinterPauser.go b/chains/evm/calls/consts/erc721PresetMinterPauser.go deleted file mode 100644 index 6706a83f..00000000 --- a/chains/evm/calls/consts/erc721PresetMinterPauser.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const ERC721PresetMinterPauserABI = `[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"getRoleMemberIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_data","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]` -const ERC721PresetMinterPauserBin = "0x60806040523480156200001157600080fd5b506040516200279f3803806200279f83398101604081905262000034916200035a565b8251839083906200004d906001906020850190620001e7565b50805162000063906002906020840190620001e7565b50506007805460ff19169055506200007d600033620000e9565b620000a97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000e9565b620000d57f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000e9565b620000e081620000f9565b50505062000428565b620000f582826200010e565b5050565b8051620000f5906009906020840190620001e7565b6000828152602081815260409091206200013391839062000da762000175821b17901c565b15620000f55760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b60006200018c836001600160a01b03841662000195565b90505b92915050565b6000818152600183016020526040812054620001de575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200018f565b5060006200018f565b828054620001f590620003eb565b90600052602060002090601f01602090048101928262000219576000855562000264565b82601f106200023457805160ff191683800117855562000264565b8280016001018555821562000264579182015b828111156200026457825182559160200191906001019062000247565b506200027292915062000276565b5090565b5b8082111562000272576000815560010162000277565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002b557600080fd5b81516001600160401b0380821115620002d257620002d26200028d565b604051601f8301601f19908116603f01168101908282118183101715620002fd57620002fd6200028d565b816040528381526020925086838588010111156200031a57600080fd5b600091505b838210156200033e57858201830151818301840152908201906200031f565b83821115620003505760008385830101525b9695505050505050565b6000806000606084860312156200037057600080fd5b83516001600160401b03808211156200038857600080fd5b6200039687838801620002a3565b94506020860151915080821115620003ad57600080fd5b620003bb87838801620002a3565b93506040860151915080821115620003d257600080fd5b50620003e186828701620002a3565b9150509250925092565b600181811c908216806200040057607f821691505b602082108114156200042257634e487b7160e01b600052602260045260246000fd5b50919050565b61236780620004386000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c806370a0823111610104578063b88d4fde116100a2578063d539139311610071578063d539139314610402578063d547741f14610429578063e63ab1e91461043c578063e985e9c51461046357600080fd5b8063b88d4fde146103b6578063c87b56dd146103c9578063ca15c873146103dc578063d3fc9864146103ef57600080fd5b806391d14854116100de57806391d148541461038057806395d89b4114610393578063a217fddf1461039b578063a22cb465146103a357600080fd5b806370a08231146103525780638456cb59146103655780639010d07c1461036d57600080fd5b806336568abe1161017c5780634e0df3f61161014b5780634e0df3f6146102f45780635c975abb1461032c5780636352211e146103375780636c0360eb1461034a57600080fd5b806336568abe146102b35780633f4ba83a146102c657806342842e0e146102ce57806342966c68146102e157600080fd5b8063095ea7b3116101b8578063095ea7b31461024757806323b872dd1461025c578063248a9ca31461026f5780632f2ff15d146102a057600080fd5b806301ffc9a7146101df57806306fdde0314610207578063081812fc1461021c575b600080fd5b6101f26101ed366004611d9b565b61049f565b60405190151581526020015b60405180910390f35b61020f6104f1565b6040516101fe9190611e10565b61022f61022a366004611e23565b610583565b6040516001600160a01b0390911681526020016101fe565b61025a610255366004611e58565b610610565b005b61025a61026a366004611e82565b610726565b61029261027d366004611e23565b60009081526020819052604090206002015490565b6040519081526020016101fe565b61025a6102ae366004611ebe565b610758565b61025a6102c1366004611ebe565b6107e6565b61025a610860565b61025a6102dc366004611e82565b610906565b61025a6102ef366004611e23565b610921565b610292610302366004611ebe565b6000828152602081815260408083206001600160a01b038516845260010190915290205492915050565b60075460ff166101f2565b61022f610345366004611e23565b61099b565b61020f610a12565b610292610360366004611eea565b610aa0565b61025a610b27565b61022f61037b366004611f05565b610bcb565b6101f261038e366004611ebe565b610bea565b61020f610c02565b610292600081565b61025a6103b1366004611f27565b610c11565b61025a6103c4366004611fef565b610c1c565b61020f6103d7366004611e23565b610c54565b6102926103ea366004611e23565b610c5f565b61025a6103fd36600461206b565b610c76565b6102927f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61025a610437366004611ebe565b610d26565b6102927f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6101f26104713660046120d6565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b14806104d057506001600160e01b03198216635b5e139f60e01b145b806104eb57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606001805461050090612100565b80601f016020809104026020016040519081016040528092919081815260200182805461052c90612100565b80156105795780601f1061054e57610100808354040283529160200191610579565b820191906000526020600020905b81548152906001019060200180831161055c57829003601f168201915b5050505050905090565b600061058e82610dbc565b6105f45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061061b8261099b565b9050806001600160a01b0316836001600160a01b031614156106895760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016105eb565b336001600160a01b03821614806106a557506106a58133610471565b6107175760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016105eb565b6107218383610dd9565b505050565b610731335b82610e47565b61074d5760405162461bcd60e51b81526004016105eb9061213b565b610721838383610f31565b6000828152602081905260409020600201546107749033610bea565b6107d85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016105eb565b6107e282826110d8565b5050565b6001600160a01b03811633146108565760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105eb565b6107e28282611131565b61088a7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610bea565b6108fc5760405162461bcd60e51b815260206004820152603a60248201527f4552433732314d696e7465724275726e65725061757365723a206d757374206860448201527f6176652070617573657220726f6c6520746f20756e706175736500000000000060648201526084016105eb565b61090461118a565b565b61072183838360405180602001604052806000815250610c1c565b61092a3361072b565b61098f5760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b60648201526084016105eb565b6109988161121d565b50565b6000818152600360205260408120546001600160a01b0316806104eb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016105eb565b60098054610a1f90612100565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90612100565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b505050505081565b60006001600160a01b038216610b0b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016105eb565b506001600160a01b031660009081526004602052604090205490565b610b517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610bea565b610bc35760405162461bcd60e51b815260206004820152603860248201527f4552433732314d696e7465724275726e65725061757365723a206d757374206860448201527f6176652070617573657220726f6c6520746f207061757365000000000000000060648201526084016105eb565b610904611226565b6000828152602081905260408120610be390836112a1565b9392505050565b6000828152602081905260408120610be390836112ad565b60606002805461050090612100565b6107e23383836112cf565b610c263383610e47565b610c425760405162461bcd60e51b81526004016105eb9061213b565b610c4e8484848461139e565b50505050565b60606104eb826113d1565b60008181526020819052604081206104eb90611533565b610ca07f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610bea565b610d125760405162461bcd60e51b815260206004820152603760248201527f4552433732314d696e7465724275726e65725061757365723a206d757374206860448201527f617665206d696e74657220726f6c6520746f206d696e7400000000000000000060648201526084016105eb565b610d1c838361153d565b610721828261167c565b600082815260208190526040902060020154610d429033610bea565b6108565760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b60648201526084016105eb565b6000610be3836001600160a01b038416611707565b6000908152600360205260409020546001600160a01b0316151590565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610e0e8261099b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e5282610dbc565b610eb35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016105eb565b6000610ebe8361099b565b9050806001600160a01b0316846001600160a01b03161480610ef95750836001600160a01b0316610eee84610583565b6001600160a01b0316145b80610f2957506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316610f448261099b565b6001600160a01b031614610fa85760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105eb565b6001600160a01b03821661100a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105eb565b611015838383611756565b611020600082610dd9565b6001600160a01b03831660009081526004602052604081208054600192906110499084906121a2565b90915550506001600160a01b03821660009081526004602052604081208054600192906110779084906121b9565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008281526020819052604090206110f09082610da7565b156107e25760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b60008281526020819052604090206111499082611761565b156107e25760405133906001600160a01b0383169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b60075460ff166111d35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105eb565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61099881611776565b60075460ff161561126c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105eb565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112003390565b6000610be383836117b6565b6001600160a01b03811660009081526001830160205260408120541515610be3565b816001600160a01b0316836001600160a01b031614156113315760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105eb565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6113a9848484610f31565b6113b5848484846117e0565b610c4e5760405162461bcd60e51b81526004016105eb906121d1565b60606113dc82610dbc565b6114425760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b60648201526084016105eb565b6000828152600860205260408120805461145b90612100565b80601f016020809104026020016040519081016040528092919081815260200182805461148790612100565b80156114d45780601f106114a9576101008083540402835291602001916114d4565b820191906000526020600020905b8154815290600101906020018083116114b757829003601f168201915b5050505050905060006114e56118de565b90508051600014156114f8575092915050565b81511561152a578082604051602001611512929190612223565b60405160208183030381529060405292505050919050565b610f29846118ed565b60006104eb825490565b6001600160a01b0382166115935760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105eb565b61159c81610dbc565b156115e95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016105eb565b6115f560008383611756565b6001600160a01b038216600090815260046020526040812080546001929061161e9084906121b9565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b61168582610dbc565b6116e85760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b60648201526084016105eb565b6000828152600860209081526040909120825161072192840190611cb6565b600081815260018301602052604081205461174e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556104eb565b5060006104eb565b6107218383836119b7565b6000610be3836001600160a01b038416611a1e565b61177f81611b11565b6000818152600860205260409020805461179890612100565b15905061099857600081815260086020526040812061099891611d3a565b60008260000182815481106117cd576117cd612252565b9060005260206000200154905092915050565b60006001600160a01b0384163b156118d357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611824903390899088908890600401612268565b6020604051808303816000875af192505050801561185f575060408051601f3d908101601f1916820190925261185c918101906122a5565b60015b6118b9573d80801561188d576040519150601f19603f3d011682016040523d82523d6000602084013e611892565b606091505b5080516118b15760405162461bcd60e51b81526004016105eb906121d1565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610f29565b506001949350505050565b60606009805461050090612100565b60606118f882610dbc565b61195c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016105eb565b60006119666118de565b905060008151116119865760405180602001604052806000815250610be3565b8061199084611bb8565b6040516020016119a1929190612223565b6040516020818303038152906040529392505050565b60075460ff16156107215760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b60648201526084016105eb565b60008181526001830160205260408120548015611b07576000611a426001836121a2565b8554909150600090611a56906001906121a2565b9050818114611abb576000866000018281548110611a7657611a76612252565b9060005260206000200154905080876000018481548110611a9957611a99612252565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611acc57611acc6122c2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506104eb565b60009150506104eb565b6000611b1c8261099b565b9050611b2a81600084611756565b611b35600083610dd9565b6001600160a01b0381166000908152600460205260408120805460019290611b5e9084906121a2565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b606081611bdc5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611c065780611bf0816122d8565b9150611bff9050600a83612309565b9150611be0565b60008167ffffffffffffffff811115611c2157611c21611f63565b6040519080825280601f01601f191660200182016040528015611c4b576020820181803683370190505b5090505b8415610f2957611c606001836121a2565b9150611c6d600a8661231d565b611c789060306121b9565b60f81b818381518110611c8d57611c8d612252565b60200101906001600160f81b031916908160001a905350611caf600a86612309565b9450611c4f565b828054611cc290612100565b90600052602060002090601f016020900481019282611ce45760008555611d2a565b82601f10611cfd57805160ff1916838001178555611d2a565b82800160010185558215611d2a579182015b82811115611d2a578251825591602001919060010190611d0f565b50611d36929150611d70565b5090565b508054611d4690612100565b6000825580601f10611d56575050565b601f01602090049060005260206000209081019061099891905b5b80821115611d365760008155600101611d71565b6001600160e01b03198116811461099857600080fd5b600060208284031215611dad57600080fd5b8135610be381611d85565b60005b83811015611dd3578181015183820152602001611dbb565b83811115610c4e5750506000910152565b60008151808452611dfc816020860160208601611db8565b601f01601f19169290920160200192915050565b602081526000610be36020830184611de4565b600060208284031215611e3557600080fd5b5035919050565b80356001600160a01b0381168114611e5357600080fd5b919050565b60008060408385031215611e6b57600080fd5b611e7483611e3c565b946020939093013593505050565b600080600060608486031215611e9757600080fd5b611ea084611e3c565b9250611eae60208501611e3c565b9150604084013590509250925092565b60008060408385031215611ed157600080fd5b82359150611ee160208401611e3c565b90509250929050565b600060208284031215611efc57600080fd5b610be382611e3c565b60008060408385031215611f1857600080fd5b50508035926020909101359150565b60008060408385031215611f3a57600080fd5b611f4383611e3c565b915060208301358015158114611f5857600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611f9457611f94611f63565b604051601f8501601f19908116603f01168101908282118183101715611fbc57611fbc611f63565b81604052809350858152868686011115611fd557600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561200557600080fd5b61200e85611e3c565b935061201c60208601611e3c565b925060408501359150606085013567ffffffffffffffff81111561203f57600080fd5b8501601f8101871361205057600080fd5b61205f87823560208401611f79565b91505092959194509250565b60008060006060848603121561208057600080fd5b61208984611e3c565b925060208401359150604084013567ffffffffffffffff8111156120ac57600080fd5b8401601f810186136120bd57600080fd5b6120cc86823560208401611f79565b9150509250925092565b600080604083850312156120e957600080fd5b6120f283611e3c565b9150611ee160208401611e3c565b600181811c9082168061211457607f821691505b6020821081141561213557634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156121b4576121b461218c565b500390565b600082198211156121cc576121cc61218c565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351612235818460208801611db8565b835190830190612249818360208801611db8565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061229b90830184611de4565b9695505050505050565b6000602082840312156122b757600080fd5b8151610be381611d85565b634e487b7160e01b600052603160045260246000fd5b60006000198214156122ec576122ec61218c565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082612318576123186122f3565b500490565b60008261232c5761232c6122f3565b50069056fea2646970667358221220a36fedb900001fa1a46298500bc02afd92b53337672be28be2d478e1dfa1d29e64736f6c634300080b0033" diff --git a/chains/evm/calls/consts/generic.go b/chains/evm/calls/consts/generic.go deleted file mode 100644 index 2542ac68..00000000 --- a/chains/evm/calls/consts/generic.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const GenericHandlerABI = `[{"inputs":[{"internalType":"address","name":"bridgeAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"_bridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractAddressToDepositFunctionDepositerOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractAddressToDepositFunctionSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractAddressToExecuteFunctionSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractAddressToResourceID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"depositFunctionSig","type":"bytes4"},{"internalType":"uint256","name":"depositFunctionDepositerOffset","type":"uint256"},{"internalType":"bytes4","name":"executeFunctionSig","type":"bytes4"}],"name":"setResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"depositer","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -const GenericHandlerBin = "0x60a060405234801561001057600080fd5b50604051610b2f380380610b2f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610a9e6100916000396000818160a801526106f90152610a9e6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063c54c2a1111610066578063c54c2a11146101a4578063cb624463146101cd578063de319d99146101f0578063e248cff214610205578063ec97d3b41461021857600080fd5b8063318c136e146100a35780637f79bea8146100e7578063a5c3a9851461011a578063aa50800b14610156578063b07e54bb14610184575b600080fd5b6100ca7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61010a6100f5366004610784565b60056020526000908152604090205460ff1681565b60405190151581526020016100de565b61013d610128366004610784565b60046020526000908152604090205460e01b81565b6040516001600160e01b031990911681526020016100de565b610176610164366004610784565b60036020526000908152604090205481565b6040519081526020016100de565b6101976101923660046107ef565b610238565b6040516100de9190610879565b6100ca6101b23660046108ac565b6000602081905290815260409020546001600160a01b031681565b61013d6101db366004610784565b60026020526000908152604090205460e01b81565b6102036101fe3660046108dd565b610491565b005b610203610213366004610934565b610524565b610176610226366004610784565b60016020526000908152604090205481565b60606102426106ee565b60006060610252848601866108ac565b9150846020856102628583610980565b9261026f939291906109a6565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508b815260208181526040808320546001600160a01b0316808452600390925290912054949550939250508115905061033b57828101602001516001600160a01b038916606082901c146103395760405162461bcd60e51b815260206004820152601f60248201527f696e636f7272656374206465706f736974657220696e2074686520646174610060448201526064015b60405180910390fd5b505b6001600160a01b03821660009081526005602052604090205460ff166103735760405162461bcd60e51b8152600401610330906109d0565b6001600160a01b03821660009081526002602052604090205460e01b6001600160e01b031981161561048357600081856040516020016103b4929190610a1b565b6040516020818303038152906040529050600080856001600160a01b0316836040516103e09190610a4c565b6000604051808303816000865af19150503d806000811461041d576040519150601f19603f3d011682016040523d82523d6000602084013e610422565b606091505b5091509150816104745760405162461bcd60e51b815260206004820152601e60248201527f63616c6c20746f20636f6e747261637441646472657373206661696c656400006044820152606401610330565b97506104899650505050505050565b50505050505b949350505050565b6104996106ee565b60008581526020818152604080832080546001600160a01b0319166001600160a01b0398909816978817905595825260018082528683209790975560028152858220805463ffffffff1990811660e097881c1790915560038252868320949094556004815285822080549094169290941c91909117909155600590915220805460ff19169091179055565b61052c6106ee565b6000606061053c838501856108ac565b91508360208461054c8583610980565b92610559939291906109a6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525089815260208181526040808320546001600160a01b03168084526005909252909120549495509360ff1692506105d49150505760405162461bcd60e51b8152600401610330906109d0565b6001600160a01b03811660009081526004602052604090205460e01b6001600160e01b03198116156106e55760008184604051602001610615929190610a1b565b60405160208183030381529060405290506000836001600160a01b0316826040516106409190610a4c565b6000604051808303816000865af19150503d806000811461067d576040519150601f19603f3d011682016040523d82523d6000602084013e610682565b606091505b50509050806106e25760405162461bcd60e51b815260206004820152602660248201527f64656c656761746563616c6c20746f20636f6e7472616374416464726573732060448201526519985a5b195960d21b6064820152608401610330565b50505b50505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107665760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206d7573742062652062726964676520636f6e747261637400006044820152606401610330565b565b80356001600160a01b038116811461077f57600080fd5b919050565b60006020828403121561079657600080fd5b61079f82610768565b9392505050565b60008083601f8401126107b857600080fd5b50813567ffffffffffffffff8111156107d057600080fd5b6020830191508360208285010111156107e857600080fd5b9250929050565b6000806000806060858703121561080557600080fd5b8435935061081560208601610768565b9250604085013567ffffffffffffffff81111561083157600080fd5b61083d878288016107a6565b95989497509550505050565b60005b8381101561086457818101518382015260200161084c565b83811115610873576000848401525b50505050565b6020815260008251806020840152610898816040850160208701610849565b601f01601f19169190910160400192915050565b6000602082840312156108be57600080fd5b5035919050565b80356001600160e01b03198116811461077f57600080fd5b600080600080600060a086880312156108f557600080fd5b8535945061090560208701610768565b9350610913604087016108c5565b925060608601359150610928608087016108c5565b90509295509295909350565b60008060006040848603121561094957600080fd5b83359250602084013567ffffffffffffffff81111561096757600080fd5b610973868287016107a6565b9497909650939450505050565b600082198211156109a157634e487b7160e01b600052601160045260246000fd5b500190565b600080858511156109b657600080fd5b838611156109c357600080fd5b5050820193919092039150565b6020808252602b908201527f70726f766964656420636f6e747261637441646472657373206973206e6f742060408201526a1dda1a5d195b1a5cdd195960aa1b606082015260800190565b6001600160e01b0319831681528151600090610a3e816004850160208701610849565b919091016004019392505050565b60008251610a5e818460208701610849565b919091019291505056fea264697066735822122078d36f51e5655a69bda54d2a97fd24742b73405439abe498501186c59305a9e564736f6c634300080b0033" diff --git a/chains/evm/calls/consts/minimalForwarder.go b/chains/evm/calls/consts/minimalForwarder.go deleted file mode 100644 index 2a8df415..00000000 --- a/chains/evm/calls/consts/minimalForwarder.go +++ /dev/null @@ -1,6 +0,0 @@ -package consts - -// contracts: https://github.com/ChainSafe/sygma-solidity/tree/v2.1.3 -// compiler: 0.8.11, optimization-runs: 200 -const MinimalForwarderABI = `[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"gas","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Forwarder.ForwardRequest","name":"req","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"gas","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Forwarder.ForwardRequest","name":"req","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"}]` -const MinimalForwarderBin = "0x61014060405234801561001157600080fd5b5060408051808201825260098152682337b93bb0b93232b960b91b602080830191825283518085019094526005845264302e302e3160d81b908401528151902060e08190527fae209a0b48f21c054280f2455d32cf309387644879d9acbd8ffc1991638118856101008190524660a0529192917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6100f48184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c052610120525061010992505050565b60805160a05160c05160e0516101005161012051610b6161015860003960006104f2015260006105410152600061051c015260006104750152600061049f015260006104c90152610b616000f3fe6080604052600436106100345760003560e01c80632d0335ab1461003957806347153f8214610082578063bf5d3bdb146100a3575b600080fd5b34801561004557600080fd5b5061006f6100543660046108e3565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b610095610090366004610913565b6100d3565b6040516100799291906109e2565b3480156100af57600080fd5b506100c36100be366004610913565b610272565b6040519015158152602001610079565b600060606100e2858585610272565b61014e5760405162461bcd60e51b815260206004820152603260248201527f4d696e696d616c466f727761726465723a207369676e617475726520646f6573604482015271081b9bdd081b585d18da081c995c5d595cdd60721b60648201526084015b60405180910390fd5b61015d60808601356001610a1e565b60008061016d60208901896108e3565b6001600160a01b03166001600160a01b03168152602001908152602001600020819055506000808660200160208101906101a791906108e3565b6001600160a01b0316606088013560408901356101c760a08b018b610a44565b6101d460208d018d6108e3565b6040516020016101e693929190610a8b565b60408051601f198184030181529082905261020091610ab1565b600060405180830381858888f193505050503d806000811461023e576040519150601f19603f3d011682016040523d82523d6000602084013e610243565b606091505b509092509050610258603f6060890135610acd565b5a1161026657610266610aef565b90969095509350505050565b60008061038584848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061037f92507fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e4891506102e2905060208a018a6108e3565b6102f260408b0160208c016108e3565b60408b013560608c013560808d013561030e60a08f018f610a44565b60405161031c929190610b05565b6040805191829003822060208301989098526001600160a01b0396871690820152949093166060850152608084019190915260a083015260c082015260e081019190915261010001604051602081830303815290604052805190602001206103f0565b90610444565b9050608085013560008061039c60208901896108e3565b6001600160a01b03166001600160a01b03168152602001908152602001600020541480156103e757506103d260208601866108e3565b6001600160a01b0316816001600160a01b0316145b95945050505050565b600061043e6103fd610468565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b6000806000610453858561058f565b91509150610460816105ff565b509392505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156104c157507f000000000000000000000000000000000000000000000000000000000000000046145b156104eb57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000808251604114156105c65760208301516040840151606085015160001a6105ba878285856107bd565b945094505050506105f8565b8251604014156105f057602083015160408401516105e58683836108aa565b9350935050506105f8565b506000905060025b9250929050565b600081600481111561061357610613610b15565b141561061c5750565b600181600481111561063057610630610b15565b141561067e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610145565b600281600481111561069257610692610b15565b14156106e05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610145565b60038160048111156106f4576106f4610b15565b141561074d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610145565b600481600481111561076157610761610b15565b14156107ba5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610145565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156107f457506000905060036108a1565b8460ff16601b1415801561080c57508460ff16601c14155b1561081d57506000905060046108a1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610871573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661089a576000600192509250506108a1565b9150600090505b94509492505050565b6000806001600160ff1b038316816108c760ff86901c601b610a1e565b90506108d5878288856107bd565b935093505050935093915050565b6000602082840312156108f557600080fd5b81356001600160a01b038116811461090c57600080fd5b9392505050565b60008060006040848603121561092857600080fd5b833567ffffffffffffffff8082111561094057600080fd5b9085019060c0828803121561095457600080fd5b9093506020850135908082111561096a57600080fd5b818601915086601f83011261097e57600080fd5b81358181111561098d57600080fd5b87602082850101111561099f57600080fd5b6020830194508093505050509250925092565b60005b838110156109cd5781810151838201526020016109b5565b838111156109dc576000848401525b50505050565b82151581526040602082015260008251806040840152610a098160608501602087016109b2565b601f01601f1916919091016060019392505050565b60008219821115610a3f57634e487b7160e01b600052601160045260246000fd5b500190565b6000808335601e19843603018112610a5b57600080fd5b83018035915067ffffffffffffffff821115610a7657600080fd5b6020019150368190038213156105f857600080fd5b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60008251610ac38184602087016109b2565b9190910192915050565b600082610aea57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052600160045260246000fd5b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220150c748ec77bffc3a61ef2b41bb7fee29fa866229e2861e0a185456925ce416664736f6c634300080b0033" diff --git a/chains/evm/calls/contracts/bridge/bridge.go b/chains/evm/calls/contracts/bridge/bridge.go deleted file mode 100644 index 44b87dd2..00000000 --- a/chains/evm/calls/contracts/bridge/bridge.go +++ /dev/null @@ -1,348 +0,0 @@ -package bridge - -import ( - "bytes" - "math/big" - "strconv" - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/deposit" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/common/hexutil" - - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" -) - -type BridgeContract struct { - contracts.Contract -} - -func NewBridgeContract( - client calls.ContractCallerDispatcher, - bridgeContractAddress common.Address, - transactor transactor.Transactor, -) *BridgeContract { - a, _ := abi.JSON(strings.NewReader(consts.BridgeABI)) - b := common.FromHex(consts.BridgeBin) - return &BridgeContract{contracts.NewContract(bridgeContractAddress, a, b, client, transactor)} -} - -func (c *BridgeContract) AddRelayer( - relayerAddr common.Address, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Adding new relayer %s", relayerAddr.String()) - return c.ExecuteTransaction( - "adminAddRelayer", - opts, - relayerAddr, - ) -} - -func (c *BridgeContract) AdminSetGenericResource( - handler common.Address, - rID types.ResourceID, - addr common.Address, - depositFunctionSig [4]byte, - depositerOffset *big.Int, - executeFunctionSig [4]byte, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Setting generic resource %s", hexutil.Encode(rID[:])) - return c.ExecuteTransaction( - "adminSetGenericResource", - opts, - handler, rID, addr, depositFunctionSig, depositerOffset, executeFunctionSig, - ) -} - -func (c *BridgeContract) AdminSetResource( - handlerAddr common.Address, - rID types.ResourceID, - targetContractAddr common.Address, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Setting resource %s", hexutil.Encode(rID[:])) - return c.ExecuteTransaction( - "adminSetResource", - opts, - handlerAddr, rID, targetContractAddr, - ) -} - -func (c *BridgeContract) SetDepositNonce( - domainId uint8, - depositNonce uint64, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Setting deposit nonce %d for %d", depositNonce, domainId) - return c.ExecuteTransaction( - "adminSetDepositNonce", - opts, - domainId, depositNonce, - ) -} - -func (c *BridgeContract) AdminChangeRelayerThreshold( - threshold uint64, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Setting threshold %d", threshold) - return c.ExecuteTransaction( - "adminChangeRelayerThreshold", - opts, - big.NewInt(0).SetUint64(threshold), - ) -} - -func (c *BridgeContract) SetBurnableInput( - handlerAddr common.Address, - tokenContractAddr common.Address, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Setting burnable input for %s", tokenContractAddr.String()) - return c.ExecuteTransaction( - "adminSetBurnable", - opts, - handlerAddr, tokenContractAddr, - ) -} - -func (c *BridgeContract) deposit( - resourceID types.ResourceID, - destDomainID uint8, - data []byte, - opts transactor.TransactOptions, -) (*common.Hash, error) { - return c.ExecuteTransaction( - "deposit", - opts, - destDomainID, resourceID, data, - ) -} - -func (c *BridgeContract) Erc20Deposit( - recipient common.Address, - amount *big.Int, - resourceID types.ResourceID, - destDomainID uint8, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug(). - Str("recipient", recipient.String()). - Str("resourceID", hexutil.Encode(resourceID[:])). - Str("amount", amount.String()). - Msgf("ERC20 deposit") - var data []byte - if opts.Priority == 0 { - data = deposit.ConstructErc20DepositData(recipient.Bytes(), amount) - } else { - data = deposit.ConstructErc20DepositDataWithPriority(recipient.Bytes(), amount, opts.Priority) - } - txHash, err := c.deposit(resourceID, destDomainID, data, opts) - if err != nil { - log.Error().Err(err) - return nil, err - } - return txHash, err -} - -func (c *BridgeContract) Erc721Deposit( - tokenId *big.Int, - metadata string, - recipient common.Address, - resourceID types.ResourceID, - destDomainID uint8, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug(). - Str("recipient", recipient.String()). - Str("resourceID", hexutil.Encode(resourceID[:])). - Str("tokenID", tokenId.String()). - Msgf("ERC721 deposit") - var data []byte - if opts.Priority == 0 { - data = deposit.ConstructErc721DepositData(recipient.Bytes(), tokenId, []byte(metadata)) - } else { - data = deposit.ConstructErc721DepositDataWithPriority(recipient.Bytes(), tokenId, []byte(metadata), opts.Priority) - } - txHash, err := c.deposit(resourceID, destDomainID, data, opts) - if err != nil { - log.Error().Err(err) - return nil, err - } - return txHash, err -} - -func (c *BridgeContract) GenericDeposit( - metadata []byte, - resourceID types.ResourceID, - destDomainID uint8, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug(). - Str("resourceID", hexutil.Encode(resourceID[:])). - Msgf("Generic deposit") - data := deposit.ConstructGenericDepositData(metadata) - txHash, err := c.deposit(resourceID, destDomainID, data, opts) - if err != nil { - log.Error().Err(err) - return nil, err - } - return txHash, err -} - -func (c *BridgeContract) ExecuteProposal( - proposal *proposal.Proposal, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug(). - Str("depositNonce", strconv.FormatUint(proposal.DepositNonce, 10)). - Str("resourceID", hexutil.Encode(proposal.ResourceId[:])). - Str("handler", proposal.HandlerAddress.String()). - Msgf("Execute proposal") - return c.ExecuteTransaction( - "executeProposal", - opts, - proposal.Source, proposal.DepositNonce, proposal.Data, proposal.ResourceId, true, - ) -} - -func (c *BridgeContract) VoteProposal( - proposal *proposal.Proposal, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug(). - Str("depositNonce", strconv.FormatUint(proposal.DepositNonce, 10)). - Str("resourceID", hexutil.Encode(proposal.ResourceId[:])). - Str("handler", proposal.HandlerAddress.String()). - Msgf("Vote proposal") - return c.ExecuteTransaction( - "voteProposal", - opts, - proposal.Source, proposal.DepositNonce, proposal.ResourceId, proposal.Data, - ) -} - -func (c *BridgeContract) SimulateVoteProposal(proposal *proposal.Proposal) error { - log.Debug(). - Str("depositNonce", strconv.FormatUint(proposal.DepositNonce, 10)). - Str("resourceID", hexutil.Encode(proposal.ResourceId[:])). - Str("handler", proposal.HandlerAddress.String()). - Msgf("Simulate vote proposal") - _, err := c.CallContract( - "voteProposal", - proposal.Source, proposal.DepositNonce, proposal.ResourceId, proposal.Data, - ) - return err -} - -func (c *BridgeContract) Pause(opts transactor.TransactOptions) (*common.Hash, error) { - log.Debug().Msg("Pause transfers") - return c.ExecuteTransaction( - "adminPauseTransfers", - opts, - ) -} - -func (c *BridgeContract) Unpause(opts transactor.TransactOptions) (*common.Hash, error) { - log.Debug().Msg("Unpause transfers") - return c.ExecuteTransaction( - "adminUnpauseTransfers", - opts, - ) -} - -func (c *BridgeContract) Withdraw( - handlerAddress, - tokenAddress, - recipientAddress common.Address, - amountOrTokenId *big.Int, - opts transactor.TransactOptions, -) (*common.Hash, error) { - // @dev withdrawal data should include: - // tokenAddress - // recipientAddress - // realAmount - data := bytes.Buffer{} - data.Write(common.LeftPadBytes(tokenAddress.Bytes(), 32)) - data.Write(common.LeftPadBytes(recipientAddress.Bytes(), 32)) - data.Write(common.LeftPadBytes(amountOrTokenId.Bytes(), 32)) - - return c.ExecuteTransaction("adminWithdraw", opts, handlerAddress, data.Bytes()) -} - -func (c *BridgeContract) GetThreshold() (uint8, error) { - log.Debug().Msg("Getting threshold") - res, err := c.CallContract("_relayerThreshold") - if err != nil { - return 0, err - } - out := *abi.ConvertType(res[0], new(uint8)).(*uint8) - return out, nil -} - -func (c *BridgeContract) IsRelayer(relayerAddress common.Address) (bool, error) { - log.Debug().Msgf("Getting is %s a relayer", relayerAddress.String()) - res, err := c.CallContract("isRelayer", relayerAddress) - if err != nil { - return false, err - } - out := abi.ConvertType(res[0], new(bool)).(*bool) - return *out, nil -} - -func (c *BridgeContract) ProposalStatus(p *proposal.Proposal) (message.ProposalStatus, error) { - log.Debug(). - Str("depositNonce", strconv.FormatUint(p.DepositNonce, 10)). - Str("resourceID", hexutil.Encode(p.ResourceId[:])). - Str("handler", p.HandlerAddress.String()). - Msg("Getting proposal status") - res, err := c.CallContract("getProposal", p.Source, p.DepositNonce, p.GetDataHash()) - if err != nil { - return message.ProposalStatus{}, err - } - out := *abi.ConvertType(res[0], new(message.ProposalStatus)).(*message.ProposalStatus) - return out, nil -} - -func (c *BridgeContract) IsProposalVotedBy(by common.Address, p *proposal.Proposal) (bool, error) { - log.Debug(). - Str("depositNonce", strconv.FormatUint(p.DepositNonce, 10)). - Str("resourceID", hexutil.Encode(p.ResourceId[:])). - Str("handler", p.HandlerAddress.String()). - Msgf("Getting is proposal voted by %s", by.String()) - res, err := c.CallContract("_hasVotedOnProposal", idAndNonce(p.Source, p.DepositNonce), p.GetDataHash(), by) - if err != nil { - return false, err - } - out := *abi.ConvertType(res[0], new(bool)).(*bool) - return out, nil -} - -func (c *BridgeContract) GetHandlerAddressForResourceID( - resourceID types.ResourceID, -) (common.Address, error) { - log.Debug().Msgf("Getting handler address for resource %s", hexutil.Encode(resourceID[:])) - res, err := c.CallContract("_resourceIDToHandlerAddress", resourceID) - if err != nil { - return common.Address{}, err - } - out := *abi.ConvertType(res[0], new(common.Address)).(*common.Address) - return out, nil -} - -func idAndNonce(srcId uint8, nonce uint64) *big.Int { - var data []byte - data = append(data, big.NewInt(int64(nonce)).Bytes()...) - data = append(data, uint8(srcId)) - return big.NewInt(0).SetBytes(data) -} diff --git a/chains/evm/calls/contracts/bridge/bridge_test.go b/chains/evm/calls/contracts/bridge/bridge_test.go deleted file mode 100644 index a4b642f0..00000000 --- a/chains/evm/calls/contracts/bridge/bridge_test.go +++ /dev/null @@ -1,415 +0,0 @@ -package bridge_test - -import ( - "encoding/hex" - "errors" - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type ProposalStatusTestSuite struct { - suite.Suite - mockContractCaller *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - bridgeAddress common.Address - bridgeContract *bridge.BridgeContract - proposal proposal.Proposal -} - -var ( - testContractAddress = "0x5f75ce92326e304962b22749bd71e36976171285" - testInteractorAddress = "0x1B33100D4f077f027042c01241D617b264d77931" - testRelayerAddress = "0x0E223343BE5E126d7Cd1F6228F8F86fA04aD80fe" - testHandlerAddress = "0xb157b07c616860546464b733a056be414167a09b" - testResourceId = [32]byte{66} - testDomainId = uint8(0) - metadata = message.Metadata{} -) - -func TestRunProposalStatusTestSuite(t *testing.T) { - suite.Run(t, new(ProposalStatusTestSuite)) -} - -func (s *ProposalStatusTestSuite) SetupSuite() {} -func (s *ProposalStatusTestSuite) TearDownSuite() {} -func (s *ProposalStatusTestSuite) SetupTest() { - gomockController := gomock.NewController(s.T()) - s.mockContractCaller = mock_calls.NewMockContractCallerDispatcher(gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(gomockController) - s.bridgeAddress = common.HexToAddress("0x3162226db165D8eA0f51720CA2bbf44Db2105ADF") - s.bridgeContract = bridge.NewBridgeContract(s.mockContractCaller, common.HexToAddress(testContractAddress), s.mockTransactor) - - s.proposal = *proposal.NewProposal( - uint8(1), - uint8(2), - uint64(1), - testResourceId, - []byte{}, - common.HexToAddress(testHandlerAddress), - common.HexToAddress(testContractAddress), - metadata, - ) -} -func (s *ProposalStatusTestSuite) TearDownTest() {} - -func (s *ProposalStatusTestSuite) TestProposalContractCall_StatusFailed() { - s.mockContractCaller.EXPECT().CallContract(gomock.Any(), gomock.Any(), nil).Return(nil, errors.New("error")) - s.mockContractCaller.EXPECT().From().Times(1).Return(common.Address{}) - bc := bridge.NewBridgeContract(s.mockContractCaller, common.Address{}, s.mockTransactor) - status, err := bc.ProposalStatus(&proposal.Proposal{}) - s.Equal(message.ProposalStatus{}, status) - s.NotNil(err) -} - -func (s *ProposalStatusTestSuite) TestProposalStatus_FailedUnpack() { - s.mockContractCaller.EXPECT().CallContract(gomock.Any(), gomock.Any(), nil).Return([]byte("invalid"), nil) - s.mockContractCaller.EXPECT().From().Times(1).Return(common.Address{}) - bc := bridge.NewBridgeContract(s.mockContractCaller, common.Address{}, s.mockTransactor) - status, err := bc.ProposalStatus(&proposal.Proposal{}) - - s.Equal(message.ProposalStatus{}, status) - s.NotNil(err) -} - -func (s *ProposalStatusTestSuite) TestProposalStatus_SuccessfulCall() { - proposalStatus, _ := hex.DecodeString("0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001f") - s.mockContractCaller.EXPECT().CallContract(gomock.Any(), gomock.Any(), nil).Return(proposalStatus, nil) - s.mockContractCaller.EXPECT().From().Times(1).Return(common.Address{}) - bc := bridge.NewBridgeContract(s.mockContractCaller, common.Address{}, s.mockTransactor) - status, err := bc.ProposalStatus(&proposal.Proposal{}) - - s.Nil(err) - s.Equal(status.YesVotesTotal, uint8(3)) - s.Equal(status.Status, message.ProposalStatusExecuted) -} - -func (s *ProposalStatusTestSuite) TestPrepare_WithdrawInput_Success() { - handlerAddress := common.HexToAddress("0x3167776db165D8eA0f51790CA2bbf44Db5105ADF") - tokenAddress := common.HexToAddress("0x3f709398808af36ADBA86ACC617FeB7F5B7B193E") - recipientAddress := common.HexToAddress("0x8e5F72B158BEDf0ab50EDa78c70dFC118158C272") - amountOrTokenId := big.NewInt(1) - - s.mockTransactor.EXPECT().Transact(&s.bridgeAddress, gomock.Any(), gomock.Any()).Times(1).Return( - &common.Hash{}, nil, - ) - - bc := bridge.NewBridgeContract(s.mockContractCaller, s.bridgeAddress, s.mockTransactor) - inputBytes, err := bc.Withdraw( - handlerAddress, tokenAddress, recipientAddress, amountOrTokenId, transactor.TransactOptions{}, - ) - s.NotNil(inputBytes) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestDeployContract_Success() { - bc := bridge.NewBridgeContract(s.mockContractCaller, s.bridgeAddress, s.mockTransactor) - a := common.HexToAddress("0x12847465a15b58D4351AfB47F0CBbeebE93B06e3") - address, err := bc.PackMethod("", - uint8(1), - []common.Address{a}, - big.NewInt(0).SetUint64(1), - big.NewInt(0).SetUint64(1), - big.NewInt(0), - ) - s.Nil(err) - s.NotNil(address) -} - -func (s *ProposalStatusTestSuite) TestBridge_AddRelayer_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3, 4, 5}, nil) - res, err := s.bridgeContract.AddRelayer(common.HexToAddress(testRelayerAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3, 4, 5}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_AdminSetGenericResource_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{10, 11, 12, 13, 14}, nil) - res, err := s.bridgeContract.AdminSetGenericResource(common.HexToAddress(testHandlerAddress), [32]byte{1}, common.HexToAddress(testInteractorAddress), [4]byte{2}, big.NewInt(0), [4]byte{3}, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{10, 11, 12, 13, 14}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_AdminSetResource_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{10, 11, 12, 13, 14, 15, 16}, nil) - res, err := s.bridgeContract.AdminSetResource(common.HexToAddress(testHandlerAddress), testResourceId, common.HexToAddress(testContractAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{10, 11, 12, 13, 14, 15, 16}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_SetDepositNonce_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{20, 21, 22, 23}, nil) - res, err := s.bridgeContract.SetDepositNonce(testDomainId, uint64(0), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{20, 21, 22, 23}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_SetThresholdInput_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{22, 23, 24, 25}, nil) - res, err := s.bridgeContract.AdminChangeRelayerThreshold(uint64(2), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{22, 23, 24, 25}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_SetBurnableInput_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{25, 26, 27, 28}, nil) - res, err := s.bridgeContract.SetBurnableInput(common.HexToAddress(testHandlerAddress), common.HexToAddress(testContractAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{25, 26, 27, 28}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_Erc20Deposit_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{30, 31, 32, 33}, nil) - res, err := s.bridgeContract.Erc20Deposit(common.HexToAddress(testInteractorAddress), big.NewInt(10), testResourceId, testDomainId, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{30, 31, 32, 33}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_Erc721Deposit_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{32, 33, 34, 35}, nil) - res, err := s.bridgeContract.Erc721Deposit(big.NewInt(55), "token_uri", common.HexToAddress(testInteractorAddress), testResourceId, testDomainId, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{32, 33, 34, 35}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_GenericDeposit_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{35, 36, 37, 38}, nil) - res, err := s.bridgeContract.GenericDeposit([]byte{1, 2, 3}, testResourceId, testDomainId, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{35, 36, 37, 38}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_ExecuteProposal_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{36, 37, 38}, nil) - res, err := s.bridgeContract.ExecuteProposal(&s.proposal, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{36, 37, 38}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_VoteProposal_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{37, 38, 39}, nil) - res, err := s.bridgeContract.VoteProposal(&s.proposal, transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{37, 38, 39}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_SimulateVoteProposal_Success() { - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, nil) - err := s.bridgeContract.SimulateVoteProposal(&s.proposal) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_Pause_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{40, 41, 42}, nil) - res, err := s.bridgeContract.Pause(transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{40, 41, 42}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_Unpause_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{42, 43, 44}, nil) - res, err := s.bridgeContract.Unpause(transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{42, 43, 44}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_Withdraw_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{44, 45, 46}, nil) - res, err := s.bridgeContract.Withdraw( - common.HexToAddress(testHandlerAddress), - common.HexToAddress(testContractAddress), - common.HexToAddress(testInteractorAddress), - big.NewInt(5), transactor.DefaultTransactionOptions, - ) - s.Equal( - &common.Hash{44, 45, 46}, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_GetThreshold_Success() { - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, nil) - res, err := s.bridgeContract.GetThreshold() - s.Equal( - uint8(2), - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_IsRelayer_Success() { - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, nil) - res, err := s.bridgeContract.IsRelayer(common.HexToAddress(testInteractorAddress)) - s.Equal( - true, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_ProposalStatus_Success() { - proposalStatus, _ := hex.DecodeString("0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001f") - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return(proposalStatus, nil) - res, err := s.bridgeContract.ProposalStatus(&s.proposal) - s.Equal( - message.ProposalStatus(message.ProposalStatus{Status: 0x3, YesVotes: big.NewInt(28), YesVotesTotal: 0x3, ProposedBlock: big.NewInt(31)}), - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_IsProposalVotedBy_Success() { - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, nil) - res, err := s.bridgeContract.IsProposalVotedBy(common.HexToAddress(testHandlerAddress), &s.proposal) - s.Equal( - true, - res, - ) - s.Nil(err) -} - -func (s *ProposalStatusTestSuite) TestBridge_GetHandlerAddressForResourceID_Success() { - s.mockContractCaller.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCaller.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5}, nil) - res, err := s.bridgeContract.GetHandlerAddressForResourceID(testResourceId) - s.Equal( - common.HexToAddress("0x0000000000000000000000000000000102030405"), - res, - ) - s.Nil(err) -} diff --git a/chains/evm/calls/contracts/centrifuge/assetStore.go b/chains/evm/calls/contracts/centrifuge/assetStore.go deleted file mode 100644 index 4436e9ad..00000000 --- a/chains/evm/calls/contracts/centrifuge/assetStore.go +++ /dev/null @@ -1,42 +0,0 @@ -package centrifuge - -import ( - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/rs/zerolog/log" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" -) - -type AssetStoreContract struct { - contracts.Contract -} - -func NewAssetStoreContract( - client calls.ContractCallerDispatcher, - assetStoreContractAddress common.Address, - transactor transactor.Transactor, -) *AssetStoreContract { - a, _ := abi.JSON(strings.NewReader(consts.CentrifugeAssetStoreABI)) - b := common.FromHex(consts.CentrifugeAssetStoreBin) - return &AssetStoreContract{contracts.NewContract(assetStoreContractAddress, a, b, client, transactor)} -} - -func (c *AssetStoreContract) IsCentrifugeAssetStored(hash [32]byte) (bool, error) { - log.Debug(). - Str("hash", hexutil.Encode(hash[:])). - Msgf("Getting is centrifuge asset stored") - res, err := c.CallContract("_assetsStored", hash) - if err != nil { - return false, err - } - - isAssetStored := *abi.ConvertType(res[0], new(bool)).(*bool) - return isAssetStored, nil -} diff --git a/chains/evm/calls/contracts/centrifuge/assetStore_test.go b/chains/evm/calls/contracts/centrifuge/assetStore_test.go deleted file mode 100644 index 69d2b6ce..00000000 --- a/chains/evm/calls/contracts/centrifuge/assetStore_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package centrifuge_test - -import ( - "errors" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type IsCentrifugeAssetStoredTestSuite struct { - suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - assetStoreContractAddress common.Address - assetStoreContract *centrifuge.AssetStoreContract -} - -func TestRunIsCentrifugeAssetStoredTestSuite(t *testing.T) { - suite.Run(t, new(IsCentrifugeAssetStoredTestSuite)) -} - -func (s *IsCentrifugeAssetStoredTestSuite) SetupSuite() {} -func (s *IsCentrifugeAssetStoredTestSuite) TearDownSuite() {} -func (s *IsCentrifugeAssetStoredTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.assetStoreContractAddress = common.HexToAddress("0x9A0E6F91E6031C08326764655432f8F9c180fBa0") - s.assetStoreContract = centrifuge.NewAssetStoreContract( - s.mockContractCallerDispatcherClient, s.assetStoreContractAddress, s.mockTransactor, - ) -} -func (s *IsCentrifugeAssetStoredTestSuite) TearDownTest() {} - -func (s *IsCentrifugeAssetStoredTestSuite) TestCallContractFails() { - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, errors.New("error")) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) - isStored, err := s.assetStoreContract.IsCentrifugeAssetStored([32]byte{}) - - s.NotNil(err) - s.Equal(isStored, false) -} - -func (s *IsCentrifugeAssetStoredTestSuite) TestUnpackingInvalidOutput() { - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("invalid"), nil) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) - isStored, err := s.assetStoreContract.IsCentrifugeAssetStored([32]byte{}) - - s.NotNil(err) - s.Equal(isStored, false) -} - -func (s *IsCentrifugeAssetStoredTestSuite) TestEmptyOutput() { - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), gomock.Any(), gomock.Any(), - ).Return([]byte{}, nil) - s.mockContractCallerDispatcherClient.EXPECT().CodeAt( - gomock.Any(), gomock.Any(), gomock.Any(), - ).Return(nil, errors.New("error")) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) - - isStored, err := s.assetStoreContract.IsCentrifugeAssetStored([32]byte{}) - - s.NotNil(err) - s.Equal(isStored, false) -} - -func (s *IsCentrifugeAssetStoredTestSuite) TestValidStoredAsset() { - response := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), gomock.Any(), gomock.Any()).Return(response, nil) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) - - isStored, err := s.assetStoreContract.IsCentrifugeAssetStored([32]byte{}) - - s.Nil(err) - s.Equal(isStored, true) -} diff --git a/chains/evm/calls/contracts/deposit/deposit.go b/chains/evm/calls/contracts/deposit/deposit.go deleted file mode 100644 index 67c889ee..00000000 --- a/chains/evm/calls/contracts/deposit/deposit.go +++ /dev/null @@ -1,50 +0,0 @@ -package deposit - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/common/math" -) - -func constructMainDepositData(tokenStats *big.Int, destRecipient []byte) []byte { - var data []byte - data = append(data, math.PaddedBigBytes(tokenStats, 32)...) // Amount (ERC20) or Token Id (ERC721) - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len(destRecipient))), 32)...) // length of recipient - data = append(data, destRecipient...) // Recipient - return data -} - -func ConstructErc20DepositData(destRecipient []byte, amount *big.Int) []byte { - data := constructMainDepositData(amount, destRecipient) - return data -} - -func ConstructErc20DepositDataWithPriority(destRecipient []byte, amount *big.Int, priority uint8) []byte { - data := constructMainDepositData(amount, destRecipient) - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len([]uint8{priority}))), 1)...) // Length of priority - data = append(data, math.PaddedBigBytes(big.NewInt(int64(priority)), 1)...) // Priority - return data -} - -func ConstructErc721DepositData(destRecipient []byte, tokenId *big.Int, metadata []byte) []byte { - data := constructMainDepositData(tokenId, destRecipient) - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 32)...) // Length of metadata - data = append(data, metadata...) // Metadata - return data -} - -func ConstructErc721DepositDataWithPriority(destRecipient []byte, tokenId *big.Int, metadata []byte, priority uint8) []byte { - data := constructMainDepositData(tokenId, destRecipient) - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 32)...) // Length of metadata - data = append(data, metadata...) // Metadata - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len([]uint8{priority}))), 1)...) // Length of priority - data = append(data, math.PaddedBigBytes(big.NewInt(int64(priority)), 1)...) // Priority - return data -} - -func ConstructGenericDepositData(metadata []byte) []byte { - var data []byte - data = append(data, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 32)...) // Length of metadata - data = append(data, metadata...) // Metadata - return data -} diff --git a/chains/evm/calls/contracts/erc20/erc20.go b/chains/evm/calls/contracts/erc20/erc20.go deleted file mode 100644 index 7b451173..00000000 --- a/chains/evm/calls/contracts/erc20/erc20.go +++ /dev/null @@ -1,78 +0,0 @@ -package erc20 - -import ( - "math/big" - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" -) - -type ERC20Contract struct { - contracts.Contract -} - -func NewERC20Contract( - client calls.ContractCallerDispatcher, - erc20ContractAddress common.Address, - transactor transactor.Transactor, -) *ERC20Contract { - a, _ := abi.JSON(strings.NewReader(consts.ERC20PresetMinterPauserABI)) - b := common.FromHex(consts.ERC20PresetMinterPauserBin) - return &ERC20Contract{contracts.NewContract(erc20ContractAddress, a, b, client, transactor)} -} - -func (c *ERC20Contract) GetBalance(address common.Address) (*big.Int, error) { - log.Debug().Msgf("Getting balance for %s", address.String()) - res, err := c.CallContract("balanceOf", address) - if err != nil { - return nil, err - } - b := abi.ConvertType(res[0], new(big.Int)).(*big.Int) - return b, nil -} - -func (c *ERC20Contract) MintTokens( - to common.Address, - amount *big.Int, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Minting %s tokens to %s", amount.String(), to.String()) - return c.ExecuteTransaction("mint", opts, to, amount) -} - -func (c *ERC20Contract) ApproveTokens( - target common.Address, - amount *big.Int, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Approving %s tokens for %s", target.String(), amount.String()) - return c.ExecuteTransaction("approve", opts, target, amount) -} - -func (c *ERC20Contract) MinterRole() ([32]byte, error) { - res, err := c.CallContract("MINTER_ROLE") - if err != nil { - return [32]byte{}, err - } - out := *abi.ConvertType(res[0], new([32]byte)).(*[32]byte) - return out, nil -} - -func (c *ERC20Contract) AddMinter( - minter common.Address, - opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Adding new minter %s", minter.String()) - role, err := c.MinterRole() - if err != nil { - return nil, err - } - return c.ExecuteTransaction("grantRole", opts, role, minter) -} diff --git a/chains/evm/calls/contracts/erc20/erc20Handler.go b/chains/evm/calls/contracts/erc20/erc20Handler.go deleted file mode 100644 index 94db6a82..00000000 --- a/chains/evm/calls/contracts/erc20/erc20Handler.go +++ /dev/null @@ -1,26 +0,0 @@ -package erc20 - -import ( - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" -) - -type ERC20HandlerContract struct { - contracts.Contract -} - -func NewERC20HandlerContract( - client calls.ContractCallerDispatcher, - erc20HandlerContractAddress common.Address, - t transactor.Transactor, -) *ERC20HandlerContract { - a, _ := abi.JSON(strings.NewReader(consts.ERC20HandlerABI)) - b := common.FromHex(consts.ERC20HandlerBin) - return &ERC20HandlerContract{contracts.NewContract(erc20HandlerContractAddress, a, b, client, t)} -} diff --git a/chains/evm/calls/contracts/erc20/erc20_test.go b/chains/evm/calls/contracts/erc20/erc20_test.go deleted file mode 100644 index 6aac8339..00000000 --- a/chains/evm/calls/contracts/erc20/erc20_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package erc20_test - -import ( - "math/big" - "testing" - - erc20 "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type ERC20ContractCallsTestSuite struct { - suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - erc20contract *erc20.ERC20Contract -} - -var ( - testContractAddress = "0x5f75ce92326e304962b22749bd71e36976171285" - testInteractorAddress = "0x8362bbbd6d987895E2A4630a55e69Dd8C7b9f87B" -) - -func TestRunERC20ContractCallsTestSuite(t *testing.T) { - suite.Run(t, new(ERC20ContractCallsTestSuite)) -} - -func (s *ERC20ContractCallsTestSuite) SetupSuite() {} -func (s *ERC20ContractCallsTestSuite) TearDownSuite() {} -func (s *ERC20ContractCallsTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.erc20contract = erc20.NewERC20Contract( - s.mockContractCallerDispatcherClient, common.HexToAddress(testContractAddress), s.mockTransactor, - ) -} -func (s *ERC20ContractCallsTestSuite) TearDownTest() {} - -func (s *ERC20ContractCallsTestSuite) TestErc20Contract_GetBalance_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, nil) - res, err := s.erc20contract.GetBalance(common.HexToAddress(testInteractorAddress)) - s.Equal( - big.NewInt(5), - res, - ) - s.Nil(err) -} - -func (s *ERC20ContractCallsTestSuite) TestErc20Contract_MintTokens_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3, 4, 5}, nil) - res, err := s.erc20contract.MintTokens(common.HexToAddress(testInteractorAddress), big.NewInt(10), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3, 4, 5}, - res, - ) - s.Nil(err) -} - -func (s *ERC20ContractCallsTestSuite) TestErc20Contract_ApproveTokens_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3, 4, 5, 6, 7, 8, 9}, nil) - res, err := s.erc20contract.ApproveTokens(common.HexToAddress(testInteractorAddress), big.NewInt(100), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3, 4, 5, 6, 7, 8, 9}, - res, - ) - s.Nil(err) -} - -func (s *ERC20ContractCallsTestSuite) TestErc20Contract_MinterRole_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, nil) - res, err := s.erc20contract.MinterRole() - s.Equal( - [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, - res, - ) - s.Nil(err) -} - -func (s *ERC20ContractCallsTestSuite) TestErc20Contract_AddMinter_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25}, nil) - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3}, nil) - res, err := s.erc20contract.AddMinter(common.HexToAddress(testInteractorAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3}, - res, - ) - s.Nil(err) -} diff --git a/chains/evm/calls/contracts/erc721/erc721.go b/chains/evm/calls/contracts/erc721/erc721.go deleted file mode 100644 index 9d0a8871..00000000 --- a/chains/evm/calls/contracts/erc721/erc721.go +++ /dev/null @@ -1,74 +0,0 @@ -package erc721 - -import ( - "math/big" - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" -) - -type ERC721Contract struct { - contracts.Contract -} - -func NewErc721Contract( - client calls.ContractCallerDispatcher, - erc721ContractAddress common.Address, - t transactor.Transactor, -) *ERC721Contract { - a, _ := abi.JSON(strings.NewReader(consts.ERC721PresetMinterPauserABI)) - b := common.FromHex(consts.ERC721PresetMinterPauserBin) - return &ERC721Contract{contracts.NewContract(erc721ContractAddress, a, b, client, t)} -} - -func (c *ERC721Contract) AddMinter( - minter common.Address, opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Adding new minter %s", minter.String()) - role, err := c.MinterRole() - if err != nil { - return nil, err - } - return c.ExecuteTransaction("grantRole", opts, role, minter) -} - -func (c *ERC721Contract) Approve( - tokenId *big.Int, recipient common.Address, opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Approving %s token for %s", tokenId.String(), recipient.String()) - return c.ExecuteTransaction("approve", opts, recipient, tokenId) -} - -func (c *ERC721Contract) Mint( - tokenId *big.Int, metadata string, destination common.Address, opts transactor.TransactOptions, -) (*common.Hash, error) { - log.Debug().Msgf("Minting tokens %s to %s", tokenId.String(), destination.String()) - return c.ExecuteTransaction("mint", opts, destination, tokenId, metadata) -} - -func (c *ERC721Contract) Owner(tokenId *big.Int) (*common.Address, error) { - log.Debug().Msgf("Getting owner of %s", tokenId.String()) - res, err := c.CallContract("ownerOf", tokenId) - if err != nil { - return nil, err - } - - ownerAddr := abi.ConvertType(res[0], new(common.Address)).(*common.Address) - return ownerAddr, nil -} - -func (c *ERC721Contract) MinterRole() ([32]byte, error) { - res, err := c.CallContract("MINTER_ROLE") - if err != nil { - return [32]byte{}, err - } - out := *abi.ConvertType(res[0], new([32]byte)).(*[32]byte) - return out, nil -} diff --git a/chains/evm/calls/contracts/erc721/erc721Handler.go b/chains/evm/calls/contracts/erc721/erc721Handler.go deleted file mode 100644 index a4a8ef0a..00000000 --- a/chains/evm/calls/contracts/erc721/erc721Handler.go +++ /dev/null @@ -1,26 +0,0 @@ -package erc721 - -import ( - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" -) - -type ERC721HandlerContract struct { - contracts.Contract -} - -func NewERC721HandlerContract( - client calls.ContractCallerDispatcher, - erc721HandlerContractAddress common.Address, - t transactor.Transactor, -) *ERC721HandlerContract { - a, _ := abi.JSON(strings.NewReader(consts.ERC721HandlerABI)) - b := common.FromHex(consts.ERC721HandlerBin) - return &ERC721HandlerContract{contracts.NewContract(erc721HandlerContractAddress, a, b, client, t)} -} diff --git a/chains/evm/calls/contracts/erc721/erc721_test.go b/chains/evm/calls/contracts/erc721/erc721_test.go deleted file mode 100644 index 2e711c5a..00000000 --- a/chains/evm/calls/contracts/erc721/erc721_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package erc721_test - -import ( - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type ERC721CallsTestSuite struct { - suite.Suite - gomockController *gomock.Controller - clientMock *mock_calls.MockClientDispatcher - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - erc721ContractAddress common.Address - erc721Contract *erc721.ERC721Contract -} - -var ( - testInteractorAddress = "0x8362bbbd6d987895E2A4630a55e69Dd8C7b9f87B" -) - -func TestRunERC721CallsTestSuite(t *testing.T) { - suite.Run(t, new(ERC721CallsTestSuite)) -} - -func (s *ERC721CallsTestSuite) SetupSuite() {} -func (s *ERC721CallsTestSuite) TearDownSuite() {} -func (s *ERC721CallsTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) - s.clientMock = mock_calls.NewMockClientDispatcher(s.gomockController) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.erc721ContractAddress = common.HexToAddress("0x9A0E6F91E6031C08326764655432f8F9c180fBa0") - s.erc721Contract = erc721.NewErc721Contract(s.mockContractCallerDispatcherClient, s.erc721ContractAddress, s.mockTransactor) -} -func (s *ERC721CallsTestSuite) TearDownTest() {} - -func (s *ERC721CallsTestSuite) TestERC721Contract_PackMethod_ValidRequest_Success() { - res, err := s.erc721Contract.PackMethod("approve", common.Address{}, big.NewInt(10)) - s.Equal( - common.Hex2Bytes("095ea7b30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a"), - res, - ) - s.Nil(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_PackMethod_InvalidNumberOfArguments_Fail() { - res, err := s.erc721Contract.PackMethod("approve", common.Address{}) - s.Equal( - []byte{}, - res, - ) - s.Error(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_PackMethod_NotExistingMethod_Fail() { - res, err := s.erc721Contract.PackMethod("fail", common.Address{}) - s.Equal( - []byte{}, - res, - ) - s.Error(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_UnpackResult_InvalidData_Fail() { - rawData := common.Hex2Bytes("095ea7b30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a") - res, err := s.erc721Contract.UnpackResult("approve", rawData) - s.NotNil(err) - s.Nil(res) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_Approve_Success() { - s.mockTransactor.EXPECT().Transact( - &s.erc721ContractAddress, - gomock.Any(), - transactor.TransactOptions{}, - ).Return(&common.Hash{}, nil) - - res, err := s.erc721Contract.Approve( - big.NewInt(1), - common.HexToAddress("0x9FD320F352539E8A0E9be4B63c91395575420Aac"), - transactor.TransactOptions{}, - ) - - s.Nil(err) - s.NotNil(res) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_AddMinter_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25}, nil) - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3}, nil) - res, err := s.erc721Contract.AddMinter(common.HexToAddress(testInteractorAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3}, - res, - ) - s.Nil(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_MintTokens_Success() { - s.mockTransactor.EXPECT().Transact( - gomock.Any(), - gomock.Any(), - gomock.Any(), - ).Return(&common.Hash{1, 2, 3, 4, 5}, nil) - res, err := s.erc721Contract.Mint(big.NewInt(5), "token_uri", common.HexToAddress(testInteractorAddress), transactor.DefaultTransactionOptions) - s.Equal( - &common.Hash{1, 2, 3, 4, 5}, - res, - ) - s.Nil(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_Owner_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50}, nil) - res, err := s.erc721Contract.MinterRole() - s.Equal( - [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50}, - res, - ) - s.Nil(err) -} - -func (s *ERC721CallsTestSuite) TestERC721Contract_MinterRole_Success() { - s.mockContractCallerDispatcherClient.EXPECT().From().Return(common.HexToAddress(testInteractorAddress)) - s.mockContractCallerDispatcherClient.EXPECT().CallContract( - gomock.Any(), - gomock.Any(), - nil, - ).Return([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, nil) - res, err := s.erc721Contract.MinterRole() - s.Equal( - [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, - res, - ) - s.Nil(err) -} diff --git a/chains/evm/calls/contracts/forwarder/forwarder.go b/chains/evm/calls/contracts/forwarder/forwarder.go deleted file mode 100644 index 2fee4bb7..00000000 --- a/chains/evm/calls/contracts/forwarder/forwarder.go +++ /dev/null @@ -1,54 +0,0 @@ -package forwarder - -import ( - "math/big" - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" -) - -// ForwarderContract matches an instance of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/MinimalForwarder.sol -type ForwarderContract struct { - contracts.Contract -} - -type ForwardRequest struct { - From common.Address - To common.Address - Value *big.Int - Gas *big.Int - Nonce *big.Int - Data []byte -} - -func NewForwarderContract( - client calls.ContractCallerDispatcher, - contractAddress common.Address, -) *ForwarderContract { - a, _ := abi.JSON(strings.NewReader(consts.MinimalForwarderABI)) - b := common.FromHex(consts.MinimalForwarderBin) - return &ForwarderContract{ - contracts.NewContract(contractAddress, a, b, client, nil), - } -} - -func (c *ForwarderContract) GetNonce(from common.Address) (*big.Int, error) { - res, err := c.CallContract("getNonce", from) - if err != nil { - return nil, err - } - - nonce := abi.ConvertType(res[0], new(big.Int)).(*big.Int) - return nonce, nil -} - -func (c *ForwarderContract) PrepareExecute( - forwardReq ForwardRequest, - sig []byte, -) ([]byte, error) { - return c.ABI.Pack("execute", forwardReq, sig) -} diff --git a/chains/evm/calls/contracts/generic/genericHandler.go b/chains/evm/calls/contracts/generic/genericHandler.go deleted file mode 100644 index c52ccd4f..00000000 --- a/chains/evm/calls/contracts/generic/genericHandler.go +++ /dev/null @@ -1,26 +0,0 @@ -package generic - -import ( - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" -) - -type GenericHandlerContract struct { - contracts.Contract -} - -func NewGenericHandlerContract( - client calls.ContractCallerDispatcher, - assetStoreContractAddress common.Address, - transactor transactor.Transactor, -) *GenericHandlerContract { - a, _ := abi.JSON(strings.NewReader(consts.GenericHandlerABI)) - b := common.FromHex(consts.GenericHandlerBin) - return &GenericHandlerContract{contracts.NewContract(assetStoreContractAddress, a, b, client, transactor)} -} diff --git a/chains/evm/calls/events/events.go b/chains/evm/calls/events/events.go index edf6409d..81099c03 100644 --- a/chains/evm/calls/events/events.go +++ b/chains/evm/calls/events/events.go @@ -13,10 +13,7 @@ func (es EventSig) GetTopic() common.Hash { } const ( - DepositSig EventSig = "Deposit(uint8,bytes32,uint64,address,bytes,bytes)" - ThresholdChangedSig EventSig = "RelayerThresholdChanged(uint256)" - ProposalEventSig EventSig = "ProposalEvent(uint8,uint64,uint8,bytes32)" - ProposalVoteSig EventSig = "ProposalVote(uint8,uint64,uint8,bytes32)" + DepositSig EventSig = "Deposit(uint8,bytes32,uint64,address,bytes,bytes)" ) // Deposit struct holds event data with all necessary parameters and a handler response diff --git a/chains/evm/calls/events/listener.go b/chains/evm/calls/events/listener.go deleted file mode 100644 index 12ac8297..00000000 --- a/chains/evm/calls/events/listener.go +++ /dev/null @@ -1,64 +0,0 @@ -package events - -import ( - "context" - "math/big" - "strings" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - ethTypes "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" -) - -type ChainClient interface { - FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]ethTypes.Log, error) -} - -type Listener struct { - client ChainClient - abi abi.ABI -} - -func NewListener(client ChainClient) *Listener { - abi, _ := abi.JSON(strings.NewReader(consts.BridgeABI)) - return &Listener{ - client: client, - abi: abi, - } -} - -func (l *Listener) FetchDeposits(ctx context.Context, contractAddress common.Address, startBlock *big.Int, endBlock *big.Int) ([]*Deposit, error) { - logs, err := l.client.FetchEventLogs(ctx, contractAddress, string(DepositSig), startBlock, endBlock) - if err != nil { - return nil, err - } - deposits := make([]*Deposit, 0) - - for _, dl := range logs { - d, err := l.UnpackDeposit(l.abi, dl.Data) - if err != nil { - log.Error().Msgf("failed unpacking deposit event log: %v", err) - continue - } - - d.SenderAddress = common.BytesToAddress(dl.Topics[1].Bytes()) - log.Debug().Msgf("Found deposit log in block: %d, TxHash: %s, contractAddress: %s, sender: %s", dl.BlockNumber, dl.TxHash, dl.Address, d.SenderAddress) - - deposits = append(deposits, d) - } - - return deposits, nil -} - -func (l *Listener) UnpackDeposit(abi abi.ABI, data []byte) (*Deposit, error) { - var dl Deposit - - err := abi.UnpackIntoInterface(&dl, "Deposit", data) - if err != nil { - return &Deposit{}, err - } - - return &dl, nil -} diff --git a/chains/evm/calls/events/listener_test.go b/chains/evm/calls/events/listener_test.go deleted file mode 100644 index 2d0ae7a6..00000000 --- a/chains/evm/calls/events/listener_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package events_test - -import ( - "encoding/hex" - "strings" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -var ( - logData = "00000000000000000000000000000000000000000000000000000000000000020000000000000000000000d606a00c1a39da53ea7bb3ab570bbe40b156eb6600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" -) - -type EvmClientTestSuite struct { - suite.Suite - gomockController *gomock.Controller - listener events.Listener -} - -func TestRunEvmClientTestSuite(t *testing.T) { - suite.Run(t, new(EvmClientTestSuite)) -} - -func (s *EvmClientTestSuite) SetupSuite() { - s.gomockController = gomock.NewController(s.T()) - s.listener = *events.NewListener(nil) -} - -func (s *EvmClientTestSuite) TestUnpackDepositEventLogFailedUnpack() { - abi, _ := abi.JSON(strings.NewReader(consts.BridgeABI)) - _, err := s.listener.UnpackDeposit(abi, []byte("invalid")) - s.NotNil(err) -} - -func (s *EvmClientTestSuite) TestUnpackDepositEventLogValidData() { - abi, _ := abi.JSON(strings.NewReader(consts.BridgeABI)) - logDataBytes, _ := hex.DecodeString(logData) - expectedRID := types.ResourceID(types.ResourceID{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd6, 0x6, 0xa0, 0xc, 0x1a, 0x39, 0xda, 0x53, 0xea, 0x7b, 0xb3, 0xab, 0x57, 0xb, 0xbe, 0x40, 0xb1, 0x56, 0xeb, 0x66, 0x0}) - dl, err := s.listener.UnpackDeposit(abi, logDataBytes) - s.Nil(err) - s.Equal(dl.SenderAddress.String(), "0x0000000000000000000000000000000000000000") - s.Equal(dl.DepositNonce, uint64(1)) - s.Equal(dl.DestinationDomainID, uint8(2)) - s.Equal(dl.ResourceID, expectedRID) - s.Equal(dl.HandlerResponse, []byte{}) -} diff --git a/chains/evm/calls/evmgaspricer/gas-pricer.go b/chains/evm/calls/gas/gas-pricer.go similarity index 100% rename from chains/evm/calls/evmgaspricer/gas-pricer.go rename to chains/evm/calls/gas/gas-pricer.go diff --git a/chains/evm/calls/evmgaspricer/london.go b/chains/evm/calls/gas/london.go similarity index 100% rename from chains/evm/calls/evmgaspricer/london.go rename to chains/evm/calls/gas/london.go diff --git a/chains/evm/calls/evmgaspricer/london_test.go b/chains/evm/calls/gas/london_test.go similarity index 100% rename from chains/evm/calls/evmgaspricer/london_test.go rename to chains/evm/calls/gas/london_test.go diff --git a/chains/evm/calls/evmgaspricer/mock/gas-pricer.go b/chains/evm/calls/gas/mock/gas-pricer.go similarity index 100% rename from chains/evm/calls/evmgaspricer/mock/gas-pricer.go rename to chains/evm/calls/gas/mock/gas-pricer.go diff --git a/chains/evm/calls/evmgaspricer/static.go b/chains/evm/calls/gas/static.go similarity index 100% rename from chains/evm/calls/evmgaspricer/static.go rename to chains/evm/calls/gas/static.go diff --git a/chains/evm/calls/evmgaspricer/static_test.go b/chains/evm/calls/gas/static_test.go similarity index 100% rename from chains/evm/calls/evmgaspricer/static_test.go rename to chains/evm/calls/gas/static_test.go diff --git a/chains/evm/calls/evmtransaction/evm-tx.go b/chains/evm/calls/transaction/evm-tx.go similarity index 100% rename from chains/evm/calls/evmtransaction/evm-tx.go rename to chains/evm/calls/transaction/evm-tx.go diff --git a/chains/evm/calls/evmtransaction/evm-tx_test.go b/chains/evm/calls/transaction/evm-tx_test.go similarity index 100% rename from chains/evm/calls/evmtransaction/evm-tx_test.go rename to chains/evm/calls/transaction/evm-tx_test.go diff --git a/chains/evm/calls/transactor/itx/itx.go b/chains/evm/calls/transactor/itx/itx.go deleted file mode 100644 index d33bb559..00000000 --- a/chains/evm/calls/transactor/itx/itx.go +++ /dev/null @@ -1,175 +0,0 @@ -package itx - -import ( - "context" - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" -) - -var ( - DefaultTransactionOptions = transactor.TransactOptions{ - GasLimit: 400000, - GasPrice: big.NewInt(1), - Priority: 1, // slow - Value: big.NewInt(0), - } -) - -// itx only supports priority as string - we use uint8 to save on data -// currently we support only "slow" and "fast" - that's why 2 (medium) defaults to slow -var ItxTxPriorities = map[uint8]string{ - 1: "slow", - 2: "slow", - 3: "fast", -} - -type RelayTx struct { - to common.Address - data []byte - opts transactor.TransactOptions -} - -type SignedRelayTx struct { - *RelayTx - txID common.Hash - sig []byte -} - -type RelayCaller interface { - CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error -} - -type Forwarder interface { - ForwarderAddress() common.Address - ChainId() *big.Int - UnsafeNonce() (*big.Int, error) - UnsafeIncreaseNonce() - LockNonce() - UnlockNonce() - ForwarderData(to *common.Address, data []byte, opts transactor.TransactOptions) ([]byte, error) -} - -type Signer interface { - CommonAddress() common.Address - Sign(digestHash []byte) ([]byte, error) -} - -type ITXTransactor struct { - forwarder Forwarder - relayCaller RelayCaller - signer Signer -} - -func NewITXTransactor(relayCaller RelayCaller, forwarder Forwarder, signer Signer) *ITXTransactor { - return &ITXTransactor{ - relayCaller: relayCaller, - forwarder: forwarder, - signer: signer, - } -} - -// Transact packs tx into a forwarded transaction, signs it and sends the relayed transaction to Infura ITX -func (itx *ITXTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) { - err := transactor.MergeTransactionOptions(&opts, &DefaultTransactionOptions) - if err != nil { - return nil, err - } - opts.ChainID = itx.forwarder.ChainId() - - defer itx.forwarder.UnlockNonce() - itx.forwarder.LockNonce() - - nonce, err := itx.forwarder.UnsafeNonce() - if err != nil { - return nil, err - } - opts.Nonce = nonce - - forwarderData, err := itx.forwarder.ForwarderData(to, data, opts) - if err != nil { - return nil, err - } - - // increase gas limit because of forwarder overhead - opts.GasLimit = opts.GasLimit * 11 / 10 - signedTx, err := itx.signRelayTx(&RelayTx{ - to: itx.forwarder.ForwarderAddress(), - data: forwarderData, - opts: opts, - }) - if err != nil { - return nil, err - } - - h, err := itx.sendTransaction(context.Background(), signedTx) - if err != nil { - return nil, err - } - - itx.forwarder.UnsafeIncreaseNonce() - return &h, nil -} - -func (itx *ITXTransactor) signRelayTx(tx *RelayTx) (*SignedRelayTx, error) { - uint256Type, _ := abi.NewType("uint256", "uint256", nil) - addressType, _ := abi.NewType("address", "address", nil) - bytesType, _ := abi.NewType("bytes", "bytes", nil) - stringType, _ := abi.NewType("string", "string", nil) - arguments := abi.Arguments{ - {Type: addressType}, - {Type: bytesType}, - {Type: uint256Type}, - {Type: uint256Type}, - {Type: stringType}, - } - packed, err := arguments.Pack( - tx.to, - tx.data, - big.NewInt(int64(tx.opts.GasLimit)), - tx.opts.ChainID, - ItxTxPriorities[tx.opts.Priority], - ) - if err != nil { - return nil, err - } - - txID := crypto.Keccak256Hash(packed) - msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(txID), string(txID.Bytes())) - hash := crypto.Keccak256Hash([]byte(msg)) - sig, err := itx.signer.Sign(hash.Bytes()) - if err != nil { - return nil, err - } - - return &SignedRelayTx{ - RelayTx: tx, - sig: sig, - txID: txID, - }, nil -} - -func (itx *ITXTransactor) sendTransaction(ctx context.Context, signedTx *SignedRelayTx) (common.Hash, error) { - sig := "0x" + common.Bytes2Hex(signedTx.sig) - txArg := map[string]interface{}{ - "to": &signedTx.to, - "data": "0x" + common.Bytes2Hex(signedTx.data), - "gas": fmt.Sprint(signedTx.opts.GasLimit), - "schedule": ItxTxPriorities[signedTx.opts.Priority], - } - - resp := struct { - RelayTransactionHash hexutil.Bytes - }{} - err := itx.relayCaller.CallContext(ctx, &resp, "relay_sendTransaction", txArg, sig) - if err != nil { - return common.Hash{}, err - } - - return common.HexToHash(resp.RelayTransactionHash.String()), nil -} diff --git a/chains/evm/calls/transactor/itx/itx_test.go b/chains/evm/calls/transactor/itx/itx_test.go deleted file mode 100644 index 6b2cfb3c..00000000 --- a/chains/evm/calls/transactor/itx/itx_test.go +++ /dev/null @@ -1,204 +0,0 @@ -package itx_test - -import ( - "context" - "errors" - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx" - mock_itx "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx/mock" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type TransactTestSuite struct { - suite.Suite - forwarder *mock_itx.MockForwarder - relayCaller *mock_itx.MockRelayCaller - transactor *itx.ITXTransactor - kp *secp256k1.Keypair -} - -func TestRunTransactTestSuite(t *testing.T) { - suite.Run(t, new(TransactTestSuite)) -} - -func (s *TransactTestSuite) SetupSuite() {} -func (s *TransactTestSuite) TearDownSuite() {} -func (s *TransactTestSuite) SetupTest() { - gomockController := gomock.NewController(s.T()) - s.kp, _ = secp256k1.NewKeypairFromPrivateKey(common.Hex2Bytes("e8e0f5427111dee651e63a6f1029da6929ebf7d2d61cefaf166cebefdf2c012e")) - s.forwarder = mock_itx.NewMockForwarder(gomockController) - s.relayCaller = mock_itx.NewMockRelayCaller(gomockController) - s.transactor = itx.NewITXTransactor(s.relayCaller, s.forwarder, s.kp) - s.forwarder.EXPECT().ChainId().Return(big.NewInt(5)) -} -func (s *TransactTestSuite) TearDownTest() {} - -func (s *TransactTestSuite) TestTransact_FailedFetchingNonce() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(nil, errors.New("error")) - - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - opts := transactor.TransactOptions{} - _, err := s.transactor.Transact(&to, data, opts) - - s.NotNil(err) -} - -func (s *TransactTestSuite) TestTransact_FailedFetchingForwarderData() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - opts := transactor.TransactOptions{ - GasLimit: 200000, - GasPrice: big.NewInt(1), - Priority: 1, // slow - Value: big.NewInt(0), - ChainID: big.NewInt(5), - Nonce: big.NewInt(1), - } - s.forwarder.EXPECT().ForwarderData(&to, data, opts).Return(nil, errors.New("error")) - - _, err := s.transactor.Transact(&to, data, opts) - - s.NotNil(err) -} - -func (s *TransactTestSuite) TestTransact_FailedSendingTransaction() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - opts := transactor.TransactOptions{ - GasLimit: 200000, - GasPrice: big.NewInt(1), - Priority: 1, // slow - Value: big.NewInt(0), - ChainID: big.NewInt(5), - Nonce: big.NewInt(1), - } - s.forwarder.EXPECT().ForwarderData(&to, data, opts).Return([]byte{}, nil) - s.forwarder.EXPECT().ForwarderAddress().Return(to) - s.relayCaller.EXPECT().CallContext( - context.Background(), - gomock.Any(), - "relay_sendTransaction", - gomock.Any(), - gomock.Any(), - ).Return(errors.New("error")) - - _, err := s.transactor.Transact(&to, data, opts) - - s.NotNil(err) -} - -func (s *TransactTestSuite) TestTransact_SuccessfulSend() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) - s.forwarder.EXPECT().UnsafeIncreaseNonce() - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - opts := transactor.TransactOptions{ - GasLimit: 200000, - GasPrice: big.NewInt(1), - Priority: 1, // slow - Value: big.NewInt(0), - ChainID: big.NewInt(5), - Nonce: big.NewInt(1), - } - expectedSig := "0x68ad089b7daeabcdd76520377822cc32eba0b41ea702358bc8f7249bc296d408781eb60366a3bb6ad9fc62dca08bdf440a7c4f02e3680aa0b477a2dd5423d5af01" - - s.forwarder.EXPECT().ForwarderData(&to, data, opts).Return([]byte{}, nil) - s.forwarder.EXPECT().ForwarderAddress().Return(to) - s.relayCaller.EXPECT().CallContext( - context.Background(), - gomock.Any(), - "relay_sendTransaction", - gomock.Any(), - expectedSig, - ).Return(nil) - - hash, err := s.transactor.Transact(&to, data, opts) - - s.Nil(err) - s.NotNil(hash) -} - -func (s *TransactTestSuite) TestTransact_SuccessfulSendWithDefaultOpts_WithSetPriority() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) - s.forwarder.EXPECT().UnsafeIncreaseNonce() - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - expectedOpts := transactor.TransactOptions{ - GasLimit: 400000, - GasPrice: big.NewInt(1), - Priority: 2, // fast - Value: big.NewInt(0), - ChainID: big.NewInt(5), - Nonce: big.NewInt(1), - } - expectedSig := "0x97e8845b060718b04c710e2e4bd786d80bc5d5843f41b0b461d756f5c5a5865f32fe1d82f838de6ac212d7caaf7e7f469510a75d3803173f5b5c21fec62a989900" - - s.forwarder.EXPECT().ForwarderData(&to, data, expectedOpts).Return([]byte{}, nil) - s.forwarder.EXPECT().ForwarderAddress().Return(to) - s.relayCaller.EXPECT().CallContext( - context.Background(), - gomock.Any(), - "relay_sendTransaction", - gomock.Any(), - expectedSig, - ).Return(nil) - - hash, err := s.transactor.Transact(&to, data, transactor.TransactOptions{ - Priority: 2, - }) - - s.Nil(err) - s.NotNil(hash) -} - -func (s *TransactTestSuite) TestTransact_SuccessfulSendWithDefaultOpts_WithDefaultPriority() { - s.forwarder.EXPECT().LockNonce() - s.forwarder.EXPECT().UnlockNonce() - s.forwarder.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) - s.forwarder.EXPECT().UnsafeIncreaseNonce() - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - data := []byte{} - expectedOpts := transactor.TransactOptions{ - GasLimit: 400000, - GasPrice: big.NewInt(1), - Priority: 1, // slow - Value: big.NewInt(0), - ChainID: big.NewInt(5), - Nonce: big.NewInt(1), - } - expectedSig := "0x97e8845b060718b04c710e2e4bd786d80bc5d5843f41b0b461d756f5c5a5865f32fe1d82f838de6ac212d7caaf7e7f469510a75d3803173f5b5c21fec62a989900" - - s.forwarder.EXPECT().ForwarderData(&to, data, expectedOpts).Return([]byte{}, nil) - s.forwarder.EXPECT().ForwarderAddress().Return(to) - s.relayCaller.EXPECT().CallContext( - context.Background(), - gomock.Any(), - "relay_sendTransaction", - gomock.Any(), - expectedSig, - ).Return(nil) - - hash, err := s.transactor.Transact(&to, data, transactor.TransactOptions{}) - - s.Nil(err) - s.NotNil(hash) -} diff --git a/chains/evm/calls/transactor/itx/minimalForwarder.go b/chains/evm/calls/transactor/itx/minimalForwarder.go deleted file mode 100644 index ad9f8260..00000000 --- a/chains/evm/calls/transactor/itx/minimalForwarder.go +++ /dev/null @@ -1,197 +0,0 @@ -package itx - -import ( - "fmt" - "math/big" - "sync" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - signer "github.com/ethereum/go-ethereum/signer/core" - "github.com/rs/zerolog/log" -) - -type ForwarderContract interface { - GetNonce(from common.Address) (*big.Int, error) - PrepareExecute(forwardReq forwarder.ForwardRequest, sig []byte) ([]byte, error) - ContractAddress() *common.Address -} - -type NonceStorer interface { - StoreNonce(chainID *big.Int, nonce *big.Int) error - GetNonce(chainID *big.Int) (*big.Int, error) -} - -type MinimalForwarder struct { - signer Signer - nonce *big.Int - nonceLock sync.Mutex - chainID *big.Int - forwarderContract ForwarderContract - nonceStore NonceStorer -} - -// NewMinimalForwarder creates an instance of MinimalForwarder -func NewMinimalForwarder(chainID *big.Int, signer Signer, forwarderContract ForwarderContract, nonceStore NonceStorer) *MinimalForwarder { - return &MinimalForwarder{ - chainID: chainID, - signer: signer, - forwarderContract: forwarderContract, - nonceStore: nonceStore, - } -} - -// LockNonce locks mutex for nonce to prevent nonce duplication -func (c *MinimalForwarder) LockNonce() { - c.nonceLock.Lock() -} - -// UnlockNonce unlocks mutext for nonce and stores nonce into storage. -// -// Nonce is stored on unlock, because current nonce should always be the correct one when unlocking. -func (c *MinimalForwarder) UnlockNonce() { - err := c.nonceStore.StoreNonce(c.chainID, c.nonce) - if err != nil { - log.Error().Err(fmt.Errorf("failed storing nonce: %v", err)) - } - - c.nonceLock.Unlock() -} - -// UnsafeNonce returns current valid nonce for a forwarded transaction. -// -// If nonce is not set, looks for nonce in storage and on contract and returns the -// higher one. Nonce in storage can be higher if there are pending transactions after -// relayer has been manually shutdown. -func (c *MinimalForwarder) UnsafeNonce() (*big.Int, error) { - if c.nonce == nil { - storedNonce, err := c.nonceStore.GetNonce(c.chainID) - if err != nil { - return nil, err - } - from := c.signer.CommonAddress() - contractNonce, err := c.forwarderContract.GetNonce(from) - if err != nil { - return nil, err - } - - var nonce *big.Int - if storedNonce.Cmp(contractNonce) >= 0 { - nonce = storedNonce - } else { - nonce = contractNonce - } - - c.nonce = nonce - } - - nonce := big.NewInt(c.nonce.Int64()) - return nonce, nil -} - -// UnsafeIncreaseNonce increases nonce value by 1. Should be used -// while nonce is locked. -func (c *MinimalForwarder) UnsafeIncreaseNonce() { - c.nonce.Add(c.nonce, big.NewInt(1)) -} - -func (c *MinimalForwarder) ForwarderAddress() common.Address { - return *c.forwarderContract.ContractAddress() -} - -func (c *MinimalForwarder) ChainId() *big.Int { - return c.chainID -} - -// ForwarderData returns ABI packed and signed byte data for a forwarded transaction -func (c *MinimalForwarder) ForwarderData(to *common.Address, data []byte, opts transactor.TransactOptions) ([]byte, error) { - from := c.signer.CommonAddress().Hex() - forwarderHash, err := c.typedHash( - from, - to.String(), - data, - math.NewHexOrDecimal256(opts.Value.Int64()), - math.NewHexOrDecimal256(int64(opts.GasLimit)), - opts.Nonce, - c.ForwarderAddress().Hex(), - ) - if err != nil { - return nil, err - } - - sig, err := c.signer.Sign(forwarderHash) - if err != nil { - return nil, err - } - sig[64] += 27 // Transform V from 0/1 to 27/28 - - forwardReq := forwarder.ForwardRequest{ - From: common.HexToAddress(from), - To: *to, - Value: opts.Value, - Gas: big.NewInt(int64(opts.GasLimit)), - Nonce: opts.Nonce, - Data: data, - } - return c.forwarderContract.PrepareExecute(forwardReq, sig) -} - -func (c *MinimalForwarder) typedHash( - from, to string, - data []byte, - value, gas *math.HexOrDecimal256, - nonce *big.Int, - verifyingContract string, -) ([]byte, error) { - chainId := math.NewHexOrDecimal256(c.chainID.Int64()) - typedData := signer.TypedData{ - Types: signer.Types{ - "EIP712Domain": []signer.Type{ - {Name: "name", Type: "string"}, - {Name: "version", Type: "string"}, - {Name: "chainId", Type: "uint256"}, - {Name: "verifyingContract", Type: "address"}, - }, - "ForwardRequest": []signer.Type{ - {Name: "from", Type: "address"}, - {Name: "to", Type: "address"}, - {Name: "value", Type: "uint256"}, - {Name: "gas", Type: "uint256"}, - {Name: "nonce", Type: "uint256"}, - {Name: "data", Type: "bytes"}, - }, - }, - PrimaryType: "ForwardRequest", - Domain: signer.TypedDataDomain{ - Name: "Forwarder", - ChainId: chainId, - Version: "0.0.1", - VerifyingContract: verifyingContract, - }, - Message: signer.TypedDataMessage{ - "from": from, - "to": to, - "value": value, - "gas": gas, - "data": data, - "nonce": math.NewHexOrDecimal256(nonce.Int64()), - }, - } - - domainSeparator, err := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) - if err != nil { - return nil, err - } - - typedDataHash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message) - if err != nil { - return nil, err - } - - rawData := []byte(fmt.Sprintf("\x19\x01%s%s", string(domainSeparator), string(typedDataHash))) - return crypto.Keccak256(rawData), nil -} diff --git a/chains/evm/calls/transactor/itx/minimalForwarder_test.go b/chains/evm/calls/transactor/itx/minimalForwarder_test.go deleted file mode 100644 index c879e66b..00000000 --- a/chains/evm/calls/transactor/itx/minimalForwarder_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package itx_test - -import ( - "errors" - "math/big" - "strings" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx" - mock_forwarder "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/itx/mock" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type MinimalForwarderTestSuite struct { - suite.Suite - minimalForwarder *itx.MinimalForwarder - forwarderContract *mock_forwarder.MockForwarderContract - nonceStore *mock_forwarder.MockNonceStorer - kp *secp256k1.Keypair -} - -func TestRunMinimalForwarderTestSuite(t *testing.T) { - suite.Run(t, new(MinimalForwarderTestSuite)) -} - -func (s *MinimalForwarderTestSuite) SetupSuite() {} -func (s *MinimalForwarderTestSuite) TearDownSuite() {} -func (s *MinimalForwarderTestSuite) SetupTest() { - gomockController := gomock.NewController(s.T()) - s.kp, _ = secp256k1.NewKeypairFromPrivateKey(common.Hex2Bytes("e8e0f5427111dee651e63a6f1029da6929ebf7d2d61cefaf166cebefdf2c012e")) - s.forwarderContract = mock_forwarder.NewMockForwarderContract(gomockController) - s.nonceStore = mock_forwarder.NewMockNonceStorer(gomockController) - s.minimalForwarder = itx.NewMinimalForwarder(big.NewInt(5), s.kp, s.forwarderContract, s.nonceStore) -} -func (s *MinimalForwarderTestSuite) TearDownTest() {} - -func (s *MinimalForwarderTestSuite) TestChainID() { - chainID := s.minimalForwarder.ChainId() - - s.Equal(big.NewInt(5), chainID) -} - -func (s *MinimalForwarderTestSuite) TestForwarderData_ValidData() { - to := common.HexToAddress("0x04005C8A516292af163b1AFe3D855b9f4f4631B5") - forwarderAddress := common.HexToAddress("0x5eDF97800a15E23F386785a2D486bA3E43545210") - s.forwarderContract.EXPECT().ContractAddress().Return(&forwarderAddress) - s.forwarderContract.EXPECT().PrepareExecute(gomock.Any(), gomock.Any()).DoAndReturn(func( - forwardReq forwarder.ForwardRequest, - sig []byte, - ) ([]byte, error) { - a, _ := abi.JSON(strings.NewReader(consts.MinimalForwarderABI)) - return a.Pack("execute", forwardReq, sig) - }) - - data, err := s.minimalForwarder.ForwarderData(&to, []byte{}, transactor.TransactOptions{ - Value: big.NewInt(0), - GasLimit: 200000, - Nonce: big.NewInt(1), - }) - - expectedForwarderData := "47153f82000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000007d0e20299178a8d0a8e7410726acc8e338119b8600000000000000000000000004005c8a516292af163b1afe3d855b9f4f4631b500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030d40000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410bdb633d2bf0583c34749616155595791c7b7ace433ffcbb1dad606f31a806ed1f8e783b71cd3253a44766db37956bc36cef943707a0f0ab567f1620f145307e1b00000000000000000000000000000000000000000000000000000000000000" - s.Nil(err) - s.Equal(common.Bytes2Hex(data), expectedForwarderData) -} - -func (s *MinimalForwarderTestSuite) TestUnsafeNonce_ErrorFetchingFromStore() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(nil, errors.New("error")) - - _, err := s.minimalForwarder.UnsafeNonce() - - s.NotNil(err) -} - -func (s *MinimalForwarderTestSuite) TestNextNonce_ErrorFetchingFromContract() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(big.NewInt(1), nil) - s.forwarderContract.EXPECT().GetNonce(common.HexToAddress(s.kp.Address())).Return(nil, errors.New("error")) - - _, err := s.minimalForwarder.UnsafeNonce() - - s.NotNil(err) -} - -func (s *MinimalForwarderTestSuite) TestNextNonce_ContractNonceHigher() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(big.NewInt(1), nil) - s.forwarderContract.EXPECT().GetNonce(common.HexToAddress(s.kp.Address())).Return(big.NewInt(2), nil) - - nonce, err := s.minimalForwarder.UnsafeNonce() - - s.Nil(err) - s.Equal(nonce, big.NewInt(2)) -} - -func (s *MinimalForwarderTestSuite) TestNextNonce_StoredNonceHigher() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(big.NewInt(3), nil) - s.forwarderContract.EXPECT().GetNonce(common.HexToAddress(s.kp.Address())).Return(big.NewInt(2), nil) - - nonce, err := s.minimalForwarder.UnsafeNonce() - - s.Nil(err) - s.Equal(nonce, big.NewInt(3)) -} - -func (s *MinimalForwarderTestSuite) TestUnsafeIncreaseNonce_NonceIcremented() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(big.NewInt(3), nil) - s.forwarderContract.EXPECT().GetNonce(common.HexToAddress(s.kp.Address())).Return(big.NewInt(2), nil) - nonce1, err := s.minimalForwarder.UnsafeNonce() - s.Nil(err) - s.Equal(nonce1, big.NewInt(3)) - - s.minimalForwarder.UnsafeIncreaseNonce() - nonce2, err := s.minimalForwarder.UnsafeNonce() - - s.Nil(err) - s.Equal(nonce2, big.NewInt(4)) -} - -func (s *MinimalForwarderTestSuite) TestUnlockNonce_FailedStore_NonceUnlocked() { - s.nonceStore.EXPECT().GetNonce(big.NewInt(5)).Return(big.NewInt(3), nil) - s.forwarderContract.EXPECT().GetNonce(common.HexToAddress(s.kp.Address())).Return(big.NewInt(2), nil) - oldNonce, err := s.minimalForwarder.UnsafeNonce() - s.Nil(err) - s.Equal(oldNonce, big.NewInt(3)) - - s.minimalForwarder.LockNonce() - - s.nonceStore.EXPECT().StoreNonce(big.NewInt(5), big.NewInt(3)).Return(errors.New("error")) - s.minimalForwarder.UnlockNonce() - - s.minimalForwarder.UnsafeIncreaseNonce() - nonce, err := s.minimalForwarder.UnsafeNonce() - - s.Nil(err) - s.Equal(nonce, big.NewInt(4)) -} diff --git a/chains/evm/calls/transactor/itx/mock/itx.go b/chains/evm/calls/transactor/itx/mock/itx.go deleted file mode 100644 index bac29f91..00000000 --- a/chains/evm/calls/transactor/itx/mock/itx.go +++ /dev/null @@ -1,226 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/calls/transactor/itx/itx.go - -// Package mock_itx is a generated GoMock package. -package mock_itx - -import ( - context "context" - big "math/big" - reflect "reflect" - - transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - common "github.com/ethereum/go-ethereum/common" - gomock "github.com/golang/mock/gomock" -) - -// MockRelayCaller is a mock of RelayCaller interface. -type MockRelayCaller struct { - ctrl *gomock.Controller - recorder *MockRelayCallerMockRecorder -} - -// MockRelayCallerMockRecorder is the mock recorder for MockRelayCaller. -type MockRelayCallerMockRecorder struct { - mock *MockRelayCaller -} - -// NewMockRelayCaller creates a new mock instance. -func NewMockRelayCaller(ctrl *gomock.Controller) *MockRelayCaller { - mock := &MockRelayCaller{ctrl: ctrl} - mock.recorder = &MockRelayCallerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockRelayCaller) EXPECT() *MockRelayCallerMockRecorder { - return m.recorder -} - -// CallContext mocks base method. -func (m *MockRelayCaller) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, result, method} - for _, a := range args { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "CallContext", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// CallContext indicates an expected call of CallContext. -func (mr *MockRelayCallerMockRecorder) CallContext(ctx, result, method interface{}, args ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, result, method}, args...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContext", reflect.TypeOf((*MockRelayCaller)(nil).CallContext), varargs...) -} - -// MockForwarder is a mock of Forwarder interface. -type MockForwarder struct { - ctrl *gomock.Controller - recorder *MockForwarderMockRecorder -} - -// MockForwarderMockRecorder is the mock recorder for MockForwarder. -type MockForwarderMockRecorder struct { - mock *MockForwarder -} - -// NewMockForwarder creates a new mock instance. -func NewMockForwarder(ctrl *gomock.Controller) *MockForwarder { - mock := &MockForwarder{ctrl: ctrl} - mock.recorder = &MockForwarderMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockForwarder) EXPECT() *MockForwarderMockRecorder { - return m.recorder -} - -// ChainId mocks base method. -func (m *MockForwarder) ChainId() *big.Int { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ChainId") - ret0, _ := ret[0].(*big.Int) - return ret0 -} - -// ChainId indicates an expected call of ChainId. -func (mr *MockForwarderMockRecorder) ChainId() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainId", reflect.TypeOf((*MockForwarder)(nil).ChainId)) -} - -// ForwarderAddress mocks base method. -func (m *MockForwarder) ForwarderAddress() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ForwarderAddress") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// ForwarderAddress indicates an expected call of ForwarderAddress. -func (mr *MockForwarderMockRecorder) ForwarderAddress() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForwarderAddress", reflect.TypeOf((*MockForwarder)(nil).ForwarderAddress)) -} - -// ForwarderData mocks base method. -func (m *MockForwarder) ForwarderData(to *common.Address, data []byte, opts transactor.TransactOptions) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ForwarderData", to, data, opts) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ForwarderData indicates an expected call of ForwarderData. -func (mr *MockForwarderMockRecorder) ForwarderData(to, data, opts interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForwarderData", reflect.TypeOf((*MockForwarder)(nil).ForwarderData), to, data, opts) -} - -// LockNonce mocks base method. -func (m *MockForwarder) LockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "LockNonce") -} - -// LockNonce indicates an expected call of LockNonce. -func (mr *MockForwarderMockRecorder) LockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockForwarder)(nil).LockNonce)) -} - -// UnlockNonce mocks base method. -func (m *MockForwarder) UnlockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UnlockNonce") -} - -// UnlockNonce indicates an expected call of UnlockNonce. -func (mr *MockForwarderMockRecorder) UnlockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockForwarder)(nil).UnlockNonce)) -} - -// UnsafeIncreaseNonce mocks base method. -func (m *MockForwarder) UnsafeIncreaseNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UnsafeIncreaseNonce") -} - -// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. -func (mr *MockForwarderMockRecorder) UnsafeIncreaseNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockForwarder)(nil).UnsafeIncreaseNonce)) -} - -// UnsafeNonce mocks base method. -func (m *MockForwarder) UnsafeNonce() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeNonce") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UnsafeNonce indicates an expected call of UnsafeNonce. -func (mr *MockForwarderMockRecorder) UnsafeNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockForwarder)(nil).UnsafeNonce)) -} - -// MockSigner is a mock of Signer interface. -type MockSigner struct { - ctrl *gomock.Controller - recorder *MockSignerMockRecorder -} - -// MockSignerMockRecorder is the mock recorder for MockSigner. -type MockSignerMockRecorder struct { - mock *MockSigner -} - -// NewMockSigner creates a new mock instance. -func NewMockSigner(ctrl *gomock.Controller) *MockSigner { - mock := &MockSigner{ctrl: ctrl} - mock.recorder = &MockSignerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockSigner) EXPECT() *MockSignerMockRecorder { - return m.recorder -} - -// CommonAddress mocks base method. -func (m *MockSigner) CommonAddress() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CommonAddress") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// CommonAddress indicates an expected call of CommonAddress. -func (mr *MockSignerMockRecorder) CommonAddress() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommonAddress", reflect.TypeOf((*MockSigner)(nil).CommonAddress)) -} - -// Sign mocks base method. -func (m *MockSigner) Sign(digestHash []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Sign", digestHash) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Sign indicates an expected call of Sign. -func (mr *MockSignerMockRecorder) Sign(digestHash interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*MockSigner)(nil).Sign), digestHash) -} diff --git a/chains/evm/calls/transactor/itx/mock/minimalForwarder.go b/chains/evm/calls/transactor/itx/mock/minimalForwarder.go deleted file mode 100644 index 78564a69..00000000 --- a/chains/evm/calls/transactor/itx/mock/minimalForwarder.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/calls/transactor/itx/minimalForwarder.go - -// Package mock_itx is a generated GoMock package. -package mock_itx - -import ( - big "math/big" - reflect "reflect" - - forwarder "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/forwarder" - common "github.com/ethereum/go-ethereum/common" - gomock "github.com/golang/mock/gomock" -) - -// MockForwarderContract is a mock of ForwarderContract interface. -type MockForwarderContract struct { - ctrl *gomock.Controller - recorder *MockForwarderContractMockRecorder -} - -// MockForwarderContractMockRecorder is the mock recorder for MockForwarderContract. -type MockForwarderContractMockRecorder struct { - mock *MockForwarderContract -} - -// NewMockForwarderContract creates a new mock instance. -func NewMockForwarderContract(ctrl *gomock.Controller) *MockForwarderContract { - mock := &MockForwarderContract{ctrl: ctrl} - mock.recorder = &MockForwarderContractMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockForwarderContract) EXPECT() *MockForwarderContractMockRecorder { - return m.recorder -} - -// ContractAddress mocks base method. -func (m *MockForwarderContract) ContractAddress() *common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContractAddress") - ret0, _ := ret[0].(*common.Address) - return ret0 -} - -// ContractAddress indicates an expected call of ContractAddress. -func (mr *MockForwarderContractMockRecorder) ContractAddress() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContractAddress", reflect.TypeOf((*MockForwarderContract)(nil).ContractAddress)) -} - -// GetNonce mocks base method. -func (m *MockForwarderContract) GetNonce(from common.Address) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetNonce", from) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetNonce indicates an expected call of GetNonce. -func (mr *MockForwarderContractMockRecorder) GetNonce(from interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNonce", reflect.TypeOf((*MockForwarderContract)(nil).GetNonce), from) -} - -// PrepareExecute mocks base method. -func (m *MockForwarderContract) PrepareExecute(forwardReq forwarder.ForwardRequest, sig []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PrepareExecute", forwardReq, sig) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PrepareExecute indicates an expected call of PrepareExecute. -func (mr *MockForwarderContractMockRecorder) PrepareExecute(forwardReq, sig interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareExecute", reflect.TypeOf((*MockForwarderContract)(nil).PrepareExecute), forwardReq, sig) -} - -// MockNonceStorer is a mock of NonceStorer interface. -type MockNonceStorer struct { - ctrl *gomock.Controller - recorder *MockNonceStorerMockRecorder -} - -// MockNonceStorerMockRecorder is the mock recorder for MockNonceStorer. -type MockNonceStorerMockRecorder struct { - mock *MockNonceStorer -} - -// NewMockNonceStorer creates a new mock instance. -func NewMockNonceStorer(ctrl *gomock.Controller) *MockNonceStorer { - mock := &MockNonceStorer{ctrl: ctrl} - mock.recorder = &MockNonceStorerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockNonceStorer) EXPECT() *MockNonceStorerMockRecorder { - return m.recorder -} - -// GetNonce mocks base method. -func (m *MockNonceStorer) GetNonce(chainID *big.Int) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetNonce", chainID) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetNonce indicates an expected call of GetNonce. -func (mr *MockNonceStorerMockRecorder) GetNonce(chainID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNonce", reflect.TypeOf((*MockNonceStorer)(nil).GetNonce), chainID) -} - -// StoreNonce mocks base method. -func (m *MockNonceStorer) StoreNonce(chainID, nonce *big.Int) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StoreNonce", chainID, nonce) - ret0, _ := ret[0].(error) - return ret0 -} - -// StoreNonce indicates an expected call of StoreNonce. -func (mr *MockNonceStorerMockRecorder) StoreNonce(chainID, nonce interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreNonce", reflect.TypeOf((*MockNonceStorer)(nil).StoreNonce), chainID, nonce) -} diff --git a/chains/evm/calls/transactor/mock/transact.go b/chains/evm/calls/transactor/mock/transact.go deleted file mode 100644 index de0d7309..00000000 --- a/chains/evm/calls/transactor/mock/transact.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: chains/evm/calls/transactor/transact.go - -// Package mock_transactor is a generated GoMock package. -package mock_transactor - -import ( - reflect "reflect" - - transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - common "github.com/ethereum/go-ethereum/common" - gomock "github.com/golang/mock/gomock" -) - -// MockTransactor is a mock of Transactor interface. -type MockTransactor struct { - ctrl *gomock.Controller - recorder *MockTransactorMockRecorder -} - -// MockTransactorMockRecorder is the mock recorder for MockTransactor. -type MockTransactorMockRecorder struct { - mock *MockTransactor -} - -// NewMockTransactor creates a new mock instance. -func NewMockTransactor(ctrl *gomock.Controller) *MockTransactor { - mock := &MockTransactor{ctrl: ctrl} - mock.recorder = &MockTransactorMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockTransactor) EXPECT() *MockTransactorMockRecorder { - return m.recorder -} - -// Transact mocks base method. -func (m *MockTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Transact", to, data, opts) - ret0, _ := ret[0].(*common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Transact indicates an expected call of Transact. -func (mr *MockTransactorMockRecorder) Transact(to, data, opts interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transact", reflect.TypeOf((*MockTransactor)(nil).Transact), to, data, opts) -} diff --git a/chains/evm/calls/transactor/monitored/monitored_test.go b/chains/evm/calls/transactor/monitored/monitored_test.go index 0c4363bc..e80c5316 100644 --- a/chains/evm/calls/transactor/monitored/monitored_test.go +++ b/chains/evm/calls/transactor/monitored/monitored_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + evmtransaction "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" @@ -100,7 +100,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_SuccessfulExec ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), @@ -135,7 +135,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TxTimeout() { ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), @@ -170,7 +170,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TransactionRes ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), @@ -209,7 +209,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_MaxGasPriceRea ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(10), @@ -234,7 +234,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_MaxGasPriceRea func (s *TransactorTestSuite) TestTransactor_IncreaseGas_15PercentIncrease() { t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(150), @@ -247,7 +247,7 @@ func (s *TransactorTestSuite) TestTransactor_IncreaseGas_15PercentIncrease() { func (s *TransactorTestSuite) TestTransactor_IncreaseGas_MaxGasReached() { t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(15), diff --git a/chains/evm/calls/transactor/prepare/prepare.go b/chains/evm/calls/transactor/prepare/prepare.go deleted file mode 100644 index c1fe21d0..00000000 --- a/chains/evm/calls/transactor/prepare/prepare.go +++ /dev/null @@ -1,34 +0,0 @@ -package prepare - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - - "github.com/ethereum/go-ethereum/common" -) - -type Transactor interface { - Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) -} -type prepareTransactor struct{} - -// Initializes PrepareTransactor which is used when --prepare flag value is set as true from CLI -// PrepareTransactor outputs calldata to stdout for multisig calls (it doesn't make any contract calls) -func NewPrepareTransactor() Transactor { - return &prepareTransactor{} -} - -// Outputs calldata to stdout (called when --prepare flag value is set as true from CLI) -func (t *prepareTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) { - fmt.Printf(` -=============================================== -To: -%s - -Calldata: -%+v -=============================================== -`, to, common.Bytes2Hex(data)) - return &common.Hash{}, nil -} diff --git a/chains/evm/calls/transactor/prepare/prepare_test.go b/chains/evm/calls/transactor/prepare/prepare_test.go deleted file mode 100644 index 8129dbab..00000000 --- a/chains/evm/calls/transactor/prepare/prepare_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package prepare_test - -import ( - "testing" - - erc20 "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/prepare" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type TransactorTestSuite struct { - suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - erc20ContractAddress common.Address - erc20Contract *erc20.ERC20Contract - mockGasPricer *mock_calls.MockGasPricer -} - -var ( - erc20ContractAddress = "0x829bd824b016326a401d083b33d092293333a830" -) - -func TestERC20TestSuite(t *testing.T) { - suite.Run(t, new(TransactorTestSuite)) -} - -func (s *TransactorTestSuite) SetupSuite() {} -func (s *TransactorTestSuite) TearDownSuite() {} -func (s *TransactorTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.erc20ContractAddress = common.HexToAddress(erc20ContractAddress) - s.erc20Contract = erc20.NewERC20Contract( - s.mockContractCallerDispatcherClient, common.HexToAddress(erc20ContractAddress), s.mockTransactor, - ) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.mockGasPricer = mock_calls.NewMockGasPricer(s.gomockController) -} - -func (s *TransactorTestSuite) TestTransactor_WithPrepare_Success() { - var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} - - var trans = prepare.NewPrepareTransactor() - txHash, err := trans.Transact( - &common.Address{}, - byteData, - transactor.TransactOptions{}, - ) - - s.Nil(err) - // with prepare flag value set to true PrepareTransactor is used and output tx hash is 0x0 - s.Equal("0x0000000000000000000000000000000000000000000000000000000000000000", txHash.String()) -} diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend.go b/chains/evm/calls/transactor/signAndSend/signAndSend.go index 0caa570c..c365b932 100644 --- a/chains/evm/calls/transactor/signAndSend/signAndSend.go +++ b/chains/evm/calls/transactor/signAndSend/signAndSend.go @@ -66,7 +66,7 @@ func (t *signAndSendTransactor) Transact(to *common.Address, data []byte, opts t return &common.Hash{}, err } - _, err = t.client.WaitAndReturnTxReceipt(h) + _, err = t.client.TxReceipt(h) if err != nil { return &common.Hash{}, err } diff --git a/chains/evm/cli/account/account.go b/chains/evm/cli/account/account.go deleted file mode 100644 index 1a7c0832..00000000 --- a/chains/evm/cli/account/account.go +++ /dev/null @@ -1,28 +0,0 @@ -package account - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var AccountRootCMD = &cobra.Command{ - Use: "accounts", - Short: "Set of commands for managing accounts", - Long: "Set of commands for managing accounts", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, _, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - AccountRootCMD.AddCommand(generateKeyPairCmd) - AccountRootCMD.AddCommand(transferBaseCurrencyCmd) -} diff --git a/chains/evm/cli/account/flagVars.go b/chains/evm/cli/account/flagVars.go deleted file mode 100644 index 86e16608..00000000 --- a/chains/evm/cli/account/flagVars.go +++ /dev/null @@ -1,33 +0,0 @@ -package account - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - PrivateKey string - Pass string - Recipient string - Amount string - Decimals uint64 -) - -// processed flag vars -var ( - RecipientAddress common.Address - WeiAmount *big.Int -) - -// global flags -var ( - url string - gasLimit uint64 - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool -) diff --git a/chains/evm/cli/account/generate-key-pair.go b/chains/evm/cli/account/generate-key-pair.go deleted file mode 100644 index 3ad56ec8..00000000 --- a/chains/evm/cli/account/generate-key-pair.go +++ /dev/null @@ -1,27 +0,0 @@ -package account - -import ( - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var generateKeyPairCmd = &cobra.Command{ - Use: "generate", - Short: "Generate a bridge keystore (Secp256k1)", - Long: "The generate subcommand is used to generate the bridge keystore. If no options are specified, a Secp256k1 key will be made", - RunE: generateKeyPair, - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, -} - -func generateKeyPair(cmd *cobra.Command, args []string) error { - kp, err := secp256k1.GenerateKeypair() - if err != nil { - return err - } - log.Debug().Msgf("Address: %s, Private key: %x", kp.CommonAddress().String(), kp.Encode()) - return nil -} diff --git a/chains/evm/cli/account/transfer.go b/chains/evm/cli/account/transfer.go deleted file mode 100644 index 6a1065f5..00000000 --- a/chains/evm/cli/account/transfer.go +++ /dev/null @@ -1,109 +0,0 @@ -package account - -import ( - "bufio" - "fmt" - "math/big" - "os" - "strings" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var transferBaseCurrencyCmd = &cobra.Command{ - Use: "transfer", - Short: "Transfer base currency", - Long: "The transfer subcommand is used to transfer the base currency", - PreRun: func(cmd *cobra.Command, args []string) { - confirmTransfer(cmd, args) - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return TransferBaseCurrency(cmd, args, t) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateTransferBaseCurrencyFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessTransferBaseCurrencyFlags(cmd, args) - return err - }, -} - -func BindTransferBaseCurrencyFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Recipient, "recipient", "", "Recipient address") - cmd.Flags().StringVar(&Amount, "amount", "", "Transfer amount") - cmd.Flags().Uint64Var(&Decimals, "decimals", 0, "Base token decimals") - flags.MarkFlagsAsRequired(cmd, "recipient", "amount", "decimals") -} - -func init() { - BindTransferBaseCurrencyFlags(transferBaseCurrencyCmd) -} -func ValidateTransferBaseCurrencyFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Recipient) { - return fmt.Errorf("invalid recipient address %s", Recipient) - } - return nil -} - -func ProcessTransferBaseCurrencyFlags(cmd *cobra.Command, args []string) error { - var err error - RecipientAddress = common.HexToAddress(Recipient) - decimals := big.NewInt(int64(Decimals)) - WeiAmount, err = callsUtil.UserAmountToWei(Amount, decimals) - return err -} -func TransferBaseCurrency(cmd *cobra.Command, args []string, t transactor.Transactor) error { - hash, err := t.Transact( - &RecipientAddress, nil, transactor.TransactOptions{Value: WeiAmount, GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(fmt.Errorf("base currency deposit error: %v", err)) - return err - } - log.Debug().Msgf("base currency transaction hash: %s", hash.Hex()) - - log.Info().Msgf("%s tokens were transferred to %s from %s", Amount, RecipientAddress.Hex(), senderKeyPair.CommonAddress().String()) - return nil -} - -func confirmTransfer(cmd *cobra.Command, args []string) { - reader := bufio.NewReader(os.Stdin) - for { - fmt.Printf("Send transaction %s(%d) to %s (Y/N)?", Amount, Decimals, Recipient) - s, _ := reader.ReadString('\n') - - s = strings.ToLower(strings.TrimSuffix(s, "\n")) - - if strings.Compare(s, "n") == 0 { - os.Exit(0) - } else if strings.Compare(s, "y") == 0 { - break - } else { - continue - } - } -} diff --git a/chains/evm/cli/account/transfer_test.go b/chains/evm/cli/account/transfer_test.go deleted file mode 100644 index 4081f99b..00000000 --- a/chains/evm/cli/account/transfer_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package account - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type TransferTestSuite struct { - suite.Suite -} - -func TestValidateTransferBaseCurrencyFlags(t *testing.T) { - suite.Run(t, new(TransferTestSuite)) -} - -func (s *TransferTestSuite) SetupSuite() { -} -func (s *TransferTestSuite) TearDownSuite() {} - -func (s *TransferTestSuite) TearDownTest() {} - -func (s *TransferTestSuite) TestValidateTransferBaseCurrencyFlags() { - cmd := new(cobra.Command) - BindTransferBaseCurrencyFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - - err = ValidateTransferBaseCurrencyFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *TransferTestSuite) TestValidateTransferBaseCurrencyFlagsInvalidAddress() { - cmd := new(cobra.Command) - BindTransferBaseCurrencyFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateTransferBaseCurrencyFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/admin/add-admin.go b/chains/evm/cli/admin/add-admin.go deleted file mode 100644 index bf5ee830..00000000 --- a/chains/evm/cli/admin/add-admin.go +++ /dev/null @@ -1,90 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var addAdminCmd = &cobra.Command{ - Use: "add-admin", - Short: "Add a new admin", - Long: "The add-admin subcommand sets an address as a bridge admin", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: addAdmin, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateAddAdminFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindAddAdminFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Admin, "admin", "", "Address to add") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "admin", "bridge") -} - -func init() { - BindAddAdminFlags(addAdminCmd) -} -func ValidateAddAdminFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Admin) { - return fmt.Errorf("invalid admin address %s", Admin) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func addAdmin(cmd *cobra.Command, args []string) error { - log.Debug().Msgf(` -Adding admin -Admin address: %s -Bridge address: %s`, Admin, Bridge) - return nil -} - -/* -func addAdmin(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - admin := cctx.String("admin") - if !common.IsHexAddress(admin) { - return fmt.Errorf("invalid admin address %s", admin) - } - adminAddress := common.HexToAddress(admin) - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - err = utils.AdminAddAdmin(ethClient, bridgeAddress, adminAddress) - if err != nil { - return err - } - log.Info().Msgf("Address %s is set to admin", adminAddress.String()) - return nil -} -*/ diff --git a/chains/evm/cli/admin/add-relayer.go b/chains/evm/cli/admin/add-relayer.go deleted file mode 100644 index fc43f808..00000000 --- a/chains/evm/cli/admin/add-relayer.go +++ /dev/null @@ -1,83 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var addRelayerCmd = &cobra.Command{ - Use: "add-relayer", - Short: "Add a new relayer", - Long: "The add-relayer subcommand sets an address as a bridge relayer", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return AddRelayerEVMCMD(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateAddRelayerFlags(cmd, args) - if err != nil { - return err - } - - ProcessAddRelayerFlags(cmd, args) - return nil - }, -} - -func BindAddRelayerFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Relayer, "relayer", "", "Address to add") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "relayer", "bridge") -} - -func init() { - BindAddRelayerFlags(addRelayerCmd) -} - -func ValidateAddRelayerFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Relayer) { - return fmt.Errorf("invalid relayer address %s", Relayer) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessAddRelayerFlags(cmd *cobra.Command, args []string) { - RelayerAddr = common.HexToAddress(Relayer) - BridgeAddr = common.HexToAddress(Bridge) -} - -func AddRelayerEVMCMD(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` -Adding relayer -Relayer address: %s -Bridge address: %s`, Relayer, Bridge) - _, err := contract.AddRelayer(RelayerAddr, transactor.TransactOptions{GasLimit: gasLimit}) - return err -} diff --git a/chains/evm/cli/admin/admin.go b/chains/evm/cli/admin/admin.go deleted file mode 100644 index 020fcb13..00000000 --- a/chains/evm/cli/admin/admin.go +++ /dev/null @@ -1,38 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var AdminCmd = &cobra.Command{ - Use: "admin", - Short: "Set of commands for executing various admin actions", - Long: "Set of commands for executing various admin actions", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, prepare, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - AdminCmd.AddCommand(addAdminCmd) - AdminCmd.AddCommand(addRelayerCmd) - AdminCmd.AddCommand(isRelayerCmd) - AdminCmd.AddCommand(pauseCmd) - AdminCmd.AddCommand(removeAdminCmd) - AdminCmd.AddCommand(removeRelayerCmd) - AdminCmd.AddCommand(setFeeCmd) - AdminCmd.AddCommand(setThresholdCmd) - AdminCmd.AddCommand(getThresholdCmd) - AdminCmd.AddCommand(unpauseCmd) - AdminCmd.AddCommand(withdrawCmd) - AdminCmd.AddCommand(setDepositNonceCmd) -} diff --git a/chains/evm/cli/admin/admin_test.go b/chains/evm/cli/admin/admin_test.go deleted file mode 100644 index f6ae8289..00000000 --- a/chains/evm/cli/admin/admin_test.go +++ /dev/null @@ -1,423 +0,0 @@ -package admin - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type AdminTestSuite struct { - suite.Suite -} - -func TestAdminTestSuite(t *testing.T) { - suite.Run(t, new(AdminTestSuite)) -} - -func (s *AdminTestSuite) SetupSuite() { -} -func (s *AdminTestSuite) TearDownSuite() {} - -func (s *AdminTestSuite) TearDownTest() {} - -func (s *AdminTestSuite) TestValidateAddAdminFlags() { - cmd := new(cobra.Command) - BindAddAdminFlags(cmd) - - err := cmd.Flag("admin").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateAddAdminFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateAddAdminFlagsInvalidAddresses() { - cmd := new(cobra.Command) - BindAddAdminFlags(cmd) - - err := cmd.Flag("admin").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateAddAdminFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateAddRelayerFlags() { - cmd := new(cobra.Command) - BindAddRelayerFlags(cmd) - - err := cmd.Flag("relayer").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateAddRelayerFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateAddRelayerFlagsInvalidAddresses() { - cmd := new(cobra.Command) - BindAddRelayerFlags(cmd) - - err := cmd.Flag("relayer").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateAddRelayerFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateGetThresholdFlags() { - cmd := new(cobra.Command) - BindGetThresholdFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateGetThresholdFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateGetThresholdFlagsInvalidAddress() { - cmd := new(cobra.Command) - BindGetThresholdFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateGetThresholdFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateIsRelayerFlags() { - cmd := new(cobra.Command) - BindIsRelayerFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("relayer").Value.Set(validAddr) - s.Nil(err) - - err = ValidateIsRelayerFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateIsRelayerInvalidAddresses() { - cmd := new(cobra.Command) - BindIsRelayerFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("relayer").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateIsRelayerFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidatePauseFlags() { - cmd := new(cobra.Command) - BindPauseFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidatePauseFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidatePauseInvalidAddress() { - cmd := new(cobra.Command) - BindPauseFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidatePauseFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateRemoveAdminFlags() { - cmd := new(cobra.Command) - BindRemoveAdminFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("admin").Value.Set(validAddr) - s.Nil(err) - - err = ValidateRemoveAdminFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateRemoveAdminInvalidAddresses() { - cmd := new(cobra.Command) - BindRemoveAdminFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("admin").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateRemoveAdminFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateRemoveRelayerFlags() { - cmd := new(cobra.Command) - BindRemoveRelayerFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("relayer").Value.Set(validAddr) - s.Nil(err) - - err = ValidateRemoveRelayerFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateRemoveRelayerInvalidAddresses() { - cmd := new(cobra.Command) - BindRemoveRelayerFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("relayer").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateRemoveRelayerFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateSetDepositNonceFlags() { - cmd := new(cobra.Command) - BindSetDepositNonceFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateSetDepositNonceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateSetDepositNonceInvalidAddress() { - cmd := new(cobra.Command) - BindSetDepositNonceFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateSetDepositNonceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateSetFeeFlags() { - cmd := new(cobra.Command) - BindSetFeeFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateSetFeeFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateSetFeeInvalidAddress() { - cmd := new(cobra.Command) - BindSetFeeFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateSetFeeFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateSetThresholdFlags() { - cmd := new(cobra.Command) - BindSetThresholdFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateSetThresholdFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateSetThresholdInvalidAddress() { - cmd := new(cobra.Command) - BindSetThresholdFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateSetThresholdFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateUnpauseFlags() { - cmd := new(cobra.Command) - BindUnpauseFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateUnpauseFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateUnpauseInvalidAddress() { - cmd := new(cobra.Command) - BindUnpauseFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateUnpauseFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateWithdrawFlags() { - cmd := new(cobra.Command) - BindWithdrawFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("token-contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("amount").Value.Set("1") - s.Nil(err) - - err = ValidateWithdrawFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *AdminTestSuite) TestValidateWithdrawInvalidAddresses() { - cmd := new(cobra.Command) - BindWithdrawFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("handler").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("token-contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("amount").Value.Set("1") - s.Nil(err) - - err = ValidateWithdrawFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *AdminTestSuite) TestValidateWithdrawAmountTokenConflict() { - cmd := new(cobra.Command) - BindWithdrawFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("token-contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("amount").Value.Set("1") - s.Nil(err) - err = cmd.Flag("token").Value.Set("1") - s.Nil(err) - - err = ValidateWithdrawFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/admin/flagVars.go b/chains/evm/cli/admin/flagVars.go deleted file mode 100644 index dcd6d5d2..00000000 --- a/chains/evm/cli/admin/flagVars.go +++ /dev/null @@ -1,45 +0,0 @@ -package admin - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - Admin string - Relayer string - DepositNonce uint64 - DomainID uint8 - Fee string - RelayerThreshold uint64 - Amount string - TokenID string - Handler string - Token string - Decimals uint64 - Recipient string - Bridge string -) - -// processed flag vars -var ( - BridgeAddr common.Address - HandlerAddr common.Address - RelayerAddr common.Address - RecipientAddr common.Address - TokenAddr common.Address - RealAmount *big.Int -) - -// global flags -var ( - url string - gasLimit uint64 - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool -) diff --git a/chains/evm/cli/admin/get-threshold.go b/chains/evm/cli/admin/get-threshold.go deleted file mode 100644 index 04507341..00000000 --- a/chains/evm/cli/admin/get-threshold.go +++ /dev/null @@ -1,80 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var getThresholdCmd = &cobra.Command{ - Use: "get-threshold", - Short: "Get the relayer vote threshold", - Long: "The get-threshold subcommand returns the relayer vote threshold", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return GetThresholdCMD(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateGetThresholdFlags(cmd, args) - if err != nil { - return err - } - - ProcessGetThresholdFlags(cmd, args) - return nil - }, -} - -func BindGetThresholdFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "bridge") -} -func init() { - BindGetThresholdFlags(getThresholdCmd) -} - -func ValidateGetThresholdFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessGetThresholdFlags(cmd *cobra.Command, args []string) { - BridgeAddr = common.HexToAddress(Bridge) -} - -func GetThresholdCMD(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` -getting threshold -Bridge address: %s`, Bridge) - threshold, err := contract.GetThreshold() - if err != nil { - log.Error().Err(fmt.Errorf("transact error: %v", err)) - return err - } - log.Info().Msgf("Relayer threshold for the bridge %v is %v", Bridge, threshold) - return nil -} diff --git a/chains/evm/cli/admin/is-relayer.go b/chains/evm/cli/admin/is-relayer.go deleted file mode 100644 index d5b4ad5a..00000000 --- a/chains/evm/cli/admin/is-relayer.go +++ /dev/null @@ -1,92 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var isRelayerCmd = &cobra.Command{ - Use: "is-relayer", - Short: "Check if an address is registered as a relayer", - Long: "The is-relayer subcommand checks if an address is registered as a relayer", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return IsRelayer(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateIsRelayerFlags(cmd, args) - if err != nil { - return err - } - - ProcessIsRelayerFlags(cmd, args) - return nil - }, -} - -func BindIsRelayerFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Relayer, "relayer", "", "Address to check") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "relayer", "bridge") -} - -func init() { - BindIsRelayerFlags(isRelayerCmd) -} - -func ValidateIsRelayerFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Relayer) { - return fmt.Errorf("invalid relayer address %s", Relayer) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessIsRelayerFlags(cmd *cobra.Command, args []string) { - RelayerAddr = common.HexToAddress(Relayer) - BridgeAddr = common.HexToAddress(Bridge) -} - -func IsRelayer(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` - Checking relayer - Relayer address: %s - Bridge address: %s`, Relayer, Bridge) - - isRelayer, err := contract.IsRelayer(RelayerAddr) - if err != nil { - return err - } - - if !isRelayer { - log.Info().Msgf("Address %s is NOT relayer", RelayerAddr.String()) - } else { - log.Info().Msgf("Address %s is relayer", RelayerAddr.String()) - } - return nil -} diff --git a/chains/evm/cli/admin/pause.go b/chains/evm/cli/admin/pause.go deleted file mode 100644 index 664fd03e..00000000 --- a/chains/evm/cli/admin/pause.go +++ /dev/null @@ -1,81 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var pauseCmd = &cobra.Command{ - Use: "pause", - Short: "Pause deposits and proposals", - Long: "The pause subcommand pauses deposits and proposals", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return PauseCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidatePauseFlags(cmd, args) - if err != nil { - return err - } - - ProcessPauseFlags(cmd, args) - - return nil - }, -} - -func BindPauseFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "bridge") -} - -func init() { - BindPauseFlags(pauseCmd) -} - -func ValidatePauseFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - return nil -} - -func ProcessPauseFlags(cmd *cobra.Command, args []string) { - BridgeAddr = common.HexToAddress(Bridge) -} - -func PauseCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - hash, err := contract.Pause(transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - log.Error().Err(fmt.Errorf("admin pause error: %v", err)) - return err - } - - log.Info().Msgf("successfully paused bridge: %s; tx hash: %s", Bridge, hash.Hex()) - return nil -} diff --git a/chains/evm/cli/admin/remove-admin.go b/chains/evm/cli/admin/remove-admin.go deleted file mode 100644 index 3d4abdf1..00000000 --- a/chains/evm/cli/admin/remove-admin.go +++ /dev/null @@ -1,94 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var removeAdminCmd = &cobra.Command{ - Use: "remove-admin", - Short: "Remove an existing admin", - Long: "The remove-admin subcommand removes an existing admin", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: removeAdmin, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateRemoveAdminFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindRemoveAdminFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Admin, "admin", "", "Address to remove") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "admin", "bridge") -} - -func init() { - BindRemoveAdminFlags(removeAdminCmd) -} -func ValidateRemoveAdminFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Admin) { - return fmt.Errorf("invalid admin address %s", Admin) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func removeAdmin(cmd *cobra.Command, args []string) error { - - log.Debug().Msgf(` -Removing admin -Admin address: %s -Bridge address: %s`, Admin, Bridge) - return nil -} - -/* -func removeAdmin(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - - admin := cctx.String("admin") - if !common.IsHexAddress(admin) { - return fmt.Errorf("invalid admin address %s", admin) - } - adminAddress := common.HexToAddress(admin) - - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - err = utils.AdminRemoveAdmin(ethClient, bridgeAddress, adminAddress) - if err != nil { - return err - } - log.Info().Msgf("Address %s is removed from admins", adminAddress.String()) - return nil -} -*/ diff --git a/chains/evm/cli/admin/remove-relayer.go b/chains/evm/cli/admin/remove-relayer.go deleted file mode 100644 index 2724d1d4..00000000 --- a/chains/evm/cli/admin/remove-relayer.go +++ /dev/null @@ -1,89 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var removeRelayerCmd = &cobra.Command{ - Use: "remove-relayer", - Short: "Remove an existing relayer", - Long: "The remove-relayer subcommand removes an existing relayer", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: removeRelayer, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateRemoveRelayerFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindRemoveRelayerFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Relayer, "relayer", "", "Address to remove") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "relayer", "bridge") -} -func init() { - BindRemoveRelayerFlags(removeRelayerCmd) -} -func ValidateRemoveRelayerFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Relayer) { - return fmt.Errorf("invalid relayer address %s", Relayer) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func removeRelayer(cmd *cobra.Command, args []string) error { - log.Debug().Msgf(` -Removing relayer -Relayer address: %s -Bridge address: %s`, Relayer, Bridge) - return nil -} - -/* -func removeRelayer(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - relayer := cctx.String("relayer") - if !common.IsHexAddress(relayer) { - return fmt.Errorf("invalid bridge address %s", relayer) - } - relayerAddress := common.HexToAddress(relayer) - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - err = utils.AdminRemoveRelayer(ethClient, bridgeAddress, relayerAddress) - if err != nil { - return err - } - log.Info().Msgf("Address %s is relayer now", relayerAddress.String()) - return nil -} -*/ diff --git a/chains/evm/cli/admin/set-deposit-nonce.go b/chains/evm/cli/admin/set-deposit-nonce.go deleted file mode 100644 index d113cbce..00000000 --- a/chains/evm/cli/admin/set-deposit-nonce.go +++ /dev/null @@ -1,84 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var setDepositNonceCmd = &cobra.Command{ - Use: "set-deposit-nonce", - Short: "Set the deposit nonce", - Long: "The set-deposit-nonce subcommand sets the deposit nonce. This nonce cannot be less than what is currently stored in the contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return SetDepositNonceEVMCMD(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateSetDepositNonceFlags(cmd, args) - if err != nil { - return err - } - - ProcessSetDepositNonceFlags(cmd, args) - return nil - }, -} - -func BindSetDepositNonceFlags(cmd *cobra.Command) { - cmd.Flags().Uint8Var(&DomainID, "domain", 0, "Domain ID of chain") - cmd.Flags().Uint64Var(&DepositNonce, "deposit-nonce", 0, "Deposit nonce to set (does not decrement)") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "domain", "deposit-nonce", "bridge") -} - -func init() { - BindSetDepositNonceFlags(setDepositNonceCmd) -} - -func ValidateSetDepositNonceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessSetDepositNonceFlags(cmd *cobra.Command, args []string) { - BridgeAddr = common.HexToAddress(Bridge) -} - -func SetDepositNonceEVMCMD(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` -Set Deposit Nonce -Domain ID: %v -Deposit Nonce: %v -Bridge Address: %s`, DomainID, DepositNonce, Bridge) - _, err := contract.SetDepositNonce(DomainID, DepositNonce, transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - return err - } - log.Info().Msgf("[domain ID: %v] successfully set nonce: %v at address: %s", DomainID, DepositNonce, BridgeAddr.String()) - return nil -} diff --git a/chains/evm/cli/admin/set-fee.go b/chains/evm/cli/admin/set-fee.go deleted file mode 100644 index 9601bcff..00000000 --- a/chains/evm/cli/admin/set-fee.go +++ /dev/null @@ -1,89 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var setFeeCmd = &cobra.Command{ - Use: "set-fee", - Short: "Set a new fee for deposits", - Long: "The set-fee subcommand sets a new fee for deposits", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: setFee, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateSetFeeFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindSetFeeFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Fee, "fee", "", "New fee (in ether)") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "fee", "bridge") -} - -func init() { - BindSetFeeFlags(setFeeCmd) -} -func ValidateSetFeeFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func setFee(cmd *cobra.Command, args []string) error { - log.Debug().Msgf(` -Setting new fee -Fee amount: %s -Bridge address: %s`, Fee, Bridge) - return nil -} - -/* -func setFee(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - fee := cctx.String("fee") - - realFeeAmount, err := utils.UserAmountToWei(fee, big.NewInt(18)) - if err != nil { - return err - } - - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - err = utils.AdminSetFee(ethClient, bridgeAddress, realFeeAmount) - if err != nil { - return err - } - log.Info().Msgf("Fee set to %s", realFeeAmount.String()) - return nil -} -*/ diff --git a/chains/evm/cli/admin/set-threshold.go b/chains/evm/cli/admin/set-threshold.go deleted file mode 100644 index 7e9184a3..00000000 --- a/chains/evm/cli/admin/set-threshold.go +++ /dev/null @@ -1,81 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var setThresholdCmd = &cobra.Command{ - Use: "set-threshold", - Short: "Set a new relayer vote threshold", - Long: "The set-threshold subcommand sets a new relayer vote threshold", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return SetThresholdCMD(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateSetThresholdFlags(cmd, args) - if err != nil { - return err - } - - ProcessSetThresholdFlags(cmd, args) - return nil - }, -} - -func BindSetThresholdFlags(cmd *cobra.Command) { - cmd.Flags().Uint64Var(&RelayerThreshold, "threshold", 0, "New relayer threshold") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "threshold", "bridge") -} - -func init() { - BindSetThresholdFlags(setThresholdCmd) -} - -func ValidateSetThresholdFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessSetThresholdFlags(cmd *cobra.Command, args []string) { - BridgeAddr = common.HexToAddress(Bridge) -} - -func SetThresholdCMD(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` -Setting new threshold -Threshold: %d -Bridge address: %s`, RelayerThreshold, Bridge) - _, err := contract.AdminChangeRelayerThreshold(RelayerThreshold, transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - return err - } - return nil -} diff --git a/chains/evm/cli/admin/unpause.go b/chains/evm/cli/admin/unpause.go deleted file mode 100644 index f6b5de57..00000000 --- a/chains/evm/cli/admin/unpause.go +++ /dev/null @@ -1,82 +0,0 @@ -package admin - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var unpauseCmd = &cobra.Command{ - Use: "unpause", - Short: "Unpause deposits and proposals", - Long: "The unpause subcommand unpauses deposits and proposals", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return UnpauseCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateUnpauseFlags(cmd, args) - if err != nil { - return err - } - - ProcessUnpauseFlags(cmd, args) - - return nil - }, -} - -func BindUnpauseFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - flags.MarkFlagsAsRequired(cmd, "bridge") -} - -func init() { - BindUnpauseFlags(unpauseCmd) -} - -func ValidateUnpauseFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - return nil -} - -func ProcessUnpauseFlags(cmd *cobra.Command, args []string) { - BridgeAddr = common.HexToAddress(Bridge) -} - -func UnpauseCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - hash, err := contract.Unpause(transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - log.Error().Err(fmt.Errorf("admin unpause error: %v", err)) - return err - } - - log.Info().Msgf("successfully unpaused bridge: %s; tx hash: %s", Bridge, hash.Hex()) - return nil - -} diff --git a/chains/evm/cli/admin/withdraw.go b/chains/evm/cli/admin/withdraw.go deleted file mode 100644 index 16c2cec4..00000000 --- a/chains/evm/cli/admin/withdraw.go +++ /dev/null @@ -1,120 +0,0 @@ -package admin - -import ( - "errors" - "fmt" - "math/big" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var withdrawCmd = &cobra.Command{ - Use: "withdraw", - Short: "Withdraw tokens from a handler contract", - Long: "The withdraw subcommand withdrawals tokens from a handler contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return WithdrawCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateWithdrawFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessWithdrawFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindWithdrawFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Amount, "amount", "", "Token amount to withdraw, use only if ERC20 token is withdrawn. If both amount and token are set an error will occur") - cmd.Flags().StringVar(&TokenID, "token", "", "Token ID to withdraw, use only if ERC721 token is withdrawn. If both amount and token are set an error will occur") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&Handler, "handler", "", "Handler contract address") - cmd.Flags().StringVar(&Token, "token-contract", "", "ERC20 or ERC721 token contract address") - cmd.Flags().StringVar(&Recipient, "recipient", "", "Address to withdraw to") - cmd.Flags().Uint64Var(&Decimals, "decimals", 0, "ERC20 token decimals") - flags.MarkFlagsAsRequired(withdrawCmd, "amount", "token", "bridge", "handler", "token-contract", "recipient", "decimals") -} - -func init() { - BindWithdrawFlags(withdrawCmd) -} - -func ValidateWithdrawFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - if !common.IsHexAddress(Handler) { - return fmt.Errorf("invalid handler address: %s", Handler) - } - if !common.IsHexAddress(Token) { - return fmt.Errorf("invalid token-contract address: %s", Token) - } - if !common.IsHexAddress(Recipient) { - return fmt.Errorf("invalid recipient address: %s", Recipient) - } - if TokenID != "" && Amount != "" { - return errors.New("only token or amount should be set") - } - if TokenID == "" && Amount == "" { - return errors.New("token or amount flag should be set") - } - return nil -} - -func ProcessWithdrawFlags(cmd *cobra.Command, args []string) error { - var err error - - BridgeAddr = common.HexToAddress(Bridge) - HandlerAddr = common.HexToAddress(Handler) - TokenAddr = common.HexToAddress(Token) - RecipientAddr = common.HexToAddress(Recipient) - decimals := big.NewInt(int64(Decimals)) - RealAmount, err = callsUtil.UserAmountToWei(Amount, decimals) - if err != nil { - return err - } - return nil -} - -func WithdrawCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - h, err := contract.Withdraw( - HandlerAddr, TokenAddr, RecipientAddr, RealAmount, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(fmt.Errorf("admin withdrawal error: %v", err)) - return err - } - - log.Info().Msgf("%s tokens were withdrawn from handler contract %s into recipient %s; tx hash: %s", Amount, Handler, Recipient, h.Hex()) - return nil -} diff --git a/chains/evm/cli/bridge/bridge.go b/chains/evm/cli/bridge/bridge.go deleted file mode 100644 index 45ea7fdc..00000000 --- a/chains/evm/cli/bridge/bridge.go +++ /dev/null @@ -1,33 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var BridgeCmd = &cobra.Command{ - Use: "bridge", - Short: "Set of commands for interacting with a bridge", - Long: "Set of commands for interacting with a bridge", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, prepare, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - BridgeCmd.AddCommand(cancelProposalCmd) - BridgeCmd.AddCommand(queryProposalCmd) - BridgeCmd.AddCommand(queryResourceCmd) - BridgeCmd.AddCommand(registerGenericResourceCmd) - BridgeCmd.AddCommand(registerResourceCmd) - BridgeCmd.AddCommand(setBurnCmd) - BridgeCmd.AddCommand(voteProposalCmd) -} diff --git a/chains/evm/cli/bridge/bridge_test.go b/chains/evm/cli/bridge/bridge_test.go deleted file mode 100644 index 95750fbe..00000000 --- a/chains/evm/cli/bridge/bridge_test.go +++ /dev/null @@ -1,219 +0,0 @@ -package bridge - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type BridgeTestSuite struct { - suite.Suite -} - -func TestBridgeTestSuite(t *testing.T) { - suite.Run(t, new(BridgeTestSuite)) -} - -func (s *BridgeTestSuite) SetupSuite() { -} -func (s *BridgeTestSuite) TearDownSuite() {} - -func (s *BridgeTestSuite) TearDownTest() {} - -func (s *BridgeTestSuite) TestValidateCancelProposalFlags() { - cmd := new(cobra.Command) - BindCancelProposalFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateCancelProposalFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateCancelProposalInvalidAddress() { - cmd := new(cobra.Command) - BindCancelProposalFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateCancelProposalFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *BridgeTestSuite) TestValidateQueryProposalFlags() { - cmd := new(cobra.Command) - BindQueryProposalFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateQueryProposalFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateQueryProposalInvalidAddress() { - cmd := new(cobra.Command) - BindQueryProposalFlags(cmd) - - err := cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateQueryProposalFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *BridgeTestSuite) TestValidateQueryResourceFlags() { - cmd := new(cobra.Command) - BindQueryResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - - err = ValidateQueryResourceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateQueryResourceInvalidAddress() { - cmd := new(cobra.Command) - BindQueryResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateQueryResourceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *BridgeTestSuite) TestValidateRegisterGenericResourceFlags() { - cmd := new(cobra.Command) - BindRegisterGenericResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("target").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateRegisterGenericResourceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateRegisterGenericResourceInvalidAddresses() { - cmd := new(cobra.Command) - BindRegisterGenericResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("target").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateRegisterGenericResourceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *BridgeTestSuite) TestValidateRegisterResourceFlags() { - cmd := new(cobra.Command) - BindRegisterResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("target").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateRegisterResourceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateRegisterResourceInvalidAddresses() { - cmd := new(cobra.Command) - BindRegisterResourceFlags(cmd) - - err := cmd.Flag("handler").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("target").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateRegisterResourceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *BridgeTestSuite) TestValidateSetBurnFlags() { - cmd := new(cobra.Command) - BindSetBurnFlags(cmd) - - err := cmd.Flag("handler").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("token-contract").Value.Set(validAddr) - s.Nil(err) - - err = ValidateSetBurnFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *BridgeTestSuite) TestValidateSetBurnInvalidAddresses() { - cmd := new(cobra.Command) - BindSetBurnFlags(cmd) - - err := cmd.Flag("handler").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("token-contract").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateSetBurnFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/bridge/cancel-proposal.go b/chains/evm/cli/bridge/cancel-proposal.go deleted file mode 100644 index 4bfcd216..00000000 --- a/chains/evm/cli/bridge/cancel-proposal.go +++ /dev/null @@ -1,95 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var cancelProposalCmd = &cobra.Command{ - Use: "cancel-proposal", - Short: "Cancel an expired proposal", - Long: "The cancel-proposal subcommand cancels an expired proposal", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: cancelProposal, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateCancelProposalFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindCancelProposalFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&DataHash, "data-hash", "", "Hash of proposal metadata") - cmd.Flags().Uint8Var(&DomainID, "domain", 0, "Domain ID of proposal to cancel") - cmd.Flags().Uint64Var(&DepositNonce, "deposit-nonce", 0, "Deposit nonce of proposal to cancel") - flags.MarkFlagsAsRequired(cmd, "bridge", "data-hash", "domain", "deposit-nonce") -} - -func init() { - BindCancelProposalFlags(cancelProposalCmd) -} - -func ValidateCancelProposalFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - return nil -} - -func cancelProposal(cmd *cobra.Command, args []string) error { - - log.Debug().Msgf(` -Cancel propsal -Bridge address: %s -Chain ID: %d -Deposit nonce: %d -DataHash: %s -`, Bridge, DomainID, DepositNonce, DataHash) - return nil -} - -/* -func cancelProposal(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - - domainID := cctx.Uint64("domainId") - depositNonce := cctx.Uint64("depositNonce") - dataHash := cctx.String("dataHash") - dataHashBytes := utils.SliceTo32Bytes(common.Hex2Bytes(dataHash)) - - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - err = utils.CancelProposal(ethClient, bridgeAddress, uint8(domainID), depositNonce, dataHashBytes) - if err != nil { - return err - } - log.Info().Msgf("Setting proposal with domain ID %v and deposit nonce %v status to 'Cancelled", domainID, depositNonce) - return nil -} -*/ diff --git a/chains/evm/cli/bridge/flagVars.go b/chains/evm/cli/bridge/flagVars.go deleted file mode 100644 index 978c7c12..00000000 --- a/chains/evm/cli/bridge/flagVars.go +++ /dev/null @@ -1,47 +0,0 @@ -package bridge - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - Bridge string - DataHash string - DomainID uint8 - Data string - DepositNonce uint64 - Handler string - ResourceID string - Target string - Deposit string - DepositerOffset uint64 - Execute string - Hash bool - TokenContract string -) - -// processed flag vars -var ( - BridgeAddr common.Address - ResourceIdBytesArr types.ResourceID - HandlerAddr common.Address - TargetContractAddr common.Address - TokenContractAddr common.Address - DepositSigBytes [4]byte - ExecuteSigBytes [4]byte - DataBytes []byte -) - -// global flags -var ( - url string - gasLimit uint64 - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool -) diff --git a/chains/evm/cli/bridge/mock/vote-proposal.go b/chains/evm/cli/bridge/mock/vote-proposal.go deleted file mode 100644 index 9769dc1c..00000000 --- a/chains/evm/cli/bridge/mock/vote-proposal.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/cli/bridge/vote-proposal.go - -// Package mock_bridge is a generated GoMock package. -package mock_bridge - -import ( - reflect "reflect" - - transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - proposal "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - common "github.com/ethereum/go-ethereum/common" - gomock "github.com/golang/mock/gomock" -) - -// MockVoter is a mock of Voter interface. -type MockVoter struct { - ctrl *gomock.Controller - recorder *MockVoterMockRecorder -} - -// MockVoterMockRecorder is the mock recorder for MockVoter. -type MockVoterMockRecorder struct { - mock *MockVoter -} - -// NewMockVoter creates a new mock instance. -func NewMockVoter(ctrl *gomock.Controller) *MockVoter { - mock := &MockVoter{ctrl: ctrl} - mock.recorder = &MockVoterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockVoter) EXPECT() *MockVoterMockRecorder { - return m.recorder -} - -// SimulateVoteProposal mocks base method. -func (m *MockVoter) SimulateVoteProposal(proposal *proposal.Proposal) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SimulateVoteProposal", proposal) - ret0, _ := ret[0].(error) - return ret0 -} - -// SimulateVoteProposal indicates an expected call of SimulateVoteProposal. -func (mr *MockVoterMockRecorder) SimulateVoteProposal(proposal interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateVoteProposal", reflect.TypeOf((*MockVoter)(nil).SimulateVoteProposal), proposal) -} - -// VoteProposal mocks base method. -func (m *MockVoter) VoteProposal(proposal *proposal.Proposal, opts transactor.TransactOptions) (*common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VoteProposal", proposal, opts) - ret0, _ := ret[0].(*common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VoteProposal indicates an expected call of VoteProposal. -func (mr *MockVoterMockRecorder) VoteProposal(proposal, opts interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VoteProposal", reflect.TypeOf((*MockVoter)(nil).VoteProposal), proposal, opts) -} diff --git a/chains/evm/cli/bridge/query-proposal.go b/chains/evm/cli/bridge/query-proposal.go deleted file mode 100644 index 73133cec..00000000 --- a/chains/evm/cli/bridge/query-proposal.go +++ /dev/null @@ -1,94 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var queryProposalCmd = &cobra.Command{ - Use: "query-proposal", - Short: "Query an inbound proposal", - Long: "The query-proposal subcommand queries an inbound proposal", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: queryProposal, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateQueryProposalFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindQueryProposalFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&DataHash, "data-hash", "", "Hash of proposal metadata") - cmd.Flags().Uint8Var(&DomainID, "domain", 0, "Source domain ID of proposal") - cmd.Flags().Uint64Var(&DepositNonce, "deposit-nonce", 0, "Deposit nonce of proposal") - flags.MarkFlagsAsRequired(cmd, "bridge", "data-hash", "domain", "deposit-nonce") -} - -func init() { - BindQueryProposalFlags(queryProposalCmd) -} - -func ValidateQueryProposalFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - return nil -} - -func queryProposal(cmd *cobra.Command, args []string) error { - log.Debug().Msgf(` -Querying proposal -Chain ID: %d -Deposit nonce: %d -Data hash: %s -Bridge address: %s`, DomainID, DepositNonce, DataHash, Bridge) - return nil -} - -/* -func queryProposal(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - bridgeAddress, err := cliutils.DefineBridgeAddress(cctx) - if err != nil { - return err - } - - domainID := cctx.Uint64("domainId") - depositNonce := cctx.Uint64("depositNonce") - dataHash := cctx.String("dataHash") - dataHashBytes := utils.SliceTo32Bytes(common.Hex2Bytes(dataHash)) - - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - - prop, err := utils.QueryProposal(ethClient, bridgeAddress, uint8(domainID), depositNonce, dataHashBytes) - if err != nil { - return err - } - log.Info().Msgf("proposal with domainID %v and depositNonce %v queried. %+v", domainID, depositNonce, prop) - return nil -} -*/ diff --git a/chains/evm/cli/bridge/query-resource.go b/chains/evm/cli/bridge/query-resource.go deleted file mode 100644 index ea286e39..00000000 --- a/chains/evm/cli/bridge/query-resource.go +++ /dev/null @@ -1,86 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var queryResourceCmd = &cobra.Command{ - Use: "query-resource", - Short: "Query the resource ID for a handler contract", - Long: "The query-resource subcommand queries the contract address with the provided resource ID for a specific handler contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: queryResource, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateQueryResourceFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindQueryResourceFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Handler, "handler", "", "Handler contract address") - cmd.Flags().StringVar(&ResourceID, "resource", "", "Resource ID to query") - flags.MarkFlagsAsRequired(cmd, "handler", "resource") -} - -func init() { - BindQueryResourceFlags(queryResourceCmd) -} - -func ValidateQueryResourceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Handler) { - return fmt.Errorf("invalid handler address: %s", Handler) - } - return nil -} - -func queryResource(cmd *cobra.Command, args []string) error { - log.Debug().Msgf(` -Querying resource -Handler address: %s -Resource ID: %s`, Handler, ResourceID) - return nil -} - -/* -func queryResource(cctx *cli.Context) error { - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - handlerS := cctx.String("handler") - if !common.IsHexAddress(handlerS) { - return errors.New("provided handler address is not valid") - } - handlerAddr := common.HexToAddress(handlerS) - resourceIDs := cctx.String("resourceId") - resourceID := utils.SliceTo32Bytes(common.Hex2Bytes(resourceIDs)) - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - return err - } - res, err := utils.QueryResource(ethClient, handlerAddr, resourceID) - if err != nil { - return err - } - log.Info().Msgf("Resource address that associated with ID %s is %s", common.Bytes2Hex(resourceID[:]), res.String()) - return nil -} -*/ diff --git a/chains/evm/cli/bridge/register-generic-resource.go b/chains/evm/cli/bridge/register-generic-resource.go deleted file mode 100644 index 475cd693..00000000 --- a/chains/evm/cli/bridge/register-generic-resource.go +++ /dev/null @@ -1,135 +0,0 @@ -package bridge - -import ( - "encoding/hex" - "fmt" - "math/big" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var registerGenericResourceCmd = &cobra.Command{ - Use: "register-generic-resource", - Short: "Register a generic resource ID", - Long: "The register-generic-resource subcommand registers a resource ID with a contract address for a generic handler", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return RegisterGenericResource(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateRegisterGenericResourceFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessRegisterGenericResourceFlags(cmd, args) - if err != nil { - return err - } - - return nil - }, -} - -func BindRegisterGenericResourceFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Handler, "handler", "", "Handler contract address") - cmd.Flags().StringVar(&ResourceID, "resource", "", "Resource ID to query") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&Target, "target", "", "Contract address or hash storage to be registered") - cmd.Flags().StringVar(&Deposit, "deposit", "0x00000000", "Deposit function signature") - cmd.Flags().StringVar(&Execute, "execute", "0x00000000", "Execute proposal function signature") - cmd.Flags().BoolVar(&Hash, "hash", false, "Treat signature inputs as function prototype strings, hash and take the first 4 bytes") - flags.MarkFlagsAsRequired(cmd, "handler", "resource", "bridge", "target") -} - -func init() { - BindRegisterGenericResourceFlags(registerGenericResourceCmd) -} - -func ValidateRegisterGenericResourceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Handler) { - return fmt.Errorf("invalid handler address %s", Handler) - } - - if !common.IsHexAddress(Target) { - return fmt.Errorf("invalid target address %s", Target) - } - - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Target) - } - - return nil -} - -func ProcessRegisterGenericResourceFlags(cmd *cobra.Command, args []string) error { - HandlerAddr = common.HexToAddress(Handler) - TargetContractAddr = common.HexToAddress(Target) - BridgeAddr = common.HexToAddress(Bridge) - - if ResourceID[0:2] == "0x" { - ResourceID = ResourceID[2:] - } - - resourceIdBytes, err := hex.DecodeString(ResourceID) - if err != nil { - return err - } - - ResourceIdBytesArr = callsUtil.SliceTo32Bytes(resourceIdBytes) - - if Hash { - DepositSigBytes = callsUtil.GetSolidityFunctionSig([]byte(Deposit)) - ExecuteSigBytes = callsUtil.GetSolidityFunctionSig([]byte(Execute)) - } else { - copy(DepositSigBytes[:], []byte(Deposit)[:]) - copy(ExecuteSigBytes[:], []byte(Execute)[:]) - } - - return nil -} - -func RegisterGenericResource(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Info().Msgf("Registering contract %s with resource ID %s on handler %s", TargetContractAddr, ResourceID, HandlerAddr) - - h, err := contract.AdminSetGenericResource( - HandlerAddr, - ResourceIdBytesArr, - TargetContractAddr, - DepositSigBytes, - big.NewInt(int64(DepositerOffset)), - ExecuteSigBytes, - transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(err) - return err - } - - log.Info().Msgf("Generic resource registered with transaction: %s", h.Hex()) - return nil -} diff --git a/chains/evm/cli/bridge/register-resource.go b/chains/evm/cli/bridge/register-resource.go deleted file mode 100644 index 234a4825..00000000 --- a/chains/evm/cli/bridge/register-resource.go +++ /dev/null @@ -1,104 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var registerResourceCmd = &cobra.Command{ - Use: "register-resource", - Short: "Register a resource ID", - Long: "The register-resource subcommand registers a resource ID with a contract address for a handler", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return RegisterResourceCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateRegisterResourceFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessRegisterResourceFlags(cmd, args) - return err - }, -} - -func BindRegisterResourceFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Handler, "handler", "", "Handler contract address") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&Target, "target", "", "Contract address to be registered") - cmd.Flags().StringVar(&ResourceID, "resource", "", "Resource ID to be registered") - flags.MarkFlagsAsRequired(cmd, "handler", "bridge", "target", "resource") -} - -func init() { - BindRegisterResourceFlags(registerResourceCmd) -} - -func ValidateRegisterResourceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Handler) { - return fmt.Errorf("invalid handler address %s", Handler) - } - if !common.IsHexAddress(Target) { - return fmt.Errorf("invalid target address %s", Target) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessRegisterResourceFlags(cmd *cobra.Command, args []string) error { - var err error - HandlerAddr = common.HexToAddress(Handler) - TargetContractAddr = common.HexToAddress(Target) - BridgeAddr = common.HexToAddress(Bridge) - - ResourceIdBytesArr, err = flags.ProcessResourceID(ResourceID) - return err -} - -func RegisterResourceCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Debug().Msgf(` -Registering resource -Handler address: %s -Resource ID: %s -Target address: %s -Bridge address: %s -`, Handler, ResourceID, Target, Bridge) - - h, err := contract.AdminSetResource( - HandlerAddr, ResourceIdBytesArr, TargetContractAddr, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(err) - return err - } - - log.Info().Msgf("Resource registered with transaction: %s", h.Hex()) - return nil -} diff --git a/chains/evm/cli/bridge/set-burn.go b/chains/evm/cli/bridge/set-burn.go deleted file mode 100644 index 32a251aa..00000000 --- a/chains/evm/cli/bridge/set-burn.go +++ /dev/null @@ -1,92 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var setBurnCmd = &cobra.Command{ - Use: "set-burn", - Short: "Set a token contract as mintable/burnable", - Long: "The set-burn subcommand sets a token contract as mintable/burnable in a handler", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return SetBurnCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateSetBurnFlags(cmd, args) - if err != nil { - return err - } - - ProcessSetBurnFlags(cmd, args) - return nil - }, -} - -func BindSetBurnFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Handler, "handler", "", "ERC20 handler contract address") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&TokenContract, "token-contract", "", "Token contract to be registered") - flags.MarkFlagsAsRequired(cmd, "handler", "bridge", "token-contract") -} - -func init() { - BindSetBurnFlags(setBurnCmd) -} -func ValidateSetBurnFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Handler) { - return fmt.Errorf("invalid handler address %s", Handler) - } - if !common.IsHexAddress(TokenContract) { - return fmt.Errorf("invalid token contract address %s", TokenContract) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - return nil -} - -func ProcessSetBurnFlags(cmd *cobra.Command, args []string) { - HandlerAddr = common.HexToAddress(Handler) - BridgeAddr = common.HexToAddress(Bridge) - TokenContractAddr = common.HexToAddress(TokenContract) -} -func SetBurnCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - log.Info().Msgf( - "Setting contract %s as burnable on handler %s", - TokenContractAddr.String(), HandlerAddr.String(), - ) - _, err := contract.SetBurnableInput( - HandlerAddr, TokenContractAddr, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(err) - return err - } - log.Info().Msg("Burnable set") - return nil -} diff --git a/chains/evm/cli/bridge/vote-proposal.go b/chains/evm/cli/bridge/vote-proposal.go deleted file mode 100644 index f4b4d450..00000000 --- a/chains/evm/cli/bridge/vote-proposal.go +++ /dev/null @@ -1,105 +0,0 @@ -package bridge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var voteProposalCmd = &cobra.Command{ - Use: "vote-proposal", - Short: "Vote on proposal", - Long: "The vote-proposal subcommand votes on an on-chain proposal. Valid relayer private key required for transaction to be successful.", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return VoteProposalCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateVoteProposalFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessVoteProposalFlags(cmd, args) - return err - }, -} - -func BindVoteProposalCmdFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Bridge, "bridge", "", "bridge contract address") - cmd.Flags().StringVar(&Data, "data", "", "hex proposal metadata") - cmd.Flags().Uint8Var(&DomainID, "domain", 0, "origin domain ID of proposal") - cmd.Flags().Uint64Var(&DepositNonce, "deposit-nonce", 0, "deposit nonce of proposal to vote on") - cmd.Flags().StringVar(&ResourceID, "resource", "", "resource id of asset") - flags.MarkFlagsAsRequired(cmd, "bridge", "deposit-nonce", "domain", "resource", "data") -} - -func init() { - BindVoteProposalCmdFlags(voteProposalCmd) -} - -func ValidateVoteProposalFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address: %s", Bridge) - } - return nil -} - -func ProcessVoteProposalFlags(cmd *cobra.Command, args []string) error { - var err error - BridgeAddr = common.HexToAddress(Bridge) - DataBytes = common.Hex2Bytes(Data) - - ResourceIdBytesArr, err = flags.ProcessResourceID(ResourceID) - return err -} - -type Voter interface { - SimulateVoteProposal(proposal *proposal.Proposal) error - VoteProposal(proposal *proposal.Proposal, opts transactor.TransactOptions) (*common.Hash, error) -} - -func VoteProposalCmd(cmd *cobra.Command, args []string, voter Voter) error { - prop := &proposal.Proposal{ - Source: uint8(DomainID), - DepositNonce: DepositNonce, - Data: DataBytes, - ResourceId: ResourceIdBytesArr, - } - - err := voter.SimulateVoteProposal(prop) - if err != nil { - return err - } - - h, err := voter.VoteProposal(prop, transactor.TransactOptions{}) - if err != nil { - return err - } - - log.Info().Msgf("Successfully voted on proposal with hash: %s", h.Hex()) - return nil -} diff --git a/chains/evm/cli/bridge/vote-proposal_test.go b/chains/evm/cli/bridge/vote-proposal_test.go deleted file mode 100644 index 4799c55b..00000000 --- a/chains/evm/cli/bridge/vote-proposal_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package bridge_test - -import ( - "encoding/hex" - "errors" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli" - "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge" - mock_bridge "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge/mock" - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -type VoteProposalTestSuite struct { - suite.Suite - gomockController *gomock.Controller - mockVoteProposalCmd *cobra.Command - voter *mock_bridge.MockVoter -} - -func TestRunVoteProposalTestSuite(t *testing.T) { - suite.Run(t, new(VoteProposalTestSuite)) -} - -func (s *VoteProposalTestSuite) SetupSuite() {} -func (s *VoteProposalTestSuite) TearDownSuite() {} -func (s *VoteProposalTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) - s.voter = mock_bridge.NewMockVoter(s.gomockController) - - s.mockVoteProposalCmd = &cobra.Command{ - RunE: func(cmd *cobra.Command, args []string) error { - return bridge.VoteProposalCmd( - cmd, - args, - s.voter) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := bridge.ValidateVoteProposalFlags(cmd, args) - if err != nil { - return err - } - - err = bridge.ProcessVoteProposalFlags(cmd, args) - return err - }, - } - cli.BindEVMCLIFlags(s.mockVoteProposalCmd) - bridge.BindVoteProposalCmdFlags(s.mockVoteProposalCmd) -} - -func (s *VoteProposalTestSuite) TestValidate_InvalidBridgeAddress() { - rootCmdArgs := []string{ - "--url", "test-url", - "--private-key", "test-private-key", - "--bridge", "invalid", - "--data", "hex-data", - "--resource", "test-resource", - "--domain", "1", - } - s.mockVoteProposalCmd.SetArgs(rootCmdArgs) - - err := s.mockVoteProposalCmd.Execute() - - s.NotNil(err) - s.Equal(err.Error(), "invalid bridge address: invalid") -} - -func (s *VoteProposalTestSuite) TestValidate_InvalidResourceID() { - rootCmdArgs := []string{ - "--url", "test-url", - "--private-key", "test-private-key", - "--bridge", "0x829bd824b016326a401d083b33d092293333a830", - "--data", "hex-data", - "--resource", "111", - "--domain", "1", - } - s.mockVoteProposalCmd.SetArgs(rootCmdArgs) - - err := s.mockVoteProposalCmd.Execute() - - s.NotNil(err) - s.Equal(err.Error(), "failed decoding resourceID hex string: encoding/hex: odd length hex string") -} - -func (s *VoteProposalTestSuite) TestValidate_FailedSimulateCall() { - rootCmdArgs := []string{ - "--url", "test-url", - "--private-key", "test-private-key", - "--bridge", "0x829bd824b016326a401d083b33d092293333a830", - "--data", "00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35", - "--resource", "0x000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00", - "--deposit-nonce", "2", - "--domain", "1", - } - s.mockVoteProposalCmd.SetArgs(rootCmdArgs) - resourceID, _ := hex.DecodeString("000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00") - s.voter.EXPECT().SimulateVoteProposal(&proposal.Proposal{ - Source: 1, - DepositNonce: 2, - Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35"), - ResourceId: calls.SliceTo32Bytes(resourceID), - }).Return(errors.New("failed simulating call")) - - err := s.mockVoteProposalCmd.Execute() - - s.NotNil(err) - s.Equal(err.Error(), "failed simulating call") -} - -func (s *VoteProposalTestSuite) TestValidate_FailedVoteCall() { - rootCmdArgs := []string{ - "--url", "test-url", - "--private-key", "test-private-key", - "--bridge", "0x829bd824b016326a401d083b33d092293333a830", - "--data", "00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35", - "--resource", "0x000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00", - "--deposit-nonce", "2", - "--domain", "1", - } - s.mockVoteProposalCmd.SetArgs(rootCmdArgs) - resourceID, _ := hex.DecodeString("000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00") - s.voter.EXPECT().SimulateVoteProposal(&proposal.Proposal{ - Source: 1, - DepositNonce: 2, - Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35"), - ResourceId: calls.SliceTo32Bytes(resourceID), - }).Return(nil) - s.voter.EXPECT().VoteProposal(&proposal.Proposal{ - Source: 1, - DepositNonce: 2, - Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35"), - ResourceId: calls.SliceTo32Bytes(resourceID), - }, transactor.TransactOptions{}).Return(&common.Hash{}, errors.New("failed vote call")) - - err := s.mockVoteProposalCmd.Execute() - - s.NotNil(err) - s.Equal(err.Error(), "failed vote call") -} - -func (s *VoteProposalTestSuite) TestValidate_SuccessfulVote() { - rootCmdArgs := []string{ - "--url", "test-url", - "--private-key", "test-private-key", - "--bridge", "0x829bd824b016326a401d083b33d092293333a830", - "--data", "00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35", - "--resource", "0x000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00", - "--deposit-nonce", "2", - "--domain", "1", - } - s.mockVoteProposalCmd.SetArgs(rootCmdArgs) - resourceID, _ := hex.DecodeString("000000000000000000000075df75bcdca8ea2360c562b4aadbaf3dfaf5b19b00") - s.voter.EXPECT().SimulateVoteProposal(&proposal.Proposal{ - Source: 1, - DepositNonce: 2, - Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35"), - ResourceId: calls.SliceTo32Bytes(resourceID), - }).Return(nil) - s.voter.EXPECT().VoteProposal(&proposal.Proposal{ - Source: 1, - DepositNonce: 2, - Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35"), - ResourceId: calls.SliceTo32Bytes(resourceID), - }, transactor.TransactOptions{}).Return(&common.Hash{}, nil) - - err := s.mockVoteProposalCmd.Execute() - - s.Nil(err) -} diff --git a/chains/evm/cli/centrifuge/centrifuge.go b/chains/evm/cli/centrifuge/centrifuge.go deleted file mode 100644 index 98022d7f..00000000 --- a/chains/evm/cli/centrifuge/centrifuge.go +++ /dev/null @@ -1,28 +0,0 @@ -package centrifuge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var CentrifugeCmd = &cobra.Command{ - Use: "centrifuge", - Short: "Set of commands for interacting with a cetrifuge asset store contract", - Long: "Set of commands for interacting with a cetrifuge asset store contract", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, _, gasPrice, senderKeyPair, prepare, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - CentrifugeCmd.AddCommand(deployCmd) - CentrifugeCmd.AddCommand(getHashCmd) -} diff --git a/chains/evm/cli/centrifuge/centrifuge_test.go b/chains/evm/cli/centrifuge/centrifuge_test.go deleted file mode 100644 index d5840a21..00000000 --- a/chains/evm/cli/centrifuge/centrifuge_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package centrifuge - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type CentrifugeTestSuite struct { - suite.Suite -} - -func TestCentrifugeTestSuite(t *testing.T) { - suite.Run(t, new(CentrifugeTestSuite)) -} - -func (s *CentrifugeTestSuite) SetupSuite() { -} -func (s *CentrifugeTestSuite) TearDownSuite() {} - -func (s *CentrifugeTestSuite) TearDownTest() {} - -func (s *CentrifugeTestSuite) TestValidateGetHashFlags() { - cmd := new(cobra.Command) - BindGetHashFlags(cmd) - - err := cmd.Flag("address").Value.Set(validAddr) - s.Nil(err) - - err = ValidateGetHashFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *CentrifugeTestSuite) TestValidateGetHashInvalidAddress() { - cmd := new(cobra.Command) - BindGetHashFlags(cmd) - - err := cmd.Flag("address").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateGetHashFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/centrifuge/deploy.go b/chains/evm/cli/centrifuge/deploy.go deleted file mode 100644 index eaf98afb..00000000 --- a/chains/evm/cli/centrifuge/deploy.go +++ /dev/null @@ -1,54 +0,0 @@ -package centrifuge - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var deployCmd = &cobra.Command{ - Use: "deploy", - Short: "Deploy a centrifuge asset store contract", - Long: "The deploy subcommand deploys a Centrifuge asset store contract that represents bridged Centrifuge assets", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return DeployCentrifugeAssetStoreCmd(cmd, args, centrifuge.NewAssetStoreContract(c, common.Address{}, t)) - }, -} - -func BindDeployCmdFlags(cmd *cobra.Command) {} - -func init() { - BindDeployCmdFlags(deployCmd) -} - -func DeployCentrifugeAssetStoreCmd(cmd *cobra.Command, args []string, contract *centrifuge.AssetStoreContract) error { - assetStoreAddress, err := contract.DeployContract() - if err != nil { - log.Error().Err(fmt.Errorf("centrifuge asset store deploy failed: %w", err)) - return err - } - - log.Info().Msgf("Deployed Centrifuge asset store to address: %s", assetStoreAddress.String()) - return nil -} diff --git a/chains/evm/cli/centrifuge/flagVars.go b/chains/evm/cli/centrifuge/flagVars.go deleted file mode 100644 index 36087ba9..00000000 --- a/chains/evm/cli/centrifuge/flagVars.go +++ /dev/null @@ -1,28 +0,0 @@ -package centrifuge - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - Hash string - Address string -) - -// processed flag vars -var ( - StoreAddr common.Address - ByteHash [32]byte -) - -// global flags -var ( - url string - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool -) diff --git a/chains/evm/cli/centrifuge/get-hash.go b/chains/evm/cli/centrifuge/get-hash.go deleted file mode 100644 index 474a69c1..00000000 --- a/chains/evm/cli/centrifuge/get-hash.go +++ /dev/null @@ -1,90 +0,0 @@ -package centrifuge - -import ( - "errors" - "fmt" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var getHashCmd = &cobra.Command{ - Use: "get-hash", - Short: "Returns the status of whether a given hash exists in an asset store", - Long: "The get-hash subcommand checks the _assetsStored map on a Centrifuge asset store contract to determine whether the asset hash exists or not", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return GetHashCmd(cmd, args, centrifuge.NewAssetStoreContract(c, StoreAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateGetHashFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessGetHashFlags(cmd, args) - if err != nil { - return err - } - - return nil - }, -} - -func init() { - BindGetHashFlags(getHashCmd) -} - -func BindGetHashFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Hash, "hash", "", "A hash to lookup") - cmd.Flags().StringVar(&Address, "address", "", "Centrifuge asset store contract address") - flags.MarkFlagsAsRequired(cmd, "hash", "address") -} - -func ValidateGetHashFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Address) { - return errors.New("invalid Centrifuge asset store address") - } - - return nil -} - -func ProcessGetHashFlags(cmd *cobra.Command, args []string) error { - StoreAddr = common.HexToAddress(Address) - ByteHash = callsUtil.SliceTo32Bytes([]byte(Hash)) - - return nil -} - -func GetHashCmd(cmd *cobra.Command, args []string, contract *centrifuge.AssetStoreContract) error { - isAssetStored, err := contract.IsCentrifugeAssetStored(ByteHash) - if err != nil { - log.Error().Err(fmt.Errorf("checking if asset stored failed: %w", err)) - return err - } - - log.Info().Msgf("The hash '%s' exists: %t", Hash, isAssetStored) - return nil -} diff --git a/chains/evm/cli/cli.go b/chains/evm/cli/cli.go deleted file mode 100644 index ef14dff2..00000000 --- a/chains/evm/cli/cli.go +++ /dev/null @@ -1,94 +0,0 @@ -package cli - -import ( - "github.com/ChainSafe/sygma-core/chains/evm/cli/account" - "github.com/ChainSafe/sygma-core/chains/evm/cli/admin" - "github.com/ChainSafe/sygma-core/chains/evm/cli/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/cli/centrifuge" - "github.com/ChainSafe/sygma-core/chains/evm/cli/deploy" - "github.com/ChainSafe/sygma-core/chains/evm/cli/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/cli/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/chains/evm/cli/utils" - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -// BindCLI is public function to be invoked in example-app's cobra command -func BindCLI(cli *cobra.Command) { - cli.AddCommand(EvmRootCLI) -} - -var EvmRootCLI = &cobra.Command{ - Use: "evm-cli", - Short: "EVM CLI", - Long: "Root command for starting EVM CLI", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - // empty Run function to enable cobra PreRun - without this PreRun is never executed - Run: func(cmd *cobra.Command, args []string) {}, -} - -var ( - // Flags for all EVM CLI commands - UrlFlagName = "url" - GasLimitFlagName = "gas-limit" - GasPriceFlagName = "gas-price" - NetworkIdFlagName = "network" - PrivateKeyFlagName = "private-key" - JsonWalletFlagName = "json-wallet" - JsonWalletPasswordFlagName = "json-wallet-password" - Prepare = "prepare" -) - -func BindEVMCLIFlags(evmRootCLI *cobra.Command) { - evmRootCLI.PersistentFlags().String(UrlFlagName, "ws://localhost:8545", "URL of the node to receive RPC calls") - evmRootCLI.PersistentFlags().Uint64(GasLimitFlagName, 6721975, "Gas limit to be used in transactions") - evmRootCLI.PersistentFlags().Uint64(GasPriceFlagName, 0, "Used as upperLimitGasPrice for transactions if not 0. Transactions gasPrice is defined by estimating it on network for pre London fork networks and by estimating BaseFee and MaxTipFeePerGas in post London networks") - evmRootCLI.PersistentFlags().Uint64(NetworkIdFlagName, 0, "ID of the Network") - evmRootCLI.PersistentFlags().String(PrivateKeyFlagName, "", "Private key to use") - evmRootCLI.PersistentFlags().String(JsonWalletFlagName, "", "Encrypted JSON wallet") - evmRootCLI.PersistentFlags().String(JsonWalletPasswordFlagName, "", "Password for encrypted JSON wallet") - evmRootCLI.PersistentFlags().Bool(Prepare, false, "Generate calldata for command") - - _ = viper.BindPFlag(UrlFlagName, evmRootCLI.PersistentFlags().Lookup(UrlFlagName)) - _ = viper.BindPFlag(GasLimitFlagName, evmRootCLI.PersistentFlags().Lookup(GasLimitFlagName)) - _ = viper.BindPFlag(GasPriceFlagName, evmRootCLI.PersistentFlags().Lookup(GasPriceFlagName)) - _ = viper.BindPFlag(NetworkIdFlagName, evmRootCLI.PersistentFlags().Lookup(NetworkIdFlagName)) - _ = viper.BindPFlag(PrivateKeyFlagName, evmRootCLI.PersistentFlags().Lookup(PrivateKeyFlagName)) - _ = viper.BindPFlag(JsonWalletFlagName, evmRootCLI.PersistentFlags().Lookup(JsonWalletFlagName)) - _ = viper.BindPFlag(JsonWalletPasswordFlagName, evmRootCLI.PersistentFlags().Lookup(JsonWalletPasswordFlagName)) - _ = viper.BindPFlag(Prepare, evmRootCLI.PersistentFlags().Lookup(Prepare)) -} - -func init() { - // persistent flags - // to be used across all evm-cli commands (i.e. global) - BindEVMCLIFlags(EvmRootCLI) - - // add commands to evm-cli root - // deploy - EvmRootCLI.AddCommand(deploy.DeployEVM) - - // admin - EvmRootCLI.AddCommand(admin.AdminCmd) - - // bridge - EvmRootCLI.AddCommand(bridge.BridgeCmd) - - // erc20 - EvmRootCLI.AddCommand(erc20.ERC20Cmd) - - // erc721 - EvmRootCLI.AddCommand(erc721.ERC721Cmd) - - // centrifuge - EvmRootCLI.AddCommand(centrifuge.CentrifugeCmd) - - // account - EvmRootCLI.AddCommand(account.AccountRootCMD) - - // utils - EvmRootCLI.AddCommand(utils.UtilsCmd) -} diff --git a/chains/evm/cli/deploy/deploy.go b/chains/evm/cli/deploy/deploy.go deleted file mode 100644 index 06a6c3b5..00000000 --- a/chains/evm/cli/deploy/deploy.go +++ /dev/null @@ -1,280 +0,0 @@ -package deploy - -import ( - "errors" - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/generic" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/chains/evm/cli/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var ErrNoDeploymentFlagsProvided = errors.New("provide at least one deployment flag. For help use --help") - -var DeployEVM = &cobra.Command{ - Use: "deploy", - Short: "Deploy smart contracts", - Long: "This command can be used to deploy all or some of the contracts required for bridging. Selection of contracts can be made by either specifying --all or a subset of flags", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - RunE: CallDeployCLI, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateDeployFlags(cmd, args) - if err != nil { - return err - } - err = ProcessDeployFlags(cmd, args) - return err - }, -} - -const ( - TwoDaysTermInBlocks int64 = 6200 -) - -var ( - // Flags for all EVM Deploy CLI commands - Bridge bool - BridgeAddress string - DeployAll bool - DomainId uint8 - GenericHandler bool - Erc20 bool - Erc20Handler bool - Erc20Name string - Erc20Symbol string - Erc721 bool - Erc721Handler bool - Erc721Name string - Erc721Symbol string - Erc721BaseURI string - Fee uint64 - RelayerThreshold uint64 - Relayers []string -) - -func BindDeployEVMFlags(cmd *cobra.Command) { - cmd.Flags().BoolVar(&Bridge, "bridge", false, "Deploy bridge") - cmd.Flags().StringVar(&BridgeAddress, "bridge-address", "", "Bridge contract address. Should be provided if handlers are deployed separately") - cmd.Flags().BoolVar(&DeployAll, "all", false, "Deploy all") - cmd.Flags().Uint8Var(&DomainId, "domain", 1, "Domain ID for the instance") - cmd.Flags().BoolVar(&Erc20, "erc20", false, "Deploy ERC20") - cmd.Flags().BoolVar(&Erc20Handler, "erc20-handler", false, "Deploy ERC20 handler") - cmd.Flags().StringVar(&Erc20Name, "erc20-name", "", "ERC20 contract name") - cmd.Flags().StringVar(&Erc20Symbol, "erc20-symbol", "", "ERC20 contract symbol") - cmd.Flags().BoolVar(&Erc721, "erc721", false, "Deploy ERC721") - cmd.Flags().BoolVar(&Erc721Handler, "erc721-handler", false, "Deploy ERC721 handler") - cmd.Flags().StringVar(&Erc721Name, "erc721-name", "", "ERC721 contract name") - cmd.Flags().StringVar(&Erc721Symbol, "erc721-symbol", "", "ERC721 contract symbol") - cmd.Flags().StringVar(&Erc721BaseURI, "erc721-base-uri", "", "ERC721 base URI") - cmd.Flags().BoolVar(&GenericHandler, "generic-handler", false, "Deploy generic handler") - cmd.Flags().Uint64Var(&Fee, "fee", 0, "Fee to be taken when making a deposit (in ETH, decimals are allowed)") - cmd.Flags().StringSliceVar(&Relayers, "relayers", []string{}, "List of initial relayers") - cmd.Flags().Uint64Var(&RelayerThreshold, "relayer-threshold", 1, "Number of votes required for a proposal to pass") -} - -func init() { - BindDeployEVMFlags(DeployEVM) -} - -func ValidateDeployFlags(cmd *cobra.Command, args []string) error { - Deployments = make([]string, 0) - if DeployAll { - flags.MarkFlagsAsRequired(cmd, "relayer-threshold", "domain", "fee", "erc20-symbol", "erc20-name") - Deployments = append(Deployments, []string{"bridge", "erc20-handler", "erc721-handler", "generic-handler", "erc20", "erc721"}...) - } else { - if Bridge { - flags.MarkFlagsAsRequired(cmd, "relayer-threshold", "domain", "fee") - Deployments = append(Deployments, "bridge") - } - if Erc20Handler { - if !Bridge { - flags.MarkFlagsAsRequired(cmd, "bridge-address") - } - Deployments = append(Deployments, "erc20-handler") - } - if Erc721Handler { - if !Bridge { - flags.MarkFlagsAsRequired(cmd, "bridge-address") - } - Deployments = append(Deployments, "erc721-handler") - } - if GenericHandler { - if !Bridge { - flags.MarkFlagsAsRequired(cmd, "bridge-address") - } - Deployments = append(Deployments, "generic-handler") - } - if Erc20 { - flags.MarkFlagsAsRequired(cmd, "erc20-symbol", "erc20-name") - Deployments = append(Deployments, "erc20") - } - if Erc721 { - flags.MarkFlagsAsRequired(cmd, "erc721-name", "erc721-symbol", "erc721-base-uri") - Deployments = append(Deployments, "erc721") - } - } - - if len(Deployments) == 0 { - log.Error().Err(ErrNoDeploymentFlagsProvided) - return ErrNoDeploymentFlagsProvided - } - - return nil -} - -var Deployments []string -var BridgeAddr common.Address -var RelayerAddresses []common.Address - -func ProcessDeployFlags(cmd *cobra.Command, args []string) error { - if common.IsHexAddress(BridgeAddress) { - BridgeAddr = common.HexToAddress(BridgeAddress) - } - for _, addr := range Relayers { - if !common.IsHexAddress(addr) { - return fmt.Errorf("invalid relayer address %s", addr) - } - RelayerAddresses = append(RelayerAddresses, common.HexToAddress(addr)) - } - return nil -} - -func CallDeployCLI(cmd *cobra.Command, args []string) error { - txFabric := evmtransaction.NewTransaction - return DeployCLI(cmd, args, txFabric, &evmgaspricer.LondonGasPriceDeterminant{}) -} - -func DeployCLI(cmd *cobra.Command, args []string, txFabric calls.TxFabric, gasPricer utils.GasPricerWithPostConfig) error { - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, _, err := flags.GlobalFlagValues(cmd) - if err != nil { - return err - } - - log.Debug().Msgf("url: %s gas limit: %v gas price: %v", url, gasLimit, gasPrice) - log.Debug().Msgf("SENDER Address %s", senderKeyPair.CommonAddress().Hex()) - - ethClient, err := evmclient.NewEVMClient(url, senderKeyPair) - if err != nil { - log.Error().Err(fmt.Errorf("ethereum client error: %v", err)).Msg("error initializing new EVM client") - return err - } - gasPricer.SetClient(ethClient) - gasPricer.SetOpts(&evmgaspricer.GasPricerOpts{UpperLimitFeePerGas: gasPrice}) - log.Debug().Msgf("Relayers for deploy %+v", Relayers) - log.Debug().Msgf("all bool: %v", DeployAll) - - t := signAndSend.NewSignAndSendTransactor(txFabric, gasPricer, ethClient) - - deployedContracts := make(map[string]string) - for _, v := range Deployments { - switch v { - case "bridge": - log.Debug().Msgf("deploying bridge..") - bc := bridge.NewBridgeContract(ethClient, common.Address{}, t) - BridgeAddr, err = bc.DeployContract( - DomainId, - RelayerAddresses, - big.NewInt(0).SetUint64(RelayerThreshold), - big.NewInt(0).SetUint64(Fee), - big.NewInt(TwoDaysTermInBlocks), // _expiry is set to 48 hours by default - ) - if err != nil { - log.Error().Err(fmt.Errorf("bridge deploy failed: %w", err)) - return err - } - deployedContracts["bridge"] = BridgeAddr.String() - log.Debug().Msgf("bridge address; %v", BridgeAddr.String()) - case "erc20": - log.Debug().Msgf("deploying ERC20..") - erc20Contract := erc20.NewERC20Contract(ethClient, common.Address{}, t) - erc20Addr, err := erc20Contract.DeployContract(Erc20Name, Erc20Symbol) - if err != nil { - log.Error().Err(fmt.Errorf("erc 20 deploy failed: %w", err)) - return err - } - deployedContracts["erc20Token"] = erc20Addr.String() - case "erc20-handler": - log.Debug().Msgf("deploying ERC20 handler..") - erc20HandlerContract := erc20.NewERC20HandlerContract(ethClient, common.Address{}, t) - erc20HandlerAddr, err := erc20HandlerContract.DeployContract(BridgeAddr) - if err != nil { - log.Error().Err(fmt.Errorf("ERC20 handler deploy failed: %w", err)) - return err - } - deployedContracts["erc20Handler"] = erc20HandlerAddr.String() - case "erc721": - log.Debug().Msgf("deploying ERC721..") - erc721Contract := erc721.NewErc721Contract(ethClient, common.Address{}, t) - erc721Addr, err := erc721Contract.DeployContract(Erc721Name, Erc721Symbol, Erc721BaseURI) - if err != nil { - log.Error().Err(fmt.Errorf("ERC721 deploy failed: %w", err)) - return err - } - deployedContracts["erc721Token"] = erc721Addr.String() - case "erc721-handler": - log.Debug().Msgf("deploying ERC721 handler..") - erc721HandlerContract := erc721.NewERC721HandlerContract(ethClient, common.Address{}, t) - erc721HandlerAddr, err := erc721HandlerContract.DeployContract(BridgeAddr) - if err != nil { - log.Error().Err(fmt.Errorf("ERC721 handler deploy failed: %w", err)) - return err - } - deployedContracts["erc721Handler"] = erc721HandlerAddr.String() - case "generic-handler": - log.Debug().Msgf("deploying generic handler..") - emptyAddr := common.Address{} - if BridgeAddr == emptyAddr { - log.Error().Err(errors.New("bridge flag or bridge-address param should be set for contracts Deployments")) - return err - } - genericHandlerContract := generic.NewGenericHandlerContract(ethClient, common.Address{}, t) - genericHandlerAddr, err := genericHandlerContract.DeployContract(BridgeAddr) - if err != nil { - log.Error().Err(fmt.Errorf("Generic handler deploy failed: %w", err)) - return err - } - deployedContracts["genericHandler"] = genericHandlerAddr.String() - } - } - fmt.Printf(` - Deployed contracts -========================================================= -Bridge: %s ---------------------------------------------------------- -ERC20 Token: %s ---------------------------------------------------------- -ERC20 Handler: %s ---------------------------------------------------------- -ERC721 Token: %s ---------------------------------------------------------- -ERC721 Handler: %s ---------------------------------------------------------- -Generic Handler: %s -========================================================= - `, - deployedContracts["bridge"], - deployedContracts["erc20Token"], - deployedContracts["erc20Handler"], - deployedContracts["erc721Token"], - deployedContracts["erc721Handler"], - deployedContracts["genericHandler"], - ) - return nil -} diff --git a/chains/evm/cli/erc20/add-minter.go b/chains/evm/cli/erc20/add-minter.go deleted file mode 100644 index 9193b927..00000000 --- a/chains/evm/cli/erc20/add-minter.go +++ /dev/null @@ -1,83 +0,0 @@ -package erc20 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var addMinterCmd = &cobra.Command{ - Use: "add-minter", - Short: "Add a new ERC20 minter", - Long: "The add-minter subcommand adds a minter to an ERC20 mintable contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return AddMinterCmd(cmd, args, erc20.NewERC20Contract(c, Erc20Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateAddMinterFlags(cmd, args) - if err != nil { - return err - } - ProcessAddMinterFlags(cmd, args) - return nil - }, -} - -func BindAddMinterFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc20Address, "contract", "", "ERC20 contract address") - cmd.Flags().StringVar(&Minter, "minter", "", "Minter address") - flags.MarkFlagsAsRequired(cmd, "contract", "minter") -} - -func init() { - BindAddMinterFlags(addMinterCmd) -} - -func ValidateAddMinterFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc20Address) { - return fmt.Errorf("invalid ERC20 contract address: %s", Erc20Address) - } - if !common.IsHexAddress(Minter) { - return fmt.Errorf("invalid minter address: %s", Minter) - } - return nil -} - -func ProcessAddMinterFlags(cmd *cobra.Command, args []string) { - Erc20Addr = common.HexToAddress(Erc20Address) - MinterAddr = common.HexToAddress(Minter) -} - -func AddMinterCmd(cmd *cobra.Command, args []string, contract *erc20.ERC20Contract) error { - _, err := contract.AddMinter(MinterAddr, transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - log.Error().Err(err) - return err - } - - log.Info().Msgf("%s account granted minter roles", MinterAddr.String()) - return nil -} diff --git a/chains/evm/cli/erc20/approve.go b/chains/evm/cli/erc20/approve.go deleted file mode 100644 index a26d1416..00000000 --- a/chains/evm/cli/erc20/approve.go +++ /dev/null @@ -1,108 +0,0 @@ -package erc20 - -import ( - "errors" - "math/big" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var approveCmd = &cobra.Command{ - Use: "approve", - Short: "Approve an ERC20 tokens", - Long: "The approve subcommand approves tokens in an ERC20 contract for transfer", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return ApproveCmd(cmd, args, erc20.NewERC20Contract(c, Erc20Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateApproveFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessApproveFlags(cmd, args) - return err - }, -} - -func BindApproveFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc20Address, "contract", "", "ERC20 contract address") - cmd.Flags().StringVar(&Amount, "amount", "", "Amount to grant allowance") - cmd.Flags().StringVar(&Recipient, "recipient", "", "Recipient address") - cmd.Flags().Uint64Var(&Decimals, "decimals", 0, "ERC20 token decimals") - flags.MarkFlagsAsRequired(cmd, "contract", "amount", "recipient", "decimals") -} - -func init() { - BindApproveFlags(approveCmd) -} - -func ValidateApproveFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc20Address) { - return errors.New("invalid erc20Address address") - } - if !common.IsHexAddress(Recipient) { - return errors.New("invalid minter address") - } - return nil -} - -func ProcessApproveFlags(cmd *cobra.Command, args []string) error { - var err error - - decimals := big.NewInt(int64(Decimals)) - Erc20Addr = common.HexToAddress(Erc20Address) - RecipientAddress = common.HexToAddress(Recipient) - RealAmount, err = callsUtil.UserAmountToWei(Amount, decimals) - if err != nil { - return err - } - - return nil -} - -func ApproveCmd(cmd *cobra.Command, args []string, contract *erc20.ERC20Contract) error { - log.Debug().Msgf(` -Approving ERC20 -ERC20 address: %s -Recipient address: %s -Amount: %s -Decimals: %v`, - Erc20Address, Recipient, Amount, Decimals) - - _, err := contract.ApproveTokens(RecipientAddress, RealAmount, transactor.TransactOptions{GasLimit: gasLimit}) - if err != nil { - log.Fatal().Err(err) - return err - } - log.Info().Msgf( - "%s account granted allowance on %v tokens of %s", - RecipientAddress.String(), Amount, RecipientAddress.String(), - ) - return nil -} diff --git a/chains/evm/cli/erc20/balance.go b/chains/evm/cli/erc20/balance.go deleted file mode 100644 index 87ba330c..00000000 --- a/chains/evm/cli/erc20/balance.go +++ /dev/null @@ -1,86 +0,0 @@ -package erc20 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var balanceCmd = &cobra.Command{ - Use: "balance", - Short: "Query an ERC20 token balance", - Long: "The balance subcommand queries the balance of an account in an ERC20 contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return BalanceCmd(cmd, args, erc20.NewERC20Contract(c, Erc20Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateBalanceFlags(cmd, args) - if err != nil { - return err - } - - ProcessBalanceFlags(cmd, args) - return nil - }, -} - -func BindBalanceFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc20Address, "contract", "", "ERC20 contract address") - cmd.Flags().StringVar(&AccountAddress, "address", "", "Address to receive balance of") - flags.MarkFlagsAsRequired(cmd, "contract", "address") -} - -func init() { - BindBalanceFlags(balanceCmd) -} - -var accountAddr common.Address - -func ValidateBalanceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc20Address) { - return fmt.Errorf("invalid recipient address %s", Recipient) - } - if !common.IsHexAddress(AccountAddress) { - return fmt.Errorf("invalid account address %s", AccountAddress) - } - return nil -} - -func ProcessBalanceFlags(cmd *cobra.Command, args []string) { - Erc20Addr = common.HexToAddress(Erc20Address) - accountAddr = common.HexToAddress(AccountAddress) -} - -func BalanceCmd(cmd *cobra.Command, args []string, contract *erc20.ERC20Contract) error { - balance, err := contract.GetBalance(accountAddr) - if err != nil { - log.Error().Err(fmt.Errorf("failed contract call error: %v", err)) - return err - } - - log.Info().Msgf("balance of %s is %s", accountAddr.String(), balance.String()) - return nil -} diff --git a/chains/evm/cli/erc20/deposit.go b/chains/evm/cli/erc20/deposit.go deleted file mode 100644 index 5954e980..00000000 --- a/chains/evm/cli/erc20/deposit.go +++ /dev/null @@ -1,115 +0,0 @@ -package erc20 - -import ( - "fmt" - "math/big" - - callsUtil "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var depositCmd = &cobra.Command{ - Use: "deposit", - Short: "Deposit an ERC20 token", - Long: "The deposit subcommand creates a new ERC20 token deposit on the bridge contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return DepositCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateDepositFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessDepositFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func init() { - BindDepositFlags(depositCmd) -} - -func BindDepositFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Recipient, "recipient", "", "Address of recipient") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Address of bridge contract") - cmd.Flags().StringVar(&Amount, "amount", "", "Amount to deposit") - cmd.Flags().Uint8Var(&DomainID, "domain", 0, "Destination domain ID") - cmd.Flags().StringVar(&ResourceID, "resource", "", "Resource ID for transfer") - cmd.Flags().Uint64Var(&Decimals, "decimals", 0, "ERC20 token decimals") - cmd.Flags().StringVar(&Priority, "priority", "none", "Transaction priority speed") - flags.MarkFlagsAsRequired(cmd, "recipient", "bridge", "amount", "domain", "resource", "decimals") -} - -func ValidateDepositFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Recipient) { - return fmt.Errorf("invalid recipient address %s", Recipient) - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address %s", Bridge) - } - switch Priority { - case "none", "slow", "medium", "fast": - return nil - default: - return fmt.Errorf("invalid priority value %s, supported priorities: \"slow|medium|fast\"", Priority) - } -} - -func ProcessDepositFlags(cmd *cobra.Command, args []string) error { - var err error - - RecipientAddress = common.HexToAddress(Recipient) - decimals := big.NewInt(int64(Decimals)) - BridgeAddr = common.HexToAddress(Bridge) - RealAmount, err = callsUtil.UserAmountToWei(Amount, decimals) - if err != nil { - return err - } - ResourceIdBytesArr, err = flags.ProcessResourceID(ResourceID) - return err -} - -func DepositCmd(cmd *cobra.Command, args []string, contract *bridge.BridgeContract) error { - hash, err := contract.Erc20Deposit( - RecipientAddress, RealAmount, ResourceIdBytesArr, - uint8(DomainID), transactor.TransactOptions{GasLimit: gasLimit, Priority: transactor.TxPriorities[Priority]}, - ) - if err != nil { - log.Error().Err(fmt.Errorf("erc20 deposit error: %v", err)) - return err - } - - log.Info().Msgf( - "%s tokens were transferred to %s from %s with hash %s", - Amount, RecipientAddress.Hex(), senderKeyPair.CommonAddress().String(), hash.Hex(), - ) - return nil -} diff --git a/chains/evm/cli/erc20/erc20.go b/chains/evm/cli/erc20/erc20.go deleted file mode 100644 index 3f747e31..00000000 --- a/chains/evm/cli/erc20/erc20.go +++ /dev/null @@ -1,32 +0,0 @@ -package erc20 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var ERC20Cmd = &cobra.Command{ - Use: "erc20", - Short: "Set of commands for interacting with an ERC20 contract", - Long: "Set of commands for interacting with an ERC20 contract", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, prepare, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - ERC20Cmd.AddCommand(addMinterCmd) - ERC20Cmd.AddCommand(getAllowanceCmd) - ERC20Cmd.AddCommand(approveCmd) - ERC20Cmd.AddCommand(balanceCmd) - ERC20Cmd.AddCommand(depositCmd) - ERC20Cmd.AddCommand(mintCmd) -} diff --git a/chains/evm/cli/erc20/erc20_test.go b/chains/evm/cli/erc20/erc20_test.go deleted file mode 100644 index f3bc4dc7..00000000 --- a/chains/evm/cli/erc20/erc20_test.go +++ /dev/null @@ -1,223 +0,0 @@ -package erc20 - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type ERC20TestSuite struct { - suite.Suite -} - -func TestERC20TestSuite(t *testing.T) { - suite.Run(t, new(ERC20TestSuite)) -} - -func (s *ERC20TestSuite) SetupSuite() { -} -func (s *ERC20TestSuite) TearDownSuite() {} - -func (s *ERC20TestSuite) TearDownTest() {} - -func (s *ERC20TestSuite) TestValidateAddMinterFlags() { - cmd := new(cobra.Command) - BindAddMinterFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("minter").Value.Set(validAddr) - s.Nil(err) - - err = ValidateAddMinterFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateAddMinterInvalidAddress() { - cmd := new(cobra.Command) - BindAddMinterFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("minter").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateAddMinterFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC20TestSuite) TestValidateApproveFlags() { - cmd := new(cobra.Command) - BindApproveFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - - err = ValidateApproveFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateApproveInvalidAddress() { - cmd := new(cobra.Command) - BindApproveFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateApproveFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC20TestSuite) TestValidateBalanceFlags() { - cmd := new(cobra.Command) - BindBalanceFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("address").Value.Set(validAddr) - s.Nil(err) - - err = ValidateBalanceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateBalanceInvalidAddress() { - cmd := new(cobra.Command) - BindBalanceFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("address").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateBalanceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC20TestSuite) TestValidateDepositFlags() { - cmd := new(cobra.Command) - BindDepositFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateDepositFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateDepositInvalidAddress() { - cmd := new(cobra.Command) - BindDepositFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateDepositFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC20TestSuite) TestValidateGetAllowanceFlags() { - cmd := new(cobra.Command) - BindGetAllowanceFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("owner").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("spender").Value.Set(validAddr) - s.Nil(err) - - err = ValidateGetAllowanceFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateGetAllowanceInvalidAddress() { - cmd := new(cobra.Command) - BindGetAllowanceFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("owner").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("spender").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateGetAllowanceFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC20TestSuite) TestValidateMintFlags() { - cmd := new(cobra.Command) - BindMintFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - - err = ValidateMintFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC20TestSuite) TestValidateMintInvalidAddress() { - cmd := new(cobra.Command) - BindMintFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateMintFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/erc20/flagVars.go b/chains/evm/cli/erc20/flagVars.go deleted file mode 100644 index 6e5d1dea..00000000 --- a/chains/evm/cli/erc20/flagVars.go +++ /dev/null @@ -1,47 +0,0 @@ -package erc20 - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - Amount string - Decimals uint64 - DstAddress string - Erc20Address string - Recipient string - Bridge string - DomainID uint8 - ResourceID string - AccountAddress string - OwnerAddress string - SpenderAddress string - Minter string - Priority string -) - -// processed flag vars -var ( - RecipientAddress common.Address - RealAmount *big.Int - Erc20Addr common.Address - MinterAddr common.Address - BridgeAddr common.Address - ResourceIdBytesArr types.ResourceID -) - -// global flags -var ( - dstAddress common.Address - url string - gasLimit uint64 - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool -) diff --git a/chains/evm/cli/erc20/get-allowance.go b/chains/evm/cli/erc20/get-allowance.go deleted file mode 100644 index 86ae7b29..00000000 --- a/chains/evm/cli/erc20/get-allowance.go +++ /dev/null @@ -1,117 +0,0 @@ -package erc20 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ChainSafe/sygma-core/util" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var getAllowanceCmd = &cobra.Command{ - Use: "get-allowance", - Short: "Get the allowance of a spender for an address", - Long: "The get-allowance subcommand returns the allowance of a spender for an address", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return GetAllowanceCmd(cmd, args, erc20.NewERC20Contract(c, Erc20Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateDepositFlags(cmd, args) - if err != nil { - return err - } - return nil - }, -} - -func BindGetAllowanceFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc20Address, "contract", "", "ERC20 contract address") - cmd.Flags().StringVar(&OwnerAddress, "owner", "", "Address of token owner") - cmd.Flags().StringVar(&SpenderAddress, "spender", "", "Address of spender") - flags.MarkFlagsAsRequired(cmd, "contract", "owner", "spender") -} - -func init() { - BindGetAllowanceFlags(getAllowanceCmd) -} -func ValidateGetAllowanceFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc20Address) { - return fmt.Errorf("invalid contract address %s", Erc20Address) - } - if !common.IsHexAddress(OwnerAddress) { - return fmt.Errorf("invalid owner address %s", OwnerAddress) - } - if !common.IsHexAddress(SpenderAddress) { - return fmt.Errorf("invalid spender address %s", SpenderAddress) - } - return nil -} - -func GetAllowanceCmd(cmd *cobra.Command, args []string, contract *erc20.ERC20Contract) error { - log.Debug().Msgf(` -Determing allowance -ERC20 address: %s -Owner address: %s -Spender address: %s`, - Erc20Address, OwnerAddress, SpenderAddress) - return nil - - /* - url := cctx.String("url") - gasLimit := cctx.Uint64("gasLimit") - gasPrice := cctx.Uint64("gasPrice") - sender, err := cliutils.DefineSender(cctx) - if err != nil { - return err - } - erc20 := cctx.String("erc20Address") - if !common.IsHexAddress(erc20) { - return errors.New("invalid erc20Address address") - } - erc20Address := common.HexToAddress(erc20) - - spender := cctx.String("spender") - if !common.IsHexAddress(spender) { - return errors.New("invalid spender address") - } - spenderAddress := common.HexToAddress(spender) - - owner := cctx.String("owner") - if !common.IsHexAddress(owner) { - return errors.New("invalid owner address") - } - ownerAddress := common.HexToAddress(owner) - - ethClient, err := client.NewClient(url, false, sender, big.NewInt(0).SetUint64(gasLimit), big.NewInt(0).SetUint64(gasPrice), big.NewFloat(1)) - if err != nil { - log.Error().Err(fmt.Errorf("eth client intialization error: %v", err)) - return err - } - balance, err := utils.ERC20Allowance(ethClient, erc20Address, spenderAddress, ownerAddress) - if err != nil { - return err - } - log.Info().Msgf("allowance of %s to spend from address %s is %s", spenderAddress.String(), ownerAddress.String(), balance.String()) - return nil - */ -} diff --git a/chains/evm/cli/erc20/mint.go b/chains/evm/cli/erc20/mint.go deleted file mode 100644 index 07a13592..00000000 --- a/chains/evm/cli/erc20/mint.go +++ /dev/null @@ -1,104 +0,0 @@ -package erc20 - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var mintCmd = &cobra.Command{ - Use: "mint", - Short: "Mint an ERC20 token", - Long: "The mint subcommand mints a token on an ERC20 mintable contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return MintCmd(cmd, args, erc20.NewERC20Contract(c, Erc20Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateMintFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessMintFlags(cmd, args) - return err - }, -} - -func init() { - BindMintFlags(mintCmd) -} -func BindMintFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc20Address, "contract", "", "ERC20 contract address") - cmd.Flags().StringVar(&Amount, "amount", "", "Deposit amount") - cmd.Flags().Uint64Var(&Decimals, "decimals", 0, "ERC20 token decimals") - cmd.Flags().StringVar(&DstAddress, "recipient", "", "Recipient address") - flags.MarkFlagsAsRequired(cmd, "contract", "amount", "decimals", "recipient") -} - -func ValidateMintFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc20Address) { - return fmt.Errorf("invalid ERC20 address %s", Erc20Address) - } - if !common.IsHexAddress(DstAddress) { - return fmt.Errorf("invalid recipient address %s", DstAddress) - } - return nil -} - -func ProcessMintFlags(cmd *cobra.Command, args []string) error { - var err error - decimals := big.NewInt(int64(Decimals)) - Erc20Addr = common.HexToAddress(Erc20Address) - - if !common.IsHexAddress(DstAddress) { - dstAddress = senderKeyPair.CommonAddress() - } else { - dstAddress = common.HexToAddress(DstAddress) - } - - RealAmount, err = calls.UserAmountToWei(Amount, decimals) - if err != nil { - log.Error().Err(err) - return err - } - - return nil -} - -func MintCmd(cmd *cobra.Command, args []string, contract *erc20.ERC20Contract) error { - _, err := contract.MintTokens( - dstAddress, RealAmount, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - log.Error().Err(err) - return err - } - log.Info().Msgf("%v tokens minted", Amount) - return nil -} diff --git a/chains/evm/cli/erc721/add-minter.go b/chains/evm/cli/erc721/add-minter.go deleted file mode 100644 index 9831f3e9..00000000 --- a/chains/evm/cli/erc721/add-minter.go +++ /dev/null @@ -1,88 +0,0 @@ -package erc721 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var addMinterCmd = &cobra.Command{ - Use: "add-minter", - Short: "Add a new ERC721 minter", - Long: "The add-minter subcommand adds a new minter address to an ERC721 mintable contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return AddMinterCmd(cmd, args, erc721.NewErc721Contract(c, Erc721Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateAddMinterFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessAddMinterFlags(cmd, args) - return err - }, -} - -func BindAddMinterFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc721Address, "contract", "", "ERC721 contract address") - cmd.Flags().StringVar(&Minter, "minter", "", "Minter address") -} - -func init() { - BindAddMinterFlags(addMinterCmd) -} - -func ValidateAddMinterFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc721Address) { - return fmt.Errorf("invalid ERC721 contract address %s", Erc721Address) - } - if !common.IsHexAddress(Minter) { - return fmt.Errorf("invalid minter address %s", Minter) - } - return nil -} - -func ProcessAddMinterFlags(cmd *cobra.Command, args []string) error { - Erc721Addr = common.HexToAddress(Erc721Address) - MinterAddr = common.HexToAddress(Minter) - return nil -} - -func AddMinterCmd(cmd *cobra.Command, args []string, erc721Contract *erc721.ERC721Contract) error { - _, err = erc721Contract.AddMinter( - MinterAddr, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - return err - } - log.Debug().Msgf(` - Adding minter - Minter address: %s - ERC721 address: %s`, - MinterAddr, Erc721Addr) - return err -} diff --git a/chains/evm/cli/erc721/approve.go b/chains/evm/cli/erc721/approve.go deleted file mode 100644 index e6a8ce62..00000000 --- a/chains/evm/cli/erc721/approve.go +++ /dev/null @@ -1,94 +0,0 @@ -package erc721 - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var approveCmd = &cobra.Command{ - Use: "approve", - Short: "Approve an ERC721 token", - Long: "The approve subcommand approves a token in an ERC721 contract for transfer", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return ApproveCmd(cmd, args, erc721.NewErc721Contract(c, Erc721Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateApproveFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessApproveFlags(cmd, args) - return err - }, -} - -func BindApproveFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc721Address, "contract", "", "ERC721 contract address") - cmd.Flags().StringVar(&Recipient, "recipient", "", "Recipient address") - cmd.Flags().StringVar(&Token, "token", "", "ERC721 token ID") - flags.MarkFlagsAsRequired(cmd, "contract", "recipient", "token") -} - -func init() { - BindApproveFlags(approveCmd) -} - -func ValidateApproveFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc721Address) { - return fmt.Errorf("invalid ERC721 contract address %s", Erc721Address) - } - if !common.IsHexAddress(Recipient) { - return fmt.Errorf("invalid recipient address") - } - return nil -} - -func ProcessApproveFlags(cmd *cobra.Command, args []string) error { - RecipientAddr = common.HexToAddress(Recipient) - Erc721Addr = common.HexToAddress(Erc721Address) - - var ok bool - if TokenId, ok = big.NewInt(0).SetString(Token, 10); !ok { - return fmt.Errorf("invalid token id value") - } - return nil -} - -func ApproveCmd(cmd *cobra.Command, args []string, erc721Contract *erc721.ERC721Contract) error { - _, err = erc721Contract.Approve( - TokenId, RecipientAddr, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - return err - } - - log.Info().Msgf("%v token approved", TokenId) - return err -} diff --git a/chains/evm/cli/erc721/deposit.go b/chains/evm/cli/erc721/deposit.go deleted file mode 100644 index 22510f0d..00000000 --- a/chains/evm/cli/erc721/deposit.go +++ /dev/null @@ -1,120 +0,0 @@ -package erc721 - -import ( - "fmt" - "math/big" - "strconv" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var depositCmd = &cobra.Command{ - Use: "deposit", - Short: "Deposit an ERC721 token", - Long: "The deposit subcommand creates a new ERC721 token deposit on the bridge contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return DepositCmd(cmd, args, bridge.NewBridgeContract(c, BridgeAddr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateDepositFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessDepositFlags(cmd, args) - return err - }, -} - -func BindDepositFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Recipient, "recipient", "", "Recipient address") - cmd.Flags().StringVar(&Bridge, "bridge", "", "Bridge contract address") - cmd.Flags().StringVar(&DestionationID, "destination", "", "Destination domain ID") - cmd.Flags().StringVar(&ResourceID, "resource", "", "Resource ID for transfer") - cmd.Flags().StringVar(&Token, "token", "", "ERC721 token ID") - cmd.Flags().StringVar(&Metadata, "metadata", "", "ERC721 token metadata") - cmd.Flags().StringVar(&Priority, "priority", "none", "Transaction priority speed (default: medium)") - flags.MarkFlagsAsRequired(cmd, "recipient", "bridge", "destination", "resource", "token") -} - -func init() { - BindDepositFlags(depositCmd) -} - -func ValidateDepositFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Recipient) { - return fmt.Errorf("invalid recipient address") - } - if !common.IsHexAddress(Bridge) { - return fmt.Errorf("invalid bridge address") - } - switch Priority { - case "none", "slow", "medium", "fast": - return nil - default: - return fmt.Errorf("invalid priority value %s, supported priorities: \"slow|medium|fast\"", Priority) - } -} - -func ProcessDepositFlags(cmd *cobra.Command, args []string) error { - RecipientAddr = common.HexToAddress(Recipient) - BridgeAddr = common.HexToAddress(Bridge) - - DestinationID, err = strconv.Atoi(DestionationID) - if err != nil { - log.Error().Err(fmt.Errorf("destination ID conversion error: %v", err)) - return err - } - - var ok bool - TokenId, ok = big.NewInt(0).SetString(Token, 10) - if !ok { - return fmt.Errorf("invalid token id value") - } - - ResourceId, err = flags.ProcessResourceID(ResourceID) - return err -} - -func DepositCmd(cmd *cobra.Command, args []string, bridgeContract *bridge.BridgeContract) error { - txHash, err := bridgeContract.Erc721Deposit( - TokenId, Metadata, RecipientAddr, ResourceId, uint8(DestinationID), transactor.TransactOptions{GasLimit: gasLimit, Priority: transactor.TxPriorities[Priority]}, - ) - if err != nil { - return err - } - - log.Info().Msgf( - `erc721 deposit hash: %s - %s token were transferred to %s from %s`, - txHash.Hex(), - TokenId.String(), - RecipientAddr.Hex(), - senderKeyPair.CommonAddress().String(), - ) - return nil -} diff --git a/chains/evm/cli/erc721/erc721.go b/chains/evm/cli/erc721/erc721.go deleted file mode 100644 index 23cbc6bd..00000000 --- a/chains/evm/cli/erc721/erc721.go +++ /dev/null @@ -1,31 +0,0 @@ -package erc721 - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/spf13/cobra" -) - -var ERC721Cmd = &cobra.Command{ - Use: "erc721", - Short: "Set of commands for interacting with an ERC721 contract", - Long: "Set of commands for interacting with an ERC721 contract", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - // fetch global flag values - url, gasLimit, gasPrice, senderKeyPair, prepare, err = flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - return nil - }, -} - -func init() { - ERC721Cmd.AddCommand(mintCmd) - ERC721Cmd.AddCommand(approveCmd) - ERC721Cmd.AddCommand(ownerCmd) - ERC721Cmd.AddCommand(depositCmd) - ERC721Cmd.AddCommand(addMinterCmd) -} diff --git a/chains/evm/cli/erc721/erc721_test.go b/chains/evm/cli/erc721/erc721_test.go deleted file mode 100644 index a3d697d3..00000000 --- a/chains/evm/cli/erc721/erc721_test.go +++ /dev/null @@ -1,183 +0,0 @@ -package erc721 - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" -) - -type ERC721TestSuite struct { - suite.Suite -} - -func TestERC721TestSuite(t *testing.T) { - suite.Run(t, new(ERC721TestSuite)) -} - -func (s *ERC721TestSuite) SetupSuite() { -} -func (s *ERC721TestSuite) TearDownSuite() {} - -func (s *ERC721TestSuite) TearDownTest() {} - -func (s *ERC721TestSuite) TestValidateAddMinterFlags() { - cmd := new(cobra.Command) - BindAddMinterFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("minter").Value.Set(validAddr) - s.Nil(err) - - err = ValidateAddMinterFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC721TestSuite) TestValidateAddMinterInvalidAddress() { - cmd := new(cobra.Command) - BindAddMinterFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("minter").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateAddMinterFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC721TestSuite) TestValidateApproveFlags() { - cmd := new(cobra.Command) - BindApproveFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - - err = ValidateApproveFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC721TestSuite) TestValidateApproveInvalidAddress() { - cmd := new(cobra.Command) - BindApproveFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateApproveFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC721TestSuite) TestValidateDepositFlags() { - cmd := new(cobra.Command) - BindDepositFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(validAddr) - s.Nil(err) - - err = ValidateDepositFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC721TestSuite) TestValidateDepositInvalidAddress() { - cmd := new(cobra.Command) - BindDepositFlags(cmd) - - err := cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("bridge").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateDepositFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC721TestSuite) TestValidateMintFlags() { - cmd := new(cobra.Command) - BindMintFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(validAddr) - s.Nil(err) - - err = ValidateMintFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC721TestSuite) TestValidateMintInvalidAddress() { - cmd := new(cobra.Command) - BindMintFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("recipient").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateMintFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *ERC721TestSuite) TestValidateOwnerFlags() { - cmd := new(cobra.Command) - BindOwnerFlags(cmd) - - err := cmd.Flag("contract").Value.Set(validAddr) - s.Nil(err) - - err = ValidateOwnerFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *ERC721TestSuite) TestValidateOwnerInvalidAddress() { - cmd := new(cobra.Command) - BindOwnerFlags(cmd) - - err := cmd.Flag("contract").Value.Set(invalidAddr) - s.Nil(err) - - err = ValidateOwnerFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/cli/erc721/flagVars.go b/chains/evm/cli/erc721/flagVars.go deleted file mode 100644 index 938e5db6..00000000 --- a/chains/evm/cli/erc721/flagVars.go +++ /dev/null @@ -1,45 +0,0 @@ -package erc721 - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" -) - -// flag vars -var ( - Erc721Address string - Dst string - Token string - Metadata string - Recipient string - Bridge string - DestionationID string - ResourceID string - Minter string - Priority string -) - -// processed flag vars -var ( - Erc721Addr common.Address - DstAddress common.Address - TokenId *big.Int - RecipientAddr common.Address - BridgeAddr common.Address - DestinationID int - ResourceId types.ResourceID - MinterAddr common.Address -) - -// global flags -var ( - url string - gasLimit uint64 - gasPrice *big.Int - senderKeyPair *secp256k1.Keypair - prepare bool - err error -) diff --git a/chains/evm/cli/erc721/mint.go b/chains/evm/cli/erc721/mint.go deleted file mode 100644 index 6addaecd..00000000 --- a/chains/evm/cli/erc721/mint.go +++ /dev/null @@ -1,101 +0,0 @@ -package erc721 - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var mintCmd = &cobra.Command{ - Use: "mint", - Short: "Mint an ERC721 token", - Long: "The mint subcommand mints a token on an ERC721 mintable contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return MintCmd(cmd, args, erc721.NewErc721Contract(c, Erc721Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateMintFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessMintFlags(cmd, args) - return err - }, -} - -func init() { - BindMintFlags(mintCmd) -} - -func BindMintFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc721Address, "contract", "", "ERC721 contract address") - cmd.Flags().StringVar(&Dst, "recipient", "", "Recipient address") - cmd.Flags().StringVar(&Token, "token", "", "ERC721 token ID") - cmd.Flags().StringVar(&Metadata, "metadata", "", "ERC721 token metadata") - flags.MarkFlagsAsRequired(cmd, "contract", "recipient", "token", "metadata") -} - -func ValidateMintFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc721Address) { - return fmt.Errorf("invalid ERC721 contract address %s", Erc721Address) - } - if !common.IsHexAddress(Dst) { - return fmt.Errorf("invalid recipient address %s", Dst) - } - return nil -} - -func ProcessMintFlags(cmd *cobra.Command, args []string) error { - Erc721Addr = common.HexToAddress(Erc721Address) - - if !common.IsHexAddress(Dst) { - DstAddress = senderKeyPair.CommonAddress() - } else { - DstAddress = common.HexToAddress(Dst) - } - - var ok bool - if TokenId, ok = big.NewInt(0).SetString(Token, 10); !ok { - return fmt.Errorf("invalid token id value") - } - - return err -} - -func MintCmd(cmd *cobra.Command, args []string, erc721Contract *erc721.ERC721Contract) error { - _, err = erc721Contract.Mint( - TokenId, Metadata, DstAddress, transactor.TransactOptions{GasLimit: gasLimit}, - ) - if err != nil { - return err - } - - log.Info().Msgf("%v token minted", TokenId) - return err -} diff --git a/chains/evm/cli/erc721/owner.go b/chains/evm/cli/erc721/owner.go deleted file mode 100644 index 366de884..00000000 --- a/chains/evm/cli/erc721/owner.go +++ /dev/null @@ -1,87 +0,0 @@ -package erc721 - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/cli/initialize" - "github.com/ChainSafe/sygma-core/util" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var ownerCmd = &cobra.Command{ - Use: "owner", - Short: "Get an ERC721 token owner", - Long: "The owner subcommand gets a token owner from an ERC721 mintable contract", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.CallPersistentPreRun(cmd, args) - }, - RunE: func(cmd *cobra.Command, args []string) error { - c, err := initialize.InitializeClient(url, senderKeyPair) - if err != nil { - return err - } - t, err := initialize.InitializeTransactor(gasPrice, evmtransaction.NewTransaction, c, prepare) - if err != nil { - return err - } - return OwnerCmd(cmd, args, erc721.NewErc721Contract(c, Erc721Addr, t)) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateOwnerFlags(cmd, args) - if err != nil { - return err - } - - err = ProcessOwnerFlags(cmd, args) - return err - }, -} - -func BindOwnerFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&Erc721Address, "contract", "", "ERC721 contract address") - cmd.Flags().StringVar(&Token, "token", "", "ERC721 token ID") - flags.MarkFlagsAsRequired(cmd, "contract", "token") -} - -func init() { - BindOwnerFlags(ownerCmd) -} - -func ValidateOwnerFlags(cmd *cobra.Command, args []string) error { - if !common.IsHexAddress(Erc721Address) { - return fmt.Errorf("invalid ERC721 contract address %s", Erc721Address) - } - return nil -} - -func ProcessOwnerFlags(cmd *cobra.Command, args []string) error { - Erc721Addr = common.HexToAddress(Erc721Address) - - var ok bool - if TokenId, ok = big.NewInt(0).SetString(Token, 10); !ok { - return fmt.Errorf("invalid token id value") - } - - return nil -} - -func OwnerCmd(cmd *cobra.Command, args []string, erc721Contract *erc721.ERC721Contract) error { - owner, err := erc721Contract.Owner(TokenId) - if err != nil { - return err - } - - log.Info().Msgf("%v token owner: %v", TokenId, owner) - return err -} diff --git a/chains/evm/cli/flags/utils.go b/chains/evm/cli/flags/utils.go deleted file mode 100644 index 5d27df6e..00000000 --- a/chains/evm/cli/flags/utils.go +++ /dev/null @@ -1,91 +0,0 @@ -package flags - -import ( - "encoding/hex" - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - - "github.com/ChainSafe/sygma-core/keystore" - "github.com/ChainSafe/sygma-core/types" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -const DefaultGasLimit = 2000000 - -func GlobalFlagValues(cmd *cobra.Command) (string, uint64, *big.Int, *secp256k1.Keypair, bool, error) { - url, err := cmd.Flags().GetString("url") - if err != nil { - log.Error().Err(fmt.Errorf("url error: %v", err)) - return "", DefaultGasLimit, nil, nil, false, err - } - - gasLimitInt, err := cmd.Flags().GetUint64("gas-limit") - if err != nil { - log.Error().Err(fmt.Errorf("gas limit error: %v", err)) - return "", DefaultGasLimit, nil, nil, false, err - } - - gasPriceInt, err := cmd.Flags().GetUint64("gas-price") - if err != nil { - log.Error().Err(fmt.Errorf("gas price error: %v", err)) - return "", DefaultGasLimit, nil, nil, false, err - } - var gasPrice *big.Int = nil - if gasPriceInt != 0 { - gasPrice = big.NewInt(0).SetUint64(gasPriceInt) - } - - senderKeyPair, err := defineSender(cmd) - if err != nil { - log.Error().Err(fmt.Errorf("define sender error: %v", err)) - return "", DefaultGasLimit, nil, nil, false, err - } - - prepare, err := cmd.Flags().GetBool("prepare") - if err != nil { - log.Error().Err(fmt.Errorf("generate calldata error: %v", err)) - return "", DefaultGasLimit, nil, nil, false, err - } - return url, gasLimitInt, gasPrice, senderKeyPair, prepare, nil -} - -func defineSender(cmd *cobra.Command) (*secp256k1.Keypair, error) { - privateKey, err := cmd.Flags().GetString("private-key") - if err != nil { - return nil, err - } - if privateKey != "" { - kp, err := secp256k1.NewKeypairFromString(privateKey) - if err != nil { - return nil, err - } - return kp, nil - } - var AliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey] - return AliceKp, nil -} - -func ProcessResourceID(resourceID string) (types.ResourceID, error) { - if resourceID[0:2] == "0x" { - resourceID = resourceID[2:] - } - resourceIdBytes, err := hex.DecodeString(resourceID) - if err != nil { - return [32]byte{}, fmt.Errorf("failed decoding resourceID hex string: %s", err) - } - return calls.SliceTo32Bytes(resourceIdBytes), nil -} - -func MarkFlagsAsRequired(cmd *cobra.Command, flags ...string) { - for _, flag := range flags { - err := cmd.MarkFlagRequired(flag) - if err != nil { - panic(err) - } - } -} diff --git a/chains/evm/cli/initialize/initialize.go b/chains/evm/cli/initialize/initialize.go deleted file mode 100644 index b059bb85..00000000 --- a/chains/evm/cli/initialize/initialize.go +++ /dev/null @@ -1,50 +0,0 @@ -package initialize - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/prepare" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/rs/zerolog/log" -) - -func InitializeClient( - url string, - senderKeyPair *secp256k1.Keypair, -) (*evmclient.EVMClient, error) { - ethClient, err := evmclient.NewEVMClient(url, senderKeyPair) - if err != nil { - log.Error().Err(fmt.Errorf("eth client initialization error: %v", err)) - return nil, err - } - return ethClient, nil -} - -// Initialize transactor which is used for contract calls -// if --prepare flag value is set as true (from CLI) call data is outputted to stdout -// which can be used for multisig contract calls -func InitializeTransactor( - gasPrice *big.Int, - txFabric calls.TxFabric, - client *evmclient.EVMClient, - prepareFlag bool, -) (transactor.Transactor, error) { - var trans transactor.Transactor - if prepareFlag { - trans = prepare.NewPrepareTransactor() - } else { - gasPricer := evmgaspricer.NewLondonGasPriceClient( - client, - &evmgaspricer.GasPricerOpts{UpperLimitFeePerGas: gasPrice}, - ) - trans = signAndSend.NewSignAndSendTransactor(txFabric, gasPricer, client) - } - - return trans, nil -} diff --git a/chains/evm/cli/local/deploy.go b/chains/evm/cli/local/deploy.go deleted file mode 100644 index daa69122..00000000 --- a/chains/evm/cli/local/deploy.go +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package local - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/generic" - evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/sygma-core/keystore" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" -) - -var AliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey] -var BobKp = keystore.TestKeyRing.EthereumKeys[keystore.BobKey] -var EveKp = keystore.TestKeyRing.EthereumKeys[keystore.EveKey] - -var ( - DefaultRelayerAddresses = []common.Address{ - common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.AliceKey].Address()), - common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.BobKey].Address()), - common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.CharlieKey].Address()), - common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.DaveKey].Address()), - common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.EveKey].Address()), - } -) - -type BridgeConfig struct { - BridgeAddr common.Address - - Erc20Addr common.Address - Erc20HandlerAddr common.Address - Erc20ResourceID types.ResourceID - - AssetStoreAddr common.Address - GenericHandlerAddr common.Address - GenericResourceID types.ResourceID - - Erc721Addr common.Address - Erc721HandlerAddr common.Address - Erc721ResourceID types.ResourceID - - ResourceIDERC721 string - ResourceIDGeneric string -} - -type EVMClient interface { - calls.ContractCallerDispatcher - evmgaspricer.GasPriceClient -} - -func SetupEVMBridge( - ethClient EVMClient, - fabric calls.TxFabric, - domainID uint8, - threshold *big.Int, - mintTo common.Address, - relayerAddresses []common.Address, -) (BridgeConfig, error) { - staticGasPricer := evmgaspricer.NewStaticGasPriceDeterminant(ethClient, nil) - t := signAndSend.NewSignAndSendTransactor(fabric, staticGasPricer, ethClient) - - bridgeContract := bridge.NewBridgeContract(ethClient, common.Address{}, t) - bridgeContractAddress, err := bridgeContract.DeployContract( - domainID, relayerAddresses, threshold, big.NewInt(0), big.NewInt(100), - ) - if err != nil { - return BridgeConfig{}, err - } - - erc721Contract, erc721ContractAddress, erc721HandlerContractAddress, err := deployErc721( - ethClient, t, bridgeContractAddress, - ) - if err != nil { - return BridgeConfig{}, err - } - - erc20Contract, erc20ContractAddress, erc20HandlerContractAddress, err := deployErc20( - ethClient, t, bridgeContractAddress, - ) - - if err != nil { - return BridgeConfig{}, err - } - - genericHandlerAddress, assetStoreAddress, err := deployGeneric(ethClient, t, bridgeContractAddress) - if err != nil { - return BridgeConfig{}, err - } - - resourceIDERC20 := calls.SliceTo32Bytes(common.LeftPadBytes([]byte{0}, 31)) - resourceIDGenericHandler := calls.SliceTo32Bytes(common.LeftPadBytes([]byte{1}, 31)) - resourceIDERC721 := calls.SliceTo32Bytes(common.LeftPadBytes([]byte{2}, 31)) - - conf := BridgeConfig{ - BridgeAddr: bridgeContractAddress, - - Erc20Addr: erc20ContractAddress, - Erc20HandlerAddr: erc20HandlerContractAddress, - Erc20ResourceID: resourceIDERC20, - - GenericHandlerAddr: genericHandlerAddress, - AssetStoreAddr: assetStoreAddress, - GenericResourceID: resourceIDGenericHandler, - - Erc721Addr: erc721ContractAddress, - Erc721HandlerAddr: erc721HandlerContractAddress, - Erc721ResourceID: resourceIDERC721, - } - - err = SetupERC20Handler(bridgeContract, erc20Contract, mintTo, conf, resourceIDERC20) - if err != nil { - return BridgeConfig{}, err - } - - err = SetupERC721Handler(bridgeContract, erc721Contract, conf, resourceIDERC721) - if err != nil { - return BridgeConfig{}, err - } - - err = SetupGenericHandler(bridgeContract, conf, resourceIDGenericHandler) - if err != nil { - return BridgeConfig{}, err - } - - _, err = bridgeContract.AdminChangeRelayerThreshold(threshold.Uint64(), transactor.TransactOptions{}) - if err != nil { - return BridgeConfig{}, err - } - - log.Debug().Msgf("All deployments and preparations are done") - return conf, nil -} - -func deployGeneric( - ethClient EVMClient, t transactor.Transactor, bridgeContractAddress common.Address, -) (common.Address, common.Address, error) { - assetStoreContract := centrifuge.NewAssetStoreContract(ethClient, common.Address{}, t) - assetStoreAddress, err := assetStoreContract.DeployContract() - if err != nil { - return common.Address{}, common.Address{}, err - } - genericHandlerContract := generic.NewGenericHandlerContract(ethClient, common.Address{}, t) - genericHandlerAddress, err := genericHandlerContract.DeployContract(bridgeContractAddress) - if err != nil { - return common.Address{}, common.Address{}, err - } - log.Debug().Msgf( - "Centrifuge asset store deployed to: %s; \n Generic Handler deployed to: %s", - assetStoreAddress, genericHandlerAddress, - ) - return genericHandlerAddress, assetStoreAddress, nil -} - -func deployErc20( - ethClient EVMClient, t transactor.Transactor, bridgeContractAddress common.Address, -) (*erc20.ERC20Contract, common.Address, common.Address, error) { - erc20Contract := erc20.NewERC20Contract(ethClient, common.Address{}, t) - erc20ContractAddress, err := erc20Contract.DeployContract("Test", "TST") - if err != nil { - return nil, common.Address{}, common.Address{}, err - } - erc20HandlerContract := erc20.NewERC20HandlerContract(ethClient, common.Address{}, t) - erc20HandlerContractAddress, err := erc20HandlerContract.DeployContract(bridgeContractAddress) - if err != nil { - return nil, common.Address{}, common.Address{}, err - } - log.Debug().Msgf( - "Erc20 deployed to: %s; \n Erc20 Handler deployed to: %s", - erc20ContractAddress, erc20HandlerContractAddress, - ) - return erc20Contract, erc20ContractAddress, erc20HandlerContractAddress, nil -} - -func deployErc721( - ethClient EVMClient, t transactor.Transactor, bridgeContractAddress common.Address, -) (*erc721.ERC721Contract, common.Address, common.Address, error) { - erc721Contract := erc721.NewErc721Contract(ethClient, common.Address{}, t) - erc721ContractAddress, err := erc721Contract.DeployContract("TestERC721", "TST721", "") - if err != nil { - return nil, common.Address{}, common.Address{}, err - } - erc721HandlerContract := erc721.NewERC721HandlerContract(ethClient, common.Address{}, t) - erc721HandlerContractAddress, err := erc721HandlerContract.DeployContract(bridgeContractAddress) - if err != nil { - return nil, common.Address{}, common.Address{}, err - } - log.Debug().Msgf( - "Erc721 deployed to: %s; \n Erc721 Handler deployed to: %s", - erc721ContractAddress, erc721HandlerContractAddress, - ) - return erc721Contract, erc721ContractAddress, erc721HandlerContractAddress, nil -} - -func SetupERC20Handler( - bridgeContract *bridge.BridgeContract, erc20Contract *erc20.ERC20Contract, mintTo common.Address, conf BridgeConfig, resourceID types.ResourceID, -) error { - _, err := bridgeContract.AdminSetResource( - conf.Erc20HandlerAddr, resourceID, conf.Erc20Addr, transactor.TransactOptions{GasLimit: 2000000}, - ) - if err != nil { - return err - } - // Minting tokens - tenTokens := big.NewInt(0).Mul(big.NewInt(10), big.NewInt(0).Exp(big.NewInt(10), big.NewInt(18), nil)) - _, err = erc20Contract.MintTokens(mintTo, tenTokens, transactor.TransactOptions{}) - if err != nil { - return err - } - // Approving tokens - _, err = erc20Contract.ApproveTokens(conf.Erc20HandlerAddr, tenTokens, transactor.TransactOptions{}) - if err != nil { - return err - } - // Adding minter - _, err = erc20Contract.AddMinter(conf.Erc20HandlerAddr, transactor.TransactOptions{}) - if err != nil { - return err - } - // Set burnable input - _, err = bridgeContract.SetBurnableInput(conf.Erc20HandlerAddr, conf.Erc20Addr, transactor.TransactOptions{}) - if err != nil { - return err - } - return nil -} - -func SetupGenericHandler(bridgeContract *bridge.BridgeContract, conf BridgeConfig, resourceID types.ResourceID) error { - _, err := bridgeContract.AdminSetGenericResource( - conf.GenericHandlerAddr, - resourceID, - conf.AssetStoreAddr, - [4]byte{0x65, 0x4c, 0xf8, 0x8c}, - big.NewInt(0), - [4]byte{0x65, 0x4c, 0xf8, 0x8c}, - transactor.TransactOptions{GasLimit: 2000000}, - ) - if err != nil { - return err - } - return nil -} - -func SetupERC721Handler(bridgeContract *bridge.BridgeContract, erc721Contract *erc721.ERC721Contract, conf BridgeConfig, resourceID types.ResourceID) error { - _, err := bridgeContract.AdminSetResource(conf.Erc721HandlerAddr, resourceID, conf.Erc721Addr, transactor.TransactOptions{GasLimit: 2000000}) - if err != nil { - return err - } - // Adding minter - _, err = erc721Contract.AddMinter(conf.Erc721HandlerAddr, transactor.TransactOptions{}) - if err != nil { - return err - } - // Set burnable input - _, err = bridgeContract.SetBurnableInput(conf.Erc721HandlerAddr, conf.Erc721Addr, transactor.TransactOptions{}) - if err != nil { - return err - } - return nil -} diff --git a/chains/evm/cli/local/local.go b/chains/evm/cli/local/local.go deleted file mode 100644 index f18f5a31..00000000 --- a/chains/evm/cli/local/local.go +++ /dev/null @@ -1,123 +0,0 @@ -package local - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - - "github.com/spf13/cobra" -) - -var LocalSetupCmd = &cobra.Command{ - Use: "local-setup", - Short: "Deploy and prefund a local bridge for testing", - Long: "The local-setup command deploys a bridge, ERC20, ERC721 and generic handler contracts with preconfigured accounts and appropriate handlers", - RunE: localSetup, -} - -// configuration -var ( - ethEndpoint1 = "http://localhost:8545" - ethEndpoint2 = "http://localhost:8547" - fabric1 = evmtransaction.NewTransaction - fabric2 = evmtransaction.NewTransaction -) - -func BindLocalSetupFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(ðEndpoint1, "endpoint1", "", "RPC endpoint of the first network") - cmd.Flags().StringVar(ðEndpoint2, "endpoint2", "", "RPC endpoint of the second network") -} - -func init() { - BindLocalSetupFlags(LocalSetupCmd) -} - -func localSetup(cmd *cobra.Command, args []string) error { - // init client1 - ethClient, err := evmclient.NewEVMClient(ethEndpoint1, EveKp) - if err != nil { - return err - } - - // init client2 - ethClient2, err := evmclient.NewEVMClient(ethEndpoint2, EveKp) - if err != nil { - return err - } - - // chain 1 - // domainsId: 0 - config, err := SetupEVMBridge(ethClient, fabric1, 1, big.NewInt(1), EveKp.CommonAddress(), DefaultRelayerAddresses) - if err != nil { - return err - } - - // chain 2 - // domainId: 1 - config2, err := SetupEVMBridge(ethClient2, fabric2, 2, big.NewInt(1), EveKp.CommonAddress(), DefaultRelayerAddresses) - if err != nil { - return err - } - - prettyPrint(config, config2) - - return nil -} - -func prettyPrint(config, config2 BridgeConfig) { - fmt.Printf(` -=============================================== -🎉🎉🎉 ChainBridge Successfully Deployed 🎉🎉🎉 - -- Chain 1 - -Bridge: %s -ERC20: %s -ERC20 Handler: %s -ERC721: %s -ERC721 Handler: %s -Generic Handler: %s -Asset Store: %s -ERC20 resourceId: %s -ERC721 resourceId %s -Generic resourceId %s - -- Chain 2 - -Bridge: %s -ERC20: %s -ERC20 Handler: %s -ERC721: %s -ERC721 Handler: %s -Generic Handler: %s -Asset Store: %s -ERC20 resourceId: %s -ERC721 resourceId %s -Generic resourceId %s - -=============================================== -`, - // config - config.BridgeAddr, - config.Erc20Addr, - config.Erc20HandlerAddr, - config.Erc721Addr, - config.Erc721HandlerAddr, - config.GenericHandlerAddr, - config.AssetStoreAddr, - config.Erc20ResourceID, - config.Erc721ResourceID, - config.GenericResourceID, - // config2 - config2.BridgeAddr, - config2.Erc20Addr, - config2.Erc20HandlerAddr, - config.Erc721Addr, - config.Erc721HandlerAddr, - config2.GenericHandlerAddr, - config2.AssetStoreAddr, - config2.Erc20ResourceID, - config2.Erc721ResourceID, - config2.GenericResourceID, - ) -} diff --git a/chains/evm/cli/logger/logger.go b/chains/evm/cli/logger/logger.go deleted file mode 100644 index efa3d955..00000000 --- a/chains/evm/cli/logger/logger.go +++ /dev/null @@ -1,47 +0,0 @@ -package logger - -import ( - "fmt" - "os" - "time" - - "github.com/ChainSafe/sygma-core/logger" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - "github.com/spf13/pflag" -) - -var ( - CliLogsFilename = "cli_output_data.log" - Now = time.Now -) - -func LoggerMetadata(cmdName string, flagSet *pflag.FlagSet) { - - currentTimestamp := Now().Format("02-01|15:00:00.000 ") - - file, err := os.OpenFile(CliLogsFilename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - log.Error().Err(fmt.Errorf("failed to create cli log file: %v", err)) - } - - var cmdFlagsWithArgs string - flagSet.VisitAll(func(flag *pflag.Flag) { - if flag.Name != "privateKey" { - cmdFlagsWithArgs += fmt.Sprintf("--%s=%q ", flag.Name, flag.Value) - } - }) - - _, err = file.WriteString( - currentTimestamp + - fmt.Sprintf("Called %s with args: %s=>\n", cmdName, cmdFlagsWithArgs)) - - if err != nil { - log.Error().Err(fmt.Errorf("failed to write to log file: %v", err)) - } - - // PartsExclude - omit log level and execution time from final log - logConsoleWriter := zerolog.ConsoleWriter{Out: os.Stdout, PartsExclude: []string{"level", "time"}} - logFileWriter := zerolog.ConsoleWriter{Out: file, PartsExclude: []string{"level", "time"}} - logger.ConfigureLogger(zerolog.DebugLevel, logConsoleWriter, logFileWriter) -} diff --git a/chains/evm/cli/logger/logger_test.go b/chains/evm/cli/logger/logger_test.go deleted file mode 100644 index 6b612ccf..00000000 --- a/chains/evm/cli/logger/logger_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package logger_test - -import ( - "os" - "regexp" - "strings" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/cli" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -type LoggerTestSuite struct { - suite.Suite - EvmRootCLI *cobra.Command -} - -func TestLoggerWriteToFile(t *testing.T) { - suite.Run(t, new(LoggerTestSuite)) -} - -func (s *LoggerTestSuite) SetupSuite() { -} -func (s *LoggerTestSuite) TearDownSuite() {} - -func (s *LoggerTestSuite) TearDownTest() {} - -func (s *LoggerTestSuite) TestWriteCliDataToFile() { - expectedLog := "Called evm-cli with args: --gas-limit=\"7000000\" --gas-price=\"25000000000\" --help=\"false\" --json-wallet=\"test-wallet\" --json-wallet-password=\"test-wallet-password\" --network=\"0\" --prepare=\"false\" --private-key=\"test-private-key\" --url=\"test-url\" =>\n" - - rootCmdArgs := []string{ - "--url", "test-url", - "--gas-limit", "7000000", - "--gas-price", "25000000000", - "--network", "0x0", - "--private-key", "test-private-key", - "--json-wallet", "test-wallet", - "--json-wallet-password", "test-wallet-password", - } - - cli.EvmRootCLI.SetArgs(rootCmdArgs) - _ = cli.EvmRootCLI.Execute() - - data, _ := os.ReadFile(logger.CliLogsFilename) - logParts := strings.SplitN(string(data), " ", 2) - s.Equal(expectedLog, logParts[1]) - s.True(regexp.Match("[0-9]{2}-[0-9]{2}|[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}", []byte(logParts[0]))) - - err := os.Remove(logger.CliLogsFilename) - s.Nil(err) -} diff --git a/chains/evm/cli/utils/flagVars.go b/chains/evm/cli/utils/flagVars.go deleted file mode 100644 index f1183b5d..00000000 --- a/chains/evm/cli/utils/flagVars.go +++ /dev/null @@ -1,19 +0,0 @@ -package utils - -import ( - "github.com/ethereum/go-ethereum/common" -) - -//flag vars -var ( - BlockNumber string - Blocks string - TxHash string - FromAddress string -) - -//processed flag vars -var ( - txHash common.Hash - fromAddr common.Address -) diff --git a/chains/evm/cli/utils/hash-list.go b/chains/evm/cli/utils/hash-list.go deleted file mode 100644 index 23926ded..00000000 --- a/chains/evm/cli/utils/hash-list.go +++ /dev/null @@ -1,88 +0,0 @@ -package utils - -import ( - "context" - "fmt" - "math/big" - "strconv" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var hashListCmd = &cobra.Command{ - Use: "hash-list", - Short: "List tx hashes within N number of blocks", - Long: "The hash-list subcommand accepts a starting block to query, loops over N number of blocks past it, then prints this list of blocks to review hashes contained within", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return HashListCmd(cmd, args) - }, -} - -func BindHashListFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&BlockNumber, "block-number", "", "Block number to start at") - cmd.Flags().StringVar(&Blocks, "blocks", "", "Number of blocks past the provided block-number to review") - flags.MarkFlagsAsRequired(cmd, "block-number", "blocks") -} - -func init() { - BindHashListFlags(hashListCmd) -} - -func HashListCmd(cmd *cobra.Command, args []string) error { - // fetch global flag values - url, _, _, senderKeyPair, _, err := flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - - ethClient, err := evmclient.NewEVMClient(url, senderKeyPair) - if err != nil { - log.Error().Err(fmt.Errorf("eth client intialization error: %v", err)) - return err - } - - // convert Blocks string to int for looping - numBlocks, err := strconv.Atoi(Blocks) - if err != nil { - log.Error().Err(fmt.Errorf("error converting NumberOfBlocks string -> int: %v", err)) - return err - } - - // convert block number to string - blockNumberBigInt, _ := new(big.Int).SetString(BlockNumber, 10) - - // loop over blocks provided by user - // check block by hash - // see if transaction block data is there - for i := 0; i < numBlocks; i++ { - log.Debug().Msgf("Block Number: %v", blockNumberBigInt) - - // convert string block number to big.Int - blockNumberBigInt.Add(blockNumberBigInt, big.NewInt(1)) - - block, err := ethClient.BlockByNumber(context.Background(), blockNumberBigInt) - if err != nil { - log.Error().Err(fmt.Errorf("block by hash error: %v", err)) - - // will return early and not print debug log if block not found - // Error: not found - - return err - } - - // loop over all transactions within block - // add newline for readability - for _, tx := range block.Body().Transactions { - log.Debug().Msgf("Tx hashes: %v\n", tx.Hash()) - } - } - return nil -} diff --git a/chains/evm/cli/utils/simulate.go b/chains/evm/cli/utils/simulate.go deleted file mode 100644 index 94499d2a..00000000 --- a/chains/evm/cli/utils/simulate.go +++ /dev/null @@ -1,97 +0,0 @@ -package utils - -import ( - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - - "github.com/ChainSafe/sygma-core/chains/evm/cli/flags" - "github.com/ChainSafe/sygma-core/chains/evm/cli/logger" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var simulateCmd = &cobra.Command{ - Use: "simulate", - Short: "Simulate the invocation of a transaction", - Long: "The simulate subcommand simulates a transaction result by simulating invocation; not state-altering", - PreRun: func(cmd *cobra.Command, args []string) { - logger.LoggerMetadata(cmd.Name(), cmd.Flags()) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return SimulateCmd(cmd) - }, - Args: func(cmd *cobra.Command, args []string) error { - err := ValidateSimulateFlags(cmd, args) - if err != nil { - return err - } - - ProcessSimulateFlags(cmd, args) - return nil - }, -} - -func BindSimulateFlags(cmd *cobra.Command) { - cmd.Flags().StringVar(&TxHash, "tx-hash", "", "Transaction hash") - cmd.Flags().StringVar(&BlockNumber, "block-number", "", "Block number") - cmd.Flags().StringVar(&FromAddress, "from", "", "Address of sender") - flags.MarkFlagsAsRequired(cmd, "tx-hash", "block-number", "from") -} - -func init() { - BindSimulateFlags(simulateCmd) -} - -func ValidateSimulateFlags(cmd *cobra.Command, args []string) error { - _, err := hexutil.Decode(TxHash) - if err != nil { - return fmt.Errorf("invalid tx hash %s", TxHash) - } - if !common.IsHexAddress(FromAddress) { - return fmt.Errorf("invalid from address %s", FromAddress) - } - return nil -} - -func ProcessSimulateFlags(cmd *cobra.Command, args []string) { - txHash = common.HexToHash(TxHash) - fromAddr = common.HexToAddress(FromAddress) -} - -func SimulateCmd(cmd *cobra.Command) error { - // fetch global flag values - url, _, _, senderKeyPair, _, err := flags.GlobalFlagValues(cmd) - if err != nil { - return fmt.Errorf("could not get global flags: %v", err) - } - - // convert string block number to big.Int - blockNumberBigInt, _ := new(big.Int).SetString(BlockNumber, 10) - - log.Debug().Msgf(` -Simulating transaction -Tx hash: %s -Block number: %v -From address: %s`, - TxHash, blockNumberBigInt, FromAddress) - - ethClient, err := evmclient.NewEVMClient(url, senderKeyPair) - if err != nil { - log.Error().Err(fmt.Errorf("eth client intialization error: %v", err)) - return err - } - data, err := calls.Simulate(ethClient, blockNumberBigInt, txHash, fromAddr) - if err != nil { - log.Error().Err(fmt.Errorf("[utils] simulate transact error: %v", err)) - return err - } - - log.Debug().Msgf("data: %s", string(data)) - - return nil -} diff --git a/chains/evm/cli/utils/utils.go b/chains/evm/cli/utils/utils.go deleted file mode 100644 index c300823d..00000000 --- a/chains/evm/cli/utils/utils.go +++ /dev/null @@ -1,25 +0,0 @@ -package utils - -import ( - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - - "github.com/spf13/cobra" -) - -var UtilsCmd = &cobra.Command{ - Use: "utils", - Short: "Set of utility commands", - Long: "Set of utility commands", -} - -func init() { - UtilsCmd.AddCommand(simulateCmd) - UtilsCmd.AddCommand(hashListCmd) -} - -type GasPricerWithPostConfig interface { - calls.GasPricer - SetClient(client evmgaspricer.LondonGasClient) - SetOpts(opts *evmgaspricer.GasPricerOpts) -} diff --git a/chains/evm/cli/utils/utils_test.go b/chains/evm/cli/utils/utils_test.go deleted file mode 100644 index 773548de..00000000 --- a/chains/evm/cli/utils/utils_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package utils - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/suite" -) - -var ( - validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" - invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" - validTxHash = "0x455096e686c929229577767350d5c9151c609c2ba3e50a447e7092018d7f2dac" - invalidTxHash = "455096e686c929229577767350d5c9151c609c2ba3e50a447e7092018d7f2dac" -) - -type UtilsTestSuite struct { - suite.Suite -} - -func TestUtilsTestSuite(t *testing.T) { - suite.Run(t, new(UtilsTestSuite)) -} - -func (s *UtilsTestSuite) SetupSuite() { -} -func (s *UtilsTestSuite) TearDownSuite() {} - -func (s *UtilsTestSuite) TearDownTest() {} - -func (s *UtilsTestSuite) TestValidateSimulateFlags() { - cmd := new(cobra.Command) - BindSimulateFlags(cmd) - - err := cmd.Flag("from").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("tx-hash").Value.Set(validTxHash) - s.Nil(err) - - err = ValidateSimulateFlags( - cmd, - []string{}, - ) - s.Nil(err) -} - -func (s *UtilsTestSuite) TestValidateSimulateInvalidAddress() { - cmd := new(cobra.Command) - BindSimulateFlags(cmd) - - err := cmd.Flag("from").Value.Set(invalidAddr) - s.Nil(err) - err = cmd.Flag("tx-hash").Value.Set(validTxHash) - s.Nil(err) - - err = ValidateSimulateFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} - -func (s *UtilsTestSuite) TestValidateSimulateInvalidTxHash() { - cmd := new(cobra.Command) - BindSimulateFlags(cmd) - - err := cmd.Flag("from").Value.Set(validAddr) - s.Nil(err) - err = cmd.Flag("tx-hash").Value.Set(invalidTxHash) - s.Nil(err) - - err = ValidateSimulateFlags( - cmd, - []string{}, - ) - s.NotNil(err) -} diff --git a/chains/evm/executor/mock/voter.go b/chains/evm/executor/mock/voter.go deleted file mode 100644 index 757bcff0..00000000 --- a/chains/evm/executor/mock/voter.go +++ /dev/null @@ -1,381 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/sygma-core/chains/evm/executor (interfaces: ChainClient,MessageHandler,BridgeContract) - -// Package mock_executor is a generated GoMock package. -package mock_executor - -import ( - context "context" - big "math/big" - reflect "reflect" - - evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - proposal "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - message "github.com/ChainSafe/sygma-core/relayer/message" - common "github.com/ethereum/go-ethereum/common" - types "github.com/ethereum/go-ethereum/core/types" - rpc "github.com/ethereum/go-ethereum/rpc" - gomock "github.com/golang/mock/gomock" -) - -// MockChainClient is a mock of ChainClient interface. -type MockChainClient struct { - ctrl *gomock.Controller - recorder *MockChainClientMockRecorder -} - -// MockChainClientMockRecorder is the mock recorder for MockChainClient. -type MockChainClientMockRecorder struct { - mock *MockChainClient -} - -// NewMockChainClient creates a new mock instance. -func NewMockChainClient(ctrl *gomock.Controller) *MockChainClient { - mock := &MockChainClient{ctrl: ctrl} - mock.recorder = &MockChainClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockChainClient) EXPECT() *MockChainClientMockRecorder { - return m.recorder -} - -// CallContract mocks base method. -func (m *MockChainClient) CallContract(arg0 context.Context, arg1 map[string]interface{}, arg2 *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CallContract", arg0, arg1, arg2) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CallContract indicates an expected call of CallContract. -func (mr *MockChainClientMockRecorder) CallContract(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockChainClient)(nil).CallContract), arg0, arg1, arg2) -} - -// CodeAt mocks base method. -func (m *MockChainClient) CodeAt(arg0 context.Context, arg1 common.Address, arg2 *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CodeAt", arg0, arg1, arg2) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CodeAt indicates an expected call of CodeAt. -func (mr *MockChainClientMockRecorder) CodeAt(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CodeAt", reflect.TypeOf((*MockChainClient)(nil).CodeAt), arg0, arg1, arg2) -} - -// From mocks base method. -func (m *MockChainClient) From() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "From") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// From indicates an expected call of From. -func (mr *MockChainClientMockRecorder) From() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "From", reflect.TypeOf((*MockChainClient)(nil).From)) -} - -// GetTransactionByHash mocks base method. -func (m *MockChainClient) GetTransactionByHash(arg0 common.Hash) (*types.Transaction, bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTransactionByHash", arg0) - ret0, _ := ret[0].(*types.Transaction) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// GetTransactionByHash indicates an expected call of GetTransactionByHash. -func (mr *MockChainClientMockRecorder) GetTransactionByHash(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionByHash", reflect.TypeOf((*MockChainClient)(nil).GetTransactionByHash), arg0) -} - -// LockNonce mocks base method. -func (m *MockChainClient) LockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "LockNonce") -} - -// LockNonce indicates an expected call of LockNonce. -func (mr *MockChainClientMockRecorder) LockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockChainClient)(nil).LockNonce)) -} - -// RelayerAddress mocks base method. -func (m *MockChainClient) RelayerAddress() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RelayerAddress") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// RelayerAddress indicates an expected call of RelayerAddress. -func (mr *MockChainClientMockRecorder) RelayerAddress() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RelayerAddress", reflect.TypeOf((*MockChainClient)(nil).RelayerAddress)) -} - -// SignAndSendTransaction mocks base method. -func (m *MockChainClient) SignAndSendTransaction(arg0 context.Context, arg1 evmclient.CommonTransaction) (common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignAndSendTransaction", arg0, arg1) - ret0, _ := ret[0].(common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SignAndSendTransaction indicates an expected call of SignAndSendTransaction. -func (mr *MockChainClientMockRecorder) SignAndSendTransaction(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignAndSendTransaction", reflect.TypeOf((*MockChainClient)(nil).SignAndSendTransaction), arg0, arg1) -} - -// SubscribePendingTransactions mocks base method. -func (m *MockChainClient) SubscribePendingTransactions(arg0 context.Context, arg1 chan<- common.Hash) (*rpc.ClientSubscription, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubscribePendingTransactions", arg0, arg1) - ret0, _ := ret[0].(*rpc.ClientSubscription) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SubscribePendingTransactions indicates an expected call of SubscribePendingTransactions. -func (mr *MockChainClientMockRecorder) SubscribePendingTransactions(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribePendingTransactions", reflect.TypeOf((*MockChainClient)(nil).SubscribePendingTransactions), arg0, arg1) -} - -// TransactionByHash mocks base method. -func (m *MockChainClient) TransactionByHash(arg0 context.Context, arg1 common.Hash) (*types.Transaction, bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByHash", arg0, arg1) - ret0, _ := ret[0].(*types.Transaction) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// TransactionByHash indicates an expected call of TransactionByHash. -func (mr *MockChainClientMockRecorder) TransactionByHash(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByHash", reflect.TypeOf((*MockChainClient)(nil).TransactionByHash), arg0, arg1) -} - -// TransactionReceipt mocks base method. -func (m *MockChainClient) TransactionReceipt(arg0 context.Context, arg1 common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionReceipt", arg0, arg1) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionReceipt indicates an expected call of TransactionReceipt. -func (mr *MockChainClientMockRecorder) TransactionReceipt(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionReceipt", reflect.TypeOf((*MockChainClient)(nil).TransactionReceipt), arg0, arg1) -} - -// UnlockNonce mocks base method. -func (m *MockChainClient) UnlockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UnlockNonce") -} - -// UnlockNonce indicates an expected call of UnlockNonce. -func (mr *MockChainClientMockRecorder) UnlockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockChainClient)(nil).UnlockNonce)) -} - -// UnsafeIncreaseNonce mocks base method. -func (m *MockChainClient) UnsafeIncreaseNonce() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeIncreaseNonce") - ret0, _ := ret[0].(error) - return ret0 -} - -// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. -func (mr *MockChainClientMockRecorder) UnsafeIncreaseNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockChainClient)(nil).UnsafeIncreaseNonce)) -} - -// UnsafeNonce mocks base method. -func (m *MockChainClient) UnsafeNonce() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeNonce") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UnsafeNonce indicates an expected call of UnsafeNonce. -func (mr *MockChainClientMockRecorder) UnsafeNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockChainClient)(nil).UnsafeNonce)) -} - -// WaitAndReturnTxReceipt mocks base method. -func (m *MockChainClient) WaitAndReturnTxReceipt(arg0 common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WaitAndReturnTxReceipt", arg0) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WaitAndReturnTxReceipt indicates an expected call of WaitAndReturnTxReceipt. -func (mr *MockChainClientMockRecorder) WaitAndReturnTxReceipt(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitAndReturnTxReceipt", reflect.TypeOf((*MockChainClient)(nil).WaitAndReturnTxReceipt), arg0) -} - -// MockMessageHandler is a mock of MessageHandler interface. -type MockMessageHandler struct { - ctrl *gomock.Controller - recorder *MockMessageHandlerMockRecorder -} - -// MockMessageHandlerMockRecorder is the mock recorder for MockMessageHandler. -type MockMessageHandlerMockRecorder struct { - mock *MockMessageHandler -} - -// NewMockMessageHandler creates a new mock instance. -func NewMockMessageHandler(ctrl *gomock.Controller) *MockMessageHandler { - mock := &MockMessageHandler{ctrl: ctrl} - mock.recorder = &MockMessageHandlerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockMessageHandler) EXPECT() *MockMessageHandlerMockRecorder { - return m.recorder -} - -// HandleMessage mocks base method. -func (m *MockMessageHandler) HandleMessage(arg0 *message.Message) (*proposal.Proposal, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HandleMessage", arg0) - ret0, _ := ret[0].(*proposal.Proposal) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HandleMessage indicates an expected call of HandleMessage. -func (mr *MockMessageHandlerMockRecorder) HandleMessage(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleMessage", reflect.TypeOf((*MockMessageHandler)(nil).HandleMessage), arg0) -} - -// MockBridgeContract is a mock of BridgeContract interface. -type MockBridgeContract struct { - ctrl *gomock.Controller - recorder *MockBridgeContractMockRecorder -} - -// MockBridgeContractMockRecorder is the mock recorder for MockBridgeContract. -type MockBridgeContractMockRecorder struct { - mock *MockBridgeContract -} - -// NewMockBridgeContract creates a new mock instance. -func NewMockBridgeContract(ctrl *gomock.Controller) *MockBridgeContract { - mock := &MockBridgeContract{ctrl: ctrl} - mock.recorder = &MockBridgeContractMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockBridgeContract) EXPECT() *MockBridgeContractMockRecorder { - return m.recorder -} - -// GetThreshold mocks base method. -func (m *MockBridgeContract) GetThreshold() (byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetThreshold") - ret0, _ := ret[0].(byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetThreshold indicates an expected call of GetThreshold. -func (mr *MockBridgeContractMockRecorder) GetThreshold() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetThreshold", reflect.TypeOf((*MockBridgeContract)(nil).GetThreshold)) -} - -// IsProposalVotedBy mocks base method. -func (m *MockBridgeContract) IsProposalVotedBy(arg0 common.Address, arg1 *proposal.Proposal) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsProposalVotedBy", arg0, arg1) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsProposalVotedBy indicates an expected call of IsProposalVotedBy. -func (mr *MockBridgeContractMockRecorder) IsProposalVotedBy(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsProposalVotedBy", reflect.TypeOf((*MockBridgeContract)(nil).IsProposalVotedBy), arg0, arg1) -} - -// ProposalStatus mocks base method. -func (m *MockBridgeContract) ProposalStatus(arg0 *proposal.Proposal) (message.ProposalStatus, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProposalStatus", arg0) - ret0, _ := ret[0].(message.ProposalStatus) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ProposalStatus indicates an expected call of ProposalStatus. -func (mr *MockBridgeContractMockRecorder) ProposalStatus(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposalStatus", reflect.TypeOf((*MockBridgeContract)(nil).ProposalStatus), arg0) -} - -// SimulateVoteProposal mocks base method. -func (m *MockBridgeContract) SimulateVoteProposal(arg0 *proposal.Proposal) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SimulateVoteProposal", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SimulateVoteProposal indicates an expected call of SimulateVoteProposal. -func (mr *MockBridgeContractMockRecorder) SimulateVoteProposal(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateVoteProposal", reflect.TypeOf((*MockBridgeContract)(nil).SimulateVoteProposal), arg0) -} - -// VoteProposal mocks base method. -func (m *MockBridgeContract) VoteProposal(arg0 *proposal.Proposal, arg1 transactor.TransactOptions) (*common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VoteProposal", arg0, arg1) - ret0, _ := ret[0].(*common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VoteProposal indicates an expected call of VoteProposal. -func (mr *MockBridgeContractMockRecorder) VoteProposal(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VoteProposal", reflect.TypeOf((*MockBridgeContract)(nil).VoteProposal), arg0, arg1) -} diff --git a/chains/evm/executor/proposal/proposal.go b/chains/evm/executor/proposal/proposal.go deleted file mode 100644 index 162f0418..00000000 --- a/chains/evm/executor/proposal/proposal.go +++ /dev/null @@ -1,43 +0,0 @@ -package proposal - -import ( - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" -) - -func NewProposal(source, destination uint8, depositNonce uint64, resourceId types.ResourceID, data []byte, handlerAddress, bridgeAddress common.Address, metadata message.Metadata) *Proposal { - - return &Proposal{ - Source: source, - Destination: destination, - DepositNonce: depositNonce, - ResourceId: resourceId, - Data: data, - HandlerAddress: handlerAddress, - BridgeAddress: bridgeAddress, - Metadata: metadata, - } -} - -type Proposal struct { - Source uint8 // Source domainID where message was initiated - Destination uint8 // Destination domainID where message is to be sent - DepositNonce uint64 // Nonce for the deposit - ResourceId types.ResourceID - Metadata message.Metadata - Data []byte - HandlerAddress common.Address - BridgeAddress common.Address -} - -// GetDataHash constructs and returns proposal data hash -func (p *Proposal) GetDataHash() common.Hash { - return crypto.Keccak256Hash(append(p.HandlerAddress.Bytes(), p.Data...)) -} - -// GetID constructs proposal unique identifier -func (p *Proposal) GetID() common.Hash { - return crypto.Keccak256Hash(append([]byte{p.Source}, byte(p.DepositNonce))) -} diff --git a/chains/evm/executor/voter.go b/chains/evm/executor/voter.go deleted file mode 100644 index a5f3cd46..00000000 --- a/chains/evm/executor/voter.go +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package executor - -import ( - "context" - "fmt" - "math/big" - "math/rand" - "strings" - "time" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - ethereumTypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc" - "github.com/rs/zerolog/log" -) - -const ( - maxSimulateVoteChecks = 5 - maxShouldVoteChecks = 40 - shouldVoteCheckPeriod = 15 -) - -var ( - Sleep = time.Sleep -) - -type ChainClient interface { - RelayerAddress() common.Address - CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) - SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error) - TransactionByHash(ctx context.Context, hash common.Hash) (tx *ethereumTypes.Transaction, isPending bool, err error) - calls.ContractCallerDispatcher -} - -type MessageHandler interface { - HandleMessage(m *message.Message) (*proposal.Proposal, error) -} - -type BridgeContract interface { - IsProposalVotedBy(by common.Address, p *proposal.Proposal) (bool, error) - VoteProposal(proposal *proposal.Proposal, opts transactor.TransactOptions) (*common.Hash, error) - SimulateVoteProposal(proposal *proposal.Proposal) error - ProposalStatus(p *proposal.Proposal) (message.ProposalStatus, error) - GetThreshold() (uint8, error) -} - -type EVMVoter struct { - mh MessageHandler - client ChainClient - bridgeContract BridgeContract - pendingProposalVotes map[common.Hash]uint8 -} - -// NewVoterWithSubscription creates an instance of EVMVoter that votes for -// proposals on chain. -// -// It is created with a pending proposal subscription that listens to -// pending voteProposal transactions and avoids wasting gas on sending votes -// for transactions that will fail. -// Currently, officially supported only by Geth nodes. -func NewVoterWithSubscription(mh MessageHandler, client ChainClient, bridgeContract BridgeContract) (*EVMVoter, error) { - voter := &EVMVoter{ - mh: mh, - client: client, - bridgeContract: bridgeContract, - pendingProposalVotes: make(map[common.Hash]uint8), - } - - ch := make(chan common.Hash) - _, err := client.SubscribePendingTransactions(context.TODO(), ch) - if err != nil { - return nil, err - } - go voter.trackProposalPendingVotes(ch) - - return voter, nil -} - -// NewVoter creates an instance of EVMVoter that votes for proposal on chain. -// -// It is created without pending proposal subscription and is a fallback -// for nodes that don't support pending transaction subscription and will vote -// on proposals that already satisfy threshold. -func NewVoter(mh MessageHandler, client ChainClient, bridgeContract BridgeContract) *EVMVoter { - return &EVMVoter{ - mh: mh, - client: client, - bridgeContract: bridgeContract, - pendingProposalVotes: make(map[common.Hash]uint8), - } -} - -// Execute checks if relayer already voted and is threshold -// satisfied and casts a vote if it isn't. -func (v *EVMVoter) Execute(m *message.Message) error { - prop, err := v.mh.HandleMessage(m) - if err != nil { - return err - } - - votedByTheRelayer, err := v.bridgeContract.IsProposalVotedBy(v.client.RelayerAddress(), prop) - if err != nil { - log.Error().Err(err).Msgf("Fetching is proposal %v voted by relayer failed", prop) - return err - } - if votedByTheRelayer { - return nil - } - - shouldVote, err := v.shouldVoteForProposal(prop, 0) - if err != nil { - log.Error().Err(err).Msgf("Should vote for proposal %v failed", prop) - return err - } - - if !shouldVote { - log.Debug().Msgf("Proposal %+v already satisfies threshold", prop) - return nil - } - err = v.repetitiveSimulateVote(prop, 0) - if err != nil { - log.Error().Err(err).Msgf("Simulating proposal %+v vote failed", prop) - return err - } - - hash, err := v.bridgeContract.VoteProposal(prop, transactor.TransactOptions{Priority: prop.Metadata.Priority}) - if err != nil { - log.Error().Err(err).Msgf("voting for proposal %+v failed", prop) - return fmt.Errorf("voting failed. Err: %w", err) - } - - log.Debug().Str("hash", hash.String()).Uint64("nonce", prop.DepositNonce).Msgf("Voted") - return nil -} - -// shouldVoteForProposal checks if proposal already has threshold with pending -// proposal votes from other relayers. -// Only works properly in conjuction with NewVoterWithSubscription as without a subscription -// no pending txs would be received and pending vote count would be 0. -func (v *EVMVoter) shouldVoteForProposal(prop *proposal.Proposal, tries int) (bool, error) { - propID := prop.GetID() - defer delete(v.pendingProposalVotes, propID) - - // random delay to prevent all relayers checking for pending votes - // at the same time and all of them sending another tx - Sleep(time.Duration(rand.Intn(shouldVoteCheckPeriod)) * time.Second) - - ps, err := v.bridgeContract.ProposalStatus(prop) - if err != nil { - return false, err - } - - if ps.Status == message.ProposalStatusExecuted || ps.Status == message.ProposalStatusCanceled { - return false, nil - } - - threshold, err := v.bridgeContract.GetThreshold() - if err != nil { - return false, err - } - - if ps.YesVotesTotal+v.pendingProposalVotes[propID] >= threshold && tries < maxShouldVoteChecks { - // Wait until proposal status is finalized to prevent missing votes - // in case of dropped txs - tries++ - return v.shouldVoteForProposal(prop, tries) - } - - return true, nil -} - -// repetitiveSimulateVote repeatedly tries(5 times) to simulate vore proposal call until it succeeds -func (v *EVMVoter) repetitiveSimulateVote(prop *proposal.Proposal, tries int) error { - err := v.bridgeContract.SimulateVoteProposal(prop) - if err != nil { - if tries < maxSimulateVoteChecks { - tries++ - return v.repetitiveSimulateVote(prop, tries) - } - return err - } else { - return nil - } -} - -// trackProposalPendingVotes tracks pending voteProposal txs from -// other relayers and increases count of pending votes in pendingProposalVotes map -// by proposal unique id. -func (v *EVMVoter) trackProposalPendingVotes(ch chan common.Hash) { - for msg := range ch { - txData, _, err := v.client.TransactionByHash(context.TODO(), msg) - if err != nil { - log.Error().Err(err) - continue - } - - a, err := abi.JSON(strings.NewReader(consts.BridgeABI)) - if err != nil { - log.Error().Err(err) - continue - } - - if len(txData.Data()) < 4 { - continue - } - - m, err := a.MethodById(txData.Data()[:4]) - if err != nil { - continue - } - - data, err := m.Inputs.UnpackValues(txData.Data()[4:]) - if err != nil { - log.Error().Err(err) - continue - } - - if m.Name == "voteProposal" { - source := data[0].(uint8) - depositNonce := data[1].(uint64) - prop := proposal.Proposal{ - Source: source, - DepositNonce: depositNonce, - } - - go v.increaseProposalVoteCount(msg, prop.GetID()) - } - } -} - -// increaseProposalVoteCount increases pending proposal vote for target proposal -// and decreases it when transaction is mined. -func (v *EVMVoter) increaseProposalVoteCount(hash common.Hash, propID common.Hash) { - v.pendingProposalVotes[propID]++ - - _, err := v.client.WaitAndReturnTxReceipt(hash) - if err != nil { - log.Error().Err(err) - } - - v.pendingProposalVotes[propID]-- -} diff --git a/chains/evm/executor/voter_test.go b/chains/evm/executor/voter_test.go deleted file mode 100644 index cfaf5398..00000000 --- a/chains/evm/executor/voter_test.go +++ /dev/null @@ -1,155 +0,0 @@ -package executor_test - -import ( - "errors" - "testing" - "time" - - "github.com/ChainSafe/sygma-core/chains/evm/executor" - mock_voter "github.com/ChainSafe/sygma-core/chains/evm/executor/mock" - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type VoterTestSuite struct { - suite.Suite - voter *executor.EVMVoter - mockMessageHandler *mock_voter.MockMessageHandler - mockClient *mock_voter.MockChainClient - mockBridgeContract *mock_voter.MockBridgeContract -} - -func TestRunVoterTestSuite(t *testing.T) { - suite.Run(t, new(VoterTestSuite)) -} - -func (s *VoterTestSuite) SetupSuite() {} -func (s *VoterTestSuite) TearDownSuite() {} -func (s *VoterTestSuite) SetupTest() { - gomockController := gomock.NewController(s.T()) - s.mockMessageHandler = mock_voter.NewMockMessageHandler(gomockController) - s.mockClient = mock_voter.NewMockChainClient(gomockController) - s.mockBridgeContract = mock_voter.NewMockBridgeContract(gomockController) - s.voter = executor.NewVoter( - s.mockMessageHandler, - s.mockClient, - s.mockBridgeContract, - ) - executor.Sleep = func(d time.Duration) {} -} -func (s *VoterTestSuite) TearDownTest() {} - -func (s *VoterTestSuite) TestExecute_HandleMessageError() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(nil, errors.New("error")) - - err := s.voter.Execute(&message.Message{}) - - s.NotNil(err) -} - -func (s *VoterTestSuite) TestExecute_SimulateVoteProposalError() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, nil) - s.mockBridgeContract.EXPECT().ProposalStatus(gomock.Any()).Return(message.ProposalStatus{Status: message.ProposalStatusActive}, nil) - s.mockBridgeContract.EXPECT().GetThreshold().Return(uint8(1), nil) - s.mockBridgeContract.EXPECT().SimulateVoteProposal(gomock.Any()).Times(6).Return(errors.New("error")) - - err := s.voter.Execute(&message.Message{}) - - s.NotNil(err) -} - -func (s *VoterTestSuite) TestExecute_SimulateVoteProposal() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, nil) - s.mockBridgeContract.EXPECT().ProposalStatus(gomock.Any()).Return(message.ProposalStatus{Status: message.ProposalStatusActive}, nil) - s.mockBridgeContract.EXPECT().GetThreshold().Return(uint8(1), nil) - s.mockBridgeContract.EXPECT().SimulateVoteProposal(gomock.Any()).Times(1).Return(nil) - s.mockBridgeContract.EXPECT().VoteProposal(gomock.Any(), gomock.Any()).Return(&common.Hash{}, nil) - - err := s.voter.Execute(&message.Message{}) - - s.Nil(err) -} - -func (s *VoterTestSuite) TestExecute_IsProposalVotedByError() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, errors.New("error")) - - err := s.voter.Execute(&message.Message{}) - - s.NotNil(err) -} - -func (s *VoterTestSuite) TestExecute_ProposalAlreadyVoted() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(true, nil) - - err := s.voter.Execute(&message.Message{}) - - s.Nil(err) -} - -func (s *VoterTestSuite) TestExecute_ProposalStatusFail() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, nil) - s.mockBridgeContract.EXPECT().ProposalStatus(gomock.Any()).Return(message.ProposalStatus{}, errors.New("error")) - - err := s.voter.Execute(&message.Message{}) - - s.NotNil(err) -} - -func (s *VoterTestSuite) TestExecute_ExecutedProposal() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, nil) - s.mockBridgeContract.EXPECT().ProposalStatus(gomock.Any()).Return(message.ProposalStatus{Status: message.ProposalStatusExecuted}, nil) - - err := s.voter.Execute(&message.Message{}) - - s.Nil(err) -} - -func (s *VoterTestSuite) TestExecute_GetThresholdFail() { - s.mockMessageHandler.EXPECT().HandleMessage(gomock.Any()).Return(&proposal.Proposal{ - Source: 0, - DepositNonce: 0, - }, nil) - s.mockClient.EXPECT().RelayerAddress().Return(common.Address{}) - s.mockBridgeContract.EXPECT().IsProposalVotedBy(gomock.Any(), gomock.Any()).Return(false, nil) - s.mockBridgeContract.EXPECT().ProposalStatus(gomock.Any()).Return(message.ProposalStatus{Status: message.ProposalStatusActive}, nil) - s.mockBridgeContract.EXPECT().GetThreshold().Return(uint8(0), errors.New("error")) - - err := s.voter.Execute(&message.Message{}) - - s.NotNil(err) -} diff --git a/e2e/evm/evm_test.go b/e2e/evm/evm_test.go index f320e8b2..ac8eafdb 100644 --- a/e2e/evm/evm_test.go +++ b/e2e/evm/evm_test.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + "github.com/ChainSafe/chainbridge-core/chains/evm/cli/local" "github.com/ChainSafe/sygma-core/chains/evm/calls" "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" @@ -19,29 +20,17 @@ import ( "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/chains/evm/cli/local" "github.com/ChainSafe/sygma-core/keystore" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/suite" ) -type TestClient interface { - local.EVMClient - LatestBlock() (*big.Int, error) - CodeAt(ctx context.Context, contractAddress common.Address, block *big.Int) ([]byte, error) - FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]types.Log, error) - SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) - TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error) -} - const ETHEndpoint1 = "ws://localhost:8546" const ETHEndpoint2 = "ws://localhost:8548" // Alice key is used by the relayer, Eve key is used as admin and depositter func Test_EVM2EVM(t *testing.T) { - config := local.BridgeConfig{ + config := evm.BridgeConfig{ BridgeAddr: common.HexToAddress("0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66"), Erc20Addr: common.HexToAddress("0x75dF75bcdCa8eA2360c562b4aaDBAF3dfAf5b19b"), @@ -86,11 +75,11 @@ func Test_EVM2EVM(t *testing.T) { func NewEVM2EVMTestSuite( fabric1, fabric2 calls.TxFabric, - client1, client2 TestClient, + client1, client2 evm.EVMClient, gasPricer1, gasPricer2 calls.GasPricer, - config1, config2 local.BridgeConfig, -) *IntegrationTestSuite { - return &IntegrationTestSuite{ + config1, config2 evm.BridgeConfig, +) *EVMTestSuite { + return &EVMTestSuite{ fabric1: fabric1, fabric2: fabric2, client1: client1, @@ -102,10 +91,10 @@ func NewEVM2EVMTestSuite( } } -type IntegrationTestSuite struct { +type EVMTestSuite struct { suite.Suite - client1 TestClient - client2 TestClient + client1 calls.ClientDispatcher + client2 calls.ClientDispatcher gasPricer1 calls.GasPricer gasPricer2 calls.GasPricer fabric1 calls.TxFabric @@ -115,14 +104,14 @@ type IntegrationTestSuite struct { } // SetupSuite waits until all contracts are deployed -func (s *IntegrationTestSuite) SetupSuite() { +func (s *EVMTestSuite) SetupSuite() { err := evm.WaitUntilBridgeReady(s.client2, s.config2.BridgeAddr) if err != nil { panic(err) } } -func (s *IntegrationTestSuite) Test_Erc20Deposit() { +func (s *EVMTestSuite) Test_Erc20Deposit() { dstAddr := keystore.TestKeyRing.EthereumKeys[keystore.BobKey].CommonAddress() transactor1 := signAndSend.NewSignAndSendTransactor(s.fabric1, s.gasPricer1, s.client1) @@ -162,7 +151,7 @@ func (s *IntegrationTestSuite) Test_Erc20Deposit() { s.Equal(1, destBalanceAfter.Cmp(destBalanceBefore)) } -func (s *IntegrationTestSuite) Test_Erc721Deposit() { +func (s *EVMTestSuite) Test_Erc721Deposit() { tokenId := big.NewInt(1) metadata := "metadata.url" @@ -220,7 +209,7 @@ func (s *IntegrationTestSuite) Test_Erc721Deposit() { s.Equal(dstAddr.String(), owner.String()) } -func (s *IntegrationTestSuite) Test_GenericDeposit() { +func (s *EVMTestSuite) Test_GenericDeposit() { transactor1 := signAndSend.NewSignAndSendTransactor(s.fabric1, s.gasPricer1, s.client1) transactor2 := signAndSend.NewSignAndSendTransactor(s.fabric2, s.gasPricer2, s.client2) diff --git a/e2e/evm/util.go b/e2e/evm/util.go index aa5df1b8..d83a929f 100644 --- a/e2e/evm/util.go +++ b/e2e/evm/util.go @@ -7,22 +7,60 @@ import ( "strings" "time" + "github.com/ChainSafe/sygma-core/chains/evm/calls" "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" + "github.com/ChainSafe/sygma-core/types" "github.com/rs/zerolog/log" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + ethereumTypes "github.com/ethereum/go-ethereum/core/types" ) var TestTimeout = time.Second * 600 +type BridgeConfig struct { + BridgeAddr common.Address + + Erc20Addr common.Address + Erc20HandlerAddr common.Address + Erc20ResourceID types.ResourceID + + Erc20LockReleaseAddr common.Address + Erc20LockReleaseHandlerAddr common.Address + Erc20LockReleaseResourceID types.ResourceID + + GenericHandlerAddr common.Address + AssetStoreAddr common.Address + GenericResourceID types.ResourceID + + PermissionlessGenericHandlerAddr common.Address + PermissionlessGenericResourceID types.ResourceID + + Erc721Addr common.Address + Erc721HandlerAddr common.Address + Erc721ResourceID types.ResourceID + + BasicFeeHandlerAddr common.Address + FeeRouterAddress common.Address + FeeHandlerWithOracleAddr common.Address + BasicFee *big.Int + OracleFee uint16 +} + +type EVMClient interface { + calls.ContractCallerDispatcher + evmgaspricer.GasPriceClient + ChainID(ctx context.Context) (*big.Int, error) +} + type Client interface { LatestBlock() (*big.Int, error) - SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) - FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]types.Log, error) + SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethereumTypes.Log) (ethereum.Subscription, error) + FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]ethereumTypes.Log, error) } func WaitUntilProposalExecuted(client Client, bridge common.Address) error { @@ -36,7 +74,7 @@ func WaitUntilProposalExecuted(client Client, bridge common.Address) error { }, } timeout := time.After(TestTimeout) - ch := make(chan types.Log) + ch := make(chan ethereumTypes.Log) a, err := abi.JSON(strings.NewReader(consts.BridgeABI)) if err != nil { return err @@ -150,7 +188,7 @@ func WaitUntilBridgeReady(client Client, bridge common.Address) error { {events.ThresholdChangedSig.GetTopic()}, }, } - ch := make(chan types.Log) + ch := make(chan ethereumTypes.Log) sub, err := client.SubscribeFilterLogs(context.Background(), query, ch) if err != nil { return err diff --git a/example/cmd/cmd.go b/example/cmd/cmd.go index b2b1da2d..76e620fe 100644 --- a/example/cmd/cmd.go +++ b/example/cmd/cmd.go @@ -4,8 +4,6 @@ package cmd import ( - evmCLI "github.com/ChainSafe/sygma-core/chains/evm/cli" - "github.com/ChainSafe/sygma-core/chains/evm/cli/local" "github.com/ChainSafe/sygma-core/example/app" "github.com/ChainSafe/sygma-core/flags" "github.com/rs/zerolog/log" @@ -34,7 +32,7 @@ func init() { } func Execute() { - rootCMD.AddCommand(runCMD, evmCLI.EvmRootCLI, local.LocalSetupCmd) + rootCMD.AddCommand(runCMD) if err := rootCMD.Execute(); err != nil { log.Fatal().Err(err).Msg("failed to execute root cmd") } diff --git a/go.mod b/go.mod index d436f7b4..4519c062 100644 --- a/go.mod +++ b/go.mod @@ -19,8 +19,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 - golang.org/x/term v0.6.0 ) require ( @@ -31,6 +29,7 @@ require ( github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect ) require ( diff --git a/go.sum b/go.sum index 61844b95..165ecb45 100644 --- a/go.sum +++ b/go.sum @@ -873,8 +873,6 @@ golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/keystore/decrypt.go b/keystore/decrypt.go deleted file mode 100644 index c53dcfc1..00000000 --- a/keystore/decrypt.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package keystore - -import ( - "encoding/json" - "errors" - "fmt" - "os" - "path/filepath" - - "github.com/ChainSafe/sygma-core/crypto" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/crypto/sr25519" -) - -// Decrypt uses AES to decrypt ciphertext with the symmetric key deterministically created from `password` -func Decrypt(data, password []byte) ([]byte, error) { - gcm, err := gcmFromPassphrase(password) - if err != nil { - return nil, err - } - - nonceSize := gcm.NonceSize() - nonce, ciphertext := data[:nonceSize], data[nonceSize:] - plaintext, err := gcm.Open(nil, nonce, ciphertext, nil) - if err != nil { - if err.Error() == "cipher: message authentication failed" { - err = errors.New(err.Error() + ". Incorrect Password.") - } - return nil, err - } - - return plaintext, nil -} - -// DecodeKeypair turns input bytes into a keypair based on the specified key type -func DecodeKeypair(in []byte, keytype crypto.KeyType) (kp crypto.Keypair, err error) { - if keytype == crypto.Secp256k1Type { - kp = &secp256k1.Keypair{} - err = kp.Decode(in) - } else if keytype == crypto.Sr25519Type { - kp = &sr25519.Keypair{} - err = kp.Decode(in) - } else { - return nil, errors.New("cannot decode key: invalid key type") - } - - return kp, err -} - -// DecryptPrivateKey uses AES to decrypt the ciphertext into a `crypto.PrivateKey` with a symmetric key deterministically -// created from `password` -func DecryptKeypair(expectedPubK string, data, password []byte, keytype string) (crypto.Keypair, error) { - pk, err := Decrypt(data, password) - if err != nil { - return nil, err - } - kp, err := DecodeKeypair(pk, keytype) - if err != nil { - return nil, err - } - - // Check that the decoding matches what was expected - if kp.PublicKey() != expectedPubK { - return nil, fmt.Errorf("unexpected key file data, file may be corrupt or have been tampered with") - } - return kp, nil -} - -// ReadFromFileAndDecrypt reads ciphertext from a file and decrypts it using the password into a `crypto.PrivateKey` -func ReadFromFileAndDecrypt(filename string, password []byte, keytype string) (crypto.Keypair, error) { - fp, err := filepath.Abs(filename) - if err != nil { - return nil, err - } - - data, err := os.ReadFile(filepath.Clean(fp)) - if err != nil { - return nil, err - } - - keydata := new(EncryptedKeystore) - err = json.Unmarshal(data, keydata) - if err != nil { - return nil, err - } - - if keytype != keydata.Type { - return nil, fmt.Errorf("Keystore type and Chain type mismatched. Expected Keystore file of type %s, got type %s", keytype, keydata.Type) - } - - return DecryptKeypair(keydata.PublicKey, keydata.Ciphertext, password, keydata.Type) -} diff --git a/keystore/encrypt.go b/keystore/encrypt.go deleted file mode 100644 index 72a33bdd..00000000 --- a/keystore/encrypt.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package keystore - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/json" - "errors" - "fmt" - "io" - "os" - "syscall" - - "github.com/ChainSafe/sygma-core/crypto" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/crypto/sr25519" - "golang.org/x/crypto/blake2b" - terminal "golang.org/x/term" -) - -type EncryptedKeystore struct { - Type string `json:"type"` - PublicKey string `json:"publicKey"` - Address string `json:"address"` - Ciphertext []byte `json:"ciphertext"` -} - -// gcmFromPassphrase creates a symmetric AES key given a password -func gcmFromPassphrase(password []byte) (cipher.AEAD, error) { - hash := blake2b.Sum256(password) - - block, err := aes.NewCipher(hash[:]) - if err != nil { - return nil, err - } - - gcm, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - - return gcm, nil -} - -// Encrypt uses AES to encrypt `msg` with the symmetric key deterministically created from `password` -func Encrypt(msg, password []byte) ([]byte, error) { - gcm, err := gcmFromPassphrase(password) - if err != nil { - return nil, err - } - - nonce := make([]byte, gcm.NonceSize()) - if _, err = io.ReadFull(rand.Reader, nonce); err != nil { - return nil, err - } - - ciphertext := gcm.Seal(nonce, nonce, msg, nil) - return ciphertext, nil -} - -// EncryptKeypair uses AES to encrypt an encoded `crypto.Keypair` with a symmetric key deterministically -// created from `password` -func EncryptKeypair(kp crypto.Keypair, password []byte) ([]byte, error) { - return Encrypt(kp.Encode(), password) -} - -// EncryptAndWriteToFile encrypts the `crypto.PrivateKey` using the password and saves it to the specified file -func EncryptAndWriteToFile(file *os.File, kp crypto.Keypair, password []byte) error { - ciphertext, err := EncryptKeypair(kp, password) - if err != nil { - return err - } - - keytype := "" - - if _, ok := kp.(*sr25519.Keypair); ok { - keytype = crypto.Sr25519Type - } - - if _, ok := kp.(*secp256k1.Keypair); ok { - keytype = crypto.Secp256k1Type - } - - if keytype == "" { - return errors.New("cannot write key not of type secp256k1 or sr25519") - } - - keydata := &EncryptedKeystore{ - Type: keytype, - PublicKey: kp.PublicKey(), - Address: kp.Address(), - Ciphertext: ciphertext, - } - - data, err := json.MarshalIndent(keydata, "", "\t") - if err != nil { - return err - } - - _, err = file.Write(append(data, byte('\n'))) - return err -} - -// prompt user to enter password for encrypted keystore -func GetPassword(msg string) []byte { - for { - fmt.Println(msg) - fmt.Print("> ") - password, err := terminal.ReadPassword(int(syscall.Stdin)) - if err != nil { - fmt.Printf("invalid input: %s\n", err) - } else { - fmt.Printf("\n") - return password - } - } -} diff --git a/keystore/encrypt_test.go b/keystore/encrypt_test.go deleted file mode 100644 index ea8cf4d5..00000000 --- a/keystore/encrypt_test.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package keystore - -import ( - "bytes" - "crypto/rand" - "os" - "path/filepath" - "reflect" - "testing" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/crypto/sr25519" -) - -func TestEncryptAndDecrypt(t *testing.T) { - password := []byte("noot") - msg := []byte("helloworld") - - ciphertext, err := Encrypt(msg, password) - if err != nil { - t.Fatal(err) - } - - res, err := Decrypt(ciphertext, password) - if err != nil { - t.Fatal(err) - } - - if !bytes.Equal(msg, res) { - t.Fatalf("Fail to decrypt: got %x expected %x", res, msg) - } -} - -func TestEncryptAndDecryptKeypair(t *testing.T) { - buf := make([]byte, 32) - _, err := rand.Read(buf) - if err != nil { - t.Fatal(err) - } - - kp, err := secp256k1.NewKeypairFromPrivateKey(buf) - if err != nil { - t.Fatal(err) - } - - password := []byte("noot") - - data, err := EncryptKeypair(kp, password) - if err != nil { - t.Fatal(err) - } - - res, err := DecryptKeypair(kp.PublicKey(), data, password, "secp256k1") - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(kp, res) { - t.Fatalf("Fail: got %#v expected %#v", res, kp) - } -} - -func createTestFile(t *testing.T) (*os.File, string) { - filename := "./test_key" - - fp, err := filepath.Abs(filename) - if err != nil { - t.Fatal(err) - } - - file, err := os.Create(fp) - if err != nil { - t.Fatal(err) - } - - return file, fp -} - -func TestEncryptAndDecryptFromFile_Secp256k1(t *testing.T) { - password := []byte("noot") - file, fp := createTestFile(t) - defer os.Remove(fp) - - kp, err := secp256k1.GenerateKeypair() - if err != nil { - t.Fatal(err) - } - - err = EncryptAndWriteToFile(file, kp, password) - if err != nil { - t.Fatal(err) - } - - res, err := ReadFromFileAndDecrypt(fp, password, "secp256k1") - if err != nil { - t.Fatal(err) - } - - if !bytes.Equal(kp.Encode(), res.Encode()) { - t.Fatalf("Fail: got %#v expected %#v", res, kp) - } -} - -func TestEncryptAndDecryptFromFile_Sr25519(t *testing.T) { - password := []byte("ansermino") - file, fp := createTestFile(t) - defer os.Remove(fp) - - kp, err := sr25519.NewKeypairFromSeed("//seed", "substrate") - if err != nil { - t.Fatal(err) - } - - err = EncryptAndWriteToFile(file, kp, password) - if err != nil { - t.Fatal(err) - } - - res, err := ReadFromFileAndDecrypt(fp, password, "sr25519") - if err != nil { - t.Fatal(err) - } - - if !bytes.Equal(kp.Encode(), res.Encode()) { - t.Fatalf("Fail: got %#v expected %#v", res, kp) - } -} - -func TestDecryptIncorrectType(t *testing.T) { - password := []byte("ansermino") - file, fp := createTestFile(t) - defer os.Remove(fp) - - kp, err := sr25519.NewKeypairFromSeed("//seed", "substrate") - if err != nil { - t.Fatal(err) - } - - err = EncryptAndWriteToFile(file, kp, password) - if err != nil { - t.Fatal(err) - } - - _, err = ReadFromFileAndDecrypt(fp, password, "secp256k1") - if err == nil { - t.Fatal("Expected mismatch error, got none.") - } -} diff --git a/keystore/keystore.go b/keystore/keystore.go deleted file mode 100644 index 875b325e..00000000 --- a/keystore/keystore.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -/* -The keystore package is used to load keys from keystore files, both for live use and for testing. - -# The Keystore - -The keystore file is used as a file representation of a key. It contains 4 parts: -- The key type (secp256k1, sr25519) -- The PublicKey -- The Address -- The ciphertext - -This keystore also requires a password to decrypt into a usable key. -The keystore library can be used to both encrypt keys into keystores, and decrypt keystore into keys. -For more information on how to encrypt and decrypt from the command line, reference the README: https://github.com/ChainSafe/ChainBridge - -# The Keyring - -The keyring provides predefined secp256k1 and srr25519 keys to use in testing. -These keys are automatically provided during runtime and stored in memory rather than being stored on disk. -There are 5 keys currenty supported: Alice, Bob, Charlie, Dave, and Eve. -*/ -package keystore - -import ( - "fmt" - "os" - - "github.com/ChainSafe/sygma-core/crypto" -) - -const EnvPassword = "KEYSTORE_PASSWORD" - -var keyMapping = map[string]string{ - "ethereum": "secp256k1", - "substrate": "sr25519", -} - -// KeypairFromAddress attempts to load the encrypted key file for the provided address, -// prompting the user for the password. -func KeypairFromAddress(addr, chainType, path string, insecure bool) (crypto.Keypair, error) { - if insecure { - return insecureKeypairFromAddress(path, chainType) - } - path = fmt.Sprintf("%s/%s.key", path, addr) - // Make sure key exists before prompting password - if _, err := os.Stat(path); os.IsNotExist(err) { - return nil, fmt.Errorf("key file not found: %s", path) - } - - var pswd []byte - if pswdStr := os.Getenv(EnvPassword); pswdStr != "" { - pswd = []byte(pswdStr) - } else { - pswd = GetPassword(fmt.Sprintf("Enter password for key %s:", path)) - } - - kp, err := ReadFromFileAndDecrypt(path, pswd, keyMapping[chainType]) - if err != nil { - return nil, err - } - - return kp, nil -} diff --git a/relayer/message/message_processors.go b/relayer/message/message_processors.go deleted file mode 100644 index 19392697..00000000 --- a/relayer/message/message_processors.go +++ /dev/null @@ -1,53 +0,0 @@ -package message - -import ( - "errors" - "math/big" - - "github.com/rs/zerolog/log" -) - -type MessageProcessor func(message *Message) error - -// AdjustDecimalsForERC20AmountMessageProcessor is a function, that accepts message and map[domainID uint8]{decimal uint} -// using this params processor converts amount for one chain to another for provided decimals with floor rounding -func AdjustDecimalsForERC20AmountMessageProcessor(args ...interface{}) MessageProcessor { - return func(m *Message) error { - if len(args) == 0 { - return errors.New("processor requires 1 argument") - } - decimalsMap, ok := args[0].(map[uint8]uint64) - if !ok { - return errors.New("no decimals map found in args") - } - sourceDecimal, ok := decimalsMap[m.Source] - if !ok { - return errors.New("no source decimals found at decimalsMap") - } - destDecimal, ok := decimalsMap[m.Destination] - if !ok { - return errors.New("no destination decimals found at decimalsMap") - } - amountByte, ok := m.Payload[0].([]byte) - if !ok { - return errors.New("could not cast interface to byte slice") - } - amount := new(big.Int).SetBytes(amountByte) - if sourceDecimal > destDecimal { - diff := sourceDecimal - destDecimal - roundedAmount := big.NewInt(0) - roundedAmount.Div(amount, big.NewInt(0).Exp(big.NewInt(10), big.NewInt(0).SetUint64(diff), nil)) - log.Info().Msgf("amount %s rounded to %s from chain %v to chain %v", amount.String(), roundedAmount.String(), m.Source, m.Destination) - m.Payload[0] = roundedAmount.Bytes() - return nil - } - if sourceDecimal < destDecimal { - diff := destDecimal - sourceDecimal - roundedAmount := big.NewInt(0) - roundedAmount.Mul(amount, big.NewInt(0).Exp(big.NewInt(10), big.NewInt(0).SetUint64(diff), nil)) - m.Payload[0] = roundedAmount.Bytes() - log.Info().Msgf("amount %s rounded to %s from chain %v to chain %v", amount.String(), roundedAmount.String(), m.Source, m.Destination) - } - return nil - } -} diff --git a/relayer/message/message_processors_test.go b/relayer/message/message_processors_test.go deleted file mode 100644 index 90b869b8..00000000 --- a/relayer/message/message_processors_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package message - -import ( - "math/big" - "testing" -) - -// TestRouter tests relayers router -func TestAdjustDecimalsForERC20AmountMessageProcessor(t *testing.T) { - a, _ := big.NewInt(0).SetString("145556700000000000000", 10) // 145.5567 tokens - msg := &Message{ - Destination: 2, - Source: 1, - Payload: []interface{}{ - a.Bytes(), // 145.5567 tokens - }, - } - err := AdjustDecimalsForERC20AmountMessageProcessor(map[uint8]uint64{1: 18, 2: 2})(msg) - if err != nil { - t.Fatal() - } - amount := new(big.Int).SetBytes(msg.Payload[0].([]byte)) - if amount.Cmp(big.NewInt(14555)) != 0 { - t.Fatal(amount.String()) - } - msg2 := &Message{ - Destination: 1, - Source: 2, - Payload: []interface{}{ - big.NewInt(14555).Bytes(), // 145.55 tokens from 2nd chain - }, - } - err = AdjustDecimalsForERC20AmountMessageProcessor(map[uint8]uint64{1: 18, 2: 2})(msg2) - if err != nil { - t.Fatal() - } - a2, _ := big.NewInt(0).SetString("145550000000000000000", 10) - amount2 := new(big.Int).SetBytes(msg2.Payload[0].([]byte)) - if amount2.Cmp(a2) != 0 { - t.Fatal() - } -} diff --git a/relayer/relayer.go b/relayer/relayer.go index 548776ee..ea7d9269 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -5,7 +5,6 @@ package relayer import ( "context" - "fmt" "github.com/ChainSafe/sygma-core/relayer/message" "github.com/rs/zerolog/log" @@ -23,15 +22,14 @@ type RelayedChain interface { DomainID() uint8 } -func NewRelayer(chains []RelayedChain, metrics DepositMeter, messageProcessors ...message.MessageProcessor) *Relayer { - return &Relayer{relayedChains: chains, messageProcessors: messageProcessors, metrics: metrics} +func NewRelayer(chains []RelayedChain, metrics DepositMeter) *Relayer { + return &Relayer{relayedChains: chains, metrics: metrics} } type Relayer struct { - metrics DepositMeter - relayedChains []RelayedChain - registry map[uint8]RelayedChain - messageProcessors []message.MessageProcessor + metrics DepositMeter + relayedChains []RelayedChain + registry map[uint8]RelayedChain } // Start function starts the relayer. Relayer routine is starting all the chains @@ -67,16 +65,10 @@ func (r *Relayer) route(msgs []*message.Message) { for _, m := range msgs { r.metrics.TrackDepositMessage(m) - - for _, mp := range r.messageProcessors { - if err := mp(m); err != nil { - log.Error().Err(fmt.Errorf("error %w processing mesage %v", err, m)) - return - } - } } log.Debug().Msgf("Sending messages %+v to destination %v", msgs, destChain.DomainID()) + err := destChain.Write(msgs) if err != nil { for _, m := range msgs { diff --git a/relayer/relayer_test.go b/relayer/relayer_test.go index 373f5257..334c2bff 100644 --- a/relayer/relayer_test.go +++ b/relayer/relayer_test.go @@ -2,7 +2,6 @@ package relayer import ( "fmt" - "math/big" "testing" "github.com/ChainSafe/sygma-core/relayer/message" @@ -40,32 +39,12 @@ func (s *RouteTestSuite) TestLogsErrorIfDestinationDoesNotExist() { }) } -// TestRouter tests relayers router -func (s *RouteTestSuite) TestAdjustDecimalsForERC20AmountMessageProcessor() { - a, _ := big.NewInt(0).SetString("145556700000000000000", 10) // 145.5567 tokens - msg := &message.Message{ - Destination: 2, - Source: 1, - Payload: []interface{}{ - a.Bytes(), // 145.5567 tokens - }, - } - err := message.AdjustDecimalsForERC20AmountMessageProcessor(map[uint8]uint64{1: 18, 2: 2})(msg) - s.Nil(err) - amount := new(big.Int).SetBytes(msg.Payload[0].([]byte)) - if amount.Cmp(big.NewInt(14555)) != 0 { - s.Fail("wrong amount") - } - -} - func (s *RouteTestSuite) TestLogsErrorIfMessageProcessorReturnsError() { s.mockMetrics.EXPECT().TrackDepositMessage(gomock.Any()) s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)) relayer := NewRelayer( []RelayedChain{}, s.mockMetrics, - func(m *message.Message) error { return fmt.Errorf("error") }, ) relayer.addRelayedChain(s.mockRelayedChain) @@ -82,7 +61,6 @@ func (s *RouteTestSuite) TestWriteFail() { relayer := NewRelayer( []RelayedChain{}, s.mockMetrics, - func(m *message.Message) error { return nil }, ) relayer.addRelayedChain(s.mockRelayedChain) @@ -99,7 +77,6 @@ func (s *RouteTestSuite) TestWritesToDestChainIfMessageValid() { relayer := NewRelayer( []RelayedChain{}, s.mockMetrics, - func(m *message.Message) error { return nil }, ) relayer.addRelayedChain(s.mockRelayedChain) diff --git a/scripts/header.txt b/scripts/header.txt index a2e965fc..64269e05 100644 --- a/scripts/header.txt +++ b/scripts/header.txt @@ -1,2 +1,2 @@ -Copyright 2021 ChainSafe Systems +Copyright 2023 ChainSafe Systems SPDX-License-Identifier: LGPL-3.0-only \ No newline at end of file diff --git a/sender/secp256sender/sender.go b/sender/secp256sender/sender.go deleted file mode 100644 index de4e7421..00000000 --- a/sender/secp256sender/sender.go +++ /dev/null @@ -1,19 +0,0 @@ -package secp256sender - -import ( - "crypto/ecdsa" - - "github.com/ethereum/go-ethereum/common" -) - -type SecpInMemory256Sender struct { - privateKey *ecdsa.PrivateKey - address common.Address -} - -func (s *SecpInMemory256Sender) PrivateKey() *ecdsa.PrivateKey { - return s.privateKey -} -func (s *SecpInMemory256Sender) Address() string { - return s.address.Hex() -} diff --git a/sender/sender.go b/sender/sender.go deleted file mode 100644 index a2958253..00000000 --- a/sender/sender.go +++ /dev/null @@ -1,10 +0,0 @@ -package sender - -import ( - "crypto/ecdsa" -) - -type Sender interface { - PrivateKey() *ecdsa.PrivateKey - Address() string -} From 68615e7b697b10d8fdc56f96e21339895f35d7f3 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 14:12:10 +0200 Subject: [PATCH 04/27] Remove test setup temporarily --- Makefile | 2 +- chains/evm/calls/calls.go | 6 +- chains/evm/calls/client/client.go | 2 +- chains/evm/calls/contracts/abi/bridge.go | 3 + chains/evm/calls/gas/gas-pricer.go | 2 +- chains/evm/calls/gas/london.go | 2 +- chains/evm/calls/gas/london_test.go | 8 +- chains/evm/calls/gas/mock/gas-pricer.go | 6 +- chains/evm/calls/gas/static.go | 2 +- chains/evm/calls/gas/static_test.go | 8 +- chains/evm/calls/mock/calls.go | 6 +- chains/evm/calls/transaction/evm-tx.go | 12 +- chains/evm/calls/transaction/evm-tx_test.go | 14 +- .../transactor/monitored/monitored_test.go | 5 +- .../signAndSend/signAndSend_test.go | 5 +- config/chain/config.go | 6 +- config/chain/config_test.go | 8 +- config/chain/evm.go | 95 ------- config/chain/evm_test.go | 141 ----------- e2e/dummy/gas-pricer.go | 36 --- e2e/evm/evm_test.go | 237 ------------------ e2e/evm/util.go | 207 --------------- example/Dockerfile | 16 -- example/app/app.go | 149 ----------- example/cfg/config_evm-evm_1.json | 39 --- example/cfg/config_evm-evm_2.json | 37 --- example/cfg/config_evm-evm_3.json | 37 --- example/cfg/otel-collector-config.yml | 20 -- example/cmd/cmd.go | 39 --- example/docker-compose.yml | 100 -------- example/geth-build/Dockerfile | 14 -- example/geth-build/entrypoint.sh | 74 ------ example/geth-build/genesis.json | 50 ---- ...--f4314cb9046bece6aa54bb9533155434d0c76909 | 1 - ...--ff93b45308fd417df303d6515ab04d9e89a750ca | 1 - ...--8e0a907331554af72563bd8d43051c2e64be5d35 | 1 - ...--24962717f8fa5ba3b931bacaf9ac03924eb475a0 | 1 - ...--148ffb2074a9e59ed58142822b3eb3fcbffb0cd7 | 1 - ...--4ceef6139f00f9f4535ad19640ff7a0137708485 | 1 - example/geth-build/password.txt | 6 - example/main.go | 12 - types/{bytes.go => types.go} | 0 util/cli.go | 12 - 43 files changed, 48 insertions(+), 1376 deletions(-) create mode 100644 chains/evm/calls/contracts/abi/bridge.go delete mode 100644 config/chain/evm.go delete mode 100644 config/chain/evm_test.go delete mode 100644 e2e/dummy/gas-pricer.go delete mode 100644 e2e/evm/evm_test.go delete mode 100644 e2e/evm/util.go delete mode 100644 example/Dockerfile delete mode 100644 example/app/app.go delete mode 100644 example/cfg/config_evm-evm_1.json delete mode 100644 example/cfg/config_evm-evm_2.json delete mode 100644 example/cfg/config_evm-evm_3.json delete mode 100644 example/cfg/otel-collector-config.yml delete mode 100644 example/cmd/cmd.go delete mode 100644 example/docker-compose.yml delete mode 100644 example/geth-build/Dockerfile delete mode 100644 example/geth-build/entrypoint.sh delete mode 100644 example/geth-build/genesis.json delete mode 100644 example/geth-build/keystore/UTC--2020-03-20T21-14-07.508717834Z--f4314cb9046bece6aa54bb9533155434d0c76909 delete mode 100644 example/geth-build/keystore/UTC--2020-04-07T13-50-35.447Z--ff93b45308fd417df303d6515ab04d9e89a750ca delete mode 100644 example/geth-build/keystore/UTC--2020-04-07T13-52-12.564Z--8e0a907331554af72563bd8d43051c2e64be5d35 delete mode 100644 example/geth-build/keystore/UTC--2020-04-07T13-53-49.003Z--24962717f8fa5ba3b931bacaf9ac03924eb475a0 delete mode 100644 example/geth-build/keystore/UTC--2020-04-07T13-55-20.258Z--148ffb2074a9e59ed58142822b3eb3fcbffb0cd7 delete mode 100644 example/geth-build/keystore/UTC--2020-04-07T13-56-44.768Z--4ceef6139f00f9f4535ad19640ff7a0137708485 delete mode 100644 example/geth-build/password.txt delete mode 100644 example/main.go rename types/{bytes.go => types.go} (100%) delete mode 100644 util/cli.go diff --git a/Makefile b/Makefile index 59543d16..07402da3 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ install-subkey: cargo install --force --git https://github.com/paritytech/substrate subkey genmocks: - mockgen -destination=./chains/evm/calls/evmgaspricer/mock/gas-pricer.go -source=./chains/evm/calls/evmgaspricer/gas-pricer.go + mockgen -destination=./chains/evm/calls/gaspricer/mock/gas-pricer.go -source=./chains/evm/calls/gaspricer/gas-pricer.go mockgen -destination=./relayer/mock/relayer.go -source=./relayer/relayer.go mockgen -source=chains/evm/calls/calls.go -destination=chains/evm/calls/mock/calls.go mockgen -source=chains/evm/calls/transactor/transact.go -destination=chains/evm/calls/transactor/mock/transact.go diff --git a/chains/evm/calls/calls.go b/chains/evm/calls/calls.go index fcee556d..f41fde0b 100644 --- a/chains/evm/calls/calls.go +++ b/chains/evm/calls/calls.go @@ -4,12 +4,12 @@ import ( "context" "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + "github.com/ChainSafe/sygma-core/chains/evm/calls/client" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) -type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (evmclient.CommonTransaction, error) +type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (client.CommonTransaction, error) type ContractChecker interface { CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) @@ -26,7 +26,7 @@ type GasPricer interface { type ClientDispatcher interface { TxReceipt(h common.Hash) (*types.Receipt, error) - SignAndSendTransaction(ctx context.Context, tx evmclient.CommonTransaction) (common.Hash, error) + SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error) UnsafeNonce() (*big.Int, error) diff --git a/chains/evm/calls/client/client.go b/chains/evm/calls/client/client.go index 920eba16..5d867454 100644 --- a/chains/evm/calls/client/client.go +++ b/chains/evm/calls/client/client.go @@ -1,4 +1,4 @@ -package evmclient +package client import ( "context" diff --git a/chains/evm/calls/contracts/abi/bridge.go b/chains/evm/calls/contracts/abi/bridge.go new file mode 100644 index 00000000..99d7e3ef --- /dev/null +++ b/chains/evm/calls/contracts/abi/bridge.go @@ -0,0 +1,3 @@ +package abi + +const BridgeABI = "[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"accessControl\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSig\",\"type\":\"bytes4\"}],\"name\":\"AccessNotAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositToCurrentDomain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyProposalsArray\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProposalSigner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressAlreadySet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressIsNotUpdatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonceDecrementsNotAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResourceIDNotMappedToHandler\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAccessControl\",\"type\":\"address\"}],\"name\":\"AccessControlChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"destinationDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EndKeygen\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lowLevelData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"}],\"name\":\"FailedHandlerExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newFeeHandler\",\"type\":\"address\"}],\"name\":\"FeeHandlerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"hash\",\"type\":\"string\"}],\"name\":\"KeyRefresh\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"name\":\"ProposalExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"txHash\",\"type\":\"string\"}],\"name\":\"Retry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"StartKeygen\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_MPCAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_accessControl\",\"outputs\":[{\"internalType\":\"contract IAccessControlSegregator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"_depositCounts\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_domainID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_feeHandler\",\"outputs\":[{\"internalType\":\"contract IFeeHandler\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"_resourceIDToHandlerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isValidForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"usedNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminPauseTransfers\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminUnpauseTransfers\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"args\",\"type\":\"bytes\"}],\"name\":\"adminSetResource\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"adminSetBurnable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"}],\"name\":\"adminSetDepositNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"adminSetForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAccessControl\",\"type\":\"address\"}],\"name\":\"adminChangeAccessControl\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newFeeHandler\",\"type\":\"address\"}],\"name\":\"adminChangeFeeHandler\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"adminWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"destinationDomainID\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"depositData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"feeData\",\"type\":\"bytes\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"executeProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal[]\",\"name\":\"proposals\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"executeProposals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startKeygen\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"MPCAddress\",\"type\":\"address\"}],\"name\":\"endKeygen\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"hash\",\"type\":\"string\"}],\"name\":\"refreshKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"txHash\",\"type\":\"string\"}],\"name\":\"retry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"depositNonce\",\"type\":\"uint256\"}],\"name\":\"isProposalExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal[]\",\"name\":\"proposals\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" diff --git a/chains/evm/calls/gas/gas-pricer.go b/chains/evm/calls/gas/gas-pricer.go index 5a0ebeb7..4c78a0c2 100644 --- a/chains/evm/calls/gas/gas-pricer.go +++ b/chains/evm/calls/gas/gas-pricer.go @@ -1,4 +1,4 @@ -package evmgaspricer +package gaspricer import ( "context" diff --git a/chains/evm/calls/gas/london.go b/chains/evm/calls/gas/london.go index 88c3c028..9a507284 100644 --- a/chains/evm/calls/gas/london.go +++ b/chains/evm/calls/gas/london.go @@ -1,4 +1,4 @@ -package evmgaspricer +package gaspricer import ( "context" diff --git a/chains/evm/calls/gas/london_test.go b/chains/evm/calls/gas/london_test.go index 3813e75d..b8ae7abd 100644 --- a/chains/evm/calls/gas/london_test.go +++ b/chains/evm/calls/gas/london_test.go @@ -1,10 +1,10 @@ -package evmgaspricer +package gaspricer import ( "math/big" "testing" - mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" @@ -12,7 +12,7 @@ import ( type LondonGasPriceTestSuite struct { suite.Suite - gasPricerMock *mock_evmgaspricer.MockLondonGasClient + gasPricerMock *mock_gaspricer.MockLondonGasClient } func TestRuLondonTestSuite(t *testing.T) { @@ -23,7 +23,7 @@ func (s *LondonGasPriceTestSuite) SetupSuite() {} func (s *LondonGasPriceTestSuite) TearDownSuite() {} func (s *LondonGasPriceTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.gasPricerMock = mock_evmgaspricer.NewMockLondonGasClient(gomockController) + s.gasPricerMock = mock_gaspricer.NewMockLondonGasClient(gomockController) } func (s *LondonGasPriceTestSuite) TearDownTest() {} diff --git a/chains/evm/calls/gas/mock/gas-pricer.go b/chains/evm/calls/gas/mock/gas-pricer.go index d96163c6..457eeaca 100644 --- a/chains/evm/calls/gas/mock/gas-pricer.go +++ b/chains/evm/calls/gas/mock/gas-pricer.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/calls/evmgaspricer/gas-pricer.go +// Source: ./chains/evm/calls/gaspricer/gas-pricer.go -// Package mock_evmgaspricer is a generated GoMock package. -package mock_evmgaspricer +// Package mock_gaspricer is a generated GoMock package. +package mock_gaspricer import ( context "context" diff --git a/chains/evm/calls/gas/static.go b/chains/evm/calls/gas/static.go index 3d0a4bae..2fcea762 100644 --- a/chains/evm/calls/gas/static.go +++ b/chains/evm/calls/gas/static.go @@ -1,4 +1,4 @@ -package evmgaspricer +package gaspricer import ( "context" diff --git a/chains/evm/calls/gas/static_test.go b/chains/evm/calls/gas/static_test.go index 848c3696..8392ea19 100644 --- a/chains/evm/calls/gas/static_test.go +++ b/chains/evm/calls/gas/static_test.go @@ -1,11 +1,11 @@ -package evmgaspricer +package gaspricer import ( "errors" "math/big" "testing" - mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" "github.com/golang/mock/gomock" @@ -14,7 +14,7 @@ import ( type StaticGasPriceTestSuite struct { suite.Suite - gasPricerMock *mock_evmgaspricer.MockGasPriceClient + gasPricerMock *mock_gaspricer.MockGasPriceClient } func TestRunTestSuite(t *testing.T) { @@ -25,7 +25,7 @@ func (s *StaticGasPriceTestSuite) SetupSuite() {} func (s *StaticGasPriceTestSuite) TearDownSuite() {} func (s *StaticGasPriceTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.gasPricerMock = mock_evmgaspricer.NewMockGasPriceClient(gomockController) + s.gasPricerMock = mock_gaspricer.NewMockGasPriceClient(gomockController) } func (s *StaticGasPriceTestSuite) TearDownTest() {} diff --git a/chains/evm/calls/mock/calls.go b/chains/evm/calls/mock/calls.go index 1fa608b5..6173c138 100644 --- a/chains/evm/calls/mock/calls.go +++ b/chains/evm/calls/mock/calls.go @@ -9,7 +9,7 @@ import ( big "math/big" reflect "reflect" - evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" + evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/client" common "github.com/ethereum/go-ethereum/common" types "github.com/ethereum/go-ethereum/core/types" gomock "github.com/golang/mock/gomock" @@ -195,7 +195,7 @@ func (mr *MockClientDispatcherMockRecorder) LockNonce() *gomock.Call { } // SignAndSendTransaction mocks base method. -func (m *MockClientDispatcher) SignAndSendTransaction(ctx context.Context, tx evmclient.CommonTransaction) (common.Hash, error) { +func (m *MockClientDispatcher) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) ret0, _ := ret[0].(common.Hash) @@ -376,7 +376,7 @@ func (mr *MockContractCallerDispatcherMockRecorder) LockNonce() *gomock.Call { } // SignAndSendTransaction mocks base method. -func (m *MockContractCallerDispatcher) SignAndSendTransaction(ctx context.Context, tx evmclient.CommonTransaction) (common.Hash, error) { +func (m *MockContractCallerDispatcher) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) ret0, _ := ret[0].(common.Hash) diff --git a/chains/evm/calls/transaction/evm-tx.go b/chains/evm/calls/transaction/evm-tx.go index 73bd18ce..6ac7b0e1 100644 --- a/chains/evm/calls/transaction/evm-tx.go +++ b/chains/evm/calls/transaction/evm-tx.go @@ -1,11 +1,9 @@ -package evmtransaction +package transaction import ( "context" "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -19,7 +17,7 @@ type TX struct { // but return raw byte representation of transaction to be compatible and interchangeable between different go-ethereum forks // WithSignature returns a new transaction with the given signature. // This signature needs to be in the [R || S || V] format where V is 0 or 1. -func (a *TX) RawWithSignature(signer evmclient.Signer, domainID *big.Int) ([]byte, error) { +func (a *TX) RawWithSignature(signer client.Signer, domainID *big.Int) ([]byte, error) { opts, err := newTransactorWithChainID(signer, domainID) if err != nil { return nil, err @@ -39,7 +37,7 @@ func (a *TX) RawWithSignature(signer evmclient.Signer, domainID *big.Int) ([]byt } // NewTransaction is the ethereum transaction constructor -func NewTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (evmclient.CommonTransaction, error) { +func NewTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (client.CommonTransaction, error) { // If there is more than one gas price returned we are sending with DynamicFeeTx's if len(gasPrices) > 1 { return newDynamicFeeTransaction(nonce, to, amount, gasLimit, gasPrices[0], gasPrices[1], data), nil @@ -78,10 +76,10 @@ func (a *TX) Hash() common.Hash { } // newTransactorWithChainID is a utility method to easily create a transaction signer -// for an evmclient.Signer. +// for an client.Signer. // Mostly copies bind.NewKeyedTransactorWithChainID but sings with the provided signer // instead of a privateKey -func newTransactorWithChainID(s evmclient.Signer, chainID *big.Int) (*bind.TransactOpts, error) { +func newTransactorWithChainID(s client.Signer, chainID *big.Int) (*bind.TransactOpts, error) { keyAddr := s.CommonAddress() if chainID == nil { return nil, bind.ErrNoChainID diff --git a/chains/evm/calls/transaction/evm-tx_test.go b/chains/evm/calls/transaction/evm-tx_test.go index b5d6eeda..6f249a9a 100644 --- a/chains/evm/calls/transaction/evm-tx_test.go +++ b/chains/evm/calls/transaction/evm-tx_test.go @@ -1,11 +1,11 @@ -package evmtransaction +package transaction_test import ( "math/big" "testing" - evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - mock_evmgaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer/mock" + gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" "github.com/ethereum/go-ethereum/core/types" @@ -21,7 +21,7 @@ var aliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey] type EVMTxTestSuite struct { suite.Suite - client *mock_evmgaspricer.MockLondonGasClient + client *mock_gaspricer.MockLondonGasClient } func TestRunTestSuite(t *testing.T) { @@ -32,14 +32,14 @@ func (s *EVMTxTestSuite) SetupSuite() {} func (s *EVMTxTestSuite) TearDownSuite() {} func (s *EVMTxTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.client = mock_evmgaspricer.NewMockLondonGasClient(gomockController) + s.client = mock_gaspricer.NewMockLondonGasClient(gomockController) } func (s *EVMTxTestSuite) TearDownTest() {} func (s *EVMTxTestSuite) TestNewTransactionWithStaticGasPricer() { s.client.EXPECT().SuggestGasPrice(gomock.Any()).Return(big.NewInt(1000), nil) txFabric := NewTransaction - gasPriceClient := evmgaspricer.NewStaticGasPriceDeterminant(s.client, nil) + gasPriceClient := gaspricer.NewStaticGasPriceDeterminant(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) tx, err := txFabric(1, &common.Address{}, big.NewInt(0), 10000, gp, []byte{}) @@ -56,7 +56,7 @@ func (s *EVMTxTestSuite) TestNewTransactionWithLondonGasPricer() { s.client.EXPECT().BaseFee().Return(big.NewInt(1000), nil) s.client.EXPECT().SuggestGasTipCap(gomock.Any()).Return(big.NewInt(1000), nil) txFabric := NewTransaction - gasPriceClient := evmgaspricer.NewLondonGasPriceClient(s.client, nil) + gasPriceClient := gaspricer.NewLondonGasPriceClient(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) tx, err := txFabric(1, &common.Address{}, big.NewInt(0), 10000, gp, []byte{}) diff --git a/chains/evm/calls/transactor/monitored/monitored_test.go b/chains/evm/calls/transactor/monitored/monitored_test.go index e80c5316..6c0eb7a8 100644 --- a/chains/evm/calls/transactor/monitored/monitored_test.go +++ b/chains/evm/calls/transactor/monitored/monitored_test.go @@ -8,7 +8,6 @@ import ( "time" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - evmtransaction "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" @@ -48,7 +47,7 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), @@ -73,7 +72,7 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Fail() { s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() t := monitored.NewMonitoredTransactor( - evmtransaction.NewTransaction, + transactionNewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend_test.go b/chains/evm/calls/transactor/signAndSend/signAndSend_test.go index 341e9970..bc70ce9b 100644 --- a/chains/evm/calls/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/calls/transactor/signAndSend/signAndSend_test.go @@ -4,7 +4,6 @@ import ( "math/big" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" @@ -43,11 +42,11 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().WaitAndReturnTxReceipt(gomock.Any()).Return(&types.Receipt{}, nil) + s.mockContractCallerDispatcherClient.EXPECT().TxReceipt(gomock.Any()).Return(&types.Receipt{}, nil) s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() - txFabric := evmtransaction.NewTransaction + txFabric := transactionNewTransaction var trans = signAndSend.NewSignAndSendTransactor( txFabric, s.mockGasPricer, diff --git a/config/chain/config.go b/config/chain/config.go index 764c3f4f..b4f53381 100644 --- a/config/chain/config.go +++ b/config/chain/config.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/viper" ) -type GeneralChainConfig struct { +type ChainConfig struct { Name string `mapstructure:"name"` Id *uint8 `mapstructure:"id"` Endpoint string `mapstructure:"endpoint"` @@ -19,7 +19,7 @@ type GeneralChainConfig struct { Insecure bool } -func (c *GeneralChainConfig) Validate() error { +func (c *ChainConfig) Validate() error { // viper defaults to 0 for not specified ints if c.Id == nil { return fmt.Errorf("required field domain.Id empty for chain %v", c.Id) @@ -33,7 +33,7 @@ func (c *GeneralChainConfig) Validate() error { return nil } -func (c *GeneralChainConfig) ParseFlags() { +func (c *ChainConfig) ParseFlags() { blockstore := viper.GetString(flags.BlockstoreFlagName) if blockstore != "" { c.BlockstorePath = blockstore diff --git a/config/chain/config_test.go b/config/chain/config_test.go index b41fce20..e4e02a35 100644 --- a/config/chain/config_test.go +++ b/config/chain/config_test.go @@ -6,25 +6,25 @@ import ( func TestValidateConfig(t *testing.T) { var id uint8 = 1 - valid := GeneralChainConfig{ + valid := ChainConfig{ Name: "chain", Id: &id, Endpoint: "endpoint", } - missingEndpoint := GeneralChainConfig{ + missingEndpoint := ChainConfig{ Name: "chain", Id: &id, Endpoint: "", } - missingName := GeneralChainConfig{ + missingName := ChainConfig{ Name: "", Id: &id, Endpoint: "endpoint", } - missingId := GeneralChainConfig{ + missingId := ChainConfig{ Name: "chain", Endpoint: "endpoint", } diff --git a/config/chain/evm.go b/config/chain/evm.go deleted file mode 100644 index 382d2cc8..00000000 --- a/config/chain/evm.go +++ /dev/null @@ -1,95 +0,0 @@ -package chain - -import ( - "fmt" - "math/big" - "time" - - "github.com/creasty/defaults" - - "github.com/mitchellh/mapstructure" -) - -type EVMConfig struct { - GeneralChainConfig GeneralChainConfig - Bridge string - Erc20Handler string - Erc721Handler string - GenericHandler string - MaxGasPrice *big.Int - GasMultiplier *big.Float - GasPriceIncreaseFactor *big.Int - GasLimit *big.Int - StartBlock *big.Int - BlockConfirmations *big.Int - BlockInterval *big.Int - BlockRetryInterval time.Duration -} - -type RawEVMConfig struct { - GeneralChainConfig `mapstructure:",squash"` - Bridge string `mapstructure:"bridge"` - Erc20Handler string `mapstructure:"erc20Handler"` - Erc721Handler string `mapstructure:"erc721Handler"` - GenericHandler string `mapstructure:"genericHandler"` - MaxGasPrice int64 `mapstructure:"maxGasPrice" default:"20000000000"` - GasPriceIncreaseFactor int64 `mapstructure:"gasPriceIncreaseFactor" default:"15"` - GasMultiplier float64 `mapstructure:"gasMultiplier" default:"1"` - GasLimit int64 `mapstructure:"gasLimit" default:"2000000"` - StartBlock int64 `mapstructure:"startBlock"` - BlockConfirmations int64 `mapstructure:"blockConfirmations" default:"10"` - BlockInterval int64 `mapstructure:"blockInterval" default:"5"` - BlockRetryInterval uint64 `mapstructure:"blockRetryInterval" default:"5"` -} - -func (c *RawEVMConfig) Validate() error { - if err := c.GeneralChainConfig.Validate(); err != nil { - return err - } - if c.Bridge == "" { - return fmt.Errorf("required field chain.Bridge empty for chain %v", *c.Id) - } - if c.BlockConfirmations != 0 && c.BlockConfirmations < 1 { - return fmt.Errorf("blockConfirmations has to be >=1") - } - return nil -} - -// NewEVMConfig decodes and validates an instance of an EVMConfig from -// raw chain config -func NewEVMConfig(chainConfig map[string]interface{}) (*EVMConfig, error) { - var c RawEVMConfig - err := mapstructure.Decode(chainConfig, &c) - if err != nil { - return nil, err - } - - err = defaults.Set(&c) - if err != nil { - return nil, err - } - - err = c.Validate() - if err != nil { - return nil, err - } - - c.GeneralChainConfig.ParseFlags() - config := &EVMConfig{ - GeneralChainConfig: c.GeneralChainConfig, - Erc20Handler: c.Erc20Handler, - Erc721Handler: c.Erc721Handler, - GenericHandler: c.GenericHandler, - Bridge: c.Bridge, - BlockRetryInterval: time.Duration(c.BlockRetryInterval) * time.Second, - GasLimit: big.NewInt(c.GasLimit), - MaxGasPrice: big.NewInt(c.MaxGasPrice), - GasPriceIncreaseFactor: big.NewInt(c.GasPriceIncreaseFactor), - GasMultiplier: big.NewFloat(c.GasMultiplier), - StartBlock: big.NewInt(c.StartBlock), - BlockConfirmations: big.NewInt(c.BlockConfirmations), - BlockInterval: big.NewInt(c.BlockInterval), - } - - return config, nil -} diff --git a/config/chain/evm_test.go b/config/chain/evm_test.go deleted file mode 100644 index 0ea64136..00000000 --- a/config/chain/evm_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package chain_test - -import ( - "math/big" - "testing" - "time" - - "github.com/ChainSafe/sygma-core/config/chain" - "github.com/stretchr/testify/suite" -) - -type NewEVMConfigTestSuite struct { - suite.Suite -} - -func TestRunNewEVMConfigTestSuite(t *testing.T) { - suite.Run(t, new(NewEVMConfigTestSuite)) -} - -func (s *NewEVMConfigTestSuite) Test_FailedDecode() { - _, err := chain.NewEVMConfig(map[string]interface{}{ - "gasLimit": "invalid", - }) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_FailedGeneralConfigValidation() { - _, err := chain.NewEVMConfig(map[string]interface{}{}) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_FailedEVMConfigValidation() { - _, err := chain.NewEVMConfig(map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - }) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_InvalidBlockConfirmation() { - _, err := chain.NewEVMConfig(map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - "blockConfirmations": -1, - }) - - s.NotNil(err) - s.Equal(err.Error(), "blockConfirmations has to be >=1") -} - -func (s *NewEVMConfigTestSuite) Test_ValidConfig() { - rawConfig := map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - "blockstorePath": "./blockstore", - "latest": true, - "fresh": true, - } - - actualConfig, err := chain.NewEVMConfig(rawConfig) - - id := new(uint8) - *id = 1 - s.Nil(err) - s.Equal(*actualConfig, chain.EVMConfig{ - GeneralChainConfig: chain.GeneralChainConfig{ - Name: "evm1", - Endpoint: "ws://domain.com", - Id: id, - BlockstorePath: "./blockstore", - FreshStart: true, - LatestBlock: true, - }, - Bridge: "bridgeAddress", - Erc20Handler: "", - Erc721Handler: "", - GenericHandler: "", - GasLimit: big.NewInt(2000000), - MaxGasPrice: big.NewInt(20000000000), - GasMultiplier: big.NewFloat(1), - GasPriceIncreaseFactor: big.NewInt(15), - StartBlock: big.NewInt(0), - BlockConfirmations: big.NewInt(10), - BlockInterval: big.NewInt(5), - BlockRetryInterval: time.Duration(5) * time.Second, - }) -} - -func (s *NewEVMConfigTestSuite) Test_ValidConfigWithCustomTxParams() { - rawConfig := map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - "maxGasPrice": 1000, - "gasPriceIncreaseFactor": 20, - "gasMultiplier": 1000, - "gasLimit": 1000, - "startBlock": 1000, - "blockConfirmations": 10, - "blockRetryInterval": 10, - "blockInterval": 2, - } - - actualConfig, err := chain.NewEVMConfig(rawConfig) - - id := new(uint8) - *id = 1 - s.Nil(err) - s.Equal(*actualConfig, chain.EVMConfig{ - GeneralChainConfig: chain.GeneralChainConfig{ - Name: "evm1", - Endpoint: "ws://domain.com", - Id: id, - }, - Bridge: "bridgeAddress", - Erc20Handler: "", - Erc721Handler: "", - GenericHandler: "", - GasLimit: big.NewInt(1000), - MaxGasPrice: big.NewInt(1000), - GasPriceIncreaseFactor: big.NewInt(20), - GasMultiplier: big.NewFloat(1000), - StartBlock: big.NewInt(1000), - BlockConfirmations: big.NewInt(10), - BlockInterval: big.NewInt(2), - BlockRetryInterval: time.Duration(10) * time.Second, - }) -} diff --git a/e2e/dummy/gas-pricer.go b/e2e/dummy/gas-pricer.go deleted file mode 100644 index 208ca588..00000000 --- a/e2e/dummy/gas-pricer.go +++ /dev/null @@ -1,36 +0,0 @@ -package dummy - -import ( - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" -) - -type GasPricer interface { - GasPrice(priority *uint8) ([]*big.Int, error) -} - -type StaticGasPriceDeterminant struct { - client evmgaspricer.GasPriceClient - opts *evmgaspricer.GasPricerOpts -} - -func NewStaticGasPriceDeterminant(client evmgaspricer.GasPriceClient, opts *evmgaspricer.GasPricerOpts) *StaticGasPriceDeterminant { - return &StaticGasPriceDeterminant{client: client, opts: opts} -} - -func (gasPricer *StaticGasPriceDeterminant) GasPrice(priority *uint8) ([]*big.Int, error) { - var gasPrice []*big.Int - switch *priority { - // slow - case 0: - gasPrice = []*big.Int{big.NewInt(50000000000)} - // fast - case 2: - gasPrice = []*big.Int{big.NewInt(140000000000)} - // medium - default: - gasPrice = []*big.Int{big.NewInt(80000000000)} - } - return gasPrice, nil -} diff --git a/e2e/evm/evm_test.go b/e2e/evm/evm_test.go deleted file mode 100644 index ac8eafdb..00000000 --- a/e2e/evm/evm_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package evm_test - -import ( - "context" - "math/big" - "testing" - - "github.com/ChainSafe/chainbridge-core/chains/evm/cli/local" - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" - "github.com/ChainSafe/sygma-core/e2e/dummy" - "github.com/ChainSafe/sygma-core/e2e/evm" - substrateTypes "github.com/centrifuge/go-substrate-rpc-client/types" - "github.com/ethereum/go-ethereum/common" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/centrifuge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc20" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/erc721" - "github.com/ChainSafe/sygma-core/keystore" - - "github.com/stretchr/testify/suite" -) - -const ETHEndpoint1 = "ws://localhost:8546" -const ETHEndpoint2 = "ws://localhost:8548" - -// Alice key is used by the relayer, Eve key is used as admin and depositter -func Test_EVM2EVM(t *testing.T) { - config := evm.BridgeConfig{ - BridgeAddr: common.HexToAddress("0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66"), - - Erc20Addr: common.HexToAddress("0x75dF75bcdCa8eA2360c562b4aaDBAF3dfAf5b19b"), - Erc20HandlerAddr: common.HexToAddress("0xb83065680e6AEc805774d8545516dF4e936F0dC0"), - Erc20ResourceID: calls.SliceTo32Bytes(common.LeftPadBytes([]byte{0}, 31)), - - Erc721HandlerAddr: common.HexToAddress("0x05C5AFACf64A6082D4933752FfB447AED63581b1"), - Erc721Addr: common.HexToAddress("0xb911DF90bCccd3D76a1d8f5fDcd32471e28Cc2c1"), - Erc721ResourceID: calls.SliceTo32Bytes(common.LeftPadBytes([]byte{2}, 31)), - - GenericHandlerAddr: common.HexToAddress("0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600"), - GenericResourceID: calls.SliceTo32Bytes(common.LeftPadBytes([]byte{1}, 31)), - AssetStoreAddr: common.HexToAddress("0x3cA3808176Ad060Ad80c4e08F30d85973Ef1d99e"), - } - - ethClient1, err := evmclient.NewEVMClient(ETHEndpoint1, local.EveKp) - if err != nil { - panic(err) - } - gasPricer1 := dummy.NewStaticGasPriceDeterminant(ethClient1, nil) - - ethClient2, err := evmclient.NewEVMClient(ETHEndpoint2, local.EveKp) - if err != nil { - panic(err) - } - gasPricer2 := dummy.NewStaticGasPriceDeterminant(ethClient2, nil) - - suite.Run( - t, - NewEVM2EVMTestSuite( - evmtransaction.NewTransaction, - evmtransaction.NewTransaction, - ethClient1, - ethClient2, - gasPricer1, - gasPricer2, - config, - config, - ), - ) -} - -func NewEVM2EVMTestSuite( - fabric1, fabric2 calls.TxFabric, - client1, client2 evm.EVMClient, - gasPricer1, gasPricer2 calls.GasPricer, - config1, config2 evm.BridgeConfig, -) *EVMTestSuite { - return &EVMTestSuite{ - fabric1: fabric1, - fabric2: fabric2, - client1: client1, - client2: client2, - gasPricer1: gasPricer1, - gasPricer2: gasPricer2, - config1: config1, - config2: config2, - } -} - -type EVMTestSuite struct { - suite.Suite - client1 calls.ClientDispatcher - client2 calls.ClientDispatcher - gasPricer1 calls.GasPricer - gasPricer2 calls.GasPricer - fabric1 calls.TxFabric - fabric2 calls.TxFabric - config1 local.BridgeConfig - config2 local.BridgeConfig -} - -// SetupSuite waits until all contracts are deployed -func (s *EVMTestSuite) SetupSuite() { - err := evm.WaitUntilBridgeReady(s.client2, s.config2.BridgeAddr) - if err != nil { - panic(err) - } -} - -func (s *EVMTestSuite) Test_Erc20Deposit() { - dstAddr := keystore.TestKeyRing.EthereumKeys[keystore.BobKey].CommonAddress() - - transactor1 := signAndSend.NewSignAndSendTransactor(s.fabric1, s.gasPricer1, s.client1) - erc20Contract1 := erc20.NewERC20Contract(s.client1, s.config1.Erc20Addr, transactor1) - bridgeContract1 := bridge.NewBridgeContract(s.client1, s.config1.BridgeAddr, transactor1) - - transactor2 := signAndSend.NewSignAndSendTransactor(s.fabric2, s.gasPricer2, s.client2) - erc20Contract2 := erc20.NewERC20Contract(s.client2, s.config2.Erc20Addr, transactor2) - - senderBalBefore, err := erc20Contract1.GetBalance(local.EveKp.CommonAddress()) - s.Nil(err) - destBalanceBefore, err := erc20Contract2.GetBalance(dstAddr) - s.Nil(err) - - amountToDeposit := big.NewInt(1000000) - - depositTxHash, err := bridgeContract1.Erc20Deposit(dstAddr, amountToDeposit, s.config1.Erc20ResourceID, 2, transactor.TransactOptions{ - Priority: uint8(2), // fast - }) - s.Nil(err) - - depositTx, _, err := s.client1.TransactionByHash(context.Background(), *depositTxHash) - s.Nil(err) - // check gas price of deposit tx - 140 gwei - s.Equal(big.NewInt(140000000000), depositTx.GasPrice()) - - err = evm.WaitUntilProposalExecuted(s.client2, s.config2.BridgeAddr) - s.Nil(err) - - senderBalAfter, err := erc20Contract1.GetBalance(s.client1.From()) - s.Nil(err) - s.Equal(-1, senderBalAfter.Cmp(senderBalBefore)) - - destBalanceAfter, err := erc20Contract2.GetBalance(dstAddr) - s.Nil(err) - // Balance has increased - s.Equal(1, destBalanceAfter.Cmp(destBalanceBefore)) -} - -func (s *EVMTestSuite) Test_Erc721Deposit() { - tokenId := big.NewInt(1) - metadata := "metadata.url" - - dstAddr := keystore.TestKeyRing.EthereumKeys[keystore.BobKey].CommonAddress() - - txOptions := transactor.TransactOptions{ - Priority: uint8(2), // fast - } - - // erc721 contract for evm1 - transactor1 := signAndSend.NewSignAndSendTransactor(s.fabric1, s.gasPricer1, s.client1) - erc721Contract1 := erc721.NewErc721Contract(s.client1, s.config1.Erc721Addr, transactor1) - bridgeContract1 := bridge.NewBridgeContract(s.client1, s.config1.BridgeAddr, transactor1) - - // erc721 contract for evm2 - transactor2 := signAndSend.NewSignAndSendTransactor(s.fabric2, s.gasPricer2, s.client2) - erc721Contract2 := erc721.NewErc721Contract(s.client2, s.config2.Erc721Addr, transactor2) - - // Mint token and give approval - // This is done here so token only exists on evm1 - _, err := erc721Contract1.Mint(tokenId, metadata, s.client1.From(), txOptions) - s.Nil(err, "Mint failed") - _, err = erc721Contract1.Approve(tokenId, s.config1.Erc721HandlerAddr, txOptions) - s.Nil(err, "Approve failed") - - // Check on evm1 if initial owner is admin - initialOwner, err := erc721Contract1.Owner(tokenId) - s.Nil(err) - s.Equal(initialOwner.String(), s.client1.From().String()) - - // Check on evm2 token doesn't exist - _, err = erc721Contract2.Owner(tokenId) - s.Error(err) - - depositTxHash, err := bridgeContract1.Erc721Deposit( - tokenId, metadata, dstAddr, s.config1.Erc721ResourceID, 2, transactor.TransactOptions{}, - ) - s.Nil(err) - - depositTx, _, err := s.client1.TransactionByHash(context.Background(), *depositTxHash) - s.Nil(err) - // check gas price of deposit tx - 50 gwei (slow) - s.Equal(big.NewInt(50000000000), depositTx.GasPrice()) - - err = evm.WaitUntilProposalExecuted(s.client2, s.config2.BridgeAddr) - s.Nil(err) - - // Check on evm1 that token is burned - _, err = erc721Contract1.Owner(tokenId) - s.Error(err) - - // Check on evm2 that token is minted to destination address - owner, err := erc721Contract2.Owner(tokenId) - s.Nil(err) - s.Equal(dstAddr.String(), owner.String()) -} - -func (s *EVMTestSuite) Test_GenericDeposit() { - transactor1 := signAndSend.NewSignAndSendTransactor(s.fabric1, s.gasPricer1, s.client1) - transactor2 := signAndSend.NewSignAndSendTransactor(s.fabric2, s.gasPricer2, s.client2) - - bridgeContract1 := bridge.NewBridgeContract(s.client1, s.config1.BridgeAddr, transactor1) - assetStoreContract2 := centrifuge.NewAssetStoreContract(s.client2, s.config2.AssetStoreAddr, transactor2) - - hash, _ := substrateTypes.GetHash(substrateTypes.NewI64(int64(1))) - - depositTxHash, err := bridgeContract1.GenericDeposit(hash[:], s.config1.GenericResourceID, 2, transactor.TransactOptions{ - Priority: uint8(0), // slow - }) - s.Nil(err) - - depositTx, _, err := s.client1.TransactionByHash(context.Background(), *depositTxHash) - s.Nil(err) - // check gas price of deposit tx - 140 gwei - s.Equal(big.NewInt(50000000000), depositTx.GasPrice()) - - err = evm.WaitUntilProposalExecuted(s.client2, s.config2.BridgeAddr) - s.Nil(err) - // Asset hash sent is stored in centrifuge asset store contract - exists, err := assetStoreContract2.IsCentrifugeAssetStored(hash) - s.Nil(err) - s.Equal(true, exists) -} diff --git a/e2e/evm/util.go b/e2e/evm/util.go deleted file mode 100644 index d83a929f..00000000 --- a/e2e/evm/util.go +++ /dev/null @@ -1,207 +0,0 @@ -package evm - -import ( - "context" - "errors" - "math/big" - "strings" - "time" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmgaspricer" - "github.com/ChainSafe/sygma-core/types" - "github.com/rs/zerolog/log" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - ethereumTypes "github.com/ethereum/go-ethereum/core/types" -) - -var TestTimeout = time.Second * 600 - -type BridgeConfig struct { - BridgeAddr common.Address - - Erc20Addr common.Address - Erc20HandlerAddr common.Address - Erc20ResourceID types.ResourceID - - Erc20LockReleaseAddr common.Address - Erc20LockReleaseHandlerAddr common.Address - Erc20LockReleaseResourceID types.ResourceID - - GenericHandlerAddr common.Address - AssetStoreAddr common.Address - GenericResourceID types.ResourceID - - PermissionlessGenericHandlerAddr common.Address - PermissionlessGenericResourceID types.ResourceID - - Erc721Addr common.Address - Erc721HandlerAddr common.Address - Erc721ResourceID types.ResourceID - - BasicFeeHandlerAddr common.Address - FeeRouterAddress common.Address - FeeHandlerWithOracleAddr common.Address - BasicFee *big.Int - OracleFee uint16 -} - -type EVMClient interface { - calls.ContractCallerDispatcher - evmgaspricer.GasPriceClient - ChainID(ctx context.Context) (*big.Int, error) -} - -type Client interface { - LatestBlock() (*big.Int, error) - SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethereumTypes.Log) (ethereum.Subscription, error) - FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]ethereumTypes.Log, error) -} - -func WaitUntilProposalExecuted(client Client, bridge common.Address) error { - startBlock, _ := client.LatestBlock() - - query := ethereum.FilterQuery{ - FromBlock: startBlock, - Addresses: []common.Address{bridge}, - Topics: [][]common.Hash{ - {events.ProposalEventSig.GetTopic()}, - }, - } - timeout := time.After(TestTimeout) - ch := make(chan ethereumTypes.Log) - a, err := abi.JSON(strings.NewReader(consts.BridgeABI)) - if err != nil { - return err - } - sub, err := client.SubscribeFilterLogs(context.Background(), query, ch) - // if unable to subscribe check for the proposal execution every 5 sec - if err != nil { - ticker := time.NewTicker(5 * time.Second) - defer ticker.Stop() - for { - select { - case <-ticker.C: - endBlock, _ := client.LatestBlock() - res, err := checkProposalExecuted(client, startBlock, endBlock, bridge, a) - if err != nil { - return err - } - if res { - return nil - } - startBlock = endBlock - case <-timeout: - return errors.New("test timed out waiting for ProposalCreated event") - } - } - } - defer sub.Unsubscribe() - - for { - select { - case evt := <-ch: - out, err := a.Unpack("ProposalEvent", evt.Data) - if err != nil { - return err - } - status := abi.ConvertType(out[2], new(uint8)).(*uint8) - // Check status - if IsExecuted(*status) { - log.Info().Msgf("Got Proposal executed event status, continuing..., status: %v", *status) - return nil - } else { - log.Info().Msgf("Got Proposal event status: %v", *status) - } - case err := <-sub.Err(): - if err != nil { - return err - } - case <-timeout: - return errors.New("test timed out waiting for ProposalCreated event") - } - } -} - -type ProposalStatus int - -const ( - Inactive ProposalStatus = iota - Active - Passed - Executed - Cancelled -) - -func IsActive(status uint8) bool { - return ProposalStatus(status) == Active -} - -func IsFinalized(status uint8) bool { - return ProposalStatus(status) == Passed -} - -func IsExecuted(status uint8) bool { - return ProposalStatus(status) == Executed -} - -func checkProposalExecuted(client Client, startBlock, endBlock *big.Int, bridge common.Address, a abi.ABI) (bool, error) { - logs, err := client.FetchEventLogs(context.TODO(), bridge, string(events.ProposalEventSig), startBlock, endBlock) - if err != nil { - return false, err - } - for _, evt := range logs { - out, err := a.Unpack("ProposalEvent", evt.Data) - if err != nil { - return false, err - } - status := abi.ConvertType(out[2], new(uint8)).(*uint8) - if IsExecuted(*status) { - log.Info().Msgf("Got Proposal executed event status, continuing..., status: %v", *status) - return true, nil - } else { - log.Info().Msgf("Got Proposal event status: %v", *status) - } - } - return false, nil -} - -func WaitUntilBridgeReady(client Client, bridge common.Address) error { - startBlock, _ := client.LatestBlock() - logs, err := client.FetchEventLogs(context.Background(), bridge, string(events.ThresholdChangedSig), big.NewInt(1), startBlock) - if err != nil { - return err - } - if len(logs) > 0 { - return nil - } - - query := ethereum.FilterQuery{ - FromBlock: startBlock, - Addresses: []common.Address{bridge}, - Topics: [][]common.Hash{ - {events.ThresholdChangedSig.GetTopic()}, - }, - } - ch := make(chan ethereumTypes.Log) - sub, err := client.SubscribeFilterLogs(context.Background(), query, ch) - if err != nil { - return err - } - defer sub.Unsubscribe() - for { - select { - case <-ch: - return nil - case err := <-sub.Err(): - if err != nil { - return err - } - } - } -} diff --git a/example/Dockerfile b/example/Dockerfile deleted file mode 100644 index b04e887d..00000000 --- a/example/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2020 ChainSafe Systems -# SPDX-License-Identifier: LGPL-3.0-only - -FROM golang:1.18-stretch AS builder -ADD . /src -WORKDIR /src -RUN cd /src && echo $(ls -1 /src) -RUN go mod download -RUN go build -o /bridge ./example/ - -# final stage -FROM debian:stretch-slim -COPY --from=builder /bridge ./ -RUN chmod +x ./bridge - -ENTRYPOINT ["./bridge"] diff --git a/example/app/app.go b/example/app/app.go deleted file mode 100644 index 9981d86f..00000000 --- a/example/app/app.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package app - -import ( - "context" - "fmt" - "os" - "os/signal" - "syscall" - "time" - - "go.opentelemetry.io/otel/attribute" - - secp256k1 "github.com/ethereum/go-ethereum/crypto" - - "github.com/ChainSafe/sygma-core/chains/evm" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/bridge" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmclient" - "github.com/ChainSafe/sygma-core/chains/evm/calls/evmtransaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" - "github.com/ChainSafe/sygma-core/chains/evm/executor" - "github.com/ChainSafe/sygma-core/chains/evm/listener" - "github.com/ChainSafe/sygma-core/config" - "github.com/ChainSafe/sygma-core/config/chain" - secp256k12 "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/e2e/dummy" - "github.com/ChainSafe/sygma-core/flags" - "github.com/ChainSafe/sygma-core/lvldb" - "github.com/ChainSafe/sygma-core/opentelemetry" - "github.com/ChainSafe/sygma-core/relayer" - "github.com/ChainSafe/sygma-core/store" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - "github.com/spf13/viper" -) - -func Run() error { - configuration, err := config.GetConfig(viper.GetString(flags.ConfigFlagName)) - if err != nil { - panic(err) - } - - db, err := lvldb.NewLvlDB(viper.GetString(flags.BlockstoreFlagName)) - if err != nil { - panic(err) - } - blockstore := store.NewBlockStore(db) - - mp, err := opentelemetry.InitMetricProvider(context.Background(), configuration.RelayerConfig.OpenTelemetryCollectorURL) - if err != nil { - panic(err) - } - defer func() { - if err := mp.Shutdown(context.Background()); err != nil { - log.Error().Msgf("Error shutting down meter provider: %v", err) - } - }() - - metrics, err := opentelemetry.NewRelayerMetrics(mp.Meter("relayer-metric-provider"), attribute.String("relayerid", configuration.RelayerConfig.Id), attribute.String("env", configuration.RelayerConfig.Env)) - if err != nil { - panic(err) - } - - ctx, cancel := context.WithCancel(context.Background()) - chains := []relayer.RelayedChain{} - for _, chainConfig := range configuration.ChainConfigs { - switch chainConfig["type"] { - case "evm": - { - config, err := chain.NewEVMConfig(chainConfig) - if err != nil { - panic(err) - } - - privateKey, err := secp256k1.HexToECDSA(config.GeneralChainConfig.Key) - if err != nil { - panic(err) - } - - kp := secp256k12.NewKeypair(*privateKey) - - client, err := evmclient.NewEVMClient(config.GeneralChainConfig.Endpoint, kp) - if err != nil { - panic(err) - } - - dummyGasPricer := dummy.NewStaticGasPriceDeterminant(client, nil) - t := monitored.NewMonitoredTransactor(evmtransaction.NewTransaction, dummyGasPricer, client, config.MaxGasPrice, config.GasPriceIncreaseFactor) - go t.Monitor(ctx, time.Minute*3, time.Minute*10, time.Minute) - bridgeContract := bridge.NewBridgeContract(client, common.HexToAddress(config.Bridge), t) - - depositHandler := listener.NewETHDepositHandler(bridgeContract) - depositHandler.RegisterDepositHandler(config.Erc20Handler, listener.Erc20DepositHandler) - depositHandler.RegisterDepositHandler(config.Erc721Handler, listener.Erc721DepositHandler) - depositHandler.RegisterDepositHandler(config.GenericHandler, listener.GenericDepositHandler) - eventListener := events.NewListener(client) - eventHandlers := make([]listener.EventHandler, 0) - eventHandlers = append(eventHandlers, listener.NewDepositEventHandler(eventListener, depositHandler, common.HexToAddress(config.Bridge), *config.GeneralChainConfig.Id)) - evmListener := listener.NewEVMListener(client, eventHandlers, blockstore, metrics, *config.GeneralChainConfig.Id, config.BlockRetryInterval, config.BlockConfirmations, config.BlockInterval) - - mh := executor.NewEVMMessageHandler(bridgeContract) - mh.RegisterMessageHandler(config.Erc20Handler, executor.ERC20MessageHandler) - mh.RegisterMessageHandler(config.Erc721Handler, executor.ERC721MessageHandler) - mh.RegisterMessageHandler(config.GenericHandler, executor.GenericMessageHandler) - - var evmVoter *executor.EVMVoter - evmVoter, err = executor.NewVoterWithSubscription(mh, client, bridgeContract) - if err != nil { - log.Error().Msgf("failed creating voter with subscription: %s. Falling back to default voter.", err.Error()) - evmVoter = executor.NewVoter(mh, client, bridgeContract) - } - - chain := evm.NewEVMChain(evmListener, evmVoter, blockstore, *config.GeneralChainConfig.Id, config.StartBlock, config.GeneralChainConfig.LatestBlock, config.GeneralChainConfig.FreshStart) - - chains = append(chains, chain) - } - default: - panic(fmt.Errorf("type '%s' not recognized", chainConfig["type"])) - } - } - - r := relayer.NewRelayer( - chains, - metrics, - ) - - errChn := make(chan error) - defer cancel() - go r.Start(ctx, errChn) - - sysErr := make(chan os.Signal, 1) - signal.Notify(sysErr, - syscall.SIGTERM, - syscall.SIGINT, - syscall.SIGHUP, - syscall.SIGQUIT) - - select { - case err := <-errChn: - log.Error().Err(err).Msg("failed to listen and serve") - return err - case sig := <-sysErr: - log.Info().Msgf("terminating got ` [%v] signal", sig) - return nil - } -} diff --git a/example/cfg/config_evm-evm_1.json b/example/cfg/config_evm-evm_1.json deleted file mode 100644 index 64306000..00000000 --- a/example/cfg/config_evm-evm_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "relayer": { - "opentelemetryCollectorURL": "http://otel-collector:4318" - }, - "chains": [ - { - "id": 1, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm1", - "type": "evm", - "endpoint": "ws://evm1-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "blockInterval": 2, - "key": "000000000000000000000000000000000000000000000000000000616c696365" - }, - { - "id": 2, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm2", - "type": "evm", - "endpoint": "ws://evm2-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "blockInterval": 2, - "key": "000000000000000000000000000000000000000000000000000000616c696365" - } - ] -} diff --git a/example/cfg/config_evm-evm_2.json b/example/cfg/config_evm-evm_2.json deleted file mode 100644 index d019aae1..00000000 --- a/example/cfg/config_evm-evm_2.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "relayer": { - "opentelemetryCollectorURL": "http://otel-collector:4318" - }, - "chains": [ - { - "id": 1, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm1", - "type": "evm", - "endpoint": "ws://evm1-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "key": "0000000000000000000000000000000000000000000000000000000000626f62" - }, - { - "id": 2, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm2", - "type": "evm", - "endpoint": "ws://evm2-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "key": "0000000000000000000000000000000000000000000000000000000000626f62" - } - ] -} diff --git a/example/cfg/config_evm-evm_3.json b/example/cfg/config_evm-evm_3.json deleted file mode 100644 index e00b0605..00000000 --- a/example/cfg/config_evm-evm_3.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "relayer": { - "opentelemetryCollectorURL": "http://otel-collector:4318" - }, - "chains": [ - { - "id": 1, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm1", - "type": "evm", - "endpoint": "ws://evm1-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "key": "0000000000000000000000000000000000000000000000000000000000657665" - }, - { - "id": 2, - "from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca", - "name": "evm2", - "type": "evm", - "endpoint": "ws://evm2-1:8546", - "bridge": "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66", - "erc20Handler": "0xb83065680e6AEc805774d8545516dF4e936F0dC0", - "erc721Handler": "0x05C5AFACf64A6082D4933752FfB447AED63581b1", - "genericHandler": "0x7573B1c6de00a73e98CDac5Cd2c4a252BdC87600", - "gasLimit": 9000000, - "maxGasPrice": 20000000000, - "blockConfirmations": 2, - "key": "0000000000000000000000000000000000000000000000000000000000657665" - } - ] -} diff --git a/example/cfg/otel-collector-config.yml b/example/cfg/otel-collector-config.yml deleted file mode 100644 index 71c958c5..00000000 --- a/example/cfg/otel-collector-config.yml +++ /dev/null @@ -1,20 +0,0 @@ -receivers: - otlp: - protocols: - grpc: - http: - -exporters: - prometheus: - endpoint: 0.0.0.0:8889 - namespace: default - -extensions: - health_check: - -service: - extensions: [health_check] - pipelines: - metrics: - exporters: [prometheus] - receivers: [otlp] diff --git a/example/cmd/cmd.go b/example/cmd/cmd.go deleted file mode 100644 index 76e620fe..00000000 --- a/example/cmd/cmd.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package cmd - -import ( - "github.com/ChainSafe/sygma-core/example/app" - "github.com/ChainSafe/sygma-core/flags" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -var ( - rootCMD = &cobra.Command{ - Use: "", - } - runCMD = &cobra.Command{ - Use: "run", - Short: "Run example app", - Long: "Run example app", - RunE: func(cmd *cobra.Command, args []string) error { - if err := app.Run(); err != nil { - return err - } - return nil - }, - } -) - -func init() { - flags.BindFlags(runCMD) -} - -func Execute() { - rootCMD.AddCommand(runCMD) - if err := rootCMD.Execute(); err != nil { - log.Fatal().Err(err).Msg("failed to execute root cmd") - } -} diff --git a/example/docker-compose.yml b/example/docker-compose.yml deleted file mode 100644 index c5ed3ff9..00000000 --- a/example/docker-compose.yml +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright 2020 ChainSafe Systems -# SPDX-License-Identifier: LGPL-3.0-only -version: '3' - -services: - evm1-1: - build: - context: ./geth-build - dockerfile: Dockerfile - container_name: evm1-1 - logging: - driver: none - ports: - - "8545:8545" - - "8546:8546" - environment: - - NODEKEY=98ab333347a12cef869f92b3de44085f9e44891e513bcf1d76a99eecbcdd5e17 - - NETWORKID=1 - - MINE=true - entrypoint: "/root/entrypoint.sh" - - # SECOND CHAIN - evm2-1: - build: - context: ./geth-build - dockerfile: Dockerfile - container_name: evm2-1 - logging: - driver: none - ports: - - "8547:8545" - - "8548:8546" - environment: - - NODEKEY=98ab333347a12cef869f92b3de44085f9e44891e513bcf1d76a99eecbcdd5e17 - - NETWORKID=2 - - MINE=true - entrypoint: "/root/entrypoint.sh" - - setup: - container_name: setup - build: - context: ../. - dockerfile: ./example/Dockerfile - command: local-setup --endpoint1 ws://evm1-1:8546 --endpoint2 ws://evm2-1:8546 - depends_on: - - evm1-1 - - evm2-1 - restart: "no" - - relayer1: - container_name: relayer1 - build: - context: ../. - dockerfile: ./example/Dockerfile - command: run --config /cfg/config_evm-evm_1.json --fresh - depends_on: - - evm1-1 - - evm2-1 - volumes: - - ./cfg:/cfg - restart: always - - relayer2: - container_name: relayer2 - build: - context: ../. - dockerfile: ./example/Dockerfile - command: run --config /cfg/config_evm-evm_2.json --fresh - depends_on: - - evm1-1 - - evm2-1 - volumes: - - ./cfg:/cfg - restart: always - - relayer3: - container_name: relayer3 - build: - context: ../. - dockerfile: ./example/Dockerfile - command: run --config /cfg/config_evm-evm_3.json --fresh - depends_on: - - evm1-1 - - evm2-1 - volumes: - - ./cfg:/cfg - restart: always - - otel-collector: - container_name: otel-collector - image: otel/opentelemetry-collector - command: ["--config=/etc/otel-collector-config.yml"] - volumes: - - ./cfg/otel-collector-config.yml:/etc/otel-collector-config.yml - ports: - - "8889:8889" # Prometheus exporter metrics - -networks: - evm2: - evm1: diff --git a/example/geth-build/Dockerfile b/example/geth-build/Dockerfile deleted file mode 100644 index 0c8835df..00000000 --- a/example/geth-build/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2020 ChainSafe Systems -# SPDX-License-Identifier: LGPL-3.0-only -FROM ethereum/client-go:v1.10.8 - -WORKDIR /root - -COPY ./genesis.json . -COPY ./keystore /root/keystore -COPY entrypoint.sh . -COPY ./password.txt . - -RUN chmod +x entrypoint.sh - -ENTRYPOINT ["/root/entrypoint.sh"] \ No newline at end of file diff --git a/example/geth-build/entrypoint.sh b/example/geth-build/entrypoint.sh deleted file mode 100644 index 1b23ac3e..00000000 --- a/example/geth-build/entrypoint.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env sh -# Copyright 2020 ChainSafe Systems -# SPDX-License-Identifier: LGPL-3.0-only - -# Exit on failure -set -ex - -geth init /root/genesis.json -rm -f /root/.ethereum/keystore/* - -# If accounts are not set, set all accounts. -if [ -z $ACCOUNTS ] -then - ACCOUNTS="0xf4314cb9046bece6aa54bb9533155434d0c76909,0xff93B45308FD417dF303D6515aB04D9e89a750Ca,0x8e0a907331554AF72563Bd8D43051C2E64Be5d35,0x24962717f8fA5BA3b931bACaF9ac03924EB475a0,0x148FfB2074A9e59eD58142822b3eB3fcBffb0cd7,0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485" -fi - -# Copy requested accounts to celo keystore. -ACCOUNTS_TRIMMED=${ACCOUNTS//0x/} -ACCOUNTS_PATTERN=${ACCOUNTS_TRIMMED//,/|} -find /root/keystore | grep -iE ${ACCOUNTS_PATTERN} | xargs -i cp {} /root/.ethereum/keystore/ - -# Identify the docker container external IP. -IP=$(ip -4 -o address | \ - grep -Eo -m 1 'eth0\s+inet\s+[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}' | \ - grep -Eo '[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}') - -if [ ! -z $BOOTNODE ] -then - BOOTNODE="--bootnodes ${BOOTNODE}" -else - BOOTNODE=" " -fi -if [ ! -z $NODEKEY ]; then NODEKEY="--nodekeyhex ${NODEKEY}"; fi -if [ -z $NETWORKID ]; then NETWORKID="5"; fi - -if [ ! -z $MINE ]; -then -# MINE="--mine --miner.etherbase=0x0000000000000000000000000000000000000000 --miner.threads=1" - MINE="--mine" -else - MINE=" " -fi - -exec geth \ - --unlock ${ACCOUNTS} \ - --password /root/password.txt \ - --ws \ - --ws.port 8546 \ - --ws.origins="*" \ - --ws.addr 0.0.0.0 \ - --http \ - --http.addr 0.0.0.0\ - --http.port 8545 \ - --http.corsdomain="*" \ - --http.vhosts="*" \ - --nat=extip:${IP} \ - --networkid ${NETWORKID} \ - --allow-insecure-unlock ${MINE} ${BOOTNODE} ${NODEKEY} - -# HTTP based JSON-RPC API options: -# -#--http Enable the HTTP-RPC server -#--http.addr HTTP-RPC server listening interface (default: localhost) -#--http.port HTTP-RPC server listening port (default: 8545) -#--http.api API's offered over the HTTP-RPC interface (default: eth,net,web3) -#--http.corsdomain Comma separated list of domains from which to accept cross origin requests (browser enforced) -#--ws Enable the WS-RPC server -#--ws.addr WS-RPC server listening interface (default: localhost) -#--ws.port WS-RPC server listening port (default: 8546) -#--ws.api API's offered over the WS-RPC interface (default: eth,net,web3) -#--ws.origins Origins from which to accept websockets requests -#--ipcdisable Disable the IPC-RPC server -#--ipcapi API's offered over the IPC-RPC interface (default: admin,debug,eth,miner,net,personal,shh,txpool,web3) -#--ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it) diff --git a/example/geth-build/genesis.json b/example/geth-build/genesis.json deleted file mode 100644 index b1ea00ff..00000000 --- a/example/geth-build/genesis.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "config": { - "chainId": 422, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "berlinBlock": 0, - "londonBlock": 0, - "clique": { - "period": 7, - "epoch": 30000 - } - }, - "alloc": { - "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485": { - "balance": "100000000000000000000" - }, - "0xff93B45308FD417dF303D6515aB04D9e89a750Ca": { - "balance": "100000000000000000000" - }, - "0x8e0a907331554AF72563Bd8D43051C2E64Be5d35": { - "balance": "100000000000000000000" - }, - "0x24962717f8fA5BA3b931bACaF9ac03924EB475a0": { - "balance": "100000000000000000000" - }, - "0x148FfB2074A9e59eD58142822b3eB3fcBffb0cd7": { - "balance": "100000000000000000000" - }, - "0xf4314cb9046bece6aa54bb9533155434d0c76909": { - "balance": "100000000000000000000" - }, - "0x1c5541A79AcC662ab2D2647F3B141a3B7Cdb2Ae4": { - "balance": "100000000000000000000" - } - }, - "coinbase": "0x0000000000000000000000000000000000000000", - "difficulty": "0x1", - "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f4314cb9046bece6aa54bb9533155434d0c769090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": "0x5DB698", - "nonce": "0x0000000700001142", - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp": "0x00" -} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-03-20T21-14-07.508717834Z--f4314cb9046bece6aa54bb9533155434d0c76909 b/example/geth-build/keystore/UTC--2020-03-20T21-14-07.508717834Z--f4314cb9046bece6aa54bb9533155434d0c76909 deleted file mode 100644 index d28ef126..00000000 --- a/example/geth-build/keystore/UTC--2020-03-20T21-14-07.508717834Z--f4314cb9046bece6aa54bb9533155434d0c76909 +++ /dev/null @@ -1 +0,0 @@ -{"address":"f4314cb9046bece6aa54bb9533155434d0c76909","blspublickey":"ec0d01b5adf993cdfee480b43be638b346ca58bc7d63d2d0e8b288de24bb320c02fa254a79fecc14511dc176f4e15c012e7d1b8ea9717c82c07b76ee5d6a5ec4ba710418ae299d3bdce703351f7c465fbaeb7ba814b43d7206546051d90f1b80","crypto":{"cipher":"aes-128-ctr","ciphertext":"8d7fa638ee1a6be535ba935bc74692731d4af74a061e1731e7cdde15ef03ccec","cipherparams":{"iv":"d237dc253c39020be3f17eda348c7dc0"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"ece36023315eb6e12601968470727936b0f098ea4703e5823275a0842088e05e"},"mac":"a3b3234d36cc3d697f1926b9360a59f4b7824c40b7a64cd21c8ed54de8dfb130"},"id":"d3d08dff-f9a7-49a7-9f17-5871d0b345c5","version":3} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-04-07T13-50-35.447Z--ff93b45308fd417df303d6515ab04d9e89a750ca b/example/geth-build/keystore/UTC--2020-04-07T13-50-35.447Z--ff93b45308fd417df303d6515ab04d9e89a750ca deleted file mode 100644 index 8f413f91..00000000 --- a/example/geth-build/keystore/UTC--2020-04-07T13-50-35.447Z--ff93b45308fd417df303d6515ab04d9e89a750ca +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"id":"369ea1d8-73ac-440b-932c-0722491eb9a2","address":"ff93b45308fd417df303d6515ab04d9e89a750ca","crypto":{"ciphertext":"095e1ad5c02249880243cfba01c79297b3a58315d5819d79c5349db7e65fcb13","cipherparams":{"iv":"589cfe4b3f5c935ea4847dd233980f0a"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"f01da06f89421cdc88d7b896844ca3b0295f01208cff36f89fa2a6706d248107","n":8192,"r":8,"p":1},"mac":"60267143aa71c8124156ac2dafb5e771cb1d0a9862634c78606549418573b907"}} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-04-07T13-52-12.564Z--8e0a907331554af72563bd8d43051c2e64be5d35 b/example/geth-build/keystore/UTC--2020-04-07T13-52-12.564Z--8e0a907331554af72563bd8d43051c2e64be5d35 deleted file mode 100644 index 8f729108..00000000 --- a/example/geth-build/keystore/UTC--2020-04-07T13-52-12.564Z--8e0a907331554af72563bd8d43051c2e64be5d35 +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"id":"1bdffff9-241c-4cda-b9b1-a2afffa73a3a","address":"8e0a907331554af72563bd8d43051c2e64be5d35","crypto":{"ciphertext":"d1af2dc6976cabe7b390799c908940150315285515622c3e5332412564c57d6d","cipherparams":{"iv":"87c6ffc252c435c3b612fcca5e9a10a0"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"e85eebb3570913942908be7201003435f9541beb26668ed275a1f2a6d4bcd932","n":8192,"r":8,"p":1},"mac":"dc8e177a84ac62c8395ecda5b7680f7ad7b0278499beddaa2e8c71965477b07b"}} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-04-07T13-53-49.003Z--24962717f8fa5ba3b931bacaf9ac03924eb475a0 b/example/geth-build/keystore/UTC--2020-04-07T13-53-49.003Z--24962717f8fa5ba3b931bacaf9ac03924eb475a0 deleted file mode 100644 index afa43592..00000000 --- a/example/geth-build/keystore/UTC--2020-04-07T13-53-49.003Z--24962717f8fa5ba3b931bacaf9ac03924eb475a0 +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"id":"fca758b1-8782-4e54-9ede-96ca22931b72","address":"24962717f8fa5ba3b931bacaf9ac03924eb475a0","crypto":{"ciphertext":"5120712ba214043947befd835e3d86a38fce60c8d830f878ca1a053120d37056","cipherparams":{"iv":"71168d1cbf61b9e65ea02b5db38de7e7"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"2010ca09bebf3988fb95997279ad7d761ab0d4b8323c647470dd680bdfc2f202","n":8192,"r":8,"p":1},"mac":"920f27b77fcdaaa3c322a33e91e088a7c30f82b0e3a9bfd1072058198b367f07"}} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-04-07T13-55-20.258Z--148ffb2074a9e59ed58142822b3eb3fcbffb0cd7 b/example/geth-build/keystore/UTC--2020-04-07T13-55-20.258Z--148ffb2074a9e59ed58142822b3eb3fcbffb0cd7 deleted file mode 100644 index 810d54c7..00000000 --- a/example/geth-build/keystore/UTC--2020-04-07T13-55-20.258Z--148ffb2074a9e59ed58142822b3eb3fcbffb0cd7 +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"id":"2995e9ab-3ac6-4814-bc40-03165cf23f1b","address":"148ffb2074a9e59ed58142822b3eb3fcbffb0cd7","crypto":{"ciphertext":"c986b6930bd7814092d613c607e7f4df0758d895f6216294fc0452bb18348d91","cipherparams":{"iv":"527bb46169ca968a6821d75c845bfd3f"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"71f9c2041a9a6b5476393331ef6924335f5485cf4c175cbc33c83c685c3f4394","n":8192,"r":8,"p":1},"mac":"c10a5aaf7a34a9d08377a02a517339b3afaa4ed7e6ec9a6a70dd1bcf3b4e1fba"}} \ No newline at end of file diff --git a/example/geth-build/keystore/UTC--2020-04-07T13-56-44.768Z--4ceef6139f00f9f4535ad19640ff7a0137708485 b/example/geth-build/keystore/UTC--2020-04-07T13-56-44.768Z--4ceef6139f00f9f4535ad19640ff7a0137708485 deleted file mode 100644 index 3daa9f09..00000000 --- a/example/geth-build/keystore/UTC--2020-04-07T13-56-44.768Z--4ceef6139f00f9f4535ad19640ff7a0137708485 +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"id":"a163ef8f-b883-4474-a79f-9ecddf079683","address":"4ceef6139f00f9f4535ad19640ff7a0137708485","crypto":{"ciphertext":"fa612d9881ab9863b830daea365acaac6643469d0f02189b82fb84948f59d643","cipherparams":{"iv":"b91f79de31d0a9bdc8a0670a129efea8"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"ddb540564be1bf1546245fafafd1b952431213b4d742a9af3d4fbedc54846ae3","n":8192,"r":8,"p":1},"mac":"ffbc5fab063f361c8dfa52f91be661d08a1e9119c9a81aac83fa81af4a2f5909"}} \ No newline at end of file diff --git a/example/geth-build/password.txt b/example/geth-build/password.txt deleted file mode 100644 index d6505c6b..00000000 --- a/example/geth-build/password.txt +++ /dev/null @@ -1,6 +0,0 @@ -passwordpassword -passwordpassword -passwordpassword -passwordpassword -passwordpassword -passwordpassword \ No newline at end of file diff --git a/example/main.go b/example/main.go deleted file mode 100644 index fd1a36fb..00000000 --- a/example/main.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package main - -import ( - "github.com/ChainSafe/sygma-core/example/cmd" -) - -func main() { - cmd.Execute() -} diff --git a/types/bytes.go b/types/types.go similarity index 100% rename from types/bytes.go rename to types/types.go diff --git a/util/cli.go b/util/cli.go deleted file mode 100644 index e3cddd78..00000000 --- a/util/cli.go +++ /dev/null @@ -1,12 +0,0 @@ -package util - -import "github.com/spf13/cobra" - -func CallPersistentPreRun(cmd *cobra.Command, args []string) error { - if parent := cmd.Parent(); parent != nil { - if parent.PersistentPreRunE != nil { - return parent.PersistentPreRunE(parent, args) - } - } - return nil -} From 4a18032d1120b0d17c18b3b071423fcf6d92db7d Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 14:15:38 +0200 Subject: [PATCH 05/27] Move package from calls to separate folders --- chains/evm/calls/calls.go | 43 -------- chains/evm/calls/util.go | 74 -------------- chains/evm/calls/util_test.go | 99 ------------------- chains/evm/{calls => }/client/client.go | 0 .../evm/{calls => }/contracts/abi/bridge.go | 0 chains/evm/{calls => }/contracts/contract.go | 0 .../{calls => }/contracts/contract_test.go | 0 chains/evm/{calls => }/events/events.go | 2 - chains/evm/{calls => }/gas/gas-pricer.go | 0 chains/evm/{calls => }/gas/london.go | 0 chains/evm/{calls => }/gas/london_test.go | 0 chains/evm/{calls => }/gas/mock/gas-pricer.go | 0 chains/evm/{calls => }/gas/static.go | 0 chains/evm/{calls => }/gas/static_test.go | 0 chains/evm/{calls => }/mock/calls.go | 0 chains/evm/{calls => }/transaction/evm-tx.go | 1 + .../{calls => }/transaction/evm-tx_test.go | 5 +- .../transactor/monitored/monitored.go | 0 .../transactor/monitored/monitored_test.go | 1 + .../transactor/signAndSend/signAndSend.go | 0 .../signAndSend/signAndSend_test.go | 0 chains/evm/{calls => }/transactor/transact.go | 0 22 files changed, 5 insertions(+), 220 deletions(-) delete mode 100644 chains/evm/calls/calls.go delete mode 100644 chains/evm/calls/util.go delete mode 100644 chains/evm/calls/util_test.go rename chains/evm/{calls => }/client/client.go (100%) rename chains/evm/{calls => }/contracts/abi/bridge.go (100%) rename chains/evm/{calls => }/contracts/contract.go (100%) rename chains/evm/{calls => }/contracts/contract_test.go (100%) rename chains/evm/{calls => }/events/events.go (84%) rename chains/evm/{calls => }/gas/gas-pricer.go (100%) rename chains/evm/{calls => }/gas/london.go (100%) rename chains/evm/{calls => }/gas/london_test.go (100%) rename chains/evm/{calls => }/gas/mock/gas-pricer.go (100%) rename chains/evm/{calls => }/gas/static.go (100%) rename chains/evm/{calls => }/gas/static_test.go (100%) rename chains/evm/{calls => }/mock/calls.go (100%) rename chains/evm/{calls => }/transaction/evm-tx.go (98%) rename chains/evm/{calls => }/transaction/evm-tx_test.go (93%) rename chains/evm/{calls => }/transactor/monitored/monitored.go (100%) rename chains/evm/{calls => }/transactor/monitored/monitored_test.go (99%) rename chains/evm/{calls => }/transactor/signAndSend/signAndSend.go (100%) rename chains/evm/{calls => }/transactor/signAndSend/signAndSend_test.go (100%) rename chains/evm/{calls => }/transactor/transact.go (100%) diff --git a/chains/evm/calls/calls.go b/chains/evm/calls/calls.go deleted file mode 100644 index f41fde0b..00000000 --- a/chains/evm/calls/calls.go +++ /dev/null @@ -1,43 +0,0 @@ -package calls - -import ( - "context" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/calls/client" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (client.CommonTransaction, error) - -type ContractChecker interface { - CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) -} - -type ContractCaller interface { - CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) -} - -type GasPricer interface { - // make priority a pointer to uint8 to pass nil into all GasPrice functions (instead of magic numbers) - GasPrice(priority *uint8) ([]*big.Int, error) -} - -type ClientDispatcher interface { - TxReceipt(h common.Hash) (*types.Receipt, error) - SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) - TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) - GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error) - UnsafeNonce() (*big.Int, error) - LockNonce() - UnlockNonce() - UnsafeIncreaseNonce() error - From() common.Address -} - -type ContractCallerDispatcher interface { - ContractCaller - ClientDispatcher - ContractChecker -} diff --git a/chains/evm/calls/util.go b/chains/evm/calls/util.go deleted file mode 100644 index e6ab4224..00000000 --- a/chains/evm/calls/util.go +++ /dev/null @@ -1,74 +0,0 @@ -package calls - -import ( - "errors" - "math" - gomath "math" - "math/big" - "strings" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" -) - -func GetSolidityFunctionSig(in []byte) [4]byte { - var res [4]byte - hash := crypto.Keccak256Hash(in) - copy(res[:], hash[:]) - return res -} - -func SliceTo32Bytes(in []byte) [32]byte { - var res [32]byte - copy(res[:], in) - return res -} - -// ToCallArg is the function that converts ethereum.CallMsg into more abstract map -// This is done for matter of making EVMClient more abstract since some go-ethereum forks uses different messages types -func ToCallArg(msg ethereum.CallMsg) map[string]interface{} { - arg := map[string]interface{}{ - "from": msg.From, - "to": msg.To, - } - if len(msg.Data) > 0 { - arg["data"] = hexutil.Bytes(msg.Data) - } - if msg.Value != nil { - arg["value"] = (*hexutil.Big)(msg.Value) - } - if msg.Gas != 0 { - arg["gas"] = hexutil.Uint64(msg.Gas) - } - if msg.GasPrice != nil { - arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) - } - return arg -} - -// UserAmountToWei converts decimal user friendly representation of token amount to 'Wei' representation with provided amount of decimal places -// eg UserAmountToWei(1, 5) => 100000 -func UserAmountToWei(amount string, decimal *big.Int) (*big.Int, error) { - amountFloat, ok := big.NewFloat(0).SetString(amount) - if !ok { - return nil, errors.New("wrong amount format") - } - ethValueFloat := new(big.Float).Mul(amountFloat, big.NewFloat(math.Pow10(int(decimal.Int64())))) - ethValueFloatString := strings.Split(ethValueFloat.Text('f', int(decimal.Int64())), ".") - - i, ok := big.NewInt(0).SetString(ethValueFloatString[0], 10) - if !ok { - return nil, errors.New(ethValueFloat.Text('f', int(decimal.Int64()))) - } - - return i, nil -} - -func WeiAmountToUser(amount *big.Int, decimals *big.Int) (*big.Float, error) { - amountFloat, ok := big.NewFloat(0).SetString(amount.String()) - if !ok { - return nil, errors.New("wrong amount format") - } - return new(big.Float).Quo(amountFloat, big.NewFloat(gomath.Pow10(int(decimals.Int64())))), nil -} diff --git a/chains/evm/calls/util_test.go b/chains/evm/calls/util_test.go deleted file mode 100644 index 99f1edc2..00000000 --- a/chains/evm/calls/util_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package calls_test - -import ( - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/calls" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type GetSolidityFunctionSigTestSuite struct { - suite.Suite - gomockController *gomock.Controller -} - -func TestRunGetSolidityFunctionSigTestSuite(t *testing.T) { - suite.Run(t, new(GetSolidityFunctionSigTestSuite)) -} - -func (s *GetSolidityFunctionSigTestSuite) SetupSuite() {} -func (s *GetSolidityFunctionSigTestSuite) TearDownSuite() {} -func (s *GetSolidityFunctionSigTestSuite) SetupTest() { - s.gomockController = gomock.NewController(s.T()) -} -func (s *GetSolidityFunctionSigTestSuite) TearDownTest() {} - -func (s *GetSolidityFunctionSigTestSuite) TestReturnsValidSolidityFunctionSig() { - sig := calls.GetSolidityFunctionSig([]byte("store(bytes32)")) - - s.Equal(sig, [4]byte{0x65, 0x4c, 0xf8, 0x8c}) -} - -type UtilsTestSuite struct { - suite.Suite - mockClientDispatcher *mock_calls.MockClientDispatcher - mockgasPricer *mock_calls.MockGasPricer -} - -func TestRunUtilsTestSuite(t *testing.T) { - suite.Run(t, new(UtilsTestSuite)) -} - -func (s *UtilsTestSuite) SetupSuite() { - gomockController := gomock.NewController(s.T()) - s.mockClientDispatcher = mock_calls.NewMockClientDispatcher(gomockController) - s.mockgasPricer = mock_calls.NewMockGasPricer(gomockController) -} -func (s *UtilsTestSuite) TearDownSuite() {} -func (s *UtilsTestSuite) SetupTest() {} -func (s *UtilsTestSuite) TearDownTest() {} - -func (s *UtilsTestSuite) TestToCallArg() { - kp, err := secp256k1.GenerateKeypair() - - s.Nil(err) - address := common.HexToAddress(kp.Address()) - - msg := ethereum.CallMsg{ - From: common.Address{}, - To: &address, - Value: big.NewInt(1), - Gas: uint64(21000), - GasPrice: big.NewInt(3000), - Data: []byte("test"), - } - got := calls.ToCallArg(msg) - want := map[string]interface{}{ - "from": msg.From, - "to": msg.To, - "value": (*hexutil.Big)(msg.Value), - "gas": hexutil.Uint64(msg.Gas), - "gasPrice": (*hexutil.Big)(msg.GasPrice), - "data": hexutil.Bytes(msg.Data), - } - s.Equal(want, got) -} - -func (s *UtilsTestSuite) TestToCallArgWithEmptyMessage() { - msg := ethereum.CallMsg{} - got := calls.ToCallArg(msg) - want := map[string]interface{}{ - "from": common.HexToAddress(""), - "to": (*common.Address)(nil), - } - s.Equal(want, got) -} - -func (s *UtilsTestSuite) TestUserAmountToWei() { - wei, err := calls.UserAmountToWei("1", big.NewInt(18)) - s.Nil(err) - s.Equal(big.NewInt(1000000000000000000), wei) -} diff --git a/chains/evm/calls/client/client.go b/chains/evm/client/client.go similarity index 100% rename from chains/evm/calls/client/client.go rename to chains/evm/client/client.go diff --git a/chains/evm/calls/contracts/abi/bridge.go b/chains/evm/contracts/abi/bridge.go similarity index 100% rename from chains/evm/calls/contracts/abi/bridge.go rename to chains/evm/contracts/abi/bridge.go diff --git a/chains/evm/calls/contracts/contract.go b/chains/evm/contracts/contract.go similarity index 100% rename from chains/evm/calls/contracts/contract.go rename to chains/evm/contracts/contract.go diff --git a/chains/evm/calls/contracts/contract_test.go b/chains/evm/contracts/contract_test.go similarity index 100% rename from chains/evm/calls/contracts/contract_test.go rename to chains/evm/contracts/contract_test.go diff --git a/chains/evm/calls/events/events.go b/chains/evm/events/events.go similarity index 84% rename from chains/evm/calls/events/events.go rename to chains/evm/events/events.go index 81099c03..6cd14080 100644 --- a/chains/evm/calls/events/events.go +++ b/chains/evm/events/events.go @@ -16,8 +16,6 @@ const ( DepositSig EventSig = "Deposit(uint8,bytes32,uint64,address,bytes,bytes)" ) -// Deposit struct holds event data with all necessary parameters and a handler response -// https://github.com/ChainSafe/chainbridge-solidity/blob/develop/contracts/Bridge.sol#L47 type Deposit struct { // ID of chain deposit will be bridged to DestinationDomainID uint8 diff --git a/chains/evm/calls/gas/gas-pricer.go b/chains/evm/gas/gas-pricer.go similarity index 100% rename from chains/evm/calls/gas/gas-pricer.go rename to chains/evm/gas/gas-pricer.go diff --git a/chains/evm/calls/gas/london.go b/chains/evm/gas/london.go similarity index 100% rename from chains/evm/calls/gas/london.go rename to chains/evm/gas/london.go diff --git a/chains/evm/calls/gas/london_test.go b/chains/evm/gas/london_test.go similarity index 100% rename from chains/evm/calls/gas/london_test.go rename to chains/evm/gas/london_test.go diff --git a/chains/evm/calls/gas/mock/gas-pricer.go b/chains/evm/gas/mock/gas-pricer.go similarity index 100% rename from chains/evm/calls/gas/mock/gas-pricer.go rename to chains/evm/gas/mock/gas-pricer.go diff --git a/chains/evm/calls/gas/static.go b/chains/evm/gas/static.go similarity index 100% rename from chains/evm/calls/gas/static.go rename to chains/evm/gas/static.go diff --git a/chains/evm/calls/gas/static_test.go b/chains/evm/gas/static_test.go similarity index 100% rename from chains/evm/calls/gas/static_test.go rename to chains/evm/gas/static_test.go diff --git a/chains/evm/calls/mock/calls.go b/chains/evm/mock/calls.go similarity index 100% rename from chains/evm/calls/mock/calls.go rename to chains/evm/mock/calls.go diff --git a/chains/evm/calls/transaction/evm-tx.go b/chains/evm/transaction/evm-tx.go similarity index 98% rename from chains/evm/calls/transaction/evm-tx.go rename to chains/evm/transaction/evm-tx.go index 6ac7b0e1..b6164a6d 100644 --- a/chains/evm/calls/transaction/evm-tx.go +++ b/chains/evm/transaction/evm-tx.go @@ -4,6 +4,7 @@ import ( "context" "math/big" + "github.com/ChainSafe/sygma-core/chains/evm/calls/client" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/calls/transaction/evm-tx_test.go b/chains/evm/transaction/evm-tx_test.go similarity index 93% rename from chains/evm/calls/transaction/evm-tx_test.go rename to chains/evm/transaction/evm-tx_test.go index 6f249a9a..190073f1 100644 --- a/chains/evm/calls/transaction/evm-tx_test.go +++ b/chains/evm/transaction/evm-tx_test.go @@ -6,6 +6,7 @@ import ( gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer" mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" "github.com/ethereum/go-ethereum/core/types" @@ -38,7 +39,7 @@ func (s *EVMTxTestSuite) TearDownTest() {} func (s *EVMTxTestSuite) TestNewTransactionWithStaticGasPricer() { s.client.EXPECT().SuggestGasPrice(gomock.Any()).Return(big.NewInt(1000), nil) - txFabric := NewTransaction + txFabric := transaction.NewTransaction gasPriceClient := gaspricer.NewStaticGasPriceDeterminant(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) @@ -55,7 +56,7 @@ func (s *EVMTxTestSuite) TestNewTransactionWithStaticGasPricer() { func (s *EVMTxTestSuite) TestNewTransactionWithLondonGasPricer() { s.client.EXPECT().BaseFee().Return(big.NewInt(1000), nil) s.client.EXPECT().SuggestGasTipCap(gomock.Any()).Return(big.NewInt(1000), nil) - txFabric := NewTransaction + txFabric := transaction.NewTransaction gasPriceClient := gaspricer.NewLondonGasPriceClient(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) diff --git a/chains/evm/calls/transactor/monitored/monitored.go b/chains/evm/transactor/monitored/monitored.go similarity index 100% rename from chains/evm/calls/transactor/monitored/monitored.go rename to chains/evm/transactor/monitored/monitored.go diff --git a/chains/evm/calls/transactor/monitored/monitored_test.go b/chains/evm/transactor/monitored/monitored_test.go similarity index 99% rename from chains/evm/calls/transactor/monitored/monitored_test.go rename to chains/evm/transactor/monitored/monitored_test.go index 6c0eb7a8..3dad2225 100644 --- a/chains/evm/calls/transactor/monitored/monitored_test.go +++ b/chains/evm/transactor/monitored/monitored_test.go @@ -8,6 +8,7 @@ import ( "time" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" + "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend.go b/chains/evm/transactor/signAndSend/signAndSend.go similarity index 100% rename from chains/evm/calls/transactor/signAndSend/signAndSend.go rename to chains/evm/transactor/signAndSend/signAndSend.go diff --git a/chains/evm/calls/transactor/signAndSend/signAndSend_test.go b/chains/evm/transactor/signAndSend/signAndSend_test.go similarity index 100% rename from chains/evm/calls/transactor/signAndSend/signAndSend_test.go rename to chains/evm/transactor/signAndSend/signAndSend_test.go diff --git a/chains/evm/calls/transactor/transact.go b/chains/evm/transactor/transact.go similarity index 100% rename from chains/evm/calls/transactor/transact.go rename to chains/evm/transactor/transact.go From 33256d4b73570ba60c0567a314d422f09e29d55f Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 14:16:01 +0200 Subject: [PATCH 06/27] Fix imports --- Makefile | 10 +++++----- chains/evm/contracts/contract.go | 2 +- chains/evm/contracts/contract_test.go | 8 ++++---- chains/evm/gas/london_test.go | 2 +- chains/evm/gas/mock/gas-pricer.go | 2 +- chains/evm/gas/static_test.go | 2 +- chains/evm/listener/deposit-handler_test.go | 4 ++-- chains/evm/listener/event-handler.go | 2 +- chains/evm/listener/event-handler_test.go | 2 +- chains/evm/listener/listener_test.go | 2 +- chains/evm/listener/mock/listener.go | 2 +- chains/evm/mock/calls.go | 4 ++-- chains/evm/transaction/evm-tx.go | 2 +- chains/evm/transaction/evm-tx_test.go | 6 +++--- chains/evm/transactor/monitored/monitored.go | 2 +- chains/evm/transactor/monitored/monitored_test.go | 10 +++++----- chains/evm/transactor/signAndSend/signAndSend.go | 2 +- chains/evm/transactor/signAndSend/signAndSend_test.go | 8 ++++---- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 07402da3..7ec3e423 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,12 @@ install-subkey: cargo install --force --git https://github.com/paritytech/substrate subkey genmocks: - mockgen -destination=./chains/evm/calls/gaspricer/mock/gas-pricer.go -source=./chains/evm/calls/gaspricer/gas-pricer.go + mockgen -destination=./chains/evm/gaspricer/mock/gas-pricer.go -source=./chains/evm/gaspricer/gas-pricer.go mockgen -destination=./relayer/mock/relayer.go -source=./relayer/relayer.go - mockgen -source=chains/evm/calls/calls.go -destination=chains/evm/calls/mock/calls.go - mockgen -source=chains/evm/calls/transactor/transact.go -destination=chains/evm/calls/transactor/mock/transact.go + mockgen -source=chains/evm/calls.go -destination=chains/evm/mock/calls.go + mockgen -source=chains/evm/transactor/transact.go -destination=chains/evm/transactor/mock/transact.go mockgen -destination=chains/evm/executor/mock/voter.go github.com/ChainSafe/sygma-core/chains/evm/executor ChainClient,MessageHandler,BridgeContract - mockgen -destination=./chains/evm/calls/transactor/itx/mock/itx.go -source=./chains/evm/calls/transactor/itx/itx.go - mockgen -destination=./chains/evm/calls/transactor/itx//mock/minimalForwarder.go -source=./chains/evm/calls/transactor/itx/minimalForwarder.go + mockgen -destination=./chains/evm/transactor/itx/mock/itx.go -source=./chains/evm/transactor/itx/itx.go + mockgen -destination=./chains/evm/transactor/itx//mock/minimalForwarder.go -source=./chains/evm/transactor/itx/minimalForwarder.go mockgen -destination=chains/evm/cli/bridge/mock/vote-proposal.go -source=./chains/evm/cli/bridge/vote-proposal.go mockgen -destination=chains/evm/listener/mock/listener.go -source=./chains/evm/listener/event-handler.go diff --git a/chains/evm/contracts/contract.go b/chains/evm/contracts/contract.go index 71548c7a..da4a3558 100644 --- a/chains/evm/contracts/contract.go +++ b/chains/evm/contracts/contract.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/contracts/contract_test.go b/chains/evm/contracts/contract_test.go index aed507b1..f404d456 100644 --- a/chains/evm/contracts/contract_test.go +++ b/chains/evm/contracts/contract_test.go @@ -6,10 +6,10 @@ import ( "strings" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/calls/consts" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/consts" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" diff --git a/chains/evm/gas/london_test.go b/chains/evm/gas/london_test.go index b8ae7abd..954b412a 100644 --- a/chains/evm/gas/london_test.go +++ b/chains/evm/gas/london_test.go @@ -4,7 +4,7 @@ import ( "math/big" "testing" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" diff --git a/chains/evm/gas/mock/gas-pricer.go b/chains/evm/gas/mock/gas-pricer.go index 457eeaca..c1c004d1 100644 --- a/chains/evm/gas/mock/gas-pricer.go +++ b/chains/evm/gas/mock/gas-pricer.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/calls/gaspricer/gas-pricer.go +// Source: ./chains/evm/gaspricer/gas-pricer.go // Package mock_gaspricer is a generated GoMock package. package mock_gaspricer diff --git a/chains/evm/gas/static_test.go b/chains/evm/gas/static_test.go index 8392ea19..9d1fa1ba 100644 --- a/chains/evm/gas/static_test.go +++ b/chains/evm/gas/static_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" "github.com/golang/mock/gomock" diff --git a/chains/evm/listener/deposit-handler_test.go b/chains/evm/listener/deposit-handler_test.go index d121fd7d..e85c03e9 100644 --- a/chains/evm/listener/deposit-handler_test.go +++ b/chains/evm/listener/deposit-handler_test.go @@ -5,8 +5,8 @@ import ( "math/big" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/calls/contracts/deposit" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/contracts/deposit" + "github.com/ChainSafe/sygma-core/chains/evm/events" "github.com/ChainSafe/sygma-core/chains/evm/listener" "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go index 220dfe90..8250b42c 100644 --- a/chains/evm/listener/event-handler.go +++ b/chains/evm/listener/event-handler.go @@ -5,7 +5,7 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/events" "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/listener/event-handler_test.go b/chains/evm/listener/event-handler_test.go index 6a363345..1bb5effd 100644 --- a/chains/evm/listener/event-handler_test.go +++ b/chains/evm/listener/event-handler_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/events" "github.com/ChainSafe/sygma-core/chains/evm/listener" mock_listener "github.com/ChainSafe/sygma-core/chains/evm/listener/mock" "github.com/ChainSafe/sygma-core/relayer/message" diff --git a/chains/evm/listener/listener_test.go b/chains/evm/listener/listener_test.go index d28bbb6b..2e4aa2b4 100644 --- a/chains/evm/listener/listener_test.go +++ b/chains/evm/listener/listener_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + "github.com/ChainSafe/sygma-core/chains/evm/events" "github.com/ChainSafe/sygma-core/chains/evm/listener" "github.com/ChainSafe/sygma-core/relayer/message" diff --git a/chains/evm/listener/mock/listener.go b/chains/evm/listener/mock/listener.go index 534eece1..0f65942b 100644 --- a/chains/evm/listener/mock/listener.go +++ b/chains/evm/listener/mock/listener.go @@ -9,7 +9,7 @@ import ( big "math/big" reflect "reflect" - events "github.com/ChainSafe/sygma-core/chains/evm/calls/events" + events "github.com/ChainSafe/sygma-core/chains/evm/events" message "github.com/ChainSafe/sygma-core/relayer/message" types "github.com/ChainSafe/sygma-core/types" common "github.com/ethereum/go-ethereum/common" diff --git a/chains/evm/mock/calls.go b/chains/evm/mock/calls.go index 6173c138..34a3b29d 100644 --- a/chains/evm/mock/calls.go +++ b/chains/evm/mock/calls.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: chains/evm/calls/calls.go +// Source: chains/evm/calls.go // Package mock_calls is a generated GoMock package. package mock_calls @@ -9,7 +9,7 @@ import ( big "math/big" reflect "reflect" - evmclient "github.com/ChainSafe/sygma-core/chains/evm/calls/client" + evmclient "github.com/ChainSafe/sygma-core/chains/evm/client" common "github.com/ethereum/go-ethereum/common" types "github.com/ethereum/go-ethereum/core/types" gomock "github.com/golang/mock/gomock" diff --git a/chains/evm/transaction/evm-tx.go b/chains/evm/transaction/evm-tx.go index b6164a6d..555ece62 100644 --- a/chains/evm/transaction/evm-tx.go +++ b/chains/evm/transaction/evm-tx.go @@ -4,7 +4,7 @@ import ( "context" "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/calls/client" + "github.com/ChainSafe/sygma-core/chains/evm/client" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/transaction/evm-tx_test.go b/chains/evm/transaction/evm-tx_test.go index 190073f1..323f43b8 100644 --- a/chains/evm/transaction/evm-tx_test.go +++ b/chains/evm/transaction/evm-tx_test.go @@ -4,9 +4,9 @@ import ( "math/big" "testing" - gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/calls/gaspricer/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" + gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer" + mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ethereum/go-ethereum/core/types" diff --git a/chains/evm/transactor/monitored/monitored.go b/chains/evm/transactor/monitored/monitored.go index 716e63f0..0853ebf9 100644 --- a/chains/evm/transactor/monitored/monitored.go +++ b/chains/evm/transactor/monitored/monitored.go @@ -11,7 +11,7 @@ import ( "github.com/rs/zerolog/log" "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" ) type RawTx struct { diff --git a/chains/evm/transactor/monitored/monitored_test.go b/chains/evm/transactor/monitored/monitored_test.go index 3dad2225..894d316b 100644 --- a/chains/evm/transactor/monitored/monitored_test.go +++ b/chains/evm/transactor/monitored/monitored_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transaction" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/monitored" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transaction" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/monitored" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" diff --git a/chains/evm/transactor/signAndSend/signAndSend.go b/chains/evm/transactor/signAndSend/signAndSend.go index c365b932..20685c7e 100644 --- a/chains/evm/transactor/signAndSend/signAndSend.go +++ b/chains/evm/transactor/signAndSend/signAndSend.go @@ -5,7 +5,7 @@ import ( "math/big" "github.com/ChainSafe/sygma-core/chains/evm/calls" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/transactor/signAndSend/signAndSend_test.go b/chains/evm/transactor/signAndSend/signAndSend_test.go index bc70ce9b..0d429fa1 100644 --- a/chains/evm/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/transactor/signAndSend/signAndSend_test.go @@ -4,10 +4,10 @@ import ( "math/big" "testing" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/calls/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/mock" - "github.com/ChainSafe/sygma-core/chains/evm/calls/transactor/signAndSend" + mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transactor" + mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/signAndSend" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" From c1372a0b4b379d9566cd5b71339716e9dde1ac4a Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 14:37:56 +0200 Subject: [PATCH 07/27] Move to proposal to relayer package --- chains/evm/gas/gas-pricer.go | 8 - chains/evm/gas/static.go | 8 + chains/evm/mock/calls.go | 516 ------------------ .../transaction/{evm-tx.go => transaction.go} | 0 .../{evm-tx_test.go => transaction_test.go} | 0 relayer/proposal/proposal.go | 29 + relayer/relayer.go | 5 - 7 files changed, 37 insertions(+), 529 deletions(-) delete mode 100644 chains/evm/mock/calls.go rename chains/evm/transaction/{evm-tx.go => transaction.go} (100%) rename chains/evm/transaction/{evm-tx_test.go => transaction_test.go} (100%) create mode 100644 relayer/proposal/proposal.go diff --git a/chains/evm/gas/gas-pricer.go b/chains/evm/gas/gas-pricer.go index 4c78a0c2..48e5eab7 100644 --- a/chains/evm/gas/gas-pricer.go +++ b/chains/evm/gas/gas-pricer.go @@ -21,11 +21,3 @@ type GasPricerOpts struct { GasPriceFactor *big.Float // GasPriceFactor In static gasPricer multiplies final gasPrice. Could be for example 0.75 or 5. Args []interface{} // Args is the array of dynamic typed args that could be used for other custom GasPricer implementations } - -func multiplyGasPrice(gasEstimate *big.Int, gasMultiplier *big.Float) *big.Int { - gasEstimateFloat := new(big.Float).SetInt(gasEstimate) - result := gasEstimateFloat.Mul(gasEstimateFloat, gasMultiplier) - gasPrice := new(big.Int) - result.Int(gasPrice) - return gasPrice -} diff --git a/chains/evm/gas/static.go b/chains/evm/gas/static.go index 2fcea762..9fe4e26e 100644 --- a/chains/evm/gas/static.go +++ b/chains/evm/gas/static.go @@ -51,3 +51,11 @@ func (gasPricer *StaticGasPriceDeterminant) GasPrice(priority *uint8) ([]*big.In gasPrices[0] = gp return gasPrices, nil } + +func multiplyGasPrice(gasEstimate *big.Int, gasMultiplier *big.Float) *big.Int { + gasEstimateFloat := new(big.Float).SetInt(gasEstimate) + result := gasEstimateFloat.Mul(gasEstimateFloat, gasMultiplier) + gasPrice := new(big.Int) + result.Int(gasPrice) + return gasPrice +} diff --git a/chains/evm/mock/calls.go b/chains/evm/mock/calls.go deleted file mode 100644 index 34a3b29d..00000000 --- a/chains/evm/mock/calls.go +++ /dev/null @@ -1,516 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: chains/evm/calls.go - -// Package mock_calls is a generated GoMock package. -package mock_calls - -import ( - context "context" - big "math/big" - reflect "reflect" - - evmclient "github.com/ChainSafe/sygma-core/chains/evm/client" - common "github.com/ethereum/go-ethereum/common" - types "github.com/ethereum/go-ethereum/core/types" - gomock "github.com/golang/mock/gomock" -) - -// MockContractChecker is a mock of ContractChecker interface. -type MockContractChecker struct { - ctrl *gomock.Controller - recorder *MockContractCheckerMockRecorder -} - -// MockContractCheckerMockRecorder is the mock recorder for MockContractChecker. -type MockContractCheckerMockRecorder struct { - mock *MockContractChecker -} - -// NewMockContractChecker creates a new mock instance. -func NewMockContractChecker(ctrl *gomock.Controller) *MockContractChecker { - mock := &MockContractChecker{ctrl: ctrl} - mock.recorder = &MockContractCheckerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockContractChecker) EXPECT() *MockContractCheckerMockRecorder { - return m.recorder -} - -// CodeAt mocks base method. -func (m *MockContractChecker) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CodeAt", ctx, contract, blockNumber) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CodeAt indicates an expected call of CodeAt. -func (mr *MockContractCheckerMockRecorder) CodeAt(ctx, contract, blockNumber interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CodeAt", reflect.TypeOf((*MockContractChecker)(nil).CodeAt), ctx, contract, blockNumber) -} - -// MockContractCaller is a mock of ContractCaller interface. -type MockContractCaller struct { - ctrl *gomock.Controller - recorder *MockContractCallerMockRecorder -} - -// MockContractCallerMockRecorder is the mock recorder for MockContractCaller. -type MockContractCallerMockRecorder struct { - mock *MockContractCaller -} - -// NewMockContractCaller creates a new mock instance. -func NewMockContractCaller(ctrl *gomock.Controller) *MockContractCaller { - mock := &MockContractCaller{ctrl: ctrl} - mock.recorder = &MockContractCallerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockContractCaller) EXPECT() *MockContractCallerMockRecorder { - return m.recorder -} - -// CallContract mocks base method. -func (m *MockContractCaller) CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CallContract", ctx, callArgs, blockNumber) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CallContract indicates an expected call of CallContract. -func (mr *MockContractCallerMockRecorder) CallContract(ctx, callArgs, blockNumber interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockContractCaller)(nil).CallContract), ctx, callArgs, blockNumber) -} - -// MockGasPricer is a mock of GasPricer interface. -type MockGasPricer struct { - ctrl *gomock.Controller - recorder *MockGasPricerMockRecorder -} - -// MockGasPricerMockRecorder is the mock recorder for MockGasPricer. -type MockGasPricerMockRecorder struct { - mock *MockGasPricer -} - -// NewMockGasPricer creates a new mock instance. -func NewMockGasPricer(ctrl *gomock.Controller) *MockGasPricer { - mock := &MockGasPricer{ctrl: ctrl} - mock.recorder = &MockGasPricerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGasPricer) EXPECT() *MockGasPricerMockRecorder { - return m.recorder -} - -// GasPrice mocks base method. -func (m *MockGasPricer) GasPrice(priority *uint8) ([]*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GasPrice", priority) - ret0, _ := ret[0].([]*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GasPrice indicates an expected call of GasPrice. -func (mr *MockGasPricerMockRecorder) GasPrice(priority interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasPrice", reflect.TypeOf((*MockGasPricer)(nil).GasPrice), priority) -} - -// MockClientDispatcher is a mock of ClientDispatcher interface. -type MockClientDispatcher struct { - ctrl *gomock.Controller - recorder *MockClientDispatcherMockRecorder -} - -// MockClientDispatcherMockRecorder is the mock recorder for MockClientDispatcher. -type MockClientDispatcherMockRecorder struct { - mock *MockClientDispatcher -} - -// NewMockClientDispatcher creates a new mock instance. -func NewMockClientDispatcher(ctrl *gomock.Controller) *MockClientDispatcher { - mock := &MockClientDispatcher{ctrl: ctrl} - mock.recorder = &MockClientDispatcherMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockClientDispatcher) EXPECT() *MockClientDispatcherMockRecorder { - return m.recorder -} - -// From mocks base method. -func (m *MockClientDispatcher) From() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "From") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// From indicates an expected call of From. -func (mr *MockClientDispatcherMockRecorder) From() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "From", reflect.TypeOf((*MockClientDispatcher)(nil).From)) -} - -// GetTransactionByHash mocks base method. -func (m *MockClientDispatcher) GetTransactionByHash(h common.Hash) (*types.Transaction, bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTransactionByHash", h) - ret0, _ := ret[0].(*types.Transaction) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// GetTransactionByHash indicates an expected call of GetTransactionByHash. -func (mr *MockClientDispatcherMockRecorder) GetTransactionByHash(h interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionByHash", reflect.TypeOf((*MockClientDispatcher)(nil).GetTransactionByHash), h) -} - -// LockNonce mocks base method. -func (m *MockClientDispatcher) LockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "LockNonce") -} - -// LockNonce indicates an expected call of LockNonce. -func (mr *MockClientDispatcherMockRecorder) LockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockClientDispatcher)(nil).LockNonce)) -} - -// SignAndSendTransaction mocks base method. -func (m *MockClientDispatcher) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) - ret0, _ := ret[0].(common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SignAndSendTransaction indicates an expected call of SignAndSendTransaction. -func (mr *MockClientDispatcherMockRecorder) SignAndSendTransaction(ctx, tx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignAndSendTransaction", reflect.TypeOf((*MockClientDispatcher)(nil).SignAndSendTransaction), ctx, tx) -} - -// TransactionReceipt mocks base method. -func (m *MockClientDispatcher) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionReceipt", ctx, txHash) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionReceipt indicates an expected call of TransactionReceipt. -func (mr *MockClientDispatcherMockRecorder) TransactionReceipt(ctx, txHash interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionReceipt", reflect.TypeOf((*MockClientDispatcher)(nil).TransactionReceipt), ctx, txHash) -} - -// UnlockNonce mocks base method. -func (m *MockClientDispatcher) UnlockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UnlockNonce") -} - -// UnlockNonce indicates an expected call of UnlockNonce. -func (mr *MockClientDispatcherMockRecorder) UnlockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockClientDispatcher)(nil).UnlockNonce)) -} - -// UnsafeIncreaseNonce mocks base method. -func (m *MockClientDispatcher) UnsafeIncreaseNonce() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeIncreaseNonce") - ret0, _ := ret[0].(error) - return ret0 -} - -// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. -func (mr *MockClientDispatcherMockRecorder) UnsafeIncreaseNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockClientDispatcher)(nil).UnsafeIncreaseNonce)) -} - -// UnsafeNonce mocks base method. -func (m *MockClientDispatcher) UnsafeNonce() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeNonce") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UnsafeNonce indicates an expected call of UnsafeNonce. -func (mr *MockClientDispatcherMockRecorder) UnsafeNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockClientDispatcher)(nil).UnsafeNonce)) -} - -// WaitAndReturnTxReceipt mocks base method. -func (m *MockClientDispatcher) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WaitAndReturnTxReceipt", h) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WaitAndReturnTxReceipt indicates an expected call of WaitAndReturnTxReceipt. -func (mr *MockClientDispatcherMockRecorder) WaitAndReturnTxReceipt(h interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitAndReturnTxReceipt", reflect.TypeOf((*MockClientDispatcher)(nil).WaitAndReturnTxReceipt), h) -} - -// MockContractCallerDispatcher is a mock of ContractCallerDispatcher interface. -type MockContractCallerDispatcher struct { - ctrl *gomock.Controller - recorder *MockContractCallerDispatcherMockRecorder -} - -// MockContractCallerDispatcherMockRecorder is the mock recorder for MockContractCallerDispatcher. -type MockContractCallerDispatcherMockRecorder struct { - mock *MockContractCallerDispatcher -} - -// NewMockContractCallerDispatcher creates a new mock instance. -func NewMockContractCallerDispatcher(ctrl *gomock.Controller) *MockContractCallerDispatcher { - mock := &MockContractCallerDispatcher{ctrl: ctrl} - mock.recorder = &MockContractCallerDispatcherMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockContractCallerDispatcher) EXPECT() *MockContractCallerDispatcherMockRecorder { - return m.recorder -} - -// CallContract mocks base method. -func (m *MockContractCallerDispatcher) CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CallContract", ctx, callArgs, blockNumber) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CallContract indicates an expected call of CallContract. -func (mr *MockContractCallerDispatcherMockRecorder) CallContract(ctx, callArgs, blockNumber interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockContractCallerDispatcher)(nil).CallContract), ctx, callArgs, blockNumber) -} - -// CodeAt mocks base method. -func (m *MockContractCallerDispatcher) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CodeAt", ctx, contract, blockNumber) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CodeAt indicates an expected call of CodeAt. -func (mr *MockContractCallerDispatcherMockRecorder) CodeAt(ctx, contract, blockNumber interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CodeAt", reflect.TypeOf((*MockContractCallerDispatcher)(nil).CodeAt), ctx, contract, blockNumber) -} - -// From mocks base method. -func (m *MockContractCallerDispatcher) From() common.Address { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "From") - ret0, _ := ret[0].(common.Address) - return ret0 -} - -// From indicates an expected call of From. -func (mr *MockContractCallerDispatcherMockRecorder) From() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "From", reflect.TypeOf((*MockContractCallerDispatcher)(nil).From)) -} - -// GetTransactionByHash mocks base method. -func (m *MockContractCallerDispatcher) GetTransactionByHash(h common.Hash) (*types.Transaction, bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTransactionByHash", h) - ret0, _ := ret[0].(*types.Transaction) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// GetTransactionByHash indicates an expected call of GetTransactionByHash. -func (mr *MockContractCallerDispatcherMockRecorder) GetTransactionByHash(h interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionByHash", reflect.TypeOf((*MockContractCallerDispatcher)(nil).GetTransactionByHash), h) -} - -// LockNonce mocks base method. -func (m *MockContractCallerDispatcher) LockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "LockNonce") -} - -// LockNonce indicates an expected call of LockNonce. -func (mr *MockContractCallerDispatcherMockRecorder) LockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockContractCallerDispatcher)(nil).LockNonce)) -} - -// SignAndSendTransaction mocks base method. -func (m *MockContractCallerDispatcher) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) - ret0, _ := ret[0].(common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SignAndSendTransaction indicates an expected call of SignAndSendTransaction. -func (mr *MockContractCallerDispatcherMockRecorder) SignAndSendTransaction(ctx, tx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignAndSendTransaction", reflect.TypeOf((*MockContractCallerDispatcher)(nil).SignAndSendTransaction), ctx, tx) -} - -// TransactionReceipt mocks base method. -func (m *MockContractCallerDispatcher) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionReceipt", ctx, txHash) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionReceipt indicates an expected call of TransactionReceipt. -func (mr *MockContractCallerDispatcherMockRecorder) TransactionReceipt(ctx, txHash interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionReceipt", reflect.TypeOf((*MockContractCallerDispatcher)(nil).TransactionReceipt), ctx, txHash) -} - -// UnlockNonce mocks base method. -func (m *MockContractCallerDispatcher) UnlockNonce() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UnlockNonce") -} - -// UnlockNonce indicates an expected call of UnlockNonce. -func (mr *MockContractCallerDispatcherMockRecorder) UnlockNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockContractCallerDispatcher)(nil).UnlockNonce)) -} - -// UnsafeIncreaseNonce mocks base method. -func (m *MockContractCallerDispatcher) UnsafeIncreaseNonce() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeIncreaseNonce") - ret0, _ := ret[0].(error) - return ret0 -} - -// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. -func (mr *MockContractCallerDispatcherMockRecorder) UnsafeIncreaseNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockContractCallerDispatcher)(nil).UnsafeIncreaseNonce)) -} - -// UnsafeNonce mocks base method. -func (m *MockContractCallerDispatcher) UnsafeNonce() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnsafeNonce") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UnsafeNonce indicates an expected call of UnsafeNonce. -func (mr *MockContractCallerDispatcherMockRecorder) UnsafeNonce() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockContractCallerDispatcher)(nil).UnsafeNonce)) -} - -// WaitAndReturnTxReceipt mocks base method. -func (m *MockContractCallerDispatcher) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WaitAndReturnTxReceipt", h) - ret0, _ := ret[0].(*types.Receipt) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WaitAndReturnTxReceipt indicates an expected call of WaitAndReturnTxReceipt. -func (mr *MockContractCallerDispatcherMockRecorder) WaitAndReturnTxReceipt(h interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitAndReturnTxReceipt", reflect.TypeOf((*MockContractCallerDispatcher)(nil).WaitAndReturnTxReceipt), h) -} - -// MockSimulateCaller is a mock of SimulateCaller interface. -type MockSimulateCaller struct { - ctrl *gomock.Controller - recorder *MockSimulateCallerMockRecorder -} - -// MockSimulateCallerMockRecorder is the mock recorder for MockSimulateCaller. -type MockSimulateCallerMockRecorder struct { - mock *MockSimulateCaller -} - -// NewMockSimulateCaller creates a new mock instance. -func NewMockSimulateCaller(ctrl *gomock.Controller) *MockSimulateCaller { - mock := &MockSimulateCaller{ctrl: ctrl} - mock.recorder = &MockSimulateCallerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockSimulateCaller) EXPECT() *MockSimulateCallerMockRecorder { - return m.recorder -} - -// CallContract mocks base method. -func (m *MockSimulateCaller) CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CallContract", ctx, callArgs, blockNumber) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CallContract indicates an expected call of CallContract. -func (mr *MockSimulateCallerMockRecorder) CallContract(ctx, callArgs, blockNumber interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockSimulateCaller)(nil).CallContract), ctx, callArgs, blockNumber) -} - -// TransactionByHash mocks base method. -func (m *MockSimulateCaller) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByHash", ctx, hash) - ret0, _ := ret[0].(*types.Transaction) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// TransactionByHash indicates an expected call of TransactionByHash. -func (mr *MockSimulateCallerMockRecorder) TransactionByHash(ctx, hash interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByHash", reflect.TypeOf((*MockSimulateCaller)(nil).TransactionByHash), ctx, hash) -} diff --git a/chains/evm/transaction/evm-tx.go b/chains/evm/transaction/transaction.go similarity index 100% rename from chains/evm/transaction/evm-tx.go rename to chains/evm/transaction/transaction.go diff --git a/chains/evm/transaction/evm-tx_test.go b/chains/evm/transaction/transaction_test.go similarity index 100% rename from chains/evm/transaction/evm-tx_test.go rename to chains/evm/transaction/transaction_test.go diff --git a/relayer/proposal/proposal.go b/relayer/proposal/proposal.go new file mode 100644 index 00000000..95a422a4 --- /dev/null +++ b/relayer/proposal/proposal.go @@ -0,0 +1,29 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package chains + +import ( + "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" +) + +func NewProposal(source, destination uint8, depositNonce uint64, resourceId types.ResourceID, data []byte, metadata message.Metadata) *Proposal { + return &Proposal{ + OriginDomainID: source, + DepositNonce: depositNonce, + ResourceID: resourceId, + Destination: destination, + Data: data, + Metadata: metadata, + } +} + +type Proposal struct { + OriginDomainID uint8 + DepositNonce uint64 + ResourceID types.ResourceID + Data []byte + Destination uint8 + Metadata message.Metadata +} diff --git a/relayer/relayer.go b/relayer/relayer.go index ea7d9269..1d6447b9 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -63,12 +63,7 @@ func (r *Relayer) route(msgs []*message.Message) { return } - for _, m := range msgs { - r.metrics.TrackDepositMessage(m) - } - log.Debug().Msgf("Sending messages %+v to destination %v", msgs, destChain.DomainID()) - err := destChain.Write(msgs) if err != nil { for _, m := range msgs { From 6107e75d32efd9dce6194a48d4230599da38abbf Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 15:01:14 +0200 Subject: [PATCH 08/27] Fix all naming conflicts in code --- chains/evm/client/client.go | 22 + chains/evm/client/util.go | 28 ++ chains/evm/client/util_test.go | 59 +++ chains/evm/contracts/contract.go | 8 +- chains/evm/executor/message-handler.go | 68 +-- chains/evm/executor/message-handler_test.go | 332 -------------- chains/evm/listener/deposit-handler.go | 172 -------- chains/evm/listener/deposit-handler_test.go | 415 ------------------ chains/evm/listener/event-handler.go | 8 +- chains/evm/listener/event-handler_test.go | 10 +- chains/evm/listener/listener.go | 7 +- chains/evm/listener/listener_test.go | 209 --------- chains/evm/transaction/transaction.go | 2 + chains/evm/transactor/monitored/monitored.go | 19 +- .../evm/transactor/signAndSend/signAndSend.go | 17 +- relayer/proposal/proposal.go | 2 +- 16 files changed, 153 insertions(+), 1225 deletions(-) create mode 100644 chains/evm/client/util.go create mode 100644 chains/evm/client/util_test.go delete mode 100644 chains/evm/executor/message-handler_test.go delete mode 100644 chains/evm/listener/deposit-handler.go delete mode 100644 chains/evm/listener/deposit-handler_test.go delete mode 100644 chains/evm/listener/listener_test.go diff --git a/chains/evm/client/client.go b/chains/evm/client/client.go index 5d867454..272cdd7e 100644 --- a/chains/evm/client/client.go +++ b/chains/evm/client/client.go @@ -19,6 +19,28 @@ import ( "github.com/ethereum/go-ethereum/rpc" ) +type ContractCaller interface { + CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error) + CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) +} + +type TransactionDispatcher interface { + WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) + SignAndSendTransaction(ctx context.Context, tx CommonTransaction) (common.Hash, error) + TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) + GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error) + UnsafeNonce() (*big.Int, error) + LockNonce() + UnlockNonce() + UnsafeIncreaseNonce() error + From() common.Address +} + +type Client interface { + ContractCaller + TransactionDispatcher +} + type EVMClient struct { *ethclient.Client signer Signer diff --git a/chains/evm/client/util.go b/chains/evm/client/util.go new file mode 100644 index 00000000..36871baf --- /dev/null +++ b/chains/evm/client/util.go @@ -0,0 +1,28 @@ +package client + +import ( + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common/hexutil" +) + +// ToCallArg is the function that converts ethereum.CallMsg into more abstract map +// This is done for matter of making EVMClient more abstract since some go-ethereum forks uses different messages types +func ToCallArg(msg ethereum.CallMsg) map[string]interface{} { + arg := map[string]interface{}{ + "from": msg.From, + "to": msg.To, + } + if len(msg.Data) > 0 { + arg["data"] = hexutil.Bytes(msg.Data) + } + if msg.Value != nil { + arg["value"] = (*hexutil.Big)(msg.Value) + } + if msg.Gas != 0 { + arg["gas"] = hexutil.Uint64(msg.Gas) + } + if msg.GasPrice != nil { + arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) + } + return arg +} diff --git a/chains/evm/client/util_test.go b/chains/evm/client/util_test.go new file mode 100644 index 00000000..a622dd7e --- /dev/null +++ b/chains/evm/client/util_test.go @@ -0,0 +1,59 @@ +package client_test + +import ( + "math/big" + "testing" + + "github.com/ChainSafe/sygma-core/chains/evm/client" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/stretchr/testify/suite" +) + +type UtilsTestSuite struct { + suite.Suite +} + +func TestRunUtilsTestSuite(t *testing.T) { + suite.Run(t, new(UtilsTestSuite)) +} + +func (s *UtilsTestSuite) SetupSuite() {} + +func (s *UtilsTestSuite) TestToCallArg() { + kp, err := secp256k1.GenerateKeypair() + + s.Nil(err) + address := common.HexToAddress(kp.Address()) + + msg := ethereum.CallMsg{ + From: common.Address{}, + To: &address, + Value: big.NewInt(1), + Gas: uint64(21000), + GasPrice: big.NewInt(3000), + Data: []byte("test"), + } + got := client.ToCallArg(msg) + want := map[string]interface{}{ + "from": msg.From, + "to": msg.To, + "value": (*hexutil.Big)(msg.Value), + "gas": hexutil.Uint64(msg.Gas), + "gasPrice": (*hexutil.Big)(msg.GasPrice), + "data": hexutil.Bytes(msg.Data), + } + s.Equal(want, got) +} + +func (s *UtilsTestSuite) TestToCallArgWithEmptyMessage() { + msg := ethereum.CallMsg{} + got := client.ToCallArg(msg) + want := map[string]interface{}{ + "from": common.HexToAddress(""), + "to": (*common.Address)(nil), + } + s.Equal(want, got) +} diff --git a/chains/evm/contracts/contract.go b/chains/evm/contracts/contract.go index da4a3558..d9a78a3a 100644 --- a/chains/evm/contracts/contract.go +++ b/chains/evm/contracts/contract.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/client" "github.com/ChainSafe/sygma-core/chains/evm/transactor" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" @@ -19,7 +19,7 @@ type Contract struct { contractAddress common.Address ABI abi.ABI bytecode []byte - client calls.ContractCallerDispatcher + client client.Client transactor.Transactor } @@ -27,7 +27,7 @@ func NewContract( contractAddress common.Address, abi abi.ABI, bytecode []byte, - client calls.ContractCallerDispatcher, + client client.Client, transactor transactor.Transactor, ) Contract { return Contract{ @@ -87,7 +87,7 @@ func (c *Contract) CallContract(method string, args ...interface{}) ([]interface return nil, err } msg := ethereum.CallMsg{From: c.client.From(), To: &c.contractAddress, Data: input} - out, err := c.client.CallContract(context.TODO(), calls.ToCallArg(msg), nil) + out, err := c.client.CallContract(context.TODO(), client.ToCallArg(msg), nil) if err != nil { log.Error(). Str("contract", c.contractAddress.String()). diff --git a/chains/evm/executor/message-handler.go b/chains/evm/executor/message-handler.go index c387f823..f059cda7 100644 --- a/chains/evm/executor/message-handler.go +++ b/chains/evm/executor/message-handler.go @@ -1,13 +1,10 @@ package executor import ( - "bytes" - "errors" "fmt" - "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/executor/proposal" "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/relayer/proposal" "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" @@ -74,66 +71,3 @@ func (mh *EVMMessageHandler) RegisterMessageHandler(address string, handler Mess mh.handlers[common.HexToAddress(address)] = handler } - -func ERC20MessageHandler(m *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error) { - if len(m.Payload) != 2 { - return nil, errors.New("malformed payload. Len of payload should be 2") - } - amount, ok := m.Payload[0].([]byte) - if !ok { - return nil, errors.New("wrong payload amount format") - } - recipient, ok := m.Payload[1].([]byte) - if !ok { - return nil, errors.New("wrong payload recipient format") - } - var data []byte - data = append(data, common.LeftPadBytes(amount, 32)...) // amount (uint256) - recipientLen := big.NewInt(int64(len(recipient))).Bytes() - data = append(data, common.LeftPadBytes(recipientLen, 32)...) // length of recipient (uint256) - data = append(data, recipient...) // recipient ([]byte) - return proposal.NewProposal(m.Source, m.Destination, m.DepositNonce, m.ResourceId, data, handlerAddr, bridgeAddress, m.Metadata), nil -} - -func ERC721MessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error) { - - if len(msg.Payload) != 3 { - return nil, errors.New("malformed payload. Len of payload should be 3") - } - tokenID, ok := msg.Payload[0].([]byte) - if !ok { - return nil, errors.New("wrong payload tokenID format") - } - recipient, ok := msg.Payload[1].([]byte) - if !ok { - return nil, errors.New("wrong payload recipient format") - } - metadata, ok := msg.Payload[2].([]byte) - if !ok { - return nil, errors.New("wrong payload metadata format") - } - data := bytes.Buffer{} - data.Write(common.LeftPadBytes(tokenID, 32)) - recipientLen := big.NewInt(int64(len(recipient))).Bytes() - data.Write(common.LeftPadBytes(recipientLen, 32)) - data.Write(recipient) - metadataLen := big.NewInt(int64(len(metadata))).Bytes() - data.Write(common.LeftPadBytes(metadataLen, 32)) - data.Write(metadata) - return proposal.NewProposal(msg.Source, msg.Destination, msg.DepositNonce, msg.ResourceId, data.Bytes(), handlerAddr, bridgeAddress, msg.Metadata), nil -} - -func GenericMessageHandler(msg *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error) { - if len(msg.Payload) != 1 { - return nil, errors.New("malformed payload. Len of payload should be 1") - } - metadata, ok := msg.Payload[0].([]byte) - if !ok { - return nil, errors.New("wrong payload metadata format") - } - data := bytes.Buffer{} - metadataLen := big.NewInt(int64(len(metadata))).Bytes() - data.Write(common.LeftPadBytes(metadataLen, 32)) // length of metadata (uint256) - data.Write(metadata) - return proposal.NewProposal(msg.Source, msg.Destination, msg.DepositNonce, msg.ResourceId, data.Bytes(), handlerAddr, bridgeAddress, msg.Metadata), nil -} diff --git a/chains/evm/executor/message-handler_test.go b/chains/evm/executor/message-handler_test.go deleted file mode 100644 index bc6d29e7..00000000 --- a/chains/evm/executor/message-handler_test.go +++ /dev/null @@ -1,332 +0,0 @@ -package executor_test - -import ( - "errors" - - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/executor" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/suite" -) - -var errIncorrectERC20PayloadLen = errors.New("malformed payload. Len of payload should be 2") -var errIncorrectERC721PayloadLen = errors.New("malformed payload. Len of payload should be 3") -var errIncorrectGenericPayloadLen = errors.New("malformed payload. Len of payload should be 1") - -var errIncorrectAmount = errors.New("wrong payload amount format") -var errIncorrectRecipient = errors.New("wrong payload recipient format") -var errIncorrectTokenID = errors.New("wrong payload tokenID format") -var errIncorrectMetadata = errors.New("wrong payload metadata format") - -// ERC20 -type Erc20HandlerTestSuite struct { - suite.Suite -} - -func TestRunErc20HandlerTestSuite(t *testing.T) { - suite.Run(t, new(Erc20HandlerTestSuite)) -} - -func (s *Erc20HandlerTestSuite) SetupSuite() {} -func (s *Erc20HandlerTestSuite) TearDownSuite() {} -func (s *Erc20HandlerTestSuite) SetupTest() {} -func (s *Erc20HandlerTestSuite) TearDownTest() {} - -func (s *Erc20HandlerTestSuite) TestErc20HandleMessage() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // amount - []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107}, // recipientAddress - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC20MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(err) - s.NotNil(prop) -} - -func (s *Erc20HandlerTestSuite) TestErc20HandleMessageIncorrectDataLen() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // amount - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC20MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectERC20PayloadLen.Error()) -} - -func (s *Erc20HandlerTestSuite) TestErc20HandleMessageIncorrectAmount() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - "incorrectAmount", // amount - []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107}, // recipientAddress - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC20MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectAmount.Error()) -} - -func (s *Erc20HandlerTestSuite) TestErc20HandleMessageIncorrectRecipient() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // amount - "incorrectRecipient", // recipientAddress - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC20MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectRecipient.Error()) -} - -// ERC721 -type Erc721HandlerTestSuite struct { - suite.Suite -} - -func TestRunErc721HandlerTestSuite(t *testing.T) { - suite.Run(t, new(Erc721HandlerTestSuite)) -} - -func (s *Erc721HandlerTestSuite) SetupSuite() {} -func (s *Erc721HandlerTestSuite) TearDownSuite() {} -func (s *Erc721HandlerTestSuite) SetupTest() {} -func (s *Erc721HandlerTestSuite) TearDownTest() {} - -func (s *Erc721HandlerTestSuite) TestErc721MessageHandlerEmptyMetadata() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // tokenID - []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107}, // recipientAddress - []byte{}, // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC721MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(err) - s.NotNil(prop) -} - -func (s *Erc721HandlerTestSuite) TestErc721MessageHandlerIncorrectDataLen() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // tokenID - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC721MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectERC721PayloadLen.Error()) -} - -func (s *Erc721HandlerTestSuite) TestErc721MessageHandlerIncorrectAmount() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - "incorrectAmount", // tokenID - []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107}, // recipientAddress - []byte{}, // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC721MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectTokenID.Error()) -} - -func (s *Erc721HandlerTestSuite) TestErc721MessageHandlerIncorrectRecipient() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // amount - "incorrectRecipient", - []byte{}, // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC721MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectRecipient.Error()) -} - -func (s *Erc721HandlerTestSuite) TestErc721MessageHandlerIncorrectMetadata() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{2}, // amount - []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107}, // recipientAddress - "incorrectMetadata", // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.ERC721MessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectMetadata.Error()) -} - -// GENERIC -type GenericHandlerTestSuite struct { - suite.Suite -} - -func TestRunGenericHandlerTestSuite(t *testing.T) { - suite.Run(t, new(GenericHandlerTestSuite)) -} - -func (s *GenericHandlerTestSuite) SetupSuite() {} -func (s *GenericHandlerTestSuite) TearDownSuite() {} -func (s *GenericHandlerTestSuite) SetupTest() {} -func (s *GenericHandlerTestSuite) TearDownTest() {} -func (s *GenericHandlerTestSuite) TestGenericHandleEvent() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - []byte{}, // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.GenericMessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(err) - s.NotNil(prop) -} - -func (s *GenericHandlerTestSuite) TestGenericHandleEventIncorrectDataLen() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{}, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.GenericMessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectGenericPayloadLen.Error()) -} - -func (s *GenericHandlerTestSuite) TestGenericHandleEventIncorrectMetadata() { - message := &message.Message{ - Source: 1, - Destination: 0, - DepositNonce: 1, - ResourceId: [32]byte{0}, - Type: message.FungibleTransfer, - Payload: []interface{}{ - "incorrectMetadata", // metadata - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - prop, err := executor.GenericMessageHandler(message, common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b")) - - s.Nil(prop) - s.NotNil(err) - s.EqualError(err, errIncorrectMetadata.Error()) -} diff --git a/chains/evm/listener/deposit-handler.go b/chains/evm/listener/deposit-handler.go deleted file mode 100644 index 32f80d33..00000000 --- a/chains/evm/listener/deposit-handler.go +++ /dev/null @@ -1,172 +0,0 @@ -package listener - -import ( - "errors" - "math/big" - - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ChainSafe/sygma-core/types" - "github.com/rs/zerolog/log" - - "github.com/ethereum/go-ethereum/common" -) - -type DepositHandlers map[common.Address]DepositHandlerFunc -type DepositHandlerFunc func(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) - -type HandlerMatcher interface { - GetHandlerAddressForResourceID(resourceID types.ResourceID) (common.Address, error) -} - -type ETHDepositHandler struct { - handlerMatcher HandlerMatcher - depositHandlers DepositHandlers -} - -// NewETHDepositHandler creates an instance of ETHDepositHandler that contains -// handler functions for processing deposit events -func NewETHDepositHandler(handlerMatcher HandlerMatcher) *ETHDepositHandler { - return ÐDepositHandler{ - handlerMatcher: handlerMatcher, - depositHandlers: make(map[common.Address]DepositHandlerFunc), - } -} - -func (e *ETHDepositHandler) HandleDeposit(sourceID, destID uint8, depositNonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) { - handlerAddr, err := e.handlerMatcher.GetHandlerAddressForResourceID(resourceID) - if err != nil { - return nil, err - } - - depositHandler, err := e.matchAddressWithHandlerFunc(handlerAddr) - if err != nil { - return nil, err - } - - return depositHandler(sourceID, destID, depositNonce, resourceID, calldata, handlerResponse) -} - -// matchAddressWithHandlerFunc matches a handler address with an associated handler function -func (e *ETHDepositHandler) matchAddressWithHandlerFunc(handlerAddress common.Address) (DepositHandlerFunc, error) { - hf, ok := e.depositHandlers[handlerAddress] - if !ok { - return nil, errors.New("no corresponding deposit handler for this address exists") - } - return hf, nil -} - -// RegisterDepositHandler registers an event handler by associating a handler function to a specified address -func (e *ETHDepositHandler) RegisterDepositHandler(handlerAddress string, handler DepositHandlerFunc) { - if handlerAddress == "" { - return - } - - log.Debug().Msgf("Registered deposit handler for address %s", handlerAddress) - e.depositHandlers[common.HexToAddress(handlerAddress)] = handler -} - -// Erc20DepositHandler converts data pulled from event logs into message -// handlerResponse can be an empty slice -func Erc20DepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) { - if len(calldata) < 84 { - err := errors.New("invalid calldata length: less than 84 bytes") - return nil, err - } - - // @dev - // amount: first 32 bytes of calldata - amount := calldata[:32] - - // lenRecipientAddress: second 32 bytes of calldata [32:64] - // does not need to be derived because it is being calculated - // within ERC20MessageHandler - // https://github.com/ChainSafe/sygma-core/blob/main/chains/evm/voter/message-handler.go#L108 - - // 32-64 is recipient address length - recipientAddressLength := big.NewInt(0).SetBytes(calldata[32:64]) - - // 64 - (64 + recipient address length) is recipient address - recipientAddress := calldata[64:(64 + recipientAddressLength.Int64())] - - // if there is priority data, parse it and use it - payload := []interface{}{ - amount, - recipientAddress, - } - - // arbitrary metadata that will be most likely be used by the relayer - var metadata message.Metadata - if 64+recipientAddressLength.Int64() < int64(len(calldata)) { - priorityLength := big.NewInt(0).SetBytes(calldata[(64 + recipientAddressLength.Int64()):((64 + recipientAddressLength.Int64()) + 1)]) - - // (64 + recipient address length + 1) - ((64 + recipient address length + 1) + priority length) is priority data - priority := calldata[(64 + recipientAddressLength.Int64() + 1):((64 + recipientAddressLength.Int64()) + 1 + priorityLength.Int64())] - metadata.Priority = priority[0] - } - return message.NewMessage(sourceID, destId, nonce, resourceID, message.FungibleTransfer, payload, metadata), nil -} - -// GenericDepositHandler converts data pulled from generic deposit event logs into message -func GenericDepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) { - if len(calldata) < 32 { - err := errors.New("invalid calldata length: less than 32 bytes") - return nil, err - } - - // first 32 bytes are metadata length - metadataLen := big.NewInt(0).SetBytes(calldata[:32]) - metadata := calldata[32 : 32+metadataLen.Int64()] - payload := []interface{}{ - metadata, - } - - // generic handler has specific payload length and doesn't support arbitrary metadata - meta := message.Metadata{} - return message.NewMessage(sourceID, destId, nonce, resourceID, message.GenericTransfer, payload, meta), nil -} - -// Erc721DepositHandler converts data pulled from ERC721 deposit event logs into message -func Erc721DepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) { - if len(calldata) < 64 { - err := errors.New("invalid calldata length: less than 84 bytes") - return nil, err - } - - // first 32 bytes are tokenId - tokenId := calldata[:32] - - // 32 - 64 is recipient address length - recipientAddressLength := big.NewInt(0).SetBytes(calldata[32:64]) - - // 64 - (64 + recipient address length) is recipient address - recipientAddress := calldata[64:(64 + recipientAddressLength.Int64())] - - // (64 + recipient address length) - ((64 + recipient address length) + 32) is metadata length - metadataLength := big.NewInt(0).SetBytes( - calldata[(64 + recipientAddressLength.Int64()):((64 + recipientAddressLength.Int64()) + 32)], - ) - // ((64 + recipient address length) + 32) - ((64 + recipient address length) + 32 + metadata length) is metadata - var metadata []byte - var metadataStart int64 - if metadataLength.Cmp(big.NewInt(0)) == 1 { - metadataStart = (64 + recipientAddressLength.Int64()) + 32 - metadata = calldata[metadataStart : metadataStart+metadataLength.Int64()] - } - // arbitrary metadata that will be most likely be used by the relayer - var meta message.Metadata - - payload := []interface{}{ - tokenId, - recipientAddress, - metadata, - } - - if 64+recipientAddressLength.Int64()+32+metadataLength.Int64() < int64(len(calldata)) { - // (metadataStart + metadataLength) - (metadataStart + metadataLength + 1) is priority length - priorityLength := big.NewInt(0).SetBytes(calldata[(64 + recipientAddressLength.Int64() + 32 + metadataLength.Int64()):(64 + recipientAddressLength.Int64() + 32 + metadataLength.Int64() + 1)]) - // (metadataStart + metadataLength + 1) - (metadataStart + metadataLength + 1) + priority length) is priority data - priority := calldata[(64 + recipientAddressLength.Int64() + 32 + metadataLength.Int64() + 1):(64 + recipientAddressLength.Int64() + 32 + metadataLength.Int64() + 1 + priorityLength.Int64())] - meta.Priority = priority[0] - } - return message.NewMessage(sourceID, destId, nonce, resourceID, message.NonFungibleTransfer, payload, meta), nil -} diff --git a/chains/evm/listener/deposit-handler_test.go b/chains/evm/listener/deposit-handler_test.go deleted file mode 100644 index e85c03e9..00000000 --- a/chains/evm/listener/deposit-handler_test.go +++ /dev/null @@ -1,415 +0,0 @@ -package listener_test - -import ( - "errors" - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/contracts/deposit" - "github.com/ChainSafe/sygma-core/chains/evm/events" - "github.com/ChainSafe/sygma-core/chains/evm/listener" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/stretchr/testify/suite" -) - -var errIncorrectDataLen = errors.New("invalid calldata length: less than 84 bytes") - -type Erc20HandlerTestSuite struct { - suite.Suite -} - -func TestRunErc20HandlerTestSuite(t *testing.T) { - suite.Run(t, new(Erc20HandlerTestSuite)) -} - -func (s *Erc20HandlerTestSuite) SetupSuite() {} -func (s *Erc20HandlerTestSuite) TearDownSuite() {} -func (s *Erc20HandlerTestSuite) SetupTest() {} -func (s *Erc20HandlerTestSuite) TearDownTest() {} - -func (s *Erc20HandlerTestSuite) TestErc20HandleEvent() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - calldata := deposit.ConstructErc20DepositData(recipientByteSlice, big.NewInt(2)) - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - amountParsed := calldata[:32] - recipientAddressParsed := calldata[64:] - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.FungibleTransfer, - Payload: []interface{}{ - amountParsed, - recipientAddressParsed, - }, - } - - message, err := listener.Erc20DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - - s.Nil(err) - s.NotNil(message) - s.Equal(message, expected) -} - -func (s *Erc20HandlerTestSuite) TestErc20HandleEventWithPriority() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - calldata := deposit.ConstructErc20DepositDataWithPriority(recipientByteSlice, big.NewInt(2), uint8(1)) - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - amountParsed := calldata[:32] - // 32-64 is recipient address length - recipientAddressLength := big.NewInt(0).SetBytes(calldata[32:64]) - - // 64 - (64 + recipient address length) is recipient address - recipientAddressParsed := calldata[64:(64 + recipientAddressLength.Int64())] - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.FungibleTransfer, - Payload: []interface{}{ - amountParsed, - recipientAddressParsed, - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - message, err := listener.Erc20DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - - s.Nil(err) - s.NotNil(message) - s.Equal(message, expected) -} - -func (s *Erc20HandlerTestSuite) TestErc20HandleEventIncorrectDataLen() { - metadata := []byte("0xdeadbeef") - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 32)...) - calldata = append(calldata, metadata...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - - message, err := listener.Erc20DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - - s.Nil(message) - s.EqualError(err, errIncorrectDataLen.Error()) -} - -type Erc721HandlerTestSuite struct { - suite.Suite -} - -func TestRunErc721HandlerTestSuite(t *testing.T) { - suite.Run(t, new(Erc721HandlerTestSuite)) -} - -func (s *Erc721HandlerTestSuite) SetupSuite() {} -func (s *Erc721HandlerTestSuite) TearDownSuite() {} -func (s *Erc721HandlerTestSuite) SetupTest() {} -func (s *Erc721HandlerTestSuite) TearDownTest() {} - -func (s *Erc721HandlerTestSuite) TestErc721DepositHandlerEmptyMetadata() { - recipient := common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b") - - calldata := deposit.ConstructErc721DepositData(recipient.Bytes(), big.NewInt(2), []byte{}) - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - tokenId := calldata[:32] - recipientAddressParsed := calldata[64:84] - var metadata []byte - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.NonFungibleTransfer, - Payload: []interface{}{ - tokenId, - recipientAddressParsed, - metadata, - }, - } - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(expected, m) -} - -func (s *Erc721HandlerTestSuite) TestErc721DepositHandlerIncorrectDataLen() { - metadata := []byte("0xdeadbeef") - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 16)...) - calldata = append(calldata, metadata...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(m) - s.EqualError(err, "invalid calldata length: less than 84 bytes") -} - -func (s *Erc721HandlerTestSuite) TestErc721DepositHandler() { - recipient := common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b") - metadata := []byte("metadata.url") - - calldata := deposit.ConstructErc721DepositData(recipient.Bytes(), big.NewInt(2), metadata) - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - tokenId := calldata[:32] - recipientAddressParsed := calldata[64:84] - parsedMetadata := calldata[116:128] - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.NonFungibleTransfer, - Payload: []interface{}{ - tokenId, - recipientAddressParsed, - parsedMetadata, - }, - } - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(expected, m) -} -func (s *Erc721HandlerTestSuite) TestErc721DepositHandlerWithPriority() { - recipient := common.HexToAddress("0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b") - metadata := []byte("metadata.url") - - calldata := deposit.ConstructErc721DepositDataWithPriority(recipient.Bytes(), big.NewInt(2), metadata, uint8(1)) - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - tokenId := calldata[:32] - - // 32 - 64 is recipient address length - recipientAddressLength := big.NewInt(0).SetBytes(calldata[32:64]) - - // 64 - (64 + recipient address length) is recipient address - recipientAddressParsed := calldata[64:(64 + recipientAddressLength.Int64())] - - // (64 + recipient address length) - ((64 + recipient address length) + 32) is metadata length - metadataLength := big.NewInt(0).SetBytes( - calldata[(64 + recipientAddressLength.Int64()):((64 + recipientAddressLength.Int64()) + 32)], - ) - - metadataStart := (64 + recipientAddressLength.Int64()) + 32 - parsedMetadata := calldata[metadataStart : metadataStart+metadataLength.Int64()] - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.NonFungibleTransfer, - Payload: []interface{}{ - tokenId, - recipientAddressParsed, - parsedMetadata, - }, - Metadata: message.Metadata{ - Priority: uint8(1), - }, - } - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(expected, m) -} - -type GenericHandlerTestSuite struct { - suite.Suite -} - -func TestRunGenericHandlerTestSuite(t *testing.T) { - suite.Run(t, new(GenericHandlerTestSuite)) -} - -func (s *GenericHandlerTestSuite) SetupSuite() {} -func (s *GenericHandlerTestSuite) TearDownSuite() {} -func (s *GenericHandlerTestSuite) SetupTest() {} -func (s *GenericHandlerTestSuite) TearDownTest() {} - -func (s *GenericHandlerTestSuite) TestGenericHandleEventIncorrectDataLen() { - metadata := []byte("0xdeadbeef") - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(metadata))), 16)...) - calldata = append(calldata, metadata...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - message, err := listener.GenericDepositHandler( - sourceID, - depositLog.DestinationDomainID, - depositLog.DepositNonce, - depositLog.ResourceID, - depositLog.Data, - depositLog.HandlerResponse, - ) - - s.Nil(message) - s.EqualError(err, "invalid calldata length: less than 32 bytes") -} - -func (s *GenericHandlerTestSuite) TestGenericHandleEventEmptyMetadata() { - metadata := []byte("") - calldata := deposit.ConstructGenericDepositData(metadata) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.GenericTransfer, - Payload: []interface{}{ - metadata, - }, - } - - message, err := listener.GenericDepositHandler( - sourceID, - depositLog.DestinationDomainID, - depositLog.DepositNonce, - depositLog.ResourceID, - depositLog.Data, - depositLog.HandlerResponse, - ) - - s.Nil(err) - s.NotNil(message) - s.Equal(message, expected) -} - -func (s *GenericHandlerTestSuite) TestGenericHandleEvent() { - metadata := []byte("0xdeadbeef") - calldata := deposit.ConstructGenericDepositData(metadata) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.GenericTransfer, - Payload: []interface{}{ - metadata, - }, - } - - message, err := listener.GenericDepositHandler( - sourceID, - depositLog.DestinationDomainID, - depositLog.DepositNonce, - depositLog.ResourceID, - depositLog.Data, - depositLog.HandlerResponse, - ) - - s.Nil(err) - s.NotNil(message) - s.Equal(message, expected) -} diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go index 8250b42c..1e8c2dac 100644 --- a/chains/evm/listener/event-handler.go +++ b/chains/evm/listener/event-handler.go @@ -25,19 +25,21 @@ type DepositEventHandler struct { depositHandler DepositHandler bridgeAddress common.Address + msgChan chan []*message.Message domainID uint8 } -func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8) *DepositEventHandler { +func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8, msgChan chan []*message.Message) *DepositEventHandler { return &DepositEventHandler{ eventListener: eventListener, depositHandler: depositHandler, bridgeAddress: bridgeAddress, domainID: domainID, + msgChan: msgChan, } } -func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.Int, msgChan chan []*message.Message) error { +func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.Int) error { deposits, err := eh.eventListener.FetchDeposits(context.Background(), eh.bridgeAddress, startBlock, endBlock) if err != nil { return fmt.Errorf("unable to fetch deposit events because of: %+v", err) @@ -65,7 +67,7 @@ func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.In for _, deposits := range domainDeposits { go func(d []*message.Message) { - msgChan <- d + eh.msgChan <- d }(deposits) } diff --git a/chains/evm/listener/event-handler_test.go b/chains/evm/listener/event-handler_test.go index 1bb5effd..b04e6902 100644 --- a/chains/evm/listener/event-handler_test.go +++ b/chains/evm/listener/event-handler_test.go @@ -32,14 +32,14 @@ func (s *DepositHandlerTestSuite) SetupTest() { s.domainID = 1 s.mockEventListener = mock_listener.NewMockEventListener(ctrl) s.mockDepositHandler = mock_listener.NewMockDepositHandler(ctrl) - s.depositEventHandler = listener.NewDepositEventHandler(s.mockEventListener, s.mockDepositHandler, common.Address{}, s.domainID) + s.depositEventHandler = listener.NewDepositEventHandler(s.mockEventListener, s.mockDepositHandler, common.Address{}, s.domainID, make(chan []*message.Message)) } func (s *DepositHandlerTestSuite) Test_FetchDepositFails() { s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]*events.Deposit{}, fmt.Errorf("error")) msgChan := make(chan []*message.Message, 1) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5), msgChan) + err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) s.NotNil(err) s.Equal(len(msgChan), 0) @@ -83,7 +83,7 @@ func (s *DepositHandlerTestSuite) Test_HandleDepositFails_ExecutionContinue() { ) msgChan := make(chan []*message.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5), msgChan) + err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) @@ -130,7 +130,7 @@ func (s *DepositHandlerTestSuite) Test_HandleDepositPanis_ExecutionContinues() { ) msgChan := make(chan []*message.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5), msgChan) + err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) @@ -178,7 +178,7 @@ func (s *DepositHandlerTestSuite) Test_SuccessfulHandleDeposit() { ) msgChan := make(chan []*message.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5), msgChan) + err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) diff --git a/chains/evm/listener/listener.go b/chains/evm/listener/listener.go index 814511e9..3bde3fdb 100644 --- a/chains/evm/listener/listener.go +++ b/chains/evm/listener/listener.go @@ -8,7 +8,6 @@ import ( "math/big" "time" - "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ChainSafe/sygma-core/store" "github.com/rs/zerolog" @@ -16,7 +15,7 @@ import ( ) type EventHandler interface { - HandleEvent(startBlock *big.Int, endBlock *big.Int, msgChan chan []*message.Message) error + HandleEvents(startBlock *big.Int, endBlock *big.Int) error } type ChainClient interface { @@ -68,7 +67,7 @@ func NewEVMListener( // ListenToEvents goes block by block of a network and executes event handlers that are // configured for the listener. -func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int, msgChan chan []*message.Message, errChn chan<- error) { +func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int, errChn chan<- error) { endBlock := big.NewInt(0) for { select { @@ -96,7 +95,7 @@ func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int, m l.log.Debug().Msgf("Fetching evm events for block range %s-%s", startBlock, endBlock) for _, handler := range l.eventHandlers { - err := handler.HandleEvent(startBlock, new(big.Int).Sub(endBlock, big.NewInt(1)), msgChan) + err := handler.HandleEvents(startBlock, new(big.Int).Sub(endBlock, big.NewInt(1))) if err != nil { l.log.Error().Err(err).Msgf("Unable to handle events") continue diff --git a/chains/evm/listener/listener_test.go b/chains/evm/listener/listener_test.go deleted file mode 100644 index 2e4aa2b4..00000000 --- a/chains/evm/listener/listener_test.go +++ /dev/null @@ -1,209 +0,0 @@ -package listener_test - -import ( - "errors" - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/events" - "github.com/ChainSafe/sygma-core/chains/evm/listener" - "github.com/ChainSafe/sygma-core/relayer/message" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/stretchr/testify/suite" -) - -var errIncorrectCalldataLen = errors.New("invalid calldata length: less than 84 bytes") - -type ListenerTestSuite struct { - suite.Suite -} - -func TestRunTestSuite(t *testing.T) { - suite.Run(t, new(ListenerTestSuite)) -} - -func (s *ListenerTestSuite) TestErc20HandleEvent() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - // construct ERC20 deposit data - // follows behavior of solidity tests - // https://github.com/ChainSafe/chainbridge-solidity/blob/develop/test/contractBridge/depositERC20.js#L46-L50 - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(2), 32)...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(recipientByteSlice))), 32)...) - calldata = append(calldata, recipientByteSlice...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - amountParsed := calldata[:32] - recipientAddressParsed := calldata[64:] - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.FungibleTransfer, - Payload: []interface{}{ - amountParsed, - recipientAddressParsed, - }, - } - - m, err := listener.Erc20DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(m, expected) -} - -func (s *ListenerTestSuite) TestErc20HandleEventIncorrectCalldataLen() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - // construct ERC20 deposit data - // follows behavior of solidity tests - // https://github.com/ChainSafe/chainbridge-solidity/blob/develop/test/contractBridge/depositERC20.js#L46-L50 - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(2), 16)...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(recipientByteSlice))), 16)...) - calldata = append(calldata, recipientByteSlice...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - - m, err := listener.Erc20DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(m) - s.EqualError(err, errIncorrectCalldataLen.Error()) -} - -func (s *ListenerTestSuite) TestErc721HandleEvent_WithMetadata_Sucess() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - metadataByteSlice := []byte{132, 121, 165, 51, 119, 4, 194, 218, 249, 250, 250, 212, 173, 9, 147, 218, 249, 250, 250, 4, 194, 218, 132, 121, 194, 218, 132, 121, 194, 218, 132, 121} - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(2), 32)...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(recipientByteSlice))), 32)...) - calldata = append(calldata, recipientByteSlice...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(metadataByteSlice))), 32)...) - calldata = append(calldata, metadataByteSlice...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - tokenIdParsed := calldata[:32] - recipientAddressParsed := calldata[64:84] - metadataParsed := calldata[116:] - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.NonFungibleTransfer, - Payload: []interface{}{ - tokenIdParsed, - recipientAddressParsed, - metadataParsed, - }, - } - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(expected, m) -} - -func (s *ListenerTestSuite) TestErc721HandleEvent_WithoutMetadata_Success() { - // 0xf1e58fb17704c2da8479a533f9fad4ad0993ca6b - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194, 218, 132, 121, 165, 51, 249, 250, 212, 173, 9, 147, 202, 107} - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(2), 32)...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(recipientByteSlice))), 32)...) - calldata = append(calldata, recipientByteSlice...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(0)), 32)...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - tokenIdParsed := calldata[:32] - recipientAddressParsed := calldata[64:84] - var metadataParsed []byte - - expected := &message.Message{ - Source: sourceID, - Destination: depositLog.DestinationDomainID, - DepositNonce: depositLog.DepositNonce, - ResourceId: depositLog.ResourceID, - Type: message.NonFungibleTransfer, - Payload: []interface{}{ - tokenIdParsed, - recipientAddressParsed, - metadataParsed, - }, - } - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(err) - s.NotNil(m) - s.Equal(expected, m) -} - -func (s *ListenerTestSuite) TestErc721HandleEvent_IncorrectCalldataLen_Failure() { - recipientByteSlice := []byte{241, 229, 143, 177, 119, 4, 194} - - var calldata []byte - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(2), 32)...) - calldata = append(calldata, math.PaddedBigBytes(big.NewInt(int64(len(recipientByteSlice))), 16)...) - calldata = append(calldata, recipientByteSlice...) - - depositLog := &events.Deposit{ - DestinationDomainID: 0, - ResourceID: [32]byte{0}, - DepositNonce: 1, - SenderAddress: common.HexToAddress("0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485"), - Data: calldata, - HandlerResponse: []byte{}, - } - - sourceID := uint8(1) - - m, err := listener.Erc721DepositHandler(sourceID, depositLog.DestinationDomainID, depositLog.DepositNonce, depositLog.ResourceID, depositLog.Data, depositLog.HandlerResponse) - s.Nil(m) - s.EqualError(err, errIncorrectCalldataLen.Error()) -} diff --git a/chains/evm/transaction/transaction.go b/chains/evm/transaction/transaction.go index 555ece62..a97d5e2d 100644 --- a/chains/evm/transaction/transaction.go +++ b/chains/evm/transaction/transaction.go @@ -10,6 +10,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" ) +type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (client.CommonTransaction, error) + type TX struct { tx *types.Transaction } diff --git a/chains/evm/transactor/monitored/monitored.go b/chains/evm/transactor/monitored/monitored.go index 0853ebf9..70a67d50 100644 --- a/chains/evm/transactor/monitored/monitored.go +++ b/chains/evm/transactor/monitored/monitored.go @@ -10,10 +10,15 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog/log" - "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/client" + "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" ) +type GasPricer interface { + GasPrice(priority *uint8) ([]*big.Int, error) +} + type RawTx struct { nonce uint64 to *common.Address @@ -26,9 +31,9 @@ type RawTx struct { } type MonitoredTransactor struct { - txFabric calls.TxFabric - gasPriceClient calls.GasPricer - client calls.ClientDispatcher + txFabric transaction.TxFabric + gasPriceClient GasPricer + client client.Client maxGasPrice *big.Int increasePercentage *big.Int @@ -44,9 +49,9 @@ type MonitoredTransactor struct { // Gas price is increased by increasePercentage param which // is a percentage value with which old gas price should be increased (e.g 15) func NewMonitoredTransactor( - txFabric calls.TxFabric, - gasPriceClient calls.GasPricer, - client calls.ClientDispatcher, + txFabric transaction.TxFabric, + gasPriceClient GasPricer, + client client.Client, maxGasPrice *big.Int, increasePercentage *big.Int, ) *MonitoredTransactor { diff --git a/chains/evm/transactor/signAndSend/signAndSend.go b/chains/evm/transactor/signAndSend/signAndSend.go index 20685c7e..6ab68098 100644 --- a/chains/evm/transactor/signAndSend/signAndSend.go +++ b/chains/evm/transactor/signAndSend/signAndSend.go @@ -4,19 +4,24 @@ import ( "context" "math/big" - "github.com/ChainSafe/sygma-core/chains/evm/calls" + "github.com/ChainSafe/sygma-core/chains/evm/client" + "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) +type GasPricer interface { + GasPrice(priority *uint8) ([]*big.Int, error) +} + type signAndSendTransactor struct { - TxFabric calls.TxFabric - gasPriceClient calls.GasPricer - client calls.ClientDispatcher + TxFabric transaction.TxFabric + gasPriceClient GasPricer + client client.Client } -func NewSignAndSendTransactor(txFabric calls.TxFabric, gasPriceClient calls.GasPricer, client calls.ClientDispatcher) transactor.Transactor { +func NewSignAndSendTransactor(txFabric transaction.TxFabric, gasPriceClient GasPricer, client client.Client) transactor.Transactor { return &signAndSendTransactor{ TxFabric: txFabric, gasPriceClient: gasPriceClient, @@ -66,7 +71,7 @@ func (t *signAndSendTransactor) Transact(to *common.Address, data []byte, opts t return &common.Hash{}, err } - _, err = t.client.TxReceipt(h) + _, err = t.client.WaitAndReturnTxReceipt(h) if err != nil { return &common.Hash{}, err } diff --git a/relayer/proposal/proposal.go b/relayer/proposal/proposal.go index 95a422a4..ab50f108 100644 --- a/relayer/proposal/proposal.go +++ b/relayer/proposal/proposal.go @@ -1,7 +1,7 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -package chains +package proposal import ( "github.com/ChainSafe/sygma-core/relayer/message" From ccada0be3fcf4020a5c210b4c5fdc2689ee3bceb Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 15:40:39 +0200 Subject: [PATCH 09/27] Move generic types to types package --- chains/evm/chain.go | 12 +- chains/evm/executor/message-handler.go | 6 +- chains/evm/listener/event-handler.go | 11 +- chains/evm/listener/event-handler_test.go | 27 ++-- chains/evm/listener/mock/listener.go | 4 +- .../transactor/monitored/monitored_test.go | 2 +- .../signAndSend/signAndSend_test.go | 3 +- opentelemetry/metrics.go | 10 +- relayer/mock/relayer.go | 135 ------------------ relayer/relayer.go | 16 +-- relayer/relayer_test.go | 10 +- {relayer/message => types}/message.go | 7 +- {relayer/proposal => types}/proposal.go | 9 +- 13 files changed, 54 insertions(+), 198 deletions(-) delete mode 100644 relayer/mock/relayer.go rename {relayer/message => types}/message.go (92%) rename {relayer/proposal => types}/proposal.go (73%) diff --git a/chains/evm/chain.go b/chains/evm/chain.go index 7d201ee0..45a9ff08 100644 --- a/chains/evm/chain.go +++ b/chains/evm/chain.go @@ -8,17 +8,17 @@ import ( "fmt" "math/big" - "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ChainSafe/sygma-core/store" + "github.com/ChainSafe/sygma-core/types" "github.com/rs/zerolog/log" ) type EventListener interface { - ListenToEvents(ctx context.Context, startBlock *big.Int, msgChan chan []*message.Message, errChan chan<- error) + ListenToEvents(ctx context.Context, startBlock *big.Int, msgChan chan []*types.Message, errChan chan<- error) } type ProposalExecutor interface { - Execute(message *message.Message) error + Execute(message *types.Message) error } // EVMChain is struct that aggregates all data required for @@ -47,7 +47,7 @@ func NewEVMChain(listener EventListener, writer ProposalExecutor, blockstore *st // PollEvents is the goroutine that polls blocks and searches Deposit events in them. // Events are then sent to eventsChan. -func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*message.Message) { +func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*types.Message) { log.Info().Msg("Polling Blocks...") startBlock, err := c.blockstore.GetStartBlock( @@ -64,9 +64,9 @@ func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan go c.listener.ListenToEvents(ctx, startBlock, msgChan, sysErr) } -func (c *EVMChain) Write(msg []*message.Message) error { +func (c *EVMChain) Write(msg []*types.Message) error { for _, msg := range msg { - go func(msg *message.Message) { + go func(msg *types.Message) { err := c.writer.Execute(msg) if err != nil { log.Err(err).Msgf("Failed writing message %v", msg) diff --git a/chains/evm/executor/message-handler.go b/chains/evm/executor/message-handler.go index f059cda7..6803a945 100644 --- a/chains/evm/executor/message-handler.go +++ b/chains/evm/executor/message-handler.go @@ -3,8 +3,6 @@ package executor import ( "fmt" - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ChainSafe/sygma-core/relayer/proposal" "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" @@ -15,7 +13,7 @@ type HandlerMatcher interface { ContractAddress() *common.Address } -type MessageHandlerFunc func(m *message.Message, handlerAddr, bridgeAddress common.Address) (*proposal.Proposal, error) +type MessageHandlerFunc func(m *types.Message, handlerAddr, bridgeAddress common.Address) (*types.Proposal, error) // NewEVMMessageHandler creates an instance of EVMMessageHandler that contains // message handler functions for converting deposit message into a chain specific @@ -31,7 +29,7 @@ type EVMMessageHandler struct { handlers map[common.Address]MessageHandlerFunc } -func (mh *EVMMessageHandler) HandleMessage(m *message.Message) (*proposal.Proposal, error) { +func (mh *EVMMessageHandler) HandleMessage(m *types.Message) (*types.Proposal, error) { // Matching resource ID with handler. addr, err := mh.handlerMatcher.GetHandlerAddressForResourceID(m.ResourceId) if err != nil { diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go index 1e8c2dac..bd035fbb 100644 --- a/chains/evm/listener/event-handler.go +++ b/chains/evm/listener/event-handler.go @@ -6,7 +6,6 @@ import ( "math/big" "github.com/ChainSafe/sygma-core/chains/evm/events" - "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" @@ -17,7 +16,7 @@ type EventListener interface { } type DepositHandler interface { - HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) + HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*types.Message, error) } type DepositEventHandler struct { @@ -25,11 +24,11 @@ type DepositEventHandler struct { depositHandler DepositHandler bridgeAddress common.Address - msgChan chan []*message.Message + msgChan chan []*types.Message domainID uint8 } -func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8, msgChan chan []*message.Message) *DepositEventHandler { +func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8, msgChan chan []*types.Message) *DepositEventHandler { return &DepositEventHandler{ eventListener: eventListener, depositHandler: depositHandler, @@ -45,7 +44,7 @@ func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.In return fmt.Errorf("unable to fetch deposit events because of: %+v", err) } - domainDeposits := make(map[uint8][]*message.Message) + domainDeposits := make(map[uint8][]*types.Message) for _, d := range deposits { func(d *events.Deposit) { defer func() { @@ -66,7 +65,7 @@ func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.In } for _, deposits := range domainDeposits { - go func(d []*message.Message) { + go func(d []*types.Message) { eh.msgChan <- d }(deposits) } diff --git a/chains/evm/listener/event-handler_test.go b/chains/evm/listener/event-handler_test.go index b04e6902..94b276fe 100644 --- a/chains/evm/listener/event-handler_test.go +++ b/chains/evm/listener/event-handler_test.go @@ -8,7 +8,6 @@ import ( "github.com/ChainSafe/sygma-core/chains/evm/events" "github.com/ChainSafe/sygma-core/chains/evm/listener" mock_listener "github.com/ChainSafe/sygma-core/chains/evm/listener/mock" - "github.com/ChainSafe/sygma-core/relayer/message" "github.com/ChainSafe/sygma-core/types" "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" @@ -32,13 +31,13 @@ func (s *DepositHandlerTestSuite) SetupTest() { s.domainID = 1 s.mockEventListener = mock_listener.NewMockEventListener(ctrl) s.mockDepositHandler = mock_listener.NewMockDepositHandler(ctrl) - s.depositEventHandler = listener.NewDepositEventHandler(s.mockEventListener, s.mockDepositHandler, common.Address{}, s.domainID, make(chan []*message.Message)) + s.depositEventHandler = listener.NewDepositEventHandler(s.mockEventListener, s.mockDepositHandler, common.Address{}, s.domainID, make(chan []*types.Message)) } func (s *DepositHandlerTestSuite) Test_FetchDepositFails() { s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]*events.Deposit{}, fmt.Errorf("error")) - msgChan := make(chan []*message.Message, 1) + msgChan := make(chan []*types.Message, 1) err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) s.NotNil(err) @@ -69,7 +68,7 @@ func (s *DepositHandlerTestSuite) Test_HandleDepositFails_ExecutionContinue() { d1.ResourceID, d1.Data, d1.HandlerResponse, - ).Return(&message.Message{}, fmt.Errorf("error")) + ).Return(&types.Message{}, fmt.Errorf("error")) s.mockDepositHandler.EXPECT().HandleDeposit( s.domainID, d2.DestinationDomainID, @@ -78,16 +77,16 @@ func (s *DepositHandlerTestSuite) Test_HandleDepositFails_ExecutionContinue() { d2.Data, d2.HandlerResponse, ).Return( - &message.Message{DepositNonce: 2}, + &types.Message{DepositNonce: 2}, nil, ) - msgChan := make(chan []*message.Message, 2) + msgChan := make(chan []*types.Message, 2) err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) - s.Equal(msgs, []*message.Message{{DepositNonce: 2}}) + s.Equal(msgs, []*types.Message{{DepositNonce: 2}}) } func (s *DepositHandlerTestSuite) Test_HandleDepositPanis_ExecutionContinues() { @@ -125,16 +124,16 @@ func (s *DepositHandlerTestSuite) Test_HandleDepositPanis_ExecutionContinues() { d2.Data, d2.HandlerResponse, ).Return( - &message.Message{DepositNonce: 2}, + &types.Message{DepositNonce: 2}, nil, ) - msgChan := make(chan []*message.Message, 2) + msgChan := make(chan []*types.Message, 2) err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) - s.Equal(msgs, []*message.Message{{DepositNonce: 2}}) + s.Equal(msgs, []*types.Message{{DepositNonce: 2}}) } func (s *DepositHandlerTestSuite) Test_SuccessfulHandleDeposit() { @@ -162,7 +161,7 @@ func (s *DepositHandlerTestSuite) Test_SuccessfulHandleDeposit() { d1.Data, d1.HandlerResponse, ).Return( - &message.Message{DepositNonce: 1}, + &types.Message{DepositNonce: 1}, nil, ) s.mockDepositHandler.EXPECT().HandleDeposit( @@ -173,14 +172,14 @@ func (s *DepositHandlerTestSuite) Test_SuccessfulHandleDeposit() { d2.Data, d2.HandlerResponse, ).Return( - &message.Message{DepositNonce: 2}, + &types.Message{DepositNonce: 2}, nil, ) - msgChan := make(chan []*message.Message, 2) + msgChan := make(chan []*types.Message, 2) err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) msgs := <-msgChan s.Nil(err) - s.Equal(msgs, []*message.Message{{DepositNonce: 1}, {DepositNonce: 2}}) + s.Equal(msgs, []*types.Message{{DepositNonce: 1}, {DepositNonce: 2}}) } diff --git a/chains/evm/listener/mock/listener.go b/chains/evm/listener/mock/listener.go index 0f65942b..d8b37ad8 100644 --- a/chains/evm/listener/mock/listener.go +++ b/chains/evm/listener/mock/listener.go @@ -78,10 +78,10 @@ func (m *MockDepositHandler) EXPECT() *MockDepositHandlerMockRecorder { } // HandleDeposit mocks base method. -func (m *MockDepositHandler) HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error) { +func (m *MockDepositHandler) HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*types.Message, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "HandleDeposit", sourceID, destID, nonce, resourceID, calldata, handlerResponse) - ret0, _ := ret[0].(*message.Message) + ret0, _ := ret[0].(*types.Message) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/chains/evm/transactor/monitored/monitored_test.go b/chains/evm/transactor/monitored/monitored_test.go index 894d316b..ba4a5c80 100644 --- a/chains/evm/transactor/monitored/monitored_test.go +++ b/chains/evm/transactor/monitored/monitored_test.go @@ -73,7 +73,7 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Fail() { s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() t := monitored.NewMonitoredTransactor( - transactionNewTransaction, + transaction.NewTransaction, s.mockGasPricer, s.mockContractCallerDispatcherClient, big.NewInt(1000), diff --git a/chains/evm/transactor/signAndSend/signAndSend_test.go b/chains/evm/transactor/signAndSend/signAndSend_test.go index 0d429fa1..9625d2f1 100644 --- a/chains/evm/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/transactor/signAndSend/signAndSend_test.go @@ -5,6 +5,7 @@ import ( "testing" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" + "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor/signAndSend" @@ -46,7 +47,7 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() - txFabric := transactionNewTransaction + txFabric := transaction.NewTransaction var trans = signAndSend.NewSignAndSendTransactor( txFabric, s.mockGasPricer, diff --git a/opentelemetry/metrics.go b/opentelemetry/metrics.go index a20b6e54..f3c92352 100644 --- a/opentelemetry/metrics.go +++ b/opentelemetry/metrics.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" "go.opentelemetry.io/otel/metric" @@ -133,7 +133,7 @@ func NewRelayerMetrics(meter metric.Meter, attributes ...attribute.KeyValue) (*R // TrackDepositMessage extracts metrics from deposit message and sends // them to OpenTelemetry collector -func (t *RelayerMetrics) TrackDepositMessage(m *message.Message) { +func (t *RelayerMetrics) TrackDepositMessage(m *types.Message) { t.DepositEventCount.Add(context.Background(), 1, t.Opts, api.WithAttributes(attribute.Int64("source", int64(m.Source)))) t.lock.Lock() @@ -141,7 +141,7 @@ func (t *RelayerMetrics) TrackDepositMessage(m *message.Message) { t.MessageEventTime[m.ID()] = time.Now() } -func (t *RelayerMetrics) TrackExecutionError(m *message.Message) { +func (t *RelayerMetrics) TrackExecutionError(m *types.Message) { t.ExecutionErrorCount.Add(context.Background(), 1, t.Opts, api.WithAttributes(attribute.Int64("destination", int64(m.Source)))) t.lock.Lock() @@ -149,7 +149,7 @@ func (t *RelayerMetrics) TrackExecutionError(m *message.Message) { delete(t.MessageEventTime, m.ID()) } -func (t *RelayerMetrics) TrackSuccessfulExecutionLatency(m *message.Message) { +func (t *RelayerMetrics) TrackSuccessfulExecutionLatency(m *types.Message) { executionLatency := time.Since(t.MessageEventTime[m.ID()]).Milliseconds() / 1000 t.ExecutionLatency.Record(context.Background(), executionLatency) t.ExecutionLatencyPerRoute.Record( @@ -165,7 +165,7 @@ func (t *RelayerMetrics) TrackSuccessfulExecutionLatency(m *message.Message) { delete(t.MessageEventTime, m.ID()) } -func (t *RelayerMetrics) TrackSuccessfulExecution(m *message.Message) { +func (t *RelayerMetrics) TrackSuccessfulExecution(m *types.Message) { executionLatency := time.Since(t.MessageEventTime[m.ID()]).Milliseconds() / 1000 t.ExecutionLatency.Record(context.Background(), executionLatency) t.ExecutionLatencyPerRoute.Record( diff --git a/relayer/mock/relayer.go b/relayer/mock/relayer.go deleted file mode 100644 index 58d26f6b..00000000 --- a/relayer/mock/relayer.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./relayer/relayer.go - -// Package mock_relayer is a generated GoMock package. -package mock_relayer - -import ( - context "context" - reflect "reflect" - - message "github.com/ChainSafe/sygma-core/relayer/message" - gomock "github.com/golang/mock/gomock" -) - -// MockDepositMeter is a mock of DepositMeter interface. -type MockDepositMeter struct { - ctrl *gomock.Controller - recorder *MockDepositMeterMockRecorder -} - -// MockDepositMeterMockRecorder is the mock recorder for MockDepositMeter. -type MockDepositMeterMockRecorder struct { - mock *MockDepositMeter -} - -// NewMockDepositMeter creates a new mock instance. -func NewMockDepositMeter(ctrl *gomock.Controller) *MockDepositMeter { - mock := &MockDepositMeter{ctrl: ctrl} - mock.recorder = &MockDepositMeterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDepositMeter) EXPECT() *MockDepositMeterMockRecorder { - return m.recorder -} - -// TrackDepositMessage mocks base method. -func (m_2 *MockDepositMeter) TrackDepositMessage(m *message.Message) { - m_2.ctrl.T.Helper() - m_2.ctrl.Call(m_2, "TrackDepositMessage", m) -} - -// TrackDepositMessage indicates an expected call of TrackDepositMessage. -func (mr *MockDepositMeterMockRecorder) TrackDepositMessage(m interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackDepositMessage", reflect.TypeOf((*MockDepositMeter)(nil).TrackDepositMessage), m) -} - -// TrackExecutionError mocks base method. -func (m_2 *MockDepositMeter) TrackExecutionError(m *message.Message) { - m_2.ctrl.T.Helper() - m_2.ctrl.Call(m_2, "TrackExecutionError", m) -} - -// TrackExecutionError indicates an expected call of TrackExecutionError. -func (mr *MockDepositMeterMockRecorder) TrackExecutionError(m interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackExecutionError", reflect.TypeOf((*MockDepositMeter)(nil).TrackExecutionError), m) -} - -// TrackSuccessfulExecutionLatency mocks base method. -func (m_2 *MockDepositMeter) TrackSuccessfulExecutionLatency(m *message.Message) { - m_2.ctrl.T.Helper() - m_2.ctrl.Call(m_2, "TrackSuccessfulExecutionLatency", m) -} - -// TrackSuccessfulExecutionLatency indicates an expected call of TrackSuccessfulExecutionLatency. -func (mr *MockDepositMeterMockRecorder) TrackSuccessfulExecutionLatency(m interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackSuccessfulExecutionLatency", reflect.TypeOf((*MockDepositMeter)(nil).TrackSuccessfulExecutionLatency), m) -} - -// MockRelayedChain is a mock of RelayedChain interface. -type MockRelayedChain struct { - ctrl *gomock.Controller - recorder *MockRelayedChainMockRecorder -} - -// MockRelayedChainMockRecorder is the mock recorder for MockRelayedChain. -type MockRelayedChainMockRecorder struct { - mock *MockRelayedChain -} - -// NewMockRelayedChain creates a new mock instance. -func NewMockRelayedChain(ctrl *gomock.Controller) *MockRelayedChain { - mock := &MockRelayedChain{ctrl: ctrl} - mock.recorder = &MockRelayedChainMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockRelayedChain) EXPECT() *MockRelayedChainMockRecorder { - return m.recorder -} - -// DomainID mocks base method. -func (m *MockRelayedChain) DomainID() uint8 { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainID") - ret0, _ := ret[0].(uint8) - return ret0 -} - -// DomainID indicates an expected call of DomainID. -func (mr *MockRelayedChainMockRecorder) DomainID() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainID", reflect.TypeOf((*MockRelayedChain)(nil).DomainID)) -} - -// PollEvents mocks base method. -func (m *MockRelayedChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*message.Message) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "PollEvents", ctx, sysErr, msgChan) -} - -// PollEvents indicates an expected call of PollEvents. -func (mr *MockRelayedChainMockRecorder) PollEvents(ctx, sysErr, msgChan interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx, sysErr, msgChan) -} - -// Write mocks base method. -func (m *MockRelayedChain) Write(messages []*message.Message) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Write", messages) - ret0, _ := ret[0].(error) - return ret0 -} - -// Write indicates an expected call of Write. -func (mr *MockRelayedChainMockRecorder) Write(messages interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockRelayedChain)(nil).Write), messages) -} diff --git a/relayer/relayer.go b/relayer/relayer.go index 1d6447b9..93eac938 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -6,19 +6,19 @@ package relayer import ( "context" - "github.com/ChainSafe/sygma-core/relayer/message" + "github.com/ChainSafe/sygma-core/types" "github.com/rs/zerolog/log" ) type DepositMeter interface { - TrackDepositMessage(m *message.Message) - TrackExecutionError(m *message.Message) - TrackSuccessfulExecutionLatency(m *message.Message) + TrackDepositMessage(m *types.Message) + TrackExecutionError(m *types.Message) + TrackSuccessfulExecutionLatency(m *types.Message) } type RelayedChain interface { - PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*message.Message) - Write(messages []*message.Message) error + PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*types.Message) + Write(messages []*types.Message) error DomainID() uint8 } @@ -37,7 +37,7 @@ type Relayer struct { func (r *Relayer) Start(ctx context.Context, sysErr chan error) { log.Debug().Msgf("Starting relayer") - messagesChannel := make(chan []*message.Message) + messagesChannel := make(chan []*types.Message) for _, c := range r.relayedChains { log.Debug().Msgf("Starting chain %v", c.DomainID()) r.addRelayedChain(c) @@ -56,7 +56,7 @@ func (r *Relayer) Start(ctx context.Context, sysErr chan error) { } // Route function runs destination writer by mapping DestinationID from message to registered writer. -func (r *Relayer) route(msgs []*message.Message) { +func (r *Relayer) route(msgs []*types.Message) { destChain, ok := r.registry[msgs[0].Destination] if !ok { log.Error().Msgf("no resolver for destID %v to send message registered", msgs[0].Destination) diff --git a/relayer/relayer_test.go b/relayer/relayer_test.go index 334c2bff..e3ed5365 100644 --- a/relayer/relayer_test.go +++ b/relayer/relayer_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/ChainSafe/sygma-core/relayer/message" mock_relayer "github.com/ChainSafe/sygma-core/relayer/mock" + "github.com/ChainSafe/sygma-core/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" ) @@ -34,7 +34,7 @@ func (s *RouteTestSuite) TestLogsErrorIfDestinationDoesNotExist() { metrics: s.mockMetrics, } - relayer.route([]*message.Message{ + relayer.route([]*types.Message{ {}, }) } @@ -48,7 +48,7 @@ func (s *RouteTestSuite) TestLogsErrorIfMessageProcessorReturnsError() { ) relayer.addRelayedChain(s.mockRelayedChain) - relayer.route([]*message.Message{ + relayer.route([]*types.Message{ {Destination: 1}, }) } @@ -64,7 +64,7 @@ func (s *RouteTestSuite) TestWriteFail() { ) relayer.addRelayedChain(s.mockRelayedChain) - relayer.route([]*message.Message{ + relayer.route([]*types.Message{ {Destination: 1}, }) } @@ -80,7 +80,7 @@ func (s *RouteTestSuite) TestWritesToDestChainIfMessageValid() { ) relayer.addRelayedChain(s.mockRelayedChain) - relayer.route([]*message.Message{ + relayer.route([]*types.Message{ {Destination: 1}, }) } diff --git a/relayer/message/message.go b/types/message.go similarity index 92% rename from relayer/message/message.go rename to types/message.go index bacfa690..fd6c9592 100644 --- a/relayer/message/message.go +++ b/types/message.go @@ -1,13 +1,10 @@ -// Copyright 2021 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package message +package types import ( "math/big" "strconv" - "github.com/ChainSafe/sygma-core/types" + "github.com/ChainSafe/chainbridge-core/types" ) type TransferType string diff --git a/relayer/proposal/proposal.go b/types/proposal.go similarity index 73% rename from relayer/proposal/proposal.go rename to types/proposal.go index ab50f108..d70656aa 100644 --- a/relayer/proposal/proposal.go +++ b/types/proposal.go @@ -1,11 +1,8 @@ -// The Licensed Work is (c) 2022 Sygma -// SPDX-License-Identifier: LGPL-3.0-only - -package proposal +package types import ( - "github.com/ChainSafe/sygma-core/relayer/message" - "github.com/ChainSafe/sygma-core/types" + "github.com/ChainSafe/chainbridge-core/relayer/message" + "github.com/ChainSafe/chainbridge-core/types" ) func NewProposal(source, destination uint8, depositNonce uint64, resourceId types.ResourceID, data []byte, metadata message.Metadata) *Proposal { From 73f731146983ec59b4e0e97742f2f30803cde45e Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 16:42:31 +0200 Subject: [PATCH 10/27] Move msg channel to be a global message sending tool --- chains/evm/chain.go | 6 +- chains/evm/contracts/abi/bridge.go | 3 - chains/evm/events/events.go | 34 ---- chains/evm/gas/mock/gas-pricer.go | 119 -------------- chains/evm/listener/event-handler.go | 74 --------- chains/evm/listener/event-handler_test.go | 185 ---------------------- chains/evm/listener/mock/listener.go | 93 ----------- relayer/relayer.go | 9 +- store/mock/blockstore.go | 138 ---------------- types/message.go | 40 +---- 10 files changed, 12 insertions(+), 689 deletions(-) delete mode 100644 chains/evm/contracts/abi/bridge.go delete mode 100644 chains/evm/events/events.go delete mode 100644 chains/evm/gas/mock/gas-pricer.go delete mode 100644 chains/evm/listener/event-handler.go delete mode 100644 chains/evm/listener/event-handler_test.go delete mode 100644 chains/evm/listener/mock/listener.go delete mode 100644 store/mock/blockstore.go diff --git a/chains/evm/chain.go b/chains/evm/chain.go index 45a9ff08..4eab8c7d 100644 --- a/chains/evm/chain.go +++ b/chains/evm/chain.go @@ -14,7 +14,7 @@ import ( ) type EventListener interface { - ListenToEvents(ctx context.Context, startBlock *big.Int, msgChan chan []*types.Message, errChan chan<- error) + ListenToEvents(ctx context.Context, startBlock *big.Int, errChan chan<- error) } type ProposalExecutor interface { @@ -47,7 +47,7 @@ func NewEVMChain(listener EventListener, writer ProposalExecutor, blockstore *st // PollEvents is the goroutine that polls blocks and searches Deposit events in them. // Events are then sent to eventsChan. -func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*types.Message) { +func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error) { log.Info().Msg("Polling Blocks...") startBlock, err := c.blockstore.GetStartBlock( @@ -61,7 +61,7 @@ func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan return } - go c.listener.ListenToEvents(ctx, startBlock, msgChan, sysErr) + go c.listener.ListenToEvents(ctx, startBlock, sysErr) } func (c *EVMChain) Write(msg []*types.Message) error { diff --git a/chains/evm/contracts/abi/bridge.go b/chains/evm/contracts/abi/bridge.go deleted file mode 100644 index 99d7e3ef..00000000 --- a/chains/evm/contracts/abi/bridge.go +++ /dev/null @@ -1,3 +0,0 @@ -package abi - -const BridgeABI = "[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"accessControl\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSig\",\"type\":\"bytes4\"}],\"name\":\"AccessNotAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositToCurrentDomain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyProposalsArray\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProposalSigner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressAlreadySet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressIsNotUpdatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MPCAddressZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonceDecrementsNotAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResourceIDNotMappedToHandler\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAccessControl\",\"type\":\"address\"}],\"name\":\"AccessControlChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"destinationDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EndKeygen\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lowLevelData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"}],\"name\":\"FailedHandlerExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newFeeHandler\",\"type\":\"address\"}],\"name\":\"FeeHandlerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"hash\",\"type\":\"string\"}],\"name\":\"KeyRefresh\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"name\":\"ProposalExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"txHash\",\"type\":\"string\"}],\"name\":\"Retry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"StartKeygen\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_MPCAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_accessControl\",\"outputs\":[{\"internalType\":\"contract IAccessControlSegregator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"_depositCounts\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_domainID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_feeHandler\",\"outputs\":[{\"internalType\":\"contract IFeeHandler\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"_resourceIDToHandlerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isValidForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"usedNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminPauseTransfers\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminUnpauseTransfers\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"args\",\"type\":\"bytes\"}],\"name\":\"adminSetResource\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"adminSetBurnable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"}],\"name\":\"adminSetDepositNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"adminSetForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAccessControl\",\"type\":\"address\"}],\"name\":\"adminChangeAccessControl\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newFeeHandler\",\"type\":\"address\"}],\"name\":\"adminChangeFeeHandler\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"handlerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"adminWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"destinationDomainID\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"depositData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"feeData\",\"type\":\"bytes\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"handlerResponse\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"executeProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal[]\",\"name\":\"proposals\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"executeProposals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startKeygen\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"MPCAddress\",\"type\":\"address\"}],\"name\":\"endKeygen\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"hash\",\"type\":\"string\"}],\"name\":\"refreshKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"txHash\",\"type\":\"string\"}],\"name\":\"retry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"domainID\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"depositNonce\",\"type\":\"uint256\"}],\"name\":\"isProposalExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"originDomainID\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"depositNonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Bridge.Proposal[]\",\"name\":\"proposals\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" diff --git a/chains/evm/events/events.go b/chains/evm/events/events.go deleted file mode 100644 index 6cd14080..00000000 --- a/chains/evm/events/events.go +++ /dev/null @@ -1,34 +0,0 @@ -package events - -import ( - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" -) - -type EventSig string - -func (es EventSig) GetTopic() common.Hash { - return crypto.Keccak256Hash([]byte(es)) -} - -const ( - DepositSig EventSig = "Deposit(uint8,bytes32,uint64,address,bytes,bytes)" -) - -type Deposit struct { - // ID of chain deposit will be bridged to - DestinationDomainID uint8 - // ResourceID used to find address of handler to be used for deposit - ResourceID types.ResourceID - // Nonce of deposit - DepositNonce uint64 - // Address of sender (msg.sender: user) - SenderAddress common.Address - // Additional data to be passed to specified handler - Data []byte - // ERC20Handler: responds with empty data - // ERC721Handler: responds with deposited token metadata acquired by calling a tokenURI method in the token contract - // GenericHandler: responds with the raw bytes returned from the call to the target contract - HandlerResponse []byte -} diff --git a/chains/evm/gas/mock/gas-pricer.go b/chains/evm/gas/mock/gas-pricer.go deleted file mode 100644 index c1c004d1..00000000 --- a/chains/evm/gas/mock/gas-pricer.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/gaspricer/gas-pricer.go - -// Package mock_gaspricer is a generated GoMock package. -package mock_gaspricer - -import ( - context "context" - big "math/big" - reflect "reflect" - - gomock "github.com/golang/mock/gomock" -) - -// MockLondonGasClient is a mock of LondonGasClient interface. -type MockLondonGasClient struct { - ctrl *gomock.Controller - recorder *MockLondonGasClientMockRecorder -} - -// MockLondonGasClientMockRecorder is the mock recorder for MockLondonGasClient. -type MockLondonGasClientMockRecorder struct { - mock *MockLondonGasClient -} - -// NewMockLondonGasClient creates a new mock instance. -func NewMockLondonGasClient(ctrl *gomock.Controller) *MockLondonGasClient { - mock := &MockLondonGasClient{ctrl: ctrl} - mock.recorder = &MockLondonGasClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockLondonGasClient) EXPECT() *MockLondonGasClientMockRecorder { - return m.recorder -} - -// BaseFee mocks base method. -func (m *MockLondonGasClient) BaseFee() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BaseFee") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BaseFee indicates an expected call of BaseFee. -func (mr *MockLondonGasClientMockRecorder) BaseFee() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseFee", reflect.TypeOf((*MockLondonGasClient)(nil).BaseFee)) -} - -// SuggestGasPrice mocks base method. -func (m *MockLondonGasClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SuggestGasPrice", ctx) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SuggestGasPrice indicates an expected call of SuggestGasPrice. -func (mr *MockLondonGasClientMockRecorder) SuggestGasPrice(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasPrice", reflect.TypeOf((*MockLondonGasClient)(nil).SuggestGasPrice), ctx) -} - -// SuggestGasTipCap mocks base method. -func (m *MockLondonGasClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SuggestGasTipCap", ctx) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SuggestGasTipCap indicates an expected call of SuggestGasTipCap. -func (mr *MockLondonGasClientMockRecorder) SuggestGasTipCap(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasTipCap", reflect.TypeOf((*MockLondonGasClient)(nil).SuggestGasTipCap), ctx) -} - -// MockGasPriceClient is a mock of GasPriceClient interface. -type MockGasPriceClient struct { - ctrl *gomock.Controller - recorder *MockGasPriceClientMockRecorder -} - -// MockGasPriceClientMockRecorder is the mock recorder for MockGasPriceClient. -type MockGasPriceClientMockRecorder struct { - mock *MockGasPriceClient -} - -// NewMockGasPriceClient creates a new mock instance. -func NewMockGasPriceClient(ctrl *gomock.Controller) *MockGasPriceClient { - mock := &MockGasPriceClient{ctrl: ctrl} - mock.recorder = &MockGasPriceClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGasPriceClient) EXPECT() *MockGasPriceClientMockRecorder { - return m.recorder -} - -// SuggestGasPrice mocks base method. -func (m *MockGasPriceClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SuggestGasPrice", ctx) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SuggestGasPrice indicates an expected call of SuggestGasPrice. -func (mr *MockGasPriceClientMockRecorder) SuggestGasPrice(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasPrice", reflect.TypeOf((*MockGasPriceClient)(nil).SuggestGasPrice), ctx) -} diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go deleted file mode 100644 index bd035fbb..00000000 --- a/chains/evm/listener/event-handler.go +++ /dev/null @@ -1,74 +0,0 @@ -package listener - -import ( - "context" - "fmt" - "math/big" - - "github.com/ChainSafe/sygma-core/chains/evm/events" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" -) - -type EventListener interface { - FetchDeposits(ctx context.Context, address common.Address, startBlock *big.Int, endBlock *big.Int) ([]*events.Deposit, error) -} - -type DepositHandler interface { - HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*types.Message, error) -} - -type DepositEventHandler struct { - eventListener EventListener - depositHandler DepositHandler - - bridgeAddress common.Address - msgChan chan []*types.Message - domainID uint8 -} - -func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8, msgChan chan []*types.Message) *DepositEventHandler { - return &DepositEventHandler{ - eventListener: eventListener, - depositHandler: depositHandler, - bridgeAddress: bridgeAddress, - domainID: domainID, - msgChan: msgChan, - } -} - -func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.Int) error { - deposits, err := eh.eventListener.FetchDeposits(context.Background(), eh.bridgeAddress, startBlock, endBlock) - if err != nil { - return fmt.Errorf("unable to fetch deposit events because of: %+v", err) - } - - domainDeposits := make(map[uint8][]*types.Message) - for _, d := range deposits { - func(d *events.Deposit) { - defer func() { - if r := recover(); r != nil { - log.Error().Err(err).Msgf("panic occured while handling deposit %+v", d) - } - }() - - m, err := eh.depositHandler.HandleDeposit(eh.domainID, d.DestinationDomainID, d.DepositNonce, d.ResourceID, d.Data, d.HandlerResponse) - if err != nil { - log.Error().Err(err).Str("start block", startBlock.String()).Str("end block", endBlock.String()).Uint8("domainID", eh.domainID).Msgf("%v", err) - return - } - - log.Debug().Msgf("Resolved message %+v in block range: %s-%s", m, startBlock.String(), endBlock.String()) - domainDeposits[m.Destination] = append(domainDeposits[m.Destination], m) - }(d) - } - - for _, deposits := range domainDeposits { - go func(d []*types.Message) { - eh.msgChan <- d - }(deposits) - } - - return nil -} diff --git a/chains/evm/listener/event-handler_test.go b/chains/evm/listener/event-handler_test.go deleted file mode 100644 index 94b276fe..00000000 --- a/chains/evm/listener/event-handler_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package listener_test - -import ( - "fmt" - "math/big" - "testing" - - "github.com/ChainSafe/sygma-core/chains/evm/events" - "github.com/ChainSafe/sygma-core/chains/evm/listener" - mock_listener "github.com/ChainSafe/sygma-core/chains/evm/listener/mock" - "github.com/ChainSafe/sygma-core/types" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/suite" -) - -type DepositHandlerTestSuite struct { - suite.Suite - depositEventHandler *listener.DepositEventHandler - mockDepositHandler *mock_listener.MockDepositHandler - mockEventListener *mock_listener.MockEventListener - domainID uint8 -} - -func TestRunDepositHandlerTestSuite(t *testing.T) { - suite.Run(t, new(DepositHandlerTestSuite)) -} - -func (s *DepositHandlerTestSuite) SetupTest() { - ctrl := gomock.NewController(s.T()) - s.domainID = 1 - s.mockEventListener = mock_listener.NewMockEventListener(ctrl) - s.mockDepositHandler = mock_listener.NewMockDepositHandler(ctrl) - s.depositEventHandler = listener.NewDepositEventHandler(s.mockEventListener, s.mockDepositHandler, common.Address{}, s.domainID, make(chan []*types.Message)) -} - -func (s *DepositHandlerTestSuite) Test_FetchDepositFails() { - s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]*events.Deposit{}, fmt.Errorf("error")) - - msgChan := make(chan []*types.Message, 1) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) - - s.NotNil(err) - s.Equal(len(msgChan), 0) -} - -func (s *DepositHandlerTestSuite) Test_HandleDepositFails_ExecutionContinue() { - d1 := &events.Deposit{ - DepositNonce: 1, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - d2 := &events.Deposit{ - DepositNonce: 2, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - deposits := []*events.Deposit{d1, d2} - s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(deposits, nil) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d1.DestinationDomainID, - d1.DepositNonce, - d1.ResourceID, - d1.Data, - d1.HandlerResponse, - ).Return(&types.Message{}, fmt.Errorf("error")) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d2.DestinationDomainID, - d2.DepositNonce, - d2.ResourceID, - d2.Data, - d2.HandlerResponse, - ).Return( - &types.Message{DepositNonce: 2}, - nil, - ) - - msgChan := make(chan []*types.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) - msgs := <-msgChan - - s.Nil(err) - s.Equal(msgs, []*types.Message{{DepositNonce: 2}}) -} - -func (s *DepositHandlerTestSuite) Test_HandleDepositPanis_ExecutionContinues() { - d1 := &events.Deposit{ - DepositNonce: 1, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - d2 := &events.Deposit{ - DepositNonce: 2, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - deposits := []*events.Deposit{d1, d2} - s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(deposits, nil) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d1.DestinationDomainID, - d1.DepositNonce, - d1.ResourceID, - d1.Data, - d1.HandlerResponse, - ).Do(func(sourceID, destID, nonce, resourceID, calldata, handlerResponse interface{}) { - panic("error") - }) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d2.DestinationDomainID, - d2.DepositNonce, - d2.ResourceID, - d2.Data, - d2.HandlerResponse, - ).Return( - &types.Message{DepositNonce: 2}, - nil, - ) - - msgChan := make(chan []*types.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) - msgs := <-msgChan - - s.Nil(err) - s.Equal(msgs, []*types.Message{{DepositNonce: 2}}) -} - -func (s *DepositHandlerTestSuite) Test_SuccessfulHandleDeposit() { - d1 := &events.Deposit{ - DepositNonce: 1, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - d2 := &events.Deposit{ - DepositNonce: 2, - DestinationDomainID: 2, - ResourceID: types.ResourceID{}, - HandlerResponse: []byte{}, - Data: []byte{}, - } - deposits := []*events.Deposit{d1, d2} - s.mockEventListener.EXPECT().FetchDeposits(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(deposits, nil) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d1.DestinationDomainID, - d1.DepositNonce, - d1.ResourceID, - d1.Data, - d1.HandlerResponse, - ).Return( - &types.Message{DepositNonce: 1}, - nil, - ) - s.mockDepositHandler.EXPECT().HandleDeposit( - s.domainID, - d2.DestinationDomainID, - d2.DepositNonce, - d2.ResourceID, - d2.Data, - d2.HandlerResponse, - ).Return( - &types.Message{DepositNonce: 2}, - nil, - ) - - msgChan := make(chan []*types.Message, 2) - err := s.depositEventHandler.HandleEvent(big.NewInt(0), big.NewInt(5)) - msgs := <-msgChan - - s.Nil(err) - s.Equal(msgs, []*types.Message{{DepositNonce: 1}, {DepositNonce: 2}}) -} diff --git a/chains/evm/listener/mock/listener.go b/chains/evm/listener/mock/listener.go deleted file mode 100644 index d8b37ad8..00000000 --- a/chains/evm/listener/mock/listener.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./chains/evm/listener/event-handler.go - -// Package mock_listener is a generated GoMock package. -package mock_listener - -import ( - context "context" - big "math/big" - reflect "reflect" - - events "github.com/ChainSafe/sygma-core/chains/evm/events" - message "github.com/ChainSafe/sygma-core/relayer/message" - types "github.com/ChainSafe/sygma-core/types" - common "github.com/ethereum/go-ethereum/common" - gomock "github.com/golang/mock/gomock" -) - -// MockEventListener is a mock of EventListener interface. -type MockEventListener struct { - ctrl *gomock.Controller - recorder *MockEventListenerMockRecorder -} - -// MockEventListenerMockRecorder is the mock recorder for MockEventListener. -type MockEventListenerMockRecorder struct { - mock *MockEventListener -} - -// NewMockEventListener creates a new mock instance. -func NewMockEventListener(ctrl *gomock.Controller) *MockEventListener { - mock := &MockEventListener{ctrl: ctrl} - mock.recorder = &MockEventListenerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockEventListener) EXPECT() *MockEventListenerMockRecorder { - return m.recorder -} - -// FetchDeposits mocks base method. -func (m *MockEventListener) FetchDeposits(ctx context.Context, address common.Address, startBlock, endBlock *big.Int) ([]*events.Deposit, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchDeposits", ctx, address, startBlock, endBlock) - ret0, _ := ret[0].([]*events.Deposit) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FetchDeposits indicates an expected call of FetchDeposits. -func (mr *MockEventListenerMockRecorder) FetchDeposits(ctx, address, startBlock, endBlock interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchDeposits", reflect.TypeOf((*MockEventListener)(nil).FetchDeposits), ctx, address, startBlock, endBlock) -} - -// MockDepositHandler is a mock of DepositHandler interface. -type MockDepositHandler struct { - ctrl *gomock.Controller - recorder *MockDepositHandlerMockRecorder -} - -// MockDepositHandlerMockRecorder is the mock recorder for MockDepositHandler. -type MockDepositHandlerMockRecorder struct { - mock *MockDepositHandler -} - -// NewMockDepositHandler creates a new mock instance. -func NewMockDepositHandler(ctrl *gomock.Controller) *MockDepositHandler { - mock := &MockDepositHandler{ctrl: ctrl} - mock.recorder = &MockDepositHandlerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDepositHandler) EXPECT() *MockDepositHandlerMockRecorder { - return m.recorder -} - -// HandleDeposit mocks base method. -func (m *MockDepositHandler) HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*types.Message, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HandleDeposit", sourceID, destID, nonce, resourceID, calldata, handlerResponse) - ret0, _ := ret[0].(*types.Message) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HandleDeposit indicates an expected call of HandleDeposit. -func (mr *MockDepositHandlerMockRecorder) HandleDeposit(sourceID, destID, nonce, resourceID, calldata, handlerResponse interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleDeposit", reflect.TypeOf((*MockDepositHandler)(nil).HandleDeposit), sourceID, destID, nonce, resourceID, calldata, handlerResponse) -} diff --git a/relayer/relayer.go b/relayer/relayer.go index 93eac938..519cf056 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -17,7 +17,7 @@ type DepositMeter interface { } type RelayedChain interface { - PollEvents(ctx context.Context, sysErr chan<- error, msgChan chan []*types.Message) + PollEvents(ctx context.Context, sysErr chan<- error) Write(messages []*types.Message) error DomainID() uint8 } @@ -34,19 +34,18 @@ type Relayer struct { // Start function starts the relayer. Relayer routine is starting all the chains // and passing them with a channel that accepts unified cross chain message format -func (r *Relayer) Start(ctx context.Context, sysErr chan error) { +func (r *Relayer) Start(ctx context.Context, msgChan chan []*types.Message, sysErr chan error) { log.Debug().Msgf("Starting relayer") - messagesChannel := make(chan []*types.Message) for _, c := range r.relayedChains { log.Debug().Msgf("Starting chain %v", c.DomainID()) r.addRelayedChain(c) - go c.PollEvents(ctx, sysErr, messagesChannel) + go c.PollEvents(ctx, sysErr) } for { select { - case m := <-messagesChannel: + case m := <-msgChan: go r.route(m) continue case <-ctx.Done(): diff --git a/store/mock/blockstore.go b/store/mock/blockstore.go deleted file mode 100644 index 212c2565..00000000 --- a/store/mock/blockstore.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: blockstore/blockstore.go - -// Package mock_blockstore is a generated GoMock package. -package mock_blockstore - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" -) - -// MockKeyValueReaderWriter is a mock of KeyValueReaderWriter interface. -type MockKeyValueReaderWriter struct { - ctrl *gomock.Controller - recorder *MockKeyValueReaderWriterMockRecorder -} - -// MockKeyValueReaderWriterMockRecorder is the mock recorder for MockKeyValueReaderWriter. -type MockKeyValueReaderWriterMockRecorder struct { - mock *MockKeyValueReaderWriter -} - -// NewMockKeyValueReaderWriter creates a new mock instance. -func NewMockKeyValueReaderWriter(ctrl *gomock.Controller) *MockKeyValueReaderWriter { - mock := &MockKeyValueReaderWriter{ctrl: ctrl} - mock.recorder = &MockKeyValueReaderWriterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockKeyValueReaderWriter) EXPECT() *MockKeyValueReaderWriterMockRecorder { - return m.recorder -} - -// GetByKey mocks base method. -func (m *MockKeyValueReaderWriter) GetByKey(key []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByKey", key) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetByKey indicates an expected call of GetByKey. -func (mr *MockKeyValueReaderWriterMockRecorder) GetByKey(key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByKey", reflect.TypeOf((*MockKeyValueReaderWriter)(nil).GetByKey), key) -} - -// SetByKey mocks base method. -func (m *MockKeyValueReaderWriter) SetByKey(key, value []byte) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetByKey", key, value) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetByKey indicates an expected call of SetByKey. -func (mr *MockKeyValueReaderWriterMockRecorder) SetByKey(key, value interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetByKey", reflect.TypeOf((*MockKeyValueReaderWriter)(nil).SetByKey), key, value) -} - -// MockKeyValueReader is a mock of KeyValueReader interface. -type MockKeyValueReader struct { - ctrl *gomock.Controller - recorder *MockKeyValueReaderMockRecorder -} - -// MockKeyValueReaderMockRecorder is the mock recorder for MockKeyValueReader. -type MockKeyValueReaderMockRecorder struct { - mock *MockKeyValueReader -} - -// NewMockKeyValueReader creates a new mock instance. -func NewMockKeyValueReader(ctrl *gomock.Controller) *MockKeyValueReader { - mock := &MockKeyValueReader{ctrl: ctrl} - mock.recorder = &MockKeyValueReaderMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockKeyValueReader) EXPECT() *MockKeyValueReaderMockRecorder { - return m.recorder -} - -// GetByKey mocks base method. -func (m *MockKeyValueReader) GetByKey(key []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByKey", key) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetByKey indicates an expected call of GetByKey. -func (mr *MockKeyValueReaderMockRecorder) GetByKey(key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByKey", reflect.TypeOf((*MockKeyValueReader)(nil).GetByKey), key) -} - -// MockKeyValueWriter is a mock of KeyValueWriter interface. -type MockKeyValueWriter struct { - ctrl *gomock.Controller - recorder *MockKeyValueWriterMockRecorder -} - -// MockKeyValueWriterMockRecorder is the mock recorder for MockKeyValueWriter. -type MockKeyValueWriterMockRecorder struct { - mock *MockKeyValueWriter -} - -// NewMockKeyValueWriter creates a new mock instance. -func NewMockKeyValueWriter(ctrl *gomock.Controller) *MockKeyValueWriter { - mock := &MockKeyValueWriter{ctrl: ctrl} - mock.recorder = &MockKeyValueWriterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockKeyValueWriter) EXPECT() *MockKeyValueWriterMockRecorder { - return m.recorder -} - -// SetByKey mocks base method. -func (m *MockKeyValueWriter) SetByKey(key, value []byte) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetByKey", key, value) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetByKey indicates an expected call of SetByKey. -func (mr *MockKeyValueWriterMockRecorder) SetByKey(key, value interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetByKey", reflect.TypeOf((*MockKeyValueWriter)(nil).SetByKey), key, value) -} diff --git a/types/message.go b/types/message.go index fd6c9592..e305f4ed 100644 --- a/types/message.go +++ b/types/message.go @@ -1,48 +1,18 @@ package types import ( - "math/big" "strconv" - - "github.com/ChainSafe/chainbridge-core/types" ) -type TransferType string type Metadata struct { - Priority uint8 - Data map[string]interface{} -} - -const ( - FungibleTransfer TransferType = "FungibleTransfer" - NonFungibleTransfer TransferType = "NonFungibleTransfer" - GenericTransfer TransferType = "GenericTransfer" -) - -type ProposalStatus struct { - Status uint8 - YesVotes *big.Int - YesVotesTotal uint8 - ProposedBlock *big.Int + Data map[string]interface{} } - -const ( - ProposalStatusInactive uint8 = iota - ProposalStatusActive - ProposalStatusPassed // Ready to be executed - ProposalStatusExecuted - ProposalStatusCanceled -) - -var ( - StatusMap = map[uint8]string{ProposalStatusInactive: "inactive", ProposalStatusActive: "active", ProposalStatusPassed: "passed", ProposalStatusExecuted: "executed", ProposalStatusCanceled: "canceled"} -) - +type TransferType string type Message struct { Source uint8 // Source where message was initiated Destination uint8 // Destination chain of message DepositNonce uint64 // Nonce for the deposit - ResourceId types.ResourceID + ResourceId ResourceID Payload []interface{} // data associated with event sequence Metadata Metadata // Arbitrary data that will be most likely be used by the relayer Type TransferType @@ -52,7 +22,7 @@ func NewMessage( source uint8, destination uint8, depositNonce uint64, - resourceId types.ResourceID, + resourceId ResourceID, transferType TransferType, payload []interface{}, metadata Metadata, @@ -69,5 +39,5 @@ func NewMessage( } func (m Message) ID() string { - return strconv.FormatInt(int64(m.Source), 10) + "-" + strconv.FormatInt(int64(m.DepositNonce), 10) + return strconv.FormatInt(int64(m.Source), 10) + "-" + strconv.FormatInt(int64(m.Destination), 10) + "-" + strconv.FormatInt(int64(m.DepositNonce), 10) } From 15ca61759ac67480e3cde15f3b58c6bbb805732f Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 16:46:34 +0200 Subject: [PATCH 11/27] Add evm config module --- chains/evm/config/config.go | 120 ++++++++++++++++++++++++ chains/evm/config/config_test.go | 153 +++++++++++++++++++++++++++++++ 2 files changed, 273 insertions(+) create mode 100644 chains/evm/config/config.go create mode 100644 chains/evm/config/config_test.go diff --git a/chains/evm/config/config.go b/chains/evm/config/config.go new file mode 100644 index 00000000..021b72f5 --- /dev/null +++ b/chains/evm/config/config.go @@ -0,0 +1,120 @@ +package config + +import ( + "fmt" + "math/big" + "time" + + "github.com/creasty/defaults" + "github.com/ethereum/go-ethereum/crypto" + "github.com/mitchellh/mapstructure" + + "github.com/ChainSafe/sygma-core/config/chain" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" +) + +type HandlerConfig struct { + Address string + Type string +} + +type EVMConfig struct { + GeneralChainConfig chain.ChainConfig + Bridge string + Handlers []HandlerConfig + MaxGasPrice *big.Int + GasMultiplier *big.Float + GasLimit *big.Int + GasIncreasePercentage *big.Int + StartBlock *big.Int + BlockConfirmations *big.Int + BlockInterval *big.Int + BlockRetryInterval time.Duration +} + +func (c *EVMConfig) String() string { + privateKey, _ := crypto.HexToECDSA(c.GeneralChainConfig.Key) + kp := secp256k1.NewKeypair(*privateKey) + return fmt.Sprintf(`Name: '%s', Id: '%d', Type: '%s', BlockstorePath: '%s', FreshStart: '%t', LatestBlock: '%t', Key address: '%s', Bridge: '%s', Handlers: %+v, MaxGasPrice: '%s', GasMultiplier: '%s', GasLimit: '%s', StartBlock: '%s', BlockConfirmations: '%s', BlockInterval: '%s', BlockRetryInterval: '%s'`, + c.GeneralChainConfig.Name, + *c.GeneralChainConfig.Id, + c.GeneralChainConfig.Type, + c.GeneralChainConfig.BlockstorePath, + c.GeneralChainConfig.FreshStart, + c.GeneralChainConfig.LatestBlock, + kp.Address(), + c.Bridge, + c.Handlers, + c.MaxGasPrice, + c.GasMultiplier, + c.GasLimit, + c.StartBlock, + c.BlockConfirmations, + c.BlockInterval, + c.BlockRetryInterval, + ) +} + +type RawEVMConfig struct { + chain.ChainConfig `mapstructure:",squash"` + Bridge string `mapstructure:"bridge"` + Handlers []HandlerConfig `mapstrcture:"handlers"` + MaxGasPrice int64 `mapstructure:"maxGasPrice" default:"500000000000"` + GasMultiplier float64 `mapstructure:"gasMultiplier" default:"1"` + GasIncreasePercentage int64 `mapstructure:"gasIncreasePercentage" default:"15"` + GasLimit int64 `mapstructure:"gasLimit" default:"2000000"` + StartBlock int64 `mapstructure:"startBlock"` + BlockConfirmations int64 `mapstructure:"blockConfirmations" default:"10"` + BlockInterval int64 `mapstructure:"blockInterval" default:"5"` + BlockRetryInterval uint64 `mapstructure:"blockRetryInterval" default:"5"` +} + +func (c *RawEVMConfig) Validate() error { + if err := c.ChainConfig.Validate(); err != nil { + return err + } + if c.Bridge == "" { + return fmt.Errorf("required field chain.Bridge empty for chain %v", *c.Id) + } + if c.BlockConfirmations != 0 && c.BlockConfirmations < 1 { + return fmt.Errorf("blockConfirmations has to be >=1") + } + return nil +} + +// NewEVMConfig decodes and validates an instance of an EVMConfig from +// raw chain config +func NewEVMConfig(chainConfig map[string]interface{}) (*EVMConfig, error) { + var c RawEVMConfig + err := mapstructure.Decode(chainConfig, &c) + if err != nil { + return nil, err + } + + err = defaults.Set(&c) + if err != nil { + return nil, err + } + + err = c.Validate() + if err != nil { + return nil, err + } + + c.ChainConfig.ParseFlags() + config := &EVMConfig{ + GeneralChainConfig: c.ChainConfig, + Handlers: c.Handlers, + Bridge: c.Bridge, + BlockRetryInterval: time.Duration(c.BlockRetryInterval) * time.Second, + GasLimit: big.NewInt(c.GasLimit), + MaxGasPrice: big.NewInt(c.MaxGasPrice), + GasIncreasePercentage: big.NewInt(c.GasIncreasePercentage), + GasMultiplier: big.NewFloat(c.GasMultiplier), + StartBlock: big.NewInt(c.StartBlock), + BlockConfirmations: big.NewInt(c.BlockConfirmations), + BlockInterval: big.NewInt(c.BlockInterval), + } + + return config, nil +} diff --git a/chains/evm/config/config_test.go b/chains/evm/config/config_test.go new file mode 100644 index 00000000..a3ff4162 --- /dev/null +++ b/chains/evm/config/config_test.go @@ -0,0 +1,153 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package config_test + +import ( + "math/big" + "testing" + "time" + + "github.com/ChainSafe/sygma-core/chains/evm/config" + "github.com/ChainSafe/sygma-core/config/chain" + "github.com/stretchr/testify/suite" +) + +type NewEVMConfigTestSuite struct { + suite.Suite +} + +func TestRunNewEVMConfigTestSuite(t *testing.T) { + suite.Run(t, new(NewEVMConfigTestSuite)) +} + +func (s *NewEVMConfigTestSuite) Test_FailedDecode() { + _, err := config.NewEVMConfig(map[string]interface{}{ + "gasLimit": "invalid", + }) + + s.NotNil(err) +} + +func (s *NewEVMConfigTestSuite) Test_FailedGeneralConfigValidation() { + _, err := config.NewEVMConfig(map[string]interface{}{}) + + s.NotNil(err) +} + +func (s *NewEVMConfigTestSuite) Test_FailedEVMConfigValidation() { + _, err := config.NewEVMConfig(map[string]interface{}{ + "id": 1, + "endpoint": "ws://domain.com", + "name": "evm1", + "from": "address", + }) + + s.NotNil(err) +} + +func (s *NewEVMConfigTestSuite) Test_InvalidBlockConfirmation() { + _, err := config.NewEVMConfig(map[string]interface{}{ + "id": 1, + "endpoint": "ws://domain.com", + "name": "evm1", + "from": "address", + "bridge": "bridgeAddress", + "blockConfirmations": -1, + }) + + s.NotNil(err) + s.Equal(err.Error(), "blockConfirmations has to be >=1") +} + +func (s *NewEVMConfigTestSuite) Test_ValidConfig() { + rawConfig := map[string]interface{}{ + "id": 1, + "endpoint": "ws://domain.com", + "name": "evm1", + "from": "address", + "bridge": "bridgeAddress", + } + + actualConfig, err := config.NewEVMConfig(rawConfig) + + id := new(uint8) + *id = 1 + s.Nil(err) + s.Equal(*actualConfig, config.EVMConfig{ + GeneralChainConfig: chain.GeneralChainConfig{ + Name: "evm1", + Endpoint: "ws://domain.com", + Id: id, + }, + Bridge: "bridgeAddress", + GasLimit: big.NewInt(2000000), + MaxGasPrice: big.NewInt(500000000000), + GasMultiplier: big.NewFloat(1), + GasIncreasePercentage: big.NewInt(15), + StartBlock: big.NewInt(0), + BlockConfirmations: big.NewInt(10), + BlockInterval: big.NewInt(5), + BlockRetryInterval: time.Duration(5) * time.Second, + }) +} + +func (s *NewEVMConfigTestSuite) Test_ValidConfigWithCustomTxParams() { + rawConfig := map[string]interface{}{ + "id": 1, + "endpoint": "ws://domain.com", + "name": "evm1", + "from": "address", + "bridge": "bridgeAddress", + "handlers": []config.HandlerConfig{ + { + Type: "erc20", + Address: "address1", + }, + { + Type: "erc721", + Address: "address2", + }, + }, + "maxGasPrice": 1000, + "gasMultiplier": 1000, + "gasIncreasePercentage": 20, + "gasLimit": 1000, + "startBlock": 1000, + "blockConfirmations": 10, + "blockRetryInterval": 10, + "blockInterval": 2, + } + + actualConfig, err := config.NewEVMConfig(rawConfig) + + id := new(uint8) + *id = 1 + s.Nil(err) + s.Equal(*actualConfig, config.EVMConfig{ + GeneralChainConfig: chain.GeneralChainConfig{ + Name: "evm1", + Endpoint: "ws://domain.com", + Id: id, + }, + Bridge: "bridgeAddress", + Handlers: []config.HandlerConfig{ + { + Type: "erc20", + Address: "address1", + }, + { + Type: "erc721", + Address: "address2", + }, + }, + GasLimit: big.NewInt(1000), + MaxGasPrice: big.NewInt(1000), + GasMultiplier: big.NewFloat(1000), + GasIncreasePercentage: big.NewInt(20), + StartBlock: big.NewInt(1000), + BlockConfirmations: big.NewInt(10), + BlockInterval: big.NewInt(2), + BlockRetryInterval: time.Duration(10) * time.Second, + }) +} From 01c27b9c9b126234e02ab78a160cebec21b07f78 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 17:12:15 +0200 Subject: [PATCH 12/27] Remove config module from core library --- Dockerfile | 16 --- Makefile | 12 +- chains/evm/config/config.go | 120 -------------------- chains/evm/config/config_test.go | 153 -------------------------- chains/evm/contracts/contract_test.go | 8 +- config/chain/config.go | 49 --------- config/chain/config_test.go | 51 --------- config/config.go | 58 ---------- config/config_test.go | 89 --------------- config/relayer/config.go | 49 --------- flags/flags.go | 32 ------ types/proposal.go | 11 +- 12 files changed, 11 insertions(+), 637 deletions(-) delete mode 100644 Dockerfile delete mode 100644 chains/evm/config/config.go delete mode 100644 chains/evm/config/config_test.go delete mode 100644 config/chain/config.go delete mode 100644 config/chain/config_test.go delete mode 100644 config/config.go delete mode 100644 config/config_test.go delete mode 100644 config/relayer/config.go delete mode 100644 flags/flags.go diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3d7de192..00000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2020 ChainSafe Systems -# SPDX-License-Identifier: LGPL-3.0-only - -FROM golang:1.17-stretch AS builder -ADD . /src -WORKDIR /src -RUN cd /src && echo $(ls -1 /src) -RUN go mod download -RUN go build -o /bridge ./e2e/evm-evm/example/. - -# final stage -FROM debian:stretch-slim -COPY --from=builder /bridge ./ -RUN chmod +x ./bridge - -ENTRYPOINT ["./bridge"] diff --git a/Makefile b/Makefile index 7ec3e423..58a74db5 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,6 @@ install-subkey: cargo install --force --git https://github.com/paritytech/substrate subkey genmocks: - mockgen -destination=./chains/evm/gaspricer/mock/gas-pricer.go -source=./chains/evm/gaspricer/gas-pricer.go - mockgen -destination=./relayer/mock/relayer.go -source=./relayer/relayer.go - mockgen -source=chains/evm/calls.go -destination=chains/evm/mock/calls.go - mockgen -source=chains/evm/transactor/transact.go -destination=chains/evm/transactor/mock/transact.go - mockgen -destination=chains/evm/executor/mock/voter.go github.com/ChainSafe/sygma-core/chains/evm/executor ChainClient,MessageHandler,BridgeContract - mockgen -destination=./chains/evm/transactor/itx/mock/itx.go -source=./chains/evm/transactor/itx/itx.go - mockgen -destination=./chains/evm/transactor/itx//mock/minimalForwarder.go -source=./chains/evm/transactor/itx/minimalForwarder.go - mockgen -destination=chains/evm/cli/bridge/mock/vote-proposal.go -source=./chains/evm/cli/bridge/vote-proposal.go - mockgen -destination=chains/evm/listener/mock/listener.go -source=./chains/evm/listener/event-handler.go + mockgen -destination=./mock/gas-pricer.go -source=./chains/evm/gaspricer/gas-pricer.go -package mock + mockgen -destination=./mock/relayer.go -source=./relayer/relayer.go -package mock + mockgen -source=chains/evm/transactor/transact.go -destination=./mock/transact.go -package mock diff --git a/chains/evm/config/config.go b/chains/evm/config/config.go deleted file mode 100644 index 021b72f5..00000000 --- a/chains/evm/config/config.go +++ /dev/null @@ -1,120 +0,0 @@ -package config - -import ( - "fmt" - "math/big" - "time" - - "github.com/creasty/defaults" - "github.com/ethereum/go-ethereum/crypto" - "github.com/mitchellh/mapstructure" - - "github.com/ChainSafe/sygma-core/config/chain" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" -) - -type HandlerConfig struct { - Address string - Type string -} - -type EVMConfig struct { - GeneralChainConfig chain.ChainConfig - Bridge string - Handlers []HandlerConfig - MaxGasPrice *big.Int - GasMultiplier *big.Float - GasLimit *big.Int - GasIncreasePercentage *big.Int - StartBlock *big.Int - BlockConfirmations *big.Int - BlockInterval *big.Int - BlockRetryInterval time.Duration -} - -func (c *EVMConfig) String() string { - privateKey, _ := crypto.HexToECDSA(c.GeneralChainConfig.Key) - kp := secp256k1.NewKeypair(*privateKey) - return fmt.Sprintf(`Name: '%s', Id: '%d', Type: '%s', BlockstorePath: '%s', FreshStart: '%t', LatestBlock: '%t', Key address: '%s', Bridge: '%s', Handlers: %+v, MaxGasPrice: '%s', GasMultiplier: '%s', GasLimit: '%s', StartBlock: '%s', BlockConfirmations: '%s', BlockInterval: '%s', BlockRetryInterval: '%s'`, - c.GeneralChainConfig.Name, - *c.GeneralChainConfig.Id, - c.GeneralChainConfig.Type, - c.GeneralChainConfig.BlockstorePath, - c.GeneralChainConfig.FreshStart, - c.GeneralChainConfig.LatestBlock, - kp.Address(), - c.Bridge, - c.Handlers, - c.MaxGasPrice, - c.GasMultiplier, - c.GasLimit, - c.StartBlock, - c.BlockConfirmations, - c.BlockInterval, - c.BlockRetryInterval, - ) -} - -type RawEVMConfig struct { - chain.ChainConfig `mapstructure:",squash"` - Bridge string `mapstructure:"bridge"` - Handlers []HandlerConfig `mapstrcture:"handlers"` - MaxGasPrice int64 `mapstructure:"maxGasPrice" default:"500000000000"` - GasMultiplier float64 `mapstructure:"gasMultiplier" default:"1"` - GasIncreasePercentage int64 `mapstructure:"gasIncreasePercentage" default:"15"` - GasLimit int64 `mapstructure:"gasLimit" default:"2000000"` - StartBlock int64 `mapstructure:"startBlock"` - BlockConfirmations int64 `mapstructure:"blockConfirmations" default:"10"` - BlockInterval int64 `mapstructure:"blockInterval" default:"5"` - BlockRetryInterval uint64 `mapstructure:"blockRetryInterval" default:"5"` -} - -func (c *RawEVMConfig) Validate() error { - if err := c.ChainConfig.Validate(); err != nil { - return err - } - if c.Bridge == "" { - return fmt.Errorf("required field chain.Bridge empty for chain %v", *c.Id) - } - if c.BlockConfirmations != 0 && c.BlockConfirmations < 1 { - return fmt.Errorf("blockConfirmations has to be >=1") - } - return nil -} - -// NewEVMConfig decodes and validates an instance of an EVMConfig from -// raw chain config -func NewEVMConfig(chainConfig map[string]interface{}) (*EVMConfig, error) { - var c RawEVMConfig - err := mapstructure.Decode(chainConfig, &c) - if err != nil { - return nil, err - } - - err = defaults.Set(&c) - if err != nil { - return nil, err - } - - err = c.Validate() - if err != nil { - return nil, err - } - - c.ChainConfig.ParseFlags() - config := &EVMConfig{ - GeneralChainConfig: c.ChainConfig, - Handlers: c.Handlers, - Bridge: c.Bridge, - BlockRetryInterval: time.Duration(c.BlockRetryInterval) * time.Second, - GasLimit: big.NewInt(c.GasLimit), - MaxGasPrice: big.NewInt(c.MaxGasPrice), - GasIncreasePercentage: big.NewInt(c.GasIncreasePercentage), - GasMultiplier: big.NewFloat(c.GasMultiplier), - StartBlock: big.NewInt(c.StartBlock), - BlockConfirmations: big.NewInt(c.BlockConfirmations), - BlockInterval: big.NewInt(c.BlockInterval), - } - - return config, nil -} diff --git a/chains/evm/config/config_test.go b/chains/evm/config/config_test.go deleted file mode 100644 index a3ff4162..00000000 --- a/chains/evm/config/config_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// The Licensed Work is (c) 2022 Sygma -// SPDX-License-Identifier: LGPL-3.0-only - -package config_test - -import ( - "math/big" - "testing" - "time" - - "github.com/ChainSafe/sygma-core/chains/evm/config" - "github.com/ChainSafe/sygma-core/config/chain" - "github.com/stretchr/testify/suite" -) - -type NewEVMConfigTestSuite struct { - suite.Suite -} - -func TestRunNewEVMConfigTestSuite(t *testing.T) { - suite.Run(t, new(NewEVMConfigTestSuite)) -} - -func (s *NewEVMConfigTestSuite) Test_FailedDecode() { - _, err := config.NewEVMConfig(map[string]interface{}{ - "gasLimit": "invalid", - }) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_FailedGeneralConfigValidation() { - _, err := config.NewEVMConfig(map[string]interface{}{}) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_FailedEVMConfigValidation() { - _, err := config.NewEVMConfig(map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - }) - - s.NotNil(err) -} - -func (s *NewEVMConfigTestSuite) Test_InvalidBlockConfirmation() { - _, err := config.NewEVMConfig(map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - "blockConfirmations": -1, - }) - - s.NotNil(err) - s.Equal(err.Error(), "blockConfirmations has to be >=1") -} - -func (s *NewEVMConfigTestSuite) Test_ValidConfig() { - rawConfig := map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - } - - actualConfig, err := config.NewEVMConfig(rawConfig) - - id := new(uint8) - *id = 1 - s.Nil(err) - s.Equal(*actualConfig, config.EVMConfig{ - GeneralChainConfig: chain.GeneralChainConfig{ - Name: "evm1", - Endpoint: "ws://domain.com", - Id: id, - }, - Bridge: "bridgeAddress", - GasLimit: big.NewInt(2000000), - MaxGasPrice: big.NewInt(500000000000), - GasMultiplier: big.NewFloat(1), - GasIncreasePercentage: big.NewInt(15), - StartBlock: big.NewInt(0), - BlockConfirmations: big.NewInt(10), - BlockInterval: big.NewInt(5), - BlockRetryInterval: time.Duration(5) * time.Second, - }) -} - -func (s *NewEVMConfigTestSuite) Test_ValidConfigWithCustomTxParams() { - rawConfig := map[string]interface{}{ - "id": 1, - "endpoint": "ws://domain.com", - "name": "evm1", - "from": "address", - "bridge": "bridgeAddress", - "handlers": []config.HandlerConfig{ - { - Type: "erc20", - Address: "address1", - }, - { - Type: "erc721", - Address: "address2", - }, - }, - "maxGasPrice": 1000, - "gasMultiplier": 1000, - "gasIncreasePercentage": 20, - "gasLimit": 1000, - "startBlock": 1000, - "blockConfirmations": 10, - "blockRetryInterval": 10, - "blockInterval": 2, - } - - actualConfig, err := config.NewEVMConfig(rawConfig) - - id := new(uint8) - *id = 1 - s.Nil(err) - s.Equal(*actualConfig, config.EVMConfig{ - GeneralChainConfig: chain.GeneralChainConfig{ - Name: "evm1", - Endpoint: "ws://domain.com", - Id: id, - }, - Bridge: "bridgeAddress", - Handlers: []config.HandlerConfig{ - { - Type: "erc20", - Address: "address1", - }, - { - Type: "erc721", - Address: "address2", - }, - }, - GasLimit: big.NewInt(1000), - MaxGasPrice: big.NewInt(1000), - GasMultiplier: big.NewFloat(1000), - GasIncreasePercentage: big.NewInt(20), - StartBlock: big.NewInt(1000), - BlockConfirmations: big.NewInt(10), - BlockInterval: big.NewInt(2), - BlockRetryInterval: time.Duration(10) * time.Second, - }) -} diff --git a/chains/evm/contracts/contract_test.go b/chains/evm/contracts/contract_test.go index f404d456..03c232ba 100644 --- a/chains/evm/contracts/contract_test.go +++ b/chains/evm/contracts/contract_test.go @@ -6,7 +6,6 @@ import ( "strings" "testing" - "github.com/ChainSafe/sygma-core/chains/evm/consts" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" @@ -16,6 +15,9 @@ import ( "github.com/stretchr/testify/suite" ) +const testABI = `[{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"address[]","name":"initialRelayers","type":"address[]"},{"internalType":"uint256","name":"initialRelayerThreshold","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"handlerResponse","type":"bytes"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"lowLevelData","type":"bytes"}],"name":"FailedHandlerExecution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"RelayerThresholdChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RELAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_depositCounts","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_domainID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_expiry","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_relayerThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToHandlerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"getRoleMemberIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isValidForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint72","name":"destNonce","type":"uint72"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"_hasVotedOnProposal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"renounceAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminPauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminUnpauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"adminChangeRelayerThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminAddRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminRemoveRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"depositFunctionSig","type":"bytes4"},{"internalType":"uint256","name":"depositFunctionDepositerOffset","type":"uint256"},{"internalType":"bytes4","name":"executeFunctionSig","type":"bytes4"}],"name":"adminSetGenericResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"adminSetDepositNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"bool","name":"valid","type":"bool"}],"name":"adminSetForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"originDomainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"getProposal","outputs":[{"components":[{"internalType":"enum Bridge.ProposalStatus","name":"_status","type":"uint8"},{"internalType":"uint200","name":"_yesVotes","type":"uint200"},{"internalType":"uint8","name":"_yesVotesTotal","type":"uint8"},{"internalType":"uint40","name":"_proposedBlock","type":"uint40"}],"internalType":"struct Bridge.Proposal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalRelayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"adminChangeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"voteProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"cancelProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bool","name":"revertOnFail","type":"bool"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"addrs","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]` +const testBin = "0x60806040523480156200001157600080fd5b5060405162003622380380620036228339810160408190526200003491620004db565b6000805460ff199081169091556002805490911660ff871617905562000066836200018a602090811b62001ef917901c565b600260016101000a81548160ff021916908360ff1602179055506200009682620001e760201b62001f501760201c565b6002806101000a8154816001600160801b0302191690836001600160801b03160217905550620000d1816200023e60201b62001fa51760201c565b6002805464ffffffffff92909216600160901b0264ffffffffff60901b199092169190911790556200010e60006200010862000297565b620002da565b60005b84518110156200017e57620001697fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4868381518110620001555762000155620005e4565b6020026020010151620002ea60201b60201c565b806200017581620005fa565b91505062000111565b50505050505062000624565b60006101008210620001e35760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e203820626974730000000060448201526064015b60405180910390fd5b5090565b6000600160801b8210620001e35760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401620001da565b6000650100000000008210620001e35760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401620001da565b60003360143610801590620002c457506001600160a01b03811660009081526005602052604090205460ff165b15620002d5575060131936013560601c5b919050565b620002e6828262000377565b5050565b60008281526001602052604090206002015462000311906200030b62000297565b620003f2565b620002da5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401620001da565b60008281526001602090815260409091206200039e91839062001ffc62000421821b17901c565b15620002e657620003ae62000297565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526001602090815260408220620004189184906200201162000438821b17901c565b90505b92915050565b600062000418836001600160a01b0384166200045b565b6001600160a01b0381166000908152600183016020526040812054151562000418565b6000818152600183016020526040812054620004a4575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200041b565b5060006200041b565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002d557600080fd5b600080600080600060a08688031215620004f457600080fd5b855160ff811681146200050657600080fd5b602087810151919650906001600160401b03808211156200052657600080fd5b818901915089601f8301126200053b57600080fd5b815181811115620005505762000550620004ad565b8060051b604051601f19603f83011681018181108582111715620005785762000578620004ad565b60405291825284820192508381018501918c8311156200059757600080fd5b938501935b82851015620005c057620005b085620004c3565b845293850193928501926200059c565b60408c015160608d01516080909d01519b9e919d509b9a9950975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200061d57634e487b7160e01b600052601160045260246000fd5b5060010190565b612fee80620006346000396000f3fe6080604052600436106102465760003560e01c806391c404ac11610139578063c5b37c22116100b6578063d15ef64e1161007a578063d15ef64e1461074f578063d547741f1461076f578063d7a9cd791461078f578063edc20c3c146107ae578063f8c39e44146107ce578063ffaac0eb146107fe57600080fd5b8063c5b37c2214610676578063c5ec8970146106b4578063ca15c873146106ef578063cb10f2151461070f578063cdb0f73a1461072f57600080fd5b80639debb3bd116100fd5780639debb3bd146105df578063a217fddf146105f4578063a9cf69fa14610609578063bd2a182014610636578063c0331b3e1461065657600080fd5b806391c404ac1461053157806391d1485414610551578063926d7d7f146105715780639d82dd63146105935780639dd694f4146105b357600080fd5b8063541d5548116101c7578063802aabe81161018b578063802aabe81461047957806380ae1c281461048e57806384db809f146104a35780638c0c2631146104f15780639010d07c1461051157600080fd5b8063541d5548146103d15780635a1ad87c146104015780635c975abb146104215780635e1fab0f146104395780637febe63f1461045957600080fd5b806336568abe1161020e57806336568abe146103035780634603ae38146103235780634b0b919d146103435780634e056005146103915780634e0df3f6146103b157600080fd5b806305e2ca171461024b57806317f03ce514610260578063206a98fd14610280578063248a9ca3146102a05780632f2ff15d146102e3575b600080fd5b61025e6102593660046126c3565b610813565b005b34801561026c57600080fd5b5061025e61027b366004612733565b610a0e565b34801561028c57600080fd5b5061025e61029b36600461277f565b610ca1565b3480156102ac57600080fd5b506102d06102bb3660046127fb565b60009081526001602052604090206002015490565b6040519081526020015b60405180910390f35b3480156102ef57600080fd5b5061025e6102fe366004612829565b610f29565b34801561030f57600080fd5b5061025e61031e366004612829565b610fb9565b34801561032f57600080fd5b5061025e61033e36600461289d565b611043565b34801561034f57600080fd5b5061037961035e3660046128fc565b6003602052600090815260409020546001600160401b031681565b6040516001600160401b0390911681526020016102da565b34801561039d57600080fd5b5061025e6103ac3660046127fb565b6110e7565b3480156103bd57600080fd5b506102d06103cc366004612829565b61114a565b3480156103dd57600080fd5b506103f16103ec366004612917565b611176565b60405190151581526020016102da565b34801561040d57600080fd5b5061025e61041c36600461294c565b611190565b34801561042d57600080fd5b5060005460ff166103f1565b34801561044557600080fd5b5061025e610454366004612917565b611246565b34801561046557600080fd5b506103f16104743660046129aa565b6112d2565b34801561048557600080fd5b506102d0611378565b34801561049a57600080fd5b5061025e611396565b3480156104af57600080fd5b506104d96104be3660046127fb565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b3480156104fd57600080fd5b5061025e61050c3660046129fa565b6113b0565b34801561051d57600080fd5b506104d961052c366004612a28565b61141c565b34801561053d57600080fd5b5061025e61054c3660046127fb565b61143b565b34801561055d57600080fd5b506103f161056c366004612829565b6114d5565b34801561057d57600080fd5b506102d0600080516020612f9983398151915281565b34801561059f57600080fd5b5061025e6105ae366004612917565b6114ed565b3480156105bf57600080fd5b506002546105cd9060ff1681565b60405160ff90911681526020016102da565b3480156105eb57600080fd5b506102d060c881565b34801561060057600080fd5b506102d0600081565b34801561061557600080fd5b50610629610624366004612733565b6115a2565b6040516102da9190612a82565b34801561064257600080fd5b5061025e610651366004612b38565b611670565b34801561066257600080fd5b5061025e610671366004612bca565b6116a6565b34801561068257600080fd5b5060025461069c906201000090046001600160801b031681565b6040516001600160801b0390911681526020016102da565b3480156106c057600080fd5b506002546106d990600160901b900464ffffffffff1681565b60405164ffffffffff90911681526020016102da565b3480156106fb57600080fd5b506102d061070a3660046127fb565b611bc1565b34801561071b57600080fd5b5061025e61072a366004612c38565b611bd8565b34801561073b57600080fd5b5061025e61074a366004612917565b611c6c565b34801561075b57600080fd5b5061025e61076a366004612c58565b611d72565b34801561077b57600080fd5b5061025e61078a366004612829565b611da5565b34801561079b57600080fd5b506002546105cd90610100900460ff1681565b3480156107ba57600080fd5b5061025e6107c9366004612c8d565b611e28565b3480156107da57600080fd5b506103f16107e9366004612917565b60056020526000908152604090205460ff1681565b34801561080a57600080fd5b5061025e611ee1565b61081b612033565b6002546201000090046001600160801b031634146108795760405162461bcd60e51b8152602060048201526016602482015275125b98dbdc9c9958dd08199959481cdd5c1c1b1a595960521b60448201526064015b60405180910390fd5b6000838152600460205260409020546001600160a01b0316806108de5760405162461bcd60e51b815260206004820181905260248201527f7265736f757263654944206e6f74206d617070656420746f2068616e646c65726044820152606401610870565b60ff8516600090815260036020526040812080548290610906906001600160401b0316612ccd565b91906101000a8154816001600160401b0302191690836001600160401b03160217905590506000610935612079565b60405163b07e54bb60e01b815290915083906000906001600160a01b0383169063b07e54bb9061096f908b9087908c908c90600401612d1d565b6000604051808303816000875af115801561098e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109b69190810190612d82565b9050826001600160a01b03167f17bc3181e17a9620a479c24e6c606e474ba84fc036877b768926872e8cd0e11f8a8a878b8b876040516109fb96959493929190612e1b565b60405180910390a2505050505050505050565b610a166120ba565b60ff838116600884901b68ffffffffffffffff0016176000818152600660209081526040808320868452909152808220815160808101909252805493949293919290918391166004811115610a6d57610a6d612a4a565b6004811115610a7e57610a7e612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015280519091506001816004811115610ad157610ad1612a4a565b1480610aee57506002816004811115610aec57610aec612a4a565b145b610b3a5760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2063616e6e6f742062652063616e63656c6c6564000000006044820152606401610870565b600254606083015164ffffffffff600160901b909204821691610b5f9143911661213e565b64ffffffffff1611610bb35760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206e6f7420617420657870697279207468726573686f6c646044820152606401610870565b600480835268ffffffffffffffffff841660009081526006602090815260408083208884529091529020835181548593839160ff1916906001908490811115610bfe57610bfe612a4a565b02179055506020820151815460408085015160609095015164ffffffffff16600160d81b026001600160d81b0360ff909616600160d01b0260ff60d01b196001600160c81b039095166101000294909416610100600160d81b031990931692909217929092179390931692909217905551600080516020612f7983398151915290610c9190889088906004908990612e6c565b60405180910390a1505050505050565b610ca9612180565b610cb1612033565b60008281526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff0060088a901b1660ff8b1617929091610cf99185918a918a9101612ea1565b60408051601f19818403018152918152815160209283012068ffffffffffffffffff851660009081526006845282812082825290935291209091506002815460ff166004811115610d4c57610d4c612a4a565b14610d995760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206d757374206861766520506173736564207374617475736044820152606401610870565b805460ff19166003178155838515610e125760405163712467f960e11b81526001600160a01b0382169063e248cff290610ddb908a908d908d90600401612ecd565b600060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b50505050610eef565b60405163712467f960e11b81526001600160a01b0382169063e248cff290610e42908a908d908d90600401612ecd565b600060405180830381600087803b158015610e5c57600080fd5b505af1925050508015610e6d575060015b610eef573d808015610e9b576040519150601f19603f3d011682016040523d82523d6000602084013e610ea0565b606091505b50825460ff191660021783556040517fbd37c1f0d53bb2f33fe4c2104de272fcdeb4d2fef3acdbf1e4ddc3d6833ca37690610edc908390612ee7565b60405180910390a1505050505050610f21565b600080516020612f798339815191528b8b600386604051610f139493929190612e6c565b60405180910390a150505050505b505050505050565b600082815260016020526040902060020154610f479061056c612079565b610fab5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401610870565b610fb582826121e6565b5050565b610fc1612079565b6001600160a01b0316816001600160a01b0316146110395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610870565b610fb5828261224f565b61104b6122b8565b60005b838110156110e05784848281811061106857611068612efa565b905060200201602081019061107d9190612917565b6001600160a01b03166108fc84848481811061109b5761109b612efa565b905060200201359081150290604051600060405180830381858888f193505050501580156110cd573d6000803e3d6000fd5b50806110d881612f10565b91505061104e565b5050505050565b6110ef6122b8565b6110f881611ef9565b6002805460ff929092166101000261ff00199092169190911790556040518181527fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c8906020015b60405180910390a150565b60008281526001602081815260408084206001600160a01b038616855290920190529020545b92915050565b6000611170600080516020612f99833981519152836114d5565b6111986122b8565b60008581526004602081905260409182902080546001600160a01b0319166001600160a01b038a8116918217909255925163de319d9960e01b8152918201889052861660248201526001600160e01b03198086166044830152606482018590528316608482015287919063de319d999060a401600060405180830381600087803b15801561122557600080fd5b505af1158015611239573d6000803e3d6000fd5b5050505050505050505050565b61124e6122b8565b6000611258612079565b9050816001600160a01b0316816001600160a01b031614156112bc5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656e6f756e6365206f6e6573656c660000000000000000006044820152606401610870565b6112c7600083610f29565b610fb5600082610fb9565b68ffffffffffffffffff831660009081526006602090815260408083208584529091528082208151608081019092528054611370929190829060ff16600481111561131f5761131f612a4a565b600481111561133057611330612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015283612311565b949350505050565b6000611391600080516020612f99833981519152611bc1565b905090565b61139e6122b8565b6113ae6113a9612079565b612334565b565b6113b86122b8565b6040516307b7ed9960e01b81526001600160a01b0382811660048301528391908216906307b7ed99906024015b600060405180830381600087803b1580156113ff57600080fd5b505af1158015611413573d6000803e3d6000fd5b50505050505050565b60008281526001602052604081206114349083612382565b9392505050565b6114436122b8565b6002546201000090046001600160801b03168114156114a45760405162461bcd60e51b815260206004820152601f60248201527f43757272656e742066656520697320657175616c20746f206e657720666565006044820152606401610870565b6114ad81611f50565b6002806101000a8154816001600160801b0302191690836001600160801b0316021790555050565b60008281526001602052604081206114349083612011565b611505600080516020612f99833981519152826114d5565b6115515760405162461bcd60e51b815260206004820152601f60248201527f6164647220646f65736e277420686176652072656c6179657220726f6c6521006044820152606401610870565b611569600080516020612f9983398151915282611da5565b6040516001600160a01b03821681527f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b9060200161113f565b60408051608081018252600080825260208201819052918101829052606081019190915260ff848116600885901b68ffffffffffffffff0016176000818152600660209081526040808320878452909152908190208151608081019092528054929391929091839116600481111561161c5761161c612a4a565b600481111561162d5761162d612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015295945050505050565b6116786122b8565b60405163025a3c9960e21b815282906001600160a01b03821690630968f264906113e5908590600401612ee7565b6116ae612180565b6116b6612033565b60008381526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff00600889901b1660ff8a16179290916116fe9185918891889101612ea1565b60408051601f19818403018152828252805160209182012068ffffffffffffffffff861660009081526006835283812082825290925282822060808501909352825490945090929190829060ff16600481111561175d5761175d612a4a565b600481111561176e5761176e612a4a565b8152905461010081046001600160c81b0316602080840191909152600160d01b820460ff16604080850191909152600160d81b90920464ffffffffff1660609093019290925260008a815260049092529020549091506001600160a01b03166118195760405162461bcd60e51b815260206004820152601960248201527f6e6f2068616e646c657220666f72207265736f757263654944000000000000006044820152606401610870565b60028151600481111561182e5761182e612a4a565b141561184c57611843898988888b6001610ca1565b505050506110e0565b6000611856612079565b905060018260000151600481111561187057611870612a4a565b11156118ca5760405162461bcd60e51b815260206004820152602360248201527f70726f706f73616c20616c72656164792065786563757465642f63616e63656c6044820152621b195960ea1b6064820152608401610870565b6118d48282612311565b156119195760405162461bcd60e51b81526020600482015260156024820152741c995b185e595c88185b1c9958591e481d9bdd1959605a1b6044820152606401610870565b60008251600481111561192e5761192e612a4a565b141561198e576040805160808101825260018082526000602083018190528284015264ffffffffff431660608301529151909350600080516020612f7983398151915291611981918d918d918890612e6c565b60405180910390a16119f0565b600254606083015164ffffffffff600160901b9092048216916119b39143911661213e565b64ffffffffff1611156119f0576004808352604051600080516020612f79833981519152916119e7918d918d918890612e6c565b60405180910390a15b600482516004811115611a0557611a05612a4a565b14611ad557611a2a611a168261238e565b83602001516001600160c81b0316176123bc565b6001600160c81b0316602083015260408201805190611a4882612f2b565b60ff1690525081516040517f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b957434364091611a84918d918d918890612e6c565b60405180910390a1600254604083015160ff6101009092048216911610611ad5576002808352604051600080516020612f7983398151915291611acc918d918d918890612e6c565b60405180910390a15b68ffffffffffffffffff8416600090815260066020908152604080832086845290915290208251815484929190829060ff19166001836004811115611b1c57611b1c612a4a565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b0319909216919091179190911792909216919091179055600282516004811115611ba057611ba0612a4a565b1415611bb557611bb58a8a89898c6000610ca1565b50505050505050505050565b600081815260016020526040812061117090612411565b611be06122b8565b60008281526004602081905260409182902080546001600160a01b0319166001600160a01b038781169182179092559251635c7d1b9b60e11b81529182018590528316602482015284919063b8fa373690604401600060405180830381600087803b158015611c4e57600080fd5b505af1158015611c62573d6000803e3d6000fd5b5050505050505050565b611c84600080516020612f99833981519152826114d5565b15611cd15760405162461bcd60e51b815260206004820152601e60248201527f6164647220616c7265616479206861732072656c6179657220726f6c652100006044820152606401610870565b60c8611cdb611378565b10611d215760405162461bcd60e51b81526020600482015260166024820152751c995b185e595c9cc81b1a5b5a5d081c995858da195960521b6044820152606401610870565b611d39600080516020612f9983398151915282610f29565b6040516001600160a01b03821681527f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c59060200161113f565b611d7a6122b8565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600082815260016020526040902060020154611dc39061056c612079565b6110395760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b6064820152608401610870565b611e306122b8565b60ff82166000908152600360205260409020546001600160401b0390811690821611611ead5760405162461bcd60e51b815260206004820152602660248201527f446f6573206e6f7420616c6c6f772064656372656d656e7473206f6620746865604482015265206e6f6e636560d01b6064820152608401610870565b60ff919091166000908152600360205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b611ee96122b8565b6113ae611ef4612079565b61241b565b60006101008210611f4c5760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e20382062697473000000006044820152606401610870565b5090565b6000600160801b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401610870565b6000650100000000008210611f4c5760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401610870565b6000611434836001600160a01b038416612466565b6001600160a01b03811660009081526001830160205260408120541515611434565b60005460ff16156113ae5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610870565b600033601436108015906120a557506001600160a01b03811660009081526005602052604090205460ff165b156120b5575060131936013560601c5b919050565b60006120c4612079565b90506120d16000826114d5565b806120ef57506120ef600080516020612f99833981519152826114d5565b61213b5760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206973206e6f742072656c61796572206f722061646d696e00006044820152606401610870565b50565b600061143483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124b5565b61219a600080516020612f9983398151915261056c612079565b6113ae5760405162461bcd60e51b815260206004820181905260248201527f73656e64657220646f65736e277420686176652072656c6179657220726f6c656044820152606401610870565b60008281526001602052604090206121fe9082611ffc565b15610fb55761220b612079565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260016020526040902061226790826124ef565b15610fb557612274612079565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6122c5600061056c612079565b6113ae5760405162461bcd60e51b815260206004820152601e60248201527f73656e64657220646f65736e277420686176652061646d696e20726f6c6500006044820152606401610870565b60008083602001516001600160c81b031661232b8461238e565b16119392505050565b61233c612033565b6000805460ff191660011790556040516001600160a01b03821681527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200161113f565b60006114348383612504565b60006123b26123ab600080516020612f998339815191528461114a565b600161213e565b6001901b92915050565b6000600160c81b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20323030206269747300006044820152606401610870565b6000611170825490565b61242361252e565b6000805460ff191690556040516001600160a01b03821681527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200161113f565b60008181526001830160205260408120546124ad57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611170565b506000611170565b600081848411156124d95760405162461bcd60e51b81526004016108709190612ee7565b5060006124e68486612f4b565b95945050505050565b6000611434836001600160a01b038416612577565b600082600001828154811061251b5761251b612efa565b9060005260206000200154905092915050565b60005460ff166113ae5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610870565b6000818152600183016020526040812054801561266057600061259b600183612f4b565b85549091506000906125af90600190612f4b565b90508181146126145760008660000182815481106125cf576125cf612efa565b90600052602060002001549050808760000184815481106125f2576125f2612efa565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061262557612625612f62565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611170565b6000915050611170565b803560ff811681146120b557600080fd5b60008083601f84011261268d57600080fd5b5081356001600160401b038111156126a457600080fd5b6020830191508360208285010111156126bc57600080fd5b9250929050565b600080600080606085870312156126d957600080fd5b6126e28561266a565b93506020850135925060408501356001600160401b0381111561270457600080fd5b6127108782880161267b565b95989497509550505050565b80356001600160401b03811681146120b557600080fd5b60008060006060848603121561274857600080fd5b6127518461266a565b925061275f6020850161271c565b9150604084013590509250925092565b803580151581146120b557600080fd5b60008060008060008060a0878903121561279857600080fd5b6127a18761266a565b95506127af6020880161271c565b945060408701356001600160401b038111156127ca57600080fd5b6127d689828a0161267b565b909550935050606087013591506127ef6080880161276f565b90509295509295509295565b60006020828403121561280d57600080fd5b5035919050565b6001600160a01b038116811461213b57600080fd5b6000806040838503121561283c57600080fd5b82359150602083013561284e81612814565b809150509250929050565b60008083601f84011261286b57600080fd5b5081356001600160401b0381111561288257600080fd5b6020830191508360208260051b85010111156126bc57600080fd5b600080600080604085870312156128b357600080fd5b84356001600160401b03808211156128ca57600080fd5b6128d688838901612859565b909650945060208701359150808211156128ef57600080fd5b5061271087828801612859565b60006020828403121561290e57600080fd5b6114348261266a565b60006020828403121561292957600080fd5b813561143481612814565b80356001600160e01b0319811681146120b557600080fd5b60008060008060008060c0878903121561296557600080fd5b863561297081612814565b955060208701359450604087013561298781612814565b935061299560608801612934565b9250608087013591506127ef60a08801612934565b6000806000606084860312156129bf57600080fd5b833568ffffffffffffffffff811681146129d857600080fd5b92506020840135915060408401356129ef81612814565b809150509250925092565b60008060408385031215612a0d57600080fd5b8235612a1881612814565b9150602083013561284e81612814565b60008060408385031215612a3b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60058110612a7e57634e487b7160e01b600052602160045260246000fd5b9052565b6000608082019050612a95828451612a60565b60018060c81b03602084015116602083015260ff604084015116604083015264ffffffffff606084015116606083015292915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612b0957612b09612acb565b604052919050565b60006001600160401b03821115612b2a57612b2a612acb565b50601f01601f191660200190565b60008060408385031215612b4b57600080fd5b8235612b5681612814565b915060208301356001600160401b03811115612b7157600080fd5b8301601f81018513612b8257600080fd5b8035612b95612b9082612b11565b612ae1565b818152866020838501011115612baa57600080fd5b816020840160208301376000602083830101528093505050509250929050565b600080600080600060808688031215612be257600080fd5b612beb8661266a565b9450612bf96020870161271c565b93506040860135925060608601356001600160401b03811115612c1b57600080fd5b612c278882890161267b565b969995985093965092949392505050565b600080600060608486031215612c4d57600080fd5b83356129d881612814565b60008060408385031215612c6b57600080fd5b8235612c7681612814565b9150612c846020840161276f565b90509250929050565b60008060408385031215612ca057600080fd5b612ca98361266a565b9150612c846020840161271c565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b0380831681811415612cea57612cea612cb7565b6001019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160a01b0384166020820152606060408201819052600090612d489083018486612cf4565b9695505050505050565b60005b83811015612d6d578181015183820152602001612d55565b83811115612d7c576000848401525b50505050565b600060208284031215612d9457600080fd5b81516001600160401b03811115612daa57600080fd5b8201601f81018413612dbb57600080fd5b8051612dc9612b9082612b11565b818152856020838501011115612dde57600080fd5b6124e6826020830160208601612d52565b60008151808452612e07816020860160208601612d52565b601f01601f19169290920160200192915050565b60ff871681528560208201526001600160401b038516604082015260a060608201526000612e4d60a083018587612cf4565b8281036080840152612e5f8185612def565b9998505050505050505050565b60ff851681526001600160401b038416602082015260808101612e926040830185612a60565b82606083015295945050505050565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b8381526040602082015260006124e6604083018486612cf4565b6020815260006114346020830184612def565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612f2457612f24612cb7565b5060010190565b600060ff821660ff811415612f4257612f42612cb7565b60010192915050565b600082821015612f5d57612f5d612cb7565b500390565b634e487b7160e01b600052603160045260246000fdfe968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d5e2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4a2646970667358221220b709f2194f4c148f513f57a45e4ba5a064bdbf9c8e2385faecd3a9e498f2bc3164736f6c634300080b0033" + type ContractTestSuite struct { suite.Suite gomockController *gomock.Controller @@ -35,8 +37,8 @@ func (s *ContractTestSuite) SetupTest() { s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) // Use ERC721 contract ABI inside the contract test - a, _ := abi.JSON(strings.NewReader(consts.ERC721PresetMinterPauserABI)) - b := common.FromHex(consts.ERC721PresetMinterPauserBin) + a, _ := abi.JSON(strings.NewReader(testABI)) + b := common.FromHex(testBin) s.contract = NewContract( common.Address{}, a, b, s.mockContractCallerDispatcherClient, s.mockTransactor, ) diff --git a/config/chain/config.go b/config/chain/config.go deleted file mode 100644 index b4f53381..00000000 --- a/config/chain/config.go +++ /dev/null @@ -1,49 +0,0 @@ -package chain - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/flags" - "github.com/spf13/viper" -) - -type ChainConfig struct { - Name string `mapstructure:"name"` - Id *uint8 `mapstructure:"id"` - Endpoint string `mapstructure:"endpoint"` - Type string `mapstructure:"type"` - BlockstorePath string `mapstructure:"blockstorePath"` - FreshStart bool `mapstructure:"fresh"` - LatestBlock bool `mapstructure:"latest"` - Key string - Insecure bool -} - -func (c *ChainConfig) Validate() error { - // viper defaults to 0 for not specified ints - if c.Id == nil { - return fmt.Errorf("required field domain.Id empty for chain %v", c.Id) - } - if c.Endpoint == "" { - return fmt.Errorf("required field chain.Endpoint empty for chain %v", *c.Id) - } - if c.Name == "" { - return fmt.Errorf("required field chain.Name empty for chain %v", *c.Id) - } - return nil -} - -func (c *ChainConfig) ParseFlags() { - blockstore := viper.GetString(flags.BlockstoreFlagName) - if blockstore != "" { - c.BlockstorePath = blockstore - } - freshStart := viper.GetBool(flags.FreshStartFlagName) - if freshStart { - c.FreshStart = freshStart - } - latestBlock := viper.GetBool(flags.LatestBlockFlagName) - if latestBlock { - c.LatestBlock = latestBlock - } -} diff --git a/config/chain/config_test.go b/config/chain/config_test.go deleted file mode 100644 index e4e02a35..00000000 --- a/config/chain/config_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package chain - -import ( - "testing" -) - -func TestValidateConfig(t *testing.T) { - var id uint8 = 1 - valid := ChainConfig{ - Name: "chain", - Id: &id, - Endpoint: "endpoint", - } - - missingEndpoint := ChainConfig{ - Name: "chain", - Id: &id, - Endpoint: "", - } - - missingName := ChainConfig{ - Name: "", - Id: &id, - Endpoint: "endpoint", - } - - missingId := ChainConfig{ - Name: "chain", - Endpoint: "endpoint", - } - - err := valid.Validate() - if err != nil { - t.Fatal(err) - } - - err = missingEndpoint.Validate() - if err == nil { - t.Fatalf("must require endpoint field, %v", err) - } - - err = missingName.Validate() - if err == nil { - t.Fatal("must require name field") - } - - err = missingId.Validate() - if err == nil { - t.Fatalf("must require domain id field, %v", err) - } -} diff --git a/config/config.go b/config/config.go deleted file mode 100644 index e20d6456..00000000 --- a/config/config.go +++ /dev/null @@ -1,58 +0,0 @@ -package config - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/config/relayer" - "github.com/creasty/defaults" - "github.com/spf13/viper" -) - -type Config struct { - RelayerConfig relayer.RelayerConfig - ChainConfigs []map[string]interface{} -} - -type RawConfig struct { - RelayerConfig relayer.RawRelayerConfig `mapstructure:"relayer" json:"relayer"` - ChainConfigs []map[string]interface{} `mapstructure:"chains" json:"chains"` -} - -// GetConfig reads config from file, validates it and parses -// it into config suitable for application -func GetConfig(path string) (Config, error) { - rawConfig := RawConfig{} - config := Config{} - - viper.SetConfigFile(path) - viper.SetConfigType("json") - - err := viper.ReadInConfig() - if err != nil { - return config, err - } - - err = viper.Unmarshal(&rawConfig) - if err != nil { - return config, err - } - - if err := defaults.Set(&rawConfig); err != nil { - return config, err - } - - relayerConfig, err := relayer.NewRelayerConfig(rawConfig.RelayerConfig) - if err != nil { - return config, err - } - for _, chain := range rawConfig.ChainConfigs { - if chain["type"] == "" || chain["type"] == nil { - return config, fmt.Errorf("Chain 'type' must be provided for every configured chain") - } - } - - config.RelayerConfig = relayerConfig - config.ChainConfigs = rawConfig.ChainConfigs - - return config, nil -} diff --git a/config/config_test.go b/config/config_test.go deleted file mode 100644 index d1f02886..00000000 --- a/config/config_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package config_test - -import ( - "encoding/json" - "os" - "testing" - - "github.com/ChainSafe/sygma-core/config" - "github.com/ChainSafe/sygma-core/config/relayer" - "github.com/stretchr/testify/suite" -) - -type GetConfigTestSuite struct { - suite.Suite -} - -func TestRunGetConfigTestSuite(t *testing.T) { - suite.Run(t, new(GetConfigTestSuite)) -} - -func (s *GetConfigTestSuite) Test_InvalidPath() { - _, err := config.GetConfig("invalid") - - s.NotNil(err) -} - -func (s *GetConfigTestSuite) Test_MissingChainType() { - data := config.RawConfig{ - ChainConfigs: []map[string]interface{}{{ - "name": "chain1", - }}, - } - file, _ := json.Marshal(data) - _ = os.WriteFile("test.json", file, 0644) - - _, err := config.GetConfig("test.json") - _ = os.Remove("test.json") - s.NotNil(err) - s.Equal(err.Error(), "Chain 'type' must be provided for every configured chain") -} - -func (s *GetConfigTestSuite) Test_InvalidRelayerConfig() { - data := config.RawConfig{ - RelayerConfig: relayer.RawRelayerConfig{ - LogLevel: "invalid", - }, - ChainConfigs: []map[string]interface{}{{ - "name": "chain1", - }}, - } - file, _ := json.Marshal(data) - _ = os.WriteFile("test.json", file, 0644) - - _, err := config.GetConfig("test.json") - - _ = os.Remove("test.json") - s.NotNil(err) - s.Equal(err.Error(), "unknown log level: invalid") -} - -func (s *GetConfigTestSuite) Test_ValidConfig() { - data := config.RawConfig{ - RelayerConfig: relayer.RawRelayerConfig{ - LogLevel: "info", - }, - ChainConfigs: []map[string]interface{}{{ - "type": "evm", - "name": "evm1", - }}, - } - file, _ := json.Marshal(data) - _ = os.WriteFile("test.json", file, 0644) - - actualConfig, err := config.GetConfig("test.json") - - _ = os.Remove("test.json") - s.Nil(err) - s.Equal(actualConfig, config.Config{ - RelayerConfig: relayer.RelayerConfig{ - LogLevel: 1, - LogFile: "out.log", - OpenTelemetryCollectorURL: "", - }, - ChainConfigs: []map[string]interface{}{{ - "type": "evm", - "name": "evm1", - }}, - }) -} diff --git a/config/relayer/config.go b/config/relayer/config.go deleted file mode 100644 index d50e1428..00000000 --- a/config/relayer/config.go +++ /dev/null @@ -1,49 +0,0 @@ -package relayer - -import ( - "fmt" - - "github.com/rs/zerolog" -) - -type RelayerConfig struct { - OpenTelemetryCollectorURL string - LogLevel zerolog.Level - LogFile string - Env string - Id string -} - -type RawRelayerConfig struct { - OpenTelemetryCollectorURL string `mapstructure:"OpenTelemetryCollectorURL" json:"opentelemetryCollectorURL"` - LogLevel string `mapstructure:"LogLevel" json:"logLevel" default:"info"` - LogFile string `mapstructure:"LogFile" json:"logFile" default:"out.log"` - Env string `mapstructure:"Env" json:"env"` - Id string `mapstructure:"Id" json:"id"` -} - -func (c *RawRelayerConfig) Validate() error { - return nil -} - -// NewRelayerConfig parses RawRelayerConfig into RelayerConfig -func NewRelayerConfig(rawConfig RawRelayerConfig) (RelayerConfig, error) { - config := RelayerConfig{} - err := rawConfig.Validate() - if err != nil { - return config, err - } - - logLevel, err := zerolog.ParseLevel(rawConfig.LogLevel) - if err != nil { - return config, fmt.Errorf("unknown log level: %s", rawConfig.LogLevel) - } - config.LogLevel = logLevel - - config.LogFile = rawConfig.LogFile - config.OpenTelemetryCollectorURL = rawConfig.OpenTelemetryCollectorURL - config.Env = rawConfig.Env - config.Id = rawConfig.Id - - return config, nil -} diff --git a/flags/flags.go b/flags/flags.go deleted file mode 100644 index 6a80df4a..00000000 --- a/flags/flags.go +++ /dev/null @@ -1,32 +0,0 @@ -package flags - -import ( - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var ( - // Flags for running the Chainbridge app - ConfigFlagName = "config" - KeystoreFlagName = "keystore" - BlockstoreFlagName = "blockstore" - FreshStartFlagName = "fresh" - LatestBlockFlagName = "latest" -) - -func BindFlags(rootCMD *cobra.Command) { - rootCMD.PersistentFlags().String(ConfigFlagName, ".", "Path to JSON configuration file") - _ = viper.BindPFlag(ConfigFlagName, rootCMD.PersistentFlags().Lookup(ConfigFlagName)) - - rootCMD.PersistentFlags().String(BlockstoreFlagName, "./lvldbdata", "Specify path for blockstore") - _ = viper.BindPFlag(BlockstoreFlagName, rootCMD.PersistentFlags().Lookup(BlockstoreFlagName)) - - rootCMD.PersistentFlags().Bool(FreshStartFlagName, false, "Disables loading from blockstore at start. Opts will still be used if specified. (default: false)") - _ = viper.BindPFlag(FreshStartFlagName, rootCMD.PersistentFlags().Lookup(FreshStartFlagName)) - - rootCMD.PersistentFlags().Bool(LatestBlockFlagName, false, "Overrides blockstore and start block, starts from latest block (default: false)") - _ = viper.BindPFlag(LatestBlockFlagName, rootCMD.PersistentFlags().Lookup(LatestBlockFlagName)) - - rootCMD.PersistentFlags().String(KeystoreFlagName, "./keys", "Path to keystore directory") - _ = viper.BindPFlag(KeystoreFlagName, rootCMD.PersistentFlags().Lookup(KeystoreFlagName)) -} diff --git a/types/proposal.go b/types/proposal.go index d70656aa..47673ee3 100644 --- a/types/proposal.go +++ b/types/proposal.go @@ -1,11 +1,6 @@ package types -import ( - "github.com/ChainSafe/chainbridge-core/relayer/message" - "github.com/ChainSafe/chainbridge-core/types" -) - -func NewProposal(source, destination uint8, depositNonce uint64, resourceId types.ResourceID, data []byte, metadata message.Metadata) *Proposal { +func NewProposal(source, destination uint8, depositNonce uint64, resourceId ResourceID, data []byte, metadata Metadata) *Proposal { return &Proposal{ OriginDomainID: source, DepositNonce: depositNonce, @@ -19,8 +14,8 @@ func NewProposal(source, destination uint8, depositNonce uint64, resourceId type type Proposal struct { OriginDomainID uint8 DepositNonce uint64 - ResourceID types.ResourceID + ResourceID ResourceID Data []byte Destination uint8 - Metadata message.Metadata + Metadata Metadata } From 9ad8df7933cf4a254b375646702a39facf7326c1 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 17:13:22 +0200 Subject: [PATCH 13/27] Move keyring to crypto module --- {keystore => crypto/keyring}/keyring.go | 0 {keystore => crypto/keyring}/keyring_test.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {keystore => crypto/keyring}/keyring.go (100%) rename {keystore => crypto/keyring}/keyring_test.go (100%) diff --git a/keystore/keyring.go b/crypto/keyring/keyring.go similarity index 100% rename from keystore/keyring.go rename to crypto/keyring/keyring.go diff --git a/keystore/keyring_test.go b/crypto/keyring/keyring_test.go similarity index 100% rename from keystore/keyring_test.go rename to crypto/keyring/keyring_test.go From f16fd6b37edd98c2baf9b52df49bd0801b98a8f4 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 29 Sep 2023 17:19:05 +0200 Subject: [PATCH 14/27] Move modules related to transactions to transactor module --- chains/evm/{ => transactor}/gas/gas-pricer.go | 0 chains/evm/{ => transactor}/gas/london.go | 0 chains/evm/{ => transactor}/gas/london_test.go | 0 chains/evm/{ => transactor}/gas/static.go | 0 chains/evm/{ => transactor}/gas/static_test.go | 0 chains/evm/transactor/monitored/monitored.go | 2 +- chains/evm/transactor/monitored/monitored_test.go | 2 +- chains/evm/transactor/signAndSend/signAndSend.go | 2 +- chains/evm/transactor/signAndSend/signAndSend_test.go | 2 +- chains/evm/{ => transactor}/transaction/transaction.go | 0 chains/evm/{ => transactor}/transaction/transaction_test.go | 0 {logger => observability}/logger.go | 2 +- {opentelemetry => observability}/metrics.go | 2 +- {lvldb => store/lvldb}/lvldb.go | 0 14 files changed, 6 insertions(+), 6 deletions(-) rename chains/evm/{ => transactor}/gas/gas-pricer.go (100%) rename chains/evm/{ => transactor}/gas/london.go (100%) rename chains/evm/{ => transactor}/gas/london_test.go (100%) rename chains/evm/{ => transactor}/gas/static.go (100%) rename chains/evm/{ => transactor}/gas/static_test.go (100%) rename chains/evm/{ => transactor}/transaction/transaction.go (100%) rename chains/evm/{ => transactor}/transaction/transaction_test.go (100%) rename {logger => observability}/logger.go (94%) rename {opentelemetry => observability}/metrics.go (99%) rename {lvldb => store/lvldb}/lvldb.go (100%) diff --git a/chains/evm/gas/gas-pricer.go b/chains/evm/transactor/gas/gas-pricer.go similarity index 100% rename from chains/evm/gas/gas-pricer.go rename to chains/evm/transactor/gas/gas-pricer.go diff --git a/chains/evm/gas/london.go b/chains/evm/transactor/gas/london.go similarity index 100% rename from chains/evm/gas/london.go rename to chains/evm/transactor/gas/london.go diff --git a/chains/evm/gas/london_test.go b/chains/evm/transactor/gas/london_test.go similarity index 100% rename from chains/evm/gas/london_test.go rename to chains/evm/transactor/gas/london_test.go diff --git a/chains/evm/gas/static.go b/chains/evm/transactor/gas/static.go similarity index 100% rename from chains/evm/gas/static.go rename to chains/evm/transactor/gas/static.go diff --git a/chains/evm/gas/static_test.go b/chains/evm/transactor/gas/static_test.go similarity index 100% rename from chains/evm/gas/static_test.go rename to chains/evm/transactor/gas/static_test.go diff --git a/chains/evm/transactor/monitored/monitored.go b/chains/evm/transactor/monitored/monitored.go index 70a67d50..e958d227 100644 --- a/chains/evm/transactor/monitored/monitored.go +++ b/chains/evm/transactor/monitored/monitored.go @@ -11,8 +11,8 @@ import ( "github.com/rs/zerolog/log" "github.com/ChainSafe/sygma-core/chains/evm/client" - "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" ) type GasPricer interface { diff --git a/chains/evm/transactor/monitored/monitored_test.go b/chains/evm/transactor/monitored/monitored_test.go index ba4a5c80..5603d4bc 100644 --- a/chains/evm/transactor/monitored/monitored_test.go +++ b/chains/evm/transactor/monitored/monitored_test.go @@ -8,10 +8,10 @@ import ( "time" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" - "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor/monitored" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" diff --git a/chains/evm/transactor/signAndSend/signAndSend.go b/chains/evm/transactor/signAndSend/signAndSend.go index 6ab68098..10531017 100644 --- a/chains/evm/transactor/signAndSend/signAndSend.go +++ b/chains/evm/transactor/signAndSend/signAndSend.go @@ -5,8 +5,8 @@ import ( "math/big" "github.com/ChainSafe/sygma-core/chains/evm/client" - "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog/log" ) diff --git a/chains/evm/transactor/signAndSend/signAndSend_test.go b/chains/evm/transactor/signAndSend/signAndSend_test.go index 9625d2f1..739e6dc1 100644 --- a/chains/evm/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/transactor/signAndSend/signAndSend_test.go @@ -5,10 +5,10 @@ import ( "testing" mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" - "github.com/ChainSafe/sygma-core/chains/evm/transaction" "github.com/ChainSafe/sygma-core/chains/evm/transactor" mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor/signAndSend" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" diff --git a/chains/evm/transaction/transaction.go b/chains/evm/transactor/transaction/transaction.go similarity index 100% rename from chains/evm/transaction/transaction.go rename to chains/evm/transactor/transaction/transaction.go diff --git a/chains/evm/transaction/transaction_test.go b/chains/evm/transactor/transaction/transaction_test.go similarity index 100% rename from chains/evm/transaction/transaction_test.go rename to chains/evm/transactor/transaction/transaction_test.go diff --git a/logger/logger.go b/observability/logger.go similarity index 94% rename from logger/logger.go rename to observability/logger.go index d1832286..49cca965 100644 --- a/logger/logger.go +++ b/observability/logger.go @@ -1,4 +1,4 @@ -package logger +package observability import ( "io" diff --git a/opentelemetry/metrics.go b/observability/metrics.go similarity index 99% rename from opentelemetry/metrics.go rename to observability/metrics.go index f3c92352..0d3d4397 100644 --- a/opentelemetry/metrics.go +++ b/observability/metrics.go @@ -1,4 +1,4 @@ -package opentelemetry +package observability import ( "context" diff --git a/lvldb/lvldb.go b/store/lvldb/lvldb.go similarity index 100% rename from lvldb/lvldb.go rename to store/lvldb/lvldb.go From 9a0f09e7f704f084c93a29d33491a51bd3a5ae6a Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 13:55:55 +0200 Subject: [PATCH 15/27] Fix tests and mocks --- Makefile | 5 +- chains/evm/contracts/contract.go | 24 - chains/evm/contracts/contract_test.go | 58 +- chains/evm/transactor/gas/gas-pricer.go | 2 +- chains/evm/transactor/gas/london.go | 2 +- chains/evm/transactor/gas/london_test.go | 12 +- chains/evm/transactor/gas/static.go | 2 +- chains/evm/transactor/gas/static_test.go | 19 +- .../transactor/monitored/monitored_test.go | 109 ++-- .../signAndSend/signAndSend_test.go | 33 +- .../transaction/transaction_test.go | 19 +- crypto/{keyring => keystore}/keyring.go | 0 crypto/{keyring => keystore}/keyring_test.go | 0 go.mod | 30 +- go.sum | 253 +-------- mock/client.go | 509 ++++++++++++++++++ mock/gas.go | 123 +++++ mock/relayer.go | 139 +++++ mock/signAndSend.go | 54 ++ mock/store.go | 142 +++++ mock/transact.go | 55 ++ relayer/relayer_test.go | 28 +- store/blockstore_test.go | 8 +- store/noncestore_test.go | 8 +- 24 files changed, 1154 insertions(+), 480 deletions(-) rename crypto/{keyring => keystore}/keyring.go (100%) rename crypto/{keyring => keystore}/keyring_test.go (100%) create mode 100644 mock/client.go create mode 100644 mock/gas.go create mode 100644 mock/relayer.go create mode 100644 mock/signAndSend.go create mode 100644 mock/store.go create mode 100644 mock/transact.go diff --git a/Makefile b/Makefile index 58a74db5..126841ab 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,9 @@ install-subkey: cargo install --force --git https://github.com/paritytech/substrate subkey genmocks: - mockgen -destination=./mock/gas-pricer.go -source=./chains/evm/gaspricer/gas-pricer.go -package mock + mockgen -destination=./mock/client.go -source=./chains/evm/client/client.go -package mock + mockgen -destination=./mock/gas.go -source=./chains/evm/transactor/gas/gas-pricer.go -package mock mockgen -destination=./mock/relayer.go -source=./relayer/relayer.go -package mock mockgen -source=chains/evm/transactor/transact.go -destination=./mock/transact.go -package mock + mockgen -source=chains/evm/transactor/signAndSend/signAndSend.go -destination=./mock/signAndSend.go -package mock + mockgen -source=./store/store.go -destination=./mock/store.go -package mock diff --git a/chains/evm/contracts/contract.go b/chains/evm/contracts/contract.go index d9a78a3a..105d251e 100644 --- a/chains/evm/contracts/contract.go +++ b/chains/evm/contracts/contract.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/rs/zerolog/log" ) @@ -108,26 +107,3 @@ func (c *Contract) CallContract(method string, args ...interface{}) ([]interface Msgf("method %s called", method) return c.UnpackResult(method, out) } - -func (c *Contract) DeployContract(params ...interface{}) (common.Address, error) { - input, err := c.PackMethod("", params...) - if err != nil { - return common.Address{}, err - } - opts := transactor.TransactOptions{GasLimit: DefaultDeployGasLimit} - hash, err := c.Transact(nil, append(c.bytecode, input...), opts) - if err != nil { - return common.Address{}, err - } - tx, _, err := c.client.GetTransactionByHash(*hash) - if err != nil { - return common.Address{}, err - } - address := crypto.CreateAddress(c.client.From(), tx.Nonce()) - c.contractAddress = address - log.Debug(). - Str("txHash", hash.String()). - Str("deployedAddress", address.String()). - Msgf("successful contract deployment") - return address, nil -} diff --git a/chains/evm/contracts/contract_test.go b/chains/evm/contracts/contract_test.go index 03c232ba..cd395b1a 100644 --- a/chains/evm/contracts/contract_test.go +++ b/chains/evm/contracts/contract_test.go @@ -6,24 +6,23 @@ import ( "strings" "testing" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" + "github.com/ChainSafe/sygma-core/mock" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" ) -const testABI = `[{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"address[]","name":"initialRelayers","type":"address[]"},{"internalType":"uint256","name":"initialRelayerThreshold","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"handlerResponse","type":"bytes"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"lowLevelData","type":"bytes"}],"name":"FailedHandlerExecution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"originDomainID","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":false,"internalType":"enum Bridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"RelayerThresholdChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RELAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_depositCounts","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_domainID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_expiry","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_relayerThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToHandlerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"getRoleMemberIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isValidForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint72","name":"destNonce","type":"uint72"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"_hasVotedOnProposal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"renounceAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminPauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminUnpauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"adminChangeRelayerThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminAddRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminRemoveRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"depositFunctionSig","type":"bytes4"},{"internalType":"uint256","name":"depositFunctionDepositerOffset","type":"uint256"},{"internalType":"bytes4","name":"executeFunctionSig","type":"bytes4"}],"name":"adminSetGenericResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"adminSetBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"adminSetDepositNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"bool","name":"valid","type":"bool"}],"name":"adminSetForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"originDomainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"getProposal","outputs":[{"components":[{"internalType":"enum Bridge.ProposalStatus","name":"_status","type":"uint8"},{"internalType":"uint200","name":"_yesVotes","type":"uint200"},{"internalType":"uint8","name":"_yesVotesTotal","type":"uint8"},{"internalType":"uint40","name":"_proposedBlock","type":"uint40"}],"internalType":"struct Bridge.Proposal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalRelayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"adminChangeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationDomainID","type":"uint8"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"voteProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"cancelProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"domainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bool","name":"revertOnFail","type":"bool"}],"name":"executeProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"addrs","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]` +const testABI = `[{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}]` const testBin = "0x60806040523480156200001157600080fd5b5060405162003622380380620036228339810160408190526200003491620004db565b6000805460ff199081169091556002805490911660ff871617905562000066836200018a602090811b62001ef917901c565b600260016101000a81548160ff021916908360ff1602179055506200009682620001e760201b62001f501760201c565b6002806101000a8154816001600160801b0302191690836001600160801b03160217905550620000d1816200023e60201b62001fa51760201c565b6002805464ffffffffff92909216600160901b0264ffffffffff60901b199092169190911790556200010e60006200010862000297565b620002da565b60005b84518110156200017e57620001697fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4868381518110620001555762000155620005e4565b6020026020010151620002ea60201b60201c565b806200017581620005fa565b91505062000111565b50505050505062000624565b60006101008210620001e35760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e203820626974730000000060448201526064015b60405180910390fd5b5090565b6000600160801b8210620001e35760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401620001da565b6000650100000000008210620001e35760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401620001da565b60003360143610801590620002c457506001600160a01b03811660009081526005602052604090205460ff165b15620002d5575060131936013560601c5b919050565b620002e6828262000377565b5050565b60008281526001602052604090206002015462000311906200030b62000297565b620003f2565b620002da5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401620001da565b60008281526001602090815260409091206200039e91839062001ffc62000421821b17901c565b15620002e657620003ae62000297565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526001602090815260408220620004189184906200201162000438821b17901c565b90505b92915050565b600062000418836001600160a01b0384166200045b565b6001600160a01b0381166000908152600183016020526040812054151562000418565b6000818152600183016020526040812054620004a4575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200041b565b5060006200041b565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002d557600080fd5b600080600080600060a08688031215620004f457600080fd5b855160ff811681146200050657600080fd5b602087810151919650906001600160401b03808211156200052657600080fd5b818901915089601f8301126200053b57600080fd5b815181811115620005505762000550620004ad565b8060051b604051601f19603f83011681018181108582111715620005785762000578620004ad565b60405291825284820192508381018501918c8311156200059757600080fd5b938501935b82851015620005c057620005b085620004c3565b845293850193928501926200059c565b60408c015160608d01516080909d01519b9e919d509b9a9950975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200061d57634e487b7160e01b600052601160045260246000fd5b5060010190565b612fee80620006346000396000f3fe6080604052600436106102465760003560e01c806391c404ac11610139578063c5b37c22116100b6578063d15ef64e1161007a578063d15ef64e1461074f578063d547741f1461076f578063d7a9cd791461078f578063edc20c3c146107ae578063f8c39e44146107ce578063ffaac0eb146107fe57600080fd5b8063c5b37c2214610676578063c5ec8970146106b4578063ca15c873146106ef578063cb10f2151461070f578063cdb0f73a1461072f57600080fd5b80639debb3bd116100fd5780639debb3bd146105df578063a217fddf146105f4578063a9cf69fa14610609578063bd2a182014610636578063c0331b3e1461065657600080fd5b806391c404ac1461053157806391d1485414610551578063926d7d7f146105715780639d82dd63146105935780639dd694f4146105b357600080fd5b8063541d5548116101c7578063802aabe81161018b578063802aabe81461047957806380ae1c281461048e57806384db809f146104a35780638c0c2631146104f15780639010d07c1461051157600080fd5b8063541d5548146103d15780635a1ad87c146104015780635c975abb146104215780635e1fab0f146104395780637febe63f1461045957600080fd5b806336568abe1161020e57806336568abe146103035780634603ae38146103235780634b0b919d146103435780634e056005146103915780634e0df3f6146103b157600080fd5b806305e2ca171461024b57806317f03ce514610260578063206a98fd14610280578063248a9ca3146102a05780632f2ff15d146102e3575b600080fd5b61025e6102593660046126c3565b610813565b005b34801561026c57600080fd5b5061025e61027b366004612733565b610a0e565b34801561028c57600080fd5b5061025e61029b36600461277f565b610ca1565b3480156102ac57600080fd5b506102d06102bb3660046127fb565b60009081526001602052604090206002015490565b6040519081526020015b60405180910390f35b3480156102ef57600080fd5b5061025e6102fe366004612829565b610f29565b34801561030f57600080fd5b5061025e61031e366004612829565b610fb9565b34801561032f57600080fd5b5061025e61033e36600461289d565b611043565b34801561034f57600080fd5b5061037961035e3660046128fc565b6003602052600090815260409020546001600160401b031681565b6040516001600160401b0390911681526020016102da565b34801561039d57600080fd5b5061025e6103ac3660046127fb565b6110e7565b3480156103bd57600080fd5b506102d06103cc366004612829565b61114a565b3480156103dd57600080fd5b506103f16103ec366004612917565b611176565b60405190151581526020016102da565b34801561040d57600080fd5b5061025e61041c36600461294c565b611190565b34801561042d57600080fd5b5060005460ff166103f1565b34801561044557600080fd5b5061025e610454366004612917565b611246565b34801561046557600080fd5b506103f16104743660046129aa565b6112d2565b34801561048557600080fd5b506102d0611378565b34801561049a57600080fd5b5061025e611396565b3480156104af57600080fd5b506104d96104be3660046127fb565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b3480156104fd57600080fd5b5061025e61050c3660046129fa565b6113b0565b34801561051d57600080fd5b506104d961052c366004612a28565b61141c565b34801561053d57600080fd5b5061025e61054c3660046127fb565b61143b565b34801561055d57600080fd5b506103f161056c366004612829565b6114d5565b34801561057d57600080fd5b506102d0600080516020612f9983398151915281565b34801561059f57600080fd5b5061025e6105ae366004612917565b6114ed565b3480156105bf57600080fd5b506002546105cd9060ff1681565b60405160ff90911681526020016102da565b3480156105eb57600080fd5b506102d060c881565b34801561060057600080fd5b506102d0600081565b34801561061557600080fd5b50610629610624366004612733565b6115a2565b6040516102da9190612a82565b34801561064257600080fd5b5061025e610651366004612b38565b611670565b34801561066257600080fd5b5061025e610671366004612bca565b6116a6565b34801561068257600080fd5b5060025461069c906201000090046001600160801b031681565b6040516001600160801b0390911681526020016102da565b3480156106c057600080fd5b506002546106d990600160901b900464ffffffffff1681565b60405164ffffffffff90911681526020016102da565b3480156106fb57600080fd5b506102d061070a3660046127fb565b611bc1565b34801561071b57600080fd5b5061025e61072a366004612c38565b611bd8565b34801561073b57600080fd5b5061025e61074a366004612917565b611c6c565b34801561075b57600080fd5b5061025e61076a366004612c58565b611d72565b34801561077b57600080fd5b5061025e61078a366004612829565b611da5565b34801561079b57600080fd5b506002546105cd90610100900460ff1681565b3480156107ba57600080fd5b5061025e6107c9366004612c8d565b611e28565b3480156107da57600080fd5b506103f16107e9366004612917565b60056020526000908152604090205460ff1681565b34801561080a57600080fd5b5061025e611ee1565b61081b612033565b6002546201000090046001600160801b031634146108795760405162461bcd60e51b8152602060048201526016602482015275125b98dbdc9c9958dd08199959481cdd5c1c1b1a595960521b60448201526064015b60405180910390fd5b6000838152600460205260409020546001600160a01b0316806108de5760405162461bcd60e51b815260206004820181905260248201527f7265736f757263654944206e6f74206d617070656420746f2068616e646c65726044820152606401610870565b60ff8516600090815260036020526040812080548290610906906001600160401b0316612ccd565b91906101000a8154816001600160401b0302191690836001600160401b03160217905590506000610935612079565b60405163b07e54bb60e01b815290915083906000906001600160a01b0383169063b07e54bb9061096f908b9087908c908c90600401612d1d565b6000604051808303816000875af115801561098e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109b69190810190612d82565b9050826001600160a01b03167f17bc3181e17a9620a479c24e6c606e474ba84fc036877b768926872e8cd0e11f8a8a878b8b876040516109fb96959493929190612e1b565b60405180910390a2505050505050505050565b610a166120ba565b60ff838116600884901b68ffffffffffffffff0016176000818152600660209081526040808320868452909152808220815160808101909252805493949293919290918391166004811115610a6d57610a6d612a4a565b6004811115610a7e57610a7e612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015280519091506001816004811115610ad157610ad1612a4a565b1480610aee57506002816004811115610aec57610aec612a4a565b145b610b3a5760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2063616e6e6f742062652063616e63656c6c6564000000006044820152606401610870565b600254606083015164ffffffffff600160901b909204821691610b5f9143911661213e565b64ffffffffff1611610bb35760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206e6f7420617420657870697279207468726573686f6c646044820152606401610870565b600480835268ffffffffffffffffff841660009081526006602090815260408083208884529091529020835181548593839160ff1916906001908490811115610bfe57610bfe612a4a565b02179055506020820151815460408085015160609095015164ffffffffff16600160d81b026001600160d81b0360ff909616600160d01b0260ff60d01b196001600160c81b039095166101000294909416610100600160d81b031990931692909217929092179390931692909217905551600080516020612f7983398151915290610c9190889088906004908990612e6c565b60405180910390a1505050505050565b610ca9612180565b610cb1612033565b60008281526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff0060088a901b1660ff8b1617929091610cf99185918a918a9101612ea1565b60408051601f19818403018152918152815160209283012068ffffffffffffffffff851660009081526006845282812082825290935291209091506002815460ff166004811115610d4c57610d4c612a4a565b14610d995760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206d757374206861766520506173736564207374617475736044820152606401610870565b805460ff19166003178155838515610e125760405163712467f960e11b81526001600160a01b0382169063e248cff290610ddb908a908d908d90600401612ecd565b600060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b50505050610eef565b60405163712467f960e11b81526001600160a01b0382169063e248cff290610e42908a908d908d90600401612ecd565b600060405180830381600087803b158015610e5c57600080fd5b505af1925050508015610e6d575060015b610eef573d808015610e9b576040519150601f19603f3d011682016040523d82523d6000602084013e610ea0565b606091505b50825460ff191660021783556040517fbd37c1f0d53bb2f33fe4c2104de272fcdeb4d2fef3acdbf1e4ddc3d6833ca37690610edc908390612ee7565b60405180910390a1505050505050610f21565b600080516020612f798339815191528b8b600386604051610f139493929190612e6c565b60405180910390a150505050505b505050505050565b600082815260016020526040902060020154610f479061056c612079565b610fab5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401610870565b610fb582826121e6565b5050565b610fc1612079565b6001600160a01b0316816001600160a01b0316146110395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610870565b610fb5828261224f565b61104b6122b8565b60005b838110156110e05784848281811061106857611068612efa565b905060200201602081019061107d9190612917565b6001600160a01b03166108fc84848481811061109b5761109b612efa565b905060200201359081150290604051600060405180830381858888f193505050501580156110cd573d6000803e3d6000fd5b50806110d881612f10565b91505061104e565b5050505050565b6110ef6122b8565b6110f881611ef9565b6002805460ff929092166101000261ff00199092169190911790556040518181527fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c8906020015b60405180910390a150565b60008281526001602081815260408084206001600160a01b038616855290920190529020545b92915050565b6000611170600080516020612f99833981519152836114d5565b6111986122b8565b60008581526004602081905260409182902080546001600160a01b0319166001600160a01b038a8116918217909255925163de319d9960e01b8152918201889052861660248201526001600160e01b03198086166044830152606482018590528316608482015287919063de319d999060a401600060405180830381600087803b15801561122557600080fd5b505af1158015611239573d6000803e3d6000fd5b5050505050505050505050565b61124e6122b8565b6000611258612079565b9050816001600160a01b0316816001600160a01b031614156112bc5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656e6f756e6365206f6e6573656c660000000000000000006044820152606401610870565b6112c7600083610f29565b610fb5600082610fb9565b68ffffffffffffffffff831660009081526006602090815260408083208584529091528082208151608081019092528054611370929190829060ff16600481111561131f5761131f612a4a565b600481111561133057611330612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015283612311565b949350505050565b6000611391600080516020612f99833981519152611bc1565b905090565b61139e6122b8565b6113ae6113a9612079565b612334565b565b6113b86122b8565b6040516307b7ed9960e01b81526001600160a01b0382811660048301528391908216906307b7ed99906024015b600060405180830381600087803b1580156113ff57600080fd5b505af1158015611413573d6000803e3d6000fd5b50505050505050565b60008281526001602052604081206114349083612382565b9392505050565b6114436122b8565b6002546201000090046001600160801b03168114156114a45760405162461bcd60e51b815260206004820152601f60248201527f43757272656e742066656520697320657175616c20746f206e657720666565006044820152606401610870565b6114ad81611f50565b6002806101000a8154816001600160801b0302191690836001600160801b0316021790555050565b60008281526001602052604081206114349083612011565b611505600080516020612f99833981519152826114d5565b6115515760405162461bcd60e51b815260206004820152601f60248201527f6164647220646f65736e277420686176652072656c6179657220726f6c6521006044820152606401610870565b611569600080516020612f9983398151915282611da5565b6040516001600160a01b03821681527f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b9060200161113f565b60408051608081018252600080825260208201819052918101829052606081019190915260ff848116600885901b68ffffffffffffffff0016176000818152600660209081526040808320878452909152908190208151608081019092528054929391929091839116600481111561161c5761161c612a4a565b600481111561162d5761162d612a4a565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015295945050505050565b6116786122b8565b60405163025a3c9960e21b815282906001600160a01b03821690630968f264906113e5908590600401612ee7565b6116ae612180565b6116b6612033565b60008381526004602090815260408083205490516001600160a01b039091169268ffffffffffffffff00600889901b1660ff8a16179290916116fe9185918891889101612ea1565b60408051601f19818403018152828252805160209182012068ffffffffffffffffff861660009081526006835283812082825290925282822060808501909352825490945090929190829060ff16600481111561175d5761175d612a4a565b600481111561176e5761176e612a4a565b8152905461010081046001600160c81b0316602080840191909152600160d01b820460ff16604080850191909152600160d81b90920464ffffffffff1660609093019290925260008a815260049092529020549091506001600160a01b03166118195760405162461bcd60e51b815260206004820152601960248201527f6e6f2068616e646c657220666f72207265736f757263654944000000000000006044820152606401610870565b60028151600481111561182e5761182e612a4a565b141561184c57611843898988888b6001610ca1565b505050506110e0565b6000611856612079565b905060018260000151600481111561187057611870612a4a565b11156118ca5760405162461bcd60e51b815260206004820152602360248201527f70726f706f73616c20616c72656164792065786563757465642f63616e63656c6044820152621b195960ea1b6064820152608401610870565b6118d48282612311565b156119195760405162461bcd60e51b81526020600482015260156024820152741c995b185e595c88185b1c9958591e481d9bdd1959605a1b6044820152606401610870565b60008251600481111561192e5761192e612a4a565b141561198e576040805160808101825260018082526000602083018190528284015264ffffffffff431660608301529151909350600080516020612f7983398151915291611981918d918d918890612e6c565b60405180910390a16119f0565b600254606083015164ffffffffff600160901b9092048216916119b39143911661213e565b64ffffffffff1611156119f0576004808352604051600080516020612f79833981519152916119e7918d918d918890612e6c565b60405180910390a15b600482516004811115611a0557611a05612a4a565b14611ad557611a2a611a168261238e565b83602001516001600160c81b0316176123bc565b6001600160c81b0316602083015260408201805190611a4882612f2b565b60ff1690525081516040517f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b957434364091611a84918d918d918890612e6c565b60405180910390a1600254604083015160ff6101009092048216911610611ad5576002808352604051600080516020612f7983398151915291611acc918d918d918890612e6c565b60405180910390a15b68ffffffffffffffffff8416600090815260066020908152604080832086845290915290208251815484929190829060ff19166001836004811115611b1c57611b1c612a4a565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b0319909216919091179190911792909216919091179055600282516004811115611ba057611ba0612a4a565b1415611bb557611bb58a8a89898c6000610ca1565b50505050505050505050565b600081815260016020526040812061117090612411565b611be06122b8565b60008281526004602081905260409182902080546001600160a01b0319166001600160a01b038781169182179092559251635c7d1b9b60e11b81529182018590528316602482015284919063b8fa373690604401600060405180830381600087803b158015611c4e57600080fd5b505af1158015611c62573d6000803e3d6000fd5b5050505050505050565b611c84600080516020612f99833981519152826114d5565b15611cd15760405162461bcd60e51b815260206004820152601e60248201527f6164647220616c7265616479206861732072656c6179657220726f6c652100006044820152606401610870565b60c8611cdb611378565b10611d215760405162461bcd60e51b81526020600482015260166024820152751c995b185e595c9cc81b1a5b5a5d081c995858da195960521b6044820152606401610870565b611d39600080516020612f9983398151915282610f29565b6040516001600160a01b03821681527f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c59060200161113f565b611d7a6122b8565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600082815260016020526040902060020154611dc39061056c612079565b6110395760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b6064820152608401610870565b611e306122b8565b60ff82166000908152600360205260409020546001600160401b0390811690821611611ead5760405162461bcd60e51b815260206004820152602660248201527f446f6573206e6f7420616c6c6f772064656372656d656e7473206f6620746865604482015265206e6f6e636560d01b6064820152608401610870565b60ff919091166000908152600360205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b611ee96122b8565b6113ae611ef4612079565b61241b565b60006101008210611f4c5760405162461bcd60e51b815260206004820152601c60248201527f76616c756520646f6573206e6f742066697420696e20382062697473000000006044820152606401610870565b5090565b6000600160801b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20313238206269747300006044820152606401610870565b6000650100000000008210611f4c5760405162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e20343020626974730000006044820152606401610870565b6000611434836001600160a01b038416612466565b6001600160a01b03811660009081526001830160205260408120541515611434565b60005460ff16156113ae5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610870565b600033601436108015906120a557506001600160a01b03811660009081526005602052604090205460ff165b156120b5575060131936013560601c5b919050565b60006120c4612079565b90506120d16000826114d5565b806120ef57506120ef600080516020612f99833981519152826114d5565b61213b5760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206973206e6f742072656c61796572206f722061646d696e00006044820152606401610870565b50565b600061143483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124b5565b61219a600080516020612f9983398151915261056c612079565b6113ae5760405162461bcd60e51b815260206004820181905260248201527f73656e64657220646f65736e277420686176652072656c6179657220726f6c656044820152606401610870565b60008281526001602052604090206121fe9082611ffc565b15610fb55761220b612079565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260016020526040902061226790826124ef565b15610fb557612274612079565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6122c5600061056c612079565b6113ae5760405162461bcd60e51b815260206004820152601e60248201527f73656e64657220646f65736e277420686176652061646d696e20726f6c6500006044820152606401610870565b60008083602001516001600160c81b031661232b8461238e565b16119392505050565b61233c612033565b6000805460ff191660011790556040516001600160a01b03821681527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200161113f565b60006114348383612504565b60006123b26123ab600080516020612f998339815191528461114a565b600161213e565b6001901b92915050565b6000600160c81b8210611f4c5760405162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e20323030206269747300006044820152606401610870565b6000611170825490565b61242361252e565b6000805460ff191690556040516001600160a01b03821681527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200161113f565b60008181526001830160205260408120546124ad57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611170565b506000611170565b600081848411156124d95760405162461bcd60e51b81526004016108709190612ee7565b5060006124e68486612f4b565b95945050505050565b6000611434836001600160a01b038416612577565b600082600001828154811061251b5761251b612efa565b9060005260206000200154905092915050565b60005460ff166113ae5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610870565b6000818152600183016020526040812054801561266057600061259b600183612f4b565b85549091506000906125af90600190612f4b565b90508181146126145760008660000182815481106125cf576125cf612efa565b90600052602060002001549050808760000184815481106125f2576125f2612efa565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061262557612625612f62565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611170565b6000915050611170565b803560ff811681146120b557600080fd5b60008083601f84011261268d57600080fd5b5081356001600160401b038111156126a457600080fd5b6020830191508360208285010111156126bc57600080fd5b9250929050565b600080600080606085870312156126d957600080fd5b6126e28561266a565b93506020850135925060408501356001600160401b0381111561270457600080fd5b6127108782880161267b565b95989497509550505050565b80356001600160401b03811681146120b557600080fd5b60008060006060848603121561274857600080fd5b6127518461266a565b925061275f6020850161271c565b9150604084013590509250925092565b803580151581146120b557600080fd5b60008060008060008060a0878903121561279857600080fd5b6127a18761266a565b95506127af6020880161271c565b945060408701356001600160401b038111156127ca57600080fd5b6127d689828a0161267b565b909550935050606087013591506127ef6080880161276f565b90509295509295509295565b60006020828403121561280d57600080fd5b5035919050565b6001600160a01b038116811461213b57600080fd5b6000806040838503121561283c57600080fd5b82359150602083013561284e81612814565b809150509250929050565b60008083601f84011261286b57600080fd5b5081356001600160401b0381111561288257600080fd5b6020830191508360208260051b85010111156126bc57600080fd5b600080600080604085870312156128b357600080fd5b84356001600160401b03808211156128ca57600080fd5b6128d688838901612859565b909650945060208701359150808211156128ef57600080fd5b5061271087828801612859565b60006020828403121561290e57600080fd5b6114348261266a565b60006020828403121561292957600080fd5b813561143481612814565b80356001600160e01b0319811681146120b557600080fd5b60008060008060008060c0878903121561296557600080fd5b863561297081612814565b955060208701359450604087013561298781612814565b935061299560608801612934565b9250608087013591506127ef60a08801612934565b6000806000606084860312156129bf57600080fd5b833568ffffffffffffffffff811681146129d857600080fd5b92506020840135915060408401356129ef81612814565b809150509250925092565b60008060408385031215612a0d57600080fd5b8235612a1881612814565b9150602083013561284e81612814565b60008060408385031215612a3b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60058110612a7e57634e487b7160e01b600052602160045260246000fd5b9052565b6000608082019050612a95828451612a60565b60018060c81b03602084015116602083015260ff604084015116604083015264ffffffffff606084015116606083015292915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612b0957612b09612acb565b604052919050565b60006001600160401b03821115612b2a57612b2a612acb565b50601f01601f191660200190565b60008060408385031215612b4b57600080fd5b8235612b5681612814565b915060208301356001600160401b03811115612b7157600080fd5b8301601f81018513612b8257600080fd5b8035612b95612b9082612b11565b612ae1565b818152866020838501011115612baa57600080fd5b816020840160208301376000602083830101528093505050509250929050565b600080600080600060808688031215612be257600080fd5b612beb8661266a565b9450612bf96020870161271c565b93506040860135925060608601356001600160401b03811115612c1b57600080fd5b612c278882890161267b565b969995985093965092949392505050565b600080600060608486031215612c4d57600080fd5b83356129d881612814565b60008060408385031215612c6b57600080fd5b8235612c7681612814565b9150612c846020840161276f565b90509250929050565b60008060408385031215612ca057600080fd5b612ca98361266a565b9150612c846020840161271c565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b0380831681811415612cea57612cea612cb7565b6001019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160a01b0384166020820152606060408201819052600090612d489083018486612cf4565b9695505050505050565b60005b83811015612d6d578181015183820152602001612d55565b83811115612d7c576000848401525b50505050565b600060208284031215612d9457600080fd5b81516001600160401b03811115612daa57600080fd5b8201601f81018413612dbb57600080fd5b8051612dc9612b9082612b11565b818152856020838501011115612dde57600080fd5b6124e6826020830160208601612d52565b60008151808452612e07816020860160208601612d52565b601f01601f19169290920160200192915050565b60ff871681528560208201526001600160401b038516604082015260a060608201526000612e4d60a083018587612cf4565b8281036080840152612e5f8185612def565b9998505050505050505050565b60ff851681526001600160401b038416602082015260808101612e926040830185612a60565b82606083015295945050505050565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b8381526040602082015260006124e6604083018486612cf4565b6020815260006114346020830184612def565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612f2457612f24612cb7565b5060010190565b600060ff821660ff811415612f4257612f42612cb7565b60010192915050565b600082821015612f5d57612f5d612cb7565b500390565b634e487b7160e01b600052603160045260246000fdfe968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d5e2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4a2646970667358221220b709f2194f4c148f513f57a45e4ba5a064bdbf9c8e2385faecd3a9e498f2bc3164736f6c634300080b0033" type ContractTestSuite struct { suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - contract Contract + gomockController *gomock.Controller + mockClient *mock.MockClient + mockTransactor *mock.MockTransactor + contract Contract } func TestRunContractTestSuite(t *testing.T) { @@ -34,13 +33,12 @@ func (s *ContractTestSuite) SetupSuite() {} func (s *ContractTestSuite) TearDownSuite() {} func (s *ContractTestSuite) SetupTest() { s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - // Use ERC721 contract ABI inside the contract test + s.mockTransactor = mock.NewMockTransactor(s.gomockController) + s.mockClient = mock.NewMockClient(s.gomockController) a, _ := abi.JSON(strings.NewReader(testABI)) b := common.FromHex(testBin) s.contract = NewContract( - common.Address{}, a, b, s.mockContractCallerDispatcherClient, s.mockTransactor, + common.Address{}, a, b, s.mockClient, s.mockTransactor, ) } func (s *ContractTestSuite) TearDownTest() {} @@ -105,12 +103,12 @@ func (s *ContractTestSuite) TestContract_ExecuteTransaction_InvalidRequest_Fail( } func (s *ContractTestSuite) TestContract_CallContract_CallContractError_Fail() { - s.mockContractCallerDispatcherClient.EXPECT().CallContract( + s.mockClient.EXPECT().CallContract( gomock.Any(), gomock.Any(), nil, ).Return(nil, errors.New("error")) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) + s.mockClient.EXPECT().From().Times(1).Return(common.Address{}) res, err := s.contract.CallContract("ownerOf", big.NewInt(0)) if err != nil { @@ -130,12 +128,12 @@ func (s *ContractTestSuite) TestContract_CallContract_InvalidRequest_Fail() { } func (s *ContractTestSuite) TestContract_CallContract_MissingContract_Fail() { - s.mockContractCallerDispatcherClient.EXPECT().CallContract( + s.mockClient.EXPECT().CallContract( gomock.Any(), gomock.Any(), nil, ).Return(nil, errors.New("error")) - s.mockContractCallerDispatcherClient.EXPECT().From().Times(1).Return(common.Address{}) + s.mockClient.EXPECT().From().Times(1).Return(common.Address{}) res, err := s.contract.CallContract("ownerOf", big.NewInt(0)) if err != nil { return @@ -143,31 +141,3 @@ func (s *ContractTestSuite) TestContract_CallContract_MissingContract_Fail() { s.Nil(res) s.Error(err, "error") } - -func (s *ContractTestSuite) TestContract_DeployContract_InvalidRequest_Fail() { - res, err := s.contract.DeployContract("invalid_param") - s.Equal(common.Address{}, res) - s.Error(err, "error") -} - -func (s *ContractTestSuite) TestContract_DeployContract_TransactionError_Fail() { - s.mockTransactor.EXPECT().Transact( - nil, gomock.Any(), gomock.Any(), - ).Times(1).Return(&common.Hash{}, errors.New("error")) - res, err := s.contract.DeployContract("TestERC721", "TST721", "") - s.Equal(common.Address{}, res) - s.Error(err, "error") -} - -func (s *ContractTestSuite) TestContract_DeployContract_GetTxByHashError_Fail() { - s.mockTransactor.EXPECT().Transact( - nil, gomock.Any(), gomock.Any(), - ).Times(1).Return(&common.Hash{}, nil) - s.mockContractCallerDispatcherClient.EXPECT().GetTransactionByHash( - common.Hash{}, - ).Return(nil, false, errors.New("error")) - - res, err := s.contract.DeployContract("TestERC721", "TST721", "") - s.Equal(common.Address{}, res) - s.Error(err, "error") -} diff --git a/chains/evm/transactor/gas/gas-pricer.go b/chains/evm/transactor/gas/gas-pricer.go index 48e5eab7..e7de49ca 100644 --- a/chains/evm/transactor/gas/gas-pricer.go +++ b/chains/evm/transactor/gas/gas-pricer.go @@ -1,4 +1,4 @@ -package gaspricer +package gas import ( "context" diff --git a/chains/evm/transactor/gas/london.go b/chains/evm/transactor/gas/london.go index 9a507284..08edb54e 100644 --- a/chains/evm/transactor/gas/london.go +++ b/chains/evm/transactor/gas/london.go @@ -1,4 +1,4 @@ -package gaspricer +package gas import ( "context" diff --git a/chains/evm/transactor/gas/london_test.go b/chains/evm/transactor/gas/london_test.go index 954b412a..182eb28c 100644 --- a/chains/evm/transactor/gas/london_test.go +++ b/chains/evm/transactor/gas/london_test.go @@ -1,18 +1,18 @@ -package gaspricer +package gas import ( "math/big" "testing" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" - - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" + + "github.com/ChainSafe/sygma-core/mock" ) type LondonGasPriceTestSuite struct { suite.Suite - gasPricerMock *mock_gaspricer.MockLondonGasClient + gasPricerMock *mock.MockLondonGasClient } func TestRuLondonTestSuite(t *testing.T) { @@ -23,7 +23,7 @@ func (s *LondonGasPriceTestSuite) SetupSuite() {} func (s *LondonGasPriceTestSuite) TearDownSuite() {} func (s *LondonGasPriceTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.gasPricerMock = mock_gaspricer.NewMockLondonGasClient(gomockController) + s.gasPricerMock = mock.NewMockLondonGasClient(gomockController) } func (s *LondonGasPriceTestSuite) TearDownTest() {} diff --git a/chains/evm/transactor/gas/static.go b/chains/evm/transactor/gas/static.go index 9fe4e26e..0e60510c 100644 --- a/chains/evm/transactor/gas/static.go +++ b/chains/evm/transactor/gas/static.go @@ -1,4 +1,4 @@ -package gaspricer +package gas import ( "context" diff --git a/chains/evm/transactor/gas/static_test.go b/chains/evm/transactor/gas/static_test.go index 9d1fa1ba..da15e869 100644 --- a/chains/evm/transactor/gas/static_test.go +++ b/chains/evm/transactor/gas/static_test.go @@ -1,38 +1,35 @@ -package gaspricer +package gas import ( "errors" "math/big" "testing" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" - - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "github.com/stretchr/testify/suite" + + "github.com/ChainSafe/sygma-core/mock" ) type StaticGasPriceTestSuite struct { suite.Suite - gasPricerMock *mock_gaspricer.MockGasPriceClient + gasPricerMock *mock.MockGasPriceClient } func TestRunTestSuite(t *testing.T) { suite.Run(t, new(StaticGasPriceTestSuite)) } -func (s *StaticGasPriceTestSuite) SetupSuite() {} -func (s *StaticGasPriceTestSuite) TearDownSuite() {} -func (s *StaticGasPriceTestSuite) SetupTest() { +func (s *StaticGasPriceTestSuite) SetupSuite() { gomockController := gomock.NewController(s.T()) - s.gasPricerMock = mock_gaspricer.NewMockGasPriceClient(gomockController) + s.gasPricerMock = mock.NewMockGasPriceClient(gomockController) } -func (s *StaticGasPriceTestSuite) TearDownTest() {} func (s *StaticGasPriceTestSuite) TestStaticGasPricerNoOpts() { twentyGwei := big.NewInt(20000000000) - gpd := NewStaticGasPriceDeterminant(s.gasPricerMock, nil) s.gasPricerMock.EXPECT().SuggestGasPrice(gomock.Any()).Return(twentyGwei, nil) + gpd := NewStaticGasPriceDeterminant(s.gasPricerMock, nil) res, err := gpd.GasPrice(nil) s.Nil(err) s.Equal(len(res), 1) diff --git a/chains/evm/transactor/monitored/monitored_test.go b/chains/evm/transactor/monitored/monitored_test.go index 5603d4bc..215c2da2 100644 --- a/chains/evm/transactor/monitored/monitored_test.go +++ b/chains/evm/transactor/monitored/monitored_test.go @@ -7,23 +7,22 @@ import ( "testing" "time" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor/monitored" "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" + "github.com/ChainSafe/sygma-core/mock" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" ) type TransactorTestSuite struct { suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - mockGasPricer *mock_calls.MockGasPricer + gomockController *gomock.Controller + mockClient *mock.MockClient + mockTransactor *mock.MockTransactor + mockGasPricer *mock.MockGasPricer } func TestMonitoredTransactorTestSuite(t *testing.T) { @@ -32,25 +31,25 @@ func TestMonitoredTransactorTestSuite(t *testing.T) { func (s *TransactorTestSuite) SetupTest() { s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.mockGasPricer = mock_calls.NewMockGasPricer(s.gomockController) + s.mockClient = mock.NewMockClient(s.gomockController) + s.mockTransactor = mock.NewMockTransactor(s.gomockController) + s.mockGasPricer = mock.NewMockGasPricer(s.gomockController) } func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(1000), big.NewInt(15)) txHash, err := t.Transact( @@ -66,16 +65,16 @@ func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { func (s *TransactorTestSuite) TestTransactor_SignAndSend_Fail() { var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{}, fmt.Errorf("error")) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{}, fmt.Errorf("error")) + s.mockClient.EXPECT().UnlockNonce() t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(1000), big.NewInt(15)) _, err := t.Transact( @@ -91,18 +90,18 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_SuccessfulExec var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} // Sending transaction - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(1000), big.NewInt(15)) @@ -113,7 +112,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_SuccessfulExec transactor.TransactOptions{}, ) // Transaction executed - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(&types.Receipt{ + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(&types.Receipt{ Status: types.ReceiptStatusSuccessful, }, nil) s.Nil(err) @@ -126,18 +125,18 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TxTimeout() { var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} // Sending transaction - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(1000), big.NewInt(15)) @@ -147,7 +146,7 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TxTimeout() { byteData, transactor.TransactOptions{}, ) - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) s.Nil(err) time.Sleep(time.Millisecond * 150) @@ -158,21 +157,21 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TransactionRes var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} // Sending transaction - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(10)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() // Resending transaction - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(1000), big.NewInt(15)) @@ -184,8 +183,8 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_TransactionRes ) s.Nil(err) - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), common.Hash{1, 2, 3, 4, 5}).Return(&types.Receipt{ + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), common.Hash{1, 2, 3, 4, 5}).Return(&types.Receipt{ Status: types.ReceiptStatusFailed, }, nil) @@ -197,21 +196,21 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_MaxGasPriceRea var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} // Sending transaction - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(11)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() // Resending transaction - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) ctx, cancel := context.WithCancel(context.Background()) t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(10), big.NewInt(15)) @@ -223,8 +222,8 @@ func (s *TransactorTestSuite) TestTransactor_MonitoredTransaction_MaxGasPriceRea ) s.Nil(err) - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) - s.mockContractCallerDispatcherClient.EXPECT().TransactionReceipt(gomock.Any(), common.Hash{1, 2, 3, 4, 5}).Return(&types.Receipt{ + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), *hash).Return(nil, fmt.Errorf("not found")) + s.mockClient.EXPECT().TransactionReceipt(gomock.Any(), common.Hash{1, 2, 3, 4, 5}).Return(&types.Receipt{ Status: types.ReceiptStatusFailed, }, nil) @@ -236,7 +235,7 @@ func (s *TransactorTestSuite) TestTransactor_IncreaseGas_15PercentIncrease() { t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(150), big.NewInt(15)) @@ -249,7 +248,7 @@ func (s *TransactorTestSuite) TestTransactor_IncreaseGas_MaxGasReached() { t := monitored.NewMonitoredTransactor( transaction.NewTransaction, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, big.NewInt(15), big.NewInt(15)) diff --git a/chains/evm/transactor/signAndSend/signAndSend_test.go b/chains/evm/transactor/signAndSend/signAndSend_test.go index 739e6dc1..09782ca0 100644 --- a/chains/evm/transactor/signAndSend/signAndSend_test.go +++ b/chains/evm/transactor/signAndSend/signAndSend_test.go @@ -4,23 +4,22 @@ import ( "math/big" "testing" - mock_calls "github.com/ChainSafe/sygma-core/chains/evm/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor" - mock_transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor/mock" "github.com/ChainSafe/sygma-core/chains/evm/transactor/signAndSend" "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" + "github.com/ChainSafe/sygma-core/mock" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" ) type TransactorTestSuite struct { suite.Suite - gomockController *gomock.Controller - mockContractCallerDispatcherClient *mock_calls.MockContractCallerDispatcher - mockTransactor *mock_transactor.MockTransactor - mockGasPricer *mock_calls.MockGasPricer + gomockController *gomock.Controller + mockClient *mock.MockClient + mockTransactor *mock.MockTransactor + mockGasPricer *mock.MockGasPricer } func TestSignAndSendTestSuite(t *testing.T) { @@ -31,27 +30,27 @@ func (s *TransactorTestSuite) SetupSuite() {} func (s *TransactorTestSuite) TearDownSuite() {} func (s *TransactorTestSuite) SetupTest() { s.gomockController = gomock.NewController(s.T()) - s.mockContractCallerDispatcherClient = mock_calls.NewMockContractCallerDispatcher(s.gomockController) - s.mockTransactor = mock_transactor.NewMockTransactor(s.gomockController) - s.mockGasPricer = mock_calls.NewMockGasPricer(s.gomockController) + s.mockClient = mock.NewMockClient(s.gomockController) + s.mockTransactor = mock.NewMockTransactor(s.gomockController) + s.mockGasPricer = mock.NewMockGasPricer(s.gomockController) } func (s *TransactorTestSuite) TestTransactor_SignAndSend_Success() { var byteData = []byte{47, 47, 241, 93, 159, 45, 240, 254, 210, 199, 118, 72, 222, 88, 96, 164, 204, 80, 140, 208, 129, 140, 133, 184, 184, 161, 171, 76, 238, 239, 141, 152, 28, 137, 86, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 48, 181, 109, 237, 4, 127, 230, 34, 95, 112, 4, 234, 75, 225, 174, 112, 201, 2, 106} - s.mockContractCallerDispatcherClient.EXPECT().LockNonce() - s.mockContractCallerDispatcherClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) + s.mockClient.EXPECT().LockNonce() + s.mockClient.EXPECT().UnsafeNonce().Return(big.NewInt(1), nil) s.mockGasPricer.EXPECT().GasPrice(gomock.Any()).Return([]*big.Int{big.NewInt(1)}, nil) - s.mockContractCallerDispatcherClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) - s.mockContractCallerDispatcherClient.EXPECT().TxReceipt(gomock.Any()).Return(&types.Receipt{}, nil) - s.mockContractCallerDispatcherClient.EXPECT().UnsafeIncreaseNonce().Return(nil) - s.mockContractCallerDispatcherClient.EXPECT().UnlockNonce() + s.mockClient.EXPECT().SignAndSendTransaction(gomock.Any(), gomock.Any()).Return(common.Hash{1, 2, 3, 4, 5}, nil) + s.mockClient.EXPECT().WaitAndReturnTxReceipt(gomock.Any()).Return(&types.Receipt{}, nil) + s.mockClient.EXPECT().UnsafeIncreaseNonce().Return(nil) + s.mockClient.EXPECT().UnlockNonce() txFabric := transaction.NewTransaction var trans = signAndSend.NewSignAndSendTransactor( txFabric, s.mockGasPricer, - s.mockContractCallerDispatcherClient, + s.mockClient, ) txHash, err := trans.Transact( &common.Address{}, diff --git a/chains/evm/transactor/transaction/transaction_test.go b/chains/evm/transactor/transaction/transaction_test.go index 323f43b8..f038021b 100644 --- a/chains/evm/transactor/transaction/transaction_test.go +++ b/chains/evm/transactor/transaction/transaction_test.go @@ -4,25 +4,24 @@ import ( "math/big" "testing" - gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer" - mock_gaspricer "github.com/ChainSafe/sygma-core/chains/evm/gaspricer/mock" - "github.com/ChainSafe/sygma-core/chains/evm/transaction" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/gas" + "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" + "github.com/ChainSafe/sygma-core/crypto/keystore" + "github.com/ChainSafe/sygma-core/mock" "github.com/ethereum/go-ethereum/core/types" - "github.com/ChainSafe/sygma-core/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" ) var aliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey] type EVMTxTestSuite struct { suite.Suite - client *mock_gaspricer.MockLondonGasClient + client *mock.MockLondonGasClient } func TestRunTestSuite(t *testing.T) { @@ -33,14 +32,14 @@ func (s *EVMTxTestSuite) SetupSuite() {} func (s *EVMTxTestSuite) TearDownSuite() {} func (s *EVMTxTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.client = mock_gaspricer.NewMockLondonGasClient(gomockController) + s.client = mock.NewMockLondonGasClient(gomockController) } func (s *EVMTxTestSuite) TearDownTest() {} func (s *EVMTxTestSuite) TestNewTransactionWithStaticGasPricer() { s.client.EXPECT().SuggestGasPrice(gomock.Any()).Return(big.NewInt(1000), nil) txFabric := transaction.NewTransaction - gasPriceClient := gaspricer.NewStaticGasPriceDeterminant(s.client, nil) + gasPriceClient := gas.NewStaticGasPriceDeterminant(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) tx, err := txFabric(1, &common.Address{}, big.NewInt(0), 10000, gp, []byte{}) @@ -57,7 +56,7 @@ func (s *EVMTxTestSuite) TestNewTransactionWithLondonGasPricer() { s.client.EXPECT().BaseFee().Return(big.NewInt(1000), nil) s.client.EXPECT().SuggestGasTipCap(gomock.Any()).Return(big.NewInt(1000), nil) txFabric := transaction.NewTransaction - gasPriceClient := gaspricer.NewLondonGasPriceClient(s.client, nil) + gasPriceClient := gas.NewLondonGasPriceClient(s.client, nil) gp, err := gasPriceClient.GasPrice(nil) s.Nil(err) tx, err := txFabric(1, &common.Address{}, big.NewInt(0), 10000, gp, []byte{}) diff --git a/crypto/keyring/keyring.go b/crypto/keystore/keyring.go similarity index 100% rename from crypto/keyring/keyring.go rename to crypto/keystore/keyring.go diff --git a/crypto/keyring/keyring_test.go b/crypto/keystore/keyring_test.go similarity index 100% rename from crypto/keyring/keyring_test.go rename to crypto/keystore/keyring_test.go diff --git a/go.mod b/go.mod index 4519c062..bbe681c1 100644 --- a/go.mod +++ b/go.mod @@ -4,21 +4,17 @@ go 1.19 require ( github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible - github.com/creasty/defaults v1.6.0 github.com/ethereum/go-ethereum v1.10.12 - github.com/golang/mock v1.6.0 github.com/imdario/mergo v0.3.12 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.25.0 - github.com/spf13/cobra v1.2.1 - github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.9.0 github.com/stretchr/testify v1.8.3 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.uber.org/mock v0.3.0 ) require ( @@ -34,14 +30,10 @@ require ( require ( github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect - github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/btcsuite/btcd v0.20.1-beta // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect - github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -49,31 +41,15 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.0 // indirect github.com/huin/goupnp v1.0.2 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect - github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559 // indirect - github.com/magiconair/properties v1.8.5 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mitchellh/mapstructure v1.4.2 - github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect - github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect + github.com/mitchellh/mapstructure v1.4.2 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/tsdb v0.7.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/spf13/afero v1.6.0 // indirect - github.com/spf13/cast v1.4.1 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect - github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef // indirect go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect @@ -84,8 +60,6 @@ require ( google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/ini.v1 v1.63.2 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 165ecb45..e7999232 100644 --- a/go.sum +++ b/go.sum @@ -15,16 +15,6 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -34,8 +24,6 @@ cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM7 cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -74,16 +62,11 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= @@ -96,8 +79,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxq github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= @@ -122,7 +103,6 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -130,7 +110,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -139,13 +118,9 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creasty/defaults v1.6.0 h1:ltuE9cfphUtlrBeomuu8PEyISTXnxqkBIoQfXgv7BSc= -github.com/creasty/defaults v1.6.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -173,9 +148,7 @@ github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVV github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -184,7 +157,6 @@ github.com/ethereum/go-ethereum v1.10.12 h1:el/KddB3gLEsnNgGQ3SQuZuiZjwnFTYHe5Tw github.com/ethereum/go-ethereum v1.10.12/go.mod h1:W3yfrFyL9C1pHcwY5hmRHVDaorTiQxhYBkKyu5mEDHw= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= @@ -204,10 +176,8 @@ github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= @@ -227,7 +197,6 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -243,9 +212,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -262,7 +228,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -282,18 +247,13 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -301,13 +261,6 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -315,7 +268,6 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -326,40 +278,13 @@ github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= @@ -370,10 +295,8 @@ github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI= github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= @@ -396,7 +319,6 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= @@ -406,10 +328,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559 h1:0VWDXPNE0brOek1Q8bLfzKkvOzwbQE/snjGojlCr8CY= github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -417,11 +337,8 @@ github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM52 github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -433,28 +350,21 @@ github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4F github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -464,25 +374,12 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -507,14 +404,9 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -524,12 +416,9 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -556,9 +445,6 @@ github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II= github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= @@ -570,23 +456,9 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= -github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 h1:6OJQqOTH8b/bIa3Z5vwzX/HgdZLV3TJqivpmiUgw6DI= github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86/go.mod h1:EyC0vqnPRbDQGq3j4Ej9lSP/nKE8DwwjTwfQ0Yan6SQ= @@ -599,12 +471,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= @@ -628,16 +497,11 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 h1:t4ZwRPU+emrcvM2e9DHd0Fsf0JTPVcbfa/BhTDF03d0= @@ -658,20 +522,16 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -679,7 +539,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -708,8 +567,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -718,15 +575,11 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -738,7 +591,6 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -756,15 +608,10 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= @@ -773,17 +620,6 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -794,14 +630,11 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -815,11 +648,8 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -828,7 +658,6 @@ golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -843,32 +672,18 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -906,10 +721,8 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -933,21 +746,10 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -976,25 +778,12 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1027,28 +816,6 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= @@ -1064,23 +831,12 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1099,14 +855,10 @@ google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= @@ -1124,7 +876,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/mock/client.go b/mock/client.go new file mode 100644 index 00000000..81eb1efb --- /dev/null +++ b/mock/client.go @@ -0,0 +1,509 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./chains/evm/client/client.go +// +// Generated by this command: +// +// mockgen -destination=./mock/client.go -source=./chains/evm/client/client.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + big "math/big" + reflect "reflect" + + client "github.com/ChainSafe/sygma-core/chains/evm/client" + common "github.com/ethereum/go-ethereum/common" + types "github.com/ethereum/go-ethereum/core/types" + gomock "go.uber.org/mock/gomock" +) + +// MockContractCaller is a mock of ContractCaller interface. +type MockContractCaller struct { + ctrl *gomock.Controller + recorder *MockContractCallerMockRecorder +} + +// MockContractCallerMockRecorder is the mock recorder for MockContractCaller. +type MockContractCallerMockRecorder struct { + mock *MockContractCaller +} + +// NewMockContractCaller creates a new mock instance. +func NewMockContractCaller(ctrl *gomock.Controller) *MockContractCaller { + mock := &MockContractCaller{ctrl: ctrl} + mock.recorder = &MockContractCallerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockContractCaller) EXPECT() *MockContractCallerMockRecorder { + return m.recorder +} + +// CallContract mocks base method. +func (m *MockContractCaller) CallContract(ctx context.Context, callArgs map[string]any, blockNumber *big.Int) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CallContract", ctx, callArgs, blockNumber) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CallContract indicates an expected call of CallContract. +func (mr *MockContractCallerMockRecorder) CallContract(ctx, callArgs, blockNumber any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockContractCaller)(nil).CallContract), ctx, callArgs, blockNumber) +} + +// CodeAt mocks base method. +func (m *MockContractCaller) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CodeAt", ctx, contract, blockNumber) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CodeAt indicates an expected call of CodeAt. +func (mr *MockContractCallerMockRecorder) CodeAt(ctx, contract, blockNumber any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CodeAt", reflect.TypeOf((*MockContractCaller)(nil).CodeAt), ctx, contract, blockNumber) +} + +// MockTransactionDispatcher is a mock of TransactionDispatcher interface. +type MockTransactionDispatcher struct { + ctrl *gomock.Controller + recorder *MockTransactionDispatcherMockRecorder +} + +// MockTransactionDispatcherMockRecorder is the mock recorder for MockTransactionDispatcher. +type MockTransactionDispatcherMockRecorder struct { + mock *MockTransactionDispatcher +} + +// NewMockTransactionDispatcher creates a new mock instance. +func NewMockTransactionDispatcher(ctrl *gomock.Controller) *MockTransactionDispatcher { + mock := &MockTransactionDispatcher{ctrl: ctrl} + mock.recorder = &MockTransactionDispatcherMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTransactionDispatcher) EXPECT() *MockTransactionDispatcherMockRecorder { + return m.recorder +} + +// From mocks base method. +func (m *MockTransactionDispatcher) From() common.Address { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "From") + ret0, _ := ret[0].(common.Address) + return ret0 +} + +// From indicates an expected call of From. +func (mr *MockTransactionDispatcherMockRecorder) From() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "From", reflect.TypeOf((*MockTransactionDispatcher)(nil).From)) +} + +// GetTransactionByHash mocks base method. +func (m *MockTransactionDispatcher) GetTransactionByHash(h common.Hash) (*types.Transaction, bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTransactionByHash", h) + ret0, _ := ret[0].(*types.Transaction) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTransactionByHash indicates an expected call of GetTransactionByHash. +func (mr *MockTransactionDispatcherMockRecorder) GetTransactionByHash(h any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionByHash", reflect.TypeOf((*MockTransactionDispatcher)(nil).GetTransactionByHash), h) +} + +// LockNonce mocks base method. +func (m *MockTransactionDispatcher) LockNonce() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "LockNonce") +} + +// LockNonce indicates an expected call of LockNonce. +func (mr *MockTransactionDispatcherMockRecorder) LockNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockTransactionDispatcher)(nil).LockNonce)) +} + +// SignAndSendTransaction mocks base method. +func (m *MockTransactionDispatcher) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) + ret0, _ := ret[0].(common.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SignAndSendTransaction indicates an expected call of SignAndSendTransaction. +func (mr *MockTransactionDispatcherMockRecorder) SignAndSendTransaction(ctx, tx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignAndSendTransaction", reflect.TypeOf((*MockTransactionDispatcher)(nil).SignAndSendTransaction), ctx, tx) +} + +// TransactionReceipt mocks base method. +func (m *MockTransactionDispatcher) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TransactionReceipt", ctx, txHash) + ret0, _ := ret[0].(*types.Receipt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TransactionReceipt indicates an expected call of TransactionReceipt. +func (mr *MockTransactionDispatcherMockRecorder) TransactionReceipt(ctx, txHash any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionReceipt", reflect.TypeOf((*MockTransactionDispatcher)(nil).TransactionReceipt), ctx, txHash) +} + +// UnlockNonce mocks base method. +func (m *MockTransactionDispatcher) UnlockNonce() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UnlockNonce") +} + +// UnlockNonce indicates an expected call of UnlockNonce. +func (mr *MockTransactionDispatcherMockRecorder) UnlockNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockTransactionDispatcher)(nil).UnlockNonce)) +} + +// UnsafeIncreaseNonce mocks base method. +func (m *MockTransactionDispatcher) UnsafeIncreaseNonce() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UnsafeIncreaseNonce") + ret0, _ := ret[0].(error) + return ret0 +} + +// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. +func (mr *MockTransactionDispatcherMockRecorder) UnsafeIncreaseNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockTransactionDispatcher)(nil).UnsafeIncreaseNonce)) +} + +// UnsafeNonce mocks base method. +func (m *MockTransactionDispatcher) UnsafeNonce() (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UnsafeNonce") + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UnsafeNonce indicates an expected call of UnsafeNonce. +func (mr *MockTransactionDispatcherMockRecorder) UnsafeNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockTransactionDispatcher)(nil).UnsafeNonce)) +} + +// WaitAndReturnTxReceipt mocks base method. +func (m *MockTransactionDispatcher) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitAndReturnTxReceipt", h) + ret0, _ := ret[0].(*types.Receipt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WaitAndReturnTxReceipt indicates an expected call of WaitAndReturnTxReceipt. +func (mr *MockTransactionDispatcherMockRecorder) WaitAndReturnTxReceipt(h any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitAndReturnTxReceipt", reflect.TypeOf((*MockTransactionDispatcher)(nil).WaitAndReturnTxReceipt), h) +} + +// MockClient is a mock of Client interface. +type MockClient struct { + ctrl *gomock.Controller + recorder *MockClientMockRecorder +} + +// MockClientMockRecorder is the mock recorder for MockClient. +type MockClientMockRecorder struct { + mock *MockClient +} + +// NewMockClient creates a new mock instance. +func NewMockClient(ctrl *gomock.Controller) *MockClient { + mock := &MockClient{ctrl: ctrl} + mock.recorder = &MockClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockClient) EXPECT() *MockClientMockRecorder { + return m.recorder +} + +// CallContract mocks base method. +func (m *MockClient) CallContract(ctx context.Context, callArgs map[string]any, blockNumber *big.Int) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CallContract", ctx, callArgs, blockNumber) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CallContract indicates an expected call of CallContract. +func (mr *MockClientMockRecorder) CallContract(ctx, callArgs, blockNumber any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallContract", reflect.TypeOf((*MockClient)(nil).CallContract), ctx, callArgs, blockNumber) +} + +// CodeAt mocks base method. +func (m *MockClient) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CodeAt", ctx, contract, blockNumber) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CodeAt indicates an expected call of CodeAt. +func (mr *MockClientMockRecorder) CodeAt(ctx, contract, blockNumber any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CodeAt", reflect.TypeOf((*MockClient)(nil).CodeAt), ctx, contract, blockNumber) +} + +// From mocks base method. +func (m *MockClient) From() common.Address { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "From") + ret0, _ := ret[0].(common.Address) + return ret0 +} + +// From indicates an expected call of From. +func (mr *MockClientMockRecorder) From() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "From", reflect.TypeOf((*MockClient)(nil).From)) +} + +// GetTransactionByHash mocks base method. +func (m *MockClient) GetTransactionByHash(h common.Hash) (*types.Transaction, bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTransactionByHash", h) + ret0, _ := ret[0].(*types.Transaction) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTransactionByHash indicates an expected call of GetTransactionByHash. +func (mr *MockClientMockRecorder) GetTransactionByHash(h any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionByHash", reflect.TypeOf((*MockClient)(nil).GetTransactionByHash), h) +} + +// LockNonce mocks base method. +func (m *MockClient) LockNonce() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "LockNonce") +} + +// LockNonce indicates an expected call of LockNonce. +func (mr *MockClientMockRecorder) LockNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockNonce", reflect.TypeOf((*MockClient)(nil).LockNonce)) +} + +// SignAndSendTransaction mocks base method. +func (m *MockClient) SignAndSendTransaction(ctx context.Context, tx client.CommonTransaction) (common.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignAndSendTransaction", ctx, tx) + ret0, _ := ret[0].(common.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SignAndSendTransaction indicates an expected call of SignAndSendTransaction. +func (mr *MockClientMockRecorder) SignAndSendTransaction(ctx, tx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignAndSendTransaction", reflect.TypeOf((*MockClient)(nil).SignAndSendTransaction), ctx, tx) +} + +// TransactionReceipt mocks base method. +func (m *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TransactionReceipt", ctx, txHash) + ret0, _ := ret[0].(*types.Receipt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TransactionReceipt indicates an expected call of TransactionReceipt. +func (mr *MockClientMockRecorder) TransactionReceipt(ctx, txHash any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionReceipt", reflect.TypeOf((*MockClient)(nil).TransactionReceipt), ctx, txHash) +} + +// UnlockNonce mocks base method. +func (m *MockClient) UnlockNonce() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UnlockNonce") +} + +// UnlockNonce indicates an expected call of UnlockNonce. +func (mr *MockClientMockRecorder) UnlockNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnlockNonce", reflect.TypeOf((*MockClient)(nil).UnlockNonce)) +} + +// UnsafeIncreaseNonce mocks base method. +func (m *MockClient) UnsafeIncreaseNonce() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UnsafeIncreaseNonce") + ret0, _ := ret[0].(error) + return ret0 +} + +// UnsafeIncreaseNonce indicates an expected call of UnsafeIncreaseNonce. +func (mr *MockClientMockRecorder) UnsafeIncreaseNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeIncreaseNonce", reflect.TypeOf((*MockClient)(nil).UnsafeIncreaseNonce)) +} + +// UnsafeNonce mocks base method. +func (m *MockClient) UnsafeNonce() (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UnsafeNonce") + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UnsafeNonce indicates an expected call of UnsafeNonce. +func (mr *MockClientMockRecorder) UnsafeNonce() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsafeNonce", reflect.TypeOf((*MockClient)(nil).UnsafeNonce)) +} + +// WaitAndReturnTxReceipt mocks base method. +func (m *MockClient) WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitAndReturnTxReceipt", h) + ret0, _ := ret[0].(*types.Receipt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WaitAndReturnTxReceipt indicates an expected call of WaitAndReturnTxReceipt. +func (mr *MockClientMockRecorder) WaitAndReturnTxReceipt(h any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitAndReturnTxReceipt", reflect.TypeOf((*MockClient)(nil).WaitAndReturnTxReceipt), h) +} + +// MockSigner is a mock of Signer interface. +type MockSigner struct { + ctrl *gomock.Controller + recorder *MockSignerMockRecorder +} + +// MockSignerMockRecorder is the mock recorder for MockSigner. +type MockSignerMockRecorder struct { + mock *MockSigner +} + +// NewMockSigner creates a new mock instance. +func NewMockSigner(ctrl *gomock.Controller) *MockSigner { + mock := &MockSigner{ctrl: ctrl} + mock.recorder = &MockSignerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSigner) EXPECT() *MockSignerMockRecorder { + return m.recorder +} + +// CommonAddress mocks base method. +func (m *MockSigner) CommonAddress() common.Address { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommonAddress") + ret0, _ := ret[0].(common.Address) + return ret0 +} + +// CommonAddress indicates an expected call of CommonAddress. +func (mr *MockSignerMockRecorder) CommonAddress() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommonAddress", reflect.TypeOf((*MockSigner)(nil).CommonAddress)) +} + +// Sign mocks base method. +func (m *MockSigner) Sign(digestHash []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Sign", digestHash) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Sign indicates an expected call of Sign. +func (mr *MockSignerMockRecorder) Sign(digestHash any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*MockSigner)(nil).Sign), digestHash) +} + +// MockCommonTransaction is a mock of CommonTransaction interface. +type MockCommonTransaction struct { + ctrl *gomock.Controller + recorder *MockCommonTransactionMockRecorder +} + +// MockCommonTransactionMockRecorder is the mock recorder for MockCommonTransaction. +type MockCommonTransactionMockRecorder struct { + mock *MockCommonTransaction +} + +// NewMockCommonTransaction creates a new mock instance. +func NewMockCommonTransaction(ctrl *gomock.Controller) *MockCommonTransaction { + mock := &MockCommonTransaction{ctrl: ctrl} + mock.recorder = &MockCommonTransactionMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockCommonTransaction) EXPECT() *MockCommonTransactionMockRecorder { + return m.recorder +} + +// Hash mocks base method. +func (m *MockCommonTransaction) Hash() common.Hash { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Hash") + ret0, _ := ret[0].(common.Hash) + return ret0 +} + +// Hash indicates an expected call of Hash. +func (mr *MockCommonTransactionMockRecorder) Hash() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Hash", reflect.TypeOf((*MockCommonTransaction)(nil).Hash)) +} + +// RawWithSignature mocks base method. +func (m *MockCommonTransaction) RawWithSignature(signer client.Signer, domainID *big.Int) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RawWithSignature", signer, domainID) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RawWithSignature indicates an expected call of RawWithSignature. +func (mr *MockCommonTransactionMockRecorder) RawWithSignature(signer, domainID any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RawWithSignature", reflect.TypeOf((*MockCommonTransaction)(nil).RawWithSignature), signer, domainID) +} diff --git a/mock/gas.go b/mock/gas.go new file mode 100644 index 00000000..e585d9ed --- /dev/null +++ b/mock/gas.go @@ -0,0 +1,123 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./chains/evm/transactor/gas/gas-pricer.go +// +// Generated by this command: +// +// mockgen -destination=./mock/gas.go -source=./chains/evm/transactor/gas/gas-pricer.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + big "math/big" + reflect "reflect" + + gomock "go.uber.org/mock/gomock" +) + +// MockLondonGasClient is a mock of LondonGasClient interface. +type MockLondonGasClient struct { + ctrl *gomock.Controller + recorder *MockLondonGasClientMockRecorder +} + +// MockLondonGasClientMockRecorder is the mock recorder for MockLondonGasClient. +type MockLondonGasClientMockRecorder struct { + mock *MockLondonGasClient +} + +// NewMockLondonGasClient creates a new mock instance. +func NewMockLondonGasClient(ctrl *gomock.Controller) *MockLondonGasClient { + mock := &MockLondonGasClient{ctrl: ctrl} + mock.recorder = &MockLondonGasClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockLondonGasClient) EXPECT() *MockLondonGasClientMockRecorder { + return m.recorder +} + +// BaseFee mocks base method. +func (m *MockLondonGasClient) BaseFee() (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BaseFee") + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BaseFee indicates an expected call of BaseFee. +func (mr *MockLondonGasClientMockRecorder) BaseFee() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseFee", reflect.TypeOf((*MockLondonGasClient)(nil).BaseFee)) +} + +// SuggestGasPrice mocks base method. +func (m *MockLondonGasClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SuggestGasPrice", ctx) + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SuggestGasPrice indicates an expected call of SuggestGasPrice. +func (mr *MockLondonGasClientMockRecorder) SuggestGasPrice(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasPrice", reflect.TypeOf((*MockLondonGasClient)(nil).SuggestGasPrice), ctx) +} + +// SuggestGasTipCap mocks base method. +func (m *MockLondonGasClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SuggestGasTipCap", ctx) + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SuggestGasTipCap indicates an expected call of SuggestGasTipCap. +func (mr *MockLondonGasClientMockRecorder) SuggestGasTipCap(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasTipCap", reflect.TypeOf((*MockLondonGasClient)(nil).SuggestGasTipCap), ctx) +} + +// MockGasPriceClient is a mock of GasPriceClient interface. +type MockGasPriceClient struct { + ctrl *gomock.Controller + recorder *MockGasPriceClientMockRecorder +} + +// MockGasPriceClientMockRecorder is the mock recorder for MockGasPriceClient. +type MockGasPriceClientMockRecorder struct { + mock *MockGasPriceClient +} + +// NewMockGasPriceClient creates a new mock instance. +func NewMockGasPriceClient(ctrl *gomock.Controller) *MockGasPriceClient { + mock := &MockGasPriceClient{ctrl: ctrl} + mock.recorder = &MockGasPriceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGasPriceClient) EXPECT() *MockGasPriceClientMockRecorder { + return m.recorder +} + +// SuggestGasPrice mocks base method. +func (m *MockGasPriceClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SuggestGasPrice", ctx) + ret0, _ := ret[0].(*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SuggestGasPrice indicates an expected call of SuggestGasPrice. +func (mr *MockGasPriceClientMockRecorder) SuggestGasPrice(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SuggestGasPrice", reflect.TypeOf((*MockGasPriceClient)(nil).SuggestGasPrice), ctx) +} diff --git a/mock/relayer.go b/mock/relayer.go new file mode 100644 index 00000000..8689694e --- /dev/null +++ b/mock/relayer.go @@ -0,0 +1,139 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./relayer/relayer.go +// +// Generated by this command: +// +// mockgen -destination=./mock/relayer.go -source=./relayer/relayer.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + reflect "reflect" + + types "github.com/ChainSafe/sygma-core/types" + gomock "go.uber.org/mock/gomock" +) + +// MockDepositMeter is a mock of DepositMeter interface. +type MockDepositMeter struct { + ctrl *gomock.Controller + recorder *MockDepositMeterMockRecorder +} + +// MockDepositMeterMockRecorder is the mock recorder for MockDepositMeter. +type MockDepositMeterMockRecorder struct { + mock *MockDepositMeter +} + +// NewMockDepositMeter creates a new mock instance. +func NewMockDepositMeter(ctrl *gomock.Controller) *MockDepositMeter { + mock := &MockDepositMeter{ctrl: ctrl} + mock.recorder = &MockDepositMeterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDepositMeter) EXPECT() *MockDepositMeterMockRecorder { + return m.recorder +} + +// TrackDepositMessage mocks base method. +func (m_2 *MockDepositMeter) TrackDepositMessage(m *types.Message) { + m_2.ctrl.T.Helper() + m_2.ctrl.Call(m_2, "TrackDepositMessage", m) +} + +// TrackDepositMessage indicates an expected call of TrackDepositMessage. +func (mr *MockDepositMeterMockRecorder) TrackDepositMessage(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackDepositMessage", reflect.TypeOf((*MockDepositMeter)(nil).TrackDepositMessage), m) +} + +// TrackExecutionError mocks base method. +func (m_2 *MockDepositMeter) TrackExecutionError(m *types.Message) { + m_2.ctrl.T.Helper() + m_2.ctrl.Call(m_2, "TrackExecutionError", m) +} + +// TrackExecutionError indicates an expected call of TrackExecutionError. +func (mr *MockDepositMeterMockRecorder) TrackExecutionError(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackExecutionError", reflect.TypeOf((*MockDepositMeter)(nil).TrackExecutionError), m) +} + +// TrackSuccessfulExecutionLatency mocks base method. +func (m_2 *MockDepositMeter) TrackSuccessfulExecutionLatency(m *types.Message) { + m_2.ctrl.T.Helper() + m_2.ctrl.Call(m_2, "TrackSuccessfulExecutionLatency", m) +} + +// TrackSuccessfulExecutionLatency indicates an expected call of TrackSuccessfulExecutionLatency. +func (mr *MockDepositMeterMockRecorder) TrackSuccessfulExecutionLatency(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackSuccessfulExecutionLatency", reflect.TypeOf((*MockDepositMeter)(nil).TrackSuccessfulExecutionLatency), m) +} + +// MockRelayedChain is a mock of RelayedChain interface. +type MockRelayedChain struct { + ctrl *gomock.Controller + recorder *MockRelayedChainMockRecorder +} + +// MockRelayedChainMockRecorder is the mock recorder for MockRelayedChain. +type MockRelayedChainMockRecorder struct { + mock *MockRelayedChain +} + +// NewMockRelayedChain creates a new mock instance. +func NewMockRelayedChain(ctrl *gomock.Controller) *MockRelayedChain { + mock := &MockRelayedChain{ctrl: ctrl} + mock.recorder = &MockRelayedChainMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRelayedChain) EXPECT() *MockRelayedChainMockRecorder { + return m.recorder +} + +// DomainID mocks base method. +func (m *MockRelayedChain) DomainID() uint8 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DomainID") + ret0, _ := ret[0].(uint8) + return ret0 +} + +// DomainID indicates an expected call of DomainID. +func (mr *MockRelayedChainMockRecorder) DomainID() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainID", reflect.TypeOf((*MockRelayedChain)(nil).DomainID)) +} + +// PollEvents mocks base method. +func (m *MockRelayedChain) PollEvents(ctx context.Context, sysErr chan<- error) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "PollEvents", ctx, sysErr) +} + +// PollEvents indicates an expected call of PollEvents. +func (mr *MockRelayedChainMockRecorder) PollEvents(ctx, sysErr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx, sysErr) +} + +// Write mocks base method. +func (m *MockRelayedChain) Write(messages []*types.Message) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Write", messages) + ret0, _ := ret[0].(error) + return ret0 +} + +// Write indicates an expected call of Write. +func (mr *MockRelayedChainMockRecorder) Write(messages any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockRelayedChain)(nil).Write), messages) +} diff --git a/mock/signAndSend.go b/mock/signAndSend.go new file mode 100644 index 00000000..a91de2db --- /dev/null +++ b/mock/signAndSend.go @@ -0,0 +1,54 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: chains/evm/transactor/signAndSend/signAndSend.go +// +// Generated by this command: +// +// mockgen -source=chains/evm/transactor/signAndSend/signAndSend.go -destination=./mock/signAndSend.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + big "math/big" + reflect "reflect" + + gomock "go.uber.org/mock/gomock" +) + +// MockGasPricer is a mock of GasPricer interface. +type MockGasPricer struct { + ctrl *gomock.Controller + recorder *MockGasPricerMockRecorder +} + +// MockGasPricerMockRecorder is the mock recorder for MockGasPricer. +type MockGasPricerMockRecorder struct { + mock *MockGasPricer +} + +// NewMockGasPricer creates a new mock instance. +func NewMockGasPricer(ctrl *gomock.Controller) *MockGasPricer { + mock := &MockGasPricer{ctrl: ctrl} + mock.recorder = &MockGasPricerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGasPricer) EXPECT() *MockGasPricerMockRecorder { + return m.recorder +} + +// GasPrice mocks base method. +func (m *MockGasPricer) GasPrice(priority *uint8) ([]*big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GasPrice", priority) + ret0, _ := ret[0].([]*big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GasPrice indicates an expected call of GasPrice. +func (mr *MockGasPricerMockRecorder) GasPrice(priority any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasPrice", reflect.TypeOf((*MockGasPricer)(nil).GasPrice), priority) +} diff --git a/mock/store.go b/mock/store.go new file mode 100644 index 00000000..982ea21c --- /dev/null +++ b/mock/store.go @@ -0,0 +1,142 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./store/store.go +// +// Generated by this command: +// +// mockgen -source=./store/store.go -destination=./mock/store.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + gomock "go.uber.org/mock/gomock" +) + +// MockKeyValueReaderWriter is a mock of KeyValueReaderWriter interface. +type MockKeyValueReaderWriter struct { + ctrl *gomock.Controller + recorder *MockKeyValueReaderWriterMockRecorder +} + +// MockKeyValueReaderWriterMockRecorder is the mock recorder for MockKeyValueReaderWriter. +type MockKeyValueReaderWriterMockRecorder struct { + mock *MockKeyValueReaderWriter +} + +// NewMockKeyValueReaderWriter creates a new mock instance. +func NewMockKeyValueReaderWriter(ctrl *gomock.Controller) *MockKeyValueReaderWriter { + mock := &MockKeyValueReaderWriter{ctrl: ctrl} + mock.recorder = &MockKeyValueReaderWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockKeyValueReaderWriter) EXPECT() *MockKeyValueReaderWriterMockRecorder { + return m.recorder +} + +// GetByKey mocks base method. +func (m *MockKeyValueReaderWriter) GetByKey(key []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetByKey", key) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetByKey indicates an expected call of GetByKey. +func (mr *MockKeyValueReaderWriterMockRecorder) GetByKey(key any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByKey", reflect.TypeOf((*MockKeyValueReaderWriter)(nil).GetByKey), key) +} + +// SetByKey mocks base method. +func (m *MockKeyValueReaderWriter) SetByKey(key, value []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetByKey", key, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetByKey indicates an expected call of SetByKey. +func (mr *MockKeyValueReaderWriterMockRecorder) SetByKey(key, value any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetByKey", reflect.TypeOf((*MockKeyValueReaderWriter)(nil).SetByKey), key, value) +} + +// MockKeyValueReader is a mock of KeyValueReader interface. +type MockKeyValueReader struct { + ctrl *gomock.Controller + recorder *MockKeyValueReaderMockRecorder +} + +// MockKeyValueReaderMockRecorder is the mock recorder for MockKeyValueReader. +type MockKeyValueReaderMockRecorder struct { + mock *MockKeyValueReader +} + +// NewMockKeyValueReader creates a new mock instance. +func NewMockKeyValueReader(ctrl *gomock.Controller) *MockKeyValueReader { + mock := &MockKeyValueReader{ctrl: ctrl} + mock.recorder = &MockKeyValueReaderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockKeyValueReader) EXPECT() *MockKeyValueReaderMockRecorder { + return m.recorder +} + +// GetByKey mocks base method. +func (m *MockKeyValueReader) GetByKey(key []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetByKey", key) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetByKey indicates an expected call of GetByKey. +func (mr *MockKeyValueReaderMockRecorder) GetByKey(key any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByKey", reflect.TypeOf((*MockKeyValueReader)(nil).GetByKey), key) +} + +// MockKeyValueWriter is a mock of KeyValueWriter interface. +type MockKeyValueWriter struct { + ctrl *gomock.Controller + recorder *MockKeyValueWriterMockRecorder +} + +// MockKeyValueWriterMockRecorder is the mock recorder for MockKeyValueWriter. +type MockKeyValueWriterMockRecorder struct { + mock *MockKeyValueWriter +} + +// NewMockKeyValueWriter creates a new mock instance. +func NewMockKeyValueWriter(ctrl *gomock.Controller) *MockKeyValueWriter { + mock := &MockKeyValueWriter{ctrl: ctrl} + mock.recorder = &MockKeyValueWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockKeyValueWriter) EXPECT() *MockKeyValueWriterMockRecorder { + return m.recorder +} + +// SetByKey mocks base method. +func (m *MockKeyValueWriter) SetByKey(key, value []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetByKey", key, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetByKey indicates an expected call of SetByKey. +func (mr *MockKeyValueWriterMockRecorder) SetByKey(key, value any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetByKey", reflect.TypeOf((*MockKeyValueWriter)(nil).SetByKey), key, value) +} diff --git a/mock/transact.go b/mock/transact.go new file mode 100644 index 00000000..5a41eb0a --- /dev/null +++ b/mock/transact.go @@ -0,0 +1,55 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: chains/evm/transactor/transact.go +// +// Generated by this command: +// +// mockgen -source=chains/evm/transactor/transact.go -destination=./mock/transact.go -package mock +// +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + transactor "github.com/ChainSafe/sygma-core/chains/evm/transactor" + common "github.com/ethereum/go-ethereum/common" + gomock "go.uber.org/mock/gomock" +) + +// MockTransactor is a mock of Transactor interface. +type MockTransactor struct { + ctrl *gomock.Controller + recorder *MockTransactorMockRecorder +} + +// MockTransactorMockRecorder is the mock recorder for MockTransactor. +type MockTransactorMockRecorder struct { + mock *MockTransactor +} + +// NewMockTransactor creates a new mock instance. +func NewMockTransactor(ctrl *gomock.Controller) *MockTransactor { + mock := &MockTransactor{ctrl: ctrl} + mock.recorder = &MockTransactorMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTransactor) EXPECT() *MockTransactorMockRecorder { + return m.recorder +} + +// Transact mocks base method. +func (m *MockTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Transact", to, data, opts) + ret0, _ := ret[0].(*common.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Transact indicates an expected call of Transact. +func (mr *MockTransactorMockRecorder) Transact(to, data, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transact", reflect.TypeOf((*MockTransactor)(nil).Transact), to, data, opts) +} diff --git a/relayer/relayer_test.go b/relayer/relayer_test.go index e3ed5365..f18bf4b0 100644 --- a/relayer/relayer_test.go +++ b/relayer/relayer_test.go @@ -4,16 +4,16 @@ import ( "fmt" "testing" - mock_relayer "github.com/ChainSafe/sygma-core/relayer/mock" + "github.com/ChainSafe/sygma-core/mock" "github.com/ChainSafe/sygma-core/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" ) type RouteTestSuite struct { suite.Suite - mockRelayedChain *mock_relayer.MockRelayedChain - mockMetrics *mock_relayer.MockDepositMeter + mockRelayedChain *mock.MockRelayedChain + mockMetrics *mock.MockDepositMeter } func TestRunRouteTestSuite(t *testing.T) { @@ -24,8 +24,8 @@ func (s *RouteTestSuite) SetupSuite() {} func (s *RouteTestSuite) TearDownSuite() {} func (s *RouteTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.mockRelayedChain = mock_relayer.NewMockRelayedChain(gomockController) - s.mockMetrics = mock_relayer.NewMockDepositMeter(gomockController) + s.mockRelayedChain = mock.NewMockRelayedChain(gomockController) + s.mockMetrics = mock.NewMockDepositMeter(gomockController) } func (s *RouteTestSuite) TearDownTest() {} @@ -39,22 +39,7 @@ func (s *RouteTestSuite) TestLogsErrorIfDestinationDoesNotExist() { }) } -func (s *RouteTestSuite) TestLogsErrorIfMessageProcessorReturnsError() { - s.mockMetrics.EXPECT().TrackDepositMessage(gomock.Any()) - s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)) - relayer := NewRelayer( - []RelayedChain{}, - s.mockMetrics, - ) - relayer.addRelayedChain(s.mockRelayedChain) - - relayer.route([]*types.Message{ - {Destination: 1}, - }) -} - func (s *RouteTestSuite) TestWriteFail() { - s.mockMetrics.EXPECT().TrackDepositMessage(gomock.Any()) s.mockMetrics.EXPECT().TrackExecutionError(gomock.Any()) s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)).Times(3) s.mockRelayedChain.EXPECT().Write(gomock.Any()).Return(fmt.Errorf("error")) @@ -70,7 +55,6 @@ func (s *RouteTestSuite) TestWriteFail() { } func (s *RouteTestSuite) TestWritesToDestChainIfMessageValid() { - s.mockMetrics.EXPECT().TrackDepositMessage(gomock.Any()) s.mockMetrics.EXPECT().TrackSuccessfulExecutionLatency(gomock.Any()) s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)).Times(2) s.mockRelayedChain.EXPECT().Write(gomock.Any()) diff --git a/store/blockstore_test.go b/store/blockstore_test.go index a3a9cb96..0f8928cd 100644 --- a/store/blockstore_test.go +++ b/store/blockstore_test.go @@ -5,17 +5,17 @@ import ( "math/big" "testing" + "github.com/ChainSafe/sygma-core/mock" "github.com/ChainSafe/sygma-core/store" - mock_store "github.com/ChainSafe/sygma-core/store/mock" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/syndtr/goleveldb/leveldb" + "go.uber.org/mock/gomock" ) type BlockStoreTestSuite struct { suite.Suite blockStore *store.BlockStore - keyValueReaderWriter *mock_store.MockKeyValueReaderWriter + keyValueReaderWriter *mock.NewMockKeyValueReaderWriter } func TestRunBlockStoreTestSuite(t *testing.T) { @@ -26,7 +26,7 @@ func (s *BlockStoreTestSuite) SetupSuite() {} func (s *BlockStoreTestSuite) TearDownSuite() {} func (s *BlockStoreTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.keyValueReaderWriter = mock_store.NewMockKeyValueReaderWriter(gomockController) + s.keyValueReaderWriter = mock.NewMockKeyValueReaderWriter(gomockController) s.blockStore = store.NewBlockStore(s.keyValueReaderWriter) } func (s *BlockStoreTestSuite) TearDownTest() {} diff --git a/store/noncestore_test.go b/store/noncestore_test.go index 951caecc..3d375bf8 100644 --- a/store/noncestore_test.go +++ b/store/noncestore_test.go @@ -5,17 +5,17 @@ import ( "math/big" "testing" + "github.com/ChainSafe/sygma-core/mock" "github.com/ChainSafe/sygma-core/store" - mock_store "github.com/ChainSafe/sygma-core/store/mock" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/syndtr/goleveldb/leveldb" + "go.uber.org/mock/gomock" ) type NonceStoreTestSuite struct { suite.Suite nonceStore *store.NonceStore - keyValueReaderWriter *mock_store.MockKeyValueReaderWriter + keyValueReaderWriter *mock.MockKeyValueReaderWriter } func TestRunNonceStoreTestSuite(t *testing.T) { @@ -26,7 +26,7 @@ func (s *NonceStoreTestSuite) SetupSuite() {} func (s *NonceStoreTestSuite) TearDownSuite() {} func (s *NonceStoreTestSuite) SetupTest() { gomockController := gomock.NewController(s.T()) - s.keyValueReaderWriter = mock_store.NewMockKeyValueReaderWriter(gomockController) + s.keyValueReaderWriter = mock.NewMockKeyValueReaderWriter(gomockController) s.nonceStore = store.NewNonceStore(s.keyValueReaderWriter) } func (s *NonceStoreTestSuite) TearDownTest() {} From f2f2fbc772a08a08787f0cca739ca946d54f92ce Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 14:03:08 +0200 Subject: [PATCH 16/27] Add additional github actions --- .github/workflows/code-quality.yml | 45 ++++++++++++++++++++++++++ .github/workflows/dependecy-review.yml | 17 ++++++++++ .github/workflows/e2e.yml | 39 ---------------------- 3 files changed, 62 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/code-quality.yml create mode 100644 .github/workflows/dependecy-review.yml delete mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 00000000..dab47ba3 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,45 @@ +# The Licensed Work is (c) 2022 Sygma +# SPDX-License-Identifier: LGPL-3.0-only + +name: "Code Scanning - Action" + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '30 1 * * 0' + +jobs: + CodeQL-Build: + runs-on: ubuntu-latest + + permissions: + security-events: write + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: go + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/dependecy-review.yml b/.github/workflows/dependecy-review.yml new file mode 100644 index 00000000..65c1cab3 --- /dev/null +++ b/.github/workflows/dependecy-review.yml @@ -0,0 +1,17 @@ +# The Licensed Work is (c) 2022 Sygma +# SPDX-License-Identifier: LGPL-3.0-only + +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v3 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v2 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index f429f97f..00000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,39 +0,0 @@ -on: - pull_request: - types: [opened, synchronize, reopened] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -name: E2E tests -jobs: - e2e: - name: E2E Tests - strategy: - matrix: - go-version: [ 1.19.x ] - platform: [ ubuntu-latest ] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/cache@v2.1.6 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run nodes - run: docker-compose -f ./example/docker-compose.yml up -d - - name: Run tests - run: make e2e-test - - name: Print logs - if: always() - run: | - docker ps -a - docker logs relayer1 From 9180b16cf66465bcdda32b4a331fa3446575b44c Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 14:04:05 +0200 Subject: [PATCH 17/27] Fix linter --- go.sum | 1 + store/blockstore_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.sum b/go.sum index e7999232..80dd71d9 100644 --- a/go.sum +++ b/go.sum @@ -99,6 +99,7 @@ github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible h1:FvPewruOgel github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/store/blockstore_test.go b/store/blockstore_test.go index 0f8928cd..c3f60958 100644 --- a/store/blockstore_test.go +++ b/store/blockstore_test.go @@ -15,7 +15,7 @@ import ( type BlockStoreTestSuite struct { suite.Suite blockStore *store.BlockStore - keyValueReaderWriter *mock.NewMockKeyValueReaderWriter + keyValueReaderWriter *mock.MockKeyValueReaderWriter } func TestRunBlockStoreTestSuite(t *testing.T) { From f9be6f9a80e8321ba906814a01920ff9652f04d5 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 14:06:23 +0200 Subject: [PATCH 18/27] Replace mockgen lib --- .github/workflows/mocks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mocks.yml b/.github/workflows/mocks.yml index cd20bba7..d0a088bc 100644 --- a/.github/workflows/mocks.yml +++ b/.github/workflows/mocks.yml @@ -13,7 +13,7 @@ jobs: with: go-version: "^1.17" - - run: go install github.com/golang/mock/mockgen@v1.6.0 + - run: go install go.uber.org/mock/mockgen@v0.3.0 - run: make genmocks From 14105b6ad14612915c1f67f8a62a0c06133bcc2b Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 16:48:34 +0200 Subject: [PATCH 19/27] Backport substrate chain from relayer --- README.md | 2 +- chains/evm/chain.go | 62 ++-- chains/evm/listener/listener.go | 2 +- chains/substrate/chain.go | 64 ++++ chains/substrate/client/client.go | 213 +++++++++++ chains/substrate/connection/connection.go | 88 +++++ chains/substrate/events/events.go | 11 + chains/substrate/executor/message-handler.go | 61 ++++ .../executor/message-handler_test.go | 130 +++++++ chains/substrate/listener/listener.go | 132 +++++++ go.mod | 31 +- go.sum | 342 +++++------------- mock/relayer.go | 8 +- relayer/relayer.go | 6 +- 14 files changed, 842 insertions(+), 310 deletions(-) create mode 100644 chains/substrate/chain.go create mode 100644 chains/substrate/client/client.go create mode 100644 chains/substrate/connection/connection.go create mode 100644 chains/substrate/events/events.go create mode 100644 chains/substrate/executor/message-handler.go create mode 100644 chains/substrate/executor/message-handler_test.go create mode 100644 chains/substrate/listener/listener.go diff --git a/README.md b/README.md index 1457908c..6f38bcab 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Fork the repository, make changes and open a PR to the `main` branch of the repo A great way to contribute to the project is to send a detailed report when you encounter an issue. We always appreciate a well-written, thorough bug report, and will thank you for it! When reporting issues, always include: - - chainbridge-core version + - sygma-core version - modules used - logs (don't forget to remove sensitive data) - tx hashes related to issue (if applicable) diff --git a/chains/evm/chain.go b/chains/evm/chain.go index 4eab8c7d..121ba39b 100644 --- a/chains/evm/chain.go +++ b/chains/evm/chain.go @@ -5,73 +5,57 @@ package evm import ( "context" - "fmt" "math/big" "github.com/ChainSafe/sygma-core/store" "github.com/ChainSafe/sygma-core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) type EventListener interface { - ListenToEvents(ctx context.Context, startBlock *big.Int, errChan chan<- error) + ListenToEvents(ctx context.Context, startBlock *big.Int) } type ProposalExecutor interface { - Execute(message *types.Message) error + Execute(messages []*types.Message) error } // EVMChain is struct that aggregates all data required for type EVMChain struct { listener EventListener - writer ProposalExecutor + executor ProposalExecutor blockstore *store.BlockStore - domainID uint8 - startBlock *big.Int - freshStart bool - latestBlock bool + domainID uint8 + startBlock *big.Int + + logger zerolog.Logger } -func NewEVMChain(listener EventListener, writer ProposalExecutor, blockstore *store.BlockStore, domainID uint8, startBlock *big.Int, latestBlock bool, freshStart bool) *EVMChain { +func NewEVMChain(listener EventListener, executor ProposalExecutor, blockstore *store.BlockStore, domainID uint8, startBlock *big.Int) *EVMChain { return &EVMChain{ - listener: listener, - writer: writer, - blockstore: blockstore, - domainID: domainID, - startBlock: startBlock, - latestBlock: latestBlock, - freshStart: freshStart, + listener: listener, + executor: executor, + blockstore: blockstore, + domainID: domainID, + startBlock: startBlock, + logger: log.With().Uint8("domainID", domainID).Logger(), } } // PollEvents is the goroutine that polls blocks and searches Deposit events in them. // Events are then sent to eventsChan. -func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error) { - log.Info().Msg("Polling Blocks...") - - startBlock, err := c.blockstore.GetStartBlock( - c.domainID, - c.startBlock, - c.latestBlock, - c.freshStart, - ) - if err != nil { - sysErr <- fmt.Errorf("error %w on getting last stored block", err) - return - } - - go c.listener.ListenToEvents(ctx, startBlock, sysErr) +func (c *EVMChain) PollEvents(ctx context.Context) { + c.logger.Info().Str("startBlock", c.startBlock.String()).Msg("Polling Blocks...") + go c.listener.ListenToEvents(ctx, c.startBlock) } -func (c *EVMChain) Write(msg []*types.Message) error { - for _, msg := range msg { - go func(msg *types.Message) { - err := c.writer.Execute(msg) - if err != nil { - log.Err(err).Msgf("Failed writing message %v", msg) - } - }(msg) +func (c *EVMChain) Write(msgs []*types.Message) error { + err := c.executor.Execute(msgs) + if err != nil { + c.logger.Err(err).Msgf("error writing messages %+v on network %d", msgs, c.DomainID()) + return err } return nil diff --git a/chains/evm/listener/listener.go b/chains/evm/listener/listener.go index 3bde3fdb..e6429bc2 100644 --- a/chains/evm/listener/listener.go +++ b/chains/evm/listener/listener.go @@ -67,7 +67,7 @@ func NewEVMListener( // ListenToEvents goes block by block of a network and executes event handlers that are // configured for the listener. -func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int, errChn chan<- error) { +func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int) { endBlock := big.NewInt(0) for { select { diff --git a/chains/substrate/chain.go b/chains/substrate/chain.go new file mode 100644 index 00000000..acd3358d --- /dev/null +++ b/chains/substrate/chain.go @@ -0,0 +1,64 @@ +package substrate + +import ( + "context" + "math/big" + + "github.com/ChainSafe/sygma-core/chains/substrate/client" + "github.com/ChainSafe/sygma-core/store" + "github.com/ChainSafe/sygma-core/types" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" +) + +type BatchProposalExecutor interface { + Execute(msgs []*types.Message) error +} + +type SubstrateChain struct { + client *client.SubstrateClient + + listener EventListener + executor BatchProposalExecutor + + blockstore *store.BlockStore + + domainID uint8 + startBlock *big.Int + + logger zerolog.Logger +} + +type EventListener interface { + ListenToEvents(ctx context.Context, startBlock *big.Int) +} + +func NewSubstrateChain(client *client.SubstrateClient, listener EventListener, blockstore *store.BlockStore, executor BatchProposalExecutor, domainID uint8, startBlock *big.Int) *SubstrateChain { + return &SubstrateChain{ + client: client, + listener: listener, + blockstore: blockstore, + executor: executor, + logger: log.With().Uint8("domainID", domainID).Logger()} +} + +// PollEvents is the goroutine that polls blocks and searches Deposit events in them. +// Events are then sent to eventsChan. +func (c *SubstrateChain) PollEvents(ctx context.Context) { + c.logger.Info().Str("startBlock", c.startBlock.String()).Msg("Polling Blocks...") + go c.listener.ListenToEvents(ctx, c.startBlock) +} + +func (c *SubstrateChain) Write(msgs []*types.Message) error { + err := c.executor.Execute(msgs) + if err != nil { + c.logger.Err(err).Msgf("error writing messages %+v on network %d", msgs, c.DomainID()) + return err + } + + return nil +} + +func (c *SubstrateChain) DomainID() uint8 { + return c.domainID +} diff --git a/chains/substrate/client/client.go b/chains/substrate/client/client.go new file mode 100644 index 00000000..68040240 --- /dev/null +++ b/chains/substrate/client/client.go @@ -0,0 +1,213 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package client + +import ( + "bytes" + "context" + "fmt" + "math/big" + "sync" + "time" + + "github.com/ChainSafe/sygma-core/chains/substrate/connection" + "github.com/ChainSafe/sygma-core/chains/substrate/events" + "github.com/centrifuge/go-substrate-rpc-client/v4/rpc/author" + "github.com/centrifuge/go-substrate-rpc-client/v4/scale" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" + "github.com/centrifuge/go-substrate-rpc-client/v4/types" + "github.com/rs/zerolog/log" +) + +type SubstrateClient struct { + key *signature.KeyringPair // Keyring used for signing + nonceLock sync.Mutex // Locks nonce for updates + nonce types.U32 // Latest account nonce + tip uint64 + Conn *connection.Connection + ChainID *big.Int +} + +func NewSubstrateClient(conn *connection.Connection, key *signature.KeyringPair, chainID *big.Int, tip uint64) *SubstrateClient { + return &SubstrateClient{ + key: key, + Conn: conn, + ChainID: chainID, + tip: tip, + } +} + +// Transact constructs and submits an extrinsic to call the method with the given arguments. +// All args are passed directly into GSRPC. GSRPC types are recommended to avoid serialization inconsistencies. +func (c *SubstrateClient) Transact(method string, args ...interface{}) (types.Hash, *author.ExtrinsicStatusSubscription, error) { + log.Debug().Msgf("Submitting substrate call... method %s, sender %s", method, c.key.Address) + + // Create call and extrinsic + meta := c.Conn.GetMetadata() + call, err := types.NewCall( + &meta, + method, + args..., + ) + if err != nil { + return types.Hash{}, nil, fmt.Errorf("failed to construct call: %w", err) + } + + ext := types.NewExtrinsic(call) + // Get latest runtime version + rv, err := c.Conn.RPC.State.GetRuntimeVersionLatest() + if err != nil { + return types.Hash{}, nil, err + } + + c.nonceLock.Lock() + defer c.nonceLock.Unlock() + + nonce, err := c.nextNonce(&meta) + if err != nil { + return types.Hash{}, nil, err + } + + // Sign the extrinsic + o := types.SignatureOptions{ + BlockHash: c.Conn.GenesisHash, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: c.Conn.GenesisHash, + Nonce: types.NewUCompactFromUInt(uint64(nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(c.tip), + TransactionVersion: rv.TransactionVersion, + } + sub, err := c.submitAndWatchExtrinsic(o, &ext) + if err != nil { + return types.Hash{}, nil, fmt.Errorf("submission of extrinsic failed: %w", err) + } + + hash, err := ExtrinsicHash(ext) + if err != nil { + return types.Hash{}, nil, err + } + + log.Info().Str("extrinsic", hash.Hex()).Msgf("Extrinsic call submitted... method %s, sender %s, nonce %d", method, c.key.Address, nonce) + c.nonce = nonce + 1 + + return hash, sub, nil +} + +func (c *SubstrateClient) TrackExtrinsic(extHash types.Hash, sub *author.ExtrinsicStatusSubscription) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Minute*10)) + defer sub.Unsubscribe() + defer cancel() + subChan := sub.Chan() + for { + select { + case status := <-subChan: + { + if status.IsInBlock { + log.Debug().Str("extrinsic", extHash.Hex()).Msgf("Extrinsic in block with hash: %#x", status.AsInBlock) + } + if status.IsFinalized { + log.Info().Str("extrinsic", extHash.Hex()).Msgf("Extrinsic is finalized in block with hash: %#x", status.AsFinalized) + return c.checkExtrinsicSuccess(extHash, status.AsFinalized) + } + } + case <-ctx.Done(): + return fmt.Errorf("extrinsic has timed out") + } + } +} + +func (c *SubstrateClient) nextNonce(meta *types.Metadata) (types.U32, error) { + key, err := types.CreateStorageKey(meta, "System", "Account", c.key.PublicKey, nil) + if err != nil { + return 0, err + } + + var latestNonce types.U32 + var acct types.AccountInfo + exists, err := c.Conn.RPC.State.GetStorageLatest(key, &acct) + if err != nil { + return 0, err + } + + if !exists { + latestNonce = 0 + } else { + latestNonce = acct.Nonce + } + + if latestNonce < c.nonce { + return c.nonce, nil + } + + return latestNonce, nil +} + +func (c *SubstrateClient) submitAndWatchExtrinsic(opts types.SignatureOptions, ext *types.Extrinsic) (*author.ExtrinsicStatusSubscription, error) { + err := ext.Sign(*c.key, opts) + if err != nil { + return nil, err + } + + sub, err := c.Conn.RPC.Author.SubmitAndWatchExtrinsic(*ext) + if err != nil { + return nil, err + } + + return sub, nil +} + +func (c *SubstrateClient) checkExtrinsicSuccess(extHash types.Hash, blockHash types.Hash) error { + block, err := c.Conn.Chain.GetBlock(blockHash) + if err != nil { + return err + } + + evts, err := c.Conn.GetBlockEvents(blockHash) + if err != nil { + return err + } + + for _, event := range evts { + index := event.Phase.AsApplyExtrinsic + hash, err := ExtrinsicHash(block.Block.Extrinsics[index]) + if err != nil { + return err + } + + if extHash != hash { + continue + } + + if event.Name == events.ExtrinsicFailedEvent { + return fmt.Errorf("extrinsic failed") + } + if event.Name == events.FailedHandlerExecutionEvent { + return fmt.Errorf("extrinsic failed with failed handler execution") + } + if event.Name == events.ExtrinsicSuccessEvent { + return nil + } + } + + return fmt.Errorf("no event found") +} + +func (c *SubstrateClient) LatestBlock() (*big.Int, error) { + block, err := c.Conn.Chain.GetBlockLatest() + if err != nil { + return nil, err + } + return big.NewInt(int64(block.Block.Header.Number)), nil +} + +func ExtrinsicHash(ext types.Extrinsic) (types.Hash, error) { + extHash := bytes.NewBuffer([]byte{}) + encoder := scale.NewEncoder(extHash) + err := ext.Encode(*encoder) + if err != nil { + return types.Hash{}, err + } + return types.NewHash(extHash.Bytes()), nil +} diff --git a/chains/substrate/connection/connection.go b/chains/substrate/connection/connection.go new file mode 100644 index 00000000..6b95679a --- /dev/null +++ b/chains/substrate/connection/connection.go @@ -0,0 +1,88 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package connection + +import ( + "sync" + + "github.com/centrifuge/go-substrate-rpc-client/v4/client" + "github.com/centrifuge/go-substrate-rpc-client/v4/registry/parser" + "github.com/centrifuge/go-substrate-rpc-client/v4/registry/retriever" + "github.com/centrifuge/go-substrate-rpc-client/v4/registry/state" + + "github.com/centrifuge/go-substrate-rpc-client/v4/rpc" + "github.com/centrifuge/go-substrate-rpc-client/v4/rpc/chain" + "github.com/centrifuge/go-substrate-rpc-client/v4/types" +) + +type Connection struct { + chain.Chain + client.Client + *rpc.RPC + meta types.Metadata // Latest chain metadata + metaLock sync.RWMutex // Lock metadata for updates, allows concurrent reads + GenesisHash types.Hash // Chain genesis hash +} + +func NewSubstrateConnection(url string) (*Connection, error) { + client, err := client.Connect(url) + if err != nil { + return nil, err + } + rpc, err := rpc.NewRPC(client) + if err != nil { + return nil, err + } + + meta, err := rpc.State.GetMetadataLatest() + if err != nil { + return nil, err + } + genesisHash, err := rpc.Chain.GetBlockHash(0) + if err != nil { + return nil, err + } + + return &Connection{ + meta: *meta, + + RPC: rpc, + Chain: rpc.Chain, + Client: client, + GenesisHash: genesisHash, + }, nil +} + +func (c *Connection) GetMetadata() (meta types.Metadata) { + c.metaLock.RLock() + meta = c.meta + c.metaLock.RUnlock() + return meta +} + +func (c *Connection) UpdateMetatdata() error { + c.metaLock.Lock() + meta, err := c.RPC.State.GetMetadataLatest() + if err != nil { + c.metaLock.Unlock() + return err + } + c.meta = *meta + c.metaLock.Unlock() + return nil +} + +func (c *Connection) GetBlockEvents(hash types.Hash) ([]*parser.Event, error) { + provider := state.NewProvider(c.State) + eventRetriever, err := retriever.NewDefaultEventRetriever(provider) + if err != nil { + return nil, err + } + + evts, err := eventRetriever.GetEvents(hash) + if err != nil { + return nil, err + } + return evts, nil +} diff --git a/chains/substrate/events/events.go b/chains/substrate/events/events.go new file mode 100644 index 00000000..d1d46522 --- /dev/null +++ b/chains/substrate/events/events.go @@ -0,0 +1,11 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package events + +const ( + ParachainUpdatedEvent = "ParachainSystem.ValidationFunctionApplied" + ExtrinsicFailedEvent = "System.ExtrinsicFailed" + ExtrinsicSuccessEvent = "System.ExtrinsicSuccess" + FailedHandlerExecutionEvent = "SygmaBridge.FailedHandlerExecution" +) diff --git a/chains/substrate/executor/message-handler.go b/chains/substrate/executor/message-handler.go new file mode 100644 index 00000000..ea8ef225 --- /dev/null +++ b/chains/substrate/executor/message-handler.go @@ -0,0 +1,61 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package executor + +import ( + "fmt" + + "github.com/ChainSafe/sygma-core/types" + + "github.com/rs/zerolog/log" +) + +type Handlers map[types.TransferType]MessageHandlerFunc +type MessageHandlerFunc func(m *types.Message) (*types.Proposal, error) + +type SubstrateMessageHandler struct { + handlers Handlers +} + +// NewSubstrateMessageHandler creates an instance of SubstrateMessageHandler that contains +// message handler functions for converting deposit message into a chain specific +// proposal +func NewSubstrateMessageHandler() *SubstrateMessageHandler { + return &SubstrateMessageHandler{ + handlers: make(map[types.TransferType]MessageHandlerFunc), + } +} + +func (mh *SubstrateMessageHandler) HandleMessage(m *types.Message) (*types.Proposal, error) { + // Based on handler that was registered on BridgeContract + handleMessage, err := mh.matchTransferTypeHandlerFunc(m.Type) + if err != nil { + return nil, err + } + log.Info().Str("type", string(m.Type)).Uint8("src", m.Source).Uint8("dst", m.Destination).Uint64("nonce", m.DepositNonce).Str("resourceID", fmt.Sprintf("%x", m.ResourceId)).Msg("Handling new message") + prop, err := handleMessage(m) + if err != nil { + return nil, err + } + return prop, nil +} + +func (mh *SubstrateMessageHandler) matchTransferTypeHandlerFunc(transferType types.TransferType) (MessageHandlerFunc, error) { + h, ok := mh.handlers[transferType] + if !ok { + return nil, fmt.Errorf("no corresponding message handler for this transfer type %s exists", transferType) + } + return h, nil +} + +// RegisterEventHandler registers an message handler by associating a handler function to a specified transfer type +func (mh *SubstrateMessageHandler) RegisterMessageHandler(transferType types.TransferType, handler MessageHandlerFunc) { + if transferType == "" { + return + } + + log.Info().Msgf("Registered message handler for transfer type %s", transferType) + + mh.handlers[transferType] = handler +} diff --git a/chains/substrate/executor/message-handler_test.go b/chains/substrate/executor/message-handler_test.go new file mode 100644 index 00000000..67760473 --- /dev/null +++ b/chains/substrate/executor/message-handler_test.go @@ -0,0 +1,130 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package executor_test + +import ( + "bytes" + "errors" + "math/big" + "testing" + "unsafe" + + "github.com/ChainSafe/sygma-core/chains/substrate/executor" + "github.com/ChainSafe/sygma-core/types" + "github.com/centrifuge/go-substrate-rpc-client/signature" + "github.com/centrifuge/go-substrate-rpc-client/v4/scale" + substrateTypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" + "github.com/ethereum/go-ethereum/common" + + "github.com/stretchr/testify/suite" +) + +var SubstratePK = signature.KeyringPair{ + URI: "//Alice", + PublicKey: []byte{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, + Address: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", +} + +type MessageHandlerTestSuite struct { + suite.Suite +} + +func TestRunFungibleTransferHandlerTestSuite(t *testing.T) { + suite.Run(t, new(MessageHandlerTestSuite)) +} + +func (s *MessageHandlerTestSuite) TestSuccesfullyRegisterFungibleTransferMessageHandler() { + recipientAddr := *(*[]substrateTypes.U8)(unsafe.Pointer(&SubstratePK.PublicKey)) + recipient := ConstructRecipientData(recipientAddr) + + messageData := &types.Message{ + Source: 1, + Destination: 0, + DepositNonce: 1, + ResourceId: [32]byte{0}, + Type: "fungible", + Payload: []interface{}{ + []byte{2}, // amount + recipient, + }, + Metadata: types.Metadata{}, + } + + invalidMessageData := &types.Message{ + Source: 1, + Destination: 0, + DepositNonce: 1, + ResourceId: [32]byte{0}, + Type: "nonFungible", + Payload: []interface{}{ + []byte{2}, // amount + recipient, + }, + Metadata: types.Metadata{}, + } + + depositMessageHandler := executor.NewSubstrateMessageHandler() + // Register FungibleTransferMessageHandler function + depositMessageHandler.RegisterMessageHandler("fungible", ExampleMessageHandler) + prop1, err1 := depositMessageHandler.HandleMessage(messageData) + s.Nil(err1) + s.NotNil(prop1) + + // Use unregistered transfer type + prop2, err2 := depositMessageHandler.HandleMessage(invalidMessageData) + s.Nil(prop2) + s.NotNil(err2) +} + +func ExampleMessageHandler(m *types.Message) (*types.Proposal, error) { + if len(m.Payload) != 2 { + return nil, errors.New("malformed payload. Len of payload should be 2") + } + amount, ok := m.Payload[0].([]byte) + if !ok { + return nil, errors.New("wrong payload amount format") + } + recipient, ok := m.Payload[1].([]byte) + if !ok { + return nil, errors.New("wrong payload recipient format") + } + var data []byte + data = append(data, common.LeftPadBytes(amount, 32)...) // amount (uint256) + + recipientLen := big.NewInt(int64(len(recipient))).Bytes() + data = append(data, common.LeftPadBytes(recipientLen, 32)...) + data = append(data, recipient...) + return types.NewProposal(m.Source, m.Destination, m.DepositNonce, m.ResourceId, data, m.Metadata), nil +} + +func ConstructRecipientData(recipient []substrateTypes.U8) []byte { + rec := substrateTypes.MultiLocationV1{ + Parents: 0, + Interior: substrateTypes.JunctionsV1{ + IsX1: true, + X1: substrateTypes.JunctionV1{ + IsAccountID32: true, + AccountID32NetworkID: substrateTypes.NetworkID{ + IsAny: true, + }, + AccountID: recipient, + }, + }, + } + + encodedRecipient := bytes.NewBuffer([]byte{}) + encoder := scale.NewEncoder(encodedRecipient) + _ = rec.Encode(*encoder) + + recipientBytes := encodedRecipient.Bytes() + var finalRecipient []byte + + // remove accountID size data + // this is a fix because the substrate decoder is not able to parse the data with extra data + // that represents size of the recipient byte array + finalRecipient = append(finalRecipient, recipientBytes[:4]...) + finalRecipient = append(finalRecipient, recipientBytes[5:]...) + + return finalRecipient +} diff --git a/chains/substrate/listener/listener.go b/chains/substrate/listener/listener.go new file mode 100644 index 00000000..5aa9e9b6 --- /dev/null +++ b/chains/substrate/listener/listener.go @@ -0,0 +1,132 @@ +// The Licensed Work is (c) 2022 Sygma +// SPDX-License-Identifier: LGPL-3.0-only + +package listener + +import ( + "context" + "math/big" + "time" + + "github.com/ChainSafe/sygma-core/store" + "github.com/centrifuge/go-substrate-rpc-client/v4/registry/parser" + "github.com/centrifuge/go-substrate-rpc-client/v4/types" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" +) + +type EventHandler interface { + HandleEvents(evts []*parser.Event) error +} +type ChainConnection interface { + UpdateMetatdata() error + GetHeaderLatest() (*types.Header, error) + GetBlockHash(blockNumber uint64) (types.Hash, error) + GetBlockEvents(hash types.Hash) ([]*parser.Event, error) + GetFinalizedHead() (types.Hash, error) + GetBlock(blockHash types.Hash) (*types.SignedBlock, error) +} + +type SubstrateListener struct { + conn ChainConnection + + blockstore store.BlockStore + + eventHandlers []EventHandler + + blockRetryInterval time.Duration + blockInterval *big.Int + domainID uint8 + + log zerolog.Logger +} + +func NewSubstrateListener(connection ChainConnection, blockstore store.BlockStore, eventHandlers []EventHandler, domainID uint8, blockRetryInterval time.Duration, blockInterval *big.Int) *SubstrateListener { + return &SubstrateListener{ + log: log.With().Uint8("domainID", domainID).Logger(), + domainID: domainID, + conn: connection, + blockstore: blockstore, + eventHandlers: eventHandlers, + blockRetryInterval: blockRetryInterval, + blockInterval: blockInterval, + } +} + +func (l *SubstrateListener) ListenToEvents(ctx context.Context, startBlock *big.Int) { + endBlock := big.NewInt(0) + + go func() { + for { + select { + case <-ctx.Done(): + return + default: + hash, err := l.conn.GetFinalizedHead() + if err != nil { + l.log.Error().Err(err).Msg("Failed to fetch finalized header") + time.Sleep(l.blockRetryInterval) + continue + } + head, err := l.conn.GetBlock(hash) + if err != nil { + l.log.Error().Err(err).Msg("Failed to fetch block") + time.Sleep(l.blockRetryInterval) + continue + } + + if startBlock == nil { + startBlock = big.NewInt(int64(head.Block.Header.Number)) + } + endBlock.Add(startBlock, l.blockInterval) + + // Sleep if finalized is less then current block + if big.NewInt(int64(head.Block.Header.Number)).Cmp(endBlock) == -1 { + time.Sleep(l.blockRetryInterval) + continue + } + + evts, err := l.fetchEvents(startBlock, endBlock) + if err != nil { + l.log.Err(err).Msgf("Failed fetching events for block range %s-%s", startBlock, endBlock) + time.Sleep(l.blockRetryInterval) + continue + } + + for _, handler := range l.eventHandlers { + err := handler.HandleEvents(evts) + if err != nil { + l.log.Error().Err(err).Msg("Error handling substrate events") + continue + } + } + err = l.blockstore.StoreBlock(startBlock, l.domainID) + if err != nil { + l.log.Error().Str("block", startBlock.String()).Err(err).Msg("Failed to write latest block to blockstore") + } + startBlock.Add(startBlock, l.blockInterval) + } + } + }() +} + +func (l *SubstrateListener) fetchEvents(startBlock *big.Int, endBlock *big.Int) ([]*parser.Event, error) { + l.log.Debug().Msgf("Fetching substrate events for block range %s-%s", startBlock, endBlock) + + evts := make([]*parser.Event, 0) + for i := new(big.Int).Set(startBlock); i.Cmp(endBlock) == -1; i.Add(i, big.NewInt(1)) { + hash, err := l.conn.GetBlockHash(i.Uint64()) + if err != nil { + return nil, err + } + + evt, err := l.conn.GetBlockEvents(hash) + if err != nil { + return nil, err + } + evts = append(evts, evt...) + + } + + return evts, nil +} diff --git a/go.mod b/go.mod index bbe681c1..7311773f 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,13 @@ go 1.19 require ( github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible - github.com/ethereum/go-ethereum v1.10.12 + github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 + github.com/ethereum/go-ethereum v1.10.20 github.com/imdario/mergo v0.3.12 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.25.0 github.com/stretchr/testify v1.8.3 - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 go.opentelemetry.io/otel/metric v1.16.0 @@ -18,31 +19,41 @@ require ( ) require ( + github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/decred/base58 v1.0.4 // indirect + github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/gtank/merlin v0.1.1 // indirect + github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect + github.com/rs/cors v1.8.2 // indirect github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/vedhavyas/go-subkey v1.0.4 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/crypto v0.7.0 // indirect ) require ( github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect - github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect github.com/go-ole/go-ole v1.2.1 // indirect - github.com/go-stack/stack v1.8.0 // indirect + github.com/go-stack/stack v1.8.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect + github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect - github.com/huin/goupnp v1.0.2 // indirect - github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect + github.com/huin/goupnp v1.0.3 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/mitchellh/mapstructure v1.4.2 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/go.sum b/go.sum index 80dd71d9..2efdf11b 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -21,7 +19,6 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -33,7 +30,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= @@ -50,53 +46,33 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= +github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= +github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible h1:FvPewruOgelqA/DVBdX7/Q6znUGGQ+g0ciG5tA2Fk98= github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= +github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 h1:GEvub7kU5YFAcn5A2uOo4AZSM1/cWZCOvfu7E3gQmK8= +github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0/go.mod h1:szA5wf9suAIcNg/1S3rGeFITHqrnqH5TC6b+O0SEQ94= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= @@ -109,7 +85,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= @@ -117,34 +92,31 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea h1:j4317fAZh7X6GqbFowYdYdI0L9bwxL07jyPZIdepyZ0= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/base58 v1.0.4 h1:QJC6B0E0rXOPA8U/kw2rP+qiRJsUaE2Er+pYb3siUeA= +github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38oGd9E= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20200219165308-d1232e640a87/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -154,32 +126,23 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.12/go.mod h1:PvsVkQmhZFx92Y+h2ylythYlheEDt/uBgFbl61Js/jo= -github.com/ethereum/go-ethereum v1.10.12 h1:el/KddB3gLEsnNgGQ3SQuZuiZjwnFTYHe5TwUet5Om4= -github.com/ethereum/go-ethereum v1.10.12/go.mod h1:W3yfrFyL9C1pHcwY5hmRHVDaorTiQxhYBkKyu5mEDHw= +github.com/ethereum/go-ethereum v1.10.20 h1:75IW830ClSS40yrQC1ZCMZCt5I+zU16oqId2SiQwdQ4= +github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -187,19 +150,14 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= @@ -232,15 +190,11 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -248,11 +202,10 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -262,237 +215,169 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= -github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= -github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI= -github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= +github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 h1:6OvNmYgJyexcZ3pYbTI9jWx5tHo1Dee/tWbLMfPe2TA= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk= +github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= -github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II= github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 h1:6OJQqOTH8b/bIa3Z5vwzX/HgdZLV3TJqivpmiUgw6DI= github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86/go.mod h1:EyC0vqnPRbDQGq3j4Ej9lSP/nKE8DwwjTwfQ0Yan6SQ= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= +github.com/vedhavyas/go-subkey v1.0.4 h1:QwjBZx4w7qXC2lmqol2jJfhaNXPI9BsgLZiMiCwqGDU= +github.com/vedhavyas/go-subkey v1.0.4/go.mod h1:aOIil/KS9hJlnr9ZSQKSoXdu/MbnkCxG4x9IOlLsMtI= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -522,30 +407,20 @@ go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLk go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= @@ -555,7 +430,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -580,7 +454,6 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -588,7 +461,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -606,14 +478,12 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -634,12 +504,9 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -647,17 +514,13 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -668,53 +531,43 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -731,7 +584,6 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -750,19 +602,13 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -790,7 +636,6 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -798,7 +643,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -855,24 +699,20 @@ google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cn google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -887,8 +727,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/mock/relayer.go b/mock/relayer.go index 8689694e..3e202412 100644 --- a/mock/relayer.go +++ b/mock/relayer.go @@ -113,15 +113,15 @@ func (mr *MockRelayedChainMockRecorder) DomainID() *gomock.Call { } // PollEvents mocks base method. -func (m *MockRelayedChain) PollEvents(ctx context.Context, sysErr chan<- error) { +func (m *MockRelayedChain) PollEvents(ctx context.Context) { m.ctrl.T.Helper() - m.ctrl.Call(m, "PollEvents", ctx, sysErr) + m.ctrl.Call(m, "PollEvents", ctx) } // PollEvents indicates an expected call of PollEvents. -func (mr *MockRelayedChainMockRecorder) PollEvents(ctx, sysErr any) *gomock.Call { +func (mr *MockRelayedChainMockRecorder) PollEvents(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx, sysErr) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx) } // Write mocks base method. diff --git a/relayer/relayer.go b/relayer/relayer.go index 519cf056..7cd3defa 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -17,7 +17,7 @@ type DepositMeter interface { } type RelayedChain interface { - PollEvents(ctx context.Context, sysErr chan<- error) + PollEvents(ctx context.Context) Write(messages []*types.Message) error DomainID() uint8 } @@ -34,13 +34,13 @@ type Relayer struct { // Start function starts the relayer. Relayer routine is starting all the chains // and passing them with a channel that accepts unified cross chain message format -func (r *Relayer) Start(ctx context.Context, msgChan chan []*types.Message, sysErr chan error) { +func (r *Relayer) Start(ctx context.Context, msgChan chan []*types.Message) { log.Debug().Msgf("Starting relayer") for _, c := range r.relayedChains { log.Debug().Msgf("Starting chain %v", c.DomainID()) r.addRelayedChain(c) - go c.PollEvents(ctx, sysErr) + go c.PollEvents(ctx) } for { From 43ae2e1a37f0e4902ed3d72f656edb39287a4145 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 16:57:45 +0200 Subject: [PATCH 20/27] Fix dependecies --- chains/substrate/executor/message-handler_test.go | 2 +- crypto/keystore/keyring.go | 2 +- crypto/sr25519/sr25519.go | 4 ++-- crypto/sr25519/sr25519_test.go | 2 +- go.mod | 2 +- go.sum | 5 ++--- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/chains/substrate/executor/message-handler_test.go b/chains/substrate/executor/message-handler_test.go index 67760473..52fdb62b 100644 --- a/chains/substrate/executor/message-handler_test.go +++ b/chains/substrate/executor/message-handler_test.go @@ -12,8 +12,8 @@ import ( "github.com/ChainSafe/sygma-core/chains/substrate/executor" "github.com/ChainSafe/sygma-core/types" - "github.com/centrifuge/go-substrate-rpc-client/signature" "github.com/centrifuge/go-substrate-rpc-client/v4/scale" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" substrateTypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" "github.com/ethereum/go-ethereum/common" diff --git a/crypto/keystore/keyring.go b/crypto/keystore/keyring.go index 6f88c89d..dd1d275f 100644 --- a/crypto/keystore/keyring.go +++ b/crypto/keystore/keyring.go @@ -9,7 +9,7 @@ import ( "github.com/ChainSafe/sygma-core/crypto" "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ChainSafe/sygma-core/crypto/sr25519" - "github.com/centrifuge/go-substrate-rpc-client/signature" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" ) // The Constant "keys". These are the name that the keys are based on. This can be expanded, but diff --git a/crypto/sr25519/sr25519.go b/crypto/sr25519/sr25519.go index 3f9db94f..c142c751 100644 --- a/crypto/sr25519/sr25519.go +++ b/crypto/sr25519/sr25519.go @@ -6,8 +6,8 @@ package sr25519 import ( "crypto/rand" - "github.com/centrifuge/go-substrate-rpc-client/signature" - "github.com/centrifuge/go-substrate-rpc-client/types" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" + "github.com/centrifuge/go-substrate-rpc-client/v4/types" "github.com/ethereum/go-ethereum/common/hexutil" ) diff --git a/crypto/sr25519/sr25519_test.go b/crypto/sr25519/sr25519_test.go index 1eb6c36e..9359a2dc 100644 --- a/crypto/sr25519/sr25519_test.go +++ b/crypto/sr25519/sr25519_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/centrifuge/go-substrate-rpc-client/signature" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" ) func TestNewKeypairFromSeed(t *testing.T) { diff --git a/go.mod b/go.mod index 7311773f..69fffb1f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/ChainSafe/sygma-core go 1.19 require ( - github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 github.com/ethereum/go-ethereum v1.10.20 github.com/imdario/mergo v0.3.12 @@ -21,6 +20,7 @@ require ( require ( github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/decred/base58 v1.0.4 // indirect diff --git a/go.sum b/go.sum index 2efdf11b..8296e390 100644 --- a/go.sum +++ b/go.sum @@ -62,15 +62,14 @@ github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1: github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible h1:FvPewruOgelqA/DVBdX7/Q6znUGGQ+g0ciG5tA2Fk98= -github.com/centrifuge/go-substrate-rpc-client v2.0.0+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 h1:GEvub7kU5YFAcn5A2uOo4AZSM1/cWZCOvfu7E3gQmK8= github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0/go.mod h1:szA5wf9suAIcNg/1S3rGeFITHqrnqH5TC6b+O0SEQ94= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= From 614cac2f187e4d823264fdcf629f8b154d285784 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 16:58:26 +0200 Subject: [PATCH 21/27] Bump go-ethereum --- go.mod | 42 +++++++---- go.sum | 229 ++++++++++++++++++++++----------------------------------- 2 files changed, 113 insertions(+), 158 deletions(-) diff --git a/go.mod b/go.mod index 69fffb1f..f32eee0d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 - github.com/ethereum/go-ethereum v1.10.20 + github.com/ethereum/go-ethereum v1.13.2 github.com/imdario/mergo v0.3.12 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.25.0 @@ -19,55 +19,67 @@ require ( require ( github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/bits-and-blooms/bitset v1.5.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.10.0 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/base58 v1.0.4 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/holiman/uint256 v1.2.3 // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/rs/cors v1.8.2 // indirect - github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 // indirect github.com/stretchr/objx v0.5.0 // indirect + github.com/supranational/blst v0.3.11 // indirect github.com/vedhavyas/go-subkey v1.0.4 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect - golang.org/x/crypto v0.7.0 // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/tools v0.9.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) require ( - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v1.8.0 // indirect - github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/mitchellh/mapstructure v1.4.2 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rjeczalik/notify v0.9.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/tklauser/go-sysconf v0.3.5 // indirect - github.com/tklauser/numcpus v0.2.2 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/go.sum b/go.sum index 8296e390..0bd4617b 100644 --- a/go.sum +++ b/go.sum @@ -31,37 +31,21 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE= +github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8= +github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= @@ -73,17 +57,14 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 h1:GEvub7kU5YFAcn5A2uOo4AZSM1/cWZCOvfu7E3gQmK8= github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0/go.mod h1:szA5wf9suAIcNg/1S3rGeFITHqrnqH5TC6b+O0SEQ94= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= @@ -91,32 +72,35 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= +github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= +github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= +github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= +github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/base58 v1.0.4 h1:QJC6B0E0rXOPA8U/kw2rP+qiRJsUaE2Er+pYb3siUeA= github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38oGd9E= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dop251/goja v0.0.0-20200219165308-d1232e640a87/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -124,38 +108,34 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.9.12/go.mod h1:PvsVkQmhZFx92Y+h2ylythYlheEDt/uBgFbl61Js/jo= -github.com/ethereum/go-ethereum v1.10.20 h1:75IW830ClSS40yrQC1ZCMZCt5I+zU16oqId2SiQwdQ4= -github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= +github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.13.2 h1:g9mCpfPWqCA1OL4e6C98PeVttb0HadfBRuKTGvMnOvw= +github.com/ethereum/go-ethereum v1.13.2/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -172,7 +152,6 @@ github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -189,9 +168,9 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -216,15 +195,14 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -234,124 +212,88 @@ github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/b github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= -github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= -github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk= github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= -github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II= github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86 h1:6OJQqOTH8b/bIa3Z5vwzX/HgdZLV3TJqivpmiUgw6DI= -github.com/status-im/keycard-go v0.0.0-20211004132608-c32310e39b86/go.mod h1:EyC0vqnPRbDQGq3j4Ej9lSP/nKE8DwwjTwfQ0Yan6SQ= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -361,21 +303,18 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/vedhavyas/go-subkey v1.0.4 h1:QwjBZx4w7qXC2lmqol2jJfhaNXPI9BsgLZiMiCwqGDU= github.com/vedhavyas/go-subkey v1.0.4/go.mod h1:aOIil/KS9hJlnr9ZSQKSoXdu/MbnkCxG4x9IOlLsMtI= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -413,12 +352,10 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -429,6 +366,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= +golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -450,6 +389,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -483,8 +424,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -500,11 +441,11 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -514,6 +455,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -535,7 +477,6 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -543,8 +484,10 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -555,12 +498,12 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -603,6 +546,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -696,19 +641,16 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -718,7 +660,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -729,3 +670,5 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= From 176eaa8ae35f4b55131678e8b5dac16443d9e6c6 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 17:01:21 +0200 Subject: [PATCH 22/27] Update import --- chains/substrate/connection/connection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chains/substrate/connection/connection.go b/chains/substrate/connection/connection.go index 6b95679a..74e478d6 100644 --- a/chains/substrate/connection/connection.go +++ b/chains/substrate/connection/connection.go @@ -74,8 +74,8 @@ func (c *Connection) UpdateMetatdata() error { } func (c *Connection) GetBlockEvents(hash types.Hash) ([]*parser.Event, error) { - provider := state.NewProvider(c.State) - eventRetriever, err := retriever.NewDefaultEventRetriever(provider) + provider := state.NewEventProvider(c.State) + eventRetriever, err := retriever.NewDefaultEventRetriever(provider, c.State) if err != nil { return nil, err } From 47f26ec2abc2b5c6a43c4c6f375611157f82dc4b Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 17:13:54 +0200 Subject: [PATCH 23/27] Remove keystore and sr25519 support --- crypto/keystore/keyring.go | 121 -------------------------------- crypto/keystore/keyring_test.go | 39 ---------- crypto/sr25519/sr25519.go | 61 ---------------- crypto/sr25519/sr25519_test.go | 56 --------------- 4 files changed, 277 deletions(-) delete mode 100644 crypto/keystore/keyring.go delete mode 100644 crypto/keystore/keyring_test.go delete mode 100644 crypto/sr25519/sr25519.go delete mode 100644 crypto/sr25519/sr25519_test.go diff --git a/crypto/keystore/keyring.go b/crypto/keystore/keyring.go deleted file mode 100644 index dd1d275f..00000000 --- a/crypto/keystore/keyring.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package keystore - -import ( - "fmt" - - "github.com/ChainSafe/sygma-core/crypto" - "github.com/ChainSafe/sygma-core/crypto/secp256k1" - "github.com/ChainSafe/sygma-core/crypto/sr25519" - "github.com/centrifuge/go-substrate-rpc-client/v4/signature" -) - -// The Constant "keys". These are the name that the keys are based on. This can be expanded, but -// any additions must be added to Keys and to insecureKeyFromAddress - -const AliceKey = "alice" -const BobKey = "bob" -const CharlieKey = "charlie" -const DaveKey = "dave" -const EveKey = "eve" - -var Keys = []string{AliceKey, BobKey, CharlieKey, DaveKey, EveKey} - -// The Chain type Constants -const EthChain = "ethereum" -const SubChain = "substrate" - -var TestKeyRing *TestKeyRingHolder - -var AliceSr25519 = sr25519.NewKeypairFromKRP(signature.KeyringPair{ - URI: "//Alice", - Address: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", - PublicKey: []byte{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, -}) - -var BobSr25519 = sr25519.NewKeypairFromKRP(signature.KeyringPair{ - URI: "//Bob", - Address: "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty", - PublicKey: []byte{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, -}) - -var CharlieSr25519 = sr25519.NewKeypairFromKRP(signature.KeyringPair{ - URI: "//Charlie", - Address: "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y", - PublicKey: []byte{0x90, 0xb5, 0xab, 0x20, 0x5c, 0x69, 0x74, 0xc9, 0xea, 0x84, 0x1b, 0xe6, 0x88, 0x86, 0x46, 0x33, 0xdc, 0x9c, 0xa8, 0xa3, 0x57, 0x84, 0x3e, 0xea, 0xcf, 0x23, 0x14, 0x64, 0x99, 0x65, 0xfe, 0x22}, -}) - -var DaveSr25519 = sr25519.NewKeypairFromKRP(signature.KeyringPair{ - URI: "//Dave", - Address: "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy", - PublicKey: []byte{0x30, 0x67, 0x21, 0x21, 0x1d, 0x54, 0x4, 0xbd, 0x9d, 0xa8, 0x8e, 0x2, 0x4, 0x36, 0xa, 0x1a, 0x9a, 0xb8, 0xb8, 0x7c, 0x66, 0xc1, 0xbc, 0x2f, 0xcd, 0xd3, 0x7f, 0x3c, 0x22, 0x22, 0xcc, 0x20}, -}) - -var EveSr25519 = sr25519.NewKeypairFromKRP(signature.KeyringPair{ - URI: "//Eve", - Address: "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw", - PublicKey: []byte{0xe6, 0x59, 0xa7, 0xa1, 0x62, 0x8c, 0xdd, 0x93, 0xfe, 0xbc, 0x4, 0xa4, 0xe0, 0x64, 0x6e, 0xa2, 0xe, 0x9f, 0x5f, 0xc, 0xe0, 0x97, 0xd9, 0xa0, 0x52, 0x90, 0xd4, 0xa9, 0xe0, 0x54, 0xdf, 0x4e}, -}) - -// TestKeyStore is a struct that holds a Keystore of all the test keys -type TestKeyRingHolder struct { - EthereumKeys map[string]*secp256k1.Keypair - SubstrateKeys map[string]*sr25519.Keypair -} - -// Init function to create a keyRing that can be accessed anywhere without having to recreate the data -func init() { - TestKeyRing = &TestKeyRingHolder{ - EthereumKeys: makeEthRing(), - SubstrateKeys: map[string]*sr25519.Keypair{ - AliceKey: AliceSr25519, - BobKey: BobSr25519, - CharlieKey: CharlieSr25519, - DaveKey: DaveSr25519, - EveKey: EveSr25519, - }, - } - -} - -func makeEthRing() map[string]*secp256k1.Keypair { - ring := map[string]*secp256k1.Keypair{} - for _, key := range Keys { - bz := padWithZeros([]byte(key), secp256k1.PrivateKeyLength) - kp, err := secp256k1.NewKeypairFromPrivateKey(bz) - if err != nil { - panic(err) - } - ring[key] = kp - } - - return ring -} - -// padWithZeros adds on extra 0 bytes to make a byte array of a specified length -func padWithZeros(key []byte, targetLength int) []byte { - res := make([]byte, targetLength-len(key)) - return append(res, key...) -} - -// insecureKeypairFromAddress is used for resolving addresses to test keypairs. -func insecureKeypairFromAddress(key string, chainType string) (crypto.Keypair, error) { - var kp crypto.Keypair - var ok bool - - if chainType == EthChain { - kp, ok = TestKeyRing.EthereumKeys[key] - } else if chainType == SubChain { - kp, ok = TestKeyRing.SubstrateKeys[key] - } else { - return nil, fmt.Errorf("unrecognized chain type: %s", chainType) - } - - if !ok { - return nil, fmt.Errorf("invalid test key selection: %s", key) - } - - return kp, nil -} diff --git a/crypto/keystore/keyring_test.go b/crypto/keystore/keyring_test.go deleted file mode 100644 index e3128600..00000000 --- a/crypto/keystore/keyring_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package keystore - -import ( - "bytes" - "reflect" - "testing" -) - -func TestByteLength(t *testing.T) { - res := padWithZeros([]byte("Alice"), 32) - - exp := append([]byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, []byte("Alice")...) - if !bytes.Equal(exp, res) { - t.Fatalf("Fail. Got: %#v\n\tExpected: %#v\n", res, exp) - } -} -func TestInsecureAddresses(t *testing.T) { - tkp, err := insecureKeypairFromAddress(AliceKey, EthChain) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(tkp, TestKeyRing.EthereumKeys[AliceKey]) { - t.Fatalf("Key is not being returned correctly") - } - - tkp, err = insecureKeypairFromAddress(AliceKey, SubChain) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(tkp, TestKeyRing.SubstrateKeys[AliceKey]) { - t.Fatalf("Key is not being returned correctly") - } - -} diff --git a/crypto/sr25519/sr25519.go b/crypto/sr25519/sr25519.go deleted file mode 100644 index c142c751..00000000 --- a/crypto/sr25519/sr25519.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package sr25519 - -import ( - "crypto/rand" - - "github.com/centrifuge/go-substrate-rpc-client/v4/signature" - "github.com/centrifuge/go-substrate-rpc-client/v4/types" - "github.com/ethereum/go-ethereum/common/hexutil" -) - -type Keypair struct { - keyringPair *signature.KeyringPair -} - -func GenerateKeypair(network string) (*Keypair, error) { - data := make([]byte, 32) - _, err := rand.Read(data) - if err != nil { - return nil, err - } - return NewKeypairFromSeed("//"+hexutil.Encode(data), network) -} - -func NewKeypairFromSeed(seed, network string) (*Keypair, error) { - kp, err := signature.KeyringPairFromSecret(seed, network) - return &Keypair{&kp}, err -} - -func NewKeypairFromKRP(pair signature.KeyringPair) *Keypair { - return &Keypair{&pair} -} - -// AsKeyringPair returns the underlying KeyringPair -func (kp *Keypair) AsKeyringPair() *signature.KeyringPair { - return kp.keyringPair -} - -// Encode uses scale to encode underlying KeyringPair -func (kp *Keypair) Encode() []byte { - out, _ := types.EncodeToBytes(kp.keyringPair) - return out -} - -// Decode initializes keypair by decoding input as a KeyringPair -func (kp *Keypair) Decode(in []byte) error { - kp.keyringPair = &signature.KeyringPair{} - return types.DecodeFromBytes(in, kp.keyringPair) -} - -// Address returns the ss58 formated address -func (kp *Keypair) Address() string { - return kp.keyringPair.Address -} - -// PublicKey returns the publickey encoded as a string -func (kp *Keypair) PublicKey() string { - return hexutil.Encode(kp.keyringPair.PublicKey) -} diff --git a/crypto/sr25519/sr25519_test.go b/crypto/sr25519/sr25519_test.go deleted file mode 100644 index 9359a2dc..00000000 --- a/crypto/sr25519/sr25519_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2020 ChainSafe Systems -// SPDX-License-Identifier: LGPL-3.0-only - -package sr25519 - -import ( - "reflect" - "testing" - - "github.com/centrifuge/go-substrate-rpc-client/v4/signature" -) - -func TestNewKeypairFromSeed(t *testing.T) { - kp, err := NewKeypairFromSeed("//Alice", "substrate") - if err != nil { - t.Fatal(err) - } - - if kp.PublicKey() == "" || kp.Address() == "" { - t.Fatalf("key is missing data: %#v", kp) - } -} - -func TestKeypair_AsKeyringPair(t *testing.T) { - kp, err := NewKeypairFromSeed("//Alice", "substrate") - if err != nil { - t.Fatal(err) - } - - krp := kp.AsKeyringPair() - - // TODO: Add expected output from subkey - - if !reflect.DeepEqual(&signature.TestKeyringPairAlice, krp) { - t.Fatalf("unexpected result.\n\tGot: %#v\n\texpected: %#v\n", krp, &signature.TestKeyringPairAlice) - } - -} - -func TestEncodeAndDecodeKeypair(t *testing.T) { - kp, err := NewKeypairFromSeed("//Alice", "substrate") - if err != nil { - t.Fatal(err) - } - - enc := kp.Encode() - res := new(Keypair) - err = res.Decode(enc) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(res, kp) { - t.Fatalf("Fail: got %#v expected %#v", res, kp) - } -} From 7b14fc0b603721392e9c7e09a19024d6492252c5 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 17:16:55 +0200 Subject: [PATCH 24/27] Hardcode random ethereum private key --- chains/evm/transactor/transaction/transaction_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chains/evm/transactor/transaction/transaction_test.go b/chains/evm/transactor/transaction/transaction_test.go index f038021b..41aa9bd0 100644 --- a/chains/evm/transactor/transaction/transaction_test.go +++ b/chains/evm/transactor/transaction/transaction_test.go @@ -6,7 +6,7 @@ import ( "github.com/ChainSafe/sygma-core/chains/evm/transactor/gas" "github.com/ChainSafe/sygma-core/chains/evm/transactor/transaction" - "github.com/ChainSafe/sygma-core/crypto/keystore" + "github.com/ChainSafe/sygma-core/crypto/secp256k1" "github.com/ChainSafe/sygma-core/mock" "github.com/ethereum/go-ethereum/core/types" @@ -17,7 +17,7 @@ import ( "go.uber.org/mock/gomock" ) -var aliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey] +var aliceKp, _ = secp256k1.NewKeypairFromString("b1370fac45517e19e27e16a2a31da07b9775d3a3bceb77a78f790f99655aa668") type EVMTxTestSuite struct { suite.Suite From 68efd2ce73d2bfeef2608a98f5491b7048972c00 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Mon, 2 Oct 2023 17:18:41 +0200 Subject: [PATCH 25/27] Rename message handler in tests --- chains/substrate/executor/message-handler_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chains/substrate/executor/message-handler_test.go b/chains/substrate/executor/message-handler_test.go index 52fdb62b..8bed70a3 100644 --- a/chains/substrate/executor/message-handler_test.go +++ b/chains/substrate/executor/message-handler_test.go @@ -66,7 +66,7 @@ func (s *MessageHandlerTestSuite) TestSuccesfullyRegisterFungibleTransferMessage depositMessageHandler := executor.NewSubstrateMessageHandler() // Register FungibleTransferMessageHandler function - depositMessageHandler.RegisterMessageHandler("fungible", ExampleMessageHandler) + depositMessageHandler.RegisterMessageHandler("fungible", FungibleMessageHandler) prop1, err1 := depositMessageHandler.HandleMessage(messageData) s.Nil(err1) s.NotNil(prop1) @@ -77,7 +77,7 @@ func (s *MessageHandlerTestSuite) TestSuccesfullyRegisterFungibleTransferMessage s.NotNil(err2) } -func ExampleMessageHandler(m *types.Message) (*types.Proposal, error) { +func FungibleMessageHandler(m *types.Message) (*types.Proposal, error) { if len(m.Payload) != 2 { return nil, errors.New("malformed payload. Len of payload should be 2") } From 3526c8340c5604696986f8d476547fd751b80cc1 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Wed, 4 Oct 2023 14:04:43 +0200 Subject: [PATCH 26/27] Regenerate mocks --- mock/relayer.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mock/relayer.go b/mock/relayer.go index ea62ee52..3e202412 100644 --- a/mock/relayer.go +++ b/mock/relayer.go @@ -113,7 +113,6 @@ func (mr *MockRelayedChainMockRecorder) DomainID() *gomock.Call { } // PollEvents mocks base method. -<<<<<<< HEAD func (m *MockRelayedChain) PollEvents(ctx context.Context) { m.ctrl.T.Helper() m.ctrl.Call(m, "PollEvents", ctx) @@ -123,17 +122,6 @@ func (m *MockRelayedChain) PollEvents(ctx context.Context) { func (mr *MockRelayedChainMockRecorder) PollEvents(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx) -======= -func (m *MockRelayedChain) PollEvents(ctx context.Context, sysErr chan<- error) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "PollEvents", ctx, sysErr) -} - -// PollEvents indicates an expected call of PollEvents. -func (mr *MockRelayedChainMockRecorder) PollEvents(ctx, sysErr any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PollEvents", reflect.TypeOf((*MockRelayedChain)(nil).PollEvents), ctx, sysErr) ->>>>>>> main } // Write mocks base method. From d9a4739ebe5dba449d0f752c454ead85e2442cb8 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Wed, 4 Oct 2023 14:19:09 +0200 Subject: [PATCH 27/27] Bump critical dependency --- go.mod | 4 ++-- go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index f32eee0d..a4227d5b 100644 --- a/go.mod +++ b/go.mod @@ -20,12 +20,12 @@ require ( require ( github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/bits-and-blooms/bitset v1.5.0 // indirect + github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.10.0 // indirect + github.com/consensys/gnark-crypto v0.12.0 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index 0bd4617b..a1a1a6fe 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8= -github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= +github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= @@ -79,8 +79,8 @@ github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVM github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= -github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= +github.com/consensys/gnark-crypto v0.12.0 h1:1OnSpOykNkUIBIBJKdhwy2p0JlW5o+Az02ICzZmvvdg= +github.com/consensys/gnark-crypto v0.12.0/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= @@ -232,7 +232,7 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -642,8 +642,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=