diff --git a/nearx/src/hint.rs b/nearx/src/hint.rs index 239f516..16587df 100644 --- a/nearx/src/hint.rs +++ b/nearx/src/hint.rs @@ -286,13 +286,12 @@ pub struct ProofInputVariable { #[cfg(test)] mod tests { - use near_light_client_primitives::NUM_BLOCK_PRODUCER_SEATS; use super::*; use crate::{ config::{self, FixturesConfig}, test_utils::{builder_suite, test_state, testnet_state, B, PI, PO}, - variables::{BlockVariableValue, HeaderVariable, ValidatorsVariable}, + variables::{BlockVariableValue, HeaderVariable}, }; type Testnet = FixturesConfig; @@ -306,70 +305,73 @@ mod tests { let define = |b: &mut B| { let header = b.read::(); let trusted_header_hash = header.hash(b); - let (_header, _bps, next_block) = - InputFetcher::(Default::default()).fetch_sync(b, &trusted_header_hash); - b.write::>(next_block); + InputFetcher::(Default::default()).fetch_sync(b, &trusted_header_hash); + b.write::>(next_block); let header = b.read::(); let trusted_header_hash = header.hash(b); let (_header, _bps, next_block) = - InputFetcher::(Default::default()).fetch_sync(b, &trusted_header_hash); - b.write::>(next_block); + InputFetcher::(Default::default()).fetch_sync(b, &trusted_header_hash); + b.write::>(next_block); }; let writer = |input: &mut PI| { input.write::(main_h.into()); input.write::(test_h.into()); }; + let assertions = |mut output: PO| { - let inputs = output.read::>(); - let nbh: BlockVariableValue = main_nb.into(); + let inputs = output.read::>(); + let nbh: BlockVariableValue<{ Mainnet::BPS }, GoldilocksField> = main_nb.into(); pretty_assertions::assert_eq!(format!("{:#?}", inputs), format!("{:#?}", nbh)); - let inputs = output.read::>(); - let nbh: BlockVariableValue = test_nb.into(); + let inputs = output.read::>(); + let nbh: BlockVariableValue<{ Testnet::BPS }, GoldilocksField> = test_nb.into(); pretty_assertions::assert_eq!(format!("{:#?}", inputs), format!("{:#?}", nbh)); }; builder_suite(define, writer, assertions); } - #[test] - fn test_fetch_corner_cases() { - let corner_cases = [ - // This is the current investigated one - bytes32!("0x84ebac64b1fd5809ac2c19193100c7e346b765b98a6e3f6de3e40b7d12d3425e"), - ]; - let fetcher = InputFetcher::(Default::default()); - - let define = |b: &mut B| { - for _ in corner_cases { - let h = b.read::(); - - let (header, bps, next_block) = fetcher.fetch_sync(b, &h); - - b.write::(header.clone()); - b.write::>(bps.clone()); - b.write::>(next_block.clone()); - - // let approval = b.reconstruct_approval_message(&next_block); - // b.validate_signatures(&next_block.approvals_after_next, &bps, - // approval); - } - }; - let writer = |input: &mut PI| { - for hash in corner_cases { - input.write::(hash); - } - }; - let assertions = |mut output: PO| { - for _hash in corner_cases { - let _header = output.read::(); - let _bps = output.read::>(); - let _nb = output.read::>(); - } - // TODO: assert on these - }; - builder_suite(define, writer, assertions); - } + // TODO: turns out this resolved itself on live after 2 weeks without doing + // anything, probably platform issue #[test] + // fn test_fetch_corner_cases() { + // let corner_cases = [ + // // This is the current investigated one + // bytes32!(" + // 0x84ebac64b1fd5809ac2c19193100c7e346b765b98a6e3f6de3e40b7d12d3425e"), + // ]; + // let fetcher = InputFetcher::(Default::default()); + + // let define = |b: &mut B| { + // for _ in corner_cases { + // let h = b.read::(); + + // let (header, bps, next_block) = fetcher.fetch_sync(b, &h); + + // b.write::(header.clone()); + // b.write::>(bps.clone()); + // b.write::>(next_block.clone()); + + // // let approval = + // b.reconstruct_approval_message(&next_block); // + // b.validate_signatures(&next_block.approvals_after_next, &bps, + // // approval); + // } + // }; + // let writer = |input: &mut PI| { + // for hash in corner_cases { + // input.write::(hash); + // } + // }; + // let assertions = |mut output: PO| { + // for _hash in corner_cases { + // let _header = output.read::(); + // let _bps = output.read::>(); let _nb = output.read::>(); } + // // TODO: assert on these + // }; + // builder_suite(define, writer, assertions); + // } }