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

Remove environment-specific timelock disabling code #2587

Merged
merged 2 commits into from
Jan 29, 2025
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
4 changes: 2 additions & 2 deletions config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ impl Defaults for Testnet {
}

fn consensus_constants_checkpoint_zero_timestamp(&self) -> i64 {
// Thursday, 23-Jan-2025, 13:00 UTC
1_737_637_200
// Thursday, 29-Jan-2025, 20:00 UTC
1_738_180_800
}

fn consensus_constants_genesis_hash(&self) -> Hash {
Expand Down
15 changes: 6 additions & 9 deletions data_structures/src/transaction_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ use serde::{Deserialize, Serialize};

use crate::{
chain::{
DataRequestOutput, Environment, Epoch, EpochConstants, Input, OutputPointer, PublicKeyHash,
StakeOutput, ValueTransferOutput,
DataRequestOutput, Epoch, EpochConstants, Input, OutputPointer, PublicKeyHash, StakeOutput,
ValueTransferOutput,
},
error::TransactionError,
fee::{AbsoluteFee, Fee},
get_environment,
transaction::{
DRTransactionBody, StakeTransactionBody, UnstakeTransactionBody, VTTransactionBody,
INPUT_SIZE,
Expand Down Expand Up @@ -681,13 +680,11 @@ pub fn transaction_inputs_sum(
let (epoch_timestamp, _) = epoch_constants.epoch_timestamp(epoch)?;
let vt_time_lock = i64::try_from(vt_output.time_lock)?;
if vt_time_lock > epoch_timestamp {
if get_environment() == Environment::Mainnet || epoch > 22_000 {
return Err(TransactionError::TimeLock {
expected: vt_time_lock,
current: epoch_timestamp,
}
.into());
return Err(TransactionError::TimeLock {
expected: vt_time_lock,
current: epoch_timestamp,
}
.into());
} else {
if !seen_output_pointers.insert(input.output_pointer()) {
// If the set already contained this output pointer
Expand Down
13 changes: 5 additions & 8 deletions validations/src/validations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ use witnet_data_structures::{
chain::{
tapi::ActiveWips, Block, BlockMerkleRoots, CheckpointBeacon, CheckpointVRF,
ConsensusConstants, ConsensusConstantsWit2, DataRequestOutput, DataRequestStage,
DataRequestState, Environment, Epoch, EpochConstants, Hash, Hashable, Input,
KeyedSignature, OutputPointer, PublicKeyHash, RADRequest, RADTally, RADType, Reputation,
ReputationEngine, SignaturesToVerify, StakeOutput, ValueTransferOutput,
DataRequestState, Epoch, EpochConstants, Hash, Hashable, Input, KeyedSignature,
OutputPointer, PublicKeyHash, RADRequest, RADTally, RADType, Reputation, ReputationEngine,
SignaturesToVerify, StakeOutput, ValueTransferOutput,
},
data_request::{
calculate_reward_collateral_ratio, calculate_tally_change, calculate_witness_reward,
calculate_witness_reward_before_second_hard_fork, create_tally,
data_request_has_too_many_witnesses, DataRequestPool,
},
error::{BlockError, DataRequestError, TransactionError},
get_environment, get_protocol_version, get_protocol_version_activation_epoch,
get_protocol_version, get_protocol_version_activation_epoch,
proto::versioning::{ProtocolVersion, VersionedHashable},
radon_report::{RadonReport, ReportContext},
staking::prelude::{Power, QueryStakesKey, StakeKey, StakesTracker},
Expand Down Expand Up @@ -1497,11 +1497,8 @@ pub fn validate_unstake_transaction<'a>(
}

// TODO: modify this to enable delegated staking with multiple withdrawer addresses on a single validator
// TODO: remove this check for mainnet release
let nonce = stake_entry.first().map(|stake| stake.value.nonce).unwrap();
if (get_environment() == Environment::Mainnet || epoch > 22_000)
&& ut_tx.body.nonce != nonce
{
if ut_tx.body.nonce != nonce {
return Err(TransactionError::UnstakeInvalidNonce {
used: ut_tx.body.nonce,
current: nonce,
Expand Down