diff --git a/node/cmd/guardiand/adminserver.go b/node/cmd/guardiand/adminserver.go index df5434bf6..04e7bf6fc 100644 --- a/node/cmd/guardiand/adminserver.go +++ b/node/cmd/guardiand/adminserver.go @@ -73,7 +73,12 @@ func adminGuardianSetUpdateToVAA(req *nodev1.GuardianSetUpdate, guardianSetIndex // adminContractUpgradeToVAA converts a nodev1.ContractUpgrade message to its canonical VAA representation. // Returns an error if the data is invalid. func adminContractUpgradeToVAA(req *nodev1.ContractUpgrade, guardianSetIndex uint32, nonce uint32, sequence uint64) (*vaa.VAA, error) { - if len(req.NewContract) != 32 { + b, err := hex.DecodeString(req.NewContract) + if err != nil { + return nil, errors.New("invalid new contract address encoding (expected hex)") + } + + if len(b) != 32 { return nil, errors.New("invalid new_contract address") } diff --git a/node/cmd/guardiand/admintemplate.go b/node/cmd/guardiand/admintemplate.go index dc72cd900..1703560fa 100644 --- a/node/cmd/guardiand/admintemplate.go +++ b/node/cmd/guardiand/admintemplate.go @@ -98,12 +98,12 @@ func runContractUpgradeTemplate(cmd *cobra.Command, args []string) { m := &nodev1.InjectGovernanceVAARequest{ CurrentSetIndex: uint32(*templateGuardianIndex), - Sequence: 1234, + Sequence: rand.Uint64(), Nonce: rand.Uint32(), Payload: &nodev1.InjectGovernanceVAARequest_ContractUpgrade{ ContractUpgrade: &nodev1.ContractUpgrade{ ChainId: 1, - NewContract: make([]byte, 32), + NewContract: "0000000000000000000000000290FB167208Af455bB137780163b7B7a9a10C16", }, }, } diff --git a/proto/node/v1/node.proto b/proto/node/v1/node.proto index 5bd17f57e..e071865b5 100644 --- a/proto/node/v1/node.proto +++ b/proto/node/v1/node.proto @@ -94,8 +94,8 @@ message ContractUpgrade { // ID of the chain where the Wormhole contract should be updated (uint8). uint32 chain_id = 1; - // Address of the new program/contract. - bytes new_contract = 2; + // Hex-encoded address (without leading 0x) address of the new program/contract. + string new_contract = 2; } message BridgeUpgradeContract { @@ -105,7 +105,7 @@ message BridgeUpgradeContract { // ID of the chain where the bridge contract should be updated (uint16). uint32 target_chain_id = 2; - // Address of the new program/contract. + // Hex-encoded address (without leading 0x) of the new program/contract. string new_contract = 3; }