1
0
mirror of synced 2025-02-07 13:23:55 +00:00

adjust test timoeut

This commit is contained in:
Giacomo Pasini 2024-09-02 14:27:46 +02:00
parent 4223f67487
commit 461770e545
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
5 changed files with 31 additions and 20 deletions

View File

@ -24,7 +24,7 @@ type BincodeOptions = WithOtherTrailing<
RejectTrailing,
>;
const DATA_LIMIT: u64 = 2048; // Do not serialize/deserialize more than 2Kb
const DATA_LIMIT: u64 = 1 << 19; // Do not serialize/deserialize more than 16Kb
static OPTIONS: Lazy<BincodeOptions> = Lazy::new(|| {
bincode::DefaultOptions::new()
.with_little_endian()

View File

@ -43,6 +43,7 @@ impl Behaviour {
gossipsub::ConfigBuilder::from(gossipsub_config)
.validation_mode(gossipsub::ValidationMode::None)
.message_id_fn(compute_message_id)
.max_transmit_size(1 << 19)
.build()?,
)?;
Ok(Self {

View File

@ -38,7 +38,7 @@ impl Leader {
}
}
pub fn build_proof_for(
pub async fn build_proof_for(
&self,
note_tree: &NoteTree,
epoch_state: &EpochState,
@ -47,9 +47,19 @@ impl Leader {
) -> Option<Risc0LeaderProof> {
let notes = self.notes.get(&parent)?;
for note in notes {
let cm_root = [0; 32];
let Some(index) = note_tree
.commitments()
.iter()
.position(|cm| cm == &note.note_commitment())
else {
continue;
};
let input_cm_path = note_tree
.witness(index)
.expect("Note was found in the tree");
let public_inputs = LeaderPublic::new(
cm_root,
note_tree.root(),
*epoch_state.nonce(),
slot.into(),
self.config.consensus_config.active_slot_coeff,
@ -64,20 +74,20 @@ impl Leader {
note.note.value,
epoch_state.total_stake()
);
let index = note_tree
.commitments()
.iter()
.position(|cm| cm == &note.note_commitment())?;
let input_cm_path = note_tree
.witness(index)
.expect("Note was found in the tree");
return Some(Risc0LeaderProof::build(
public_inputs,
LeaderPrivate {
input: *note,
input_cm_path,
},
));
let input = *note;
return Some(
tokio::task::spawn_blocking(move || {
Risc0LeaderProof::build(
public_inputs,
LeaderPrivate {
input,
input_cm_path,
},
)
})
.await
.ok()?,
);
}
}

View File

@ -344,7 +344,7 @@ where
tracing::error!("trying to propose a block for slot {} but epoch state is not available", u64::from(slot));
continue;
};
if let Some(proof) = leader.build_proof_for(note_tree, epoch_state, slot, parent) {
if let Some(proof) = leader.build_proof_for(note_tree, epoch_state, slot, parent).await {
tracing::debug!("proposing block...");
// TODO: spawn as a separate task?
let block = Self::propose_block(

View File

@ -258,7 +258,7 @@ impl Node for NomosNode {
},
};
let time_config = TimeConfig {
slot_duration: Duration::from_secs(1),
slot_duration: Duration::from_secs(30),
chain_start_time: OffsetDateTime::now_utc(),
};