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 cadad4c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 0 additions & 2 deletions bin/operator/tests/succinct.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(dead_code)] // Justification: Until we decide on test feature flags
use std::str::FromStr;

use nearx_operator::{config::Config, succinct::*, BaseConfig};
use uuid::Uuid;

async fn client() -> Client {
let _ = tracing_subscriber::fmt::try_init();
Expand Down
33 changes: 21 additions & 12 deletions nearx/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,25 +295,18 @@ mod tests {
};

type Testnet = FixturesConfig<config::Testnet>;
type Mainnet = FixturesConfig<config::Mainnet>;
type _Mainnet = FixturesConfig<config::Mainnet>;

#[test]
fn test_fetch_header() {
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 cadad4c

Please sign in to comment.