Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standartize fork activation logic #588

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions consensus/core/src/config/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl ForkActivation {
pub fn is_active(self, current_daa_score: u64) -> bool {
current_daa_score >= self.0
}

pub fn is_within_range_from_activation(self, current_daa_score: u64, range: u64) -> bool {
self.is_active(current_daa_score) && current_daa_score < self.0 + range
}
}

/// Consensus parameters. Contains settings and configurations which are consensus-sensitive.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::constants::{MAX_SOMPI, SEQUENCE_LOCK_TIME_DISABLED, SEQUENCE_LOCK_TIME_MASK};
use kaspa_consensus_core::{
config::params::ForkActivation,
hashing::sighash::{SigHashReusedValuesSync, SigHashReusedValuesUnsync},
mass::Kip9Version,
tx::{TransactionInput, VerifiableTransaction},
Expand Down Expand Up @@ -48,10 +49,11 @@ impl TransactionValidator {
// Storage mass hardfork was activated
self.check_mass_commitment(tx)?;

// TODO: Decide what to do here
// if pov_daa_score < self.storage_mass_activation + 10 && self.storage_mass_activation > 0 {
// warn!("--------- Storage mass hardfork was activated successfully!!! --------- (DAA score: {})", pov_daa_score);
// }
if self.storage_mass_activation.is_within_range_from_activation(pov_daa_score, 10)
&& self.storage_mass_activation != ForkActivation::always()
michaelsutton marked this conversation as resolved.
Show resolved Hide resolved
{
warn!("--------- Storage mass hardfork was activated successfully!!! --------- (DAA score: {})", pov_daa_score);
}
}
Self::check_sequence_lock(tx, pov_daa_score)?;

Expand Down