@@ -72,79 +72,6 @@ func NetworkConfig() *network.Config {
7272 return & cfg
7373}
7474
75- // =====================
76- // Wormhole Contract Types
77- // =====================
78-
79- // WormholeInstantiateMsg is the message to instantiate the wormhole contract
80- type WormholeInstantiateMsg struct {
81- GovChain uint16 `json:"gov_chain"`
82- GovAddress string `json:"gov_address"`
83- InitialGuardianSet GuardianSetInfo `json:"initial_guardian_set"`
84- GuardianSetExpirity uint64 `json:"guardian_set_expirity"`
85- ChainID uint16 `json:"chain_id"`
86- FeeDenom string `json:"fee_denom"`
87- }
88-
89- // GuardianSetInfo contains guardian set data
90- type GuardianSetInfo struct {
91- Addresses []GuardianAddress `json:"addresses"`
92- ExpirationTime uint64 `json:"expiration_time"`
93- }
94-
95- // GuardianAddress represents a guardian's Ethereum-style address
96- type GuardianAddress struct {
97- Bytes string `json:"bytes"` // base64 encoded
98- }
99-
100- // WormholeExecuteMsg is the execute message for wormhole contract
101- type WormholeExecuteMsg struct {
102- SubmitVAA * SubmitVAAMsg `json:"submit_v_a_a,omitempty"`
103- PostMessage * PostMessageMsg `json:"post_message,omitempty"`
104- }
105-
106- type SubmitVAAMsg struct {
107- VAA string `json:"vaa"` // base64 encoded
108- }
109-
110- type PostMessageMsg struct {
111- Message string `json:"message"` // base64 encoded
112- Nonce uint32 `json:"nonce"`
113- }
114-
115- // WormholeQueryMsg is the query message for wormhole contract
116- type WormholeQueryMsg struct {
117- GuardianSetInfo * struct {} `json:"guardian_set_info,omitempty"`
118- VerifyVAA * VerifyVAAQuery `json:"verify_v_a_a,omitempty"`
119- GetState * struct {} `json:"get_state,omitempty"`
120- QueryAddressHex * QueryAddressHexMsg `json:"query_address_hex,omitempty"`
121- }
122-
123- type VerifyVAAQuery struct {
124- VAA string `json:"vaa"` // base64 encoded
125- BlockTime uint64 `json:"block_time"`
126- }
127-
128- type QueryAddressHexMsg struct {
129- Address string `json:"address"`
130- }
131-
132- // WormholeGuardianSetInfoResponse is the response from GuardianSetInfo query
133- type WormholeGuardianSetInfoResponse struct {
134- GuardianSetIndex uint32 `json:"guardian_set_index"`
135- Addresses []GuardianAddress `json:"addresses"`
136- }
137-
138- // WormholeGetStateResponse is the response from GetState query
139- type WormholeGetStateResponse struct {
140- Fee CoinResponse `json:"fee"`
141- }
142-
143- type CoinResponse struct {
144- Denom string `json:"denom"`
145- Amount string `json:"amount"`
146- }
147-
14875// =====================
14976// Price Oracle Contract Types
15077// =====================
@@ -334,65 +261,6 @@ func (s *priceOracleContractTestSuite) TestStoreContractViaGovernance() {
334261 s .T ().Log ("Successfully submitted store code proposal via governance" )
335262}
336263
337- // TestWormholeContractMessageEncoding tests that Wormhole contract message types serialize correctly
338- func (s * priceOracleContractTestSuite ) TestWormholeContractMessageEncoding () {
339- // Test WormholeInstantiateMsg encoding
340- // Use a test guardian address (20 bytes)
341- testGuardianAddr := make ([]byte , 20 )
342- for i := range testGuardianAddr {
343- testGuardianAddr [i ] = byte (i + 1 )
344- }
345-
346- instantiateMsg := WormholeInstantiateMsg {
347- GovChain : 1 , // Solana
348- GovAddress : base64 .StdEncoding .EncodeToString (make ([]byte , 32 )),
349- InitialGuardianSet : GuardianSetInfo {
350- Addresses : []GuardianAddress {
351- {Bytes : base64 .StdEncoding .EncodeToString (testGuardianAddr )},
352- },
353- ExpirationTime : 0 ,
354- },
355- GuardianSetExpirity : 86400 ,
356- ChainID : 18 , // Example chain ID
357- FeeDenom : "uakt" ,
358- }
359-
360- data , err := json .Marshal (instantiateMsg )
361- s .Require ().NoError (err )
362- s .T ().Logf ("Wormhole InstantiateMsg JSON: %s" , string (data ))
363-
364- var decoded WormholeInstantiateMsg
365- err = json .Unmarshal (data , & decoded )
366- s .Require ().NoError (err )
367- s .Require ().Equal (instantiateMsg .GovChain , decoded .GovChain )
368- s .Require ().Equal (instantiateMsg .ChainID , decoded .ChainID )
369-
370- // Test WormholeQueryMsg encoding
371- queryMsg := WormholeQueryMsg {
372- GuardianSetInfo : & struct {}{},
373- }
374-
375- data , err = json .Marshal (queryMsg )
376- s .Require ().NoError (err )
377- s .Require ().Equal (`{"guardian_set_info":{}}` , string (data ))
378-
379- queryMsg = WormholeQueryMsg {
380- GetState : & struct {}{},
381- }
382-
383- data , err = json .Marshal (queryMsg )
384- s .Require ().NoError (err )
385- s .Require ().Equal (`{"get_state":{}}` , string (data ))
386-
387- queryMsg = WormholeQueryMsg {
388- QueryAddressHex : & QueryAddressHexMsg {Address : "akash1test123" },
389- }
390-
391- data , err = json .Marshal (queryMsg )
392- s .Require ().NoError (err )
393- s .T ().Logf ("Wormhole QueryAddressHex JSON: %s" , string (data ))
394- }
395-
396264// TestPriceOracleWithVAAMessageEncoding tests that Pyth contract PNAU message types serialize correctly.
397265func (s * priceOracleContractTestSuite ) TestPriceOracleWithVAAMessageEncoding () {
398266 vaaInstantiateMsg := PythVaaInstantiateMsg {
@@ -595,42 +463,6 @@ func (s *priceOracleContractTestSuite) TestContractResponseParsing() {
595463 s .Require ().Equal (uint64 (100 ), params .LastUpdatedHeight )
596464}
597465
598- // TestWormholeResponseParsing tests parsing of Wormhole contract responses
599- func (s * priceOracleContractTestSuite ) TestWormholeResponseParsing () {
600- // Test GuardianSetInfoResponse parsing
601- testGuardianAddr := make ([]byte , 20 )
602- for i := range testGuardianAddr {
603- testGuardianAddr [i ] = byte (i + 1 )
604- }
605-
606- guardianSetJSON := `{
607- "guardian_set_index": 3,
608- "addresses": [
609- {"bytes": "` + base64 .StdEncoding .EncodeToString (testGuardianAddr ) + `"}
610- ]
611- }`
612-
613- var guardianSet WormholeGuardianSetInfoResponse
614- err := json .Unmarshal ([]byte (guardianSetJSON ), & guardianSet )
615- s .Require ().NoError (err )
616- s .Require ().Equal (uint32 (3 ), guardianSet .GuardianSetIndex )
617- s .Require ().Len (guardianSet .Addresses , 1 )
618-
619- // Test GetStateResponse parsing
620- stateJSON := `{
621- "fee": {
622- "denom": "uakt",
623- "amount": "1000"
624- }
625- }`
626-
627- var state WormholeGetStateResponse
628- err = json .Unmarshal ([]byte (stateJSON ), & state )
629- s .Require ().NoError (err )
630- s .Require ().Equal ("uakt" , state .Fee .Denom )
631- s .Require ().Equal ("1000" , state .Fee .Amount )
632- }
633-
634466// TestPNAUExecuteMessageParsing tests that PNAU execute messages are properly formatted.
635467func (s * priceOracleContractTestSuite ) TestPNAUExecuteMessageParsing () {
636468 testPNAUData := []byte ("PNAU" + "test_router_signed_accumulator_update" )
@@ -667,8 +499,6 @@ func (s *priceOracleContractTestSuite) TestAllContractsExist() {
667499 dir string
668500 wasmFile string
669501 }{
670- {"wormhole" , "wormhole" , "wormhole.wasm" },
671- {"pyth" , "pyth" , "pyth.wasm" },
672502 {"pyth-vaa" , "pyth-vaa" , "pyth_vaa.wasm" },
673503 {"pyth-pro" , "pyth-pro" , "pyth_pro.wasm" },
674504 }
@@ -692,11 +522,12 @@ func (s *priceOracleContractTestSuite) TestAllContractsExist() {
692522 }
693523}
694524
695- // TestVAAStructure validates VAA binary structure understanding
696- func (s * priceOracleContractTestSuite ) TestVAAStructure () {
697- // VAA header structure (for reference):
525+ // TestRouterSignedVAAStructure documents the VAA-format envelope used inside PNAU.
526+ func (s * priceOracleContractTestSuite ) TestRouterSignedVAAStructure () {
527+ // The upgraded Pyth router payload keeps the VAA-format envelope, but the
528+ // signer set is the Pyth router set rather than the former guardian set.
698529 // - version (1 byte)
699- // - guardian_set_index (4 bytes)
530+ // - router_set_index (4 bytes)
700531 // - len_signers (1 byte)
701532 // - signatures (66 bytes each)
702533 // - body:
@@ -711,7 +542,7 @@ func (s *priceOracleContractTestSuite) TestVAAStructure() {
711542 // Test that we understand the structure correctly
712543 s .T ().Log ("VAA Header structure:" )
713544 s .T ().Log (" - Version: 1 byte at offset 0" )
714- s .T ().Log (" - Guardian Set Index: 4 bytes at offset 1" )
545+ s .T ().Log (" - Router Set Index: 4 bytes at offset 1" )
715546 s .T ().Log (" - Num Signers: 1 byte at offset 5" )
716547 s .T ().Log (" - Signatures: 66 bytes each starting at offset 6" )
717548 s .T ().Log ("Body structure (after signatures):" )
@@ -723,15 +554,14 @@ func (s *priceOracleContractTestSuite) TestVAAStructure() {
723554 s .T ().Log (" - Consistency Level: 1 byte at offset 50" )
724555 s .T ().Log (" - Payload: variable starting at offset 51" )
725556
726- // Create a minimal test VAA structure
727- testGuardianAddr := make ([]byte , 20 )
728- for i := range testGuardianAddr {
729- testGuardianAddr [i ] = byte (i + 1 )
557+ // Router addresses use the same 20-byte Ethereum-style address encoding.
558+ testRouterAddr := make ([]byte , 20 )
559+ for i := range testRouterAddr {
560+ testRouterAddr [i ] = byte (i + 1 )
730561 }
731562
732- // Log test guardian address
733- s .T ().Logf ("Test guardian address (hex): %s" , hex .EncodeToString (testGuardianAddr ))
734- s .T ().Logf ("Test guardian address (base64): %s" , base64 .StdEncoding .EncodeToString (testGuardianAddr ))
563+ s .T ().Logf ("Test router address (hex): %s" , hex .EncodeToString (testRouterAddr ))
564+ s .T ().Logf ("Test router address (base64): %s" , base64 .StdEncoding .EncodeToString (testRouterAddr ))
735565}
736566
737567// findWasmPath attempts to find a wasm file for a given contract
0 commit comments