diff --git a/cmd/zetatool/filterdeposit/btc.go b/cmd/zetatool/filterdeposit/btc.go index bc2397523d..a8ded3f08b 100644 --- a/cmd/zetatool/filterdeposit/btc.go +++ b/cmd/zetatool/filterdeposit/btc.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/cmd/zetatool/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" ) func NewBtcCmd() *cobra.Command { @@ -162,7 +162,7 @@ func getHashList(cfg *config.Config, tssAddress string) ([]Deposit, error) { if err != nil { continue } - if bytes.Equal(memoBytes, []byte(common.DonationMessage)) { + if bytes.Equal(memoBytes, []byte(pkg.DonationMessage)) { continue } } else { diff --git a/cmd/zetatool/filterdeposit/evm.go b/cmd/zetatool/filterdeposit/evm.go index 73e1f8b78f..4e26ed1338 100644 --- a/cmd/zetatool/filterdeposit/evm.go +++ b/cmd/zetatool/filterdeposit/evm.go @@ -18,7 +18,7 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol" "github.com/zeta-chain/zetacore/cmd/zetatool/config" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" ) const ( @@ -202,7 +202,7 @@ func getTSSDeposits(tssAddress string, startBlock uint64, endBlock uint64, apiKe for _, tx := range txns { if tx.To == tssAddress { - if strings.Compare(tx.Input, zetacommon.DonationMessage) == 0 { + if strings.Compare(tx.Input, pkg.DonationMessage) == 0 { continue // skip donation tx } if tx.TxReceiptStatus != "1" { diff --git a/x/observer/keeper/msg_server_reset_chain_nonces.go b/x/observer/keeper/msg_server_reset_chain_nonces.go index b3d1731645..feb23b58c4 100644 --- a/x/observer/keeper/msg_server_reset_chain_nonces.go +++ b/x/observer/keeper/msg_server_reset_chain_nonces.go @@ -4,7 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -22,7 +22,7 @@ func (k msgServer) ResetChainNonces(goCtx context.Context, msg *types.MsgResetCh return nil, types.ErrTssNotFound } - chain := common.GetChainFromChainID(msg.ChainId) + chain := pkg.GetChainFromChainID(msg.ChainId) if chain == nil { return nil, types.ErrSupportedChains } diff --git a/x/observer/keeper/msg_server_reset_chain_nonces_test.go b/x/observer/keeper/msg_server_reset_chain_nonces_test.go index 46da328fe8..0b1e60e4c6 100644 --- a/x/observer/keeper/msg_server_reset_chain_nonces_test.go +++ b/x/observer/keeper/msg_server_reset_chain_nonces_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -19,7 +19,7 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { UseAuthorityMock: true, }) srv := keeper.NewMsgServerImpl(*k) - chainId := common.GoerliLocalnetChain().ChainId + chainId := pkg.GoerliLocalnetChain().ChainId admin := sample.AccAddress() authorityMock := keepertest.GetObserverAuthorityMock(t, k) @@ -44,7 +44,7 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { authorityMock := keepertest.GetObserverAuthorityMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) - chainId := common.GoerliLocalnetChain().ChainId + chainId := pkg.GoerliLocalnetChain().ChainId _, err := srv.ResetChainNonces(sdk.WrapSDKContext(ctx), &types.MsgResetChainNonces{ Creator: admin, ChainId: chainId, @@ -88,8 +88,8 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) - chainId := common.GoerliLocalnetChain().ChainId - index := common.GoerliLocalnetChain().ChainName.String() + chainId := pkg.GoerliLocalnetChain().ChainId + index := pkg.GoerliLocalnetChain().ChainName.String() // check existing chain nonces _, found := k.GetChainNonces(ctx, index) diff --git a/x/observer/types/message_reset_chain_nonces.go b/x/observer/types/message_reset_chain_nonces.go index 71e438d103..b14cb75df1 100644 --- a/x/observer/types/message_reset_chain_nonces.go +++ b/x/observer/types/message_reset_chain_nonces.go @@ -4,7 +4,7 @@ import ( "errors" cosmoserrors "cosmossdk.io/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -51,7 +51,7 @@ func (msg *MsgResetChainNonces) ValidateBasic() error { } // Check if chain exists - chain := common.GetChainFromChainID(msg.ChainId) + chain := pkg.GetChainFromChainID(msg.ChainId) if chain == nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "invalid chain id (%d)", msg.ChainId) } diff --git a/x/observer/types/message_reset_chain_nonces_test.go b/x/observer/types/message_reset_chain_nonces_test.go index 7043432952..3b8f1788f4 100644 --- a/x/observer/types/message_reset_chain_nonces_test.go +++ b/x/observer/types/message_reset_chain_nonces_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -20,7 +20,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "valid message chain nonce high greater than nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 5, }, @@ -30,7 +30,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "valid message chain nonce high same as nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 1, }, @@ -40,7 +40,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid address", msg: types.MsgResetChainNonces{ Creator: "invalid_address", - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, }, wantErr: true, }, @@ -56,7 +56,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, ChainNonceLow: -1, }, wantErr: true, @@ -65,7 +65,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce high", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: -1, }, @@ -75,7 +75,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce low greater than chain nonce high", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: pkg.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 0, }, diff --git a/zetaclient/testutils/stub/chain_signer.go b/zetaclient/testutils/stub/chain_signer.go index 364cbc22bb..e659a16278 100644 --- a/zetaclient/testutils/stub/chain_signer.go +++ b/zetaclient/testutils/stub/chain_signer.go @@ -2,7 +2,7 @@ package stub import ( ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/interfaces" "github.com/zeta-chain/zetacore/zetaclient/outtxprocessor" @@ -15,13 +15,13 @@ var _ interfaces.ChainSigner = (*EVMSigner)(nil) // EVMSigner is a mock of evm chain signer for testing type EVMSigner struct { - Chain common.Chain + Chain pkg.Chain ZetaConnectorAddress ethcommon.Address ERC20CustodyAddress ethcommon.Address } func NewEVMSigner( - chain common.Chain, + chain pkg.Chain, zetaConnectorAddress ethcommon.Address, erc20CustodyAddress ethcommon.Address, ) *EVMSigner {