@@ -400,7 +400,7 @@ async fn test_stale_threshold() {
400
400
& contract
401
401
. view ( "get_update_fee_estimate" )
402
402
. args_json ( & json ! ( {
403
- "vaa " : vaa,
403
+ "data " : vaa,
404
404
} ) )
405
405
. await
406
406
. unwrap ( )
@@ -410,7 +410,7 @@ async fn test_stale_threshold() {
410
410
411
411
// Submit price. As there are no prices this should succeed despite being old.
412
412
assert ! ( contract
413
- . call( "update_price_feed " )
413
+ . call( "update_price_feeds " )
414
414
. gas( 300_000_000_000_000 )
415
415
. deposit( update_fee. into( ) )
416
416
. args_json( & json!( {
@@ -482,7 +482,7 @@ async fn test_stale_threshold() {
482
482
483
483
// The update handler should now succeed even if price is old, but simply not update the price.
484
484
assert ! ( contract
485
- . call( "update_price_feed " )
485
+ . call( "update_price_feeds " )
486
486
. gas( 300_000_000_000_000 )
487
487
. deposit( update_fee. into( ) )
488
488
. args_json( & json!( {
@@ -616,7 +616,7 @@ async fn test_contract_fees() {
616
616
& contract
617
617
. view ( "get_update_fee_estimate" )
618
618
. args_json ( & json ! ( {
619
- "vaa " : vaa,
619
+ "data " : vaa,
620
620
} ) )
621
621
. await
622
622
. unwrap ( )
@@ -648,7 +648,7 @@ async fn test_contract_fees() {
648
648
& contract
649
649
. view( "get_update_fee_estimate" )
650
650
. args_json( & json!( {
651
- "vaa " : vaa,
651
+ "data " : vaa,
652
652
} ) )
653
653
. await
654
654
. unwrap( )
@@ -699,7 +699,7 @@ async fn test_contract_fees() {
699
699
} ;
700
700
701
701
assert ! ( contract
702
- . call( "update_price_feed " )
702
+ . call( "update_price_feeds " )
703
703
. gas( 300_000_000_000_000 )
704
704
. deposit( update_fee. into( ) )
705
705
. args_json( & json!( {
@@ -990,7 +990,6 @@ async fn test_accumulator_updates() {
990
990
fn create_accumulator_message_from_updates (
991
991
price_updates : Vec < MerklePriceUpdate > ,
992
992
tree : MerkleTree < Keccak160 > ,
993
- corrupt_wormhole_message : bool ,
994
993
emitter_address : [ u8 ; 32 ] ,
995
994
emitter_chain : u16 ,
996
995
) -> Vec < u8 > {
@@ -1026,11 +1025,7 @@ async fn test_accumulator_updates() {
1026
1025
to_vec :: < _ , BigEndian > ( & accumulator_update_data) . unwrap ( )
1027
1026
}
1028
1027
1029
- fn create_accumulator_message (
1030
- all_feeds : & [ Message ] ,
1031
- updates : & [ Message ] ,
1032
- corrupt_wormhole_message : bool ,
1033
- ) -> Vec < u8 > {
1028
+ fn create_accumulator_message ( all_feeds : & [ Message ] , updates : & [ Message ] ) -> Vec < u8 > {
1034
1029
let all_feeds_bytes: Vec < _ > = all_feeds
1035
1030
. iter ( )
1036
1031
. map ( |f| to_vec :: < _ , BigEndian > ( f) . unwrap ( ) )
@@ -1050,7 +1045,6 @@ async fn test_accumulator_updates() {
1050
1045
create_accumulator_message_from_updates (
1051
1046
price_updates,
1052
1047
tree,
1053
- corrupt_wormhole_message,
1054
1048
[ 1 ; 32 ] ,
1055
1049
wormhole:: Chain :: Any . into ( ) ,
1056
1050
)
@@ -1109,12 +1103,12 @@ async fn test_accumulator_updates() {
1109
1103
// Create a couple of test feeds.
1110
1104
let feed_1 = create_dummy_price_feed_message ( 100 ) ;
1111
1105
let feed_2 = create_dummy_price_feed_message ( 200 ) ;
1112
- let message = create_accumulator_message ( & [ feed_1, feed_2] , & [ feed_1] , false ) ;
1106
+ let message = create_accumulator_message ( & [ feed_1, feed_2] , & [ feed_1] ) ;
1113
1107
let message = hex:: encode ( message) ;
1114
1108
1115
1109
// Call the usual UpdatePriceFeed function.
1116
1110
assert ! ( contract
1117
- . call( "update_price_feed " )
1111
+ . call( "update_price_feeds " )
1118
1112
. gas( 300_000_000_000_000 )
1119
1113
. deposit( 300_000_000_000_000_000_000_000 )
1120
1114
. args_json( & json!( {
@@ -1127,4 +1121,26 @@ async fn test_accumulator_updates() {
1127
1121
. unwrap( )
1128
1122
. failures( )
1129
1123
. is_empty( ) ) ;
1124
+
1125
+ // Check the price feed actually updated. Check both types of serialized PriceIdentifier.
1126
+ let mut identifier = [ 0 ; 32 ] ;
1127
+ identifier[ 0 ] = 100 ;
1128
+
1129
+ assert_eq ! (
1130
+ Some ( Price {
1131
+ price: 100 ,
1132
+ conf: 100 ,
1133
+ expo: 100 ,
1134
+ timestamp: 100 ,
1135
+ } ) ,
1136
+ serde_json:: from_slice:: <Option <Price >>(
1137
+ & contract
1138
+ . view( "get_price_unsafe" )
1139
+ . args_json( & json!( { "price_identifier" : PriceIdentifier ( identifier) } ) )
1140
+ . await
1141
+ . unwrap( )
1142
+ . result
1143
+ )
1144
+ . unwrap( ) ,
1145
+ ) ;
1130
1146
}
0 commit comments