1
0
mirror of synced 2025-02-12 07:36:48 +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, 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(|| { static OPTIONS: Lazy<BincodeOptions> = Lazy::new(|| {
bincode::DefaultOptions::new() bincode::DefaultOptions::new()
.with_little_endian() .with_little_endian()

View File

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

View File

@ -38,7 +38,7 @@ impl Leader {
} }
} }
pub fn build_proof_for( pub async fn build_proof_for(
&self, &self,
note_tree: &NoteTree, note_tree: &NoteTree,
epoch_state: &EpochState, epoch_state: &EpochState,
@ -47,9 +47,19 @@ impl Leader {
) -> Option<Risc0LeaderProof> { ) -> Option<Risc0LeaderProof> {
let notes = self.notes.get(&parent)?; let notes = self.notes.get(&parent)?;
for note in notes { 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( let public_inputs = LeaderPublic::new(
cm_root, note_tree.root(),
*epoch_state.nonce(), *epoch_state.nonce(),
slot.into(), slot.into(),
self.config.consensus_config.active_slot_coeff, self.config.consensus_config.active_slot_coeff,
@ -64,20 +74,20 @@ impl Leader {
note.note.value, note.note.value,
epoch_state.total_stake() epoch_state.total_stake()
); );
let index = note_tree let input = *note;
.commitments() return Some(
.iter() tokio::task::spawn_blocking(move || {
.position(|cm| cm == &note.note_commitment())?; Risc0LeaderProof::build(
let input_cm_path = note_tree public_inputs,
.witness(index) LeaderPrivate {
.expect("Note was found in the tree"); input,
return Some(Risc0LeaderProof::build( input_cm_path,
public_inputs, },
LeaderPrivate { )
input: *note, })
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)); tracing::error!("trying to propose a block for slot {} but epoch state is not available", u64::from(slot));
continue; 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..."); tracing::debug!("proposing block...");
// TODO: spawn as a separate task? // TODO: spawn as a separate task?
let block = Self::propose_block( let block = Self::propose_block(

View File

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