⚡ Recommended focus areas for review
Protobuf Message Indices
The new AxelarRoute and AxelarPacketReceipt definitions adjust the message indices and registration. Verify that the indices and message exporters are consistent with the generated protobuf requirements.
return nil
}
// AxelarRoute represents a route for Axelar packets and implements the RouteI interface.
type AxelarRoute struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// destination_chain_id is the destination chain ID
DestinationChainId string `protobuf:"bytes,1,opt,name=destination_chain_id,json=destinationChainId,proto3" json:"destination_chain_id,omitempty"`
// destination_contract_address is the destination contract address
DestinationContractAddress string `protobuf:"bytes,2,opt,name=destination_contract_address,json=destinationContractAddress,proto3" json:"destination_contract_address,omitempty"`
// fee is the fee for each packet in the Axelar network.
Fee *v1beta11.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee,omitempty"`
}
func (x *AxelarRoute) Reset() {
*x = AxelarRoute{}
if protoimpl.UnsafeEnabled {
mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AxelarRoute) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AxelarRoute) ProtoMessage() {}
// Deprecated: Use AxelarRoute.ProtoReflect.Descriptor instead.
func (*AxelarRoute) Descriptor() ([]byte, []int) {
return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{8}
}
func (x *AxelarRoute) GetDestinationChainId() string {
if x != nil {
return x.DestinationChainId
}
return ""
}
func (x *AxelarRoute) GetDestinationContractAddress() string {
if x != nil {
return x.DestinationContractAddress
}
return ""
}
func (x *AxelarRoute) GetFee() *v1beta11.Coin {
if x != nil {
return x.Fee
}
return nil
}
CLI Command Parsing
The added CLI commands for creating and updating Axelar tunnels include multiple arguments that need thorough validation and error handling. Verify that the argument parsing and conversion logic is robust.
func GetTxCmdCreateAxelarTunnel() *cobra.Command {
cmd := &cobra.Command{
Use: "axelar [destination-chain-id] [destination-address] [axelar-fee] [initial-deposit] [interval] [signalInfos-json-file]",
Short: "Create a new Axelar tunnel",
Args: cobra.ExactArgs(6),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
destinationChainID := args[0]
destinationContractAddress := args[1]
axelarFee, err := sdk.ParseCoinNormalized(args[2])
if err != nil {
return err
}
initialDeposit, err := sdk.ParseCoinsNormalized(args[3])
if err != nil {
return err
}
interval, err := strconv.ParseUint(args[4], 10, 64)
if err != nil {
return err
}
signalInfos, err := parseSignalDeviations(args[5])
if err != nil {
return err
}
msg, err := types.NewMsgCreateAxelarTunnel(
signalInfos.ToSignalDeviations(),
interval,
destinationChainID,
destinationContractAddress,
axelarFee,
initialDeposit,
clientCtx.GetFromAddress().String(),
)
if err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
Parameter Validation
The new AxelarIBCChannel parameter validation checks the channel format. Ensure that the error message is clear and that the validation logic properly permits an empty channel identifier when appropriate.
return fmt.Errorf("invalid base packet fee: %s", p.BasePacketFee)
}
// validate AxelarIBCChannel
if p.AxelarIBCChannel != "" && !channeltypes.IsChannelIDFormat(p.AxelarIBCChannel) {
return fmt.Errorf("channel identifier is not in the format: `channel-{N}` or be empty string")
}
|