File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,34 @@ contract GovernanceTest is Test {
41
41
myContract.transferOwnership (address (governance));
42
42
}
43
43
44
+ function test_parseGuardian () public {
45
+ // these bytes were dumped from the guardian command with prototxt
46
+ // ```
47
+ // current_set_index: 4
48
+ // # generic evm call
49
+ // messages: {
50
+ // sequence: 4513077582118919631
51
+ // nonce: 2809988562
52
+ // evm_call: {
53
+ // chain_id: 3
54
+ // governance_contract: "0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB"
55
+ // target_contract: "0xF890982f9310df57d00f659cf4fd87e65adEd8d7"
56
+ // abi_encoded_call: "BEEFFACE"
57
+ // }
58
+ // }
59
+ // ```
60
+ bytes memory foo =
61
+ hex "000000000000000047656e6572616c507572706f7365476f7665726e616e6365010003d8e4c2dbdd2e2bd8f1336ea691dbff6952b1a6ebf890982f9310df57d00f659cf4fd87e65aded8d70004beefface " ;
62
+ Governance.GeneralPurposeGovernanceMessage memory message =
63
+ governance.parseGeneralPurposeGovernanceMessage (foo);
64
+ assertEq (message.action, uint8 (Governance.GovernanceAction.EVM_CALL));
65
+ assertEq (message.chain, uint16 (3 ));
66
+ assertEq (message.governanceContract, address (0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB ));
67
+ assertEq (message.governedContract, address (0xF890982f9310df57d00f659cf4fd87e65adEd8d7 ));
68
+ console.logBytes (message.callData);
69
+ assertEq (message.callData, hex "beefface " );
70
+ }
71
+
44
72
function buildGovernanceVaa (
45
73
uint8 action ,
46
74
uint16 chainId ,
You can’t perform that action at this time.
0 commit comments