Skip to content

Commit

Permalink
More green
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Jan 24, 2024
1 parent 559cec4 commit ed2a6f1
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions target_chains/near/receiver/tests/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,69 +983,6 @@ async fn test_accumulator_updates() {
Message::PriceFeedMessage(msg)
}

// fn create_accumulator_message_from_updates(
// price_updates: Vec<MerklePriceUpdate>,
// tree: MerkleTree<Keccak160>,
// emitter_address: [u8; 32],
// emitter_chain: u16,
// ) -> Vec<u8> {
// let mut root_hash = [0u8; 20];
// root_hash.copy_from_slice(&to_vec::<_, BigEndian>(&tree.root).unwrap()[..20]);
// let wormhole_message = WormholeMessage::new(WormholePayload::Merkle(WormholeMerkleRoot {
// slot: 0,
// ring_size: 0,
// root: root_hash,
// }));

// let vaa = wormhole_sdk::Vaa {
// emitter_chain: emitter_chain.into(),
// emitter_address: wormhole_sdk::Address(emitter_address),
// sequence: 2,
// payload: (),
// ..Default::default()
// };

// let vaa = {
// let mut cur = Cursor::new(Vec::new());
// serde_wormhole::to_writer(&mut cur, &vaa).expect("Failed to serialize VAA");
// cur.write_all(&to_vec::<_, BigEndian>(&wormhole_message).unwrap())
// .expect("Failed to write Payload");
// cur.into_inner()
// };

// let accumulator_update_data = AccumulatorUpdateData::new(Proof::WormholeMerkle {
// vaa: PrefixedVec::from(vaa),
// updates: price_updates,
// });

// to_vec::<_, BigEndian>(&accumulator_update_data).unwrap()
// }

// 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())
// .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,
// [1; 32],
// wormhole_sdk::Chain::Any.into(),
// )
// }

let (_, contract, _) = initialize_chain().await;

// Submit a new Source to the contract, this will trigger a cross-contract call to wormhole
Expand Down Expand Up @@ -1099,7 +1036,7 @@ 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]);
let message = create_accumulator_message(&[feed_1, feed_2], &[feed_1], false);
let message = hex::encode(message);

// Call the usual UpdatePriceFeed function.
Expand Down

0 comments on commit ed2a6f1

Please sign in to comment.