Skip to content

Commit

Permalink
resolver comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Sep 18, 2024
1 parent 24ec4e2 commit 43359bc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/spec/authority/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If the chain already exists in the chain info object, it is updated
```proto
message MsgUpdateChainInfo {
string creator = 1;
pkg.chains.Chain chain = 2;
pkg.chains.Chain chain = 3;
}
```

Expand Down
5 changes: 4 additions & 1 deletion proto/zetachain/zetacore/authority/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ message MsgUpdatePoliciesResponse {}
// MsgUpdateChainInfo defines the MsgUpdateChainInfo service.
message MsgUpdateChainInfo {
string creator = 1;
pkg.chains.Chain chain = 2 [ (gogoproto.nullable) = false ];
pkg.chains.Chain chain = 3 [ (gogoproto.nullable) = false ];

// Do not edit
reserved 2;
}

// MsgUpdateChainInfoResponse defines the MsgUpdateChainInfoResponse service.
Expand Down
2 changes: 1 addition & 1 deletion typescript/zetachain/zetacore/authority/tx_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export declare class MsgUpdateChainInfo extends Message<MsgUpdateChainInfo> {
creator: string;

/**
* @generated from field: zetachain.zetacore.pkg.chains.Chain chain = 2;
* @generated from field: zetachain.zetacore.pkg.chains.Chain chain = 3;
*/
chain?: Chain;

Expand Down
10 changes: 5 additions & 5 deletions x/authority/keeper/msg_server_update_chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ func (k msgServer) UpdateChainInfo(
}

chainInfo := types.ChainInfo{}
updatedChainInfo := false
chainInfoExist := false

cf, found := k.GetChainInfo(ctx)
existingChainInfo, found := k.GetChainInfo(ctx)
if found {
chainInfo = cf
chainInfo = existingChainInfo
}
// try to update a chain if the chain info already exists
for i, chain := range chainInfo.Chains {
if chain.ChainId == msg.Chain.ChainId {
chainInfo.Chains[i] = msg.Chain
updatedChainInfo = true
chainInfoExist = true
}
}

// if the chain info does not exist, add the chain to the chain info object
if !updatedChainInfo {
if !chainInfoExist {
chainInfo.Chains = append(chainInfo.Chains, msg.Chain)
}

Expand Down
78 changes: 39 additions & 39 deletions x/authority/types/tx.pb.go

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

0 comments on commit 43359bc

Please sign in to comment.