|
|
@@ -400,7 +400,7 @@ async fn test_stale_threshold() {
|
|
|
&contract
|
|
|
.view("get_update_fee_estimate")
|
|
|
.args_json(&json!({
|
|
|
- "vaa": vaa,
|
|
|
+ "data": vaa,
|
|
|
}))
|
|
|
.await
|
|
|
.unwrap()
|
|
|
@@ -410,7 +410,7 @@ async fn test_stale_threshold() {
|
|
|
|
|
|
// Submit price. As there are no prices this should succeed despite being old.
|
|
|
assert!(contract
|
|
|
- .call("update_price_feed")
|
|
|
+ .call("update_price_feeds")
|
|
|
.gas(300_000_000_000_000)
|
|
|
.deposit(update_fee.into())
|
|
|
.args_json(&json!({
|
|
|
@@ -482,7 +482,7 @@ async fn test_stale_threshold() {
|
|
|
|
|
|
// The update handler should now succeed even if price is old, but simply not update the price.
|
|
|
assert!(contract
|
|
|
- .call("update_price_feed")
|
|
|
+ .call("update_price_feeds")
|
|
|
.gas(300_000_000_000_000)
|
|
|
.deposit(update_fee.into())
|
|
|
.args_json(&json!({
|
|
|
@@ -616,7 +616,7 @@ async fn test_contract_fees() {
|
|
|
&contract
|
|
|
.view("get_update_fee_estimate")
|
|
|
.args_json(&json!({
|
|
|
- "vaa": vaa,
|
|
|
+ "data": vaa,
|
|
|
}))
|
|
|
.await
|
|
|
.unwrap()
|
|
|
@@ -648,7 +648,7 @@ async fn test_contract_fees() {
|
|
|
&contract
|
|
|
.view("get_update_fee_estimate")
|
|
|
.args_json(&json!({
|
|
|
- "vaa": vaa,
|
|
|
+ "data": vaa,
|
|
|
}))
|
|
|
.await
|
|
|
.unwrap()
|
|
|
@@ -699,7 +699,7 @@ async fn test_contract_fees() {
|
|
|
};
|
|
|
|
|
|
assert!(contract
|
|
|
- .call("update_price_feed")
|
|
|
+ .call("update_price_feeds")
|
|
|
.gas(300_000_000_000_000)
|
|
|
.deposit(update_fee.into())
|
|
|
.args_json(&json!({
|
|
|
@@ -990,7 +990,6 @@ async fn test_accumulator_updates() {
|
|
|
fn create_accumulator_message_from_updates(
|
|
|
price_updates: Vec<MerklePriceUpdate>,
|
|
|
tree: MerkleTree<Keccak160>,
|
|
|
- corrupt_wormhole_message: bool,
|
|
|
emitter_address: [u8; 32],
|
|
|
emitter_chain: u16,
|
|
|
) -> Vec<u8> {
|
|
|
@@ -1026,11 +1025,7 @@ async fn test_accumulator_updates() {
|
|
|
to_vec::<_, BigEndian>(&accumulator_update_data).unwrap()
|
|
|
}
|
|
|
|
|
|
- fn create_accumulator_message(
|
|
|
- all_feeds: &[Message],
|
|
|
- updates: &[Message],
|
|
|
- corrupt_wormhole_message: bool,
|
|
|
- ) -> Vec<u8> {
|
|
|
+ fn create_accumulator_message(all_feeds: &[Message], updates: &[Message]) -> Vec<u8> {
|
|
|
let all_feeds_bytes: Vec<_> = all_feeds
|
|
|
.iter()
|
|
|
.map(|f| to_vec::<_, BigEndian>(f).unwrap())
|
|
|
@@ -1050,7 +1045,6 @@ async fn test_accumulator_updates() {
|
|
|
create_accumulator_message_from_updates(
|
|
|
price_updates,
|
|
|
tree,
|
|
|
- corrupt_wormhole_message,
|
|
|
[1; 32],
|
|
|
wormhole::Chain::Any.into(),
|
|
|
)
|
|
|
@@ -1109,12 +1103,12 @@ async fn test_accumulator_updates() {
|
|
|
// Create a couple of test feeds.
|
|
|
let feed_1 = create_dummy_price_feed_message(100);
|
|
|
let feed_2 = create_dummy_price_feed_message(200);
|
|
|
- let message = create_accumulator_message(&[feed_1, feed_2], &[feed_1], false);
|
|
|
+ let message = create_accumulator_message(&[feed_1, feed_2], &[feed_1]);
|
|
|
let message = hex::encode(message);
|
|
|
|
|
|
// Call the usual UpdatePriceFeed function.
|
|
|
assert!(contract
|
|
|
- .call("update_price_feed")
|
|
|
+ .call("update_price_feeds")
|
|
|
.gas(300_000_000_000_000)
|
|
|
.deposit(300_000_000_000_000_000_000_000)
|
|
|
.args_json(&json!({
|
|
|
@@ -1127,4 +1121,26 @@ async fn test_accumulator_updates() {
|
|
|
.unwrap()
|
|
|
.failures()
|
|
|
.is_empty());
|
|
|
+
|
|
|
+ // Check the price feed actually updated. Check both types of serialized PriceIdentifier.
|
|
|
+ let mut identifier = [0; 32];
|
|
|
+ identifier[0] = 100;
|
|
|
+
|
|
|
+ assert_eq!(
|
|
|
+ Some(Price {
|
|
|
+ price: 100,
|
|
|
+ conf: 100,
|
|
|
+ expo: 100,
|
|
|
+ timestamp: 100,
|
|
|
+ }),
|
|
|
+ serde_json::from_slice::<Option<Price>>(
|
|
|
+ &contract
|
|
|
+ .view("get_price_unsafe")
|
|
|
+ .args_json(&json!({ "price_identifier": PriceIdentifier(identifier) }))
|
|
|
+ .await
|
|
|
+ .unwrap()
|
|
|
+ .result
|
|
|
+ )
|
|
|
+ .unwrap(),
|
|
|
+ );
|
|
|
}
|