From 3fd9c9a95f59a3a4c79fe2050b25f37eda6c0377 Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Fri, 7 Jun 2024 18:16:34 +0200 Subject: [PATCH] refactor: perform some various renaming fixes (#2323) * rename metacore and utxos * inbound, outbounds * manager renaming --- docs/openapi/openapi.swagger.yaml | 4 +- docs/zetaclient/zetaclient_logging.md | 2 +- .../zetacore/crosschain/genesis.proto | 2 +- .../zetacore/observer/observer.proto | 4 +- testutil/keeper/crosschain.go | 6 +- testutil/sample/observer.go | 2 +- .../zetacore/crosschain/genesis_pb.d.ts | 2 +- .../zetacore/observer/observer_pb.d.ts | 8 +-- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../keeper/msg_server_vote_inbound_tx_test.go | 4 +- .../msg_server_vote_outbound_tx_test.go | 32 +++++----- x/crosschain/keeper/process_outbound.go | 4 +- x/crosschain/types/cctx.go | 8 +-- x/crosschain/types/cctx_test.go | 4 +- x/crosschain/types/genesis.pb.go | 2 +- x/crosschain/types/keys.go | 2 + .../keeper/msg_server_vote_block_header.go | 2 +- x/observer/keeper/utils_test.go | 2 +- x/observer/keeper/vote_inbound.go | 6 +- x/observer/keeper/vote_inbound_test.go | 4 +- x/observer/keeper/vote_outbound.go | 2 +- x/observer/keeper/vote_outbound_test.go | 4 +- x/observer/types/ballot_test.go | 2 +- x/observer/types/observer.pb.go | 60 +++++++++---------- x/observer/types/parsers_test.go | 4 +- zetaclient/chains/bitcoin/observer/inbound.go | 2 +- .../chains/bitcoin/observer/observer.go | 30 +++++----- zetaclient/chains/bitcoin/signer/signer.go | 6 +- zetaclient/chains/evm/observer/inbound.go | 6 +- .../chains/evm/signer/outbound_data_test.go | 2 +- zetaclient/chains/evm/signer/signer_test.go | 4 +- zetaclient/orchestrator/orchestrator.go | 2 +- ...essor_manager.go => outbound_processor.go} | 4 +- ...ger_test.go => outbound_processor_test.go} | 0 zetaclient/zetacore/tx.go | 4 +- zetaclient/zetacore/tx_test.go | 4 +- 36 files changed, 120 insertions(+), 118 deletions(-) rename zetaclient/outboundprocessor/{outbound_processor_manager.go => outbound_processor.go} (94%) rename zetaclient/outboundprocessor/{outbound_processor_manager_test.go => outbound_processor_test.go} (100%) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index ac40f0b45a..dc72d0bf6b 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -57938,8 +57938,8 @@ definitions: type: string enum: - EmptyObserverType - - InBoundTx - - OutBoundTx + - InboundTx + - OutboundTx - TSSKeyGen - TSSKeySign default: EmptyObserverType diff --git a/docs/zetaclient/zetaclient_logging.md b/docs/zetaclient/zetaclient_logging.md index b59f4b8f70..2782609d78 100644 --- a/docs/zetaclient/zetaclient_logging.md +++ b/docs/zetaclient/zetaclient_logging.md @@ -23,7 +23,7 @@ - WatchInbound : chain = `BTC` module=`WatchInbound` - WatchGasPrice : chain = `BTC` module=`WatchGasPrice` - ObserverOutbound : chain = `BTC` module=`ObserveOutbound` - - WatchUTXOS:chain = `BTC` module=`WatchUTXOS` + - WatchUTXOs:chain = `BTC` module=`WatchUTXOs` - EVMLoggers ( Individual sections for each EVM Chain) - ChainLogger : chain = `evm_chain_name` - BuildBlockIndex : chain = `evm_chain_name` module=`BuildBlockIndex` diff --git a/proto/zetachain/zetacore/crosschain/genesis.proto b/proto/zetachain/zetacore/crosschain/genesis.proto index 92f9fdfbde..7ffef701d5 100644 --- a/proto/zetachain/zetacore/crosschain/genesis.proto +++ b/proto/zetachain/zetacore/crosschain/genesis.proto @@ -12,7 +12,7 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; -// GenesisState defines the metacore module's genesis state. +// GenesisState defines the crosschain module's genesis state. message GenesisState { repeated OutboundTracker outboundTrackerList = 2 [ (gogoproto.nullable) = false ]; diff --git a/proto/zetachain/zetacore/observer/observer.proto b/proto/zetachain/zetacore/observer/observer.proto index 2d0fe2c7f4..240f0025f0 100644 --- a/proto/zetachain/zetacore/observer/observer.proto +++ b/proto/zetachain/zetacore/observer/observer.proto @@ -9,8 +9,8 @@ option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; enum ObservationType { option (gogoproto.goproto_enum_stringer) = true; EmptyObserverType = 0; - InBoundTx = 1; - OutBoundTx = 2; + InboundTx = 1; + OutboundTx = 2; TSSKeyGen = 3; TSSKeySign = 4; } diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index 5ca5acbaae..693234ab77 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -392,11 +392,11 @@ func MockVoteOnOutboundFailedBallot( Once() } -func MockGetOutBound(m *crosschainmocks.CrosschainObserverKeeper, ctx sdk.Context) { +func MockGetOutbound(m *crosschainmocks.CrosschainObserverKeeper, ctx sdk.Context) { m.On("GetTSS", ctx).Return(observertypes.TSS{}, true).Once() } -func MockSaveOutBound( +func MockSaveOutbound( m *crosschainmocks.CrosschainObserverKeeper, ctx sdk.Context, cctx *types.CrossChainTx, @@ -408,7 +408,7 @@ func MockSaveOutBound( m.On("GetTSS", ctx).Return(observertypes.TSS{}, true) } -func MockSaveOutBoundNewRevertCreated( +func MockSaveOutboundNewRevertCreated( m *crosschainmocks.CrosschainObserverKeeper, ctx sdk.Context, cctx *types.CrossChainTx, diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index a67636642e..3c1a38bc0d 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -229,7 +229,7 @@ func BallotList(n int, observerSet []string) []types.Ballot { BallotIdentifier: identifier.Hex(), VoterList: observerSet, Votes: VotesSuccessOnly(len(observerSet)), - ObservationType: types.ObservationType_InBoundTx, + ObservationType: types.ObservationType_InboundTx, BallotThreshold: sdk.OneDec(), BallotStatus: types.BallotStatus_BallotFinalized_SuccessObservation, BallotCreationHeight: 0, diff --git a/typescript/zetachain/zetacore/crosschain/genesis_pb.d.ts b/typescript/zetachain/zetacore/crosschain/genesis_pb.d.ts index c1e1648048..35b98487a7 100644 --- a/typescript/zetachain/zetacore/crosschain/genesis_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/genesis_pb.d.ts @@ -14,7 +14,7 @@ import type { InboundTracker } from "./inbound_tracker_pb.js"; import type { RateLimiterFlags } from "./rate_limiter_flags_pb.js"; /** - * GenesisState defines the metacore module's genesis state. + * GenesisState defines the crosschain module's genesis state. * * @generated from message zetachain.zetacore.crosschain.GenesisState */ diff --git a/typescript/zetachain/zetacore/observer/observer_pb.d.ts b/typescript/zetachain/zetacore/observer/observer_pb.d.ts index 04673d8f46..551d977036 100644 --- a/typescript/zetachain/zetacore/observer/observer_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/observer_pb.d.ts @@ -16,14 +16,14 @@ export declare enum ObservationType { EmptyObserverType = 0, /** - * @generated from enum value: InBoundTx = 1; + * @generated from enum value: InboundTx = 1; */ - InBoundTx = 1, + InboundTx = 1, /** - * @generated from enum value: OutBoundTx = 2; + * @generated from enum value: OutboundTx = 2; */ - OutBoundTx = 2, + OutboundTx = 2, /** * @generated from enum value: TSSKeyGen = 3; diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index 89e7c5a152..8e158c1172 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -95,6 +95,6 @@ func (c CCTXGatewayZEVM) InitiateOutbound(ctx sdk.Context, cctx *types.CrossChai } // successful HandleEVMDeposit; commit() - cctx.SetOutBoundMined("Remote omnichain contract call completed") + cctx.SetOutboundMined("Remote omnichain contract call completed") return types.CctxStatus_OutboundMined } diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index e2bf3c8c50..1a94c3f10d 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -82,7 +82,7 @@ func TestKeeper_VoteInbound(t *testing.T) { ctx, msg.Digest(), zk.ObserverKeeper.GetSupportedChainFromChainID(ctx, msg.SenderChainId), - observertypes.ObservationType_InBoundTx, + observertypes.ObservationType_InboundTx, ) require.Equal(t, ballot.BallotStatus, observertypes.BallotStatus_BallotFinalized_SuccessObservation) cctx, found := k.GetCrossChainTx(ctx, msg.Digest()) @@ -223,7 +223,7 @@ func TestKeeper_VoteInbound(t *testing.T) { ctx, msg.Digest(), zk.ObserverKeeper.GetSupportedChainFromChainID(ctx, msg.SenderChainId), - observertypes.ObservationType_InBoundTx, + observertypes.ObservationType_InboundTx, ) require.Equal(t, ballot.BallotStatus, observertypes.BallotStatus_BallotInProgress) require.Equal(t, ballot.Votes[0], observertypes.VoteType_SuccessObservation) diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go index 427876d702..ca7661a3e1 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go @@ -146,11 +146,11 @@ func TestKeeper_VoteOutbound(t *testing.T) { // Successfully mock VoteOnOutboundBallot keepertest.MockVoteOnOutboundSuccessBallot(observerMock, ctx, cctx, *senderChain, observer) - // Successfully mock GetOutBound - keepertest.MockGetOutBound(observerMock, ctx) + // Successfully mock GetOutbound + keepertest.MockGetOutbound(observerMock, ctx) // Successfully mock SaveSuccessfulOutbound - keepertest.MockSaveOutBound(observerMock, ctx, cctx, tss) + keepertest.MockSaveOutbound(observerMock, ctx, cctx, tss) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.VoteOutbound(ctx, &types.MsgVoteOutbound{ @@ -197,16 +197,16 @@ func TestKeeper_VoteOutbound(t *testing.T) { // Successfully mock VoteOnOutboundBallot keepertest.MockVoteOnOutboundFailedBallot(observerMock, ctx, cctx, *senderChain, observer) - // Successfully mock GetOutBound - keepertest.MockGetOutBound(observerMock, ctx) + // Successfully mock GetOutbound + keepertest.MockGetOutbound(observerMock, ctx) // Successfully mock ProcessOutbound keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) _ = keepertest.MockUpdateNonce(observerMock, *senderChain) - //Successfully mock SaveOutBound - keepertest.MockSaveOutBoundNewRevertCreated(observerMock, ctx, cctx, tss) + //Successfully mock SaveOutbound + keepertest.MockSaveOutboundNewRevertCreated(observerMock, ctx, cctx, tss) oldParamsLen := len(cctx.OutboundParams) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.VoteOutbound(ctx, &types.MsgVoteOutbound{ @@ -256,8 +256,8 @@ func TestKeeper_VoteOutbound(t *testing.T) { // Successfully mock VoteOnOutboundBallot keepertest.MockVoteOnOutboundFailedBallot(observerMock, ctx, cctx, *senderChain, observer) - // Successfully mock GetOutBound - keepertest.MockGetOutBound(observerMock, ctx) + // Successfully mock GetOutbound + keepertest.MockGetOutbound(observerMock, ctx) // Mock Failed ProcessOutbound keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) @@ -265,8 +265,8 @@ func TestKeeper_VoteOutbound(t *testing.T) { observerMock.On("GetChainNonces", mock.Anything, senderChain.ChainName.String()). Return(observertypes.ChainNonces{}, false) - //Successfully mock SaveOutBound - keepertest.MockSaveOutBound(observerMock, ctx, cctx, tss) + //Successfully mock SaveOutbound + keepertest.MockSaveOutbound(observerMock, ctx, cctx, tss) oldParamsLen := len(cctx.OutboundParams) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.VoteOutbound(ctx, &types.MsgVoteOutbound{ @@ -321,15 +321,15 @@ func TestKeeper_VoteOutbound(t *testing.T) { // Successfully mock VoteOnOutboundBallot keepertest.MockVoteOnOutboundFailedBallot(observerMock, ctx, cctx, *senderChain, observer) - // Successfully mock GetOutBound - keepertest.MockGetOutBound(observerMock, ctx) + // Successfully mock GetOutbound + keepertest.MockGetOutbound(observerMock, ctx) // Fail ProcessOutbound so that changes are not committed to the state fungibleMock.On("GetForeignCoinFromAsset", mock.Anything, mock.Anything, mock.Anything). Return(fungibletypes.ForeignCoins{}, false) //Successfully mock SaveFailedOutbound - keepertest.MockSaveOutBound(observerMock, ctx, cctx, tss) + keepertest.MockSaveOutbound(observerMock, ctx, cctx, tss) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.VoteOutbound(ctx, &types.MsgVoteOutbound{ @@ -450,7 +450,7 @@ func TestKeeper_VoteOutbound(t *testing.T) { }) } -func TestKeeper_SaveFailedOutBound(t *testing.T) { +func TestKeeper_SaveFailedOutbound(t *testing.T) { t.Run("successfully save failed outbound", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := sample.CrossChainTx(t, "test") @@ -472,7 +472,7 @@ func TestKeeper_SaveFailedOutBound(t *testing.T) { }) } -func TestKeeper_SaveSuccessfulOutBound(t *testing.T) { +func TestKeeper_SaveSuccessfulOutbound(t *testing.T) { t.Run("successfully save successful outbound", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := sample.CrossChainTx(t, "test") diff --git a/x/crosschain/keeper/process_outbound.go b/x/crosschain/keeper/process_outbound.go index 51c0f43afe..f0b4127f3e 100644 --- a/x/crosschain/keeper/process_outbound.go +++ b/x/crosschain/keeper/process_outbound.go @@ -68,7 +68,7 @@ func (k Keeper) ProcessSuccessfulOutbound(ctx sdk.Context, cctx *types.CrossChai case types.CctxStatus_PendingRevert: cctx.SetReverted("Outbound succeeded, revert executed") case types.CctxStatus_PendingOutbound: - cctx.SetOutBoundMined("Outbound succeeded, mined") + cctx.SetOutboundMined("Outbound succeeded, mined") default: return } @@ -123,7 +123,7 @@ func (k Keeper) ProcessFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, } else { err := k.processFailedOutboundForExternalChainTx(ctx, cctx, oldStatus) if err != nil { - return cosmoserrors.Wrap(err, "ProcessFailedOutBoundForExternalChainTx") + return cosmoserrors.Wrap(err, "ProcessFailedOutboundForExternalChainTx") } } newStatus := cctx.CctxStatus.Status.String() diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index e3d448c746..f99fbd6cbf 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -141,8 +141,8 @@ func (m CrossChainTx) SetPendingOutbound(message string) { m.CctxStatus.ChangeStatus(CctxStatus_PendingOutbound, message) } -// SetOutBoundMined sets the CCTX status to OutboundMined with the given error message. -func (m CrossChainTx) SetOutBoundMined(message string) { +// SetOutboundMined sets the CCTX status to OutboundMined with the given error message. +func (m CrossChainTx) SetOutboundMined(message string) { m.CctxStatus.ChangeStatus(CctxStatus_OutboundMined, message) } @@ -189,7 +189,7 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT CoinType: msg.CoinType, } - outBoundParams := &OutboundParams{ + outboundParams := &OutboundParams{ Receiver: msg.Receiver, ReceiverChainId: msg.ReceiverChain, Hash: "", @@ -215,7 +215,7 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT RelayedMessage: msg.Message, CctxStatus: status, InboundParams: inboundParams, - OutboundParams: []*OutboundParams{outBoundParams}, + OutboundParams: []*OutboundParams{outboundParams}, } // TODO: remove this validate call diff --git a/x/crosschain/types/cctx_test.go b/x/crosschain/types/cctx_test.go index 34bfcbcd75..1e2df98301 100644 --- a/x/crosschain/types/cctx_test.go +++ b/x/crosschain/types/cctx_test.go @@ -296,10 +296,10 @@ func TestCrossChainTx_SetPendingOutbound(t *testing.T) { require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } -func TestCrossChainTx_SetOutBoundMined(t *testing.T) { +func TestCrossChainTx_SetOutboundMined(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetOutBoundMined("test") + cctx.SetOutboundMined("test") require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } diff --git a/x/crosschain/types/genesis.pb.go b/x/crosschain/types/genesis.pb.go index 30a23e2a9c..7ab67189d0 100644 --- a/x/crosschain/types/genesis.pb.go +++ b/x/crosschain/types/genesis.pb.go @@ -23,7 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines the metacore module's genesis state. +// GenesisState defines the crosschain module's genesis state. type GenesisState struct { OutboundTrackerList []OutboundTracker `protobuf:"bytes,2,rep,name=outboundTrackerList,proto3" json:"outboundTrackerList"` GasPriceList []*GasPrice `protobuf:"bytes,5,rep,name=gasPriceList,proto3" json:"gasPriceList,omitempty"` diff --git a/x/crosschain/types/keys.go b/x/crosschain/types/keys.go index dd5f8b496c..da56a5e797 100644 --- a/x/crosschain/types/keys.go +++ b/x/crosschain/types/keys.go @@ -19,6 +19,8 @@ const ( RouterKey = ModuleName // MemStoreKey defines the in-memory store key + // NOTE: named metacore because previous module name was metacore + // we keep the current value for backward compatibility MemStoreKey = "mem_metacore" ProtocolFee = 2000000000000000000 diff --git a/x/observer/keeper/msg_server_vote_block_header.go b/x/observer/keeper/msg_server_vote_block_header.go index bbcdc05719..5e8c0e0bce 100644 --- a/x/observer/keeper/msg_server_vote_block_header.go +++ b/x/observer/keeper/msg_server_vote_block_header.go @@ -35,7 +35,7 @@ func (k msgServer) VoteBlockHeader( } // add vote to ballot - ballot, isNew, err := k.FindBallot(ctx, msg.Digest(), chain, types.ObservationType_InBoundTx) + ballot, isNew, err := k.FindBallot(ctx, msg.Digest(), chain, types.ObservationType_InboundTx) if err != nil { return nil, cosmoserrors.Wrap(err, "failed to find ballot") } diff --git a/x/observer/keeper/utils_test.go b/x/observer/keeper/utils_test.go index 5d3a14eae3..b11a4512ca 100644 --- a/x/observer/keeper/utils_test.go +++ b/x/observer/keeper/utils_test.go @@ -316,7 +316,7 @@ func TestKeeper_FindBallot(t *testing.T) { _, _, err := k.FindBallot(ctx, "index", &chains.Chain{ ChainId: 987, - }, types.ObservationType_InBoundTx) + }, types.ObservationType_InboundTx) require.Error(t, err) }) } diff --git a/x/observer/keeper/vote_inbound.go b/x/observer/keeper/vote_inbound.go index e0189d7dac..b5fcdb1e38 100644 --- a/x/observer/keeper/vote_inbound.go +++ b/x/observer/keeper/vote_inbound.go @@ -34,7 +34,7 @@ func (k Keeper) VoteOnInboundBallot( return false, false, sdkerrors.Wrap(types.ErrSupportedChains, fmt.Sprintf( "ChainID %d, Observation %s", senderChainID, - types.ObservationType_InBoundTx.String()), + types.ObservationType_InboundTx.String()), ) } @@ -49,7 +49,7 @@ func (k Keeper) VoteOnInboundBallot( return false, false, sdkerrors.Wrap(types.ErrSupportedChains, fmt.Sprintf( "ChainID %d, Observation %s", receiverChainID, - types.ObservationType_InBoundTx.String()), + types.ObservationType_InboundTx.String()), ) } @@ -65,7 +65,7 @@ func (k Keeper) VoteOnInboundBallot( } // checks against the supported chains list before querying for Ballot - ballot, isNew, err := k.FindBallot(ctx, ballotIndex, senderChain, types.ObservationType_InBoundTx) + ballot, isNew, err := k.FindBallot(ctx, ballotIndex, senderChain, types.ObservationType_InboundTx) if err != nil { return false, false, err } diff --git a/x/observer/keeper/vote_inbound_test.go b/x/observer/keeper/vote_inbound_test.go index cfa1680d97..9f9fa09b58 100644 --- a/x/observer/keeper/vote_inbound_test.go +++ b/x/observer/keeper/vote_inbound_test.go @@ -405,7 +405,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { sample.AccAddress(), }, Votes: types.CreateVotes(5), - ObservationType: types.ObservationType_InBoundTx, + ObservationType: types.ObservationType_InboundTx, BallotThreshold: threshold, BallotStatus: types.BallotStatus_BallotInProgress, } @@ -467,7 +467,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { sample.AccAddress(), }, Votes: types.CreateVotes(3), - ObservationType: types.ObservationType_InBoundTx, + ObservationType: types.ObservationType_InboundTx, BallotThreshold: threshold, BallotStatus: types.BallotStatus_BallotInProgress, } diff --git a/x/observer/keeper/vote_outbound.go b/x/observer/keeper/vote_outbound.go index b502badc57..0dc946f5b4 100644 --- a/x/observer/keeper/vote_outbound.go +++ b/x/observer/keeper/vote_outbound.go @@ -37,7 +37,7 @@ func (k Keeper) VoteOnOutboundBallot( } // fetch or create ballot - ballot, isNew, err = k.FindBallot(ctx, ballotIndex, observationChain, observertypes.ObservationType_OutBoundTx) + ballot, isNew, err = k.FindBallot(ctx, ballotIndex, observationChain, observertypes.ObservationType_OutboundTx) if err != nil { return false, false, ballot, "", err } diff --git a/x/observer/keeper/vote_outbound_test.go b/x/observer/keeper/vote_outbound_test.go index 209841b1fc..4d14e828ba 100644 --- a/x/observer/keeper/vote_outbound_test.go +++ b/x/observer/keeper/vote_outbound_test.go @@ -257,7 +257,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { sample.AccAddress(), }, Votes: types.CreateVotes(5), - ObservationType: types.ObservationType_OutBoundTx, + ObservationType: types.ObservationType_OutboundTx, BallotThreshold: threshold, BallotStatus: types.BallotStatus_BallotInProgress, } @@ -313,7 +313,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { sample.AccAddress(), }, Votes: types.CreateVotes(3), - ObservationType: types.ObservationType_OutBoundTx, + ObservationType: types.ObservationType_OutboundTx, BallotThreshold: threshold, BallotStatus: types.BallotStatus_BallotInProgress, } diff --git a/x/observer/types/ballot_test.go b/x/observer/types/ballot_test.go index 089e2e764c..3f428e99d4 100644 --- a/x/observer/types/ballot_test.go +++ b/x/observer/types/ballot_test.go @@ -266,7 +266,7 @@ func TestBallot_AddVote(t *testing.T) { BallotIdentifier: "identifier", VoterList: test.voterList, Votes: CreateVotes(len(test.voterList)), - ObservationType: ObservationType_InBoundTx, + ObservationType: ObservationType_InboundTx, BallotThreshold: test.threshold, BallotStatus: BallotStatus_BallotInProgress, } diff --git a/x/observer/types/observer.pb.go b/x/observer/types/observer.pb.go index bf3019518c..13d3e1c998 100644 --- a/x/observer/types/observer.pb.go +++ b/x/observer/types/observer.pb.go @@ -28,24 +28,24 @@ type ObservationType int32 const ( ObservationType_EmptyObserverType ObservationType = 0 - ObservationType_InBoundTx ObservationType = 1 - ObservationType_OutBoundTx ObservationType = 2 + ObservationType_InboundTx ObservationType = 1 + ObservationType_OutboundTx ObservationType = 2 ObservationType_TSSKeyGen ObservationType = 3 ObservationType_TSSKeySign ObservationType = 4 ) var ObservationType_name = map[int32]string{ 0: "EmptyObserverType", - 1: "InBoundTx", - 2: "OutBoundTx", + 1: "InboundTx", + 2: "OutboundTx", 3: "TSSKeyGen", 4: "TSSKeySign", } var ObservationType_value = map[string]int32{ "EmptyObserverType": 0, - "InBoundTx": 1, - "OutBoundTx": 2, + "InboundTx": 1, + "OutboundTx": 2, "TSSKeyGen": 3, "TSSKeySign": 4, } @@ -194,31 +194,31 @@ func init() { } var fileDescriptor_05af1bc65780862e = []byte{ - // 379 bytes of a gzipped FileDescriptorProto + // 378 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xdf, 0xaa, 0xd3, 0x30, - 0x18, 0x6f, 0xb6, 0x29, 0x9c, 0x1c, 0x8f, 0xa7, 0x0b, 0x13, 0xc6, 0x84, 0x32, 0xe6, 0xcd, 0x18, - 0xda, 0x82, 0x3e, 0x81, 0x1b, 0xa2, 0xc3, 0xc1, 0xa0, 0xdd, 0x10, 0xbc, 0x19, 0x69, 0x1b, 0xdb, - 0xe0, 0x9a, 0x94, 0xe6, 0xab, 0xac, 0x3e, 0x85, 0x0f, 0xe1, 0x85, 0x8f, 0xe2, 0xe5, 0x2e, 0xbd, - 0x94, 0xed, 0x45, 0x24, 0xe9, 0x32, 0x41, 0xbc, 0xca, 0xf7, 0xfb, 0x9b, 0x8b, 0x1f, 0x9e, 0x7d, - 0x65, 0x40, 0x93, 0x9c, 0x72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0x84, 0xdb, 0x1b, 0xf7, 0x7e, + 0xfe, 0xf0, 0xd0, 0x7c, 0x85, 0x87, 0xb6, 0x75, 0x5b, 0xa6, 0x14, 0x58, 0xc8, 0xa8, 0x92, 0x42, + 0x87, 0xb7, 0x22, 0x65, 0x9f, 0xb9, 0x60, 0xa9, 0xeb, 0x98, 0xb0, 0x2c, 0x62, 0x05, 0x52, 0x63, + 0x44, 0xfa, 0xf8, 0xf6, 0x75, 0x5a, 0x70, 0xd1, 0x66, 0xdc, 0x4e, 0xdb, 0xf6, 0x66, 0xf9, 0xeb, + 0xe4, 0xa1, 0xe3, 0xc9, 0x43, 0x7f, 0x4e, 0x1e, 0xfa, 0x7e, 0xf6, 0x9c, 0xe3, 0xd9, 0x73, 0x7e, + 0x9f, 0x3d, 0xe7, 0x53, 0x90, 0x71, 0xc8, 0xeb, 0xd8, 0x4f, 0x64, 0x61, 0xf6, 0x78, 0xf1, 0xdf, + 0x34, 0x87, 0x7f, 0xdb, 0x43, 0x53, 0x32, 0x15, 0x3f, 0x34, 0xd3, 0xbc, 0xfa, 0x1b, 0x00, 0x00, + 0xff, 0xff, 0xc7, 0x4c, 0xd1, 0x68, 0x27, 0x02, 0x00, 0x00, } func (m *ObserverSet) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/parsers_test.go b/x/observer/types/parsers_test.go index 326f2c094e..34c24672aa 100644 --- a/x/observer/types/parsers_test.go +++ b/x/observer/types/parsers_test.go @@ -37,8 +37,8 @@ func TestParseStringToObservationType(t *testing.T) { expected types.ObservationType }{ {"TestValidObservationType1", "EmptyObserverType", types.ObservationType(0)}, - {"TestValidObservationType1", "InBoundTx", types.ObservationType(1)}, - {"TestValidObservationType1", "OutBoundTx", types.ObservationType(2)}, + {"TestValidObservationType1", "InboundTx", types.ObservationType(1)}, + {"TestValidObservationType1", "OutboundTx", types.ObservationType(2)}, {"TestValidObservationType1", "TSSKeyGen", types.ObservationType(3)}, {"TestValidObservationType1", "TSSKeySign", types.ObservationType(4)}, {"TestInvalidObservationType", "InvalidType", types.ObservationType(0)}, diff --git a/zetaclient/chains/bitcoin/observer/inbound.go b/zetaclient/chains/bitcoin/observer/inbound.go index e9b4c20d60..54c5294745 100644 --- a/zetaclient/chains/bitcoin/observer/inbound.go +++ b/zetaclient/chains/bitcoin/observer/inbound.go @@ -341,7 +341,7 @@ func (ob *Observer) GetInboundVoteMessageFromBtcEvent(inbound *BTCInboundEvent) return nil } - return zetacore.GetInBoundVoteMessage( + return zetacore.GetInboundVoteMessage( inbound.FromAddress, ob.chain.ChainId, inbound.FromAddress, diff --git a/zetaclient/chains/bitcoin/observer/observer.go b/zetaclient/chains/bitcoin/observer/observer.go index 91f0d695f4..4726dc595a 100644 --- a/zetaclient/chains/bitcoin/observer/observer.go +++ b/zetaclient/chains/bitcoin/observer/observer.go @@ -64,8 +64,8 @@ type Logger struct { // Outbound is the logger for outgoing transactions Outbound zerolog.Logger // The logger for outgoing transactions - // UTXOS is the logger for UTXOs management - UTXOS zerolog.Logger // The logger for UTXOs management + // UTXOs is the logger for UTXOs management + UTXOs zerolog.Logger // The logger for UTXOs management // GasPrice is the logger for gas price GasPrice zerolog.Logger // The logger for gas price @@ -163,7 +163,7 @@ func NewObserver( Chain: chainLogger, Inbound: chainLogger.With().Str("module", "WatchInbound").Logger(), Outbound: chainLogger.With().Str("module", "WatchOutbound").Logger(), - UTXOS: chainLogger.With().Str("module", "WatchUTXOS").Logger(), + UTXOs: chainLogger.With().Str("module", "WatchUTXOs").Logger(), GasPrice: chainLogger.With().Str("module", "WatchGasPrice").Logger(), Compliance: loggers.Compliance, } @@ -232,7 +232,7 @@ func (ob *Observer) WithLogger(logger zerolog.Logger) { Chain: logger, Inbound: logger.With().Str("module", "WatchInbound").Logger(), Outbound: logger.With().Str("module", "WatchOutbound").Logger(), - UTXOS: logger.With().Str("module", "WatchUTXOS").Logger(), + UTXOs: logger.With().Str("module", "WatchUTXOs").Logger(), GasPrice: logger.With().Str("module", "WatchGasPrice").Logger(), } } @@ -272,7 +272,7 @@ func (ob *Observer) Start() { ob.logger.Chain.Info().Msgf("Bitcoin client is starting") go ob.WatchInbound() // watch bitcoin chain for incoming txs and post votes to zetacore go ob.WatchOutbound() // watch bitcoin chain for outgoing txs status - go ob.WatchUTXOS() // watch bitcoin chain for UTXOs owned by the TSS address + go ob.WatchUTXOs() // watch bitcoin chain for UTXOs owned by the TSS address go ob.WatchGasPrice() // watch bitcoin chain for gas rate and post to zetacore go ob.WatchInboundTracker() // watch zetacore for bitcoin inbound trackers go ob.WatchRPCStatus() // watch the RPC status of the bitcoin chain @@ -511,11 +511,11 @@ func GetSenderAddressByVin(rpcClient interfaces.BTCRPCClient, vin btcjson.Vin, n return "", nil } -// WatchUTXOS watches bitcoin chain for UTXOs owned by the TSS address -func (ob *Observer) WatchUTXOS() { - ticker, err := clienttypes.NewDynamicTicker("Bitcoin_WatchUTXOS", ob.GetChainParams().WatchUtxoTicker) +// WatchUTXOs watches bitcoin chain for UTXOs owned by the TSS address +func (ob *Observer) WatchUTXOs() { + ticker, err := clienttypes.NewDynamicTicker("Bitcoin_WatchUTXOs", ob.GetChainParams().WatchUtxoTicker) if err != nil { - ob.logger.UTXOS.Error().Err(err).Msg("error creating ticker") + ob.logger.UTXOs.Error().Err(err).Msg("error creating ticker") return } @@ -526,22 +526,22 @@ func (ob *Observer) WatchUTXOS() { if !ob.GetChainParams().IsSupported { continue } - err := ob.FetchUTXOS() + err := ob.FetchUTXOs() if err != nil { - ob.logger.UTXOS.Error().Err(err).Msg("error fetching btc utxos") + ob.logger.UTXOs.Error().Err(err).Msg("error fetching btc utxos") } - ticker.UpdateInterval(ob.GetChainParams().WatchUtxoTicker, ob.logger.UTXOS) + ticker.UpdateInterval(ob.GetChainParams().WatchUtxoTicker, ob.logger.UTXOs) case <-ob.stop: - ob.logger.UTXOS.Info().Msgf("WatchUTXOS stopped for chain %d", ob.chain.ChainId) + ob.logger.UTXOs.Info().Msgf("WatchUTXOs stopped for chain %d", ob.chain.ChainId) return } } } -func (ob *Observer) FetchUTXOS() error { +func (ob *Observer) FetchUTXOs() error { defer func() { if err := recover(); err != nil { - ob.logger.UTXOS.Error().Msgf("BTC FetchUTXOS: caught panic error: %v", err) + ob.logger.UTXOs.Error().Msgf("BTC FetchUTXOs: caught panic error: %v", err) } }() diff --git a/zetaclient/chains/bitcoin/signer/signer.go b/zetaclient/chains/bitcoin/signer/signer.go index 0c51fc7204..12c5b2b100 100644 --- a/zetaclient/chains/bitcoin/signer/signer.go +++ b/zetaclient/chains/bitcoin/signer/signer.go @@ -180,9 +180,9 @@ func (signer *Signer) SignWithdrawTx( nonceMark := chains.NonceMarkAmount(nonce) // refresh unspent UTXOs and continue with keysign regardless of error - err := observer.FetchUTXOS() + err := observer.FetchUTXOs() if err != nil { - signer.logger.Error().Err(err).Msgf("SignWithdrawTx: FetchUTXOS error: nonce %d chain %d", nonce, chain.ChainId) + signer.logger.Error().Err(err).Msgf("SignWithdrawTx: FetchUTXOs error: nonce %d chain %d", nonce, chain.ChainId) } // select N UTXOs to cover the total expense @@ -416,7 +416,7 @@ func (signer *Signer) TryProcessOutbound( if err != nil { logger.Warn(). Err(err). - Msgf("unable to get observer list: chain %d observation %s", outboundTssNonce, observertypes.ObservationType_OutBoundTx.String()) + Msgf("unable to get observer list: chain %d observation %s", outboundTssNonce, observertypes.ObservationType_OutboundTx.String()) } if tx != nil { outboundHash := tx.TxHash().String() diff --git a/zetaclient/chains/evm/observer/inbound.go b/zetaclient/chains/evm/observer/inbound.go index 373536fe6d..1e261c4d0a 100644 --- a/zetaclient/chains/evm/observer/inbound.go +++ b/zetaclient/chains/evm/observer/inbound.go @@ -612,7 +612,7 @@ func (ob *Observer) BuildInboundVoteMsgForDepositedEvent( Msgf("ERC20CustodyDeposited inbound detected on chain %d tx %s block %d from %s value %s message %s", ob.chain.ChainId, event.Raw.TxHash.Hex(), event.Raw.BlockNumber, sender.Hex(), event.Amount.String(), message) - return zetacore.GetInBoundVoteMessage( + return zetacore.GetInboundVoteMessage( sender.Hex(), ob.chain.ChainId, "", @@ -667,7 +667,7 @@ func (ob *Observer) BuildInboundVoteMsgForZetaSentEvent( ob.logger.Inbound.Info().Msgf("ZetaSent inbound detected on chain %d tx %s block %d from %s value %s message %s", ob.chain.ChainId, event.Raw.TxHash.Hex(), event.Raw.BlockNumber, sender, event.ZetaValueAndGas.String(), message) - return zetacore.GetInBoundVoteMessage( + return zetacore.GetInboundVoteMessage( sender, ob.chain.ChainId, event.SourceTxOriginAddress.Hex(), @@ -716,7 +716,7 @@ func (ob *Observer) BuildInboundVoteMsgForTokenSentToTSS( ob.logger.Inbound.Info().Msgf("TSS inbound detected on chain %d tx %s block %d from %s value %s message %s", ob.chain.ChainId, tx.Hash, blockNumber, sender.Hex(), tx.Value.String(), message) - return zetacore.GetInBoundVoteMessage( + return zetacore.GetInboundVoteMessage( sender.Hex(), ob.chain.ChainId, sender.Hex(), diff --git a/zetaclient/chains/evm/signer/outbound_data_test.go b/zetaclient/chains/evm/signer/outbound_data_test.go index bd9e81061c..fbb4d5ef88 100644 --- a/zetaclient/chains/evm/signer/outbound_data_test.go +++ b/zetaclient/chains/evm/signer/outbound_data_test.go @@ -27,7 +27,7 @@ func TestSigner_SetChainAndSender(t *testing.T) { require.Equal(t, big.NewInt(cctx.InboundParams.SenderChainId), txData.toChainID) }) - t.Run("SetChainAndSender PendingOutBound", func(t *testing.T) { + t.Run("SetChainAndSender PendingOutbound", func(t *testing.T) { cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound skipTx := txData.SetChainAndSender(cctx, logger) diff --git a/zetaclient/chains/evm/signer/signer_test.go b/zetaclient/chains/evm/signer/signer_test.go index 5bd1b6a967..06e33571a5 100644 --- a/zetaclient/chains/evm/signer/signer_test.go +++ b/zetaclient/chains/evm/signer/signer_test.go @@ -145,13 +145,13 @@ func TestSigner_TryProcessOutbound(t *testing.T) { evmSigner, err := getNewEvmSigner(nil) require.NoError(t, err) cctx := getCCTX(t) - processorManager := getNewOutboundProcessor() + processor := getNewOutboundProcessor() mockObserver, err := getNewEvmChainObserver(nil) require.NoError(t, err) // Test with mock client that has keys client := mocks.NewMockZetacoreClient().WithKeys(&keys.Keys{}) - evmSigner.TryProcessOutbound(cctx, processorManager, "123", mockObserver, client, 123) + evmSigner.TryProcessOutbound(cctx, processor, "123", mockObserver, client, 123) // Check if cctx was signed and broadcasted list := evmSigner.GetReportedTxList() diff --git a/zetaclient/orchestrator/orchestrator.go b/zetaclient/orchestrator/orchestrator.go index f9678301ff..7967231de0 100644 --- a/zetaclient/orchestrator/orchestrator.go +++ b/zetaclient/orchestrator/orchestrator.go @@ -82,7 +82,7 @@ func NewOrchestrator( oc.signerMap = signerMap oc.observerMap = observerMap - // create outbound processor manager + // create outbound processor oc.outboundProc = outboundprocessor.NewProcessor(logger) balance, err := zetacoreClient.GetZetaHotKeyBalance() diff --git a/zetaclient/outboundprocessor/outbound_processor_manager.go b/zetaclient/outboundprocessor/outbound_processor.go similarity index 94% rename from zetaclient/outboundprocessor/outbound_processor_manager.go rename to zetaclient/outboundprocessor/outbound_processor.go index 8499252ede..feb4caafa7 100644 --- a/zetaclient/outboundprocessor/outbound_processor_manager.go +++ b/zetaclient/outboundprocessor/outbound_processor.go @@ -23,7 +23,7 @@ func NewProcessor(logger zerolog.Logger) *Processor { outboundEndTime: make(map[string]time.Time), outboundActive: make(map[string]struct{}), mu: sync.Mutex{}, - Logger: logger.With().Str("module", "OutboundProcessorManager").Logger(), + Logger: logger.With().Str("module", "OutboundProcessor").Logger(), numActiveProcessor: 0, } } @@ -63,7 +63,7 @@ func (p *Processor) TimeInTryProcess(outboundID string) time.Duration { return 0 } -// ToOutboundID returns the outbound ID for OutboundProcessorManager to track +// ToOutboundID returns the outbound ID for OutboundProcessor to track func ToOutboundID(index string, receiverChainID int64, nonce uint64) string { return fmt.Sprintf("%s-%d-%d", index, receiverChainID, nonce) } diff --git a/zetaclient/outboundprocessor/outbound_processor_manager_test.go b/zetaclient/outboundprocessor/outbound_processor_test.go similarity index 100% rename from zetaclient/outboundprocessor/outbound_processor_manager_test.go rename to zetaclient/outboundprocessor/outbound_processor_test.go diff --git a/zetaclient/zetacore/tx.go b/zetaclient/zetacore/tx.go index b4aa0725f8..798654856f 100644 --- a/zetaclient/zetacore/tx.go +++ b/zetaclient/zetacore/tx.go @@ -23,8 +23,8 @@ import ( appcontext "github.com/zeta-chain/zetacore/zetaclient/context" ) -// GetInBoundVoteMessage returns a new MsgVoteInbound -func GetInBoundVoteMessage( +// GetInboundVoteMessage returns a new MsgVoteInbound +func GetInboundVoteMessage( sender string, senderChain int64, txOrigin string, diff --git a/zetaclient/zetacore/tx_test.go b/zetaclient/zetacore/tx_test.go index bd860bc894..1d00f33d1a 100644 --- a/zetaclient/zetacore/tx_test.go +++ b/zetaclient/zetacore/tx_test.go @@ -411,11 +411,11 @@ func TestZetacore_PostVoteInbound(t *testing.T) { }) } -func TestZetacore_GetInBoundVoteMessage(t *testing.T) { +func TestZetacore_GetInboundVoteMessage(t *testing.T) { address := sdktypes.AccAddress(mocks.TestKeyringPair.PubKey().Address().Bytes()) t.Run("get inbound vote message", func(t *testing.T) { zetacoreBroadcast = MockBroadcast - msg := GetInBoundVoteMessage( + msg := GetInboundVoteMessage( address.String(), chains.Ethereum.ChainId, "",