Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: perform some various renaming fixes #2323

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57938,8 +57938,8 @@ definitions:
type: string
enum:
- EmptyObserverType
- InBoundTx
- OutBoundTx
- InboundTx
- OutboundTx
- TSSKeyGen
- TSSKeySign
default: EmptyObserverType
Expand Down
2 changes: 1 addition & 1 deletion docs/zetaclient/zetaclient_logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion proto/zetachain/zetacore/crosschain/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down
4 changes: 2 additions & 2 deletions proto/zetachain/zetacore/observer/observer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions testutil/keeper/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion testutil/sample/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion typescript/zetachain/zetacore/crosschain/genesis_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 4 additions & 4 deletions typescript/zetachain/zetacore/observer/observer_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/keeper/cctx_gateway_zevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions x/crosschain/keeper/msg_server_vote_inbound_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions x/crosschain/keeper/msg_server_vote_outbound_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -256,17 +256,17 @@ 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)
keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset)
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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/keeper/process_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions x/crosschain/types/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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: "",
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/types/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions x/crosschain/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/observer/keeper/msg_server_vote_block_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion x/observer/keeper/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
6 changes: 3 additions & 3 deletions x/observer/keeper/vote_inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
)
}

Expand All @@ -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()),
)
}

Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions x/observer/keeper/vote_inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion x/observer/keeper/vote_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions x/observer/keeper/vote_outbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion x/observer/types/ballot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
Loading
Loading