Skip to content

Commit

Permalink
fix: specifically this fixture has 102 signers
Browse files Browse the repository at this point in the history
  • Loading branch information
Donovan Dall committed Jul 3, 2024
1 parent 9eb6ce8 commit bd26e0a
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions nearx/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,11 @@ mod tests {
let (main_h, _, main_nb) = test_state();
let (test_h, _, test_nb) = testnet_state();

type Mainnet = FixturesConfig<config::Mainnet, 102>;

let define = |b: &mut B| {
let header = b.read::<HeaderVariable>();
let trusted_header_hash = header.hash(b);
let (_header, _bps, next_block) =
InputFetcher::<Mainnet>(Default::default()).fetch_sync(b, &trusted_header_hash);
b.write::<BlockVariable<{ Mainnet::BPS }>>(next_block);

let header = b.read::<HeaderVariable>();
let trusted_header_hash = header.hash(b);
let (_header, _bps, next_block) =
InputFetcher::<Testnet>(Default::default()).fetch_sync(b, &trusted_header_hash);
b.write::<BlockVariable<{ Testnet::BPS }>>(next_block);
test_fetch_data::<Mainnet>(b);
test_fetch_data::<Testnet>(b);
};

let writer = |input: &mut PI| {
Expand All @@ -333,6 +326,22 @@ mod tests {
builder_suite(define, writer, assertions);
}

// This is a compiler bug because we use the [();BPS] syntax to constrain the
// const generic
#[allow(unused)]
fn test_fetch_data<C>(b: &mut CircuitBuilder<DefaultParameters, 2>)
where
C: Config,
[(); C::BPS]:,
{
let header = b.read::<HeaderVariable>();
let trusted_header_hash = header.hash(b);

let (_header, _bps, next_block) =
InputFetcher::<C>(Default::default()).fetch_sync(b, &trusted_header_hash);
b.write::<BlockVariable<{ C::BPS }>>(next_block);
}

// TODO: turns out this resolved itself on live after 2 weeks without doing
// anything, probably platform issue #[test]
// fn test_fetch_corner_cases() {
Expand Down

0 comments on commit bd26e0a

Please sign in to comment.