Skip to content

Commit 94c447a

Browse files
committed
Works
1 parent fa8b418 commit 94c447a

File tree

11 files changed

+123
-24
lines changed

11 files changed

+123
-24
lines changed

governance/remote_executor/Cargo.lock

Lines changed: 85 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

governance/remote_executor/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ members = [
66

77
[profile.release]
88
overflow-checks = true
9+
10+
[patch.crates-io]
11+
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" }

governance/remote_executor/cli/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ shellexpand = "2.1.2"
1414
anyhow = "1.0.65"
1515
base64 = "0.13.0"
1616
wormhole-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"}
1819
hex = "0.4.3"

governance/remote_executor/cli/src/main.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#![deny(warnings)]
2+
3+
use {
4+
serde_wormhole::RawMessage,
5+
wormhole_sdk::{
6+
vaa::digest,
7+
Vaa,
8+
},
9+
};
210
pub mod cli;
311
use {
412
anchor_client::{
@@ -47,7 +55,6 @@ use {
4755
transaction::Transaction,
4856
},
4957
std::str::FromStr,
50-
wormhole::VAA,
5158
wormhole_solana::{
5259
instructions::{
5360
post_message,
@@ -86,7 +93,7 @@ fn main() -> Result<()> {
8693

8794
let signature_set_keypair = Keypair::new();
8895

89-
let vaa = VAA::from_bytes(vaa_bytes.clone())?;
96+
let vaa: Vaa<&RawMessage> = serde_wormhole::from_slice(&vaa_bytes)?;
9097

9198
let posted_vaa_key = PostedVAA::key(&wormhole, vaa.digest().unwrap().hash);
9299

@@ -111,10 +118,10 @@ fn main() -> Result<()> {
111118
timestamp: vaa.timestamp,
112119
nonce: vaa.nonce,
113120
emitter_chain: vaa.emitter_chain.into(),
114-
emitter_address: vaa.emitter_address,
121+
emitter_address: vaa.emitter_address.0,
115122
sequence: vaa.sequence,
116123
consistency_level: vaa.consistency_level,
117-
payload: vaa.payload,
124+
payload: vaa.payload.to_vec(),
118125
};
119126

120127
process_transaction(

governance/remote_executor/programs/remote-executor/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ pythtest = []
1919
[dependencies]
2020
anchor-lang = {version = "0.25.0", features = ["init-if-needed"]}
2121
wormhole-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"}
2324
boolinator = "2.4.0"
2425

2526
[dev-dependencies]
27+
2628
solana-program-test = "=1.10.31"
2729
tokio = "1.14.1"
2830
solana-sdk = "=1.10.31"

governance/remote_executor/programs/remote-executor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use {
1212
claim_record::ClaimRecord,
1313
posted_vaa::AnchorVaa,
1414
},
15-
wormhole::Chain::{
15+
wormhole_sdk::Chain::{
1616
self,
1717
Solana,
1818
},

governance/remote_executor/programs/remote-executor/src/state/governance_payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use {
1010
mem::size_of,
1111
ops::Deref,
1212
},
13-
wormhole::Chain,
13+
wormhole_sdk::Chain,
1414
};
1515

1616
pub const MAGIC_NUMBER: u32 = 0x4d475450; // Reverse order of the solidity contract because borsh uses little endian numbers (the solidity contract uses 0x5054474d)

governance/remote_executor/programs/remote-executor/src/tests/executor_simulator.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use {
3131
ToAccountMetas,
3232
},
3333
solana_program_test::{
34-
find_file,
3534
read_file,
3635
BanksClient,
3736
BanksClientError,
@@ -54,8 +53,11 @@ use {
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 {
8183
impl 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();

target_chains/solana/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/solana/cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ solana-client = "1.10.31"
1212
anchor-client = "0.26.0"
1313
clap = {version ="3.2.22", features = ["derive"]}
1414
pyth-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"}

0 commit comments

Comments
 (0)