This commit is contained in:
Guillermo Bescos 2024-01-23 21:41:05 +00:00
parent 530d752a8e
commit 23d7a99d85
6 changed files with 29 additions and 47 deletions

View File

@ -10,9 +10,6 @@ edition = "2021"
crate-type = ["lib"]
name = "pythnet_sdk"
[features]
gen = ["dep:wormhole-sdk", "dep:serde_wormhole"]
[dependencies]
bincode = "1.3.1"
borsh = "0.10.3"
@ -26,12 +23,6 @@ quickcheck = { version = "1", optional = true}
sha3 = "0.10.4"
slow_primes = "0.1.14"
thiserror = "1.0.40"
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", optional = true }
wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", optional = true }
[patch.crates-io]
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole"}
[dev-dependencies]
base64 = "0.21.0"

View File

@ -5,9 +5,6 @@ pub mod messages;
pub mod wire;
pub mod wormhole;
#[cfg(feature = "gen")]
pub mod gen;
pub(crate) type Pubkey = [u8; 32];
/// Official Message Buffer Program Id

View File

@ -213,17 +213,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "bstr"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
dependencies = [
"memchr",
"regex-automata",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -1557,11 +1546,9 @@ dependencies = [
"hex",
"rustc_version",
"serde",
"serde_wormhole",
"sha3 0.10.8",
"slow_primes",
"thiserror",
"wormhole-sdk",
]
[[package]]
@ -1630,12 +1617,6 @@ dependencies = [
"smallvec",
]
[[package]]
name = "regex-automata"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9"
[[package]]
name = "region"
version = "3.0.0"
@ -1876,18 +1857,6 @@ dependencies = [
"syn 2.0.15",
]
[[package]]
name = "serde_wormhole"
version = "0.1.0"
source = "git+https://github.com/wormhole-foundation/wormhole#ded305ffab3ac6b55fe85cb0431626a176baf8bb"
dependencies = [
"base64",
"itoa",
"serde",
"serde_bytes",
"thiserror",
]
[[package]]
name = "sha2"
version = "0.9.9"
@ -2711,3 +2680,8 @@ name = "zeroize"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
[[patch.unused]]
name = "cw20-wrapped-2"
version = "0.1.0"
source = "git+https://github.com/wormhole-foundation/wormhole?tag=v2.14.8#7e982cb03264cf1cccfbb5d947c00d6ad3e2f8f1"

View File

@ -16,4 +16,4 @@ incremental = false
overflow-checks = true
[patch.crates-io]
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
cw20-wrapped-2 = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}

View File

@ -45,4 +45,3 @@ wormhole-cosmwasm = {git = "https://github.com/wormhole-foundation/wormhole", t
[dev-dependencies]
cosmwasm-vm = { version = "1.0.0", default-features = false }
serde_json = "1.0"
pythnet-sdk = { path = "../../../../pythnet/pythnet_sdk", features = ["gen"] }

View File

@ -831,7 +831,6 @@ mod test {
merkle::MerkleTree,
Accumulator,
},
gen::create_accumulator_message as create_accumulator_message_v1,
messages::{
PriceFeedMessage,
TwapMessage,
@ -1236,7 +1235,29 @@ mod test {
updates: &[Message],
corrupt_wormhole_message: bool,
) -> Binary {
create_accumulator_message_v1(all_feeds, updates, corrupt_wormhole_message).into()
let all_feeds_bytes: Vec<_> = all_feeds
.iter()
.map(|f| to_vec::<_, BigEndian>(f).unwrap())
.collect();
let all_feeds_bytes_refs: Vec<_> = all_feeds_bytes.iter().map(|f| f.as_ref()).collect();
let tree = MerkleTree::<Keccak160>::new(all_feeds_bytes_refs.as_slice()).unwrap();
let mut price_updates: Vec<MerklePriceUpdate> = vec![];
for update in updates {
let proof = tree
.prove(&to_vec::<_, BigEndian>(update).unwrap())
.unwrap();
price_updates.push(MerklePriceUpdate {
message: PrefixedVec::from(to_vec::<_, BigEndian>(update).unwrap()),
proof,
});
}
create_accumulator_message_from_updates(
price_updates,
tree,
corrupt_wormhole_message,
default_emitter_addr(),
EMITTER_CHAIN,
)
}