Skip to content

Commit

Permalink
update comments for SetCctxAndNonceToCctxAndInboundHashToCctx
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Nov 28, 2024
1 parent 7265af5 commit 6d4a4cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions x/crosschain/keeper/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (

// 2. Set the cctx in the store

// 3. set the mapping inboundHash -> cctxIndex
// 3. Update the mapping inboundHash -> cctxIndex
// A new value is added to the mapping when a single inbound hash is connected to multiple cctx indexes
// If the inbound hash to cctx mapping does not exist, a new mapping is created and the cctx index is added to the list of cctx indexes

// 4. update the zeta accounting
// Zeta-accounting is updated aborted cctxs of cointtype zeta.When a cctx is aborted it means that `GetAbortedAmount`
Expand All @@ -33,7 +34,7 @@ func (k Keeper) SetCctxAndNonceToCctxAndInboundHashToCctx(
cctx types.CrossChainTx,
tssPubkey string,
) {
k.UpdateNonceToCCTX(ctx, cctx, tssPubkey)
k.SetNonceToCCTXMapping(ctx, cctx, tssPubkey)
k.SetCrossChainTx(ctx, cctx)
k.UpdateInboundHashToCCTX(ctx, cctx)
k.UpdateZetaAccounting(ctx, cctx)
Expand Down Expand Up @@ -69,8 +70,8 @@ func (k Keeper) UpdateZetaAccounting(
}
}

// UpdateNonceToCCTX updates the mapping between a nonce and a cctx index if the cctx is in a PendingOutbound or PendingRevert state
func (k Keeper) UpdateNonceToCCTX(
// SetNonceToCCTXMapping updates the mapping between a nonce and a cctx index if the cctx is in a PendingOutbound or PendingRevert state
func (k Keeper) SetNonceToCCTXMapping(
ctx sdk.Context,
cctx types.CrossChainTx,
tssPubkey string,
Expand Down
6 changes: 3 additions & 3 deletions x/crosschain/keeper/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func TestKeeper_UpdateNonceToCCTX(t *testing.T) {
tssPubkey := "test-tss-pubkey"

// Act
k.UpdateNonceToCCTX(ctx, cctx, tssPubkey)
k.SetNonceToCCTXMapping(ctx, cctx, tssPubkey)

// Assert
nonceToCctx, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tssPubkey, chainID, int64(nonce))
Expand All @@ -491,7 +491,7 @@ func TestKeeper_UpdateNonceToCCTX(t *testing.T) {
tssPubkey := "test-tss-pubkey"

// Act
k.UpdateNonceToCCTX(ctx, cctx, tssPubkey)
k.SetNonceToCCTXMapping(ctx, cctx, tssPubkey)

// Assert
nonceToCctx, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tssPubkey, chainID, int64(nonce))
Expand All @@ -514,7 +514,7 @@ func TestKeeper_UpdateNonceToCCTX(t *testing.T) {
tssPubkey := "test-tss-pubkey"

// Act
k.UpdateNonceToCCTX(ctx, cctx, tssPubkey)
k.SetNonceToCCTXMapping(ctx, cctx, tssPubkey)

// Assert
_, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tssPubkey, chainID, int64(nonce))
Expand Down

0 comments on commit 6d4a4cf

Please sign in to comment.