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

Refactor out VotingPower #707

Merged
merged 86 commits into from
Nov 30, 2022
Merged
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
22d845b
replace floating point arithm from token module with rust_decimal
brentstone Aug 30, 2022
97523f4
[ci] wasm checksums update
github-actions[bot] Oct 26, 2022
d08da6e
changelog: #436
tzemanovic Oct 26, 2022
29eb68f
remove staking reward address from all code
brentstone Oct 25, 2022
020f6bf
remove staking reward address from genesis toml files
brentstone Oct 26, 2022
3eb21f7
client: remove staking rewards address from init-validator result
tzemanovic Oct 26, 2022
b54b5c0
wallet: remove validator rewards key
tzemanovic Oct 26, 2022
9852d28
remove staking rewards address from cli strings and docs strings
tzemanovic Oct 26, 2022
70fa58b
changelog: #687
tzemanovic Oct 26, 2022
da7bffc
introduce validator commission rate and changes
brentstone Sep 21, 2022
3fbc30e
require commission rate input data for new validators
brentstone Sep 23, 2022
4b88573
epoched commission rate and tx for validator to change their rate
brentstone Sep 27, 2022
4ff76d8
commission rate: query + refactor validator change tx
brentstone Sep 28, 2022
77dfff4
add missing commission rate-related instances
brentstone Oct 26, 2022
5b6565e
include and update `rust_decimal`
brentstone Oct 26, 2022
288bf33
bug fix from splitting this PR off of #388
brentstone Oct 26, 2022
3704ef6
cleaning: incl fmt + clippy
brentstone Oct 26, 2022
0e097d8
init validator: add commission rate required args for tests
brentstone Oct 26, 2022
80283b2
fix commission rate validation on validator initialization
brentstone Oct 28, 2022
9d8a0d0
improve docs
brentstone Oct 28, 2022
629e1c5
[ci] wasm checksums update
github-actions[bot] Oct 31, 2022
258b910
wasm tx test for changing validator commission rate
brentstone Nov 4, 2022
6610a65
fix error convention
brentstone Nov 4, 2022
563d218
commission change wasm tx test: fix and update validation
brentstone Nov 4, 2022
7d652e3
bug fix: consensus key validation error
brentstone Nov 4, 2022
9b4f2be
fix get of epoched commission rate before pipeline
brentstone Nov 4, 2022
6778fd0
add max change info to query of validator commission rate
brentstone Nov 4, 2022
b900354
fix pos state machine test
brentstone Nov 7, 2022
7b6de40
[ci] wasm checksums update
github-actions[bot] Nov 7, 2022
302a08c
changes in response to review comments
brentstone Nov 8, 2022
dcfd6af
validator VP that checks source and signature for a commission rate c…
brentstone Nov 9, 2022
9068938
add max commission rate info to validation and pos state machine test
brentstone Nov 9, 2022
9b175c4
fix: critical flaw in pos VP that was prematurely returning true
brentstone Nov 9, 2022
fea59bd
add vp validator to wasms
brentstone Nov 9, 2022
757ba1d
async tx to change validator commission rate
brentstone Nov 9, 2022
42b0bfa
addressing 2nd round of review comments
brentstone Nov 10, 2022
476877e
[ci] wasm checksums update
github-actions[bot] Nov 10, 2022
6b92f2c
changelog: add #695
tzemanovic Nov 10, 2022
862d840
clarify+rename 'epoch_storage_key' as 'epoch_duration_storage_key'
brentstone Aug 29, 2022
d953ee6
add max_staking_reward_rate to PosParams
brentstone Aug 29, 2022
a5897bd
add new parameters needed for rewards PD controller to the Parameters…
brentstone Sep 8, 2022
9ad5b56
rename `votes_per_token` to `tm_votes_per_token` since this will only…
brentstone Sep 9, 2022
32588d5
update max inflation rate in params (formerly max_staking_rewards_rate)
brentstone Sep 9, 2022
9bb70f4
add target_staked_ratio to PoS params
brentstone Sep 9, 2022
4b1eb5f
specify read or write intentions for parameters storage keys
brentstone Sep 12, 2022
e3994dc
rename reward_rate -> inflation_rate for pos
brentstone Sep 18, 2022
8ba80cb
documentation updates + unused imports removal
brentstone Sep 20, 2022
f16ec20
remove BasisPoints and change relevant parameters to Decimal type
brentstone Sep 8, 2022
9683b44
add fns to multiply Decimal and integer type, return truncated integer
brentstone Sep 8, 2022
f7ae3ce
more decimal_mult function uses
brentstone Sep 8, 2022
4f89a63
fix correct inner type of ValidationError::TotalVotingPowerTooLarge
brentstone Sep 12, 2022
9d904df
clean comments and toml files of basis points
brentstone Oct 26, 2022
1ba6ee2
update rust_decimal version + fmt
brentstone Oct 26, 2022
265b071
fix initial staked ratio parameter at genesis
brentstone Oct 21, 2022
0d0f394
fix: write all fields in Parameters storage in `init_storage`
brentstone Sep 30, 2022
2fd4ed5
storage change: last inflation rate -> last inflation token amount
brentstone Oct 18, 2022
b5ae9bb
fix arb_amount to max out at max tm voting power (fix wasm test bug)
brentstone Oct 27, 2022
6ed8bce
update toml files with latest parameters and values
brentstone Sep 21, 2022
0a8b491
Update rewards parameters and distribution
brentstone Sep 20, 2022
a079234
updates to accommodate `tm_votes_per_token` relative to namnam
brentstone Oct 28, 2022
9e7088f
fmt and includes
brentstone Oct 28, 2022
6e51bc4
[ci] wasm checksums update
github-actions[bot] Nov 8, 2022
c34c33b
update comments
brentstone Nov 9, 2022
9ca0546
remove `staked_ratio` and `pos_inflation_amount` from `ParametersConfig`
brentstone Nov 9, 2022
52e6f09
remove `min_duration` from `ParametersConfig`
brentstone Nov 10, 2022
c6cc0f5
changelog: add #708
brentstone Nov 11, 2022
4e76c28
[ci] wasm checksums update
github-actions[bot] Nov 11, 2022
14639ad
rename slash rate params with `min`, update default `PosParam` values
brentstone Nov 18, 2022
e3fbf35
refactor out VotingPower(Delta) in pos crate, distinguish total and v…
brentstone Sep 14, 2022
528b24a
continue refactoring away VotingPower
brentstone Sep 16, 2022
5da2a80
refactor VotingPower out of PoS VP
brentstone Sep 16, 2022
251f9d4
Update wasm tx_(un)bond with VotingPower removal
brentstone Sep 20, 2022
7d31f7d
change `validator_total_deltas` -> `validator_deltas`
brentstone Sep 20, 2022
08b1bdf
keep voting_power as a possible client query
brentstone Sep 20, 2022
4e161ac
more voting_power removal and accurate variable renaming
brentstone Sep 20, 2022
530e315
fmt + cleanup after cherrypicking commits from #388
brentstone Oct 30, 2022
cdd8b71
clippy: suppress unused validation vars (may need later)
brentstone Oct 30, 2022
d65654b
fix `TendermintValidator::power`
brentstone Oct 30, 2022
3e34cae
fix client voting power query
brentstone Oct 30, 2022
116a77a
clean up naming of "validator total deltas" -> "validator deltas"
brentstone Nov 7, 2022
372667a
fix pos state machine test
brentstone Nov 7, 2022
b22f2bc
client: replace voting power with bonded stake in queries, etc
brentstone Nov 9, 2022
615408b
convert to tm voting power in `update_epoch`
brentstone Nov 9, 2022
6c0b900
remove comments to self
brentstone Nov 10, 2022
13ad178
changelog: add #707
brentstone Nov 11, 2022
d30a3ba
[ci] wasm checksums update
github-actions[bot] Nov 11, 2022
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
2 changes: 1 addition & 1 deletion apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
@@ -470,7 +470,7 @@ pub async fn query_protocol_parameters(
println!("Governance Parameters\n {:4}", gov_parameters);

println!("Protocol parameters");
let key = param_storage::get_epoch_storage_key();
let key = param_storage::get_epoch_duration_storage_key();
let epoch_duration = query_storage_value::<EpochDuration>(&client, &key)
.await
.expect("Parameter should be definied.");
12 changes: 6 additions & 6 deletions shared/src/ledger/parameters/mod.rs
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ impl Parameters {
H: ledger_storage::StorageHasher,
{
// write epoch parameters
let epoch_key = storage::get_epoch_storage_key();
let epoch_key = storage::get_epoch_duration_storage_key();
let epoch_value = encode(&self.epoch_duration);
storage.write(&epoch_key, epoch_value).expect(
"Epoch parameters must be initialized in the genesis block",
@@ -242,7 +242,7 @@ where
DB: ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>,
H: ledger_storage::StorageHasher,
{
let key = storage::get_epoch_storage_key();
let key = storage::get_epoch_duration_storage_key();
update(storage, value, key)
}

@@ -268,15 +268,15 @@ where
}

/// Read the the epoch duration parameter from store
pub fn read_epoch_parameter<DB, H>(
pub fn read_epoch_duration_parameter<DB, H>(
storage: &Storage<DB, H>,
) -> std::result::Result<(EpochDuration, u64), ReadError>
where
DB: ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>,
H: ledger_storage::StorageHasher,
{
// read epoch
let epoch_key = storage::get_epoch_storage_key();
let epoch_key = storage::get_epoch_duration_storage_key();
let (value, gas) =
storage.read(&epoch_key).map_err(ReadError::StorageError)?;
let epoch_duration: EpochDuration =
@@ -295,8 +295,8 @@ where
DB: ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>,
H: ledger_storage::StorageHasher,
{
// read epoch
let (epoch_duration, gas_epoch) = read_epoch_parameter(storage)
// read epoch duration
let (epoch_duration, gas_epoch) = read_epoch_duration_parameter(storage)
.expect("Couldn't read epoch duration parameters");

// read vp whitelist
6 changes: 3 additions & 3 deletions shared/src/ledger/parameters/storage.rs
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@ pub fn is_parameter_key(key: &Key) -> bool {

/// Returns if the key is a protocol parameter key.
pub fn is_protocol_parameter_key(key: &Key) -> bool {
is_epoch_storage_key(key)
is_epoch_duration_storage_key(key)
|| is_max_expected_time_per_block_key(key)
|| is_tx_whitelist_key(key)
|| is_vp_whitelist_key(key)
}

/// Returns if the key is an epoch storage key.
pub fn is_epoch_storage_key(key: &Key) -> bool {
pub fn is_epoch_duration_storage_key(key: &Key) -> bool {
matches!(&key.segments[..], [
DbKeySeg::AddressSeg(addr),
DbKeySeg::StringSeg(epoch_duration),
@@ -53,7 +53,7 @@ pub fn is_vp_whitelist_key(key: &Key) -> bool {
}

/// Storage key used for epoch parameter.
pub fn get_epoch_storage_key() -> Key {
pub fn get_epoch_duration_storage_key() -> Key {
Key {
segments: vec![
DbKeySeg::AddressSeg(ADDRESS),