File tree Expand file tree Collapse file tree 11 files changed +124
-25
lines changed
governance/remote_executor Expand file tree Collapse file tree 11 files changed +124
-25
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,6 @@ members = [
66
77[profile .release ]
88overflow-checks = true
9+
10+ [patch .crates-io ]
11+ serde_wormhole = { git = " https://github.com/wormhole-foundation/wormhole" , tag = " v2.17.1" }
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ shellexpand = "2.1.2"
1414anyhow = " 1.0.65"
1515base64 = " 0.13.0"
1616wormhole-solana = { git = " https://github.com/guibescos/wormhole-solana" }
17- wormhole-core = { git = " https://github.com/guibescos/wormhole-solana" }
17+ wormhole-sdk = { git = " https://github.com/wormhole-foundation/wormhole" , tag = " v2.17.1" }
18+ serde_wormhole = { git = " https://github.com/wormhole-foundation/wormhole" , tag = " v2.17.1" }
1819hex = " 0.4.3"
Original file line number Diff line number Diff line change 11#![ deny( warnings) ]
2+
3+ use {
4+ serde_wormhole:: RawMessage ,
5+ wormhole_sdk:: {
6+ vaa:: digest,
7+ Vaa ,
8+ } ,
9+ } ;
210pub mod cli;
311use {
412 anchor_client:: {
5058 transaction:: Transaction ,
5159 } ,
5260 std:: str:: FromStr ,
53- wormhole:: VAA ,
5461 wormhole_solana:: {
5562 instructions:: {
5663 post_message,
@@ -89,12 +96,12 @@ fn main() -> Result<()> {
8996
9097 let signature_set_keypair = Keypair :: new ( ) ;
9198
92- let vaa = VAA :: from_bytes ( vaa_bytes. clone ( ) ) ?;
99+ let vaa: Vaa < & RawMessage > = serde_wormhole :: from_slice ( & vaa_bytes) ?;
93100
94101 // RENT HACK STARTS HERE
95102 let signature_set_size = 4 + 19 + 32 + 4 ;
96103 let posted_vaa_size = 3 + 1 + 1 + 4 + 32 + 4 + 4 + 8 + 2 + 32 + 4 + vaa. payload . len ( ) ;
97- let posted_vaa_key = PostedVAA :: key ( & wormhole, vaa . digest ( ) . unwrap ( ) . hash ) ;
104+ let posted_vaa_key = PostedVAA :: key ( & wormhole, digest ( & vaa_bytes ) . unwrap ( ) . hash ) ;
98105
99106 process_transaction (
100107 & rpc_client,
@@ -136,10 +143,10 @@ fn main() -> Result<()> {
136143 timestamp : vaa. timestamp ,
137144 nonce : vaa. nonce ,
138145 emitter_chain : vaa. emitter_chain . into ( ) ,
139- emitter_address : vaa. emitter_address ,
146+ emitter_address : vaa. emitter_address . 0 ,
140147 sequence : vaa. sequence ,
141148 consistency_level : vaa. consistency_level ,
142- payload : vaa. payload ,
149+ payload : vaa. payload . to_vec ( ) ,
143150 } ;
144151
145152 process_transaction (
Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ pythtest = []
1919[dependencies ]
2020anchor-lang = {version = " 0.25.0" , features = [" init-if-needed" ]}
2121wormhole-solana = { git = " https://github.com/guibescos/wormhole-solana" }
22- wormhole-core = { git = " https://github.com/guibescos/wormhole-solana" }
22+ wormhole-sdk = { git = " https://github.com/wormhole-foundation/wormhole" , tag = " v2.17.1" }
23+ serde_wormhole = { git = " https://github.com/wormhole-foundation/wormhole" , tag = " v2.17.1" }
2324boolinator = " 2.4.0"
2425
2526[dev-dependencies ]
27+
2628solana-program-test = " =1.10.31"
2729tokio = " 1.14.1"
2830solana-sdk = " =1.10.31"
Original file line number Diff line number Diff line change 1212 claim_record:: ClaimRecord ,
1313 posted_vaa:: AnchorVaa ,
1414 } ,
15- wormhole :: Chain :: {
15+ wormhole_sdk :: Chain :: {
1616 self ,
1717 Solana ,
1818 } ,
Original file line number Diff line number Diff line change 1010 mem:: size_of,
1111 ops:: Deref ,
1212 } ,
13- wormhole :: Chain ,
13+ wormhole_sdk :: Chain ,
1414} ;
1515
1616pub const MAGIC_NUMBER : u32 = 0x4d475450 ; // Reverse order of the solidity contract because borsh uses little endian numbers (the solidity contract uses 0x5054474d)
Original file line number Diff line number Diff line change 3131 ToAccountMetas ,
3232 } ,
3333 solana_program_test:: {
34- find_file,
3534 read_file,
3635 BanksClient ,
3736 BanksClientError ,
5453 TransactionError ,
5554 } ,
5655 } ,
57- std:: collections:: HashMap ,
58- wormhole:: Chain ,
56+ std:: {
57+ collections:: HashMap ,
58+ path:: Path ,
59+ } ,
60+ wormhole_sdk:: Chain ,
5961 wormhole_solana:: VAA ,
6062} ;
6163
@@ -81,9 +83,12 @@ pub enum VaaAttack {
8183impl ExecutorBench {
8284 /// Deploys the executor program as upgradable
8385 pub fn new ( ) -> ExecutorBench {
84- let mut bpf_data = read_file ( find_file ( "remote_executor.so" ) . unwrap_or_else ( || {
85- panic ! ( "Unable to locate {}" , "remote_executor.so" ) ;
86- } ) ) ;
86+ let mut bpf_data = read_file (
87+ std:: env:: current_dir ( )
88+ . unwrap ( )
89+ . join ( Path :: new ( "../../target/deploy/remote_executor.so" ) ) ,
90+ ) ;
91+
8792
8893 let mut program_test = ProgramTest :: default ( ) ;
8994 let program_key = crate :: id ( ) ;
Original file line number Diff line number Diff line change @@ -12,5 +12,5 @@ solana-client = "1.10.31"
1212anchor-client = " 0.26.0"
1313clap = {version =" 3.2.22" , features = [" derive" ]}
1414pyth-solana-receiver = {path = " ../programs/solana-receiver" }
15- wormhole-core = { git = " https://github.com/guibescos/wormhole" , branch = " reisen/sdk -solana" }
16- wormhole-solana = { git = " https://github.com/guibescos/wormhole" , branch = " reisen/sdk -solana" }
15+ wormhole-core = { git = " https://github.com/guibescos/wormhole-solana" }
16+ wormhole-solana = { git = " https://github.com/guibescos/wormhole-solana" }
You can’t perform that action at this time.
0 commit comments