-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: generalised governance #3895
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! But I think you also have to make a change to node/cmd/guardiand/admintemplate.go
.
c4d25ca
to
dc65642
Compare
Handles governance requests of the form: ``` current_set_index: 4 messages: { sequence: 4513077582118919631 nonce: 2809988562 evm_call: { chain_id: 3 governance_contract: "0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB" target_contract: "0xF890982f9310df57d00f659cf4fd87e65adEd8d7" abi_encoded_call: "6497f75a000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000f890982f9310df57d00f659cf4fd87e65aded8d70000000000000000000000000000000000000000000000000000000000000140bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe000000000000000000000000000000000000000000000000000000000000000268690000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004beefface00000000000000000000000000000000000000000000000000000000" } } ```
dc65642
to
1fc0df9
Compare
handles governance requests of the form ``` current_set_index: 4 messages: { sequence: 4513077582118919631 nonce: 2809988562 solana_call: { chain_id: 3 governance_contract: "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5" encoded_instruction: "BEEFFACE" } } ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved but had a couple questions.
8986124
to
b7f4adb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving pending clarification.
b7f4adb
to
e1c8bc8
Compare
13058bb
to
51d34bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with reworking checks in Serialize
to return errors in a future PR #3897
if *governanceTargetAddress == "" { | ||
log.Fatal("--target-address must be specified") | ||
} | ||
if !common.IsHexAddress(*governanceTargetAddress) { | ||
log.Fatal("invalid target address") | ||
} | ||
governanceTargetAddress := common.HexToAddress(*governanceTargetAddress).Hex() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using parseAddress
in these templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because parseAddress
attempts to parse any 32 byte address-like thing into a (left-padded) 32 byte address
wormhole/node/cmd/guardiand/admintemplate.go
Lines 1061 to 1084 in 51d34bf
func parseAddress(s string) (string, error) { | |
// try base58 | |
b, err := base58.Decode(s) | |
if err == nil { | |
return leftPadAddress(b) | |
} | |
// try bech32 | |
_, b, err = bech32.Decode(s) | |
if err == nil { | |
return leftPadAddress(b) | |
} | |
// try hex | |
if len(s) > 2 && strings.ToLower(s[:2]) == "0x" { | |
s = s[2:] | |
} | |
a, err := hex.DecodeString(s) | |
if err != nil { | |
return "", fmt.Errorf("invalid hex address: %v", err) | |
} | |
return leftPadAddress(a) | |
} |
in this case, we only care about EVM addresses, so we can be a bit more specific
@@ -577,6 +577,58 @@ func wormholeRelayerSetDefaultDeliveryProvider(req *nodev1.WormholeRelayerSetDef | |||
return v, nil | |||
} | |||
|
|||
func evmCallToVaa(evmCall *nodev1.EvmCall, timestamp time.Time, guardianSetIndex, nonce uint32, sequence uint64) (*vaa.VAA, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a check in here to enforce that chain id doesn't exceed max uint16?
The EVM implementation handles governance requests of the form:
The solana implementation handles governance requests of the form:
The expectation is for the
abi_encoded_call
andencoded_instruction
calls to be generated (and verified) via external tools.