-
Notifications
You must be signed in to change notification settings - Fork 307
[remote-executor] Isolate wormhole-solana crate #843
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
Changes from all commits
fa8b418
94c447a
9c25f6e
bcf423e
fa58fb5
60d18fc
01152dd
4402790
6eb0b4d
08beb57
839e1dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,6 @@ members = [ | |
|
|
||
| [profile.release] | ||
| overflow-checks = true | ||
|
|
||
| [patch.crates-io] | ||
| serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch.crate-io wormhole thing is getting out of control, wormhole needs to fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, reasonable fix for now though. Let's ask for publishing. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| #![deny(warnings)] | ||
|
|
||
| use { | ||
| serde_wormhole::RawMessage, | ||
| wormhole_sdk::vaa::{ | ||
| Body, | ||
| Header, | ||
| Vaa, | ||
| }, | ||
| }; | ||
| pub mod cli; | ||
| use { | ||
| anchor_client::{ | ||
|
|
@@ -47,7 +56,6 @@ use { | |
| transaction::Transaction, | ||
| }, | ||
| std::str::FromStr, | ||
| wormhole::VAA, | ||
| wormhole_solana::{ | ||
| instructions::{ | ||
| post_message, | ||
|
|
@@ -86,9 +94,10 @@ fn main() -> Result<()> { | |
|
|
||
| let signature_set_keypair = Keypair::new(); | ||
|
|
||
| let vaa = VAA::from_bytes(vaa_bytes.clone())?; | ||
| let vaa: Vaa<&RawMessage> = serde_wormhole::from_slice(&vaa_bytes)?; | ||
| let (header, body): (Header, Body<&RawMessage>) = vaa.into(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice nice nice. |
||
|
|
||
| let posted_vaa_key = PostedVAA::key(&wormhole, vaa.digest().unwrap().hash); | ||
| let posted_vaa_key = PostedVAA::key(&wormhole, body.digest().unwrap().hash); | ||
|
|
||
| // First verify VAA | ||
| let verify_txs = verify_signatures_txs( | ||
|
|
@@ -106,15 +115,15 @@ fn main() -> Result<()> { | |
|
|
||
| // Post VAA | ||
| let post_vaa_data = PostVAAData { | ||
| version: vaa.version, | ||
| guardian_set_index: vaa.guardian_set_index, | ||
| timestamp: vaa.timestamp, | ||
| nonce: vaa.nonce, | ||
| emitter_chain: vaa.emitter_chain.into(), | ||
| emitter_address: vaa.emitter_address, | ||
| sequence: vaa.sequence, | ||
| consistency_level: vaa.consistency_level, | ||
| payload: vaa.payload, | ||
| version: header.version, | ||
| guardian_set_index: header.guardian_set_index, | ||
| timestamp: body.timestamp, | ||
| nonce: body.nonce, | ||
| emitter_chain: body.emitter_chain.into(), | ||
| emitter_address: body.emitter_address.0, | ||
| sequence: body.sequence, | ||
| consistency_level: body.consistency_level, | ||
| payload: body.payload.to_vec(), | ||
| }; | ||
|
|
||
| process_transaction( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,13 @@ pythtest = [] | |
|
|
||
| [dependencies] | ||
| anchor-lang = {version = "0.25.0", features = ["init-if-needed"]} | ||
| wormhole-solana = { git = "https://github.com/guibescos/wormhole", branch = "reisen/sdk-solana"} | ||
| wormhole-core = { git = "https://github.com/guibescos/wormhole", branch = "reisen/sdk-solana"} | ||
| wormhole-solana = { git = "https://github.com/guibescos/wormhole-solana", rev="f14b3b54c1e37e1aaf8c2ac2a5e236832ffdb3c2"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should really get away from this, maybe we can chat about what needs to be upstreamed. We're running into this in pythnet too. I believe this was based on my original PR that had plans to revive, we should push for it if possible.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a temporary home.
|
||
| wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" } | ||
| serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1"} | ||
| boolinator = "2.4.0" | ||
|
|
||
| [dev-dependencies] | ||
|
|
||
| solana-program-test = "=1.10.31" | ||
| tokio = "1.14.1" | ||
| solana-sdk = "=1.10.31" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,6 @@ use { | |
| ToAccountMetas, | ||
| }, | ||
| solana_program_test::{ | ||
| find_file, | ||
| read_file, | ||
| BanksClient, | ||
| BanksClientError, | ||
|
|
@@ -54,8 +53,11 @@ use { | |
| TransactionError, | ||
| }, | ||
| }, | ||
| std::collections::HashMap, | ||
| wormhole::Chain, | ||
| std::{ | ||
| collections::HashMap, | ||
| path::Path, | ||
| }, | ||
| wormhole_sdk::Chain, | ||
| wormhole_solana::VAA, | ||
| }; | ||
|
|
||
|
|
@@ -81,9 +83,12 @@ pub enum VaaAttack { | |
| impl ExecutorBench { | ||
| /// Deploys the executor program as upgradable | ||
| pub fn new() -> ExecutorBench { | ||
| let mut bpf_data = read_file(find_file("remote_executor.so").unwrap_or_else(|| { | ||
| panic!("Unable to locate {}", "remote_executor.so"); | ||
| })); | ||
| let mut bpf_data = read_file( | ||
| std::env::current_dir() | ||
| .unwrap() | ||
| .join(Path::new("../../target/deploy/remote_executor.so")), | ||
| ); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newer versions of solana can't find the binary with the previous logic
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why? Inherently suspicious of needing relative paths.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In previous versions (1.13.x) when you ran cargo test-bpf, it would set an environment variable BPF_OUT_DIR and that's how the code would find the binary. Maybe it has to do with them trying to migrate to test-sbf and deprecating test-bpf.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| let mut program_test = ProgramTest::default(); | ||
| let program_key = crate::id(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [toolchain] | ||
| channel = "1.66.1" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drive-by pin toolchain |
||
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.
I had to bump this