wormchain: remove redundant guardian key arg in register-account-as-guardian msg handler

This commit is contained in:
Nikhil Suri 2022-12-20 17:51:13 +00:00 committed by Conor Patrick
parent acc3ec14d8
commit 79d3013336
5 changed files with 47 additions and 126 deletions

View File

@ -3,7 +3,6 @@ package wormhole_foundation.wormchain.wormhole;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
// this line is used by starport scaffolding # proto/tx/import // this line is used by starport scaffolding # proto/tx/import
import "wormhole/guardian_key.proto";
option go_package = "github.com/wormhole-foundation/wormchain/x/wormhole/types"; option go_package = "github.com/wormhole-foundation/wormchain/x/wormhole/types";
@ -30,7 +29,6 @@ message MsgExecuteGovernanceVAAResponse {
message MsgRegisterAccountAsGuardian { message MsgRegisterAccountAsGuardian {
string signer = 1; string signer = 1;
GuardianKey guardianPubkey = 2;
bytes signature = 3; bytes signature = 3;
} }

View File

@ -5,7 +5,6 @@ import (
"strconv" "strconv"
"encoding/hex" "encoding/hex"
"encoding/json"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
@ -18,16 +17,11 @@ var _ = strconv.Itoa(0)
func CmdRegisterAccountAsGuardian() *cobra.Command { func CmdRegisterAccountAsGuardian() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "register-account-as-guardian [guardian-pubkey] [signature]", Use: "register-account-as-guardian [signature]",
Short: "Register a guardian public key with a wormhole chain address.", Short: "Register a guardian public key with a wormhole chain address.",
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) { RunE: func(cmd *cobra.Command, args []string) (err error) {
argGuardianPubkey := new(types.GuardianKey) argSignature, err := hex.DecodeString(args[0])
err = json.Unmarshal([]byte(args[0]), argGuardianPubkey)
if err != nil {
return err
}
argSignature, err := hex.DecodeString(args[1])
if err != nil { if err != nil {
return fmt.Errorf("malformed signature: %w", err) return fmt.Errorf("malformed signature: %w", err)
} }
@ -39,7 +33,6 @@ func CmdRegisterAccountAsGuardian() *cobra.Command {
msg := types.NewMsgRegisterAccountAsGuardian( msg := types.NewMsgRegisterAccountAsGuardian(
clientCtx.GetFromAddress().String(), clientCtx.GetFromAddress().String(),
argGuardianPubkey,
argSignature, argSignature,
) )
if err := msg.ValidateBasic(); err != nil { if err := msg.ValidateBasic(); err != nil {

View File

@ -34,13 +34,7 @@ func (k msgServer) RegisterAccountAsGuardian(goCtx context.Context, msg *types.M
// hash the public key, and take the last 20 bytes of the hash // hash the public key, and take the last 20 bytes of the hash
// (according to // (according to
// https://ethereum.org/en/developers/docs/accounts/#account-creation) // https://ethereum.org/en/developers/docs/accounts/#account-creation)
guardianKeyAddrFromSignature := common.BytesToAddress(crypto.Keccak256(guardianKey[1:])[12:]) guardianKeyAddr := common.BytesToAddress(crypto.Keccak256(guardianKey[1:])[12:])
guardianKeyAddr := common.BytesToAddress(msg.GuardianPubkey.Key)
// check the recovered guardian key matches the one in the message
if guardianKeyAddrFromSignature != guardianKeyAddr {
return nil, types.ErrGuardianSignatureMismatch
}
// next we check if this guardian key is in the most recent guardian set. // next we check if this guardian key is in the most recent guardian set.
// we don't allow registration of arbitrary public keys, since that would // we don't allow registration of arbitrary public keys, since that would

View File

@ -9,11 +9,10 @@ const TypeMsgRegisterAccountAsGuardian = "register_account_as_guardian"
var _ sdk.Msg = &MsgRegisterAccountAsGuardian{} var _ sdk.Msg = &MsgRegisterAccountAsGuardian{}
func NewMsgRegisterAccountAsGuardian(signer string, guardianPubkey *GuardianKey, signature []byte) *MsgRegisterAccountAsGuardian { func NewMsgRegisterAccountAsGuardian(signer string, signature []byte) *MsgRegisterAccountAsGuardian {
return &MsgRegisterAccountAsGuardian{ return &MsgRegisterAccountAsGuardian{
Signer: signer, Signer: signer,
GuardianPubkey: guardianPubkey, Signature: signature,
Signature: signature,
} }
} }

View File

@ -117,9 +117,8 @@ func (m *MsgExecuteGovernanceVAAResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgExecuteGovernanceVAAResponse proto.InternalMessageInfo var xxx_messageInfo_MsgExecuteGovernanceVAAResponse proto.InternalMessageInfo
type MsgRegisterAccountAsGuardian struct { type MsgRegisterAccountAsGuardian struct {
Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
GuardianPubkey *GuardianKey `protobuf:"bytes,2,opt,name=guardianPubkey,proto3" json:"guardianPubkey,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
} }
func (m *MsgRegisterAccountAsGuardian) Reset() { *m = MsgRegisterAccountAsGuardian{} } func (m *MsgRegisterAccountAsGuardian) Reset() { *m = MsgRegisterAccountAsGuardian{} }
@ -162,13 +161,6 @@ func (m *MsgRegisterAccountAsGuardian) GetSigner() string {
return "" return ""
} }
func (m *MsgRegisterAccountAsGuardian) GetGuardianPubkey() *GuardianKey {
if m != nil {
return m.GuardianPubkey
}
return nil
}
func (m *MsgRegisterAccountAsGuardian) GetSignature() []byte { func (m *MsgRegisterAccountAsGuardian) GetSignature() []byte {
if m != nil { if m != nil {
return m.Signature return m.Signature
@ -471,45 +463,42 @@ func init() {
func init() { proto.RegisterFile("wormhole/tx.proto", fileDescriptor_55f7aa067b0c517b) } func init() { proto.RegisterFile("wormhole/tx.proto", fileDescriptor_55f7aa067b0c517b) }
var fileDescriptor_55f7aa067b0c517b = []byte{ var fileDescriptor_55f7aa067b0c517b = []byte{
// 594 bytes of a gzipped FileDescriptorProto // 550 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x51, 0x6b, 0xd3, 0x5e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02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x00, 0x00, 0xff, 0xff, 0x58, 0x04, 0x5c, 0x24, 0x1e, 0x06,
0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -528,7 +517,7 @@ type MsgClient interface {
RegisterAccountAsGuardian(ctx context.Context, in *MsgRegisterAccountAsGuardian, opts ...grpc.CallOption) (*MsgRegisterAccountAsGuardianResponse, error) RegisterAccountAsGuardian(ctx context.Context, in *MsgRegisterAccountAsGuardian, opts ...grpc.CallOption) (*MsgRegisterAccountAsGuardianResponse, error)
// StoreCode to submit Wasm code to the system // StoreCode to submit Wasm code to the system
StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error) StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error)
// Instantiate creates a new smart contract instance for the given code id. // Instantiate creates a new smart contract instance for the given code id.
InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error) InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error)
} }
@ -582,7 +571,7 @@ type MsgServer interface {
RegisterAccountAsGuardian(context.Context, *MsgRegisterAccountAsGuardian) (*MsgRegisterAccountAsGuardianResponse, error) RegisterAccountAsGuardian(context.Context, *MsgRegisterAccountAsGuardian) (*MsgRegisterAccountAsGuardianResponse, error)
// StoreCode to submit Wasm code to the system // StoreCode to submit Wasm code to the system
StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error) StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error)
// Instantiate creates a new smart contract instance for the given code id. // Instantiate creates a new smart contract instance for the given code id.
InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error)
} }
@ -791,18 +780,6 @@ func (m *MsgRegisterAccountAsGuardian) MarshalToSizedBuffer(dAtA []byte) (int, e
i-- i--
dAtA[i] = 0x1a dAtA[i] = 0x1a
} }
if m.GuardianPubkey != nil {
{
size, err := m.GuardianPubkey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Signer) > 0 { if len(m.Signer) > 0 {
i -= len(m.Signer) i -= len(m.Signer)
copy(dAtA[i:], m.Signer) copy(dAtA[i:], m.Signer)
@ -1048,10 +1025,6 @@ func (m *MsgRegisterAccountAsGuardian) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
} }
if m.GuardianPubkey != nil {
l = m.GuardianPubkey.Size()
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Signature) l = len(m.Signature)
if l > 0 { if l > 0 {
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
@ -1379,42 +1352,6 @@ func (m *MsgRegisterAccountAsGuardian) Unmarshal(dAtA []byte) error {
} }
m.Signer = string(dAtA[iNdEx:postIndex]) m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GuardianPubkey", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GuardianPubkey == nil {
m.GuardianPubkey = &GuardianKey{}
}
if err := m.GuardianPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3: case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)