From ae38f3b8b4e4400c0ed84c0d7d8277e7e8803cac Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 19 Jun 2024 20:50:40 +0200 Subject: [PATCH] PR comments --- x/crosschain/keeper/cctx_orchestrator_validate_inbound.go | 2 +- x/crosschain/keeper/cctx_utils.go | 2 +- x/crosschain/keeper/evm_deposit.go | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_inbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_inbound.go index 4a5987cc54..4bb90ec915 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_inbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_inbound.go @@ -40,7 +40,7 @@ func (k Keeper) ValidateInbound( return nil, err } - inCctxIndex, ok := ctx.Value("inCctxIndex").(string) + inCctxIndex, ok := ctx.Value(InCCTXIndexKey).(string) if ok { cctx.InboundParams.ObservedHash = inCctxIndex } diff --git a/x/crosschain/keeper/cctx_utils.go b/x/crosschain/keeper/cctx_utils.go index 4f05884fcc..3d3cf31cd5 100644 --- a/x/crosschain/keeper/cctx_utils.go +++ b/x/crosschain/keeper/cctx_utils.go @@ -16,7 +16,7 @@ import ( zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" ) -// SetObserverOutboundInfo sets the CCTX outbound nonce to the next nonce, and updates the nonce of blockchain state. +// SetObserverOutboundInfo sets the CCTX outbound nonce to the next available nonce for the TSS address, and updates the nonce of blockchain state. // It also updates the PendingNonces that is used to track the unfulfilled outbound txs. func (k Keeper) SetObserverOutboundInfo(ctx sdk.Context, receiveChainID int64, cctx *types.CrossChainTx) error { chain := k.GetObserverKeeper().GetSupportedChainFromChainID(ctx, receiveChainID) diff --git a/x/crosschain/keeper/evm_deposit.go b/x/crosschain/keeper/evm_deposit.go index 927e9f5eb1..858c709f18 100644 --- a/x/crosschain/keeper/evm_deposit.go +++ b/x/crosschain/keeper/evm_deposit.go @@ -18,6 +18,8 @@ import ( fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) +const InCCTXIndexKey = "inCctxIndex" + // HandleEVMDeposit handles a deposit from an inbound tx // returns (isContractReverted, err) // (true, non-nil) means CallEVM() reverted @@ -102,7 +104,7 @@ func (k Keeper) HandleEVMDeposit(ctx sdk.Context, cctx *types.CrossChainTx) (boo if !evmTxResponse.Failed() && contractCall { logs := evmtypes.LogsToEthereum(evmTxResponse.Logs) if len(logs) > 0 { - ctx = ctx.WithValue("inCctxIndex", cctx.Index) + ctx = ctx.WithValue(InCCTXIndexKey, cctx.Index) txOrigin := cctx.InboundParams.TxOrigin if txOrigin == "" { txOrigin = inboundSender