Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion forester/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ impl<R: Rpc> EpochManager<R> {
let slot = rpc.get_slot().await?;
let phases = get_epoch_phases(&self.protocol_config, epoch);

if slot < phases.registration.end {
if slot >= phases.registration.start && slot < phases.registration.end {
let forester_epoch_pda_pubkey =
get_forester_epoch_pda_from_authority(&self.config.derivation_pubkey, epoch).0;
let existing_registration = rpc
Expand Down Expand Up @@ -984,6 +984,17 @@ impl<R: Rpc> EpochManager<R> {
};
debug!("Registered: {:?}", registration_info);
Ok(registration_info)
} else if slot < phases.registration.start {
warn!(
"Too early to register for epoch {}. Current slot: {}, Registration starts: {}",
epoch, slot, phases.registration.start
);
Err(RegistrationError::RegistrationPhaseNotStarted {
epoch,
current_slot: slot,
registration_start: phases.registration.start,
}
.into())
} else {
warn!(
"Too late to register for epoch {}. Current slot: {}, Registration end: {}",
Expand Down
7 changes: 7 additions & 0 deletions forester/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ pub enum ForesterError {

#[derive(Error, Debug)]
pub enum RegistrationError {
#[error("Too early to register for epoch {epoch}. Current slot: {current_slot}, Registration starts: {registration_start}")]
RegistrationPhaseNotStarted {
epoch: u64,
current_slot: u64,
registration_start: u64,
},

#[error("Too late to register for epoch {epoch}. Current slot: {current_slot}, Registration end: {registration_end}")]
RegistrationPhaseEnded {
epoch: u64,
Expand Down
1 change: 1 addition & 0 deletions forester/src/processor/v2/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ where
self.zkp_batch_size,
self.current_root,
self.proof_cache.clone(),
self.seq,
);
let job_tx = self
.worker_pool
Expand Down
7 changes: 4 additions & 3 deletions forester/src/processor/v2/tx_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ struct OrderedProofBuffer {
}

impl OrderedProofBuffer {
fn new(capacity: usize) -> Self {
fn new(capacity: usize, base_seq: u64) -> Self {
Self {
buffer: (0..capacity).map(|_| None).collect(),
base_seq: 0,
base_seq,
len: 0,
head: 0,
}
Expand Down Expand Up @@ -191,6 +191,7 @@ impl<R: Rpc> TxSender<R> {
zkp_batch_size: u64,
last_seen_root: [u8; 32],
proof_cache: Option<Arc<SharedProofCache>>,
initial_seq: u64,
) -> JoinHandle<crate::Result<TxSenderResult>> {
let ixs_per_tx = if context.address_lookup_tables.is_empty() {
V2_IXS_PER_TX_WITHOUT_LUT
Expand All @@ -200,7 +201,7 @@ impl<R: Rpc> TxSender<R> {

let sender = Self {
context,
buffer: OrderedProofBuffer::new(MAX_BUFFER_SIZE),
buffer: OrderedProofBuffer::new(MAX_BUFFER_SIZE, initial_seq),
zkp_batch_size,
last_seen_root,
pending_batch: Vec::with_capacity(ixs_per_tx),
Expand Down
Loading