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

(chore): fix-all-the-things #2497

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e62c036
fix(validations): add Serialize trait where required
drcpu-github Oct 30, 2024
cfa0eac
fix(mining): use same default hash when building and validating a block
drcpu-github Nov 2, 2024
93955d9
fix(mining): fix data request reward system for wit/2
drcpu-github Sep 3, 2024
2e2ff7c
fix(stakes): self argument for query_stakes does not need to be mutable
drcpu-github Sep 7, 2024
6107371
feat(validations): check a validator has enough stake to create this …
drcpu-github Oct 20, 2024
56684fb
chore(tapi): implement TAPI activation for WIP0028 used to activate p…
drcpu-github Oct 18, 2024
3ea10db
feat(wit2): set wit/2 start timestamp to i64::MAX when its start epoc…
drcpu-github Oct 26, 2024
8c446b0
feat(mining): Activate wit/2 two weeks (26880 epochs) after at least …
drcpu-github Oct 19, 2024
cc04563
chore(chain): rename epoch_constants.*_v2 variables to epoch_constant…
drcpu-github Oct 28, 2024
8e29305
feat(validations): validate stake and unstake transactions are not in…
drcpu-github Oct 19, 2024
d71f5c3
feat(validations): properly validate unstake transaction
drcpu-github Oct 20, 2024
835a82a
feat(staking): implement fee for unstake transaction
drcpu-github Oct 20, 2024
8b1f6e7
feat(mining): include unstaking transactions when building a block
drcpu-github Oct 20, 2024
ca7d66e
fix(mining): correct value transfer weight check
drcpu-github Oct 20, 2024
e7d31c0
feat(mining): clear stake and unstake transactions from pool to preve…
drcpu-github Oct 21, 2024
6a7ffcf
feat(validations): validate stake and unstake transaction validity wh…
drcpu-github Oct 21, 2024
8334c01
feat(mining): remove unstaking transactions from the pool once they a…
drcpu-github Oct 22, 2024
81bcb1d
chore(mining): rename utxo diff parameter to prevent confusion
drcpu-github Oct 22, 2024
d8c39c2
feat(validations): create unstake UTXO
drcpu-github Oct 22, 2024
21ef758
feat(validations): implement and validate unstaking delay
drcpu-github Oct 22, 2024
2f8e353
feat(validations): implement relative time locks
drcpu-github Oct 22, 2024
02f93fe
chore(fmt): apply fomatting
drcpu-github Oct 20, 2024
ac95874
fix(validations): improve stake transaction validation tests
drcpu-github Oct 23, 2024
a45ef33
fix(validations): make time lock tests pass again
drcpu-github Oct 23, 2024
5b4e94e
fix(transaction): reset unstake memohash to detect modified unstake t…
drcpu-github Oct 23, 2024
0972cd7
feat(stakes): add nonce field to Stake
drcpu-github Oct 24, 2024
470cabe
feat(transaction): add nonce to unstake transaction to prevent rebroa…
drcpu-github Oct 24, 2024
31f2b11
feat(validations): add unstake tests
drcpu-github Oct 23, 2024
3323555
fix(stakes): add validator and withdrawer to StakeEntry upon creation
drcpu-github Oct 25, 2024
95a1851
feat(validations): set a maximum stake amount per validator and stake…
drcpu-github Oct 27, 2024
4ab6bcf
feat(validations): improve error stake validator/withdrawer error
drcpu-github Oct 28, 2024
da5ba85
fix(chain_manager): reward miner instead of committer / revealer
drcpu-github Oct 31, 2024
17aa17f
feat(data_structures): implement consensus constants for wit/2
drcpu-github Jul 15, 2024
387dcf9
chore(clippy): allow complex types for StakesTracker
drcpu-github Nov 1, 2024
2f44ae7
chore(clippy): make clippy happy
drcpu-github Nov 1, 2024
52353d9
fix(data_structures): fix versioned hashes for data request and tally…
drcpu-github Nov 7, 2024
71d53dd
fix(validations): fix default hashes for staking and unstaking transa…
drcpu-github Nov 7, 2024
1d72fd4
feat(chain): nullify merkle roots for stake and unstake transactions …
drcpu-github Nov 8, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions bridges/centralized-ethereum/src/actors/wit_poller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ async fn get_dr_timestamp(
let epoch_constants = EpochConstants {
checkpoint_zero_timestamp: get_protocol_version_activation_epoch(V1_7).into(),
checkpoints_period: get_protocol_version_period(V1_7),
checkpoint_zero_timestamp_v2: get_protocol_version_activation_epoch(V2_0).into(),
checkpoints_period_v2: get_protocol_version_period(V2_0),
checkpoint_zero_timestamp_wit2: get_protocol_version_activation_epoch(V2_0).into(),
checkpoints_period_wit2: get_protocol_version_period(V2_0),
};
let timestamp = convert_block_epoch_to_timestamp(
epoch_constants,
Expand Down
14 changes: 2 additions & 12 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,18 +415,8 @@ pub struct Mempool {
#[derive(Deserialize, Serialize, Default, Debug, Clone, PartialEq, Eq)]
#[serde(default)]
pub struct Tapi {
/// Oppose WIP0022
pub oppose_wip0022: bool,
/// Oppose WIP0023
pub oppose_wip0023: bool,
/// Oppose WIP0024
pub oppose_wip0024: bool,
/// Oppose WIP0025
pub oppose_wip0025: bool,
/// Oppose WIP0026
pub oppose_wip0026: bool,
/// Oppose WIP0027
pub oppose_wip0027: bool,
/// Oppose WIP0028
pub oppose_wip0028: bool,
}

/// Configuration related to protocol versions.
Expand Down
7 changes: 0 additions & 7 deletions config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,6 @@ pub const PSEUDO_CONSENSUS_CONSTANTS_WIP0022_REWARD_COLLATERAL_RATIO: u64 = 125;
// TODO: modify the value directly in ConsensusConstants
pub const PSEUDO_CONSENSUS_CONSTANTS_WIP0027_COLLATERAL_AGE: u32 = 13440;

/// Maximum weight units that a block can devote to `StakeTransaction`s.
pub const PSEUDO_CONSENSUS_CONSTANTS_POS_MAX_STAKE_BLOCK_WEIGHT: u32 = 10_000_000;

/// Minimum amount of nanoWits that a `StakeTransaction` can add, and minimum amount that can be
/// left in stake by an `UnstakeTransaction`.
pub const PSEUDO_CONSENSUS_CONSTANTS_POS_MIN_STAKE_NANOWITS: u64 = 10_000_000_000_000;

/// Struct that will implement all the development defaults
pub struct Development;

Expand Down
6 changes: 3 additions & 3 deletions config/src/loaders/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ enabled = false
let config_oppose_0022 = super::from_str(
r"
[tapi]
oppose_wip0022 = true
oppose_wip0028 = true
",
)
.unwrap();

assert_eq!(empty_config.tapi, Tapi::default());
assert!(!empty_config.tapi.oppose_wip0022);
assert!(config_oppose_0022.tapi.oppose_wip0022);
assert!(!empty_config.tapi.oppose_wip0028);
assert!(config_oppose_0022.tapi.oppose_wip0028);
}
}
14 changes: 11 additions & 3 deletions data_structures/benches/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use bencher::Bencher;
use rand::Rng;
use witnet_data_structures::staking::prelude::*;

const MINIMUM_VALIDATOR_STAKE: u64 = 1_000_000_000;

fn populate(b: &mut Bencher) {
let mut stakes = StakesTester::default();
let mut i = 1;
Expand All @@ -12,7 +14,9 @@ fn populate(b: &mut Bencher) {
let address = format!("{i}");
let coins = i;
let epoch = i;
stakes.add_stake(address.as_str(), coins, epoch).unwrap();
stakes
.add_stake(address.as_str(), coins, epoch, MINIMUM_VALIDATOR_STAKE)
.unwrap();

i += 1;
});
Expand All @@ -32,7 +36,9 @@ fn rank(b: &mut Bencher) {
let epoch = i;
let address = format!("{}", rng.gen::<u64>());

stakes.add_stake(address.as_str(), coins, epoch).unwrap();
stakes
.add_stake(address.as_str(), coins, epoch, MINIMUM_VALIDATOR_STAKE)
.unwrap();

i += 1;

Expand Down Expand Up @@ -62,7 +68,9 @@ fn query_power(b: &mut Bencher) {
let epoch = i;
let address = format!("{i}");

stakes.add_stake(address.as_str(), coins, epoch).unwrap();
stakes
.add_stake(address.as_str(), coins, epoch, MINIMUM_VALIDATOR_STAKE)
.unwrap();

i += 1;

Expand Down
Loading