Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Update based on feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
vimystic committed Oct 4, 2023
1 parent 6e848c1 commit 6a71537
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion imt/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (t *Tree) Count() uint32 {
return t.count
}

// Count returns the number of inserts performed on the Tree
// Set the count . (Used when restoring from genesis state)
func (t *Tree) SetCount(count uint32) {
t.count = count
}
Expand Down
9 changes: 6 additions & 3 deletions x/mailbox/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (k *Keeper) Dispatch(goCtx context.Context, msg *types.MsgDispatch) (*types
version := make([]byte, 1)
message = append(message, version...)

//Nonce is the current branch length.
// Nonce is the tree count.
nonce := k.Tree.Count()
nonceBytes := make([]byte, 4)
binary.BigEndian.PutUint32(nonceBytes, nonce)
Expand Down Expand Up @@ -95,15 +95,18 @@ func (k *Keeper) Dispatch(goCtx context.Context, msg *types.MsgDispatch) (*types
message = append(message, messageBytes...)
hyperlaneMsg := hexutil.Encode(message)

// Get the message ID. (i.e: Keccak256 sha)
// Get the message ID. (i.e: Keccak256 hash of the message)
id := common.Id(message)

store.Set(types.MailboxIMTKey(), id)
// Insert the message id into the tree
err := k.Tree.Insert(id)
if err != nil {
return nil, err
}

// Store that the current root
store.Set(types.MailboxIMTKey(), k.Tree.Root())

// Emit the events
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
Expand Down

0 comments on commit 6a71537

Please sign in to comment.