Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions target_chains/cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions target_chains/cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[patch.crates-io]
cw20-wrapped-2 = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
2 changes: 1 addition & 1 deletion target_chains/cosmwasm/contracts/pyth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ schemars = "0.8.1"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
serde_derive = { version = "1.0.103"}
terraswap = "2.4.0"
wormhole-bridge-terra-2 = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9", features = ["library"] }
wormhole-bridge-terra-2 = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8", features = ["library"] }
thiserror = { version = "1.0.20" }
k256 = { version = "0.9.4", default-features = false, features = ["ecdsa"] }
sha3 = { version = "0.9.1", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion tilt_devnet/docker_images/Dockerfile.solana
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN cargo init --lib /tmp/decoy-crate && \

WORKDIR /usr/src/bridge

ARG WORMHOLE_REV=2.14.7
ARG WORMHOLE_REV=2.14.8
ADD https://github.com/wormhole-foundation/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz .
RUN tar -xvf v${WORMHOLE_REV}.tar.gz
RUN mv wormhole-${WORMHOLE_REV} wormhole
Expand Down
8 changes: 4 additions & 4 deletions wormhole_attester/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wormhole_attester/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ borsh = "=0.9.3"
clap = {version = "3.1.18", features = ["derive"]}
env_logger = "0.8.4"
log = "0.4.14"
wormhole-bridge-solana = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
wormhole-bridge-solana = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
pyth-wormhole-attester = {path = "../program"}
pyth-wormhole-attester-sdk = { path = "../sdk/rust", features=["solana"] }
pyth-sdk-solana = "0.6.1"
Expand All @@ -32,7 +32,7 @@ solana-client = "=1.10.31"
solana-program = "=1.10.31"
solana-sdk = "=1.10.31"
solana-transaction-status = "=1.10.31"
solitaire = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
solitaire = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
tokio = {version = "1", features = ["sync", "rt-multi-thread", "time"]}
futures = "0.3.21"
sha3 = "0.10.6"
Expand Down
6 changes: 3 additions & 3 deletions wormhole_attester/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ trace = ["solitaire/trace", "wormhole-bridge-solana/trace"]
no-entrypoint = []

[dependencies]
wormhole-bridge-solana = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9" }
solitaire = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
rocksalt = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
wormhole-bridge-solana = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8" }
solitaire = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
rocksalt = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
solana-program = "=1.10.31"
borsh = "=0.9.3"
pyth-client = "0.2.2"
Expand Down
44 changes: 1 addition & 43 deletions wormhole_attester/program/src/attest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ use {
},
solana_program::{
clock::Clock,
program::{
invoke,
invoke_signed,
},
program::invoke_signed,
program_error::ProgramError,
rent::Rent,
system_instruction,
sysvar::Sysvar as SolanaSysvar,
},
solitaire::{
trace,
Expand Down Expand Up @@ -368,42 +363,5 @@ pub fn attest(ctx: &ExecutionContext, accs: &mut Attest, data: AttestData) -> So
.as_slice(),
)?;

// NOTE: 2022-09-05
//
// This part is added to avoid rent exemption error that is introduced using
// a wrong implementation in solitaire
//
// This is done after the cross-contract call to get the proper account sizes
// and avoid breaking wormhole call.
//
// It can be removed once wormhole mitigates this problem and upgrades its contract

// Checking the message account balance
let wh_message_balance = accs.wh_message.info().lamports();
let wh_message_rent_exempt = Rent::get()?.minimum_balance(accs.wh_message.info().data_len());

if wh_message_balance < wh_message_rent_exempt {
let required_deposit = wh_message_rent_exempt - wh_message_balance;

let transfer_ix = system_instruction::transfer(
accs.payer.key,
accs.wh_message.info().key,
required_deposit,
);
invoke(&transfer_ix, ctx.accounts)?
}

// Checking the sequence account balance
let wh_sequence_balance = accs.wh_sequence.info().lamports();
let wh_sequence_rent_exempt = Rent::get()?.minimum_balance(accs.wh_sequence.data_len());

if wh_sequence_balance < wh_sequence_rent_exempt {
let required_deposit = wh_sequence_rent_exempt - wh_sequence_balance;

let transfer_ix =
system_instruction::transfer(accs.payer.key, accs.wh_sequence.key, required_deposit);
invoke(&transfer_ix, ctx.accounts)?
}

Ok(())
}
22 changes: 0 additions & 22 deletions wormhole_attester/program/src/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ use {
P2WConfigAccount,
Pyth2WormholeConfig,
},
solana_program::{
program::invoke,
rent::Rent,
system_instruction,
sysvar::Sysvar,
},
solitaire::{
trace,
AccountState,
Expand Down Expand Up @@ -41,21 +35,5 @@ pub fn initialize(
.create(ctx, accs.payer.info().key, CreationLamports::Exempt)?;
accs.new_config.1 = data;

// TODO(2022-09-05): Remove this rent collection after
// sysvar-based rent calculation becomes mainline in Solitaire.
let config_balance = accs.new_config.info().lamports();
let config_rent_exempt = Rent::get()?.minimum_balance(accs.new_config.info().data_len());

if config_balance < config_rent_exempt {
let required_deposit = config_rent_exempt - config_balance;

let transfer_ix = system_instruction::transfer(
accs.payer.key,
accs.new_config.info().key,
required_deposit,
);
invoke(&transfer_ix, ctx.accounts)?
}

Ok(())
}
24 changes: 0 additions & 24 deletions wormhole_attester/program/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ use {
Pyth2WormholeConfig,
},
solana_program::{
program::invoke,
program_error::ProgramError,
rent::Rent,
system_instruction,
system_program,
sysvar::Sysvar,
},
solitaire::{
trace,
AccountSize,
AccountState,
CreationLamports,
ExecutionContext,
Expand Down Expand Up @@ -77,25 +72,6 @@ pub fn migrate(ctx: &ExecutionContext, accs: &mut Migrate, _data: ()) -> SoliRes
.create(ctx, accs.payer.info().key, CreationLamports::Exempt)?;
accs.new_config.1 = Pyth2WormholeConfig::from(old_config.clone());

// Adjust new config lamports
// NOTE(2022-09-29): Necessary due to PythNet rent calculation
// differences, remove when solitaire supports Rent::get()?
let acc_lamports = accs.new_config.info().lamports();

let new_lamports = Rent::get()?.minimum_balance(accs.new_config.size());

let diff_lamports: u64 = (acc_lamports as i64 - new_lamports as i64).unsigned_abs();

if acc_lamports < new_lamports {
// Less than enough lamports, debit the payer
let transfer_ix = system_instruction::transfer(
accs.payer.info().key,
accs.new_config.info().key,
diff_lamports,
);
invoke(&transfer_ix, ctx.accounts)?;
}

// Reclaim old config lamports

// Save current balance
Expand Down
4 changes: 2 additions & 2 deletions wormhole_attester/sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-wormhole-attester-sdk"
version = "0.1.1"
version = "0.1.2"
authors = ["Wormhole Contributors <[email protected]>"]
edition = "2018"
description = "Pyth to Wormhole SDK"
Expand All @@ -17,7 +17,7 @@ hex = "0.4.3"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
pyth-sdk = {version = "0.5.0"}
pyth-sdk-solana = { version = "0.5.0", optional = true }
solitaire = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9", optional = true}
solitaire = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8", optional = true}
solana-program = { version = "=1.10.31", optional = true }

[dev-dependencies]
Expand Down