Skip to content

Commit

Permalink
remove prev_block_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Dec 12, 2024
1 parent 816f819 commit 7f2eec7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions sequencer-sqlite/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,6 @@ mod test_headers {
block_merkle_tree: block_merkle_tree.clone(),
fee_merkle_tree,
chain_config: genesis.instance_state.chain_config.into(),
prev_block_epoch: EpochNumber::new(0),
};

let (fee_account, fee_key) = FeeAccount::generated_from_seed_indexed([0; 32], 0);
Expand Down
16 changes: 3 additions & 13 deletions types/src/v0/impls/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ pub struct ValidatedState {
pub fee_merkle_tree: FeeMerkleTree,
/// Configuration [`Header`] proposals will be validated against.
pub chain_config: ResolvableChainConfig,
// TODO: >>>> better name?
pub prev_block_epoch: EpochNumber,
}

impl Default for ValidatedState {
Expand All @@ -162,7 +160,6 @@ impl Default for ValidatedState {
block_merkle_tree,
fee_merkle_tree,
chain_config,
prev_block_epoch: EpochNumber::new(0),
}
}
}
Expand Down Expand Up @@ -623,7 +620,6 @@ impl ValidatedState {
self.block_merkle_tree.commitment(),
),
chain_config: ResolvableChainConfig::from(self.chain_config.commit()),
prev_block_epoch: EpochNumber::new(0),
}
}
}
Expand Down Expand Up @@ -702,11 +698,11 @@ fn validate_builder_fee(
async fn emit_update_stake_table_event(
instance: &NodeState,
header: &Header,
prev_block_epoch: EpochNumber,
) -> anyhow::Result<()> {
let prev_epoch = epoch_from_block_number(header.block_number().saturating_sub(1), EPOCH_HEIGHT);
let epoch = epoch_from_block_number(header.block_number(), EPOCH_HEIGHT);

if epoch <= prev_block_epoch.u64() {
if epoch <= prev_epoch {
return Ok(());
}

Expand Down Expand Up @@ -767,12 +763,7 @@ impl ValidatedState {
.await;

if version >= EpochVersion::VERSION {
emit_update_stake_table_event(
instance,
proposed_header,
validated_state.prev_block_epoch,
)
.await?;
emit_update_stake_table_event(instance, proposed_header).await?;
}

// Find missing fee state entries. We will need to use the builder account which is paying a
Expand Down Expand Up @@ -1011,7 +1002,6 @@ impl HotShotState<SeqTypes> for ValidatedState {
fee_merkle_tree,
block_merkle_tree,
chain_config: block_header.chain_config(),
prev_block_epoch: EpochNumber::new(epoch),
}
}
/// Construct a genesis validated state.
Expand Down

0 comments on commit 7f2eec7

Please sign in to comment.