From dee896c3dcb5484406a41bbf2a311c2130c6fe06 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Mon, 21 Nov 2022 16:52:43 +0100 Subject: [PATCH] Update DPoS terminologies to PoS (#7803) ### What was the problem? This PR resolves #7672 ### How was it solved? - Update DPoS terminologies to PoS - vote => stake - delegate => validator - DPoS => PoS - voter => staker ### How was it tested? - All build/test should pass - There should be no dpos related terminologies --- .../bootstrapping/commands/endpoint/invoke.ts | 2 +- .../commands/generator/disable.ts | 2 +- .../commands/generator/enable.ts | 6 +- .../generators/init_generator.ts | 4 +- commander/src/utils/genesis_creation.ts | 14 +- .../commands/endpoint/invoke.spec.ts | 8 +- .../commands/system/info.spec.ts | 6 +- .../commands/transaction/create.spec.ts | 44 +- .../commands/transaction/prompt.spec.ts | 22 +- commander/test/helpers/account.ts | 20 +- commander/test/helpers/mocks.ts | 14 +- commander/test/helpers/transactions.ts | 12 +- .../lisk-api-client/test/utils/transaction.ts | 4 +- .../lisk-chain/benchmark/calculate_diff.js | 2 +- .../benchmark/encode_decode_account.js | 34 +- .../__snapshots__/add_schema.spec.ts.snap | 148 +- elements/lisk-codec/test/decode.spec.ts | 10 +- elements/lisk-codec/test/encode.spec.ts | 10 +- elements/lisk-codec/test/utils.ts | 12 +- .../fixtures/transactions.json | 400 ++-- .../test/__snapshots__/fee.spec.ts.snap | 4 +- elements/lisk-transactions/test/fee.spec.ts | 14 +- .../.eslintignore | 0 .../.eslintrc.js | 0 .../.gitignore | 0 .../.lintstagedrc.json | 0 .../.liskrc.json | 0 .../.prettierignore | 0 .../.prettierrc.json | 0 .../README.md | 0 .../{dpos-mainchain => pos-mainchain}/bin/run | 0 .../bin/run.cmd | 0 .../config/default/config.json | 2 +- .../config/default/dev-validators.json | 0 .../config/default/genesis_assets.json | 32 +- .../config/default/genesis_block.blob | Bin 30436 -> 30435 bytes .../config/default/passphrase.json | 0 .../jest.config.js | 0 .../package.json | 24 +- .../src/app/app.ts | 0 .../src/app/index.ts | 0 .../src/app/modules.ts | 0 .../src/app/modules/.gitkeep | 0 .../src/app/plugins.ts | 0 .../src/app/plugins/.gitkeep | 0 .../src/commands/block/get.ts | 0 .../src/commands/blockchain/export.ts | 0 .../src/commands/blockchain/hash.ts | 0 .../src/commands/blockchain/import.ts | 0 .../src/commands/blockchain/reset.ts | 0 .../src/commands/config/create.ts | 0 .../src/commands/config/show.ts | 0 .../src/commands/console.ts | 0 .../src/commands/endpoint/invoke.ts | 0 .../src/commands/generator/disable.ts | 0 .../src/commands/generator/enable.ts | 0 .../src/commands/generator/export.ts | 0 .../src/commands/generator/import.ts | 0 .../src/commands/generator/status.ts | 0 .../src/commands/genesis-block/create.ts | 0 .../src/commands/hash-onion.ts | 0 .../src/commands/keys/create.ts | 0 .../src/commands/keys/encrypt.ts | 0 .../src/commands/keys/export.ts | 0 .../src/commands/keys/import.ts | 0 .../src/commands/passphrase/decrypt.ts | 0 .../src/commands/passphrase/encrypt.ts | 0 .../src/commands/start.ts | 0 .../src/commands/system/metadata.ts | 0 .../src/commands/system/node-info.ts | 0 .../src/commands/transaction/create.ts | 0 .../src/commands/transaction/get.ts | 0 .../src/commands/transaction/send.ts | 0 .../src/commands/transaction/sign.ts | 0 .../test/.eslintrc.js | 0 .../test/_setup.js | 0 .../test/integration/.gitkeep | 0 .../test/network/.gitkeep | 0 .../test/tsconfig.json | 0 .../test/types.ts | 0 .../test/unit/modules/.gitkeep | 0 .../test/utils/config.ts | 0 .../tsconfig.json | 0 .../lisk-framework-forger-plugin/README.md | 2 +- .../lisk-framework-forger-plugin/package.json | 2 +- .../lisk-framework-forger-plugin/src/db.ts | 4 +- .../src/endpoint.ts | 44 +- .../src/forger_plugin.ts | 106 +- .../src/schemas.ts | 16 +- .../lisk-framework-forger-plugin/src/types.ts | 12 +- .../__snapshots__/voters.spec.ts.snap | 620 +++--- .../__snapshots__/event_track.spec.ts.snap | 26 +- .../forger_info_sync.spec.ts.snap | 2 +- .../forger_info/event_track.spec.ts | 70 +- .../test/functional/voters.spec.ts | 40 +- .../test/utils/transactions.ts | 8 +- .../README.md | 2 +- .../package.json | 2 +- .../src/report_misbehavior_plugin.ts | 12 +- .../test/integration/cleanup_job.spec.ts | 6 +- .../send_pom_transaction.spec.ts.snap | 2 +- .../test/unit/send_pom_transaction.spec.ts | 8 +- framework/.eslintignore | 10 +- framework/src/application.ts | 14 +- framework/src/engine/bft/bft_votes.ts | 2 +- framework/src/engine/bft/method.ts | 2 +- framework/src/engine/bft/utils.ts | 2 +- .../consensus/fork_choice/fork_choice_rule.ts | 4 +- .../engine/consensus/synchronizer/utils.ts | 6 +- framework/src/engine/generator/endpoint.ts | 4 +- framework/src/engine/generator/generator.ts | 2 +- framework/src/index.ts | 12 +- .../modules/dpos_v2/commands/vote_delegate.ts | 348 --- .../src/modules/dynamic_rewards/constants.ts | 2 +- .../src/modules/dynamic_rewards/module.ts | 33 +- .../src/modules/dynamic_rewards/schemas.ts | 4 +- .../src/modules/dynamic_rewards/types.ts | 6 +- .../commands/change_commission.ts | 32 +- .../commands/claim_rewards.ts | 24 +- .../commands/register_validator.ts} | 60 +- .../commands/report_misbehavior.ts} | 80 +- framework/src/modules/pos/commands/stake.ts | 350 +++ .../{dpos_v2 => pos}/commands/unlock.ts | 34 +- .../commands/update_generator_key.ts | 8 +- .../src/modules/{dpos_v2 => pos}/constants.ts | 42 +- .../src/modules/{dpos_v2 => pos}/endpoint.ts | 184 +- .../events/commission_change.ts | 8 +- .../events/rewards_assigned.ts | 12 +- .../events/validator_banned.ts} | 12 +- .../events/validator_punished.ts} | 12 +- .../events/validator_registered.ts} | 12 +- .../events/validator_staked.ts} | 28 +- .../src/modules/{dpos_v2 => pos}/index.ts | 10 +- .../{dpos_v2 => pos}/internal_method.ts | 34 +- .../src/modules/{dpos_v2 => pos}/method.ts | 62 +- .../src/modules/{dpos_v2 => pos}/module.ts | 485 ++--- .../src/modules/{dpos_v2 => pos}/rounds.ts | 0 .../src/modules/{dpos_v2 => pos}/schemas.ts | 166 +- .../stores/eligible_validators.ts} | 34 +- .../{dpos_v2 => pos}/stores/genesis.ts | 8 +- .../modules/{dpos_v2 => pos}/stores/name.ts | 8 +- .../stores/previous_timestamp.ts | 2 +- .../{dpos_v2 => pos}/stores/snapshot.ts | 8 +- .../stores/voter.ts => pos/stores/staker.ts} | 36 +- .../delegate.ts => pos/stores/validator.ts} | 28 +- .../src/modules/{dpos_v2 => pos}/types.ts | 92 +- .../src/modules/{dpos_v2 => pos}/utils.ts | 140 +- framework/src/testing/block_processing_env.ts | 12 +- framework/src/testing/fixtures/config.ts | 2 +- .../src/testing/fixtures/genesis-asset.ts | 8 +- framework/src/types.ts | 2 +- ...d.json => validators_for_first_round.json} | 0 ...delegates.json => genesis_validators.json} | 2 +- ..._forger_selection => pos_forger_selection} | 0 ..._generation => pos_random_seed_generation} | 0 ...gate_shuffling => pos_validator_shuffling} | 0 .../__snapshots__/application.spec.ts.snap | 90 +- .../test/functional/actions/delegates.spec.ts | 22 +- .../rpc-api/ipc/ipc_client_in_memory.spec.ts | 12 +- .../functional/rpc-api/ws/ws_client.spec.ts | 10 +- .../__snapshots__/genesis_block.spec.ts.snap | 2 +- .../integration/node/genesis_block.spec.ts | 4 +- .../block_process/process_block.spec.ts | 34 +- .../node/processor/delete_block.spec.ts | 14 +- .../report_misbehavior_transaction.spec.ts | 8 +- .../node/processor/transaction_order.spec.ts | 18 +- .../test/unit/controller/controller.spec.ts | 2 +- .../unit/engine/bft/bft_processing.spec.ts | 30 +- .../test/unit/engine/bft/bft_votes.spec.ts | 2 +- framework/test/unit/engine/bft/module.spec.ts | 2 +- .../block_synchronization_mechanism.spec.ts | 4 +- .../fast_chain_switching_mechanism.spec.ts | 10 +- .../unit/engine/generator/generator.spec.ts | 2 +- .../commands/__snapshots__/pom.spec.ts.snap | 43 - .../dpos_v2/commands/vote_delegate.spec.ts | 1871 ---------------- .../unit/modules/dpos_v2/endpoint.spec.ts | 675 ------ .../modules/dynamic_rewards/module.spec.ts | 30 +- .../report_misbehavior.spec.ts.snap | 22 + .../__snapshots__/stake.spec.ts.snap} | 12 +- .../commands/change_commission.spec.ts | 72 +- .../commands/claim_rewards.spec.ts | 88 +- .../commands/report_misbehavior.spec.ts} | 176 +- .../unit/modules/pos/commands/stake.spec.ts | 1914 +++++++++++++++++ .../{dpos_v2 => pos}/commands/unlock.spec.ts | 376 ++-- .../commands/validator_registration.spec.ts} | 229 +- .../test/unit/modules/pos/endpoint.spec.ts | 675 ++++++ .../genesis_block_test_data.ts | 360 ++-- .../{dpos_v2 => pos}/internal_method.spec.ts | 188 +- .../modules/{dpos_v2 => pos}/method.spec.ts | 196 +- .../modules/{dpos_v2 => pos}/module.spec.ts | 721 +++---- .../stores/eligible_validators_store.spec.ts} | 104 +- .../update_generator_key.spec.ts | 30 +- .../modules/{dpos_v2 => pos}/utils.spec.ts | 60 +- .../test/unit/modules/random/endpoint.spec.ts | 80 +- .../test/unit/modules/random/method.spec.ts | 74 +- ..._generation => pos_random_seed_generation} | 0 .../unit/modules/random/random_module.spec.ts | 84 +- .../token/cc_commands/cc_transfer.spec.ts | 2 +- .../test/unit/modules/token/cc_method.spec.ts | 10 +- .../test/unit/modules/token/endpoint.spec.ts | 2 +- .../token/init_genesis_state_fixture.ts | 22 +- .../test/unit/modules/token/method.spec.ts | 18 +- .../unit/modules/token/stores/user.spec.ts | 10 +- .../unit/modules/validators/method.spec.ts | 2 +- .../unit/state_machine/event_queue.spec.ts | 4 +- .../test/utils/configs/config_constants.ts | 6 +- framework/test/utils/mocks/transaction.ts | 32 +- framework/tsconfig.json | 2 +- protocol-specs/config/devnet.json | 6 +- .../config/devnet_genesis_delegates.json | 404 ++-- protocol-specs/config/genesis_block_v2.json | 2 +- ...json => 11_validators_partial_switch.json} | 152 +- ...ts.json => 4_validators_missed_slots.json} | 84 +- ...s_simple.json => 4_validators_simple.json} | 52 +- ... => 5_validators_switched_completely.json} | 124 +- ....json => 7_validators_partial_switch.json} | 144 +- .../bft_invalid_block_headers.json | 312 +-- ...=> uniformly_shuffled_validator_list.json} | 12 +- ...lection.json => pos_forger_selection.json} | 110 +- ...on => pos_forger_selection_0_standby.json} | 216 +- ...s_forger_selection_exactly_1_standby.json} | 216 +- ...s_forger_selection_exactly_2_standby.json} | 216 +- ...> pos_forger_selection_less_than_103.json} | 110 +- ...forger_selection_more_than_2_standby.json} | 310 +-- ...s_random_seed_generation_first_round.json} | 4 +- ..._seed_generation_invalid_seed_reveal.json} | 8 +- ...m_seed_generation_not_forged_earlier.json} | 8 +- ...eneration_not_passed_middle_of_round.json} | 4 +- ..._random_seed_generation_other_rounds.json} | 4 +- .../lisk_codec/account_decodings.json | 60 +- .../lisk_codec/account_encodings.json | 60 +- .../lisk_codec/arrays_decodings.json | 10 +- .../lisk_codec/arrays_encodings.json | 10 +- .../lisk_codec/block_asset_decodings.json | 4 +- .../lisk_codec/block_asset_encodings.json | 4 +- .../lisk_codec/block_decodings.json | 20 +- .../lisk_codec/block_encodings.json | 20 +- .../lisk_codec/block_header_decodings.json | 4 +- .../lisk_codec/block_header_encodings.json | 4 +- .../lisk_codec/boolean_decodings.json | 4 +- .../lisk_codec/boolean_encodings.json | 4 +- .../lisk_codec/bytes_decodings.json | 4 +- .../lisk_codec/bytes_encodings.json | 4 +- .../lisk_codec/cart_sample_decodings.json | 2 +- .../lisk_codec/cart_sample_encodings.json | 2 +- .../lisk_codec/genesis_block_decodings.json | 48 +- .../lisk_codec/genesis_block_encodings.json | 48 +- .../lisk_codec/nested_array_decodings.json | 10 +- .../lisk_codec/nested_array_encoding.json | 8 +- .../lisk_codec/nested_array_encodings.json | 10 +- .../lisk_codec/number_decodings.json | 8 +- .../lisk_codec/number_encodings.json | 8 +- .../lisk_codec/objects_decodings.json | 12 +- .../lisk_codec/objects_encodings.json | 12 +- .../peer_info_sample_decodings.json | 8 +- .../peer_info_sample_encodings.json | 12 +- .../lisk_codec/string_decodings.json | 6 +- .../lisk_codec/string_encodings.json | 6 +- .../lisk_codec/transaction_decodings.json | 24 +- .../lisk_codec/transaction_encodings.json | 24 +- .../proof_of_misbehavior_transaction.json | 6 +- .../delegate_transaction_validate.json | 8 +- .../unlock_transaction.json | 2 +- .../vote_transaction_10_upvotes.json | 10 +- .../11_delegates_partial_switch.csv | 2 +- .../4_delegates_missed_slots.csv | 2 +- .../bft_processing/4_delegates_simple.csv | 2 +- .../5_delegates_switched_completely.csv | 2 +- .../7_delegates_partial_switch.csv | 2 +- .../generators/bft_processing/index.js | 144 +- .../dpos_delegate_shuffling/README.md | 17 - .../dpos_delegate_shuffling/index.js | 61 - .../dpos_forger_selection/README.md | 19 - .../lisk_codec/proto_files/account.proto | 14 +- .../lisk_codec/proto_files/block.proto | 22 +- .../lisk_codec/proto_files/object.proto | 2 +- .../lisk_codec/types_generators/account.js | 38 +- .../types_generators/genesis_block_asset.js | 46 +- .../types_generators/nested_array.js | 4 +- .../lisk_codec/types_generators/objects.js | 6 +- .../types_generators/transaction.js | 18 +- .../generators/pos_forger_selection/README.md | 19 + .../index.js | 98 +- .../sample_generator.js | 20 +- .../validator_weight_0_eligible_standby.json} | 206 +- ...or_weight_exactly_1_eligible_standby.json} | 206 +- ...or_weight_exactly_2_eligible_standby.json} | 206 +- .../validator_weight_less_than_103.json} | 100 +- ..._weight_more_than_2_eligible_standby.json} | 300 +-- .../README.md | 0 .../forger_list.json | 300 +-- .../index.js | 106 +- .../sample_generator.js | 20 +- .../pos_validator_shuffling/README.md | 17 + .../pos_validator_shuffling/index.js | 61 + .../sample_generator.js | 16 +- .../validator_address_list.json} | 2 +- .../proof_of_misbehavior_transaction/index.js | 2 +- .../index.js | 24 +- .../unlocking_transaction/README.md | 2 +- .../generators/unlocking_transaction/index.js | 94 +- .../generators/vote_transaction/README.md | 4 +- .../generators/vote_transaction/index.js | 124 +- protocol-specs/schema/README.md | 2 +- .../schema/lisk_protocol_specs.schema.json | 2 +- protocol-specs/utils/README.md | 12 +- protocol-specs/utils/bft/index.js | 18 +- sdk/README.md | 8 +- sdk/src/samples/config_devnet.json | 8 +- sdk/src/samples/genesis_block_devnet.json | 1040 ++++----- test/src/main.spec.ts | 6 +- test/src/types.ts | 4 +- 312 files changed, 9529 insertions(+), 9661 deletions(-) rename examples/{dpos-mainchain => pos-mainchain}/.eslintignore (100%) rename examples/{dpos-mainchain => pos-mainchain}/.eslintrc.js (100%) rename examples/{dpos-mainchain => pos-mainchain}/.gitignore (100%) rename examples/{dpos-mainchain => pos-mainchain}/.lintstagedrc.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/.liskrc.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/.prettierignore (100%) rename examples/{dpos-mainchain => pos-mainchain}/.prettierrc.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/README.md (100%) rename examples/{dpos-mainchain => pos-mainchain}/bin/run (100%) rename examples/{dpos-mainchain => pos-mainchain}/bin/run.cmd (100%) rename examples/{dpos-mainchain => pos-mainchain}/config/default/config.json (96%) rename examples/{dpos-mainchain => pos-mainchain}/config/default/dev-validators.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/config/default/genesis_assets.json (99%) rename examples/{dpos-mainchain => pos-mainchain}/config/default/genesis_block.blob (99%) rename examples/{dpos-mainchain => pos-mainchain}/config/default/passphrase.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/jest.config.js (100%) rename examples/{dpos-mainchain => pos-mainchain}/package.json (82%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/app.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/index.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/modules.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/modules/.gitkeep (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/plugins.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/app/plugins/.gitkeep (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/block/get.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/blockchain/export.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/blockchain/hash.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/blockchain/import.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/blockchain/reset.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/config/create.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/config/show.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/console.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/endpoint/invoke.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/generator/disable.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/generator/enable.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/generator/export.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/generator/import.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/generator/status.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/genesis-block/create.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/hash-onion.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/keys/create.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/keys/encrypt.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/keys/export.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/keys/import.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/passphrase/decrypt.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/passphrase/encrypt.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/start.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/system/metadata.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/system/node-info.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/transaction/create.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/transaction/get.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/transaction/send.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/src/commands/transaction/sign.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/.eslintrc.js (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/_setup.js (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/integration/.gitkeep (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/network/.gitkeep (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/tsconfig.json (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/types.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/unit/modules/.gitkeep (100%) rename examples/{dpos-mainchain => pos-mainchain}/test/utils/config.ts (100%) rename examples/{dpos-mainchain => pos-mainchain}/tsconfig.json (100%) delete mode 100644 framework/src/modules/dpos_v2/commands/vote_delegate.ts rename framework/src/modules/{dpos_v2 => pos}/commands/change_commission.ts (73%) rename framework/src/modules/{dpos_v2 => pos}/commands/claim_rewards.ts (63%) rename framework/src/modules/{dpos_v2/commands/delegate_registration.ts => pos/commands/register_validator.ts} (62%) rename framework/src/modules/{dpos_v2/commands/pom.ts => pos/commands/report_misbehavior.ts} (64%) create mode 100644 framework/src/modules/pos/commands/stake.ts rename framework/src/modules/{dpos_v2 => pos}/commands/unlock.ts (71%) rename framework/src/modules/{dpos_v2 => pos}/commands/update_generator_key.ts (87%) rename framework/src/modules/{dpos_v2 => pos}/constants.ts (66%) rename framework/src/modules/{dpos_v2 => pos}/endpoint.ts (57%) rename framework/src/modules/{dpos_v2 => pos}/events/commission_change.ts (87%) rename framework/src/modules/{dpos_v2 => pos}/events/rewards_assigned.ts (85%) rename framework/src/modules/{dpos_v2/events/delegate_banned.ts => pos/events/validator_banned.ts} (72%) rename framework/src/modules/{dpos_v2/events/delegate_punished.ts => pos/events/validator_punished.ts} (71%) rename framework/src/modules/{dpos_v2/events/delegate_registered.ts => pos/events/validator_registered.ts} (70%) rename framework/src/modules/{dpos_v2/events/delegate_voted.ts => pos/events/validator_staked.ts} (56%) rename framework/src/modules/{dpos_v2 => pos}/index.ts (68%) rename framework/src/modules/{dpos_v2 => pos}/internal_method.ts (71%) rename framework/src/modules/{dpos_v2 => pos}/method.ts (61%) rename framework/src/modules/{dpos_v2 => pos}/module.ts (54%) rename framework/src/modules/{dpos_v2 => pos}/rounds.ts (100%) rename framework/src/modules/{dpos_v2 => pos}/schemas.ts (78%) rename framework/src/modules/{dpos_v2/stores/eligible_delegates.ts => pos/stores/eligible_validators.ts} (72%) rename framework/src/modules/{dpos_v2 => pos}/stores/genesis.ts (88%) rename framework/src/modules/{dpos_v2 => pos}/stores/name.ts (88%) rename framework/src/modules/{dpos_v2 => pos}/stores/previous_timestamp.ts (95%) rename framework/src/modules/{dpos_v2 => pos}/stores/snapshot.ts (89%) rename framework/src/modules/{dpos_v2/stores/voter.ts => pos/stores/staker.ts} (75%) rename framework/src/modules/{dpos_v2/stores/delegate.ts => pos/stores/validator.ts} (80%) rename framework/src/modules/{dpos_v2 => pos}/types.ts (78%) rename framework/src/modules/{dpos_v2 => pos}/utils.ts (58%) rename framework/test/fixtures/config/devnet/{delegates_for_first_round.json => validators_for_first_round.json} (100%) rename framework/test/fixtures/{genesis_delegates.json => genesis_validators.json} (99%) rename framework/test/fixtures/{dpos_forger_selection => pos_forger_selection} (100%) rename framework/test/fixtures/{dpos_random_seed_generation => pos_random_seed_generation} (100%) rename framework/test/fixtures/{dpos_delegate_shuffling => pos_validator_shuffling} (100%) delete mode 100644 framework/test/unit/modules/dpos_v2/commands/__snapshots__/pom.spec.ts.snap delete mode 100644 framework/test/unit/modules/dpos_v2/commands/vote_delegate.spec.ts delete mode 100644 framework/test/unit/modules/dpos_v2/endpoint.spec.ts create mode 100644 framework/test/unit/modules/pos/commands/__snapshots__/report_misbehavior.spec.ts.snap rename framework/test/unit/modules/{dpos_v2/commands/__snapshots__/vote_delegate.spec.ts.snap => pos/commands/__snapshots__/stake.spec.ts.snap} (73%) rename framework/test/unit/modules/{dpos_v2 => pos}/commands/change_commission.spec.ts (79%) rename framework/test/unit/modules/{dpos_v2 => pos}/commands/claim_rewards.spec.ts (59%) rename framework/test/unit/modules/{dpos_v2/commands/pom.spec.ts => pos/commands/report_misbehavior.spec.ts} (82%) create mode 100644 framework/test/unit/modules/pos/commands/stake.spec.ts rename framework/test/unit/modules/{dpos_v2 => pos}/commands/unlock.spec.ts (51%) rename framework/test/unit/modules/{dpos_v2/commands/delegate_registration.spec.ts => pos/commands/validator_registration.spec.ts} (60%) create mode 100644 framework/test/unit/modules/pos/endpoint.spec.ts rename framework/test/unit/modules/{dpos_v2 => pos}/genesis_block_test_data.ts (62%) rename framework/test/unit/modules/{dpos_v2 => pos}/internal_method.spec.ts (60%) rename framework/test/unit/modules/{dpos_v2 => pos}/method.spec.ts (60%) rename framework/test/unit/modules/{dpos_v2 => pos}/module.spec.ts (59%) rename framework/test/unit/modules/{dpos_v2/stores/eligible_delegates_store.spec.ts => pos/stores/eligible_validators_store.spec.ts} (52%) rename framework/test/unit/modules/{dpos_v2 => pos}/update_generator_key.spec.ts (86%) rename framework/test/unit/modules/{dpos_v2 => pos}/utils.spec.ts (50%) rename framework/test/unit/modules/random/{dpos_random_seed_generation => pos_random_seed_generation} (100%) rename protocol-specs/generator_outputs/bft_processing/{11_delegates_partial_switch.json => 11_validators_partial_switch.json} (93%) rename protocol-specs/generator_outputs/bft_processing/{4_delegates_missed_slots.json => 4_validators_missed_slots.json} (90%) rename protocol-specs/generator_outputs/bft_processing/{4_delegates_simple.json => 4_validators_simple.json} (89%) rename protocol-specs/generator_outputs/bft_processing/{5_delegates_switched_completely.json => 5_validators_switched_completely.json} (92%) rename protocol-specs/generator_outputs/bft_processing/{7_delegates_partial_switch.json => 7_validators_partial_switch.json} (92%) rename protocol-specs/generator_outputs/dpos_delegate_shuffling/{uniformly_shuffled_delegate_list.json => uniformly_shuffled_validator_list.json} (97%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection.json => pos_forger_selection.json} (66%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection_0_standby.json => pos_forger_selection_0_standby.json} (75%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection_exactly_1_standby.json => pos_forger_selection_exactly_1_standby.json} (74%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection_exactly_2_standby.json => pos_forger_selection_exactly_2_standby.json} (74%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection_less_than_103.json => pos_forger_selection_less_than_103.json} (74%) rename protocol-specs/generator_outputs/dpos_forger_selection/{dpos_forger_selection_more_than_2_standby.json => pos_forger_selection_more_than_2_standby.json} (71%) rename protocol-specs/generator_outputs/dpos_random_seed_generation/{dpos_random_seed_generation_first_round.json => pos_random_seed_generation_first_round.json} (99%) rename protocol-specs/generator_outputs/dpos_random_seed_generation/{dpos_random_seed_generation_invalid_seed_reveal.json => pos_random_seed_generation_invalid_seed_reveal.json} (99%) rename protocol-specs/generator_outputs/dpos_random_seed_generation/{dpos_random_seed_generation_not_forged_earlier.json => pos_random_seed_generation_not_forged_earlier.json} (99%) rename protocol-specs/generator_outputs/dpos_random_seed_generation/{dpos_random_seed_generation_not_passed_middle_of_round.json => pos_random_seed_generation_not_passed_middle_of_round.json} (99%) rename protocol-specs/generator_outputs/dpos_random_seed_generation/{dpos_random_seed_generation_other_rounds.json => pos_random_seed_generation_other_rounds.json} (99%) delete mode 100644 protocol-specs/generators/dpos_delegate_shuffling/README.md delete mode 100644 protocol-specs/generators/dpos_delegate_shuffling/index.js delete mode 100644 protocol-specs/generators/dpos_forger_selection/README.md create mode 100644 protocol-specs/generators/pos_forger_selection/README.md rename protocol-specs/generators/{dpos_forger_selection => pos_forger_selection}/index.js (56%) rename protocol-specs/generators/{dpos_forger_selection => pos_forger_selection}/sample_generator.js (74%) rename protocol-specs/generators/{dpos_forger_selection/delegate_weight_0_eligible_standby.json => pos_forger_selection/validator_weight_0_eligible_standby.json} (64%) rename protocol-specs/generators/{dpos_forger_selection/delegate_weight_exactly_1_eligible_standby.json => pos_forger_selection/validator_weight_exactly_1_eligible_standby.json} (64%) rename protocol-specs/generators/{dpos_forger_selection/delegate_weight_exactly_2_eligible_standby.json => pos_forger_selection/validator_weight_exactly_2_eligible_standby.json} (63%) rename protocol-specs/generators/{dpos_forger_selection/delegate_weight_less_than_103.json => pos_forger_selection/validator_weight_less_than_103.json} (64%) rename protocol-specs/generators/{dpos_forger_selection/delegate_weight_more_than_2_eligible_standby.json => pos_forger_selection/validator_weight_more_than_2_eligible_standby.json} (63%) rename protocol-specs/generators/{dpos_random_seed_generation => pos_random_seed_generation}/README.md (100%) rename protocol-specs/generators/{dpos_random_seed_generation => pos_random_seed_generation}/forger_list.json (71%) rename protocol-specs/generators/{dpos_random_seed_generation => pos_random_seed_generation}/index.js (75%) rename protocol-specs/generators/{dpos_random_seed_generation => pos_random_seed_generation}/sample_generator.js (72%) create mode 100644 protocol-specs/generators/pos_validator_shuffling/README.md create mode 100644 protocol-specs/generators/pos_validator_shuffling/index.js rename protocol-specs/generators/{dpos_delegate_shuffling => pos_validator_shuffling}/sample_generator.js (72%) rename protocol-specs/generators/{dpos_delegate_shuffling/delegate_address_list.json => pos_validator_shuffling/validator_address_list.json} (99%) diff --git a/commander/src/bootstrapping/commands/endpoint/invoke.ts b/commander/src/bootstrapping/commands/endpoint/invoke.ts index dfef511257d..8a8230edb63 100644 --- a/commander/src/bootstrapping/commands/endpoint/invoke.ts +++ b/commander/src/bootstrapping/commands/endpoint/invoke.ts @@ -9,7 +9,7 @@ export class InvokeCommand extends BaseIPCClientCommand { 'endpoint:invoke {endpoint} {parameters}', 'endpoint:invoke --data-path --file', `endpoint:invoke generator_getAllKeys`, - `endpoint:invoke consensus_getBFTParameters '{"height": 2}' -d ~/.lisk/dpos-mainchain --pretty`, + `endpoint:invoke consensus_getBFTParameters '{"height": 2}' -d ~/.lisk/pos-mainchain --pretty`, `endpoint:invoke consensus_getBFTParameters -f ./input.json`, ]; diff --git a/commander/src/bootstrapping/commands/generator/disable.ts b/commander/src/bootstrapping/commands/generator/disable.ts index a2fdf2327a9..e153103a3cd 100644 --- a/commander/src/bootstrapping/commands/generator/disable.ts +++ b/commander/src/bootstrapping/commands/generator/disable.ts @@ -16,7 +16,7 @@ import { BaseForgingCommand } from '../base_forging'; export abstract class DisableCommand extends BaseForgingCommand { - static description = 'Disable forging for given delegate address.'; + static description = 'Disable forging for given validator address.'; static examples = [ 'generator:disable lskycz7hvr8yfu74bcwxy2n4mopfmjancgdvxq8xz', diff --git a/commander/src/bootstrapping/commands/generator/enable.ts b/commander/src/bootstrapping/commands/generator/enable.ts index 6ead59f1d22..489318cae2c 100644 --- a/commander/src/bootstrapping/commands/generator/enable.ts +++ b/commander/src/bootstrapping/commands/generator/enable.ts @@ -16,7 +16,7 @@ import { BaseForgingCommand } from '../base_forging'; export abstract class EnableCommand extends BaseForgingCommand { - static description = 'Enable forging for given delegate address.'; + static description = 'Enable forging for given validator address.'; static examples = [ 'generator:enable lsk24cd35u4jdq8szo3pnsqe5dsxwrnazyqqqg5eu 100 100 10', @@ -39,12 +39,12 @@ export abstract class EnableCommand extends BaseForgingCommand { { name: 'maxHeightGenerated', required: true, - description: 'Delegates largest previously forged height.', + description: 'Validators largest previously forged height.', }, { name: 'maxHeightPrevoted', required: true, - description: 'Delegates largest prevoted height for a block.', + description: 'Validators largest prevoted height for a block.', }, ]; diff --git a/commander/src/bootstrapping/templates/lisk-template-ts/generators/init_generator.ts b/commander/src/bootstrapping/templates/lisk-template-ts/generators/init_generator.ts index 688fab64b9f..bb49dcc1ef5 100644 --- a/commander/src/bootstrapping/templates/lisk-template-ts/generators/init_generator.ts +++ b/commander/src/bootstrapping/templates/lisk-template-ts/generators/init_generator.ts @@ -21,7 +21,7 @@ import * as fs from 'fs-extra'; import * as Generator from 'yeoman-generator'; import { isHexString } from '@liskhq/lisk-validator'; import { Mnemonic } from '@liskhq/lisk-passphrase'; -import { generateGenesisBlockDefaultDPoSAssets } from '../../../../utils/genesis_creation'; +import { generateGenesisBlockDefaultPoSAssets } from '../../../../utils/genesis_creation'; interface InitPrompts { name: string; @@ -126,7 +126,7 @@ export default class InitGenerator extends Generator { const { keys } = JSON.parse( fs.readFileSync(`${this.destinationPath('config/default/dev-validators.json')}`, 'utf8'), ) as Record; - const { genesisAssets } = generateGenesisBlockDefaultDPoSAssets({ + const { genesisAssets } = generateGenesisBlockDefaultPoSAssets({ chainID: this.answers.chainID, keysList: keys as never, numberOfValidators: 101, diff --git a/commander/src/utils/genesis_creation.ts b/commander/src/utils/genesis_creation.ts index 39cb4a979ad..79c52e0b53b 100644 --- a/commander/src/utils/genesis_creation.ts +++ b/commander/src/utils/genesis_creation.ts @@ -16,8 +16,8 @@ import { Schema } from '@liskhq/lisk-codec'; import { address } from '@liskhq/lisk-cryptography'; import { - dposGenesisStoreSchema, - DPoSModule, + posGenesisStoreSchema, + PoSModule, tokenGenesisStoreSchema, TokenModule, } from 'lisk-framework'; @@ -79,7 +79,7 @@ interface GenesisBlockDefaultAccountInput { numberOfValidators: number; } -export const generateGenesisBlockDefaultDPoSAssets = (input: GenesisBlockDefaultAccountInput) => { +export const generateGenesisBlockDefaultPoSAssets = (input: GenesisBlockDefaultAccountInput) => { const localID = Buffer.from([0, 0, 0, 0]).toString('hex'); const tokenID = `${input.chainID}${localID}`; input.keysList.sort((a, b) => @@ -109,7 +109,7 @@ export const generateGenesisBlockDefaultDPoSAssets = (input: GenesisBlockDefault schema: tokenGenesisStoreSchema, }, { - module: new DPoSModule().name, + module: new PoSModule().name, data: { validators: input.keysList.map((v, i) => ({ address: v.address, @@ -125,13 +125,13 @@ export const generateGenesisBlockDefaultDPoSAssets = (input: GenesisBlockDefault lastCommissionIncreaseHeight: 0, sharingCoefficients: [], })), - voters: [], + stakers: [], genesisData: { initRounds: 3, - initDelegates: input.keysList.slice(0, input.numberOfValidators).map(v => v.address), + initValidators: input.keysList.slice(0, input.numberOfValidators).map(v => v.address), }, } as Record, - schema: dposGenesisStoreSchema, + schema: posGenesisStoreSchema, }, ]; diff --git a/commander/test/bootstrapping/commands/endpoint/invoke.spec.ts b/commander/test/bootstrapping/commands/endpoint/invoke.spec.ts index 1f879988ef2..32008337cbe 100644 --- a/commander/test/bootstrapping/commands/endpoint/invoke.spec.ts +++ b/commander/test/bootstrapping/commands/endpoint/invoke.spec.ts @@ -49,7 +49,7 @@ describe('endpoint:invoke command', () => { [ 'consensus_getBFTParameters', '{"height": 2}', - '-d ~/.lisk/dpos-mainchain', + '-d ~/.lisk/pos-mainchain', '-f ./input.json', ], config, @@ -58,7 +58,7 @@ describe('endpoint:invoke command', () => { }); it('should call invoke with the provided action', async () => { - await InvokeCommand.run(['consensus_getBFTParameters', '-d ~/.lisk/dpos-mainchain'], config); + await InvokeCommand.run(['consensus_getBFTParameters', '-d ~/.lisk/pos-mainchain'], config); expect(invokeMock).toBeCalledTimes(1); expect(invokeMock).toBeCalledWith('consensus_getBFTParameters'); @@ -66,7 +66,7 @@ describe('endpoint:invoke command', () => { it('should call invoke the provided action with parameters if provided', async () => { await InvokeCommand.run( - ['consensus_getBFTParameters', '{"height": 2}', '-d ~/.lisk/dpos-mainchain'], + ['consensus_getBFTParameters', '{"height": 2}', '-d ~/.lisk/pos-mainchain'], config, ); @@ -76,7 +76,7 @@ describe('endpoint:invoke command', () => { it('should call printJSON with the result of client.invoke', async () => { await InvokeCommand.run( - ['consensus_getBFTParameters', '{"height": 2}', '-d ~/.lisk/dpos-mainchain'], + ['consensus_getBFTParameters', '{"height": 2}', '-d ~/.lisk/pos-mainchain'], config, ); diff --git a/commander/test/bootstrapping/commands/system/info.spec.ts b/commander/test/bootstrapping/commands/system/info.spec.ts index 2a672ad23c0..60d602fcde3 100644 --- a/commander/test/bootstrapping/commands/system/info.spec.ts +++ b/commander/test/bootstrapping/commands/system/info.spec.ts @@ -40,10 +40,10 @@ describe('system:node-info command', () => { distance: 3000000, }, communityIdentifier: 'Lisk', - activeDelegates: 101, - standbyDelegates: 2, + activeValidators: 101, + standbyValidators: 2, totalAmount: '10000000000000000', - delegateListRoundOffset: 2, + validatorListRoundOffset: 2, }, }; diff --git a/commander/test/bootstrapping/commands/transaction/create.spec.ts b/commander/test/bootstrapping/commands/transaction/create.spec.ts index 33743f538d8..886d618ff4b 100644 --- a/commander/test/bootstrapping/commands/transaction/create.spec.ts +++ b/commander/test/bootstrapping/commands/transaction/create.spec.ts @@ -21,7 +21,7 @@ import * as transactions from '@liskhq/lisk-transactions'; import * as appUtils from '../../../../src/utils/application'; import * as readerUtils from '../../../../src/utils/reader'; -import { tokenTransferParamsSchema, dposVoteParamsSchema } from '../../../helpers/transactions'; +import { tokenTransferParamsSchema, posVoteParamsSchema } from '../../../helpers/transactions'; import { CreateCommand } from '../../../../src/bootstrapping/commands/transaction/create'; import { getConfig } from '../../../helpers/config'; import { PromiseResolvedType } from '../../../../src/types'; @@ -32,9 +32,9 @@ describe('transaction:create command', () => { const transferParams = '{"tokenID": "0000000000000000","amount":100,"recipientAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","data":"send token", "accountInitializationFee": "5000000"}'; const voteParams = - '{"votes":[{"delegateAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":100},{"delegateAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":-50}]}'; + '{"stakes":[{"validatorAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":100},{"validatorAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":-50}]}'; const unVoteParams = - '{"votes":[{"delegateAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":-50}]}'; + '{"stakes":[{"validatorAddress":"lskqozpc4ftffaompmqwzd93dfj89g5uezqwhosg9","amount":-50}]}'; const { publicKey } = cryptography.legacy.getPrivateAndPublicKeyFromPassphrase(passphrase); const senderPublicKey = publicKey.toString('hex'); const mockEncodedTransaction = Buffer.from('encoded transaction'); @@ -94,11 +94,11 @@ describe('transaction:create command', () => { ], }, { - name: 'dpos', + name: 'pos', commands: [ { - name: 'voteDelegate', - params: dposVoteParamsSchema, + name: 'stake', + params: posVoteParamsSchema, }, ], }, @@ -338,12 +338,12 @@ describe('transaction:create command', () => { }); }); - describe(`transaction:create dpos voteDelegate 100000000 --params=${voteParams} --passphrase=${passphrase}`, () => { + describe(`transaction:create pos stake 100000000 --params=${voteParams} --passphrase=${passphrase}`, () => { it('should return encoded transaction string in hex format with signature', async () => { await CreateCommandExtended.run( [ - 'dpos', - 'voteDelegate', + 'pos', + 'stake', '100000000', '--offline', `--params=${voteParams}`, @@ -360,12 +360,12 @@ describe('transaction:create command', () => { }); }); - describe(`transaction:create dpos voteDelegate 100000000 --params=${unVoteParams} --passphrase=${passphrase}`, () => { + describe(`transaction:create pos stake 100000000 --params=${unVoteParams} --passphrase=${passphrase}`, () => { it('should return encoded transaction string in hex format with signature', async () => { await CreateCommandExtended.run( [ - 'dpos', - 'voteDelegate', + 'pos', + 'stake', '100000000', '--offline', `--params=${unVoteParams}`, @@ -600,16 +600,10 @@ describe('transaction:create command', () => { }); }); - describe(`transaction:create dpos voteDelegate 100000000 --params=${voteParams} --passphrase=${passphrase}`, () => { + describe(`transaction:create pos stake 100000000 --params=${voteParams} --passphrase=${passphrase}`, () => { it('should return encoded transaction string in hex format with signature', async () => { await CreateCommandExtended.run( - [ - 'dpos', - 'voteDelegate', - '100000000', - `--params=${voteParams}`, - `--passphrase=${passphrase}`, - ], + ['pos', 'stake', '100000000', `--params=${voteParams}`, `--passphrase=${passphrase}`], config, ); expect(CreateCommandExtended.prototype.printJSON).toHaveBeenCalledTimes(1); @@ -619,16 +613,10 @@ describe('transaction:create command', () => { }); }); - describe(`transaction:create dpos voteDelegate 100000000 --params=${unVoteParams} --passphrase=${passphrase}`, () => { + describe(`transaction:create pos stake 100000000 --params=${unVoteParams} --passphrase=${passphrase}`, () => { it('should return encoded transaction string in hex format with signature', async () => { await CreateCommandExtended.run( - [ - 'dpos', - 'voteDelegate', - '100000000', - `--params=${unVoteParams}`, - `--passphrase=${passphrase}`, - ], + ['pos', 'stake', '100000000', `--params=${unVoteParams}`, `--passphrase=${passphrase}`], config, ); expect(CreateCommandExtended.prototype.printJSON).toHaveBeenCalledTimes(1); diff --git a/commander/test/bootstrapping/commands/transaction/prompt.spec.ts b/commander/test/bootstrapping/commands/transaction/prompt.spec.ts index 93f37e5710e..5a59f56d8ff 100644 --- a/commander/test/bootstrapping/commands/transaction/prompt.spec.ts +++ b/commander/test/bootstrapping/commands/transaction/prompt.spec.ts @@ -21,7 +21,7 @@ import { import { tokenTransferParamsSchema, keysRegisterParamsSchema, - dposVoteParamsSchema, + posVoteParamsSchema, } from '../../../helpers/transactions'; describe('prompt', () => { @@ -81,28 +81,28 @@ describe('prompt', () => { describe('transformNestedAsset', () => { it('should transform result according to nested asset schema', () => { - const questions = prepareQuestions(dposVoteParamsSchema); - const transformedAsset = transformNestedAsset(dposVoteParamsSchema, [ - { votes: 'a,100' }, - { votes: 'b,300' }, + const questions = prepareQuestions(posVoteParamsSchema); + const transformedAsset = transformNestedAsset(posVoteParamsSchema, [ + { stakes: 'a,100' }, + { stakes: 'b,300' }, ]); expect(questions).toEqual([ { type: 'input', - name: 'votes', - message: 'Please enter: votes(delegateAddress, amount): ', + name: 'stakes', + message: 'Please enter: stakes(validatorAddress, amount): ', }, { type: 'confirm', name: 'askAgain', - message: 'Want to enter another votes(delegateAddress, amount)', + message: 'Want to enter another stakes(validatorAddress, amount)', }, ]); expect(transformedAsset).toEqual({ - votes: [ - { delegateAddress: 'a', amount: 100 }, - { delegateAddress: 'b', amount: 300 }, + stakes: [ + { validatorAddress: 'a', amount: 100 }, + { validatorAddress: 'b', amount: 300 }, ], }); }); diff --git a/commander/test/helpers/account.ts b/commander/test/helpers/account.ts index 9f9e37e212b..a9ed13b8802 100644 --- a/commander/test/helpers/account.ts +++ b/commander/test/helpers/account.ts @@ -52,17 +52,17 @@ export const createFakeDefaultAccount = (account: any) => ({ optionalKeys: account?.keys?.optionalKeys ?? [], numberOfSignatures: account?.keys?.numberOfSignatures ?? 0, }, - dpos: { - delegate: { - username: account?.dpos?.delegate?.username ?? '', - pomHeights: account?.dpos?.delegate?.pomHeights ?? [], - consecutiveMissedBlocks: account?.dpos?.delegate?.consecutiveMissedBlocks ?? 0, - lastForgedHeight: account?.dpos?.delegate?.lastForgedHeight ?? 0, - isBanned: account?.dpos?.delegate?.isBanned ?? false, - totalVotesReceived: account?.dpos?.delegate?.totalVotesReceived ?? BigInt(0), + pos: { + validator: { + username: account?.pos?.validator?.username ?? '', + pomHeights: account?.pos?.validator?.pomHeights ?? [], + consecutiveMissedBlocks: account?.pos?.validator?.consecutiveMissedBlocks ?? 0, + lastForgedHeight: account?.pos?.validator?.lastForgedHeight ?? 0, + isBanned: account?.pos?.validator?.isBanned ?? false, + totalStakeReceived: account?.pos?.validator?.totalStakeReceived ?? BigInt(0), }, - sentVotes: account?.dpos?.sentVotes ?? [], - unlocking: account?.dpos?.unlocking ?? [], + sentStakes: account?.pos?.sentStakes ?? [], + unlocking: account?.pos?.unlocking ?? [], }, }); diff --git a/commander/test/helpers/mocks.ts b/commander/test/helpers/mocks.ts index 3cc27d32034..e2130f636f2 100644 --- a/commander/test/helpers/mocks.ts +++ b/commander/test/helpers/mocks.ts @@ -17,7 +17,7 @@ import { codec, Schema } from '@liskhq/lisk-codec'; import { utils } from '@liskhq/lisk-cryptography'; import { transactionSchema } from 'lisk-framework'; import { - dposVoteParamsSchema, + posVoteParamsSchema, registerMultisignatureParamsSchema, tokenTransferParamsSchema, } from './transactions'; @@ -40,9 +40,9 @@ export const mockCommands: CommandInfo[] = [ schema: registerMultisignatureParamsSchema, }, { - module: 'dpos', - command: 'voteDelegate', - schema: dposVoteParamsSchema, + module: 'pos', + command: 'stake', + schema: posVoteParamsSchema, }, ]; @@ -99,12 +99,12 @@ export const createIPCClientMock = ( }, { id: utils.intToBuffer(13, 4).toString('hex'), - name: 'dpos', + name: 'pos', commands: [ { id: utils.intToBuffer(1, 4).toString('hex'), - name: 'voteDelegate', - params: dposVoteParamsSchema, + name: 'stake', + params: posVoteParamsSchema, }, ], }, diff --git a/commander/test/helpers/transactions.ts b/commander/test/helpers/transactions.ts index 676cf7e65ef..735148b63fa 100644 --- a/commander/test/helpers/transactions.ts +++ b/commander/test/helpers/transactions.ts @@ -175,21 +175,21 @@ export const keysRegisterParamsSchema = { }, required: ['numberOfSignatures', 'mandatoryKeys', 'optionalKeys'], }; -export const dposVoteParamsSchema = { - $id: '/dpos/command/voteDelegateParams', +export const posVoteParamsSchema = { + $id: '/pos/command/stakeParams', type: 'object', - required: ['votes'], + required: ['stakes'], properties: { - votes: { + stakes: { type: 'array', fieldNumber: 1, minItems: 1, maxItems: 20, items: { type: 'object', - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', diff --git a/elements/lisk-api-client/test/utils/transaction.ts b/elements/lisk-api-client/test/utils/transaction.ts index be5e61867bf..7c7d2d9a22e 100644 --- a/elements/lisk-api-client/test/utils/transaction.ts +++ b/elements/lisk-api-client/test/utils/transaction.ts @@ -114,7 +114,7 @@ export const metadata: ModuleMetadata[] = [ }, { id: utils.intToBuffer(5, 4).toString('hex'), - name: 'dpos', + name: 'pos', events: [], assets: [], endpoints: [], @@ -123,7 +123,7 @@ export const metadata: ModuleMetadata[] = [ id: utils.intToBuffer(0, 4).toString('hex'), name: 'transfer', params: { - $id: '/lisk/dpos/pom', + $id: '/lisk/pos/pom', type: 'object', required: ['header1', 'header2'], properties: { diff --git a/elements/lisk-chain/benchmark/calculate_diff.js b/elements/lisk-chain/benchmark/calculate_diff.js index 0644a59db25..f4332ee0364 100644 --- a/elements/lisk-chain/benchmark/calculate_diff.js +++ b/elements/lisk-chain/benchmark/calculate_diff.js @@ -21,7 +21,7 @@ const senderAccount = { address: '5059876081639179984L', publicKey: '0fe9a3f1a21b5530f27f87a414b549e79a940bf24fdf2b2f05e7f22aeeecc86a', username: null, - isDelegate: false, + isValidator: false, nonce: '103', balance: 9897000000000000, fees: '0', diff --git a/elements/lisk-codec/benchmark/encode_decode_account.js b/elements/lisk-codec/benchmark/encode_decode_account.js index e82f807badd..d61a1a48f31 100644 --- a/elements/lisk-codec/benchmark/encode_decode_account.js +++ b/elements/lisk-codec/benchmark/encode_decode_account.js @@ -31,24 +31,24 @@ const account = { optionalKeys: [], }, asset: { - delegate: { - username: 'DelegateA', + validator: { + username: 'ValidatorA', pomHeights: [85], consecutiveMissedBlocks: 32, lastForgedHeight: 64, isBanned: false, - totalVotesReceived: BigInt(300000000), + totalStakeReceived: BigInt(300000000), }, - sentVotes: [ + sentStakes: [ { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( 'cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4', 'hex', ), amount: BigInt(100000000), }, { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( '9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6', 'hex', ), @@ -57,12 +57,12 @@ const account = { ], unlocking: [ { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( '655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5', 'hex', ), amount: BigInt(400000000), - unvoteHeight: 128, + unstakeHeight: 128, }, ], }, @@ -98,7 +98,7 @@ const testSchema = { type: 'object', fieldNumber: 6, properties: { - delegate: { + validator: { type: 'object', fieldNumber: 1, properties: { @@ -111,7 +111,7 @@ const testSchema = { consecutiveMissedBlocks: { dataType: 'uint32', fieldNumber: 3 }, lastForgedHeight: { dataType: 'uint32', fieldNumber: 4 }, isBanned: { dataType: 'boolean', fieldNumber: 5 }, - totalVotesReceived: { dataType: 'uint64', fieldNumber: 6 }, + totalStakeReceived: { dataType: 'uint64', fieldNumber: 6 }, }, required: [ 'username', @@ -119,19 +119,19 @@ const testSchema = { 'consecutiveMissedBlocks', 'lastForgedHeight', 'isBanned', - 'totalVotesReceived', + 'totalStakeReceived', ], }, - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 2, items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, }, - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], }, }, unlocking: { @@ -140,11 +140,11 @@ const testSchema = { items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, - unvoteHeight: { dataType: 'uint32', fieldNumber: 3 }, + unstakeHeight: { dataType: 'uint32', fieldNumber: 3 }, }, - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], }, }, }, diff --git a/elements/lisk-codec/test/__snapshots__/add_schema.spec.ts.snap b/elements/lisk-codec/test/__snapshots__/add_schema.spec.ts.snap index 3ff12c3ff58..36cbf9015bd 100644 --- a/elements/lisk-codec/test/__snapshots__/add_schema.spec.ts.snap +++ b/elements/lisk-codec/test/__snapshots__/add_schema.spec.ts.snap @@ -1,149 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`addSchema should add schema and keep it in cache 1`] = ` -Array [ - Object { - "binaryKey": Object { - "data": Array [ - 10, - ], - "type": "Buffer", - }, - "dataPath": Array [], - "propertyName": "address", - "schemaProp": Object { - "dataType": "bytes", - "fieldNumber": 1, - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 16, - ], - "type": "Buffer", - }, - "dataPath": Array [], - "propertyName": "balance", - "schemaProp": Object { - "dataType": "uint64", - "fieldNumber": 2, - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 24, - ], - "type": "Buffer", - }, - "dataPath": Array [], - "propertyName": "isDelegate", - "schemaProp": Object { - "dataType": "boolean", - "fieldNumber": 3, - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 34, - ], - "type": "Buffer", - }, - "dataPath": Array [], - "propertyName": "name", - "schemaProp": Object { - "dataType": "string", - "fieldNumber": 4, - }, - }, - Array [ - Object { - "binaryKey": Object { - "data": Array [ - 42, - ], - "type": "Buffer", - }, - "dataPath": Array [ - "asset", - ], - "propertyName": "asset", - "schemaProp": Object { - "fieldNumber": 5, - "type": "object", - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 10, - ], - "type": "Buffer", - }, - "dataPath": Array [ - "asset", - ], - "propertyName": "data", - "schemaProp": Object { - "dataType": "string", - "fieldNumber": 1, - }, - }, - Array [ - Object { - "binaryKey": Object { - "data": Array [ - 18, - ], - "type": "Buffer", - }, - "dataPath": Array [ - "asset", - "fooBar", - ], - "propertyName": "fooBar", - "schemaProp": Object { - "fieldNumber": 2, - "type": "object", - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 8, - ], - "type": "Buffer", - }, - "dataPath": Array [ - "asset", - "fooBar", - ], - "propertyName": "foo", - "schemaProp": Object { - "dataType": "uint32", - "fieldNumber": 1, - }, - }, - Object { - "binaryKey": Object { - "data": Array [ - 16, - ], - "type": "Buffer", - }, - "dataPath": Array [ - "asset", - "fooBar", - ], - "propertyName": "bar", - "schemaProp": Object { - "dataType": "uint32", - "fieldNumber": 2, - }, - }, - ], - ], -] -`; +exports[`addSchema should add schema and keep it in cache 1`] = `undefined`; diff --git a/elements/lisk-codec/test/decode.spec.ts b/elements/lisk-codec/test/decode.spec.ts index a9892366929..ef120447fda 100644 --- a/elements/lisk-codec/test/decode.spec.ts +++ b/elements/lisk-codec/test/decode.spec.ts @@ -85,7 +85,7 @@ describe('decode', () => { it.each(buildTestCases(blockTestCases))('%s', ({ input, output }) => { const object = { header: Buffer.from(output.object.header, 'hex'), - transactions: output.object.transactions.map(p => Buffer.from(p, 'hex')), + payload: output.object.payload.map(p => Buffer.from(p, 'hex')), }; const result = codec.decode(input.schema, Buffer.from(input.value, 'hex')); @@ -340,7 +340,7 @@ describe('decode', () => { it.each(buildTestCases(genesisBlockTestCases))('%s', ({ input, output }) => { const object = { ...output.object, - initDelegates: output.object.initDelegates.map(d => Buffer.from(d, 'hex')), + initValidators: output.object.initValidators.map(d => Buffer.from(d, 'hex')), accounts: output.object.accounts.map(a => getAccountFromJSON(a)), }; @@ -473,15 +473,15 @@ describe('decode', () => { expect(result).toEqual(object); }); - // vote asset + // stake asset it(transactionTestCases[1].description, () => { const testCase = transactionTestCases[1]; const output = testCase.output as any; const object = { ...output.object, - votes: output.object.votes.map((v: any) => ({ - delegateAddress: Buffer.from(v.delegateAddress, 'hex'), + stakes: output.object.stakes.map((v: any) => ({ + validatorAddress: Buffer.from(v.validatorAddress, 'hex'), amount: BigInt(v.amount), })), }; diff --git a/elements/lisk-codec/test/encode.spec.ts b/elements/lisk-codec/test/encode.spec.ts index 0986efc242e..c052eeec5d9 100644 --- a/elements/lisk-codec/test/encode.spec.ts +++ b/elements/lisk-codec/test/encode.spec.ts @@ -102,7 +102,7 @@ describe('encode', () => { it.each(buildTestCases(blockTestCases))('%s', ({ input, output }) => { const object = { header: Buffer.from(input.object.header, 'hex'), - transactions: input.object.transactions.map(p => Buffer.from(p, 'hex')), + payload: input.object.payload.map(p => Buffer.from(p, 'hex')), }; const result = codec.encode(input.schema, object); @@ -162,7 +162,7 @@ describe('encode', () => { it.each(buildTestCases(genesisBlockTestCases))('%s', ({ input, output }) => { const object = { ...input.object, - initDelegates: input.object.initDelegates.map(d => Buffer.from(d, 'hex')), + initValidators: input.object.initValidators.map(d => Buffer.from(d, 'hex')), accounts: input.object.accounts.map(a => getAccountFromJSON(a)), }; @@ -301,15 +301,15 @@ describe('encode', () => { expect(result.toString('hex')).toEqual(testCase.output.value); }); - // vote asset + // stake asset it(transactionTestCases[1].description, () => { const testCase = transactionTestCases[1]; const input = testCase.input as any; const object = { ...input.object, - votes: input.object.votes.map((v: any) => ({ - delegateAddress: Buffer.from(v.delegateAddress, 'hex'), + stakes: input.object.stakes.map((v: any) => ({ + validatorAddress: Buffer.from(v.validatorAddress, 'hex'), amount: BigInt(v.amount), })), }; diff --git a/elements/lisk-codec/test/utils.ts b/elements/lisk-codec/test/utils.ts index 16c588a7b01..647a75ecae8 100644 --- a/elements/lisk-codec/test/utils.ts +++ b/elements/lisk-codec/test/utils.ts @@ -35,18 +35,18 @@ export const getAccountFromJSON = (account: any) => ({ }, asset: { ...account.asset, - delegate: { - ...account.asset.delegate, - totalVotesReceived: BigInt(account.asset.delegate.totalVotesReceived), + validator: { + ...account.asset.validator, + totalStakeReceived: BigInt(account.asset.validator.totalStakeReceived), }, - sentVotes: account.asset.sentVotes.map((v: any) => ({ + sentStakes: account.asset.sentStakes.map((v: any) => ({ ...v, - delegateAddress: Buffer.from(v.delegateAddress, 'hex'), + validatorAddress: Buffer.from(v.validatorAddress, 'hex'), amount: BigInt(v.amount), })), unlocking: account.asset.unlocking.map((v: any) => ({ ...v, - delegateAddress: Buffer.from(v.delegateAddress, 'hex'), + validatorAddress: Buffer.from(v.validatorAddress, 'hex'), amount: BigInt(v.amount), })), }, diff --git a/elements/lisk-transaction-pool/fixtures/transactions.json b/elements/lisk-transaction-pool/fixtures/transactions.json index 7e67c486a76..c99d09dc68a 100644 --- a/elements/lisk-transaction-pool/fixtures/transactions.json +++ b/elements/lisk-transaction-pool/fixtures/transactions.json @@ -39,7 +39,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+25215f583d93ad13b51cf3f74b521fd00a0fba8b650974305dcd786e80e83008"], + "stakes": ["+25215f583d93ad13b51cf3f74b521fd00a0fba8b650974305dcd786e80e83008"], "recipientId": "12298336625069163905L", "amount": "0" }, @@ -102,7 +102,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9bb41fce7cae8b2a248ef46aa6f617ab899d71f6e0927d0557b39a1fb749bcb4"], + "stakes": ["+9bb41fce7cae8b2a248ef46aa6f617ab899d71f6e0927d0557b39a1fb749bcb4"], "recipientId": "3747847319783711194L", "amount": "0" }, @@ -165,7 +165,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5ce189eebf2e55818f198cca0d0496ca23a4eaf0fd815cce161703518e0e3a63"], + "stakes": ["+5ce189eebf2e55818f198cca0d0496ca23a4eaf0fd815cce161703518e0e3a63"], "recipientId": "5794491185452817986L", "amount": "0" }, @@ -228,7 +228,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c628ad9fd25034436280be095a114ddaf08267d4edb069671cf563f4c7ffd9ee"], + "stakes": ["+c628ad9fd25034436280be095a114ddaf08267d4edb069671cf563f4c7ffd9ee"], "recipientId": "8523266721081721849L", "amount": "0" }, @@ -291,7 +291,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a1cc98d89088b4aae6279f33f6b488e20e9022c2942a3ad9a45049205a412f74"], + "stakes": ["+a1cc98d89088b4aae6279f33f6b488e20e9022c2942a3ad9a45049205a412f74"], "recipientId": "2632346862538514441L", "amount": "0" }, @@ -354,7 +354,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+d4b99185cf0307954be1f093b74fed64c0a22bd054bf92a0e74190e13208e3d9"], + "stakes": ["+d4b99185cf0307954be1f093b74fed64c0a22bd054bf92a0e74190e13208e3d9"], "recipientId": "17266829266570849889L", "amount": "0" }, @@ -417,7 +417,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b1e4e7b6a34ae07ccf0ee5c80c6d5e6582dcca9bdd5f40b3d1698bf9355c67ff"], + "stakes": ["+b1e4e7b6a34ae07ccf0ee5c80c6d5e6582dcca9bdd5f40b3d1698bf9355c67ff"], "recipientId": "10909963504503064046L", "amount": "0" }, @@ -480,7 +480,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+700498d3b049a31a0fe89f0e1690b843981f327e9550be758bbeca90da114238"], + "stakes": ["+700498d3b049a31a0fe89f0e1690b843981f327e9550be758bbeca90da114238"], "recipientId": "3488588871520979421L", "amount": "0" }, @@ -543,7 +543,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b98cbf431b38f5778eeeda14967485d74794e75dd641ae2fc293e811bb2336ea"], + "stakes": ["+b98cbf431b38f5778eeeda14967485d74794e75dd641ae2fc293e811bb2336ea"], "recipientId": "4337829998959396793L", "amount": "0" }, @@ -606,7 +606,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+6cbef623057bded813a69576a8d8888c3e7079d1f7814b36ba4a3ca1c91f7179"], + "stakes": ["+6cbef623057bded813a69576a8d8888c3e7079d1f7814b36ba4a3ca1c91f7179"], "recipientId": "7618215462200321783L", "amount": "0" }, @@ -669,7 +669,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+004d53519837c3289f0a2889b89b26390408700f228787c2242029f99c3a4bd4"], + "stakes": ["+004d53519837c3289f0a2889b89b26390408700f228787c2242029f99c3a4bd4"], "recipientId": "13643066146532836068L", "amount": "0" }, @@ -732,7 +732,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f7de68db8819ec135c6c53131ede8442532f01c8bef4adeeaa3d747b29270ce3"], + "stakes": ["+f7de68db8819ec135c6c53131ede8442532f01c8bef4adeeaa3d747b29270ce3"], "recipientId": "5282964883603386230L", "amount": "0" }, @@ -795,7 +795,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+04c4fcc82aa7aac403f58dca0840ba702b169d7ffe7d137e80df683453639d24"], + "stakes": ["+04c4fcc82aa7aac403f58dca0840ba702b169d7ffe7d137e80df683453639d24"], "recipientId": "5875215186750376849L", "amount": "0" }, @@ -858,7 +858,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+edc243c7415f3b701e16b52e84c96f812d5981302cda699baed3428cbba9f905"], + "stakes": ["+edc243c7415f3b701e16b52e84c96f812d5981302cda699baed3428cbba9f905"], "recipientId": "372406364815696347L", "amount": "0" }, @@ -921,7 +921,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b39a7a2d4e5fe0fb2a85fc35ae85bfbed5e8e08c45df0a9050157778d77be706"], + "stakes": ["+b39a7a2d4e5fe0fb2a85fc35ae85bfbed5e8e08c45df0a9050157778d77be706"], "recipientId": "11261259397990416889L", "amount": "0" }, @@ -984,7 +984,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+77d10770940304342a225ac52f82d14f644b7abaf8b73964c72cb9c9cfc79dfc"], + "stakes": ["+77d10770940304342a225ac52f82d14f644b7abaf8b73964c72cb9c9cfc79dfc"], "recipientId": "1257244595675313090L", "amount": "0" }, @@ -1047,7 +1047,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c69fbafbc32a175e9606f2faf317a4ab0f7882fda7e0be13a7ea856aa3273892"], + "stakes": ["+c69fbafbc32a175e9606f2faf317a4ab0f7882fda7e0be13a7ea856aa3273892"], "recipientId": "17023349411286843752L", "amount": "0" }, @@ -1110,7 +1110,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+746f38653921761a3c86521a3ce7099d3750729e88800068150e12d456f58f40"], + "stakes": ["+746f38653921761a3c86521a3ce7099d3750729e88800068150e12d456f58f40"], "recipientId": "3174290987810788334L", "amount": "0" }, @@ -1173,7 +1173,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+222f79302bca0e8635c47b35b57be447e5a5028b8258d32644981a64347df1de"], + "stakes": ["+222f79302bca0e8635c47b35b57be447e5a5028b8258d32644981a64347df1de"], "recipientId": "13117683447059096710L", "amount": "0" }, @@ -1236,7 +1236,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+07e68b72b44478c554490b5e7729170900a7948ab07fa5e75f030ac21f3c6acb"], + "stakes": ["+07e68b72b44478c554490b5e7729170900a7948ab07fa5e75f030ac21f3c6acb"], "recipientId": "10723234683574181708L", "amount": "0" }, @@ -1299,7 +1299,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+ec5923d8db97a9cb11933450fdc491167ae1e68348edc9b37b245588ab3325ee"], + "stakes": ["+ec5923d8db97a9cb11933450fdc491167ae1e68348edc9b37b245588ab3325ee"], "recipientId": "12793954300984313557L", "amount": "0" }, @@ -1362,7 +1362,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c003576be4a81d06d8ff3ba0c362c5759b9ae65b091d25d6b25f3fac767fa994"], + "stakes": ["+c003576be4a81d06d8ff3ba0c362c5759b9ae65b091d25d6b25f3fac767fa994"], "recipientId": "13274387365904449694L", "amount": "0" }, @@ -1425,7 +1425,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+467e86205b8aac13a824bd00cf9f48f469fe0344b577079b2bf35e967e26e680"], + "stakes": ["+467e86205b8aac13a824bd00cf9f48f469fe0344b577079b2bf35e967e26e680"], "recipientId": "7049365022267183222L", "amount": "0" }, @@ -1488,7 +1488,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e172e5558f6f8a6d68d221b9f4f7355be72b8d952033d943226e070eee4fada7"], + "stakes": ["+e172e5558f6f8a6d68d221b9f4f7355be72b8d952033d943226e070eee4fada7"], "recipientId": "6556421469083094935L", "amount": "0" }, @@ -1551,7 +1551,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4ed5d92ad9fe266786034af4a1d53c7d9cf137d3ef14cd4d1f96883aecacc6bc"], + "stakes": ["+4ed5d92ad9fe266786034af4a1d53c7d9cf137d3ef14cd4d1f96883aecacc6bc"], "recipientId": "12436360500510125013L", "amount": "0" }, @@ -1614,7 +1614,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f42eeab0a5244787c671372522470a47f721be40bbfeebc30ce7e0492233ba21"], + "stakes": ["+f42eeab0a5244787c671372522470a47f721be40bbfeebc30ce7e0492233ba21"], "recipientId": "9558693083952885061L", "amount": "0" }, @@ -1677,7 +1677,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a0d22e4809586cfacc42c802fa60b8dac04fef6e80734078d4bcce8602b2fffb"], + "stakes": ["+a0d22e4809586cfacc42c802fa60b8dac04fef6e80734078d4bcce8602b2fffb"], "recipientId": "3138991761615412204L", "amount": "0" }, @@ -1740,7 +1740,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bf69eea92f575c5acba52ebea89200cfcd71e4a22f376518b1569c00e11acf1e"], + "stakes": ["+bf69eea92f575c5acba52ebea89200cfcd71e4a22f376518b1569c00e11acf1e"], "recipientId": "15714118231328580921L", "amount": "0" }, @@ -1803,7 +1803,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+93fa6da4b06bc7082f825fc188820daa642f874ecc2149dc8641ec9ddb016415"], + "stakes": ["+93fa6da4b06bc7082f825fc188820daa642f874ecc2149dc8641ec9ddb016415"], "recipientId": "16427464421488253629L", "amount": "0" }, @@ -1866,7 +1866,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5eaea299ffecc2292d9d30ee924566774954bddbfd48b2b725ed733325fc966c"], + "stakes": ["+5eaea299ffecc2292d9d30ee924566774954bddbfd48b2b725ed733325fc966c"], "recipientId": "5526525089372276814L", "amount": "0" }, @@ -1929,7 +1929,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+cd833691bc237fd06a49248d23fc8f9f2255fda4121eaa13b40e633704b4044d"], + "stakes": ["+cd833691bc237fd06a49248d23fc8f9f2255fda4121eaa13b40e633704b4044d"], "recipientId": "7721246606053221973L", "amount": "0" }, @@ -1992,7 +1992,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+dccbf25d59074855d8f226b1c9bce5764684b88bebb2e97bb5f4c90d7aa2f7c8"], + "stakes": ["+dccbf25d59074855d8f226b1c9bce5764684b88bebb2e97bb5f4c90d7aa2f7c8"], "recipientId": "6582134679736962294L", "amount": "0" }, @@ -2055,7 +2055,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+28bc9f8406c08f37313df4ec87519099120368dee910e3fbd3aa3a11b1208423"], + "stakes": ["+28bc9f8406c08f37313df4ec87519099120368dee910e3fbd3aa3a11b1208423"], "recipientId": "6313168133983998307L", "amount": "0" }, @@ -2118,7 +2118,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+07a5284e47b57d4162cd7e2b15c8bea3fe18426270497c6ac7c7d505269f79ca"], + "stakes": ["+07a5284e47b57d4162cd7e2b15c8bea3fe18426270497c6ac7c7d505269f79ca"], "recipientId": "8586968180834075423L", "amount": "0" }, @@ -2181,7 +2181,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+52a2cf39e31454a9adeee343d01af8ca3ac3f21d6d8a918d7505a77b2f4839f3"], + "stakes": ["+52a2cf39e31454a9adeee343d01af8ca3ac3f21d6d8a918d7505a77b2f4839f3"], "recipientId": "17403211532547585358L", "amount": "0" }, @@ -2244,7 +2244,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3784aca9e387484872a172ffa990f268e533823cea6b439d7d08eb083de1d2ac"], + "stakes": ["+3784aca9e387484872a172ffa990f268e533823cea6b439d7d08eb083de1d2ac"], "recipientId": "5679258470572642769L", "amount": "0" }, @@ -2307,7 +2307,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+642abfcd8f699dfdff65a41980dd198555fbeb2a12eb13ef5b158e970dc79141"], + "stakes": ["+642abfcd8f699dfdff65a41980dd198555fbeb2a12eb13ef5b158e970dc79141"], "recipientId": "3972333673817467832L", "amount": "0" }, @@ -2370,7 +2370,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5a815ee6bc625aeff1499a0ecdc2632319885c55de3fdb2ce122e752357ed09c"], + "stakes": ["+5a815ee6bc625aeff1499a0ecdc2632319885c55de3fdb2ce122e752357ed09c"], "recipientId": "2817445091933172704L", "amount": "0" }, @@ -2433,7 +2433,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5b999af8fb15078d7f73056c5db9bd5022781a1a13754484cb9c21c33e9ef7cc"], + "stakes": ["+5b999af8fb15078d7f73056c5db9bd5022781a1a13754484cb9c21c33e9ef7cc"], "recipientId": "4633965557515166026L", "amount": "0" }, @@ -2496,7 +2496,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+97743b2cab1b92884c7a1823bf8c30ee34bb2b37a837657652204c56ee27ef5a"], + "stakes": ["+97743b2cab1b92884c7a1823bf8c30ee34bb2b37a837657652204c56ee27ef5a"], "recipientId": "18217296755194720663L", "amount": "0" }, @@ -2559,7 +2559,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3ef267f62704a1a72ad1473e61129ed2637617f98e5db73fd419f637c8a1d182"], + "stakes": ["+3ef267f62704a1a72ad1473e61129ed2637617f98e5db73fd419f637c8a1d182"], "recipientId": "666781314329054077L", "amount": "0" }, @@ -2622,7 +2622,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c10b31c7ed5587d886cb2569ee38ee27b5b44e6c1d80aecfcf2465a09f86acaf"], + "stakes": ["+c10b31c7ed5587d886cb2569ee38ee27b5b44e6c1d80aecfcf2465a09f86acaf"], "recipientId": "15453881732217608747L", "amount": "0" }, @@ -2685,7 +2685,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0ec2061671ef6685ecef5070ef7bf579ce986d7641f4d04be3b8201a1dc09ed3"], + "stakes": ["+0ec2061671ef6685ecef5070ef7bf579ce986d7641f4d04be3b8201a1dc09ed3"], "recipientId": "10067423873551418982L", "amount": "0" }, @@ -2748,7 +2748,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8f0a1215401ef08d5ebd228198aa8dba53c6cd3aea58f42a62f84d436c2b2dc9"], + "stakes": ["+8f0a1215401ef08d5ebd228198aa8dba53c6cd3aea58f42a62f84d436c2b2dc9"], "recipientId": "15237561450427276449L", "amount": "0" }, @@ -2811,7 +2811,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a4635730b95cf45fd1a5c4e9362bb53906e0d186fa245afff055aa2e23915101"], + "stakes": ["+a4635730b95cf45fd1a5c4e9362bb53906e0d186fa245afff055aa2e23915101"], "recipientId": "13711091592225112085L", "amount": "0" }, @@ -2874,7 +2874,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+df87eaf0b919bd794246961223d41a5a9e5437dd24503ebacff08c2e7915db50"], + "stakes": ["+df87eaf0b919bd794246961223d41a5a9e5437dd24503ebacff08c2e7915db50"], "recipientId": "17367868322943504694L", "amount": "0" }, @@ -2937,7 +2937,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+270f67c47251b1c422eb7a3bfd245fbd45e26fbb054d452877454f040657bac1"], + "stakes": ["+270f67c47251b1c422eb7a3bfd245fbd45e26fbb054d452877454f040657bac1"], "recipientId": "7600798692855975651L", "amount": "0" }, @@ -3000,7 +3000,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a71d922a869d07f35f5fc79e23065bea36b25b9b625d0248ce7386530f002729"], + "stakes": ["+a71d922a869d07f35f5fc79e23065bea36b25b9b625d0248ce7386530f002729"], "recipientId": "1600476336849154505L", "amount": "0" }, @@ -3063,7 +3063,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4935adbd5ca9ad4ce6ef994d8d592e9669c78450686bad820cfb22a41cf3e217"], + "stakes": ["+4935adbd5ca9ad4ce6ef994d8d592e9669c78450686bad820cfb22a41cf3e217"], "recipientId": "7739449823295881692L", "amount": "0" }, @@ -3126,7 +3126,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5c368135825c854c33ee143d435ab87f22688ca1548ba0dd64522c9ace1f1475"], + "stakes": ["+5c368135825c854c33ee143d435ab87f22688ca1548ba0dd64522c9ace1f1475"], "recipientId": "4869611128516759332L", "amount": "0" }, @@ -3189,7 +3189,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+310e1eab6db7c2081bdfdc9f4d877f8a9fae7dec7be3de9d483badaf6d3992a9"], + "stakes": ["+310e1eab6db7c2081bdfdc9f4d877f8a9fae7dec7be3de9d483badaf6d3992a9"], "recipientId": "2297631283214184578L", "amount": "0" }, @@ -3252,7 +3252,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+7ba9a9f6710dc07bf77a8d53d717e2083207d158650af032e0825758516c251a"], + "stakes": ["+7ba9a9f6710dc07bf77a8d53d717e2083207d158650af032e0825758516c251a"], "recipientId": "13540625599369657033L", "amount": "0" }, @@ -3315,7 +3315,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+36a2ee4088aa6b9b7b07f86d21fb5928ec8193d26e425a98c51cde39597ee894"], + "stakes": ["+36a2ee4088aa6b9b7b07f86d21fb5928ec8193d26e425a98c51cde39597ee894"], "recipientId": "864881789245260221L", "amount": "0" }, @@ -3378,7 +3378,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+69e254b8f41d93d228962153ae37d83d200a06f173b5effae8a3bf4c0c28b4fc"], + "stakes": ["+69e254b8f41d93d228962153ae37d83d200a06f173b5effae8a3bf4c0c28b4fc"], "recipientId": "573465499993194130L", "amount": "0" }, @@ -3441,7 +3441,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+05ebd956f173c6e6848cd1173efa91d6f1e69982b2f46982e0efecc86dd558e2"], + "stakes": ["+05ebd956f173c6e6848cd1173efa91d6f1e69982b2f46982e0efecc86dd558e2"], "recipientId": "1957993454347503616L", "amount": "0" }, @@ -3504,7 +3504,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9e1665fd37a7643f5859fd91568d1783f33838b10c9dd0ebd138fe80a33fb734"], + "stakes": ["+9e1665fd37a7643f5859fd91568d1783f33838b10c9dd0ebd138fe80a33fb734"], "recipientId": "7567346131303514705L", "amount": "0" }, @@ -3567,7 +3567,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+857216773288b7f6ae72fc406e78a63d9d0d7dc1d01affde0ecc975ac15120ea"], + "stakes": ["+857216773288b7f6ae72fc406e78a63d9d0d7dc1d01affde0ecc975ac15120ea"], "recipientId": "6484331694260405055L", "amount": "0" }, @@ -3630,7 +3630,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b4a0106962cf18380fbecaa7d3468e0ff8c9246dfb63c3362db1af944be5871d"], + "stakes": ["+b4a0106962cf18380fbecaa7d3468e0ff8c9246dfb63c3362db1af944be5871d"], "recipientId": "12138856705023269842L", "amount": "0" }, @@ -3693,7 +3693,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f7e5c8b610fe008c212bee9701acb0a34c64fed38f7fda0e15a96e37809087fe"], + "stakes": ["+f7e5c8b610fe008c212bee9701acb0a34c64fed38f7fda0e15a96e37809087fe"], "recipientId": "13628188138437539735L", "amount": "0" }, @@ -3756,7 +3756,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4f8976b6cb26c6d63adc9085a29cd7868a69cd222aedb0861b270eb9af55ae2b"], + "stakes": ["+4f8976b6cb26c6d63adc9085a29cd7868a69cd222aedb0861b270eb9af55ae2b"], "recipientId": "15979827488030900437L", "amount": "0" }, @@ -3819,7 +3819,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a5ab4bc66443c0390bc3ea1d81a956af22a60848b30ffca17d966d3ab138e94e"], + "stakes": ["+a5ab4bc66443c0390bc3ea1d81a956af22a60848b30ffca17d966d3ab138e94e"], "recipientId": "6463707033609101884L", "amount": "0" }, @@ -3882,7 +3882,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9f00ebd27711d06ef917809e59553ab8d4464d1bacd48315881562a6df9312ce"], + "stakes": ["+9f00ebd27711d06ef917809e59553ab8d4464d1bacd48315881562a6df9312ce"], "recipientId": "2620728400056693845L", "amount": "0" }, @@ -3945,7 +3945,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+2cbcd6eeeb208363e71de31e9f77d069bb153e551eb5db5a7f014906d3b4155b"], + "stakes": ["+2cbcd6eeeb208363e71de31e9f77d069bb153e551eb5db5a7f014906d3b4155b"], "recipientId": "7092421626858565089L", "amount": "0" }, @@ -4008,7 +4008,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a5ec20fda5c263eed32bb7f4af640a6f3865077c2801b2a56af8a28ebd6701ec"], + "stakes": ["+a5ec20fda5c263eed32bb7f4af640a6f3865077c2801b2a56af8a28ebd6701ec"], "recipientId": "8991647492352376810L", "amount": "0" }, @@ -4071,7 +4071,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+fd0aedad4fcf996eadab8f64c2a549360ae880597c6e6d536646063aae359d11"], + "stakes": ["+fd0aedad4fcf996eadab8f64c2a549360ae880597c6e6d536646063aae359d11"], "recipientId": "10592856102130455468L", "amount": "0" }, @@ -4134,7 +4134,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+dfb9e7398bea08f7e7535eff06155284fd890ed96d3daa20c910e8d9e84f4a18"], + "stakes": ["+dfb9e7398bea08f7e7535eff06155284fd890ed96d3daa20c910e8d9e84f4a18"], "recipientId": "15076415483326273316L", "amount": "0" }, @@ -4197,7 +4197,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0499185401817391c9bfdde1bd4a612f7ca322bb400ae1ce0b4d3adb438e1c0a"], + "stakes": ["+0499185401817391c9bfdde1bd4a612f7ca322bb400ae1ce0b4d3adb438e1c0a"], "recipientId": "11533093589842670896L", "amount": "0" }, @@ -4260,7 +4260,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9607212e8d7f0b49f1cdae74e57f950c3e4c5fd5e5cae7aba55f06fcd629409b"], + "stakes": ["+9607212e8d7f0b49f1cdae74e57f950c3e4c5fd5e5cae7aba55f06fcd629409b"], "recipientId": "5239508044876751503L", "amount": "0" }, @@ -4323,7 +4323,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+1625403fc2c9c417d1caeb104206d46c13a626d23c7d14a12ff4c032e1af2587"], + "stakes": ["+1625403fc2c9c417d1caeb104206d46c13a626d23c7d14a12ff4c032e1af2587"], "recipientId": "12074326587988059764L", "amount": "0" }, @@ -4386,7 +4386,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c3461d9a97f2f6b1750f7bda9532b65b6252bdaefa5a7368846490e8694d9c04"], + "stakes": ["+c3461d9a97f2f6b1750f7bda9532b65b6252bdaefa5a7368846490e8694d9c04"], "recipientId": "16747552654097155732L", "amount": "0" }, @@ -4449,7 +4449,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+910d802b398c096f9f68cb5dfb2f237028da9b7d25f4d997e43361bf3b9eb2a5"], + "stakes": ["+910d802b398c096f9f68cb5dfb2f237028da9b7d25f4d997e43361bf3b9eb2a5"], "recipientId": "6288876117737393283L", "amount": "0" }, @@ -4512,7 +4512,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f9ccf5ba72337ba4feb4ed0d7bdaccd4e609b3f1638b9a7ff082efa38486c2e7"], + "stakes": ["+f9ccf5ba72337ba4feb4ed0d7bdaccd4e609b3f1638b9a7ff082efa38486c2e7"], "recipientId": "10740561143240537279L", "amount": "0" }, @@ -4575,7 +4575,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+228bbf1abfe77285541d501c0cc9dca93e386243c1d8ac62c0a7df68593bfe75"], + "stakes": ["+228bbf1abfe77285541d501c0cc9dca93e386243c1d8ac62c0a7df68593bfe75"], "recipientId": "12463861798866987577L", "amount": "0" }, @@ -4638,7 +4638,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0582ab087459e9a003540fff3d53dc31cfc2959fe0a52aff7c6ebf4f201907f4"], + "stakes": ["+0582ab087459e9a003540fff3d53dc31cfc2959fe0a52aff7c6ebf4f201907f4"], "recipientId": "16512507299434191375L", "amount": "0" }, @@ -4701,7 +4701,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a4d639f3570f33a39d7c8713ea0ec9869c434a051cc0d26aa769c9c5626bae19"], + "stakes": ["+a4d639f3570f33a39d7c8713ea0ec9869c434a051cc0d26aa769c9c5626bae19"], "recipientId": "12855517753836685925L", "amount": "0" }, @@ -4764,7 +4764,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+67a9a0f490be0897f46febe1268b39998720ef3d408520443cd3312b50178015"], + "stakes": ["+67a9a0f490be0897f46febe1268b39998720ef3d408520443cd3312b50178015"], "recipientId": "16325501434090710761L", "amount": "0" }, @@ -4827,7 +4827,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+2a4a16d25501494d00ffa49f2ecd8002f46ee1f07d4a4678fafb96780d78e143"], + "stakes": ["+2a4a16d25501494d00ffa49f2ecd8002f46ee1f07d4a4678fafb96780d78e143"], "recipientId": "5424660779191033983L", "amount": "0" }, @@ -4890,7 +4890,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+246218b0ac0a4c1f8f5bfbfa205d6600e175d03083c98c0e0df0810e0e6055ed"], + "stakes": ["+246218b0ac0a4c1f8f5bfbfa205d6600e175d03083c98c0e0df0810e0e6055ed"], "recipientId": "14182590104752563275L", "amount": "0" }, @@ -4953,7 +4953,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4644c4362150ba6476dcb25d1b2381a1e75501cd6da6c3531a388a98abe3342d"], + "stakes": ["+4644c4362150ba6476dcb25d1b2381a1e75501cd6da6c3531a388a98abe3342d"], "recipientId": "5893534871285256844L", "amount": "0" }, @@ -5016,7 +5016,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9e1f5fe2bb7eb8b0ceb3e42a478eadd2ba5a68cbf44401e3132349b899b52ffb"], + "stakes": ["+9e1f5fe2bb7eb8b0ceb3e42a478eadd2ba5a68cbf44401e3132349b899b52ffb"], "recipientId": "12010045913570566959L", "amount": "0" }, @@ -5079,7 +5079,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0251d537d3278f0317f306e5cd7691363428aa502cdececbd91396aa83ce0135"], + "stakes": ["+0251d537d3278f0317f306e5cd7691363428aa502cdececbd91396aa83ce0135"], "recipientId": "16827243971064478236L", "amount": "0" }, @@ -5142,7 +5142,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+1f86c69d53d6b0d1c2a4853cc34e87dfa59c3aaabe2afcbbdb3d72ea6e9d8235"], + "stakes": ["+1f86c69d53d6b0d1c2a4853cc34e87dfa59c3aaabe2afcbbdb3d72ea6e9d8235"], "recipientId": "10906820577572630968L", "amount": "0" }, @@ -5205,7 +5205,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bbc825a2aedc3506e32dbef71c588a30010d5e59fd1eaea147db90c790acf96e"], + "stakes": ["+bbc825a2aedc3506e32dbef71c588a30010d5e59fd1eaea147db90c790acf96e"], "recipientId": "15699053529071456783L", "amount": "0" }, @@ -5268,7 +5268,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+14aeb4d00f5e68665521de7c834d4d68cc93e66c18dc8b36063c05feaf3afb24"], + "stakes": ["+14aeb4d00f5e68665521de7c834d4d68cc93e66c18dc8b36063c05feaf3afb24"], "recipientId": "5393322898190002128L", "amount": "0" }, @@ -5331,7 +5331,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e57fc2681b64d55c688fd0870550da15f9b236a9edd12138740485b20854046d"], + "stakes": ["+e57fc2681b64d55c688fd0870550da15f9b236a9edd12138740485b20854046d"], "recipientId": "5851974412947226044L", "amount": "0" }, @@ -5394,7 +5394,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+49d16844a506405d10a3cd02934c7c1944ab21905791c19e5d6e0748d1229c52"], + "stakes": ["+49d16844a506405d10a3cd02934c7c1944ab21905791c19e5d6e0748d1229c52"], "recipientId": "6777236461751864770L", "amount": "0" }, @@ -5457,7 +5457,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f91c6be7b1e6da47f2ce854b3e4093fd9492aac36a9966ffd1b0e5484a5d37f9"], + "stakes": ["+f91c6be7b1e6da47f2ce854b3e4093fd9492aac36a9966ffd1b0e5484a5d37f9"], "recipientId": "13610022076702374368L", "amount": "0" }, @@ -5520,7 +5520,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+eea4b464f99d5e0c8f6d975371b0663747207e00e939d3776902b0f67cf18db5"], + "stakes": ["+eea4b464f99d5e0c8f6d975371b0663747207e00e939d3776902b0f67cf18db5"], "recipientId": "3993995081251903465L", "amount": "0" }, @@ -5583,7 +5583,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+97bcf0f41eb78289d9ecf0fcb746f95b462784dd2d8f72f95663f7cafb9b3155"], + "stakes": ["+97bcf0f41eb78289d9ecf0fcb746f95b462784dd2d8f72f95663f7cafb9b3155"], "recipientId": "3045169695963396886L", "amount": "0" }, @@ -5646,7 +5646,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b9c0e4512141c5fc6b6f6eb9bfd4c2fc6ae6de9bd28e9fa5e4938dbd65733b08"], + "stakes": ["+b9c0e4512141c5fc6b6f6eb9bfd4c2fc6ae6de9bd28e9fa5e4938dbd65733b08"], "recipientId": "5618804553878583657L", "amount": "0" }, @@ -5709,7 +5709,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+111a6cc73528309345673de245ba99e22d06a050874538095129722a6a337435"], + "stakes": ["+111a6cc73528309345673de245ba99e22d06a050874538095129722a6a337435"], "recipientId": "3287133389630663844L", "amount": "0" }, @@ -5772,7 +5772,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+832642952bb7848cef31227b68d571169d432195acae5b630a6d2ba622d12546"], + "stakes": ["+832642952bb7848cef31227b68d571169d432195acae5b630a6d2ba622d12546"], "recipientId": "8948421607304929286L", "amount": "0" }, @@ -5835,7 +5835,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+74eb7469b54b87544c3865282ef64b14f9a78ebe074854d30665d155644bd7ad"], + "stakes": ["+74eb7469b54b87544c3865282ef64b14f9a78ebe074854d30665d155644bd7ad"], "recipientId": "7680350476340506614L", "amount": "0" }, @@ -5898,7 +5898,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0b9130beab3528cab7c4380356cd93c7e672259355ce41a78a182f00dbbdb365"], + "stakes": ["+0b9130beab3528cab7c4380356cd93c7e672259355ce41a78a182f00dbbdb365"], "recipientId": "6487574859072015252L", "amount": "0" }, @@ -5961,7 +5961,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3cff66f6ae6172b072b94405b4361bc3b418f29d5528be19cef5d0bb3bb5fa23"], + "stakes": ["+3cff66f6ae6172b072b94405b4361bc3b418f29d5528be19cef5d0bb3bb5fa23"], "recipientId": "3032920508415710378L", "amount": "0" }, @@ -6024,7 +6024,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b69e54d21eb094c5e2974eabb6a87151bbb273189f88055ac0250b2eff10ea53"], + "stakes": ["+b69e54d21eb094c5e2974eabb6a87151bbb273189f88055ac0250b2eff10ea53"], "recipientId": "14131578053375283885L", "amount": "0" }, @@ -6087,7 +6087,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+72bd63ee2f0f4e32e32e83ea2cf40935b12d2de308df583a9bbccbb88aa73a81"], + "stakes": ["+72bd63ee2f0f4e32e32e83ea2cf40935b12d2de308df583a9bbccbb88aa73a81"], "recipientId": "12539770102310253441L", "amount": "0" }, @@ -6150,7 +6150,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4aefbc90ac0097dc3e0bd0ebade85cd82766f4685a59f31042ef1ccc626e31c0"], + "stakes": ["+4aefbc90ac0097dc3e0bd0ebade85cd82766f4685a59f31042ef1ccc626e31c0"], "recipientId": "7468093180593042900L", "amount": "0" }, @@ -6213,7 +6213,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5225496e341a5960cf6ac36e90493c89bb37c1982e6c337928b5b12d31932cc6"], + "stakes": ["+5225496e341a5960cf6ac36e90493c89bb37c1982e6c337928b5b12d31932cc6"], "recipientId": "8039639842131530462L", "amount": "0" }, @@ -6276,7 +6276,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bad88f9f7b214135781b3a4db570a69804ee62e0e161b2c6a5b8e92b2e6bc84e"], + "stakes": ["+bad88f9f7b214135781b3a4db570a69804ee62e0e161b2c6a5b8e92b2e6bc84e"], "recipientId": "14912175472599030472L", "amount": "0" }, @@ -6339,7 +6339,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+d074d1db8fef3953e4808ae5495ec8a2ab7467f6c7441d2bc9abcd61d95e169e"], + "stakes": ["+d074d1db8fef3953e4808ae5495ec8a2ab7467f6c7441d2bc9abcd61d95e169e"], "recipientId": "14500669038813455569L", "amount": "0" }, @@ -6402,7 +6402,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8cd1d6d0465d7272b203c6f9ca35dd664e8798ffe62209ea5af90985c081731b"], + "stakes": ["+8cd1d6d0465d7272b203c6f9ca35dd664e8798ffe62209ea5af90985c081731b"], "recipientId": "3430046214873810255L", "amount": "0" }, @@ -6465,7 +6465,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+aec4e8fe9dded6937c26bdfede10d6b88946241cd87be9edc540056032c6b511"], + "stakes": ["+aec4e8fe9dded6937c26bdfede10d6b88946241cd87be9edc540056032c6b511"], "recipientId": "16516747851220724447L", "amount": "0" }, @@ -6528,7 +6528,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+eed09f07896c16c0c94d2608b974800a09ef95be2e94b07ddd538d8bdb43aa43"], + "stakes": ["+eed09f07896c16c0c94d2608b974800a09ef95be2e94b07ddd538d8bdb43aa43"], "recipientId": "10972103432408482162L", "amount": "0" }, @@ -6591,7 +6591,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3d7a4b522709748e8ddbc286f3109d33bee5b394a2bdb1269b065b78132a4487"], + "stakes": ["+3d7a4b522709748e8ddbc286f3109d33bee5b394a2bdb1269b065b78132a4487"], "recipientId": "15873561270753252877L", "amount": "0" }, @@ -6654,7 +6654,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+badc5c9df73e713dfea6a99af8053f50b22b3110464c6ae58921c4c316755564"], + "stakes": ["+badc5c9df73e713dfea6a99af8053f50b22b3110464c6ae58921c4c316755564"], "recipientId": "17849699930152083990L", "amount": "0" }, @@ -6717,7 +6717,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+7c44c88b7ae0b9dfad5cbca35f738bc826d23107d6411ab0ba2ff2d115949606"], + "stakes": ["+7c44c88b7ae0b9dfad5cbca35f738bc826d23107d6411ab0ba2ff2d115949606"], "recipientId": "7143152327339961892L", "amount": "0" }, @@ -6780,7 +6780,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+20d1f2632be2689d4b54ff2d2c5fa2ebf14e01a897477ec462e75a1986578ce7"], + "stakes": ["+20d1f2632be2689d4b54ff2d2c5fa2ebf14e01a897477ec462e75a1986578ce7"], "recipientId": "2549133345932177907L", "amount": "0" }, @@ -6843,7 +6843,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3c10b37399414e58e17b901b98e25bd5ae365a2376c278b3c420571b3eba9f45"], + "stakes": ["+3c10b37399414e58e17b901b98e25bd5ae365a2376c278b3c420571b3eba9f45"], "recipientId": "9438125228453050361L", "amount": "0" }, @@ -6906,7 +6906,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+803055ec150a3ab8aad7c06fb28e21be7ba20eb99460fe36e5fad6cbeb764399"], + "stakes": ["+803055ec150a3ab8aad7c06fb28e21be7ba20eb99460fe36e5fad6cbeb764399"], "recipientId": "3916024107904997998L", "amount": "0" }, @@ -6969,7 +6969,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+28dc06c7f9774d215a2511a0761f8dbb285418438808afb8f63b265fe0bc4ddc"], + "stakes": ["+28dc06c7f9774d215a2511a0761f8dbb285418438808afb8f63b265fe0bc4ddc"], "recipientId": "1938412918027918963L", "amount": "0" }, @@ -7032,7 +7032,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+01d3afa9417499f056f73e980fb1acf6cbc3ddc5fd50ffa38715ec4f1a49a29b"], + "stakes": ["+01d3afa9417499f056f73e980fb1acf6cbc3ddc5fd50ffa38715ec4f1a49a29b"], "recipientId": "3667006431484213724L", "amount": "0" }, @@ -7095,7 +7095,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b6f0b680d976cadc763cd71caf2c3495f81c5ef07bb2518ae1ec81256bb2a360"], + "stakes": ["+b6f0b680d976cadc763cd71caf2c3495f81c5ef07bb2518ae1ec81256bb2a360"], "recipientId": "6625949790222269428L", "amount": "0" }, @@ -7158,7 +7158,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+20b323a973d982b855bf7c373899aadea934b09e39b45e5852ee251e88f8fc2e"], + "stakes": ["+20b323a973d982b855bf7c373899aadea934b09e39b45e5852ee251e88f8fc2e"], "recipientId": "2532318941103971096L", "amount": "0" }, @@ -7221,7 +7221,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c43068ed5194cc2d64068c5ebce55db5e7cc50cf8d9e1990ed794c7f98e57f07"], + "stakes": ["+c43068ed5194cc2d64068c5ebce55db5e7cc50cf8d9e1990ed794c7f98e57f07"], "recipientId": "12277599915277509534L", "amount": "0" }, @@ -7284,7 +7284,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f842a88a982e2e115debdf763cf87894ae2a79fa62fa92aa18a21943212f8aa6"], + "stakes": ["+f842a88a982e2e115debdf763cf87894ae2a79fa62fa92aa18a21943212f8aa6"], "recipientId": "12989474873841150704L", "amount": "0" }, @@ -7347,7 +7347,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+75e4e3ec9d84884f4251e261d8cf5ac73f1b1d80029a4f8cb1859e0664bbb625"], + "stakes": ["+75e4e3ec9d84884f4251e261d8cf5ac73f1b1d80029a4f8cb1859e0664bbb625"], "recipientId": "13315625913407116641L", "amount": "0" }, @@ -7410,7 +7410,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+49a7c781bf9a78afa071dfb1f458522d70d5026b7bd0873301a99c130c7d74fe"], + "stakes": ["+49a7c781bf9a78afa071dfb1f458522d70d5026b7bd0873301a99c130c7d74fe"], "recipientId": "4097147014844535493L", "amount": "0" }, @@ -7473,7 +7473,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3b1027e5c95eaf4fa9e6becb0691c67f8168a2a37abff281748b0ab6a9f543fb"], + "stakes": ["+3b1027e5c95eaf4fa9e6becb0691c67f8168a2a37abff281748b0ab6a9f543fb"], "recipientId": "2351907297337713922L", "amount": "0" }, @@ -7536,7 +7536,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+3b71d14fab58d23e5282f0f890646920e0160da0d31b858458f0b88337212343"], + "stakes": ["+3b71d14fab58d23e5282f0f890646920e0160da0d31b858458f0b88337212343"], "recipientId": "17265865472587794602L", "amount": "0" }, @@ -7599,7 +7599,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e0d4022efd7f873b34687d6e1f5df33f49b5a50430893d0418b4191556c39489"], + "stakes": ["+e0d4022efd7f873b34687d6e1f5df33f49b5a50430893d0418b4191556c39489"], "recipientId": "3182358207667693329L", "amount": "0" }, @@ -7662,7 +7662,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f137223b815c8b0c3b7ddfbf663217cc44d4e630befe0d3acdb0251e5c324b08"], + "stakes": ["+f137223b815c8b0c3b7ddfbf663217cc44d4e630befe0d3acdb0251e5c324b08"], "recipientId": "12272175868892632797L", "amount": "0" }, @@ -7725,7 +7725,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+303b1c4ffc1a6ff979d7257468f44344b21b070adcb1909636340bb9510ff1b3"], + "stakes": ["+303b1c4ffc1a6ff979d7257468f44344b21b070adcb1909636340bb9510ff1b3"], "recipientId": "13431630650517718259L", "amount": "0" }, @@ -7788,7 +7788,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+212e4ea4cbe06c8899d79f3fad601c8ee28054622a0c674b41d8829b62cc4ebe"], + "stakes": ["+212e4ea4cbe06c8899d79f3fad601c8ee28054622a0c674b41d8829b62cc4ebe"], "recipientId": "8748614421722402938L", "amount": "0" }, @@ -7851,7 +7851,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8ed9ca44d7cd75e6c68311c1b7367c4ec1fe58e4e662befa055f2b9990e8596b"], + "stakes": ["+8ed9ca44d7cd75e6c68311c1b7367c4ec1fe58e4e662befa055f2b9990e8596b"], "recipientId": "13486017742700136515L", "amount": "0" }, @@ -7914,7 +7914,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bdcfdc67cfe2b6b7f874af23f4c8d34fb5a3f95168ccfd0fe112fffd9ee342b1"], + "stakes": ["+bdcfdc67cfe2b6b7f874af23f4c8d34fb5a3f95168ccfd0fe112fffd9ee342b1"], "recipientId": "9419095812884114909L", "amount": "0" }, @@ -7977,7 +7977,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+257777e31b4879eea6f70c07428d72148e1e53c3ae6793fa613e47b4cabe09dc"], + "stakes": ["+257777e31b4879eea6f70c07428d72148e1e53c3ae6793fa613e47b4cabe09dc"], "recipientId": "10665749510945097506L", "amount": "0" }, @@ -8040,7 +8040,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+39cc310c31327bab431b5cb5aeceb749f079c9b95181128a565b0a60aa0e3a25"], + "stakes": ["+39cc310c31327bab431b5cb5aeceb749f079c9b95181128a565b0a60aa0e3a25"], "recipientId": "1543378874947842209L", "amount": "0" }, @@ -8103,7 +8103,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+d26f3805d2eb44819101142b651d3a6def9feb5141750f55ac8cf456508b084f"], + "stakes": ["+d26f3805d2eb44819101142b651d3a6def9feb5141750f55ac8cf456508b084f"], "recipientId": "1860461577684079264L", "amount": "0" }, @@ -8166,7 +8166,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e16bcd555f17db4e4e8966f1a4ca55f9f028f647d736b742e516873ffe43bc14"], + "stakes": ["+e16bcd555f17db4e4e8966f1a4ca55f9f028f647d736b742e516873ffe43bc14"], "recipientId": "5984792984008367575L", "amount": "0" }, @@ -8229,7 +8229,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9562c1a2baa92670c9afed500af66cac91409e0fad648f00bdb2b49fadc6dbdd"], + "stakes": ["+9562c1a2baa92670c9afed500af66cac91409e0fad648f00bdb2b49fadc6dbdd"], "recipientId": "17688246838540961114L", "amount": "0" }, @@ -8292,7 +8292,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+1900fab7d59c32119bd94b0dd40de1c8c4095ddd29b9f9296a1a14930c6dfb9b"], + "stakes": ["+1900fab7d59c32119bd94b0dd40de1c8c4095ddd29b9f9296a1a14930c6dfb9b"], "recipientId": "12426322581046583489L", "amount": "0" }, @@ -8355,7 +8355,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8fd722d05867f3b7bb866ea9a475d1fc3b0f274fc4fc7338199ba1dd135dbc40"], + "stakes": ["+8fd722d05867f3b7bb866ea9a475d1fc3b0f274fc4fc7338199ba1dd135dbc40"], "recipientId": "18361026162829954637L", "amount": "0" }, @@ -8418,7 +8418,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+15dfdc372f7e1522bf0fff764644521de327f6076fd5f5d8ca9cf20efc6a4dff"], + "stakes": ["+15dfdc372f7e1522bf0fff764644521de327f6076fd5f5d8ca9cf20efc6a4dff"], "recipientId": "4447810648093978479L", "amount": "0" }, @@ -8481,7 +8481,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+9b8221b4eb2977dee9a6b4e8fce06115370138c8548b8eeec635fbb6abf85563"], + "stakes": ["+9b8221b4eb2977dee9a6b4e8fce06115370138c8548b8eeec635fbb6abf85563"], "recipientId": "13937493016465070517L", "amount": "0" }, @@ -8544,7 +8544,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a6ca54255c4caa9bb12e3e4fd9d1fc4224be079cc3ee8f45a0183c026eb780d9"], + "stakes": ["+a6ca54255c4caa9bb12e3e4fd9d1fc4224be079cc3ee8f45a0183c026eb780d9"], "recipientId": "16739373691139928407L", "amount": "0" }, @@ -8607,7 +8607,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8c0f8fc5be269c1e3ca9ba297726724b01877a406847cf36e7d84dd8e44b15c5"], + "stakes": ["+8c0f8fc5be269c1e3ca9ba297726724b01877a406847cf36e7d84dd8e44b15c5"], "recipientId": "4806469903362416770L", "amount": "0" }, @@ -8670,7 +8670,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+29672a3673b1da494b9bfea408ad974a076a162f228f49611a7b57bdd1328811"], + "stakes": ["+29672a3673b1da494b9bfea408ad974a076a162f228f49611a7b57bdd1328811"], "recipientId": "10346253556425626732L", "amount": "0" }, @@ -8733,7 +8733,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+4bab5bb5bb1d5faf77a17e08825062324d3a0432fb565a18167f0eeced801a8f"], + "stakes": ["+4bab5bb5bb1d5faf77a17e08825062324d3a0432fb565a18167f0eeced801a8f"], "recipientId": "6643177689096071963L", "amount": "0" }, @@ -8796,7 +8796,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c84ce13ca70e11ee3db85962b470a6bef9c036ceef718bfca28b2d853f0a42a9"], + "stakes": ["+c84ce13ca70e11ee3db85962b470a6bef9c036ceef718bfca28b2d853f0a42a9"], "recipientId": "320853526084300214L", "amount": "0" }, @@ -8859,7 +8859,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a35f02afa6cd32b08e1ed33b8114349eef18d9e3cb8296bc61693c31c00c46c4"], + "stakes": ["+a35f02afa6cd32b08e1ed33b8114349eef18d9e3cb8296bc61693c31c00c46c4"], "recipientId": "3904504284084393779L", "amount": "0" }, @@ -8922,7 +8922,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+ae8dde42864db63b32c65720082cf0c8cf3d80be8012e2b7ad100139a51c926c"], + "stakes": ["+ae8dde42864db63b32c65720082cf0c8cf3d80be8012e2b7ad100139a51c926c"], "recipientId": "5226528019016360010L", "amount": "0" }, @@ -8985,7 +8985,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+15d2e4927945fc65e7016e5a899694e54f7ad6fb9cd8c0d029866e828738450b"], + "stakes": ["+15d2e4927945fc65e7016e5a899694e54f7ad6fb9cd8c0d029866e828738450b"], "recipientId": "6128170150568124446L", "amount": "0" }, @@ -9048,7 +9048,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+42e7195c8ed019c2af2ee851a4c3bc5d7acc8f1172bedfef96bcb81018cab508"], + "stakes": ["+42e7195c8ed019c2af2ee851a4c3bc5d7acc8f1172bedfef96bcb81018cab508"], "recipientId": "15214578104668437953L", "amount": "0" }, @@ -9111,7 +9111,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+441a57f8dc3685c4c73d28670739f11b6932545c3f65d24d893827f4fbe4fdce"], + "stakes": ["+441a57f8dc3685c4c73d28670739f11b6932545c3f65d24d893827f4fbe4fdce"], "recipientId": "11624639864567871688L", "amount": "0" }, @@ -9174,7 +9174,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+d89b7e937977843e9e247ca4adf493a018c2bfc3ad1076f2507f261335779fc0"], + "stakes": ["+d89b7e937977843e9e247ca4adf493a018c2bfc3ad1076f2507f261335779fc0"], "recipientId": "8071676643666065131L", "amount": "0" }, @@ -9237,7 +9237,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+dcbf5ba23d5e1966d13f73ff78c3fa59f7ec088c666d2c0997e96c3367cb42dd"], + "stakes": ["+dcbf5ba23d5e1966d13f73ff78c3fa59f7ec088c666d2c0997e96c3367cb42dd"], "recipientId": "13093347258327855019L", "amount": "0" }, @@ -9300,7 +9300,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+317d6c8745b99e32e07fc0429450375804eae6ed652f0afd4ebfce6bc906ab1c"], + "stakes": ["+317d6c8745b99e32e07fc0429450375804eae6ed652f0afd4ebfce6bc906ab1c"], "recipientId": "14608684293975358257L", "amount": "0" }, @@ -9363,7 +9363,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+07a4a89c9d1f6b78f648a15668e141c43465f7f2104691934fcdb693635d786f"], + "stakes": ["+07a4a89c9d1f6b78f648a15668e141c43465f7f2104691934fcdb693635d786f"], "recipientId": "399687885325683754L", "amount": "0" }, @@ -9426,7 +9426,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+49332227fc350f1d7957d558d9715b407e7077777e7b9caa1b95174bebc2162c"], + "stakes": ["+49332227fc350f1d7957d558d9715b407e7077777e7b9caa1b95174bebc2162c"], "recipientId": "8169435304351891655L", "amount": "0" }, @@ -9489,7 +9489,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+612161b73cb67acfdfec56cd50975182ec747ed45ee1b829a0b20b11614de4e1"], + "stakes": ["+612161b73cb67acfdfec56cd50975182ec747ed45ee1b829a0b20b11614de4e1"], "recipientId": "6718335082194300758L", "amount": "0" }, @@ -9552,7 +9552,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5238c57931fab65bb9a6e6d105be2ce71b0b67db2258c1b1e10ea26aec312d4f"], + "stakes": ["+5238c57931fab65bb9a6e6d105be2ce71b0b67db2258c1b1e10ea26aec312d4f"], "recipientId": "1312749963746460682L", "amount": "0" }, @@ -9615,7 +9615,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+651410e5145768b973ada60fd6de5d1973aadc0743a05b2cb0c4844322502b47"], + "stakes": ["+651410e5145768b973ada60fd6de5d1973aadc0743a05b2cb0c4844322502b47"], "recipientId": "1357930661074762850L", "amount": "0" }, @@ -9678,7 +9678,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+5ca9c2d799b878d2627f0952fa0852380e4c5f089a10ef3b7a26bb9b8f22ec66"], + "stakes": ["+5ca9c2d799b878d2627f0952fa0852380e4c5f089a10ef3b7a26bb9b8f22ec66"], "recipientId": "7987928967922230013L", "amount": "0" }, @@ -9741,7 +9741,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+2b50c09051a480454a6153377b857206d626da3b2b1a78e3cda54cd666a8e676"], + "stakes": ["+2b50c09051a480454a6153377b857206d626da3b2b1a78e3cda54cd666a8e676"], "recipientId": "3190776667541768693L", "amount": "0" }, @@ -9804,7 +9804,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bc1b7f26fe27aff384d7538a54856f89a43fd2e120dbbab8060586303577079f"], + "stakes": ["+bc1b7f26fe27aff384d7538a54856f89a43fd2e120dbbab8060586303577079f"], "recipientId": "12313615574089710672L", "amount": "0" }, @@ -9867,7 +9867,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+55248d11da7d0cb7688147da8a2b21e63550e54e4eca07708d58d1fd8d5a01a8"], + "stakes": ["+55248d11da7d0cb7688147da8a2b21e63550e54e4eca07708d58d1fd8d5a01a8"], "recipientId": "10069992613393200607L", "amount": "0" }, @@ -9930,7 +9930,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+2d6f1cdb4dc10c7cdcc401ccdf983d0f07f62422b07184735f8530cf15ecdc96"], + "stakes": ["+2d6f1cdb4dc10c7cdcc401ccdf983d0f07f62422b07184735f8530cf15ecdc96"], "recipientId": "14192654215365553854L", "amount": "0" }, @@ -9993,7 +9993,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a570482d4f729aebd1cbc51033676bb0ef7618d9bd88248ec45c8499b9ddd85a"], + "stakes": ["+a570482d4f729aebd1cbc51033676bb0ef7618d9bd88248ec45c8499b9ddd85a"], "recipientId": "13716803199232586937L", "amount": "0" }, @@ -10056,7 +10056,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+511a9f7835dfa0508e879feb4aec6907c6dfcff440ec985a9ba304b0ba2a4d84"], + "stakes": ["+511a9f7835dfa0508e879feb4aec6907c6dfcff440ec985a9ba304b0ba2a4d84"], "recipientId": "8762913442176959474L", "amount": "0" }, @@ -10119,7 +10119,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c7df03d4ce0a3c30115b55dc04110527eaba83b4ee8487f6f7f811e81cc116dc"], + "stakes": ["+c7df03d4ce0a3c30115b55dc04110527eaba83b4ee8487f6f7f811e81cc116dc"], "recipientId": "1719243736806599794L", "amount": "0" }, @@ -10182,7 +10182,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+346ed673e114c6f2a92cfb548767221ef415d631b9edafbe8db4c98033de7168"], + "stakes": ["+346ed673e114c6f2a92cfb548767221ef415d631b9edafbe8db4c98033de7168"], "recipientId": "13961530197827907819L", "amount": "0" }, @@ -10245,7 +10245,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e0849976e21ae3b49a0cf6ac479389e9c4e30c692d94e36d3b46b1152709488c"], + "stakes": ["+e0849976e21ae3b49a0cf6ac479389e9c4e30c692d94e36d3b46b1152709488c"], "recipientId": "1454506391342021962L", "amount": "0" }, @@ -10308,7 +10308,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c586c24877d8d14f89d46dca72197b07cc928d2d810a8f1c8d1c0ec051104e15"], + "stakes": ["+c586c24877d8d14f89d46dca72197b07cc928d2d810a8f1c8d1c0ec051104e15"], "recipientId": "1663443299711429869L", "amount": "0" }, @@ -10371,7 +10371,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+eebfc8f36e3503dd5a591214cc5624ebb61d66cbd41ecac02d75578676f7f8cc"], + "stakes": ["+eebfc8f36e3503dd5a591214cc5624ebb61d66cbd41ecac02d75578676f7f8cc"], "recipientId": "10516970142268947805L", "amount": "0" }, @@ -10434,7 +10434,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a0620e87822c59f872637c73f0fcf15e8a1425137c2f0c6a175e33596c1cef85"], + "stakes": ["+a0620e87822c59f872637c73f0fcf15e8a1425137c2f0c6a175e33596c1cef85"], "recipientId": "5922956840970443338L", "amount": "0" }, @@ -10497,7 +10497,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+822a4dd2eba7a84f4f9341840ba7a778e04d1ebedc1842470f313c4e6cdcb8f1"], + "stakes": ["+822a4dd2eba7a84f4f9341840ba7a778e04d1ebedc1842470f313c4e6cdcb8f1"], "recipientId": "16157148956722722703L", "amount": "0" }, @@ -10560,7 +10560,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bef618e5514578332e9b1c8351e0ad5f855aae27b2cb27564d3d1cb3dbc18ee9"], + "stakes": ["+bef618e5514578332e9b1c8351e0ad5f855aae27b2cb27564d3d1cb3dbc18ee9"], "recipientId": "6138436421552052381L", "amount": "0" }, @@ -10623,7 +10623,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+39d6225c1dd67df2de046175c97c4c26b43e4c4d44a3ff73dccafe0aad8515cb"], + "stakes": ["+39d6225c1dd67df2de046175c97c4c26b43e4c4d44a3ff73dccafe0aad8515cb"], "recipientId": "8690529447321685485L", "amount": "0" }, @@ -10686,7 +10686,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+36f7eed674944bad682c33b2d76d7cf069ef220c316d1d052fc56d4f01d90f7e"], + "stakes": ["+36f7eed674944bad682c33b2d76d7cf069ef220c316d1d052fc56d4f01d90f7e"], "recipientId": "16828600199059189083L", "amount": "0" }, @@ -10749,7 +10749,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c24212c825b4c65db50c95de2b9da5e09fb3802112097e0256e43bc54c1cafb9"], + "stakes": ["+c24212c825b4c65db50c95de2b9da5e09fb3802112097e0256e43bc54c1cafb9"], "recipientId": "3117234715182843213L", "amount": "0" }, @@ -10812,7 +10812,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+05b236537af28e1ee0d89e84710b9ce94744330977fa63dc2b8c116adeb11885"], + "stakes": ["+05b236537af28e1ee0d89e84710b9ce94744330977fa63dc2b8c116adeb11885"], "recipientId": "18008258998173769426L", "amount": "0" }, @@ -10875,7 +10875,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+700268733539d66fab4de74c38f42549415b1b8337222488d10918bf95599250"], + "stakes": ["+700268733539d66fab4de74c38f42549415b1b8337222488d10918bf95599250"], "recipientId": "18327507212732860521L", "amount": "0" }, @@ -10938,7 +10938,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+bce384981dbebb2a41925fcd34e5ea69402e097de22b7e9c6a9d1dfcd7aca7a9"], + "stakes": ["+bce384981dbebb2a41925fcd34e5ea69402e097de22b7e9c6a9d1dfcd7aca7a9"], "recipientId": "10642381638630676703L", "amount": "0" }, @@ -11001,7 +11001,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+d011d67c9018ea9282532d9cc3de82533e9a19f7038add13fd54dcbcb038465c"], + "stakes": ["+d011d67c9018ea9282532d9cc3de82533e9a19f7038add13fd54dcbcb038465c"], "recipientId": "1832701800952916406L", "amount": "0" }, @@ -11064,7 +11064,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+6075ef9752cd466712c73a7f506788f67ffe121921ba01c2aab956d32e708363"], + "stakes": ["+6075ef9752cd466712c73a7f506788f67ffe121921ba01c2aab956d32e708363"], "recipientId": "3272065180880293808L", "amount": "0" }, @@ -11127,7 +11127,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+7033a174c11f5545c698494039ab0ed2bdb3f76c59e2f341cdc18415023f2b35"], + "stakes": ["+7033a174c11f5545c698494039ab0ed2bdb3f76c59e2f341cdc18415023f2b35"], "recipientId": "6885133969991843253L", "amount": "0" }, @@ -11190,7 +11190,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+183899c3460f11352dee7071e421aca95ce7ec3a1416c665797a5db61b6e51f7"], + "stakes": ["+183899c3460f11352dee7071e421aca95ce7ec3a1416c665797a5db61b6e51f7"], "recipientId": "4869975650883480574L", "amount": "0" }, @@ -11253,7 +11253,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+0024b96aa7172fc5d8e69b120cffc41ae5c817e2f8cc3ec0caaacfedef9c656d"], + "stakes": ["+0024b96aa7172fc5d8e69b120cffc41ae5c817e2f8cc3ec0caaacfedef9c656d"], "recipientId": "17382513943689513695L", "amount": "0" }, @@ -11316,7 +11316,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+de08d06bbc23118ad68b35d0e13013904cb0cd4f31672799507fd7584bda3623"], + "stakes": ["+de08d06bbc23118ad68b35d0e13013904cb0cd4f31672799507fd7584bda3623"], "recipientId": "8929885107192285804L", "amount": "0" }, @@ -11379,7 +11379,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+1dc2e6bdefac86fc99098e43b627fccd0c45d246227b7533452251a5445c8fbc"], + "stakes": ["+1dc2e6bdefac86fc99098e43b627fccd0c45d246227b7533452251a5445c8fbc"], "recipientId": "12364889234919827602L", "amount": "0" }, @@ -11442,7 +11442,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+b2e6515135c4b88eb22ac948939debf9d0556623fdb418de1a9ae6db84ab978e"], + "stakes": ["+b2e6515135c4b88eb22ac948939debf9d0556623fdb418de1a9ae6db84ab978e"], "recipientId": "5057331965422499891L", "amount": "0" }, @@ -11505,7 +11505,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+40fa2c635eb91e0c857115a215822ae80c6129976705d5009298f8f5bfa7f90f"], + "stakes": ["+40fa2c635eb91e0c857115a215822ae80c6129976705d5009298f8f5bfa7f90f"], "recipientId": "2941105044814971087L", "amount": "0" }, @@ -11568,7 +11568,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+43c1e6bae29b779e3b8d8e8ce285aaa605025d7ce8879dd6e0ff4fcafb18a927"], + "stakes": ["+43c1e6bae29b779e3b8d8e8ce285aaa605025d7ce8879dd6e0ff4fcafb18a927"], "recipientId": "4460841135260728414L", "amount": "0" }, @@ -11631,7 +11631,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8f52257c70d236b7874b8513b5a91b95e56d13fd500edc7153a0df9de6084868"], + "stakes": ["+8f52257c70d236b7874b8513b5a91b95e56d13fd500edc7153a0df9de6084868"], "recipientId": "11188995612554378488L", "amount": "0" }, @@ -11694,7 +11694,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e2559085f4922f53dd81de705667b7f354712645f47c4e4cfcf3c72c548fb782"], + "stakes": ["+e2559085f4922f53dd81de705667b7f354712645f47c4e4cfcf3c72c548fb782"], "recipientId": "1826426256229028807L", "amount": "0" }, @@ -11757,7 +11757,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+886b3aca526b343e4cd9d31769dee3b364b22c9c229452f536e07388e3f1c9f7"], + "stakes": ["+886b3aca526b343e4cd9d31769dee3b364b22c9c229452f536e07388e3f1c9f7"], "recipientId": "3072337877364613825L", "amount": "0" }, @@ -11820,7 +11820,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+a1e8b8965a25a06e51c99be2f903f7ecb32d07780c921c4c9f5bf1cd0f234e08"], + "stakes": ["+a1e8b8965a25a06e51c99be2f903f7ecb32d07780c921c4c9f5bf1cd0f234e08"], "recipientId": "1002722795512430133L", "amount": "0" }, @@ -11883,7 +11883,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+ed9511d396bf4297989dbee7a0317d7a074696588425f170b019430cae7b06a2"], + "stakes": ["+ed9511d396bf4297989dbee7a0317d7a074696588425f170b019430cae7b06a2"], "recipientId": "7564039508345962387L", "amount": "0" }, @@ -11946,7 +11946,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+282ea999ff65eb19b18217635a1e022ce5e7718b0ddce8286163eb7f4bcaea25"], + "stakes": ["+282ea999ff65eb19b18217635a1e022ce5e7718b0ddce8286163eb7f4bcaea25"], "recipientId": "8477594334433202442L", "amount": "0" }, @@ -12009,7 +12009,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+7e3a99b599d37024e47313a03b2522cdb238d5c82ca2895d65ccc9063138c643"], + "stakes": ["+7e3a99b599d37024e47313a03b2522cdb238d5c82ca2895d65ccc9063138c643"], "recipientId": "10061339281844477568L", "amount": "0" }, @@ -12072,7 +12072,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+96ded1032028cd008d35c7230a638bff13455b36781574a9f22bab09aad1717b"], + "stakes": ["+96ded1032028cd008d35c7230a638bff13455b36781574a9f22bab09aad1717b"], "recipientId": "10973533420696678447L", "amount": "0" }, @@ -12135,7 +12135,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+479b97219706ccf76d3516d4da104c9a4cfdb22a8b87bf3a3b1b09379e6a474d"], + "stakes": ["+479b97219706ccf76d3516d4da104c9a4cfdb22a8b87bf3a3b1b09379e6a474d"], "recipientId": "17205056432162668840L", "amount": "0" }, @@ -12198,7 +12198,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+8fd89d17ce266427ff7fb1b3a283ff913404f4f24d0ea5709815b31ce4602c08"], + "stakes": ["+8fd89d17ce266427ff7fb1b3a283ff913404f4f24d0ea5709815b31ce4602c08"], "recipientId": "1831426387655050045L", "amount": "0" }, @@ -12261,7 +12261,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f24ab602f4424a1fffc754e7492e174185a08c7b06a6b7ed4c8d1bbfcde00d50"], + "stakes": ["+f24ab602f4424a1fffc754e7492e174185a08c7b06a6b7ed4c8d1bbfcde00d50"], "recipientId": "2623645469004101929L", "amount": "0" }, @@ -12324,7 +12324,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+c8fa24fed9c52d2cd1db8518690d81710918f64165f8d6ed2d0577f829c4a89b"], + "stakes": ["+c8fa24fed9c52d2cd1db8518690d81710918f64165f8d6ed2d0577f829c4a89b"], "recipientId": "8813059541939740410L", "amount": "0" }, @@ -12387,7 +12387,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+e4a393e77e15b016036964854dbad19384296414ae015d0023e22dde2b20d2ac"], + "stakes": ["+e4a393e77e15b016036964854dbad19384296414ae015d0023e22dde2b20d2ac"], "recipientId": "13371311846687282017L", "amount": "0" }, @@ -12450,7 +12450,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+f6ff6be887b6f4cc07c6d71dc95aa7bfe9aa888a4c998ca04ef10ecbefd06e5e"], + "stakes": ["+f6ff6be887b6f4cc07c6d71dc95aa7bfe9aa888a4c998ca04ef10ecbefd06e5e"], "recipientId": "3539294500270642084L", "amount": "0" }, @@ -12513,7 +12513,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+26fbfbf00c45e24e49bc9dd94c08b60a0e5330c3527753e5e56de2baf591f953"], + "stakes": ["+26fbfbf00c45e24e49bc9dd94c08b60a0e5330c3527753e5e56de2baf591f953"], "recipientId": "1059049099930719314L", "amount": "0" }, @@ -12576,7 +12576,7 @@ "fee": "10000000", "type": 3, "asset": { - "votes": ["+68c538b6b9ed2ec8b1938a3456a2d237629e991bdc9d9880fefbdc43e13c3607"], + "stakes": ["+68c538b6b9ed2ec8b1938a3456a2d237629e991bdc9d9880fefbdc43e13c3607"], "recipientId": "13626916270102280476L", "amount": "0" }, diff --git a/elements/lisk-transactions/test/__snapshots__/fee.spec.ts.snap b/elements/lisk-transactions/test/__snapshots__/fee.spec.ts.snap index 445d27920cd..b0d4d09924a 100644 --- a/elements/lisk-transactions/test/__snapshots__/fee.spec.ts.snap +++ b/elements/lisk-transactions/test/__snapshots__/fee.spec.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`fee computeMinFee should calculate minimum fee for delegate registration transaction 1`] = `135000n`; - exports[`fee computeMinFee should calculate minimum fee for given minFeePerByte 1`] = `316000n`; exports[`fee computeMinFee should calculate minimum fee for transaction from multisignature account 1`] = `8634000n`; +exports[`fee computeMinFee should calculate minimum fee for validator registration transaction 1`] = `136000n`; + exports[`fee computeMinFee should return minimum fee required to send to network 1`] = `158000n`; diff --git a/elements/lisk-transactions/test/fee.spec.ts b/elements/lisk-transactions/test/fee.spec.ts index 3cd81023dcc..8d2b9ef470b 100644 --- a/elements/lisk-transactions/test/fee.spec.ts +++ b/elements/lisk-transactions/test/fee.spec.ts @@ -109,17 +109,17 @@ describe('fee', () => { expect(minFee.toString()).toEqual(BigInt(txBytes.length * 1000).toString()); }); - it('should calculate minimum fee for delegate registration transaction', () => { + it('should calculate minimum fee for validator registration transaction', () => { // Arrange - const delegateRegisterTransaction = { + const validatorRegisterTransaction = { ...validTransaction, module: utils.intToBuffer(5, 4), command: 'transfer', - params: { username: 'delegate1' }, + params: { username: 'validator1' }, }; const options = { minFeePerByte: 1000, numberOfSignatures: 1 }; - const delegateRegisterParamsSchema = { - $id: '/lisk/dpos/register', + const validatorRegisterParamsSchema = { + $id: '/lisk/pos/register', type: 'object', required: ['username'], properties: { @@ -132,8 +132,8 @@ describe('fee', () => { }, }; const minFee = computeMinFee( - delegateRegisterTransaction, - delegateRegisterParamsSchema, + validatorRegisterTransaction, + validatorRegisterParamsSchema, options, ); diff --git a/examples/dpos-mainchain/.eslintignore b/examples/pos-mainchain/.eslintignore similarity index 100% rename from examples/dpos-mainchain/.eslintignore rename to examples/pos-mainchain/.eslintignore diff --git a/examples/dpos-mainchain/.eslintrc.js b/examples/pos-mainchain/.eslintrc.js similarity index 100% rename from examples/dpos-mainchain/.eslintrc.js rename to examples/pos-mainchain/.eslintrc.js diff --git a/examples/dpos-mainchain/.gitignore b/examples/pos-mainchain/.gitignore similarity index 100% rename from examples/dpos-mainchain/.gitignore rename to examples/pos-mainchain/.gitignore diff --git a/examples/dpos-mainchain/.lintstagedrc.json b/examples/pos-mainchain/.lintstagedrc.json similarity index 100% rename from examples/dpos-mainchain/.lintstagedrc.json rename to examples/pos-mainchain/.lintstagedrc.json diff --git a/examples/dpos-mainchain/.liskrc.json b/examples/pos-mainchain/.liskrc.json similarity index 100% rename from examples/dpos-mainchain/.liskrc.json rename to examples/pos-mainchain/.liskrc.json diff --git a/examples/dpos-mainchain/.prettierignore b/examples/pos-mainchain/.prettierignore similarity index 100% rename from examples/dpos-mainchain/.prettierignore rename to examples/pos-mainchain/.prettierignore diff --git a/examples/dpos-mainchain/.prettierrc.json b/examples/pos-mainchain/.prettierrc.json similarity index 100% rename from examples/dpos-mainchain/.prettierrc.json rename to examples/pos-mainchain/.prettierrc.json diff --git a/examples/dpos-mainchain/README.md b/examples/pos-mainchain/README.md similarity index 100% rename from examples/dpos-mainchain/README.md rename to examples/pos-mainchain/README.md diff --git a/examples/dpos-mainchain/bin/run b/examples/pos-mainchain/bin/run similarity index 100% rename from examples/dpos-mainchain/bin/run rename to examples/pos-mainchain/bin/run diff --git a/examples/dpos-mainchain/bin/run.cmd b/examples/pos-mainchain/bin/run.cmd similarity index 100% rename from examples/dpos-mainchain/bin/run.cmd rename to examples/pos-mainchain/bin/run.cmd diff --git a/examples/dpos-mainchain/config/default/config.json b/examples/pos-mainchain/config/default/config.json similarity index 96% rename from examples/dpos-mainchain/config/default/config.json rename to examples/pos-mainchain/config/default/config.json index 4ab5ffd0c78..43d69fb3e87 100644 --- a/examples/dpos-mainchain/config/default/config.json +++ b/examples/pos-mainchain/config/default/config.json @@ -1,6 +1,6 @@ { "system": { - "dataPath": "~/.lisk/dpos-mainchain" + "dataPath": "~/.lisk/pos-mainchain" }, "rpc": { "modes": ["ipc"] diff --git a/examples/dpos-mainchain/config/default/dev-validators.json b/examples/pos-mainchain/config/default/dev-validators.json similarity index 100% rename from examples/dpos-mainchain/config/default/dev-validators.json rename to examples/pos-mainchain/config/default/dev-validators.json diff --git a/examples/dpos-mainchain/config/default/genesis_assets.json b/examples/pos-mainchain/config/default/genesis_assets.json similarity index 99% rename from examples/dpos-mainchain/config/default/genesis_assets.json rename to examples/pos-mainchain/config/default/genesis_assets.json index 7da5daaec5f..efd62bf99af 100644 --- a/examples/dpos-mainchain/config/default/genesis_assets.json +++ b/examples/pos-mainchain/config/default/genesis_assets.json @@ -755,7 +755,7 @@ } }, { - "module": "dpos", + "module": "pos", "data": { "validators": [ { @@ -2201,10 +2201,10 @@ "sharingCoefficients": [] } ], - "voters": [], + "stakers": [], "genesisData": { "initRounds": 3, - "initDelegates": [ + "initValidators": [ "lskzbqjmwmd32sx8ya56saa4gk7tkco953btm24t8", "lskzot8pzdcvjhpjwrhq3dkkbf499ok7mhwkrvsq3", "lskz89nmk8tuwt93yzqm6wu2jxjdaftr9d5detn8v", @@ -2310,9 +2310,9 @@ } }, "schema": { - "$id": "/dpos/module/genesis", + "$id": "/pos/module/genesis", "type": "object", - "required": ["validators", "voters", "genesisData"], + "required": ["validators", "stakers", "genesisData"], "properties": { "validators": { "type": "array", @@ -2411,26 +2411,26 @@ } } }, - "voters": { + "stakers": { "type": "array", "fieldNumber": 2, "items": { "type": "object", - "required": ["address", "sentVotes", "pendingUnlocks"], + "required": ["address", "sentStakes", "pendingUnlocks"], "properties": { "address": { "dataType": "bytes", "format": "lisk32", "fieldNumber": 1 }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", - "required": ["delegateAddress", "amount"], + "required": ["validatorAddress", "amount"], "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -2438,7 +2438,7 @@ "dataType": "uint64", "fieldNumber": 2 }, - "voteSharingCoefficients": { + "stakeSharingCoefficients": { "type": "array", "fieldNumber": 3, "items": { @@ -2464,9 +2464,9 @@ "fieldNumber": 3, "items": { "type": "object", - "required": ["delegateAddress", "amount", "unvoteHeight"], + "required": ["validatorAddress", "amount", "unstakeHeight"], "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1, "minLength": 20, @@ -2476,7 +2476,7 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } @@ -2489,13 +2489,13 @@ "genesisData": { "type": "object", "fieldNumber": 3, - "required": ["initRounds", "initDelegates"], + "required": ["initRounds", "initValidators"], "properties": { "initRounds": { "dataType": "uint32", "fieldNumber": 1 }, - "initDelegates": { + "initValidators": { "type": "array", "fieldNumber": 2, "items": { diff --git a/examples/dpos-mainchain/config/default/genesis_block.blob b/examples/pos-mainchain/config/default/genesis_block.blob similarity index 99% rename from examples/dpos-mainchain/config/default/genesis_block.blob rename to examples/pos-mainchain/config/default/genesis_block.blob index 2a9e40f5652e3141e85806e5ae2ad4a376a7a604..dc58a2977ef1df13e529f14ee29c1b2e8f70feed 100644 GIT binary patch delta 111 zcmV-#0FeLW?E&NM0S^lN0SEvPmBj6v1{eS$AdwLsku5wRORU;DcbM#S-lqu*@iwM* zKe>8V2cz?U, lightcurve GmbH ", "license": "Apache-2.0", "keywords": [ diff --git a/framework-plugins/lisk-framework-forger-plugin/src/db.ts b/framework-plugins/lisk-framework-forger-plugin/src/db.ts index a4d3566e36e..2e3960e0beb 100644 --- a/framework-plugins/lisk-framework-forger-plugin/src/db.ts +++ b/framework-plugins/lisk-framework-forger-plugin/src/db.ts @@ -72,12 +72,12 @@ export const getForgerInfo = async (db: KVStore, forgerAddress: string): Promise Buffer.concat([DB_KEY_FORGER_INFO, Buffer.from(`:${forgerAddress}`, 'utf8')]), ); } catch (error) { - debug(`Forger info does not exists for delegate: ${forgerAddress}`); + debug(`Forger info does not exists for validator: ${forgerAddress}`); return { totalProducedBlocks: 0, totalReceivedFees: BigInt(0), totalReceivedRewards: BigInt(0), - votesReceived: [], + stakeReceived: [], }; } diff --git a/framework-plugins/lisk-framework-forger-plugin/src/endpoint.ts b/framework-plugins/lisk-framework-forger-plugin/src/endpoint.ts index fa8ec2a64a9..e6b84aa59b3 100644 --- a/framework-plugins/lisk-framework-forger-plugin/src/endpoint.ts +++ b/framework-plugins/lisk-framework-forger-plugin/src/endpoint.ts @@ -21,11 +21,11 @@ import { import { getForgerInfo } from './db'; import { Forger } from './types'; -interface Voter { +interface Staker { readonly address: string; readonly username: string; - readonly totalVotesReceived: string; - readonly voters: { + readonly totalStakeReceived: string; + readonly stakers: { readonly address: string; readonly amount: string; }[]; @@ -36,14 +36,14 @@ interface ForgerInfo extends Forger { readonly totalReceivedFees: string; readonly totalReceivedRewards: string; readonly totalProducedBlocks: number; - readonly totalVotesReceived: string; + readonly totalStakeReceived: string; readonly consecutiveMissedBlocks: number; } -interface Delegate { +interface Validator { name: string; - totalVotesReceived: string; - selfVotes: string; + totalStakeReceived: string; + selfStake: string; lastGeneratedHeight: number; isBanned: boolean; pomHeights: ReadonlyArray; @@ -59,20 +59,20 @@ export class Endpoint extends BasePluginEndpoint { this._client = apiClient; } - public async getVoters(_context: PluginEndpointContext): Promise { + public async getStakers(_context: PluginEndpointContext): Promise { const forgersList = await this._client.invoke('app_getForgingStatus'); const forgerAccounts = []; - for (const delegate of forgersList) { - const res = await this._client.invoke('dpos_getDelegate', { - address: delegate.address, + for (const validator of forgersList) { + const res = await this._client.invoke('pos_getValidator', { + address: validator.address, }); forgerAccounts.push({ ...res, - address: delegate.address, + address: validator.address, }); } - const result: Voter[] = []; + const result: Staker[] = []; for (const account of forgerAccounts) { const forgerInfo = await getForgerInfo( this._db, @@ -82,10 +82,10 @@ export class Endpoint extends BasePluginEndpoint { result.push({ address: account.address, username: account.name, - totalVotesReceived: account.totalVotesReceived, - voters: forgerInfo.votesReceived.map(vote => ({ - address: cryptography.address.getLisk32AddressFromAddress(vote.address), - amount: vote.amount.toString(), + totalStakeReceived: account.totalStakeReceived, + stakers: forgerInfo.stakeReceived.map(stake => ({ + address: cryptography.address.getLisk32AddressFromAddress(stake.address), + amount: stake.amount.toString(), })), }); } @@ -96,13 +96,13 @@ export class Endpoint extends BasePluginEndpoint { public async getForgingInfo(_context: PluginEndpointContext): Promise { const forgersList = await this._client.invoke>('app_getForgingStatus'); const forgerAccounts = []; - for (const delegate of forgersList) { - const res = await this._client.invoke('dpos_getDelegate', { - address: delegate.address, + for (const validator of forgersList) { + const res = await this._client.invoke('pos_getValidator', { + address: validator.address, }); forgerAccounts.push({ ...res, - address: delegate.address, + address: validator.address, }); } const data: ForgerInfo[] = []; @@ -118,7 +118,7 @@ export class Endpoint extends BasePluginEndpoint { totalReceivedFees: forgerInfo.totalReceivedFees.toString(), totalReceivedRewards: forgerInfo.totalReceivedRewards.toString(), totalProducedBlocks: forgerInfo.totalProducedBlocks, - totalVotesReceived: forgerAccount.totalVotesReceived, + totalStakeReceived: forgerAccount.totalStakeReceived, consecutiveMissedBlocks: forgerAccount.consecutiveMissedBlocks, }); } diff --git a/framework-plugins/lisk-framework-forger-plugin/src/forger_plugin.ts b/framework-plugins/lisk-framework-forger-plugin/src/forger_plugin.ts index 0f9d3fb439e..e5fffca1528 100644 --- a/framework-plugins/lisk-framework-forger-plugin/src/forger_plugin.ts +++ b/framework-plugins/lisk-framework-forger-plugin/src/forger_plugin.ts @@ -29,7 +29,7 @@ import { setForgerInfo, setForgerSyncInfo, } from './db'; -import { Forger, Voters } from './types'; +import { Forger, Stakers } from './types'; import { Endpoint } from './endpoint'; const { Block } = chain; @@ -38,18 +38,18 @@ type BlockJSON = chain.BlockJSON; type TransactionJSON = chain.TransactionJSON; const BLOCKS_BATCH_TO_SYNC = 1000; -const MODULE_DPOS = 'dpos'; -const COMMAND_VOTE = 'vote'; +const MODULE_POS = 'pos'; +const COMMAND_STAKE = 'stake'; interface Data { readonly blockHeader: BlockHeaderJSON; } -interface VotesParams { - readonly votes: Array>; +interface StakesParams { + readonly stakes: Array>; } -interface Vote { - delegateAddress: string; +interface Stake { + validatorAddress: string; amount: string; } @@ -70,8 +70,8 @@ interface MissedBlocksByAddress { [key: string]: number; } -interface ForgerReceivedVotes { - [key: string]: Voters; +interface ForgerReceivedStakes { + [key: string]: Stakers; } const getBinaryAddress = (hexAddressStr: string) => @@ -254,7 +254,7 @@ export class ForgerPlugin extends BasePlugin { await setForgerInfo(this._forgerPluginDB, forgerAddressBinary, { ...forgerInfo }); } - await this._addVotesReceived(transactions); + await this._addStakesReceived(transactions); await this._updateMissedBlock(header, transactions); } @@ -268,37 +268,37 @@ export class ForgerPlugin extends BasePlugin { await setForgerInfo(this._forgerPluginDB, forgerAddressBinary, { ...forgerInfo }); } - await this._revertVotesReceived(transactions); + await this._revertStakesReceived(transactions); } - private _getForgerReceivedVotes( + private _getForgerReceivedStakes( transactions: ReadonlyArray, - ): ForgerReceivedVotes { - const forgerReceivedVotes: ForgerReceivedVotes = {}; + ): ForgerReceivedStakes { + const forgerReceivedStakes: ForgerReceivedStakes = {}; - const dposModuleMeta = this.apiClient.metadata.find(c => c.name === MODULE_DPOS); - if (!dposModuleMeta) { - throw new Error('DPoS votes command is not registered.'); + const posModuleMeta = this.apiClient.metadata.find(c => c.name === MODULE_POS); + if (!posModuleMeta) { + throw new Error('PoS stakes command is not registered.'); } - const voteCommandMeta = dposModuleMeta.commands.find(c => c.name === COMMAND_VOTE); + const voteCommandMeta = posModuleMeta.commands.find(c => c.name === COMMAND_STAKE); if (!voteCommandMeta || !voteCommandMeta.params) { - throw new Error('DPoS votes command is not registered.'); + throw new Error('PoS stakes command is not registered.'); } for (const trx of transactions) { - if (trx.module === MODULE_DPOS && trx.command === COMMAND_VOTE) { - const params = codec.decode( + if (trx.module === MODULE_POS && trx.command === COMMAND_STAKE) { + const params = codec.decode( voteCommandMeta.params, Buffer.from(trx.params, 'hex'), ); - params.votes.reduce((acc: ForgerReceivedVotes, curr) => { + params.stakes.reduce((acc: ForgerReceivedStakes, curr) => { if ( - this._forgersList.has(getAddressBuffer(curr.delegateAddress)) && - acc[curr.delegateAddress] + this._forgersList.has(getAddressBuffer(curr.validatorAddress)) && + acc[curr.validatorAddress] ) { - acc[curr.delegateAddress].amount += BigInt(curr.amount); + acc[curr.validatorAddress].amount += BigInt(curr.amount); } else { - acc[curr.delegateAddress] = { + acc[curr.validatorAddress] = { address: cryptography.address.getAddressFromPublicKey( Buffer.from(trx.senderPublicKey, 'hex'), ), @@ -306,57 +306,57 @@ export class ForgerPlugin extends BasePlugin { }; } return acc; - }, forgerReceivedVotes); + }, forgerReceivedStakes); } } - return forgerReceivedVotes; + return forgerReceivedStakes; } - private async _addVotesReceived(transactions: ReadonlyArray): Promise { - const forgerReceivedVotes = this._getForgerReceivedVotes(transactions); + private async _addStakesReceived(transactions: ReadonlyArray): Promise { + const forgerReceivedStakes = this._getForgerReceivedStakes(transactions); - for (const [delegateAddress, votesReceived] of Object.entries(forgerReceivedVotes)) { + for (const [validatorAddress, stakeReceived] of Object.entries(forgerReceivedStakes)) { const forgerInfo = await getForgerInfo( this._forgerPluginDB, - getBinaryAddress(delegateAddress), + getBinaryAddress(validatorAddress), ); - const voterIndex = forgerInfo.votesReceived.findIndex(aVote => - aVote.address.equals(votesReceived.address), + const stakerIndex = forgerInfo.stakeReceived.findIndex(aStake => + aStake.address.equals(stakeReceived.address), ); - if (voterIndex === -1) { - forgerInfo.votesReceived.push(votesReceived); + if (stakerIndex === -1) { + forgerInfo.stakeReceived.push(stakeReceived); } else { - forgerInfo.votesReceived[voterIndex].amount += votesReceived.amount; - // Remove voter when amount becomes zero - if (forgerInfo.votesReceived[voterIndex].amount === BigInt(0)) { - forgerInfo.votesReceived.splice(voterIndex, 1); + forgerInfo.stakeReceived[stakerIndex].amount += stakeReceived.amount; + // Remove staker when amount becomes zero + if (forgerInfo.stakeReceived[stakerIndex].amount === BigInt(0)) { + forgerInfo.stakeReceived.splice(stakerIndex, 1); } } - await setForgerInfo(this._forgerPluginDB, getBinaryAddress(delegateAddress), forgerInfo); + await setForgerInfo(this._forgerPluginDB, getBinaryAddress(validatorAddress), forgerInfo); } } - private async _revertVotesReceived(transactions: ReadonlyArray): Promise { - const forgerReceivedVotes = this._getForgerReceivedVotes(transactions); + private async _revertStakesReceived(transactions: ReadonlyArray): Promise { + const forgerReceivedStakes = this._getForgerReceivedStakes(transactions); - for (const [delegateAddress, votesReceived] of Object.entries(forgerReceivedVotes)) { + for (const [validatorAddress, stakeReceived] of Object.entries(forgerReceivedStakes)) { const forgerInfo = await getForgerInfo( this._forgerPluginDB, - getBinaryAddress(delegateAddress), + getBinaryAddress(validatorAddress), ); - const voterIndex = forgerInfo.votesReceived.findIndex(aVote => - aVote.address.equals(votesReceived.address), + const stakerIndex = forgerInfo.stakeReceived.findIndex(aStake => + aStake.address.equals(stakeReceived.address), ); - if (voterIndex !== -1) { - forgerInfo.votesReceived[voterIndex].amount -= BigInt(votesReceived.amount); - // Remove voter when amount becomes zero - if (forgerInfo.votesReceived[voterIndex].amount === BigInt(0)) { - forgerInfo.votesReceived.splice(voterIndex, 1); + if (stakerIndex !== -1) { + forgerInfo.stakeReceived[stakerIndex].amount -= BigInt(stakeReceived.amount); + // Remove staker when amount becomes zero + if (forgerInfo.stakeReceived[stakerIndex].amount === BigInt(0)) { + forgerInfo.stakeReceived.splice(stakerIndex, 1); } - await setForgerInfo(this._forgerPluginDB, getBinaryAddress(delegateAddress), forgerInfo); + await setForgerInfo(this._forgerPluginDB, getBinaryAddress(validatorAddress), forgerInfo); } } } diff --git a/framework-plugins/lisk-framework-forger-plugin/src/schemas.ts b/framework-plugins/lisk-framework-forger-plugin/src/schemas.ts index acaaadbc713..02fbf8fcfe5 100644 --- a/framework-plugins/lisk-framework-forger-plugin/src/schemas.ts +++ b/framework-plugins/lisk-framework-forger-plugin/src/schemas.ts @@ -28,7 +28,7 @@ export const forgerInfoSchema = { dataType: 'uint64', fieldNumber: 3, }, - votesReceived: { + stakeReceived: { type: 'array', fieldNumber: 4, items: { @@ -47,7 +47,7 @@ export const forgerInfoSchema = { required: ['address', 'amount'], }, }, - required: ['totalProducedBlocks', 'totalReceivedFees', 'totalReceivedRewards', 'votesReceived'], + required: ['totalProducedBlocks', 'totalReceivedFees', 'totalReceivedRewards', 'stakeReceived'], }; export const forgerSyncSchema = { @@ -62,20 +62,20 @@ export const forgerSyncSchema = { }, }; -export const dposVoteParamsSchema = { - $id: '/forger/dpos/vote', +export const posStakeParamsSchema = { + $id: '/forger/pos/stake', type: 'object', - required: ['votes'], + required: ['stakes'], properties: { - votes: { + stakes: { type: 'array', minItems: 1, maxItems: 20, items: { type: 'object', - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, minLength: 20, diff --git a/framework-plugins/lisk-framework-forger-plugin/src/types.ts b/framework-plugins/lisk-framework-forger-plugin/src/types.ts index c73436cf815..96012461dbb 100644 --- a/framework-plugins/lisk-framework-forger-plugin/src/types.ts +++ b/framework-plugins/lisk-framework-forger-plugin/src/types.ts @@ -21,10 +21,10 @@ export interface ForgerInfo { totalProducedBlocks: number; totalReceivedFees: bigint; totalReceivedRewards: bigint; - votesReceived: Voters[]; + stakeReceived: Stakers[]; } -export interface Voters { +export interface Stakers { address: Buffer; amount: bigint; } @@ -33,11 +33,11 @@ export interface ForgetSyncInfo { syncUptoHeight: number; } -export interface DPoSAccountJSON { - dpos: { - delegate: { +export interface PoSAccountJSON { + pos: { + validator: { username: string; - totalVotesReceived: string; + totalStakeReceived: string; consecutiveMissedBlocks: number; }; }; diff --git a/framework-plugins/lisk-framework-forger-plugin/test/functional/__snapshots__/voters.spec.ts.snap b/framework-plugins/lisk-framework-forger-plugin/test/functional/__snapshots__/voters.spec.ts.snap index d2db43d510c..2e8d3c07433 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/functional/__snapshots__/voters.spec.ts.snap +++ b/framework-plugins/lisk-framework-forger-plugin/test/functional/__snapshots__/voters.spec.ts.snap @@ -1,624 +1,624 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`forger:getVoters action action forger:getVoters should return valid format 1`] = ` +exports[`forger:getStakers action action forger:getStakers should return valid format 1`] = ` Array [ Object { "address": "9cabee3d27426676b852ce6b804cb2fdff7cd0b5", - "totalVotesReceived": "0", - "username": "delegate_0", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_0", + "stakers": Array [], }, Object { "address": "463e7e879b7bdc6a97ec02a2a603aa1a46a04c80", - "totalVotesReceived": "0", - "username": "delegate_1", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_1", + "stakers": Array [], }, Object { "address": "328d0f546695c5fa02105deb055cf2801d9b8ba1", - "totalVotesReceived": "0", - "username": "delegate_2", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_2", + "stakers": Array [], }, Object { "address": "6174515fa66c91bff1128913edd4e0f1de37cee0", - "totalVotesReceived": "0", - "username": "delegate_3", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_3", + "stakers": Array [], }, Object { "address": "9d0149b0962d44bfc08a9f64d5afceb6281d7fb5", - "totalVotesReceived": "0", - "username": "delegate_4", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_4", + "stakers": Array [], }, Object { "address": "b56c55b9a70c8e2f07979b862374aed0e92a6dda", - "totalVotesReceived": "0", - "username": "delegate_5", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_5", + "stakers": Array [], }, Object { "address": "b7580969dd56151f608931f126f793bbf45d8fa0", - "totalVotesReceived": "0", - "username": "delegate_6", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_6", + "stakers": Array [], }, Object { "address": "58d907d26508603e838423daa2061c29c7a84950", - "totalVotesReceived": "0", - "username": "delegate_7", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_7", + "stakers": Array [], }, Object { "address": "52f9cdcff0605241c78278690ae36eb0136a30ff", - "totalVotesReceived": "0", - "username": "delegate_8", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_8", + "stakers": Array [], }, Object { "address": "b485becd88db1ab3d556d405204451ba00adaa7d", - "totalVotesReceived": "0", - "username": "delegate_9", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_9", + "stakers": Array [], }, Object { "address": "4fd52f67f151fbbdda9dd92a714884a399830eca", - "totalVotesReceived": "0", - "username": "delegate_10", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_10", + "stakers": Array [], }, Object { "address": "24c130eb6cc0d8f663a8f6d16ffc61f935a2e02e", - "totalVotesReceived": "0", - "username": "delegate_11", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_11", + "stakers": Array [], }, Object { "address": "e39316cc020089ea7a5614bcf69a8931c10630a7", - "totalVotesReceived": "0", - "username": "delegate_12", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_12", + "stakers": Array [], }, Object { "address": "6b9895c31bcdb2d9c929b9da7e389ed91de672a0", - "totalVotesReceived": "0", - "username": "delegate_13", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_13", + "stakers": Array [], }, Object { "address": "1ac73bff74924ad9b74236c4962be27174ae87d0", - "totalVotesReceived": "0", - "username": "delegate_14", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_14", + "stakers": Array [], }, Object { "address": "31fe789b43277e35ab410f2afcfb574280af2dd8", - "totalVotesReceived": "0", - "username": "delegate_15", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_15", + "stakers": Array [], }, Object { "address": "a0620472cde03e77caece701ab7bc5928a5d367c", - "totalVotesReceived": "0", - "username": "delegate_16", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_16", + "stakers": Array [], }, Object { "address": "f730cb929a1c45032387c345e10d2427bea55a5e", - "totalVotesReceived": "0", - "username": "delegate_17", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_17", + "stakers": Array [], }, Object { "address": "a6f6a0543ae470c6b056021cb2ac153368eafeec", - "totalVotesReceived": "0", - "username": "delegate_18", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_18", + "stakers": Array [], }, Object { "address": "79f30c1cbc1b9c4949c8b85acc24a7578e01558b", - "totalVotesReceived": "0", - "username": "delegate_19", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_19", + "stakers": Array [], }, Object { "address": "cb579ee537b34926d47129a0b54c0e6d00ef3004", - "totalVotesReceived": "0", - "username": "delegate_20", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_20", + "stakers": Array [], }, Object { "address": "436b40f58c0c27ed133f6001a019ff25561efad4", - "totalVotesReceived": "0", - "username": "delegate_21", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_21", + "stakers": Array [], }, Object { "address": "4e874bcfb6f5896fe9e5dab3b26f59b2e2a9c09b", - "totalVotesReceived": "0", - "username": "delegate_22", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_22", + "stakers": Array [], }, Object { "address": "d2c9a93755aed20c4d8f55c1e92b812d2c7d49d2", - "totalVotesReceived": "0", - "username": "delegate_23", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_23", + "stakers": Array [], }, Object { "address": "3de95e18f18a54e2269bbf8f1a38ea70762c73fa", - "totalVotesReceived": "0", - "username": "delegate_24", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_24", + "stakers": Array [], }, Object { "address": "df0e187bb3895806261c87cf66e1772566ee8e58", - "totalVotesReceived": "0", - "username": "delegate_25", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_25", + "stakers": Array [], }, Object { "address": "be89f4e983dfb04e2b58a12eb9ed18149e108b07", - "totalVotesReceived": "0", - "username": "delegate_26", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_26", + "stakers": Array [], }, Object { "address": "4b6126597881cb6ba1a45c1f6286769e7a094fb4", - "totalVotesReceived": "0", - "username": "delegate_27", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_27", + "stakers": Array [], }, Object { "address": "70abf056bd92e8f77cfc551748fa54a4e3018d5f", - "totalVotesReceived": "0", - "username": "delegate_28", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_28", + "stakers": Array [], }, Object { "address": "d0a0e45b950e3871d8783b973409042b4ab382d4", - "totalVotesReceived": "0", - "username": "delegate_29", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_29", + "stakers": Array [], }, Object { "address": "3deeb0a7426a028b435b4ddd8d35ac85cf567237", - "totalVotesReceived": "0", - "username": "delegate_30", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_30", + "stakers": Array [], }, Object { "address": "5fbd442a4647b079cda1229ecf6d8f44f361c8ca", - "totalVotesReceived": "0", - "username": "delegate_31", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_31", + "stakers": Array [], }, Object { "address": "ad42f8e867d618171bf4982e64269442148f6e11", - "totalVotesReceived": "0", - "username": "delegate_32", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_32", + "stakers": Array [], }, Object { "address": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", - "totalVotesReceived": "0", - "username": "delegate_33", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_33", + "stakers": Array [], }, Object { "address": "9139c91f8a0aa1fb385770feaf299b99883aec2d", - "totalVotesReceived": "0", - "username": "delegate_34", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_34", + "stakers": Array [], }, Object { "address": "61f396d2a4a13ab7a39ba791fac4b921b54a208e", - "totalVotesReceived": "0", - "username": "delegate_35", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_35", + "stakers": Array [], }, Object { "address": "8722453383f781d5427a4ee211020e49bf34a2b9", - "totalVotesReceived": "0", - "username": "delegate_36", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_36", + "stakers": Array [], }, Object { "address": "8074f0d02f748fc55448a4bf200f1dade8517059", - "totalVotesReceived": "0", - "username": "delegate_37", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_37", + "stakers": Array [], }, Object { "address": "308a95d1d3f7bb556f48da4f4344566e59f6f1cb", - "totalVotesReceived": "0", - "username": "delegate_38", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_38", + "stakers": Array [], }, Object { "address": "d5bd2050b74b309d54819ca17add173c6fca1e16", - "totalVotesReceived": "0", - "username": "delegate_39", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_39", + "stakers": Array [], }, Object { "address": "8b1c221a030cf720736d9fb7d0499dd7276fc1b3", - "totalVotesReceived": "0", - "username": "delegate_40", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_40", + "stakers": Array [], }, Object { "address": "6330fd8ae91df4a5d7fbc2390c182ec6676dc5a6", - "totalVotesReceived": "0", - "username": "delegate_41", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_41", + "stakers": Array [], }, Object { "address": "94146c9889748c7b727eb3ac8c20e53c52effd32", - "totalVotesReceived": "0", - "username": "delegate_42", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_42", + "stakers": Array [], }, Object { "address": "290abc4a2244bf0ecf5aa1ccee8ac8f60f8bce48", - "totalVotesReceived": "0", - "username": "delegate_43", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_43", + "stakers": Array [], }, Object { "address": "abd2ed5ad35b3a0870aadae6dceacc988ba63895", - "totalVotesReceived": "0", - "username": "delegate_44", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_44", + "stakers": Array [], }, Object { "address": "1c194c2be1cc53f663a93c64899cbaa34016f415", - "totalVotesReceived": "0", - "username": "delegate_45", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_45", + "stakers": Array [], }, Object { "address": "5cd1d0ccf98f2bd5a4bfaa770d55f16498af0bcc", - "totalVotesReceived": "0", - "username": "delegate_46", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_46", + "stakers": Array [], }, Object { "address": "657f610728eef97d55e50212871f0993bb7cc700", - "totalVotesReceived": "0", - "username": "delegate_47", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_47", + "stakers": Array [], }, Object { "address": "2159f75e5440c36431aedbc7dc29a65a327778b8", - "totalVotesReceived": "0", - "username": "delegate_48", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_48", + "stakers": Array [], }, Object { "address": "0f33a5033b750e6c4dca47e38ba020e912df143e", - "totalVotesReceived": "0", - "username": "delegate_49", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_49", + "stakers": Array [], }, Object { "address": "9b42e4264020f3c3dcaaed806578ccd469205060", - "totalVotesReceived": "0", - "username": "delegate_50", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_50", + "stakers": Array [], }, Object { "address": "aebd99f07218109162a905d0e0c91e58bedc83c5", - "totalVotesReceived": "0", - "username": "delegate_51", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_51", + "stakers": Array [], }, Object { "address": "82cbc7b39d35af358f9e2513af13b2f77b647a00", - "totalVotesReceived": "0", - "username": "delegate_52", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_52", + "stakers": Array [], }, Object { "address": "0d2c377e936b68c70066613b10c0fdad537f90da", - "totalVotesReceived": "0", - "username": "delegate_53", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_53", + "stakers": Array [], }, Object { "address": "89b144ecfdd5ea352083bf624d3cf842ec06a5e3", - "totalVotesReceived": "0", - "username": "delegate_54", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_54", + "stakers": Array [], }, Object { "address": "2cf52c08cc76091d884e800c1c697b13f69907d4", - "totalVotesReceived": "0", - "username": "delegate_55", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_55", + "stakers": Array [], }, Object { "address": "e2950a9f07b44e724df2129360cc140293c08308", - "totalVotesReceived": "0", - "username": "delegate_56", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_56", + "stakers": Array [], }, Object { "address": "65f927187bf96aac5d968fcc9351e5492b5f9356", - "totalVotesReceived": "0", - "username": "delegate_57", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_57", + "stakers": Array [], }, Object { "address": "d06fe6d3e5f7facb5855eca839422fe3824a5d6e", - "totalVotesReceived": "0", - "username": "delegate_58", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_58", + "stakers": Array [], }, Object { "address": "6e12e4498ae69fb07ff2d8aab036a911229d6c62", - "totalVotesReceived": "0", - "username": "delegate_59", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_59", + "stakers": Array [], }, Object { "address": "dcb5bf35b6d521195e613c42483f520139e2331d", - "totalVotesReceived": "0", - "username": "delegate_60", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_60", + "stakers": Array [], }, Object { "address": "8506f3c10f75044946f1a23a7caf578253649471", - "totalVotesReceived": "0", - "username": "delegate_61", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_61", + "stakers": Array [], }, Object { "address": "d3c8064d011ef853e3be506b95a045f41f78e72a", - "totalVotesReceived": "0", - "username": "delegate_62", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_62", + "stakers": Array [], }, Object { "address": "c98554123062ac5795a3ee905b081e863db5a818", - "totalVotesReceived": "0", - "username": "delegate_63", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_63", + "stakers": Array [], }, Object { "address": "a0bc50b27e7ac39060ed015a55f2f4508c84f0c2", - "totalVotesReceived": "0", - "username": "delegate_64", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_64", + "stakers": Array [], }, Object { "address": "d5c4e380b1ec2f7f2068cfba9a90cb3ae7816110", - "totalVotesReceived": "0", - "username": "delegate_65", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_65", + "stakers": Array [], }, Object { "address": "7d2c6781d873ed2ba7a87f46f735f5e15a41a6f1", - "totalVotesReceived": "0", - "username": "delegate_66", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_66", + "stakers": Array [], }, Object { "address": "3b3e137b1bec6f20c9a8b2ad4f5784661fb0fa79", - "totalVotesReceived": "0", - "username": "delegate_67", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_67", + "stakers": Array [], }, Object { "address": "6ffcd8ad547d8a549a31b25236e322c781a52d85", - "totalVotesReceived": "0", - "username": "delegate_68", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_68", + "stakers": Array [], }, Object { "address": "bd175729d4177259c71cf13fd4ecfb5d01542706", - "totalVotesReceived": "0", - "username": "delegate_69", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_69", + "stakers": Array [], }, Object { "address": "5853a3f24990deecced49d6bc15990102ec0c33a", - "totalVotesReceived": "0", - "username": "delegate_70", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_70", + "stakers": Array [], }, Object { "address": "e9355152c117c9e1fad8be86e9abea961cef4a36", - "totalVotesReceived": "0", - "username": "delegate_71", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_71", + "stakers": Array [], }, Object { "address": "4f4422eb61c45edb4d76f10cd871c9f983f2ebaa", - "totalVotesReceived": "0", - "username": "delegate_72", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_72", + "stakers": Array [], }, Object { "address": "0903f4c5cb599a7928aef27e314e98291d1e3888", - "totalVotesReceived": "0", - "username": "delegate_73", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_73", + "stakers": Array [], }, Object { "address": "31204ad5b95dd922c2899aa5bf8e7ee5b7546af3", - "totalVotesReceived": "0", - "username": "delegate_74", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_74", + "stakers": Array [], }, Object { "address": "8459b8870fcefff59f172d716b7bfe9fcc28d408", - "totalVotesReceived": "0", - "username": "delegate_75", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_75", + "stakers": Array [], }, Object { "address": "246fba5c519576d93c5fac899c44b29b72f526ae", - "totalVotesReceived": "0", - "username": "delegate_76", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_76", + "stakers": Array [], }, Object { "address": "d8e611bafd70a549f035cf61ab0d6ed9e7f25c4e", - "totalVotesReceived": "0", - "username": "delegate_77", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_77", + "stakers": Array [], }, Object { "address": "7d60db187337cbd881140d69d84c9246eda8382e", - "totalVotesReceived": "0", - "username": "delegate_78", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_78", + "stakers": Array [], }, Object { "address": "b11c5811ea074a30142d824b6e8cfd3df14b2688", - "totalVotesReceived": "0", - "username": "delegate_79", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_79", + "stakers": Array [], }, Object { "address": "8eceffd5a41e678b6467c9bc80ce35d2e8543d98", - "totalVotesReceived": "0", - "username": "delegate_80", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_80", + "stakers": Array [], }, Object { "address": "ca5f6d76eab6e4f5aacee2864c79034d7111b986", - "totalVotesReceived": "0", - "username": "delegate_81", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_81", + "stakers": Array [], }, Object { "address": "0bc3bec2fdb565996fd316e368e66e5d8e830808", - "totalVotesReceived": "0", - "username": "delegate_82", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_82", + "stakers": Array [], }, Object { "address": "ab0041a7d3f7b2c290b5b834d46bdc7b7eb85815", - "totalVotesReceived": "0", - "username": "delegate_83", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_83", + "stakers": Array [], }, Object { "address": "c697b620c7c4015e32dd7bdd7d0430b33404e107", - "totalVotesReceived": "0", - "username": "delegate_84", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_84", + "stakers": Array [], }, Object { "address": "c3ab2ac23512d9bf62b02775e22cf80df814eb1b", - "totalVotesReceived": "0", - "username": "delegate_85", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_85", + "stakers": Array [], }, Object { "address": "ca309a5f4bbf11ca86592febb6d2ccc78309f69e", - "totalVotesReceived": "0", - "username": "delegate_86", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_86", + "stakers": Array [], }, Object { "address": "27843a60a1e044c1e6e3cf119fdf64eb2b3e0d94", - "totalVotesReceived": "0", - "username": "delegate_87", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_87", + "stakers": Array [], }, Object { "address": "8ac800124d5b16afd57b5cf7245edfcd5885ea3b", - "totalVotesReceived": "0", - "username": "delegate_88", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_88", + "stakers": Array [], }, Object { "address": "a28d5e34007fd8fe6d7903044eb23a60fdad3c00", - "totalVotesReceived": "0", - "username": "delegate_89", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_89", + "stakers": Array [], }, Object { "address": "d5e1f52cbe4a11a3730b98f52109b57602a9c4a1", - "totalVotesReceived": "0", - "username": "delegate_90", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_90", + "stakers": Array [], }, Object { "address": "3c80e7d9964a1c83a6dd5dc64e105e0e634bd58a", - "totalVotesReceived": "0", - "username": "delegate_91", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_91", + "stakers": Array [], }, Object { "address": "fa526a1611ccc66dec815cb963174118074b736e", - "totalVotesReceived": "0", - "username": "delegate_92", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_92", + "stakers": Array [], }, Object { "address": "3b96d8565569421f43684b2c4eaa0639cbb5e011", - "totalVotesReceived": "0", - "username": "delegate_93", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_93", + "stakers": Array [], }, Object { "address": "acfbdbaeb93d587170c7cd9c0b5ffdeb7ff9daec", - "totalVotesReceived": "0", - "username": "delegate_94", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_94", + "stakers": Array [], }, Object { "address": "ffce8ce225c5d80098f50e877125b655aef6d101", - "totalVotesReceived": "0", - "username": "delegate_95", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_95", + "stakers": Array [], }, Object { "address": "a9c66694dd65b2fdf40cdf45a0c308cbd38004fc", - "totalVotesReceived": "0", - "username": "delegate_96", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_96", + "stakers": Array [], }, Object { "address": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", - "totalVotesReceived": "0", - "username": "delegate_97", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_97", + "stakers": Array [], }, Object { "address": "b76a0f1819c4be0a1482567ca9b9fbed3eda444c", - "totalVotesReceived": "0", - "username": "delegate_98", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_98", + "stakers": Array [], }, Object { "address": "b543e2e592200beb38235f6e48f8abe1d87ad872", - "totalVotesReceived": "0", - "username": "delegate_99", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_99", + "stakers": Array [], }, Object { "address": "4fd8cc4e27a3489b57ed986efe3d327d3de40d92", - "totalVotesReceived": "0", - "username": "delegate_100", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_100", + "stakers": Array [], }, Object { "address": "936f3a0f4d776b6a7722ed126e8ff17b44d7e7b8", - "totalVotesReceived": "0", - "username": "delegate_101", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_101", + "stakers": Array [], }, Object { "address": "5ade564399e670bd1d429583059067f3a6ca2b7f", - "totalVotesReceived": "0", - "username": "delegate_102", - "voters": Array [], + "totalStakeReceived": "0", + "username": "validator_102", + "stakers": Array [], }, ] `; diff --git a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/event_track.spec.ts.snap b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/event_track.spec.ts.snap index 63872096edd..d08b75ca48b 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/event_track.spec.ts.snap +++ b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/event_track.spec.ts.snap @@ -5,16 +5,16 @@ Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [], + "stakeReceived": Array [], } `; -exports[`Forger Info New Block Vote transactions should save forger info with votes received in new block 1`] = ` +exports[`Forger Info New Block Stake transactions should save forger info with stakes received in new block 1`] = ` Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [ + "stakeReceived": Array [ Object { "address": Object { "data": Array [ @@ -47,12 +47,12 @@ Object { } `; -exports[`Forger Info New Block Vote transactions should update forger info with multiple votes received for same delegate in new block 1`] = ` +exports[`Forger Info New Block Stake transactions should update forger info with multiple stakes received for same validator in new block 1`] = ` Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [ + "stakeReceived": Array [ Object { "address": Object { "data": Array [ @@ -85,12 +85,12 @@ Object { } `; -exports[`Forger Info New Block Vote transactions should update forger info with upvote and downvote for same delegate in new block 1`] = ` +exports[`Forger Info New Block Stake transactions should update forger info with upvote and downvote for same validator in new block 1`] = ` Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [ + "stakeReceived": Array [ Object { "address": Object { "data": Array [ @@ -123,21 +123,21 @@ Object { } `; -exports[`Forger Info New Block Vote transactions should update forger info with voters info and remove when amount becomes zero 1`] = ` +exports[`Forger Info New Block Stake transactions should update forger info with stakers info and remove when amount becomes zero 1`] = ` Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [], + "stakeReceived": Array [], } `; -exports[`Forger Info New Block Vote transactions should update forger info with voters info and remove when amount becomes zero 2`] = ` +exports[`Forger Info New Block Stake transactions should update forger info with stakers info and remove when amount becomes zero 2`] = ` Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [ + "stakeReceived": Array [ Object { "address": Object { "data": Array [ @@ -175,7 +175,7 @@ Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [], + "stakeReceived": Array [], } `; @@ -184,6 +184,6 @@ Object { "totalProducedBlocks": 0, "totalReceivedFees": 0n, "totalReceivedRewards": 0n, - "votesReceived": Array [], + "stakeReceived": Array [], } `; diff --git a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/forger_info_sync.spec.ts.snap b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/forger_info_sync.spec.ts.snap index 8b22cde47e3..ab350fc978d 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/forger_info_sync.spec.ts.snap +++ b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/__snapshots__/forger_info_sync.spec.ts.snap @@ -5,6 +5,6 @@ Object { "totalProducedBlocks": 1, "totalReceivedFees": 29858000n, "totalReceivedRewards": 0n, - "votesReceived": Array [], + "stakeReceived": Array [], } `; diff --git a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/event_track.spec.ts b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/event_track.spec.ts index 1f0cfaf1d6b..784c5229978 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/event_track.spec.ts +++ b/framework-plugins/lisk-framework-forger-plugin/test/functional/forger_info/event_track.spec.ts @@ -15,7 +15,7 @@ import { testing, PartialApplicationConfig } from 'lisk-sdk'; import { getForgerInfoByAddress, getForgerPlugin, waitTill } from '../../utils/application'; import { getRandomAccount } from '../../utils/accounts'; -import { createTransferTransaction, createVoteTransaction } from '../../utils/transactions'; +import { createTransferTransaction, createStakeTransaction } from '../../utils/transactions'; import { ForgerPlugin } from '../../../src'; describe('Forger Info', () => { @@ -91,14 +91,14 @@ describe('Forger Info', () => { expect(forgerInfo).toMatchSnapshot(); }); - describe('Vote transactions', () => { - it('should save forger info with votes received in new block', async () => { + describe('Stake transactions', () => { + it('should save forger info with stakes received in new block', async () => { // Arrange const forgerPluginInstance = getForgerPlugin(appEnv.application); - const [forgingDelegateAddress] = forgerPluginInstance['_forgersList'].entries()[0]; - const transaction1 = createVoteTransaction({ + const [forgingValidatorAddress] = forgerPluginInstance['_forgersList'].entries()[0]; + const transaction1 = createStakeTransaction({ amount: '10', - recipientAddress: forgingDelegateAddress.toString('hex'), + recipientAddress: forgingValidatorAddress.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, @@ -113,28 +113,28 @@ describe('Forger Info', () => { const forgerInfo = await getForgerInfoByAddress( forgerPluginInstance, - forgingDelegateAddress.toString('binary'), + forgingValidatorAddress.toString('binary'), ); // Assert expect(forgerInfo).toMatchSnapshot(); - expect(forgerInfo.votesReceived[0].amount).toEqual(BigInt(1000000000)); + expect(forgerInfo.stakeReceived[0].amount).toEqual(BigInt(1000000000)); }); - it('should update forger info with multiple votes received for same delegate in new block', async () => { + it('should update forger info with multiple stakes received for same validator in new block', async () => { // Arrange const forgerPluginInstance = getForgerPlugin(appEnv.application); - const [forgingDelegateAddress] = forgerPluginInstance['_forgersList'].entries()[0]; - const transaction1 = createVoteTransaction({ + const [forgingValidatorAddress] = forgerPluginInstance['_forgersList'].entries()[0]; + const transaction1 = createStakeTransaction({ amount: '10', - recipientAddress: forgingDelegateAddress.toString('hex'), + recipientAddress: forgingValidatorAddress.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, }); accountNonce += 1; - const transaction2 = createVoteTransaction({ + const transaction2 = createStakeTransaction({ amount: '50', - recipientAddress: forgingDelegateAddress.toString('hex'), + recipientAddress: forgingValidatorAddress.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, @@ -152,28 +152,28 @@ describe('Forger Info', () => { const forgerInfo = await getForgerInfoByAddress( forgerPluginInstance, - forgingDelegateAddress.toString('binary'), + forgingValidatorAddress.toString('binary'), ); // Assert expect(forgerInfo).toMatchSnapshot(); - expect(forgerInfo.votesReceived[0].amount).toEqual(BigInt(7000000000)); + expect(forgerInfo.stakeReceived[0].amount).toEqual(BigInt(7000000000)); }); - it('should update forger info with upvote and downvote for same delegate in new block', async () => { + it('should update forger info with upvote and downvote for same validator in new block', async () => { // Arrange const forgerPluginInstance = getForgerPlugin(appEnv.application); - const [forgingDelegateAddress] = forgerPluginInstance['_forgersList'].entries()[0]; - const transaction1 = createVoteTransaction({ + const [forgingValidatorAddress] = forgerPluginInstance['_forgersList'].entries()[0]; + const transaction1 = createStakeTransaction({ amount: '-50', - recipientAddress: forgingDelegateAddress.toString('hex'), + recipientAddress: forgingValidatorAddress.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, }); accountNonce += 1; - const transaction2 = createVoteTransaction({ + const transaction2 = createStakeTransaction({ amount: '+10', - recipientAddress: forgingDelegateAddress.toString('hex'), + recipientAddress: forgingValidatorAddress.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, @@ -191,29 +191,29 @@ describe('Forger Info', () => { const forgerInfo = await getForgerInfoByAddress( forgerPluginInstance, - forgingDelegateAddress.toString('binary'), + forgingValidatorAddress.toString('binary'), ); // Assert expect(forgerInfo).toMatchSnapshot(); - expect(forgerInfo.votesReceived[0].amount).toEqual(BigInt(3000000000)); + expect(forgerInfo.stakeReceived[0].amount).toEqual(BigInt(3000000000)); }); - it('should update forger info with voters info and remove when amount becomes zero', async () => { + it('should update forger info with stakers info and remove when amount becomes zero', async () => { // Arrange const forgerPluginInstance = getForgerPlugin(appEnv.application); - const [forgingDelegateAddress1] = forgerPluginInstance['_forgersList'].entries()[0]; - const [forgingDelegateAddress2] = forgerPluginInstance['_forgersList'].entries()[1]; - const transaction1 = createVoteTransaction({ + const [forgingValidatorAddress1] = forgerPluginInstance['_forgersList'].entries()[0]; + const [forgingValidatorAddress2] = forgerPluginInstance['_forgersList'].entries()[1]; + const transaction1 = createStakeTransaction({ amount: '-30', - recipientAddress: forgingDelegateAddress1.toString('hex'), + recipientAddress: forgingValidatorAddress1.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, }); accountNonce += 1; - const transaction2 = createVoteTransaction({ + const transaction2 = createStakeTransaction({ amount: '20', - recipientAddress: forgingDelegateAddress2.toString('hex'), + recipientAddress: forgingValidatorAddress2.toString('hex'), fee: '0.3', nonce: accountNonce, chainID, @@ -231,17 +231,17 @@ describe('Forger Info', () => { const forgerInfo1 = await getForgerInfoByAddress( forgerPluginInstance, - forgingDelegateAddress1.toString('binary'), + forgingValidatorAddress1.toString('binary'), ); const forgerInfo2 = await getForgerInfoByAddress( forgerPluginInstance, - forgingDelegateAddress2.toString('binary'), + forgingValidatorAddress2.toString('binary'), ); // Assert expect(forgerInfo1).toMatchSnapshot(); - expect(forgerInfo1.votesReceived).toBeEmpty(); + expect(forgerInfo1.stakeReceived).toBeEmpty(); expect(forgerInfo2).toMatchSnapshot(); - expect(forgerInfo2.votesReceived[0].amount).toEqual(BigInt(2000000000)); + expect(forgerInfo2.stakeReceived[0].amount).toEqual(BigInt(2000000000)); }); }); }); diff --git a/framework-plugins/lisk-framework-forger-plugin/test/functional/voters.spec.ts b/framework-plugins/lisk-framework-forger-plugin/test/functional/voters.spec.ts index 16ddde75687..d1105d7b5a6 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/functional/voters.spec.ts +++ b/framework-plugins/lisk-framework-forger-plugin/test/functional/voters.spec.ts @@ -14,10 +14,10 @@ import { testing, PartialApplicationConfig } from 'lisk-sdk'; import { waitTill } from '../utils/application'; -import { createVoteTransaction } from '../utils/transactions'; +import { createStakeTransaction } from '../utils/transactions'; import { ForgerPlugin } from '../../src'; -describe('forger:getVoters action', () => { +describe('forger:getStakers action', () => { let appEnv: testing.ApplicationEnv; let accountNonce = 0; let chainID: Buffer; @@ -26,7 +26,7 @@ describe('forger:getVoters action', () => { const rootPath = '~/.lisk/forger-plugin'; const config = { rootPath, - label: 'voters_functional', + label: 'stakers_functional', } as PartialApplicationConfig; appEnv = testing.createDefaultApplicationEnv({ @@ -44,32 +44,32 @@ describe('forger:getVoters action', () => { await appEnv.stopApplication(); }); - describe('action forger:getVoters', () => { + describe('action forger:getStakers', () => { it('should return valid format', async () => { // Arrange & Act - const voters = await appEnv.ipcClient.invoke('forger:getVoters'); + const stakers = await appEnv.ipcClient.invoke('forger:getStakers'); // Assert - expect(voters).toMatchSnapshot(); - expect(voters).toBeInstanceOf(Array); - expect(voters).toHaveLength(103); - expect(voters[0]).toMatchObject( + expect(stakers).toMatchSnapshot(); + expect(stakers).toBeInstanceOf(Array); + expect(stakers).toHaveLength(103); + expect(stakers[0]).toMatchObject( expect.objectContaining({ address: expect.any(String), username: expect.any(String), - totalVotesReceived: expect.any(String), - voters: expect.any(Array), + totalStakeReceived: expect.any(String), + stakers: expect.any(Array), }), ); }); - it('should return valid voters', async () => { + it('should return valid stakers', async () => { // Arrange - const initialVoters = await appEnv.ipcClient.invoke('forger:getVoters'); - const forgingDelegateAddress = (initialVoters[0] as any).address; - const transaction = createVoteTransaction({ + const initialStakers = await appEnv.ipcClient.invoke('forger:getStakers'); + const forgingValidatorAddress = (initialStakers[0] as any).address; + const transaction = createStakeTransaction({ amount: '10', - recipientAddress: forgingDelegateAddress, + recipientAddress: forgingValidatorAddress, fee: '0.3', nonce: accountNonce, chainID, @@ -84,13 +84,13 @@ describe('forger:getVoters action', () => { await waitTill(2000); // Act - const voters = await appEnv.ipcClient.invoke('forger:getVoters'); - const forgerInfo = (voters as any).find( - (forger: any) => forger.address === forgingDelegateAddress, + const stakers = await appEnv.ipcClient.invoke('forger:getStakers'); + const forgerInfo = (stakers as any).find( + (forger: any) => forger.address === forgingValidatorAddress, ); // Assert - expect(forgerInfo.voters[0]).toMatchObject( + expect(forgerInfo.stakers[0]).toMatchObject( expect.objectContaining({ address: transaction.senderAddress.toString('hex'), amount: '1000000000', diff --git a/framework-plugins/lisk-framework-forger-plugin/test/utils/transactions.ts b/framework-plugins/lisk-framework-forger-plugin/test/utils/transactions.ts index e1a891758cd..ba5a61b59ea 100644 --- a/framework-plugins/lisk-framework-forger-plugin/test/utils/transactions.ts +++ b/framework-plugins/lisk-framework-forger-plugin/test/utils/transactions.ts @@ -52,7 +52,7 @@ export const createTransferTransaction = ({ return tx; }; -export const createVoteTransaction = ({ +export const createStakeTransaction = ({ amount, fee, recipientAddress, @@ -66,10 +66,10 @@ export const createVoteTransaction = ({ chainID: Buffer; }): Transaction => { const genesisAccount = testing.fixtures.defaultFaucetAccount; - const encodedAsset = codec.encode(new DPoSVoteAsset().schema, { - votes: [ + const encodedAsset = codec.encode(new PoSStakeAsset().schema, { + stakes: [ { - delegateAddress: Buffer.from(recipientAddress, 'hex'), + validatorAddress: Buffer.from(recipientAddress, 'hex'), amount: BigInt(transactions.convertLSKToBeddows(amount)), }, ], diff --git a/framework-plugins/lisk-framework-report-misbehavior-plugin/README.md b/framework-plugins/lisk-framework-report-misbehavior-plugin/README.md index 1ca0dc01030..01672b338a4 100644 --- a/framework-plugins/lisk-framework-report-misbehavior-plugin/README.md +++ b/framework-plugins/lisk-framework-report-misbehavior-plugin/README.md @@ -1,6 +1,6 @@ # @liskhq/lisk-framework-report-misbehavior-plugin -@liskhq/lisk-framework-report-misbehavior-plugin is a plugin for lisk-framework that provides automatic detection of delegate misbehavior and sends a reportDelegateMisbehaviorTransaction to the running node. +@liskhq/lisk-framework-report-misbehavior-plugin is a plugin for lisk-framework that provides automatic detection of validator misbehavior and sends a reportValidatorMisbehaviorTransaction to the running node. ## Installation diff --git a/framework-plugins/lisk-framework-report-misbehavior-plugin/package.json b/framework-plugins/lisk-framework-report-misbehavior-plugin/package.json index 99a889bf1ba..fd89182d8ff 100644 --- a/framework-plugins/lisk-framework-report-misbehavior-plugin/package.json +++ b/framework-plugins/lisk-framework-report-misbehavior-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@liskhq/lisk-framework-report-misbehavior-plugin", "version": "0.3.0-alpha.5", - "description": "A plugin for lisk-framework that provides automatic detection of delegate misbehavior and sends a reportDelegateMisbehaviorTransaction to the running node", + "description": "A plugin for lisk-framework that provides automatic detection of validator misbehavior and sends a reportValidatorMisbehaviorTransaction to the running node", "author": "Lisk Foundation , lightcurve GmbH ", "license": "Apache-2.0", "keywords": [ diff --git a/framework-plugins/lisk-framework-report-misbehavior-plugin/src/report_misbehavior_plugin.ts b/framework-plugins/lisk-framework-report-misbehavior-plugin/src/report_misbehavior_plugin.ts index 23312ef2332..718097e0734 100644 --- a/framework-plugins/lisk-framework-report-misbehavior-plugin/src/report_misbehavior_plugin.ts +++ b/framework-plugins/lisk-framework-report-misbehavior-plugin/src/report_misbehavior_plugin.ts @@ -126,14 +126,14 @@ export class ReportMisbehaviorPlugin extends BasePlugin { - // ModuleID:13 (DPoS), CommandID:3 (PoMCommand) - const dposMeta = this.apiClient.metadata.find( + // ModuleID:13 (PoS), CommandID:3 (PoMCommand) + const posMeta = this.apiClient.metadata.find( m => m.id === Buffer.from([0, 0, 0, 13]).toString('hex'), ); - if (!dposMeta) { - throw new Error('DPoS module is not registered in the application.'); + if (!posMeta) { + throw new Error('PoS module is not registered in the application.'); } - const pomParamsInfo = dposMeta.commands.find( + const pomParamsInfo = posMeta.commands.find( m => m.id === Buffer.from([0, 0, 0, 3]).toString('hex'), ); if (!pomParamsInfo || !pomParamsInfo.params) { @@ -159,7 +159,7 @@ export class ReportMisbehaviorPlugin extends BasePlugin { commands: [ { moduleID: utils.intToBuffer(5, 4), - moduleName: 'dpos', + moduleName: 'pos', commandID: utils.intToBuffer(3, 4), - commandName: 'reportDelegateMisbehavior', + commandName: 'reportValidatorMisbehavior', schema: { - $id: '/lisk/dpos/pom', + $id: '/lisk/pos/pom', type: 'object', required: ['header1', 'header2'], properties: { diff --git a/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/__snapshots__/send_pom_transaction.spec.ts.snap b/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/__snapshots__/send_pom_transaction.spec.ts.snap index 346342f1356..f2a6502352b 100644 --- a/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/__snapshots__/send_pom_transaction.spec.ts.snap +++ b/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/__snapshots__/send_pom_transaction.spec.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Send PoM transaction should create pom transaction for given block headers 1`] = `"0a0464706f7312197265706f727444656c65676174654d69736265686176696f7218002080c2d72f2a2031048f87ca35a00a553633dd03c788d4b82ea9caf6ccc36315cf8e595f3e7a8332b6040a980208021064186422203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989902a1440ff452fae2affe6eeef3c30e53e9eac35a1bc4332203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899042203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989904a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989905020580060006a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989907206080012001a007a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899012980208021064186422203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989902a1440ff452fae2affe6eeef3c30e53e9eac35a1bc4332203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899042203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989904a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989905032580060006a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989907206080012001a007a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a4039af247f493389605d4c1e5660ce9dd360a463434b807086e2df01a0cca73fb384e08ae2cceb288409161118589703ac517b423d57e9f2e0bd52630b35591109"`; +exports[`Send PoM transaction should create pom transaction for given block headers 1`] = `"0a03706f73121a7265706f727456616c696461746f724d69736265686176696f7218002080c2d72f2a2031048f87ca35a00a553633dd03c788d4b82ea9caf6ccc36315cf8e595f3e7a8332b6040a980208021064186422203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989902a1440ff452fae2affe6eeef3c30e53e9eac35a1bc4332203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899042203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989904a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989905020580060006a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989907206080012001a007a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899012980208021064186422203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989902a1440ff452fae2affe6eeef3c30e53e9eac35a1bc4332203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e6589899042203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989904a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989905032580060006a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989907206080012001a007a203d1b5dd1ef4ff7b22359598ebdf58966a51adcc03e02ad356632743e658989903a40fbc4b3864cb4bf331bf10bbd9fcd8107590b4272fc2868efcad95a0eb7e036b84aaff63a02ad15e9d89e7085621392e1e065c1ab29a54a4ab01f1851be5c9b0f"`; diff --git a/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/send_pom_transaction.spec.ts b/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/send_pom_transaction.spec.ts index fe370827035..57340e2ccec 100644 --- a/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/send_pom_transaction.spec.ts +++ b/framework-plugins/lisk-framework-report-misbehavior-plugin/test/unit/send_pom_transaction.spec.ts @@ -90,13 +90,13 @@ describe('Send PoM transaction', () => { metadata: [ { id: utils.intToBuffer(13, 4).toString('hex'), - name: 'dpos', + name: 'pos', commands: [ { id: utils.intToBuffer(3, 4).toString('hex'), - name: 'reportDelegateMisbehavior', + name: 'reportValidatorMisbehavior', params: { - $id: '/lisk/dpos/pom', + $id: '/lisk/pos/pom', type: 'object', required: ['header1', 'header2'], properties: { @@ -151,7 +151,7 @@ describe('Send PoM transaction', () => { metadata: [ { id: utils.intToBuffer(13, 4).toString('hex'), - name: 'dpos', + name: 'pos', commands: [], }, ], diff --git a/framework/.eslintignore b/framework/.eslintignore index 1e0a0f2f468..dc2fb1d5873 100644 --- a/framework/.eslintignore +++ b/framework/.eslintignore @@ -14,12 +14,4 @@ test/**/setup.js # Temporally disable integration and functional test/integration -test/functional -# Temporally disable linting for modules -src/modules/dpos -test/unit/modules/dpos -src/modules/keys -test/unit/modules/keys -src/modules/sequence -test/unit/modules/sequence - +test/functional \ No newline at end of file diff --git a/framework/src/application.ts b/framework/src/application.ts index 9fde2b03d01..82a36ccee92 100644 --- a/framework/src/application.ts +++ b/framework/src/application.ts @@ -44,7 +44,7 @@ import { TokenModule, TokenMethod } from './modules/token'; import { AuthModule, AuthMethod } from './modules/auth'; import { FeeModule, FeeMethod } from './modules/fee'; import { RandomModule, RandomMethod } from './modules/random'; -import { DPoSModule, DPoSMethod } from './modules/dpos_v2'; +import { PoSModule, PoSMethod } from './modules/pos'; import { generateGenesisBlock, GenesisBlockGenerateInput } from './genesis_block'; import { StateMachine } from './state_machine'; import { ABIHandler, EVENT_ENGINE_READY } from './abi_handler/abi_handler'; @@ -112,7 +112,7 @@ interface DefaultApplication { fee: FeeMethod; random: RandomMethod; reward: DynamicRewardMethod; - dpos: DPoSMethod; + pos: PoSMethod; interoperability: SidechainInteroperabilityMethod | MainchainInteroperabilityMethod; }; } @@ -168,7 +168,7 @@ export class Application { const rewardModule = new DynamicRewardModule(); const randomModule = new RandomModule(); const validatorModule = new ValidatorsModule(); - const dposModule = new DPoSModule(); + const posModule = new PoSModule(); let interoperabilityModule; if (mainchain) { interoperabilityModule = new MainchainInteroperabilityModule(); @@ -184,9 +184,9 @@ export class Application { tokenModule.method, randomModule.method, validatorModule.method, - dposModule.method, + posModule.method, ); - dposModule.addDependencies(randomModule.method, validatorModule.method, tokenModule.method); + posModule.addDependencies(randomModule.method, validatorModule.method, tokenModule.method); tokenModule.addDependencies(interoperabilityModule.method); // resolve interoperability dependencies @@ -199,7 +199,7 @@ export class Application { application._registerModule(feeModule); application._registerModule(rewardModule); application._registerModule(randomModule); - application._registerModule(dposModule); + application._registerModule(posModule); application._registerModule(interoperabilityModule); return { @@ -209,7 +209,7 @@ export class Application { token: tokenModule.method, auth: authModule.method, fee: feeModule.method, - dpos: dposModule.method, + pos: posModule.method, random: randomModule.method, reward: rewardModule.method, interoperability: interoperabilityModule.method, diff --git a/framework/src/engine/bft/bft_votes.ts b/framework/src/engine/bft/bft_votes.ts index d5503709f47..a1224a63493 100644 --- a/framework/src/engine/bft/bft_votes.ts +++ b/framework/src/engine/bft/bft_votes.ts @@ -66,7 +66,7 @@ export const updatePrevotesPrecommits = async ( v.address.equals(newBlockBFTInfo.generatorAddress), ); if (!validatorInfo) { - // the validator does not exist, meaning it does not have bft vote weight + // the validator does not exist, meaning it does not have bft stake weight return; } const heightNotPrevoted = getHeightNotPrevoted(bftVotes); diff --git a/framework/src/engine/bft/method.ts b/framework/src/engine/bft/method.ts index 7ae8e731ce4..43401a673dc 100644 --- a/framework/src/engine/bft/method.ts +++ b/framework/src/engine/bft/method.ts @@ -130,7 +130,7 @@ export class BFTMethod { if (offset >= bftVotes.blockBFTInfos.length) { return true; } - // block at previousHeight is generated by a different delegate and header doesn't + // block at previousHeight is generated by a different validator and header doesn't // imply maximal number of prevotes if (!bftVotes.blockBFTInfos[offset].generatorAddress.equals(header.generatorAddress)) { return false; diff --git a/framework/src/engine/bft/utils.ts b/framework/src/engine/bft/utils.ts index 77b27aba54f..b3e76e936a9 100644 --- a/framework/src/engine/bft/utils.ts +++ b/framework/src/engine/bft/utils.ts @@ -41,7 +41,7 @@ export const areDistinctHeadersContradicting = (b1: BFTHeader, b2: BFTHeader): b ) { [earlierBlock, laterBlock] = [laterBlock, earlierBlock]; } - // Blocks by different delegates are never contradicting + // Blocks by different validators are never contradicting if (!earlierBlock.generatorAddress.equals(laterBlock.generatorAddress)) { return false; } diff --git a/framework/src/engine/consensus/fork_choice/fork_choice_rule.ts b/framework/src/engine/consensus/fork_choice/fork_choice_rule.ts index bdae37db7f6..1aa88fd1102 100644 --- a/framework/src/engine/consensus/fork_choice/fork_choice_rule.ts +++ b/framework/src/engine/consensus/fork_choice/fork_choice_rule.ts @@ -128,7 +128,7 @@ export const forkChoice = ( } if (isDoubleForging(lastBlockHeader, blockHeader)) { - // Delegates are the same + // Validators are the same // Case 3: double forging different blocks in the same slot. // Last Block stands. return ForkStatus.DOUBLE_FORGING; @@ -141,7 +141,7 @@ export const forkChoice = ( receivedBlock: receivedBFTHeader, }) ) { - // Two competing blocks by different delegates at the same height. + // Two competing blocks by different validators at the same height. // Case 4: Tie break return ForkStatus.TIE_BREAK; } diff --git a/framework/src/engine/consensus/synchronizer/utils.ts b/framework/src/engine/consensus/synchronizer/utils.ts index 206f8b2d815..cd85c9e8775 100644 --- a/framework/src/engine/consensus/synchronizer/utils.ts +++ b/framework/src/engine/consensus/synchronizer/utils.ts @@ -107,14 +107,14 @@ export const restoreBlocksUponStartup = async ( export const computeBlockHeightsList = ( finalizedHeight: number, - activeDelegates: number, + activeValidators: number, listSizeLimit: number, currentRound: number, ): number[] => { - const startingHeight = Math.max((currentRound - 1) * activeDelegates, 0); + const startingHeight = Math.max((currentRound - 1) * activeValidators, 0); const heightList = new Array(listSizeLimit) .fill(0) - .map((_, i) => startingHeight - i * activeDelegates) + .map((_, i) => startingHeight - i * activeValidators) .filter(height => height >= 0); const heightListAfterFinalized = heightList.filter(height => height > finalizedHeight); return heightList.length !== heightListAfterFinalized.length diff --git a/framework/src/engine/generator/endpoint.ts b/framework/src/engine/generator/endpoint.ts index 335d4efc4be..650e7fe77fe 100644 --- a/framework/src/engine/generator/endpoint.ts +++ b/framework/src/engine/generator/endpoint.ts @@ -146,7 +146,7 @@ export class Endpoint { // Before disabling, above ensure decrypt is successful if (!req.enable) { - // Disable delegate by removing keypairs corresponding to address + // Disable validator by removing keypairs corresponding to address this._keypairs.delete(cryptoAddress.getAddressFromLisk32Address(ctx.params.address)); ctx.logger.info(`Forging disabled on account: ${req.address}`); return { @@ -186,7 +186,7 @@ export class Endpoint { ); } - // Enable delegate to forge by adding keypairs corresponding to address + // Enable validator to forge by adding keypairs corresponding to address this._keypairs.set(address, decryptedKeys); ctx.logger.info(`Block generation enabled on address: ${req.address}`); diff --git a/framework/src/engine/generator/generator.ts b/framework/src/engine/generator/generator.ts index 88f7359a1a9..e09de961cde 100644 --- a/framework/src/engine/generator/generator.ts +++ b/framework/src/engine/generator/generator.ts @@ -447,7 +447,7 @@ export class Generator { const validatorKeypair = this._keypairs.get(generator.address); if (validatorKeypair === undefined) { - this._logger.debug({ currentSlot }, 'Waiting for delegate slot'); + this._logger.debug({ currentSlot }, 'Waiting for validator slot'); return; } diff --git a/framework/src/index.ts b/framework/src/index.ts index 4baf256f913..17a82722b17 100644 --- a/framework/src/index.ts +++ b/framework/src/index.ts @@ -59,15 +59,15 @@ export { genesisTokenStoreSchema as tokenGenesisStoreSchema, } from './modules/token'; export { - DPoSMethod, - DPoSModule, - DelegateRegistrationCommand, + PoSMethod, + PoSModule, + ValidatorRegistrationCommand, ReportMisbehaviorCommand, UnlockCommand, UpdateGeneratorKeyCommand, - VoteDelegateCommand, - genesisStoreSchema as dposGenesisStoreSchema, -} from './modules/dpos_v2'; + StakeCommand, + genesisStoreSchema as posGenesisStoreSchema, +} from './modules/pos'; export { MainchainCCUpdateCommand, MainchainInteroperabilityMethod, diff --git a/framework/src/modules/dpos_v2/commands/vote_delegate.ts b/framework/src/modules/dpos_v2/commands/vote_delegate.ts deleted file mode 100644 index b125c730263..00000000000 --- a/framework/src/modules/dpos_v2/commands/vote_delegate.ts +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright © 2021 Lisk Foundation - * - * See the LICENSE file at the top-level directory of this distribution - * for licensing information. - * - * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, - * no part of this software, including this file, may be copied, modified, - * propagated, or distributed except according to the terms contained in the - * LICENSE file. - * - * Removal or modification of this copyright notice is prohibited. - */ - -import { dataStructures } from '@liskhq/lisk-utils'; -import { validator } from '@liskhq/lisk-validator'; -import { AggregateValidationError, ValidationError } from '../../../errors'; -import { - CommandVerifyContext, - VerificationResult, - VerifyStatus, - CommandExecuteContext, -} from '../../../state_machine'; -import { BaseCommand } from '../../base_command'; -import { - MAX_NUMBER_PENDING_UNLOCKS, - MAX_NUMBER_SENT_VOTES, - MODULE_NAME_DPOS, - PoSEventResult, - BASE_VOTE_AMOUNT, -} from '../constants'; -import { DelegateVotedEvent } from '../events/delegate_voted'; -import { InternalMethod } from '../internal_method'; -import { voteCommandParamsSchema } from '../schemas'; -import { DelegateStore } from '../stores/delegate'; -import { EligibleDelegatesStore } from '../stores/eligible_delegates'; -import { VoterStore } from '../stores/voter'; -import { TokenMethod, TokenID, VoteTransactionParams } from '../types'; -import { sortUnlocking, getDelegateWeight } from '../utils'; - -export class VoteDelegateCommand extends BaseCommand { - public schema = voteCommandParamsSchema; - - private _tokenMethod!: TokenMethod; - private _governanceTokenID!: TokenID; - private _internalMethod!: InternalMethod; - private _factorSelfVotes!: bigint; - - public addDependencies(args: { tokenMethod: TokenMethod; internalMethod: InternalMethod }) { - this._tokenMethod = args.tokenMethod; - this._internalMethod = args.internalMethod; - } - - public init(args: { governanceTokenID: TokenID; factorSelfVotes: bigint }) { - this._governanceTokenID = args.governanceTokenID; - this._factorSelfVotes = args.factorSelfVotes; - } - - // eslint-disable-next-line @typescript-eslint/require-await - public async verify( - context: CommandVerifyContext, - ): Promise { - const { - params: { votes }, - } = context; - - try { - validator.validate(this.schema, context.params); - } catch (err) { - return { - status: VerifyStatus.FAIL, - error: new AggregateValidationError('Parameter is not valid.', err), - }; - } - - let upvoteCount = 0; - let downvoteCount = 0; - const addressSet = new dataStructures.BufferMap(); - for (const vote of votes) { - addressSet.set(vote.delegateAddress, true); - - if (vote.amount === BigInt(0)) { - return { - status: VerifyStatus.FAIL, - error: new ValidationError('Amount cannot be 0.', ''), - }; - } - - if (vote.amount % BASE_VOTE_AMOUNT !== BigInt(0)) { - return { - status: VerifyStatus.FAIL, - error: new ValidationError( - 'Amount should be multiple of 10 * 10^8.', - vote.amount.toString(), - ), - }; - } - - if (vote.amount > BigInt(0)) { - upvoteCount += 1; - } else if (vote.amount < BigInt(0)) { - downvoteCount += 1; - } - } - - if (upvoteCount > MAX_NUMBER_SENT_VOTES) { - return { - status: VerifyStatus.FAIL, - error: new ValidationError( - `Upvote can only be casted up to ${MAX_NUMBER_SENT_VOTES}.`, - upvoteCount.toString(), - ), - }; - } - - if (downvoteCount > MAX_NUMBER_SENT_VOTES) { - return { - status: VerifyStatus.FAIL, - error: new ValidationError( - 'Downvote can only be casted up to 10.', - downvoteCount.toString(), - ), - }; - } - - if (addressSet.entries().length !== votes.length) { - return { - status: VerifyStatus.FAIL, - error: new ValidationError( - 'Delegate address must be unique.', - votes.map(vote => vote.delegateAddress.toString('hex')).join(), - ), - }; - } - - return { - status: VerifyStatus.OK, - }; - } - - public async execute(context: CommandExecuteContext): Promise { - const { - transaction: { senderAddress }, - params: { votes }, - getMethodContext, - header: { height }, - } = context; - - votes.sort((a, b) => { - const diff = a.amount - b.amount; - if (diff > BigInt(0)) { - return 1; - } - if (diff < BigInt(0)) { - return -1; - } - - return 0; - }); - - const voterStore = this.stores.get(VoterStore); - const delegateStore = this.stores.get(DelegateStore); - for (const vote of votes) { - const voterData = await voterStore.getOrDefault(context, senderAddress); - - const delegateExists = await delegateStore.has(context, vote.delegateAddress); - - if (!delegateExists) { - this.events.get(DelegateVotedEvent).error( - context, - { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }, - PoSEventResult.VOTE_FAILED_NON_REGISTERED_DELEGATE, - ); - - throw new Error('Invalid vote: no registered delegate with the specified address'); - } - - const delegateData = await delegateStore.get(context, vote.delegateAddress); - - const originalUpvoteIndex = voterData.sentVotes.findIndex(senderVote => - senderVote.delegateAddress.equals(vote.delegateAddress), - ); - const index = originalUpvoteIndex > -1 ? originalUpvoteIndex : voterData.sentVotes.length; - - if (vote.amount < BigInt(0)) { - // unvote - if (originalUpvoteIndex < 0) { - this.events.get(DelegateVotedEvent).error( - context, - { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }, - PoSEventResult.VOTE_FAILED_INVALID_UNVOTE_PARAMETERS, - ); - - throw new Error('Invalid unvote: Cannot cast downvote to delegate who is not upvoted.'); - } - - if (voterData.sentVotes[originalUpvoteIndex].amount + vote.amount < BigInt(0)) { - this.events.get(DelegateVotedEvent).error( - context, - { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }, - PoSEventResult.VOTE_FAILED_INVALID_UNVOTE_PARAMETERS, - ); - - throw new Error( - 'Invalid unvote: The unvote amount exceeds the voted amount for this delegate.', - ); - } - - await this._internalMethod.assignVoteRewards( - context, - senderAddress, - voterData.sentVotes[originalUpvoteIndex], - delegateData, - ); - - voterData.sentVotes[originalUpvoteIndex].amount += vote.amount; - voterData.sentVotes[originalUpvoteIndex].voteSharingCoefficients = - delegateData.sharingCoefficients; - - if (voterData.sentVotes[originalUpvoteIndex].amount === BigInt(0)) { - voterData.sentVotes = voterData.sentVotes.filter( - senderVote => !senderVote.delegateAddress.equals(vote.delegateAddress), - ); - } - - // Create unlocking object - // Amount is converted to +BigInt for unlocking - voterData.pendingUnlocks.push({ - delegateAddress: vote.delegateAddress, - amount: BigInt(-1) * vote.amount, - unvoteHeight: height + 1, - }); - - // Sort account.unlocking - sortUnlocking(voterData.pendingUnlocks); - - if (voterData.pendingUnlocks.length > MAX_NUMBER_PENDING_UNLOCKS) { - this.events.get(DelegateVotedEvent).error( - context, - { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }, - PoSEventResult.VOTE_FAILED_TOO_MANY_PENDING_UNLOCKS, - ); - - throw new Error( - `Pending unlocks cannot exceed ${MAX_NUMBER_PENDING_UNLOCKS.toString()}.`, - ); - } - } else { - // Upvote amount case - let upvote; - - await this._tokenMethod.lock( - getMethodContext(), - senderAddress, - MODULE_NAME_DPOS, - this._governanceTokenID, - vote.amount, - ); - - if (originalUpvoteIndex > -1) { - upvote = voterData.sentVotes[originalUpvoteIndex]; - - await this._internalMethod.assignVoteRewards( - context.getMethodContext(), - senderAddress, - voterData.sentVotes[originalUpvoteIndex], - delegateData, - ); - - voterData.sentVotes[index].voteSharingCoefficients = delegateData.sharingCoefficients; - } else { - upvote = { - delegateAddress: vote.delegateAddress, - amount: BigInt(0), - voteSharingCoefficients: delegateData.sharingCoefficients, - }; - } - - upvote.amount += vote.amount; - - voterData.sentVotes[index] = { - ...upvote, - }; - - voterData.sentVotes.sort((a, b) => a.delegateAddress.compare(b.delegateAddress)); - if (voterData.sentVotes.length > MAX_NUMBER_SENT_VOTES) { - this.events.get(DelegateVotedEvent).error( - context, - { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }, - PoSEventResult.VOTE_FAILED_TOO_MANY_SENT_VOTES, - ); - - throw new Error(`Sender can only vote upto ${MAX_NUMBER_SENT_VOTES.toString()}.`); - } - } - - const previousDelegateWeight = getDelegateWeight( - this._factorSelfVotes, - delegateData.selfVotes, - delegateData.totalVotesReceived, - ); - // Change delegate.selfVote if this vote is a self vote - if (senderAddress.equals(vote.delegateAddress)) { - delegateData.selfVotes += vote.amount; - } - - delegateData.totalVotesReceived += vote.amount; - - const eligibleDelegatesStore = this.stores.get(EligibleDelegatesStore); - - await eligibleDelegatesStore.update( - context, - vote.delegateAddress, - previousDelegateWeight, - delegateData, - ); - - await voterStore.set(context, senderAddress, voterData); - await delegateStore.set(context, vote.delegateAddress, delegateData); - - this.events.get(DelegateVotedEvent).log(context, { - senderAddress, - delegateAddress: vote.delegateAddress, - amount: vote.amount, - }); - } - } -} diff --git a/framework/src/modules/dynamic_rewards/constants.ts b/framework/src/modules/dynamic_rewards/constants.ts index 4a56255ab96..c1904ef7bb7 100644 --- a/framework/src/modules/dynamic_rewards/constants.ts +++ b/framework/src/modules/dynamic_rewards/constants.ts @@ -18,7 +18,7 @@ export const EMPTY_BYTES = Buffer.alloc(0); export const defaultConfig = { ...rewardDefaultConfig, - factorMinimumRewardActiveDelegates: 1000, + factorMinimumRewardActiveValidators: 1000, }; export const DECIMAL_PERCENT_FACTOR = BigInt(10000); diff --git a/framework/src/modules/dynamic_rewards/module.ts b/framework/src/modules/dynamic_rewards/module.ts index e4adee7fda7..5236f31ead2 100644 --- a/framework/src/modules/dynamic_rewards/module.ts +++ b/framework/src/modules/dynamic_rewards/module.ts @@ -23,7 +23,7 @@ import { REWARD_REDUCTION_SEED_REVEAL, } from '../reward/constants'; import { - DPoSMethod, + PoSMethod, ModuleConfig, ModuleConfigJSON, RandomMethod, @@ -55,7 +55,7 @@ export class DynamicRewardModule extends BaseModule { private _tokenMethod!: TokenMethod; private _randomMethod!: RandomMethod; private _validatorMethod!: ValidatorsMethod; - private _dposMethod!: DPoSMethod; + private _posMethod!: PoSMethod; private _moduleConfig!: ModuleConfig; public constructor() { @@ -69,12 +69,12 @@ export class DynamicRewardModule extends BaseModule { tokenMethod: TokenMethod, randomMethod: RandomMethod, validatorMethod: ValidatorsMethod, - dposMethod: DPoSMethod, + posMethod: PoSMethod, ) { this._tokenMethod = tokenMethod; this._randomMethod = randomMethod; this._validatorMethod = validatorMethod; - this._dposMethod = dposMethod; + this._posMethod = posMethod; } public metadata(): ModuleMetadata { @@ -154,7 +154,7 @@ export class DynamicRewardModule extends BaseModule { this._moduleConfig.tokenID, blockReward, ); - await this._dposMethod.updateSharedRewards( + await this._posMethod.updateSharedRewards( context.getMethodContext(), context.header.generatorAddress, this._moduleConfig.tokenID, @@ -162,7 +162,7 @@ export class DynamicRewardModule extends BaseModule { ); } - const isEndOfRound = await this._dposMethod.isEndOfRound( + const isEndOfRound = await this._posMethod.isEndOfRound( context.getMethodContext(), context.header.height, ); @@ -204,7 +204,7 @@ export class DynamicRewardModule extends BaseModule { context: ImmutableMethodContext, header: BlockHeader, ): Promise { - const roundLength = this._dposMethod.getRoundLength(context); + const roundLength = this._posMethod.getRoundLength(context); const { timestamp } = await this.stores.get(EndOfRoundTimestampStore).get(context, EMPTY_BYTES); const generatorsMap = await this._validatorMethod.getGeneratorsBetweenTimestamps( @@ -214,11 +214,11 @@ export class DynamicRewardModule extends BaseModule { ); const defaultReward = calculateDefaultReward(this._moduleConfig, header.height); - const minimalRewardActiveDelegates = - (defaultReward * BigInt(this._moduleConfig.factorMinimumRewardActiveDelegates)) / + const minimalRewardActiveValidators = + (defaultReward * BigInt(this._moduleConfig.factorMinimumRewardActiveValidators)) / DECIMAL_PERCENT_FACTOR; if (Object.keys(generatorsMap).length >= roundLength) { - return minimalRewardActiveDelegates; + return minimalRewardActiveValidators; } const validatorsParams = await this._validatorMethod.getValidatorsParams(context); @@ -234,14 +234,15 @@ export class DynamicRewardModule extends BaseModule { if (!bftValidator) { throw new Error('Invalid generator. Validator params does not include the validator.'); } - const numberOfActiveDelegates = this._dposMethod.getNumberOfActiveDelegates(context); - const totalRewardActiveDelegates = defaultReward * BigInt(numberOfActiveDelegates); - const stakeRewardActiveDelegates = - totalRewardActiveDelegates - BigInt(numberOfActiveDelegates) * minimalRewardActiveDelegates; + const numberOfActiveValidators = this._posMethod.getNumberOfActiveValidators(context); + const totalRewardActiveValidators = defaultReward * BigInt(numberOfActiveValidators); + const stakeRewardActiveValidators = + totalRewardActiveValidators - + BigInt(numberOfActiveValidators) * minimalRewardActiveValidators; if (bftValidator.bftWeight > BigInt(0)) { return ( - minimalRewardActiveDelegates + - (bftValidator.bftWeight * stakeRewardActiveDelegates) / bftWeightSum + minimalRewardActiveValidators + + (bftValidator.bftWeight * stakeRewardActiveValidators) / bftWeightSum ); } diff --git a/framework/src/modules/dynamic_rewards/schemas.ts b/framework/src/modules/dynamic_rewards/schemas.ts index fe960fc0ff6..4afcd15865c 100644 --- a/framework/src/modules/dynamic_rewards/schemas.ts +++ b/framework/src/modules/dynamic_rewards/schemas.ts @@ -18,10 +18,10 @@ export const configSchema = { type: 'object', properties: { ...rewardConfigSchema.properties, - factorMinimumRewardActiveDelegates: { + factorMinimumRewardActiveValidators: { type: 'integer', minimum: 1, }, }, - required: [...rewardConfigSchema.required, 'factorMinimumRewardActiveDelegates'], + required: [...rewardConfigSchema.required, 'factorMinimumRewardActiveValidators'], }; diff --git a/framework/src/modules/dynamic_rewards/types.ts b/framework/src/modules/dynamic_rewards/types.ts index 11bea713766..5400032b1d8 100644 --- a/framework/src/modules/dynamic_rewards/types.ts +++ b/framework/src/modules/dynamic_rewards/types.ts @@ -18,7 +18,7 @@ import { JSONObject } from '../../types'; import { ModuleConfig as RewardModuleConfig } from '../reward/types'; export interface ModuleConfig extends RewardModuleConfig { - factorMinimumRewardActiveDelegates: number; + factorMinimumRewardActiveValidators: number; } export type ModuleConfigJSON = JSONObject; @@ -55,9 +55,9 @@ export interface ValidatorsMethod { }>; } -export interface DPoSMethod { +export interface PoSMethod { getRoundLength(methodContext: ImmutableMethodContext): number; - getNumberOfActiveDelegates(methodContext: ImmutableMethodContext): number; + getNumberOfActiveValidators(methodContext: ImmutableMethodContext): number; updateSharedRewards( methodContext: MethodContext, generatorAddress: Buffer, diff --git a/framework/src/modules/dpos_v2/commands/change_commission.ts b/framework/src/modules/pos/commands/change_commission.ts similarity index 73% rename from framework/src/modules/dpos_v2/commands/change_commission.ts rename to framework/src/modules/pos/commands/change_commission.ts index c7fbf1f0169..f69ea56f904 100644 --- a/framework/src/modules/dpos_v2/commands/change_commission.ts +++ b/framework/src/modules/pos/commands/change_commission.ts @@ -22,7 +22,7 @@ import { import { BaseCommand } from '../../base_command'; import { CommissionChangeEvent } from '../events/commission_change'; import { changeCommissionCommandParamsSchema } from '../schemas'; -import { DelegateStore } from '../stores/delegate'; +import { ValidatorStore } from '../stores/validator'; import { ChangeCommissionParams } from '../types'; export class ChangeCommissionCommand extends BaseCommand { @@ -48,20 +48,20 @@ export class ChangeCommissionCommand extends BaseCommand { }; } - const delegateStore = this.stores.get(DelegateStore); - const delegateExists = await delegateStore.has(context, context.transaction.senderAddress); + const validatorStore = this.stores.get(ValidatorStore); + const validatorExists = await validatorStore.has(context, context.transaction.senderAddress); - if (!delegateExists) { + if (!validatorExists) { return { status: VerifyStatus.FAIL, - error: new Error('Transaction sender has not registered as a delegate.'), + error: new Error('Transaction sender has not registered as a validator.'), }; } - const delegate = await delegateStore.get(context, context.transaction.senderAddress); - const oldCommission = delegate.commission; + const validatorData = await validatorStore.get(context, context.transaction.senderAddress); + const oldCommission = validatorData.commission; const hasIncreasedCommissionRecently = - context.header.height - delegate.lastCommissionIncreaseHeight < + context.header.height - validatorData.lastCommissionIncreaseHeight < this._commissionIncreasePeriod; if (context.params.newCommission >= oldCommission && hasIncreasedCommissionRecently) { @@ -88,20 +88,20 @@ export class ChangeCommissionCommand extends BaseCommand { } public async execute(context: CommandExecuteContext): Promise { - const delegateStore = this.stores.get(DelegateStore); + const validatorStore = this.stores.get(ValidatorStore); - const delegate = await delegateStore.get(context, context.transaction.senderAddress); - const oldCommission = delegate.commission; + const validatorData = await validatorStore.get(context, context.transaction.senderAddress); + const oldCommission = validatorData.commission; - delegate.commission = context.params.newCommission; - if (delegate.commission > oldCommission) { - delegate.lastCommissionIncreaseHeight = context.header.height; + validatorData.commission = context.params.newCommission; + if (validatorData.commission > oldCommission) { + validatorData.lastCommissionIncreaseHeight = context.header.height; } - await delegateStore.set(context, context.transaction.senderAddress, delegate); + await validatorStore.set(context, context.transaction.senderAddress, validatorData); this.events.get(CommissionChangeEvent).log(context, { - delegateAddress: context.transaction.senderAddress, + validatorAddress: context.transaction.senderAddress, oldCommission, newCommission: context.params.newCommission, }); diff --git a/framework/src/modules/dpos_v2/commands/claim_rewards.ts b/framework/src/modules/pos/commands/claim_rewards.ts similarity index 63% rename from framework/src/modules/dpos_v2/commands/claim_rewards.ts rename to framework/src/modules/pos/commands/claim_rewards.ts index f8bae2a9ddd..4eb47945847 100644 --- a/framework/src/modules/dpos_v2/commands/claim_rewards.ts +++ b/framework/src/modules/pos/commands/claim_rewards.ts @@ -15,8 +15,8 @@ import { CommandExecuteContext } from '../../../state_machine'; import { BaseCommand } from '../../base_command'; import { InternalMethod } from '../internal_method'; -import { DelegateStore } from '../stores/delegate'; -import { VoterStore } from '../stores/voter'; +import { ValidatorStore } from '../stores/validator'; +import { StakerStore } from '../stores/staker'; export class ClaimRewardsCommand extends BaseCommand { private _internalMethod!: InternalMethod; @@ -31,21 +31,21 @@ export class ClaimRewardsCommand extends BaseCommand { getMethodContext, } = context; - const delegateStore = this.stores.get(DelegateStore); - const voterStore = this.stores.get(VoterStore); - const voterData = await voterStore.get(context, senderAddress); + const validatorStore = this.stores.get(ValidatorStore); + const stakerStore = this.stores.get(StakerStore); + const stakerData = await stakerStore.get(context, senderAddress); - for (const sentVote of voterData.sentVotes) { - const delegate = await delegateStore.get(context, sentVote.delegateAddress); - await this._internalMethod.assignVoteRewards( + for (const sentStake of stakerData.sentStakes) { + const validator = await validatorStore.get(context, sentStake.validatorAddress); + await this._internalMethod.assignStakeRewards( getMethodContext(), senderAddress, - sentVote, - delegate, + sentStake, + validator, ); - sentVote.voteSharingCoefficients = delegate.sharingCoefficients; + sentStake.stakeSharingCoefficients = validator.sharingCoefficients; } - await voterStore.set(context, senderAddress, voterData); + await stakerStore.set(context, senderAddress, stakerData); } } diff --git a/framework/src/modules/dpos_v2/commands/delegate_registration.ts b/framework/src/modules/pos/commands/register_validator.ts similarity index 62% rename from framework/src/modules/dpos_v2/commands/delegate_registration.ts rename to framework/src/modules/pos/commands/register_validator.ts index 59a0887b6d0..57d4e1af793 100644 --- a/framework/src/modules/dpos_v2/commands/delegate_registration.ts +++ b/framework/src/modules/pos/commands/register_validator.ts @@ -21,41 +21,37 @@ import { } from '../../../state_machine'; import { BaseCommand } from '../../base_command'; import { COMMISSION, TOKEN_ID_FEE } from '../constants'; -import { DelegateRegisteredEvent } from '../events/delegate_registered'; -import { delegateRegistrationCommandParamsSchema } from '../schemas'; -import { DelegateStore } from '../stores/delegate'; +import { ValidatorRegisteredEvent } from '../events/validator_registered'; +import { validatorRegistrationCommandParamsSchema } from '../schemas'; +import { ValidatorStore } from '../stores/validator'; import { NameStore } from '../stores/name'; -import { DelegateRegistrationParams, TokenMethod, ValidatorsMethod } from '../types'; +import { ValidatorRegistrationParams, TokenMethod, ValidatorsMethod } from '../types'; import { isUsername } from '../utils'; -export class DelegateRegistrationCommand extends BaseCommand { - public schema = delegateRegistrationCommandParamsSchema; +export class RegisterValidatorCommand extends BaseCommand { + public schema = validatorRegistrationCommandParamsSchema; private _validatorsMethod!: ValidatorsMethod; private _tokenMethod!: TokenMethod; private _tokenIDFee!: Buffer; - private _delegateRegistrationFee!: bigint; + private _validatorRegistrationFee!: bigint; public addDependencies(tokenMethod: TokenMethod, validatorsMethod: ValidatorsMethod) { this._tokenMethod = tokenMethod; this._validatorsMethod = validatorsMethod; } - public init(args: { tokenIDFee: Buffer; delegateRegistrationFee: bigint }) { + public init(args: { tokenIDFee: Buffer; validatorRegistrationFee: bigint }) { this._tokenIDFee = args.tokenIDFee; - this._delegateRegistrationFee = args.delegateRegistrationFee; - } - - public get name() { - return 'registerDelegate'; + this._validatorRegistrationFee = args.validatorRegistrationFee; } public async verify( - context: CommandVerifyContext, + context: CommandVerifyContext, ): Promise { const { transaction, params } = context; try { - validator.validate(delegateRegistrationCommandParamsSchema, context.params); + validator.validate(validatorRegistrationCommandParamsSchema, context.params); } catch (err) { return { status: VerifyStatus.FAIL, @@ -63,10 +59,10 @@ export class DelegateRegistrationCommand extends BaseCommand { }; } - if (context.params.delegateRegistrationFee !== this._delegateRegistrationFee) { + if (context.params.validatorRegistrationFee !== this._validatorRegistrationFee) { return { status: VerifyStatus.FAIL, - error: new Error('Invalid delegate registration fee.'), + error: new Error('Invalid validator registration fee.'), }; } @@ -75,10 +71,10 @@ export class DelegateRegistrationCommand extends BaseCommand { transaction.senderAddress, TOKEN_ID_FEE, ); - if (balance < this._delegateRegistrationFee) { + if (balance < this._validatorRegistrationFee) { return { status: VerifyStatus.FAIL, - error: new Error('Not sufficient amount for delegate registration fee.'), + error: new Error('Not sufficient amount for validator registration fee.'), }; } @@ -98,12 +94,12 @@ export class DelegateRegistrationCommand extends BaseCommand { }; } - const delegateSubstore = this.stores.get(DelegateStore); - const delegateExists = await delegateSubstore.has(context, transaction.senderAddress); - if (delegateExists) { + const validatorSubstore = this.stores.get(ValidatorStore); + const validatorExists = await validatorSubstore.has(context, transaction.senderAddress); + if (validatorExists) { return { status: VerifyStatus.FAIL, - error: new Error('Delegate substore must not have an entry for the store key address'), + error: new Error('Validator substore must not have an entry for the store key address'), }; } @@ -112,10 +108,10 @@ export class DelegateRegistrationCommand extends BaseCommand { }; } - public async execute(context: CommandExecuteContext): Promise { + public async execute(context: CommandExecuteContext): Promise { const { transaction, - params: { name, blsKey, generatorKey, proofOfPossession, delegateRegistrationFee }, + params: { name, blsKey, generatorKey, proofOfPossession, validatorRegistrationFee }, header: { height }, } = context; const methodContext = context.getMethodContext(); @@ -136,14 +132,14 @@ export class DelegateRegistrationCommand extends BaseCommand { context, transaction.senderAddress, this._tokenIDFee, - delegateRegistrationFee, + validatorRegistrationFee, ); - const delegateSubstore = this.stores.get(DelegateStore); - await delegateSubstore.set(context, transaction.senderAddress, { + const validatorSubstore = this.stores.get(ValidatorStore); + await validatorSubstore.set(context, transaction.senderAddress, { name, - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), lastGeneratedHeight: height, isBanned: false, pomHeights: [], @@ -155,10 +151,10 @@ export class DelegateRegistrationCommand extends BaseCommand { const nameSubstore = this.stores.get(NameStore); await nameSubstore.set(context, Buffer.from(name, 'utf8'), { - delegateAddress: transaction.senderAddress, + validatorAddress: transaction.senderAddress, }); - this.events.get(DelegateRegisteredEvent).log(context, { + this.events.get(ValidatorRegisteredEvent).log(context, { address: transaction.senderAddress, name, }); diff --git a/framework/src/modules/dpos_v2/commands/pom.ts b/framework/src/modules/pos/commands/report_misbehavior.ts similarity index 64% rename from framework/src/modules/dpos_v2/commands/pom.ts rename to framework/src/modules/pos/commands/report_misbehavior.ts index 31bab0f4c10..b79b24362b8 100644 --- a/framework/src/modules/dpos_v2/commands/pom.ts +++ b/framework/src/modules/pos/commands/report_misbehavior.ts @@ -24,7 +24,7 @@ import { BaseCommand } from '../../base_command'; import { REPORTING_PUNISHMENT_REWARD, POM_LIMIT_BANNED, - LOCKING_PERIOD_SELF_VOTES, + LOCKING_PERIOD_SELF_STAKES, } from '../constants'; import { pomCommandParamsSchema } from '../schemas'; import { @@ -34,29 +34,29 @@ import { TokenID, ValidatorsMethod, } from '../types'; -import { getDelegateWeight, getPunishmentPeriod } from '../utils'; +import { getValidatorWeight, getPunishmentPeriod } from '../utils'; import { ValidationError } from '../../../errors'; import { areDistinctHeadersContradicting } from '../../../engine/bft/utils'; -import { DelegateStore } from '../stores/delegate'; -import { DelegatePunishedEvent } from '../events/delegate_punished'; -import { DelegateBannedEvent } from '../events/delegate_banned'; -import { EligibleDelegatesStore } from '../stores/eligible_delegates'; +import { ValidatorStore } from '../stores/validator'; +import { ValidatorPunishedEvent } from '../events/validator_punished'; +import { ValidatorBannedEvent } from '../events/validator_banned'; +import { EligibleValidatorsStore } from '../stores/eligible_validators'; export class ReportMisbehaviorCommand extends BaseCommand { public schema = pomCommandParamsSchema; private _tokenMethod!: TokenMethod; private _validatorsMethod!: ValidatorsMethod; - private _governanceTokenID!: TokenID; - private _factorSelfVotes!: number; + private _posTokenID!: TokenID; + private _factorSelfStakes!: number; public addDependencies(args: PomCommandDependencies) { this._tokenMethod = args.tokenMethod; this._validatorsMethod = args.validatorsMethod; } - public init(args: { governanceTokenID: TokenID; factorSelfVotes: number }) { - this._governanceTokenID = args.governanceTokenID; - this._factorSelfVotes = args.factorSelfVotes; + public init(args: { posTokenID: TokenID; factorSelfStakes: number }) { + this._posTokenID = args.posTokenID; + this._factorSelfStakes = args.factorSelfStakes; } // eslint-disable-next-line @typescript-eslint/require-await @@ -82,9 +82,9 @@ export class ReportMisbehaviorCommand extends BaseCommand { throw new Error('Different generator address never contradict to each other.'); } - const delegateAddress = header1.generatorAddress; - const delegateSubStore = this.stores.get(DelegateStore); - const delegateAccount = await delegateSubStore.get(context, delegateAddress); + const validatorAddress = header1.generatorAddress; + const validatorSubStore = this.stores.get(ValidatorStore); + const validatorAccount = await validatorSubStore.get(context, validatorAddress); const { generatorKey } = await this._validatorsMethod.getValidatorKeys( getMethodContext(), @@ -99,23 +99,23 @@ export class ReportMisbehaviorCommand extends BaseCommand { Math.abs(header2.height - currentHeight), ); - if (maxPunishableHeight >= LOCKING_PERIOD_SELF_VOTES) { + if (maxPunishableHeight >= LOCKING_PERIOD_SELF_STAKES) { throw new Error('Locking period has expired.'); } if ( getPunishmentPeriod( - delegateAddress, - delegateAddress, - delegateAccount.pomHeights, + validatorAddress, + validatorAddress, + validatorAccount.pomHeights, header.height, ) > 0 ) { - throw new Error('Delegate is already punished.'); + throw new Error('Validator is already punished.'); } - if (delegateAccount.isBanned) { - throw new Error('Delegate is already banned.'); + if (validatorAccount.isBanned) { + throw new Error('Validator is already banned.'); } /* Checking if the two headers are the same or not. */ @@ -142,45 +142,45 @@ export class ReportMisbehaviorCommand extends BaseCommand { const header1 = BlockHeader.fromBytes(params.header1); const punishedAddress = header1.generatorAddress; - const delegateSubStore = this.stores.get(DelegateStore); - const delegateAccount = await delegateSubStore.get(context, punishedAddress); + const validatorSubStore = this.stores.get(ValidatorStore); + const validatorAccount = await validatorSubStore.get(context, punishedAddress); - const delegateAccountBalance = await this._tokenMethod.getAvailableBalance( + const validatorAccountBalance = await this._tokenMethod.getAvailableBalance( getMethodContext(), punishedAddress, - this._governanceTokenID, + this._posTokenID, ); - delegateAccount.pomHeights.push(currentHeight); + validatorAccount.pomHeights.push(currentHeight); - this.events.get(DelegatePunishedEvent).log(context, { + this.events.get(ValidatorPunishedEvent).log(context, { address: punishedAddress, height: currentHeight, }); - if (delegateAccount.pomHeights.length === POM_LIMIT_BANNED) { - delegateAccount.isBanned = true; + if (validatorAccount.pomHeights.length === POM_LIMIT_BANNED) { + validatorAccount.isBanned = true; - this.events.get(DelegateBannedEvent).log(context, { + this.events.get(ValidatorBannedEvent).log(context, { address: punishedAddress, height: currentHeight, }); } - const currentWeight = getDelegateWeight( - BigInt(this._factorSelfVotes), - delegateAccount.selfVotes, - delegateAccount.totalVotesReceived, + const currentWeight = getValidatorWeight( + BigInt(this._factorSelfStakes), + validatorAccount.selfStake, + validatorAccount.totalStakeReceived, ); - const eligibleDelegateStore = this.stores.get(EligibleDelegatesStore); - await eligibleDelegateStore.update(context, punishedAddress, currentWeight, delegateAccount); + const eligibleValidatorStore = this.stores.get(EligibleValidatorsStore); + await eligibleValidatorStore.update(context, punishedAddress, currentWeight, validatorAccount); - await delegateSubStore.set(context, punishedAddress, delegateAccount); + await validatorSubStore.set(context, punishedAddress, validatorAccount); const reward = - REPORTING_PUNISHMENT_REWARD > delegateAccountBalance - ? delegateAccountBalance + REPORTING_PUNISHMENT_REWARD > validatorAccountBalance + ? validatorAccountBalance : REPORTING_PUNISHMENT_REWARD; if (reward > BigInt(0)) { @@ -188,7 +188,7 @@ export class ReportMisbehaviorCommand extends BaseCommand { getMethodContext(), punishedAddress, transaction.senderAddress, - this._governanceTokenID, + this._posTokenID, reward, ); } diff --git a/framework/src/modules/pos/commands/stake.ts b/framework/src/modules/pos/commands/stake.ts new file mode 100644 index 00000000000..36bc55146a8 --- /dev/null +++ b/framework/src/modules/pos/commands/stake.ts @@ -0,0 +1,350 @@ +/* + * Copyright © 2021 Lisk Foundation + * + * See the LICENSE file at the top-level directory of this distribution + * for licensing information. + * + * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, + * no part of this software, including this file, may be copied, modified, + * propagated, or distributed except according to the terms contained in the + * LICENSE file. + * + * Removal or modification of this copyright notice is prohibited. + */ + +import { dataStructures } from '@liskhq/lisk-utils'; +import { validator } from '@liskhq/lisk-validator'; +import { AggregateValidationError, ValidationError } from '../../../errors'; +import { + CommandVerifyContext, + VerificationResult, + VerifyStatus, + CommandExecuteContext, +} from '../../../state_machine'; +import { BaseCommand } from '../../base_command'; +import { + MAX_NUMBER_PENDING_UNLOCKS, + MAX_NUMBER_SENT_STAKES, + MODULE_NAME_POS, + PoSEventResult, + BASE_STAKE_AMOUNT, +} from '../constants'; +import { ValidatorStakedEvent } from '../events/validator_staked'; +import { InternalMethod } from '../internal_method'; +import { stakeCommandParamsSchema } from '../schemas'; +import { ValidatorStore } from '../stores/validator'; +import { EligibleValidatorsStore } from '../stores/eligible_validators'; +import { StakerStore } from '../stores/staker'; +import { TokenMethod, TokenID, StakeTransactionParams } from '../types'; +import { sortUnlocking, getValidatorWeight } from '../utils'; + +export class StakeCommand extends BaseCommand { + public schema = stakeCommandParamsSchema; + + private _tokenMethod!: TokenMethod; + private _posTokenID!: TokenID; + private _internalMethod!: InternalMethod; + private _factorSelfStakes!: bigint; + + public addDependencies(args: { tokenMethod: TokenMethod; internalMethod: InternalMethod }) { + this._tokenMethod = args.tokenMethod; + this._internalMethod = args.internalMethod; + } + + public init(args: { posTokenID: TokenID; factorSelfStakes: bigint }) { + this._posTokenID = args.posTokenID; + this._factorSelfStakes = args.factorSelfStakes; + } + + // eslint-disable-next-line @typescript-eslint/require-await + public async verify( + context: CommandVerifyContext, + ): Promise { + const { + params: { stakes }, + } = context; + + try { + validator.validate(this.schema, context.params); + } catch (err) { + return { + status: VerifyStatus.FAIL, + error: new AggregateValidationError('Parameter is not valid.', err), + }; + } + + let upstakeCount = 0; + let downstakeCount = 0; + const addressSet = new dataStructures.BufferMap(); + for (const stake of stakes) { + addressSet.set(stake.validatorAddress, true); + + if (stake.amount === BigInt(0)) { + return { + status: VerifyStatus.FAIL, + error: new ValidationError('Amount cannot be 0.', ''), + }; + } + + if (stake.amount % BASE_STAKE_AMOUNT !== BigInt(0)) { + return { + status: VerifyStatus.FAIL, + error: new ValidationError( + 'Amount should be multiple of 10 * 10^8.', + stake.amount.toString(), + ), + }; + } + + if (stake.amount > BigInt(0)) { + upstakeCount += 1; + } else if (stake.amount < BigInt(0)) { + downstakeCount += 1; + } + } + + if (upstakeCount > MAX_NUMBER_SENT_STAKES) { + return { + status: VerifyStatus.FAIL, + error: new ValidationError( + `Upstake can only be casted up to ${MAX_NUMBER_SENT_STAKES}.`, + upstakeCount.toString(), + ), + }; + } + + if (downstakeCount > MAX_NUMBER_SENT_STAKES) { + return { + status: VerifyStatus.FAIL, + error: new ValidationError( + 'Downstake can only be casted up to 10.', + downstakeCount.toString(), + ), + }; + } + + if (addressSet.entries().length !== stakes.length) { + return { + status: VerifyStatus.FAIL, + error: new ValidationError( + 'Validator address must be unique.', + stakes.map(stake => stake.validatorAddress.toString('hex')).join(), + ), + }; + } + + return { + status: VerifyStatus.OK, + }; + } + + public async execute(context: CommandExecuteContext): Promise { + const { + transaction: { senderAddress }, + params: { stakes }, + getMethodContext, + header: { height }, + } = context; + + stakes.sort((a, b) => { + const diff = a.amount - b.amount; + if (diff > BigInt(0)) { + return 1; + } + if (diff < BigInt(0)) { + return -1; + } + + return 0; + }); + + const stakerStore = this.stores.get(StakerStore); + const validatorStore = this.stores.get(ValidatorStore); + for (const stake of stakes) { + const stakerData = await stakerStore.getOrDefault(context, senderAddress); + + const validatorExists = await validatorStore.has(context, stake.validatorAddress); + + if (!validatorExists) { + this.events.get(ValidatorStakedEvent).error( + context, + { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }, + PoSEventResult.STAKE_FAILED_NON_REGISTERED_VALIDATOR, + ); + + throw new Error('Invalid stake: no registered validator with the specified address'); + } + + const validatorData = await validatorStore.get(context, stake.validatorAddress); + + const originalUpstakeIndex = stakerData.sentStakes.findIndex(senderStake => + senderStake.validatorAddress.equals(stake.validatorAddress), + ); + const index = originalUpstakeIndex > -1 ? originalUpstakeIndex : stakerData.sentStakes.length; + + if (stake.amount < BigInt(0)) { + // unstake + if (originalUpstakeIndex < 0) { + this.events.get(ValidatorStakedEvent).error( + context, + { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }, + PoSEventResult.STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS, + ); + + throw new Error( + 'Invalid unstake: Cannot cast downstake to validator who is not upstaked.', + ); + } + + if (stakerData.sentStakes[originalUpstakeIndex].amount + stake.amount < BigInt(0)) { + this.events.get(ValidatorStakedEvent).error( + context, + { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }, + PoSEventResult.STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS, + ); + + throw new Error( + 'Invalid unstake: The unstake amount exceeds the staked amount for this validator.', + ); + } + + await this._internalMethod.assignStakeRewards( + context, + senderAddress, + stakerData.sentStakes[originalUpstakeIndex], + validatorData, + ); + + stakerData.sentStakes[originalUpstakeIndex].amount += stake.amount; + stakerData.sentStakes[originalUpstakeIndex].stakeSharingCoefficients = + validatorData.sharingCoefficients; + + if (stakerData.sentStakes[originalUpstakeIndex].amount === BigInt(0)) { + stakerData.sentStakes = stakerData.sentStakes.filter( + senderStake => !senderStake.validatorAddress.equals(stake.validatorAddress), + ); + } + + // Create unlocking object + // Amount is converted to +BigInt for unlocking + stakerData.pendingUnlocks.push({ + validatorAddress: stake.validatorAddress, + amount: BigInt(-1) * stake.amount, + unstakeHeight: height + 1, + }); + + // Sort account.unlocking + sortUnlocking(stakerData.pendingUnlocks); + + if (stakerData.pendingUnlocks.length > MAX_NUMBER_PENDING_UNLOCKS) { + this.events.get(ValidatorStakedEvent).error( + context, + { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }, + PoSEventResult.STAKE_FAILED_TOO_MANY_PENDING_UNLOCKS, + ); + + throw new Error( + `Pending unlocks cannot exceed ${MAX_NUMBER_PENDING_UNLOCKS.toString()}.`, + ); + } + } else { + // Upstake amount case + let upstake; + + await this._tokenMethod.lock( + getMethodContext(), + senderAddress, + MODULE_NAME_POS, + this._posTokenID, + stake.amount, + ); + + if (originalUpstakeIndex > -1) { + upstake = stakerData.sentStakes[originalUpstakeIndex]; + + await this._internalMethod.assignStakeRewards( + context.getMethodContext(), + senderAddress, + stakerData.sentStakes[originalUpstakeIndex], + validatorData, + ); + + stakerData.sentStakes[index].stakeSharingCoefficients = validatorData.sharingCoefficients; + } else { + upstake = { + validatorAddress: stake.validatorAddress, + amount: BigInt(0), + stakeSharingCoefficients: validatorData.sharingCoefficients, + }; + } + + upstake.amount += stake.amount; + + stakerData.sentStakes[index] = { + ...upstake, + }; + + stakerData.sentStakes.sort((a, b) => a.validatorAddress.compare(b.validatorAddress)); + if (stakerData.sentStakes.length > MAX_NUMBER_SENT_STAKES) { + this.events.get(ValidatorStakedEvent).error( + context, + { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }, + PoSEventResult.STAKE_FAILED_TOO_MANY_SENT_STAKES, + ); + + throw new Error(`Sender can only stake upto ${MAX_NUMBER_SENT_STAKES.toString()}.`); + } + } + + const previousValidatorWeight = getValidatorWeight( + this._factorSelfStakes, + validatorData.selfStake, + validatorData.totalStakeReceived, + ); + // Change validator.selfStake if this stake is a self stake + if (senderAddress.equals(stake.validatorAddress)) { + validatorData.selfStake += stake.amount; + } + + validatorData.totalStakeReceived += stake.amount; + + const eligibleValidatorsStore = this.stores.get(EligibleValidatorsStore); + + await eligibleValidatorsStore.update( + context, + stake.validatorAddress, + previousValidatorWeight, + validatorData, + ); + + await stakerStore.set(context, senderAddress, stakerData); + await validatorStore.set(context, stake.validatorAddress, validatorData); + + this.events.get(ValidatorStakedEvent).log(context, { + senderAddress, + validatorAddress: stake.validatorAddress, + amount: stake.amount, + }); + } + } +} diff --git a/framework/src/modules/dpos_v2/commands/unlock.ts b/framework/src/modules/pos/commands/unlock.ts similarity index 71% rename from framework/src/modules/dpos_v2/commands/unlock.ts rename to framework/src/modules/pos/commands/unlock.ts index af493bc2cee..3e78d48c27f 100644 --- a/framework/src/modules/dpos_v2/commands/unlock.ts +++ b/framework/src/modules/pos/commands/unlock.ts @@ -19,24 +19,24 @@ import { VerifyStatus, } from '../../../state_machine'; import { BaseCommand } from '../../base_command'; -import { EMPTY_KEY, MODULE_NAME_DPOS } from '../constants'; -import { DelegateStore } from '../stores/delegate'; +import { EMPTY_KEY, MODULE_NAME_POS } from '../constants'; +import { ValidatorStore } from '../stores/validator'; import { GenesisDataStore } from '../stores/genesis'; -import { VoterStore } from '../stores/voter'; +import { StakerStore } from '../stores/staker'; import { TokenMethod, TokenID, UnlockCommandDependencies } from '../types'; import { isPunished, isCertificateGenerated, hasWaited } from '../utils'; export class UnlockCommand extends BaseCommand { private _tokenMethod!: TokenMethod; - private _governanceTokenID!: TokenID; + private _posTokenID!: TokenID; private _roundLength!: number; public addDependencies(args: UnlockCommandDependencies) { this._tokenMethod = args.tokenMethod; } - public init(args: { governanceTokenID: TokenID; roundLength: number }) { - this._governanceTokenID = args.governanceTokenID; + public init(args: { posTokenID: TokenID; roundLength: number }) { + this._posTokenID = args.posTokenID; this._roundLength = args.roundLength; } @@ -62,16 +62,16 @@ export class UnlockCommand extends BaseCommand { getMethodContext, header: { height, aggregateCommit }, } = context; - const delegateSubstore = this.stores.get(DelegateStore); - const voterSubstore = this.stores.get(VoterStore); - const voterData = await voterSubstore.get(context, senderAddress); + const validatorSubstore = this.stores.get(ValidatorStore); + const stakerSubstore = this.stores.get(StakerStore); + const stakerData = await stakerSubstore.get(context, senderAddress); const ineligibleUnlocks = []; const genesisDataStore = this.stores.get(GenesisDataStore); const genesisData = await genesisDataStore.get(context, EMPTY_KEY); const { height: genesisHeight } = genesisData; - for (const unlockObject of voterData.pendingUnlocks) { - const { pomHeights } = await delegateSubstore.get(context, unlockObject.delegateAddress); + for (const unlockObject of stakerData.pendingUnlocks) { + const { pomHeights } = await validatorSubstore.get(context, unlockObject.validatorAddress); if ( hasWaited(unlockObject, senderAddress, height) && @@ -86,18 +86,18 @@ export class UnlockCommand extends BaseCommand { await this._tokenMethod.unlock( getMethodContext(), senderAddress, - MODULE_NAME_DPOS, - this._governanceTokenID, + MODULE_NAME_POS, + this._posTokenID, unlockObject.amount, ); continue; } ineligibleUnlocks.push(unlockObject); } - if (voterData.pendingUnlocks.length === ineligibleUnlocks.length) { - throw new Error('No eligible voter data was found for unlocking'); + if (stakerData.pendingUnlocks.length === ineligibleUnlocks.length) { + throw new Error('No eligible staker data was found for unlocking'); } - voterData.pendingUnlocks = ineligibleUnlocks; - await voterSubstore.set(context, senderAddress, voterData); + stakerData.pendingUnlocks = ineligibleUnlocks; + await stakerSubstore.set(context, senderAddress, stakerData); } } diff --git a/framework/src/modules/dpos_v2/commands/update_generator_key.ts b/framework/src/modules/pos/commands/update_generator_key.ts similarity index 87% rename from framework/src/modules/dpos_v2/commands/update_generator_key.ts rename to framework/src/modules/pos/commands/update_generator_key.ts index 9783d68b0a4..653f182288d 100644 --- a/framework/src/modules/dpos_v2/commands/update_generator_key.ts +++ b/framework/src/modules/pos/commands/update_generator_key.ts @@ -21,7 +21,7 @@ import { } from '../../../state_machine'; import { BaseCommand } from '../../base_command'; import { updateGeneratorKeyCommandParamsSchema } from '../schemas'; -import { DelegateStore } from '../stores/delegate'; +import { ValidatorStore } from '../stores/validator'; import { UpdateGeneratorKeyParams, ValidatorsMethod } from '../types'; export class UpdateGeneratorKeyCommand extends BaseCommand { @@ -47,13 +47,13 @@ export class UpdateGeneratorKeyCommand extends BaseCommand { }; } - const delegateSubstore = this.stores.get(DelegateStore); - const entryExists = await delegateSubstore.has(context, transaction.senderAddress); + const validatorSubstore = this.stores.get(ValidatorStore); + const entryExists = await validatorSubstore.has(context, transaction.senderAddress); if (!entryExists) { return { status: VerifyStatus.FAIL, - error: new Error('Delegate substore must have an entry for the store key address'), + error: new Error('Validator substore must have an entry for the store key address'), }; } diff --git a/framework/src/modules/dpos_v2/constants.ts b/framework/src/modules/pos/constants.ts similarity index 66% rename from framework/src/modules/dpos_v2/constants.ts rename to framework/src/modules/pos/constants.ts index 270a0c53148..1638825ff18 100644 --- a/framework/src/modules/dpos_v2/constants.ts +++ b/framework/src/modules/pos/constants.ts @@ -11,27 +11,27 @@ * * Removal or modification of this copyright notice is prohibited. */ -export const MODULE_NAME_DPOS = 'dpos'; +export const MODULE_NAME_POS = 'pos'; -export const COMMAND_NAME_DELEGATE_REGISTRATION = 'registerDelegate'; +export const COMMAND_NAME_VALIDATOR_REGISTRATION = 'registerValidator'; -export const LOCKING_PERIOD_VOTES = 26000; -export const LOCKING_PERIOD_SELF_VOTES = 260000; -export const PUNISHMENT_WINDOW_VOTES = 260000; -export const PUNISHMENT_WINDOW_SELF_VOTES = 780000; +export const LOCKING_PERIOD_STAKES = 26000; +export const LOCKING_PERIOD_SELF_STAKES = 260000; +export const PUNISHMENT_WINDOW_STAKES = 260000; +export const PUNISHMENT_WINDOW_SELF_STAKES = 780000; // Punishment period is 780k block height by default export const PUNISHMENT_PERIOD = 780000; export const MAX_LENGTH_NAME = 20; -export const BASE_VOTE_AMOUNT = BigInt(10) * BigInt(10) ** BigInt(8); -export const MAX_NUMBER_SENT_VOTES = 10; +export const BASE_STAKE_AMOUNT = BigInt(10) * BigInt(10) ** BigInt(8); +export const MAX_NUMBER_SENT_STAKES = 10; export const MAX_NUMBER_PENDING_UNLOCKS = 20; -export const TOKEN_ID_DPOS = Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]); +export const TOKEN_ID_POS = Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]); export const TOKEN_ID_FEE = Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]); -export const DELEGATE_REGISTRATION_FEE = BigInt(10) * BigInt(10) ** BigInt(8); +export const VALIDATOR_REGISTRATION_FEE = BigInt(10) * BigInt(10) ** BigInt(8); export const MAX_PUNISHABLE_BLOCK_HEIGHT_DIFFERENCE = 260000; export const POM_LIMIT_BANNED = 5; export const REPORTING_PUNISHMENT_REWARD = BigInt(100000000); -export const DELEGATE_LIST_ROUND_OFFSET = 2; +export const VALIDATOR_LIST_ROUND_OFFSET = 2; export const EMPTY_KEY = Buffer.alloc(0); export const MAX_SNAPSHOT = 3; export const CHAIN_ID_LENGTH = 4; @@ -51,28 +51,28 @@ export const MAX_COMMISSION = 10000; export const MIN_WEIGHT = BigInt(1000) * BigInt(10) ** BigInt(8); export const defaultConfig = { - factorSelfVotes: 10, + factorSelfStakes: 10, maxLengthName: 20, - maxNumberSentVotes: 10, + maxNumberSentStakes: 10, maxNumberPendingUnlocks: 20, failSafeMissedBlocks: 50, failSafeInactiveWindow: 260000, punishmentWindow: PUNISHMENT_PERIOD, roundLength: 103, minWeightStandby: '100000000000', - numberActiveDelegates: 101, - numberStandbyDelegates: 2, + numberActiveValidators: 101, + numberStandbyValidators: 2, tokenIDFee: TOKEN_ID_FEE.toString('hex'), - delegateRegistrationFee: DELEGATE_REGISTRATION_FEE.toString(), + validatorRegistrationFee: VALIDATOR_REGISTRATION_FEE.toString(), maxBFTWeightCap: 500, commissionIncreasePeriod: COMMISSION_INCREASE_PERIOD, maxCommissionIncreaseRate: MAX_COMMISSION_INCREASE_RATE, }; export const enum PoSEventResult { - VOTE_SUCCESSFUL = 0, - VOTE_FAILED_NON_REGISTERED_DELEGATE = 1, - VOTE_FAILED_INVALID_UNVOTE_PARAMETERS = 2, - VOTE_FAILED_TOO_MANY_PENDING_UNLOCKS = 3, - VOTE_FAILED_TOO_MANY_SENT_VOTES = 4, + STAKE_SUCCESSFUL = 0, + STAKE_FAILED_NON_REGISTERED_VALIDATOR = 1, + STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS = 2, + STAKE_FAILED_TOO_MANY_PENDING_UNLOCKS = 3, + STAKE_FAILED_TOO_MANY_SENT_STAKES = 4, } diff --git a/framework/src/modules/dpos_v2/endpoint.ts b/framework/src/modules/pos/endpoint.ts similarity index 57% rename from framework/src/modules/dpos_v2/endpoint.ts rename to framework/src/modules/pos/endpoint.ts index 0bf87f5c5a3..39d31eed40e 100644 --- a/framework/src/modules/dpos_v2/endpoint.ts +++ b/framework/src/modules/pos/endpoint.ts @@ -19,12 +19,12 @@ import { validator } from '@liskhq/lisk-validator'; import { dataStructures, math } from '@liskhq/lisk-utils'; import { ModuleEndpointContext } from '../../types'; import { BaseEndpoint } from '../base_endpoint'; -import { DelegateAccountJSON, DelegateStore, delegateStoreSchema } from './stores/delegate'; -import { VoterStore, voterStoreSchema } from './stores/voter'; +import { ValidatorAccountJSON, ValidatorStore, validatorStoreSchema } from './stores/validator'; +import { StakerStore, stakerStoreSchema } from './stores/staker'; import { GetClaimableRewardsRequest, ClaimableReward, - GetGovernanceTokenIDResponse, + GetPoSTokenIDResponse, GetLockedRewardsRequest, GetLockedRewardsResponse, GetUnlockHeightResponse, @@ -33,24 +33,24 @@ import { ModuleConfig, ModuleConfigJSON, TokenMethod, - VoterData, - VoterDataJSON, + StakerData, + StakerDataJSON, } from './types'; -import { getPunishTime, getWaitTime, isCertificateGenerated, calculateVoteRewards } from './utils'; +import { getPunishTime, getWaitTime, isCertificateGenerated, calculateStakeRewards } from './utils'; import { GenesisDataStore } from './stores/genesis'; import { EMPTY_KEY } from './constants'; -import { EligibleDelegatesStore } from './stores/eligible_delegates'; +import { EligibleValidatorsStore } from './stores/eligible_validators'; import { getClaimableRewardsRequestSchema, getLockedRewardsRequestSchema, - getLockedVotedAmountRequestSchema, + getLockedStakedAmountRequestSchema, getValidatorsByStakeRequestSchema, } from './schemas'; import { ImmutableMethodContext } from '../../state_machine'; const { q96 } = math; -export class DPoSEndpoint extends BaseEndpoint { +export class PoSEndpoint extends BaseEndpoint { private _moduleConfig!: ModuleConfig; private _moduleName!: string; private _tokenMethod!: TokenMethod; @@ -61,67 +61,67 @@ export class DPoSEndpoint extends BaseEndpoint { this._tokenMethod = tokenMethod; } - public async getVoter(ctx: ModuleEndpointContext): Promise { - const voterSubStore = this.stores.get(VoterStore); + public async getStaker(ctx: ModuleEndpointContext): Promise { + const stakerSubStore = this.stores.get(StakerStore); const { address } = ctx.params; if (typeof address !== 'string') { throw new Error('Parameter address must be a string.'); } cryptoAddress.validateLisk32Address(address); - const voterData = await voterSubStore.get( + const stakerData = await stakerSubStore.get( ctx, cryptoAddress.getAddressFromLisk32Address(address), ); - return codec.toJSON(voterStoreSchema, voterData); + return codec.toJSON(stakerStoreSchema, stakerData); } - public async getDelegate( + public async getValidator( ctx: ModuleEndpointContext, - ): Promise { - const delegateSubStore = this.stores.get(DelegateStore); + ): Promise { + const validatorSubStore = this.stores.get(ValidatorStore); const { address } = ctx.params; if (typeof address !== 'string') { throw new Error('Parameter address must be a string.'); } cryptoAddress.validateLisk32Address(address); - const delegate = await delegateSubStore.get( + const validatorData = await validatorSubStore.get( ctx, cryptoAddress.getAddressFromLisk32Address(address), ); return { - ...codec.toJSON(delegateStoreSchema, delegate), + ...codec.toJSON(validatorStoreSchema, validatorData), address, }; } - public async getAllDelegates( + public async getAllValidators( ctx: ModuleEndpointContext, - ): Promise<{ delegates: (DelegateAccountJSON & { address: string })[] }> { - const delegateSubStore = this.stores.get(DelegateStore); + ): Promise<{ validators: (ValidatorAccountJSON & { address: string })[] }> { + const validatorSubStore = this.stores.get(ValidatorStore); const startBuf = Buffer.alloc(20); const endBuf = Buffer.alloc(20, 255); - const storeData = await delegateSubStore.iterate(ctx, { gte: startBuf, lte: endBuf }); + const storeData = await validatorSubStore.iterate(ctx, { gte: startBuf, lte: endBuf }); const response = []; for (const data of storeData) { - const delegate = await delegateSubStore.get(ctx, data.key); - const delegateJSON = { - ...codec.toJSON(delegateStoreSchema, delegate), + const validatorData = await validatorSubStore.get(ctx, data.key); + const validatorJSON = { + ...codec.toJSON(validatorStoreSchema, validatorData), address: cryptoAddress.getLisk32AddressFromAddress(data.key), }; - response.push(delegateJSON); + response.push(validatorJSON); } - return { delegates: response }; + return { validators: response }; } - public async getLockedVotedAmount(ctx: ModuleEndpointContext): Promise<{ amount: string }> { + public async getLockedStakedAmount(ctx: ModuleEndpointContext): Promise<{ amount: string }> { const { params } = ctx; - validator.validate<{ address: string }>(getLockedVotedAmountRequestSchema, params); + validator.validate<{ address: string }>(getLockedStakedAmountRequestSchema, params); - const amount = await this._getLockedVotedAmount( + const amount = await this._getLockedStakedAmount( ctx, cryptoAddress.getAddressFromLisk32Address(params.address), ); @@ -133,20 +133,20 @@ export class DPoSEndpoint extends BaseEndpoint { // eslint-disable-next-line @typescript-eslint/require-await public async getConstants(): Promise { return { - factorSelfVotes: this._moduleConfig.factorSelfVotes, + factorSelfStakes: this._moduleConfig.factorSelfStakes, maxLengthName: this._moduleConfig.maxLengthName, - maxNumberSentVotes: this._moduleConfig.maxNumberSentVotes, + maxNumberSentStakes: this._moduleConfig.maxNumberSentStakes, maxNumberPendingUnlocks: this._moduleConfig.maxNumberPendingUnlocks, failSafeMissedBlocks: this._moduleConfig.failSafeMissedBlocks, failSafeInactiveWindow: this._moduleConfig.failSafeInactiveWindow, punishmentWindow: this._moduleConfig.punishmentWindow, roundLength: this._moduleConfig.roundLength, minWeightStandby: this._moduleConfig.minWeightStandby.toString(), - numberActiveDelegates: this._moduleConfig.numberActiveDelegates, - numberStandbyDelegates: this._moduleConfig.numberStandbyDelegates, - governanceTokenID: this._moduleConfig.governanceTokenID.toString('hex'), + numberActiveValidators: this._moduleConfig.numberActiveValidators, + numberStandbyValidators: this._moduleConfig.numberStandbyValidators, + posTokenID: this._moduleConfig.posTokenID.toString('hex'), tokenIDFee: this._moduleConfig.tokenIDFee.toString('hex'), - delegateRegistrationFee: this._moduleConfig.delegateRegistrationFee.toString(), + validatorRegistrationFee: this._moduleConfig.validatorRegistrationFee.toString(), maxBFTWeightCap: this._moduleConfig.maxBFTWeightCap, commissionIncreasePeriod: this._moduleConfig.commissionIncreasePeriod, maxCommissionIncreaseRate: this._moduleConfig.maxCommissionIncreaseRate, @@ -160,15 +160,15 @@ export class DPoSEndpoint extends BaseEndpoint { } cryptoAddress.validateLisk32Address(address); const addressBytes = cryptoAddress.getAddressFromLisk32Address(address); - const voterSubStore = this.stores.get(VoterStore); - let voterData: VoterData; + const stakerSubStore = this.stores.get(StakerStore); + let stakerData: StakerData; try { - voterData = await voterSubStore.get(ctx, addressBytes); + stakerData = await stakerSubStore.get(ctx, addressBytes); } catch (error) { if (!(error instanceof NotFoundError)) { throw error; } - // If voter does not exist, nothing is pending + // If staker does not exist, nothing is pending return { pendingUnlocks: [], }; @@ -179,12 +179,12 @@ export class DPoSEndpoint extends BaseEndpoint { const result = []; - for (const unlock of voterData.pendingUnlocks) { + for (const unlock of stakerData.pendingUnlocks) { const expectedUnlockableHeight = await this._getExpectedUnlockHeight( ctx, addressBytes, - unlock.delegateAddress, - unlock.unvoteHeight, + unlock.validatorAddress, + unlock.unstakeHeight, ); const isCertified = isCertificateGenerated({ maxHeightCertified: ctx.header.aggregateCommit.height, @@ -196,7 +196,7 @@ export class DPoSEndpoint extends BaseEndpoint { ...unlock, unlockable: ctx.header.height > expectedUnlockableHeight && isCertified, amount: unlock.amount.toString(), - delegateAddress: cryptoAddress.getLisk32AddressFromAddress(unlock.delegateAddress), + validatorAddress: cryptoAddress.getLisk32AddressFromAddress(unlock.validatorAddress), expectedUnlockableHeight, }); } @@ -207,11 +207,9 @@ export class DPoSEndpoint extends BaseEndpoint { } // eslint-disable-next-line @typescript-eslint/require-await - public async getGovernanceTokenID( - _ctx: ModuleEndpointContext, - ): Promise { + public async getPoSTokenID(_ctx: ModuleEndpointContext): Promise { return { - tokenID: this._moduleConfig.governanceTokenID.toString('hex'), + tokenID: this._moduleConfig.posTokenID.toString('hex'), }; } @@ -220,22 +218,22 @@ export class DPoSEndpoint extends BaseEndpoint { ): Promise { validator.validate(getValidatorsByStakeRequestSchema, ctx.params); - const eligibleDelegateStore = this.stores.get(EligibleDelegatesStore); - const delegateSubStore = this.stores.get(DelegateStore); + const eligibleValidatorStore = this.stores.get(EligibleValidatorsStore); + const validatorSubStore = this.stores.get(ValidatorStore); const response = []; - const delegatesList = await eligibleDelegateStore.getTop( + const validatorsList = await eligibleValidatorStore.getTop( ctx, (ctx.params.limit as number | undefined) ?? 100, ); - for (const { key } of delegatesList) { - const [address] = eligibleDelegateStore.splitKey(key); - const delegate = await delegateSubStore.get(ctx, address); - const delegateJSON = { - ...codec.toJSON(delegateStoreSchema, delegate), + for (const { key } of validatorsList) { + const [address] = eligibleValidatorStore.splitKey(key); + const validatorData = await validatorSubStore.get(ctx, address); + const validatorJSON = { + ...codec.toJSON(validatorStoreSchema, validatorData), address: cryptoAddress.getLisk32AddressFromAddress(address), }; - response.push(delegateJSON); + response.push(validatorJSON); } return { validators: response }; @@ -252,14 +250,14 @@ export class DPoSEndpoint extends BaseEndpoint { tokenID, this._moduleName, ); - if (!tokenID.equals(this._moduleConfig.governanceTokenID)) { + if (!tokenID.equals(this._moduleConfig.posTokenID)) { return { reward: locked.toString(), }; } - // if the token is the same as governance tokenID, subtract the locked amount for vote - const lockedAmountForVotes = await this._getLockedVotedAmount(ctx, address); - locked -= lockedAmountForVotes; + // if the token is the same as governance tokenID, subtract the locked amount for stake + const lockedAmountForStakes = await this._getLockedStakedAmount(ctx, address); + locked -= lockedAmountForStakes; return { reward: locked.toString(), @@ -276,28 +274,32 @@ export class DPoSEndpoint extends BaseEndpoint { const rewards = new dataStructures.BufferMap(); const address = cryptoAddress.getAddressFromLisk32Address(context.params.address); - const { sentVotes: votes } = await this.stores.get(VoterStore).getOrDefault(context, address); + const { sentStakes: stakes } = await this.stores + .get(StakerStore) + .getOrDefault(context, address); - for (const vote of votes) { - if (vote.delegateAddress.equals(address)) { + for (const stake of stakes) { + if (stake.validatorAddress.equals(address)) { continue; } - const delegate = await this.stores.get(DelegateStore).get(context, vote.delegateAddress); + const validatorData = await this.stores + .get(ValidatorStore) + .get(context, stake.validatorAddress); - for (const delegateSharingCoefficient of delegate.sharingCoefficients) { - const voteSharingConefficient = vote.voteSharingCoefficients.find(sc => - sc.tokenID.equals(delegateSharingCoefficient.tokenID), + for (const validatorSharingCoefficient of validatorData.sharingCoefficients) { + const stakeSharingConefficient = stake.stakeSharingCoefficients.find(sc => + sc.tokenID.equals(validatorSharingCoefficient.tokenID), ) ?? { - tokenID: delegateSharingCoefficient.tokenID, + tokenID: validatorSharingCoefficient.tokenID, coefficient: q96(BigInt(0)).toBuffer(), }; - const reward = calculateVoteRewards( - voteSharingConefficient, - vote.amount, - delegateSharingCoefficient, + const reward = calculateStakeRewards( + stakeSharingConefficient, + stake.amount, + validatorSharingCoefficient, ); - const currentReward = rewards.get(delegateSharingCoefficient.tokenID) ?? BigInt(0); - rewards.set(delegateSharingCoefficient.tokenID, reward + currentReward); + const currentReward = rewards.get(validatorSharingCoefficient.tokenID) ?? BigInt(0); + rewards.set(validatorSharingCoefficient.tokenID, reward + currentReward); } } @@ -309,16 +311,16 @@ export class DPoSEndpoint extends BaseEndpoint { }; } - private async _getLockedVotedAmount( + private async _getLockedStakedAmount( ctx: ImmutableMethodContext, address: Buffer, ): Promise { - const voter = await this.stores.get(VoterStore).getOrDefault(ctx, address); + const staker = await this.stores.get(StakerStore).getOrDefault(ctx, address); let lockedAmount = BigInt(0); - for (const votes of voter.sentVotes) { - lockedAmount += votes.amount; + for (const stakes of staker.sentStakes) { + lockedAmount += stakes.amount; } - for (const unlock of voter.pendingUnlocks) { + for (const unlock of staker.pendingUnlocks) { lockedAmount += unlock.amount; } return lockedAmount; @@ -327,23 +329,23 @@ export class DPoSEndpoint extends BaseEndpoint { private async _getExpectedUnlockHeight( ctx: ModuleEndpointContext, callerAddress: Buffer, - delegateAddress: Buffer, - unvoteHeight: number, + validatorAddress: Buffer, + unstakeHeight: number, ): Promise { - const delegateSubStore = this.stores.get(DelegateStore); - const delegate = await delegateSubStore.get(ctx, delegateAddress); - const waitTime = getWaitTime(callerAddress, delegateAddress) + unvoteHeight; - if (!delegate.pomHeights.length) { + const validatorSubStore = this.stores.get(ValidatorStore); + const validatorData = await validatorSubStore.get(ctx, validatorAddress); + const waitTime = getWaitTime(callerAddress, validatorAddress) + unstakeHeight; + if (!validatorData.pomHeights.length) { return waitTime; } - const lastPomHeight = delegate.pomHeights[delegate.pomHeights.length - 1]; - // if last pom height is greater than unvote height + wait time, the delegate is not punished - if (lastPomHeight >= unvoteHeight + waitTime) { + const lastPomHeight = validatorData.pomHeights[validatorData.pomHeights.length - 1]; + // if last pom height is greater than unstake height + wait time, the validator is not punished + if (lastPomHeight >= unstakeHeight + waitTime) { return waitTime; } return Math.max( - getPunishTime(callerAddress, delegateAddress) + lastPomHeight, - getWaitTime(callerAddress, delegateAddress) + unvoteHeight, + getPunishTime(callerAddress, validatorAddress) + lastPomHeight, + getWaitTime(callerAddress, validatorAddress) + unstakeHeight, ); } } diff --git a/framework/src/modules/dpos_v2/events/commission_change.ts b/framework/src/modules/pos/events/commission_change.ts similarity index 87% rename from framework/src/modules/dpos_v2/events/commission_change.ts rename to framework/src/modules/pos/events/commission_change.ts index 0817c26ff5f..5ebcf07b035 100644 --- a/framework/src/modules/dpos_v2/events/commission_change.ts +++ b/framework/src/modules/pos/events/commission_change.ts @@ -15,7 +15,7 @@ import { BaseEvent, EventQueuer } from '../../base_event'; export interface CommissionChangeEventData { - delegateAddress: Buffer; + validatorAddress: Buffer; oldCommission: number; newCommission: number; } @@ -23,9 +23,9 @@ export interface CommissionChangeEventData { export const commissionChangeEventParams = { $id: '/pos/events/commissionChangeData', type: 'object', - required: ['delegateAddress', 'oldCommission', 'newCommission'], + required: ['validatorAddress', 'oldCommission', 'newCommission'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', format: 'lisk32', fieldNumber: 1, @@ -45,6 +45,6 @@ export class CommissionChangeEvent extends BaseEvent public schema = commissionChangeEventParams; public log(ctx: EventQueuer, data: CommissionChangeEventData): void { - this.add(ctx, { ...data }, [data.delegateAddress]); + this.add(ctx, { ...data }, [data.validatorAddress]); } } diff --git a/framework/src/modules/dpos_v2/events/rewards_assigned.ts b/framework/src/modules/pos/events/rewards_assigned.ts similarity index 85% rename from framework/src/modules/dpos_v2/events/rewards_assigned.ts rename to framework/src/modules/pos/events/rewards_assigned.ts index 8fe2261f1a8..32c15fd67f9 100644 --- a/framework/src/modules/dpos_v2/events/rewards_assigned.ts +++ b/framework/src/modules/pos/events/rewards_assigned.ts @@ -16,8 +16,8 @@ import { BaseEvent, EventQueuer } from '../../base_event'; import { TOKEN_ID_LENGTH } from '../constants'; export interface RewardsAssignedEventData { - voterAddress: Buffer; - delegateAddress: Buffer; + stakerAddress: Buffer; + validatorAddress: Buffer; tokenID: Buffer; amount: bigint; } @@ -25,14 +25,14 @@ export interface RewardsAssignedEventData { export const rewardsAssignedEventParams = { $id: '/pos/events/rewardsAssignedData', type: 'object', - required: ['voterAddress', 'delegateAddress', 'tokenID', 'amount'], + required: ['stakerAddress', 'validatorAddress', 'tokenID', 'amount'], properties: { - voterAddress: { + stakerAddress: { dataType: 'bytes', format: 'lisk32', fieldNumber: 1, }, - delegateAddress: { + validatorAddress: { dataType: 'bytes', format: 'lisk32', fieldNumber: 2, @@ -54,6 +54,6 @@ export class RewardsAssignedEvent extends BaseEvent { public schema = rewardsAssignedEventParams; public log(ctx: EventQueuer, data: RewardsAssignedEventData): void { - this.add(ctx, { ...data }, [data.voterAddress]); + this.add(ctx, { ...data }, [data.stakerAddress]); } } diff --git a/framework/src/modules/dpos_v2/events/delegate_banned.ts b/framework/src/modules/pos/events/validator_banned.ts similarity index 72% rename from framework/src/modules/dpos_v2/events/delegate_banned.ts rename to framework/src/modules/pos/events/validator_banned.ts index b98d006f798..196ecbc5f49 100644 --- a/framework/src/modules/dpos_v2/events/delegate_banned.ts +++ b/framework/src/modules/pos/events/validator_banned.ts @@ -14,13 +14,13 @@ import { BaseEvent, EventQueuer } from '../../base_event'; -export interface DelegateBannedEventData { +export interface ValidatorBannedEventData { address: Buffer; height: number; } -export const delegateBannedDataSchema = { - $id: '/pos/events/delegateBannedData', +export const validatorBannedDataSchema = { + $id: '/pos/events/validatorBannedData', type: 'object', required: ['address', 'height'], properties: { @@ -36,10 +36,10 @@ export const delegateBannedDataSchema = { }, }; -export class DelegateBannedEvent extends BaseEvent { - public schema = delegateBannedDataSchema; +export class ValidatorBannedEvent extends BaseEvent { + public schema = validatorBannedDataSchema; - public log(ctx: EventQueuer, data: DelegateBannedEventData): void { + public log(ctx: EventQueuer, data: ValidatorBannedEventData): void { this.add(ctx, data, [data.address]); } } diff --git a/framework/src/modules/dpos_v2/events/delegate_punished.ts b/framework/src/modules/pos/events/validator_punished.ts similarity index 71% rename from framework/src/modules/dpos_v2/events/delegate_punished.ts rename to framework/src/modules/pos/events/validator_punished.ts index a4f84453c70..97f37aac174 100644 --- a/framework/src/modules/dpos_v2/events/delegate_punished.ts +++ b/framework/src/modules/pos/events/validator_punished.ts @@ -14,13 +14,13 @@ import { BaseEvent, EventQueuer } from '../../base_event'; -export interface DelegatePunishedEventData { +export interface ValidatorPunishedEventData { address: Buffer; height: number; } -export const delegatePunishedDataSchema = { - $id: '/pos/events/punishDelegateData', +export const validatorPunishedDataSchema = { + $id: '/pos/events/punishValidatorData', type: 'object', required: ['address', 'height'], properties: { @@ -36,10 +36,10 @@ export const delegatePunishedDataSchema = { }, }; -export class DelegatePunishedEvent extends BaseEvent { - public schema = delegatePunishedDataSchema; +export class ValidatorPunishedEvent extends BaseEvent { + public schema = validatorPunishedDataSchema; - public log(ctx: EventQueuer, data: DelegatePunishedEventData): void { + public log(ctx: EventQueuer, data: ValidatorPunishedEventData): void { this.add(ctx, data, [data.address]); } } diff --git a/framework/src/modules/dpos_v2/events/delegate_registered.ts b/framework/src/modules/pos/events/validator_registered.ts similarity index 70% rename from framework/src/modules/dpos_v2/events/delegate_registered.ts rename to framework/src/modules/pos/events/validator_registered.ts index 12b79390b8d..9a7cbc454a1 100644 --- a/framework/src/modules/dpos_v2/events/delegate_registered.ts +++ b/framework/src/modules/pos/events/validator_registered.ts @@ -14,13 +14,13 @@ import { BaseEvent, EventQueuer } from '../../base_event'; -export interface RegisterDelegateEventData { +export interface RegisterValidatorEventData { address: Buffer; name: string; } -export const delegateRegisteredDataSchema = { - $id: '/pos/events/registerDelegateData', +export const validatorRegisteredDataSchema = { + $id: '/pos/events/registerValidatorData', type: 'object', required: ['address', 'name'], properties: { @@ -36,10 +36,10 @@ export const delegateRegisteredDataSchema = { }, }; -export class DelegateRegisteredEvent extends BaseEvent { - public schema = delegateRegisteredDataSchema; +export class ValidatorRegisteredEvent extends BaseEvent { + public schema = validatorRegisteredDataSchema; - public log(ctx: EventQueuer, data: RegisterDelegateEventData): void { + public log(ctx: EventQueuer, data: RegisterValidatorEventData): void { this.add(ctx, data, [data.address]); } } diff --git a/framework/src/modules/dpos_v2/events/delegate_voted.ts b/framework/src/modules/pos/events/validator_staked.ts similarity index 56% rename from framework/src/modules/dpos_v2/events/delegate_voted.ts rename to framework/src/modules/pos/events/validator_staked.ts index b27969b8565..9f2eea04f34 100644 --- a/framework/src/modules/dpos_v2/events/delegate_voted.ts +++ b/framework/src/modules/pos/events/validator_staked.ts @@ -15,23 +15,23 @@ import { BaseEvent, EventQueuer } from '../../base_event'; import { PoSEventResult } from '../constants'; -export interface DelegateVotedEventData { +export interface ValidatorStakedEventData { senderAddress: Buffer; - delegateAddress: Buffer; + validatorAddress: Buffer; amount: bigint; } -export const delegateVotedDataSchema = { - $id: '/pos/events/delegateVotedData', +export const validatorStakedDataSchema = { + $id: '/pos/events/validatorStakedData', type: 'object', - required: ['senderAddress', 'delegateAddress', 'amount', 'result'], + required: ['senderAddress', 'validatorAddress', 'amount', 'result'], properties: { senderAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', }, - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 2, format: 'lisk32', @@ -47,19 +47,19 @@ export const delegateVotedDataSchema = { }, }; -export class DelegateVotedEvent extends BaseEvent< - DelegateVotedEventData & { result: PoSEventResult } +export class ValidatorStakedEvent extends BaseEvent< + ValidatorStakedEventData & { result: PoSEventResult } > { - public schema = delegateVotedDataSchema; + public schema = validatorStakedDataSchema; - public log(ctx: EventQueuer, data: DelegateVotedEventData): void { - this.add(ctx, { ...data, result: PoSEventResult.VOTE_SUCCESSFUL }, [ + public log(ctx: EventQueuer, data: ValidatorStakedEventData): void { + this.add(ctx, { ...data, result: PoSEventResult.STAKE_SUCCESSFUL }, [ data.senderAddress, - data.delegateAddress, + data.validatorAddress, ]); } - public error(ctx: EventQueuer, data: DelegateVotedEventData, result: PoSEventResult): void { - this.add(ctx, { ...data, result }, [data.senderAddress, data.delegateAddress], true); + public error(ctx: EventQueuer, data: ValidatorStakedEventData, result: PoSEventResult): void { + this.add(ctx, { ...data, result }, [data.senderAddress, data.validatorAddress], true); } } diff --git a/framework/src/modules/dpos_v2/index.ts b/framework/src/modules/pos/index.ts similarity index 68% rename from framework/src/modules/dpos_v2/index.ts rename to framework/src/modules/pos/index.ts index 85583ca137f..04f40ceee6a 100644 --- a/framework/src/modules/dpos_v2/index.ts +++ b/framework/src/modules/pos/index.ts @@ -12,11 +12,11 @@ * Removal or modification of this copyright notice is prohibited. */ -export { DPoSModule } from './module'; -export { DelegateRegistrationCommand } from './commands/delegate_registration'; -export { VoteDelegateCommand } from './commands/vote_delegate'; +export { PoSModule } from './module'; +export { RegisterValidatorCommand as ValidatorRegistrationCommand } from './commands/register_validator'; +export { StakeCommand } from './commands/stake'; export { UpdateGeneratorKeyCommand } from './commands/update_generator_key'; -export { ReportMisbehaviorCommand } from './commands/pom'; +export { ReportMisbehaviorCommand } from './commands/report_misbehavior'; export { UnlockCommand } from './commands/unlock'; -export { DPoSMethod } from './method'; +export { PoSMethod } from './method'; export { genesisStoreSchema } from './schemas'; diff --git a/framework/src/modules/dpos_v2/internal_method.ts b/framework/src/modules/pos/internal_method.ts similarity index 71% rename from framework/src/modules/dpos_v2/internal_method.ts rename to framework/src/modules/pos/internal_method.ts index dbf9dcfd92e..1a1410aaa0b 100644 --- a/framework/src/modules/dpos_v2/internal_method.ts +++ b/framework/src/modules/pos/internal_method.ts @@ -17,8 +17,8 @@ import { BaseMethod } from '../base_method'; import { NamedRegistry } from '../named_registry'; import { MAX_NUMBER_BYTES_Q96 } from './constants'; import { RewardsAssignedEvent } from './events/rewards_assigned'; -import { DelegateAccount, TokenMethod, VoteObject } from './types'; -import { calculateVoteRewards } from './utils'; +import { ValidatorAccount, TokenMethod, StakeObject } from './types'; +import { calculateStakeRewards } from './utils'; export class InternalMethod extends BaseMethod { private _tokenMethod!: TokenMethod; @@ -33,34 +33,34 @@ export class InternalMethod extends BaseMethod { this._tokenMethod = tokenMethod; } - public async assignVoteRewards( + public async assignStakeRewards( methodContext: MethodContext, - voterAddress: Buffer, - sentVote: VoteObject, - delegateData: DelegateAccount, + stakerAddress: Buffer, + sentStake: StakeObject, + validatorData: ValidatorAccount, ) { - if (sentVote.delegateAddress.equals(voterAddress)) { + if (sentStake.validatorAddress.equals(stakerAddress)) { return; } - for (const sharingCoefficient of delegateData.sharingCoefficients) { - const voteSharingCoefficient = sentVote.voteSharingCoefficients.find(coefficient => + for (const sharingCoefficient of validatorData.sharingCoefficients) { + const stakeSharingCoefficient = sentStake.stakeSharingCoefficients.find(coefficient => coefficient.tokenID.equals(sharingCoefficient.tokenID), ) ?? { tokenID: sharingCoefficient.tokenID, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96), }; - const reward = calculateVoteRewards( - voteSharingCoefficient, - sentVote.amount, + const reward = calculateStakeRewards( + stakeSharingCoefficient, + sentStake.amount, sharingCoefficient, ); if (reward > 0) { await this._tokenMethod.unlock( methodContext, - sentVote.delegateAddress, + sentStake.validatorAddress, this._moduleName, sharingCoefficient.tokenID, reward, @@ -68,15 +68,15 @@ export class InternalMethod extends BaseMethod { await this._tokenMethod.transfer( methodContext, - sentVote.delegateAddress, - voterAddress, + sentStake.validatorAddress, + stakerAddress, sharingCoefficient.tokenID, reward, ); this.events.get(RewardsAssignedEvent).log(methodContext, { - voterAddress, - delegateAddress: sentVote.delegateAddress, + stakerAddress, + validatorAddress: sentStake.validatorAddress, tokenID: sharingCoefficient.tokenID, amount: reward, }); diff --git a/framework/src/modules/dpos_v2/method.ts b/framework/src/modules/pos/method.ts similarity index 61% rename from framework/src/modules/dpos_v2/method.ts rename to framework/src/modules/pos/method.ts index fd2ef645536..de66356e7d9 100644 --- a/framework/src/modules/dpos_v2/method.ts +++ b/framework/src/modules/pos/method.ts @@ -17,13 +17,13 @@ import { ImmutableMethodContext, MethodContext } from '../../state_machine'; import { BaseMethod } from '../base_method'; import { EMPTY_KEY, MAX_LENGTH_NAME } from './constants'; import { GenesisDataStore } from './stores/genesis'; -import { VoterStore } from './stores/voter'; -import { ModuleConfig, VoterData, TokenMethod } from './types'; -import { DelegateAccount, DelegateStore } from './stores/delegate'; +import { StakerStore } from './stores/staker'; +import { ModuleConfig, StakerData, TokenMethod } from './types'; +import { ValidatorAccount, ValidatorStore } from './stores/validator'; import { NameStore } from './stores/name'; import { isUsername } from './utils'; -export class DPoSMethod extends BaseMethod { +export class PoSMethod extends BaseMethod { private _config!: ModuleConfig; private _moduleName!: string; private _tokenMethod!: TokenMethod; @@ -50,32 +50,32 @@ export class DPoSMethod extends BaseMethod { return true; } - public async getVoter( + public async getStaker( methodContext: ImmutableMethodContext, address: Buffer, - ): Promise { - const voterSubStore = this.stores.get(VoterStore); - const voterData = await voterSubStore.get(methodContext, address); + ): Promise { + const stakerSubStore = this.stores.get(StakerStore); + const stakerData = await stakerSubStore.get(methodContext, address); - return voterData; + return stakerData; } - public async getDelegate( + public async getValidator( methodContext: ImmutableMethodContext, address: Buffer, - ): Promise { - const delegateSubStore = this.stores.get(DelegateStore); - const delegate = await delegateSubStore.get(methodContext, address); + ): Promise { + const validatorSubStore = this.stores.get(ValidatorStore); + const validator = await validatorSubStore.get(methodContext, address); - return delegate; + return validator; } public getRoundLength(_methodContext: ImmutableMethodContext): number { return this._config.roundLength; } - public getNumberOfActiveDelegates(_methodContext: ImmutableMethodContext): number { - return this._config.numberActiveDelegates; + public getNumberOfActiveValidators(_methodContext: ImmutableMethodContext): number { + return this._config.numberActiveValidators; } public async updateSharedRewards( @@ -84,33 +84,33 @@ export class DPoSMethod extends BaseMethod { tokenID: Buffer, reward: bigint, ): Promise { - const delegateStore = this.stores.get(DelegateStore); - const delegate = await delegateStore.get(context, generatorAddress); - if (delegate.totalVotesReceived === BigInt(0)) { + const validatorStore = this.stores.get(ValidatorStore); + const validator = await validatorStore.get(context, generatorAddress); + if (validator.totalStakeReceived === BigInt(0)) { return; } const { q96 } = math; const rewardQ = q96(reward); - const commissionQ = q96(BigInt(delegate.commission)); + const commissionQ = q96(BigInt(validator.commission)); const rewardFractionQ = q96(BigInt(1)).sub(commissionQ.div(q96(BigInt(10000)))); - const selfVotesQ = q96(delegate.selfVotes); - const totalVotesQ = q96(delegate.totalVotesReceived); + const selfStakeQ = q96(validator.selfStake); + const totalStakesQ = q96(validator.totalStakeReceived); - const matchingCoefficientIndex = delegate.sharingCoefficients.findIndex(coefficient => + const matchingCoefficientIndex = validator.sharingCoefficients.findIndex(coefficient => coefficient.tokenID.equals(tokenID), ); const index = matchingCoefficientIndex > -1 ? matchingCoefficientIndex - : delegate.sharingCoefficients.length; + : validator.sharingCoefficients.length; if (matchingCoefficientIndex < 0) { - delegate.sharingCoefficients[index] = { tokenID, coefficient: q96(BigInt(0)).toBuffer() }; + validator.sharingCoefficients[index] = { tokenID, coefficient: q96(BigInt(0)).toBuffer() }; } - const oldSharingCoefficient = q96(delegate.sharingCoefficients[index].coefficient); - const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalVotesQ); - const sharedRewards = sharingCoefficientIncrease.mul(totalVotesQ.sub(selfVotesQ)).floor(); + const oldSharingCoefficient = q96(validator.sharingCoefficients[index].coefficient); + const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalStakesQ); + const sharedRewards = sharingCoefficientIncrease.mul(totalStakesQ.sub(selfStakeQ)).floor(); await this._tokenMethod.lock( context, @@ -121,10 +121,10 @@ export class DPoSMethod extends BaseMethod { ); const newSharingCoefficient = oldSharingCoefficient.add(sharingCoefficientIncrease); - delegate.sharingCoefficients[index].coefficient = newSharingCoefficient.toBuffer(); + validator.sharingCoefficients[index].coefficient = newSharingCoefficient.toBuffer(); - delegate.sharingCoefficients.sort((a, b) => a.tokenID.compare(b.tokenID)); - await delegateStore.set(context, generatorAddress, delegate); + validator.sharingCoefficients.sort((a, b) => a.tokenID.compare(b.tokenID)); + await validatorStore.set(context, generatorAddress, validator); } public async isEndOfRound( diff --git a/framework/src/modules/dpos_v2/module.ts b/framework/src/modules/pos/module.ts similarity index 54% rename from framework/src/modules/dpos_v2/module.ts rename to framework/src/modules/pos/module.ts index fbfd4dcdda2..131401e4af9 100644 --- a/framework/src/modules/dpos_v2/module.ts +++ b/framework/src/modules/pos/module.ts @@ -18,41 +18,41 @@ import { isUInt64, validator } from '@liskhq/lisk-validator'; import { codec } from '@liskhq/lisk-codec'; import { GenesisBlockExecuteContext, BlockAfterExecuteContext } from '../../state_machine'; import { BaseModule, ModuleInitArgs, ModuleMetadata } from '../base_module'; -import { DPoSMethod } from './method'; -import { DelegateRegistrationCommand } from './commands/delegate_registration'; -import { ReportMisbehaviorCommand } from './commands/pom'; +import { PoSMethod } from './method'; +import { RegisterValidatorCommand } from './commands/register_validator'; +import { ReportMisbehaviorCommand } from './commands/report_misbehavior'; import { UnlockCommand } from './commands/unlock'; import { UpdateGeneratorKeyCommand } from './commands/update_generator_key'; -import { VoteDelegateCommand } from './commands/vote_delegate'; +import { StakeCommand } from './commands/stake'; import { ChangeCommissionCommand } from './commands/change_commission'; import { - DELEGATE_LIST_ROUND_OFFSET, + VALIDATOR_LIST_ROUND_OFFSET, EMPTY_KEY, - MAX_NUMBER_SENT_VOTES, + MAX_NUMBER_SENT_STAKES, MAX_NUMBER_PENDING_UNLOCKS, defaultConfig, MAX_CAP, } from './constants'; -import { DPoSEndpoint } from './endpoint'; +import { PoSEndpoint } from './endpoint'; import { configSchema, genesisStoreSchema, - getAllDelegatesResponseSchema, + getAllValidatorsResponseSchema, getClaimableRewardsRequestSchema, getClaimableRewardsResponseSchema, - getDelegateRequestSchema, - getDelegateResponseSchema, - getGovernanceTokenIDResponseSchema, + getValidatorRequestSchema, + getValidatorResponseSchema, + getPoSTokenIDResponseSchema, getLockedRewardsRequestSchema, getLockedRewardsResponseSchema, - getLockedVotedAmountRequestSchema, - getLockedVotedAmountResponseSchema, + getLockedStakedAmountRequestSchema, + getLockedStakedAmountResponseSchema, getPendingUnlocksRequestSchema, getPendingUnlocksResponseSchema, getValidatorsByStakeRequestSchema, getValidatorsByStakeResponseSchema, - getVoterRequestSchema, - getVoterResponseSchema, + getStakerRequestSchema, + getStakerResponseSchema, } from './schemas'; import { RandomMethod, @@ -66,35 +66,35 @@ import { Rounds } from './rounds'; import { equalUnlocking, isUsername, - selectStandbyDelegates, - shuffleDelegateList, + selectStandbyValidators, + shuffleValidatorList, sortUnlocking, getModuleConfig, - getDelegateWeight, + getValidatorWeight, ValidatorWeight, isSharingCoefficientSorted, } from './utils'; -import { DelegateStore } from './stores/delegate'; +import { ValidatorStore } from './stores/validator'; import { GenesisDataStore } from './stores/genesis'; import { NameStore } from './stores/name'; import { PreviousTimestampStore } from './stores/previous_timestamp'; import { SnapshotStore, SnapshotStoreData } from './stores/snapshot'; -import { VoterStore } from './stores/voter'; -import { EligibleDelegatesStore } from './stores/eligible_delegates'; -import { DelegateBannedEvent } from './events/delegate_banned'; -import { DelegatePunishedEvent } from './events/delegate_punished'; -import { DelegateRegisteredEvent } from './events/delegate_registered'; -import { DelegateVotedEvent } from './events/delegate_voted'; +import { StakerStore } from './stores/staker'; +import { EligibleValidatorsStore } from './stores/eligible_validators'; +import { ValidatorBannedEvent } from './events/validator_banned'; +import { ValidatorPunishedEvent } from './events/validator_punished'; +import { ValidatorRegisteredEvent } from './events/validator_registered'; +import { ValidatorStakedEvent } from './events/validator_staked'; import { InternalMethod } from './internal_method'; import { CommissionChangeEvent } from './events/commission_change'; import { ClaimRewardsCommand } from './commands/claim_rewards'; -export class DPoSModule extends BaseModule { - public method = new DPoSMethod(this.stores, this.events); +export class PoSModule extends BaseModule { + public method = new PoSMethod(this.stores, this.events); public configSchema = configSchema; - public endpoint = new DPoSEndpoint(this.stores, this.offchainStores); + public endpoint = new PoSEndpoint(this.stores, this.offchainStores); - private readonly _delegateRegistrationCommand = new DelegateRegistrationCommand( + private readonly _registerValidatorCommand = new RegisterValidatorCommand( this.stores, this.events, ); @@ -107,17 +107,17 @@ export class DPoSModule extends BaseModule { this.stores, this.events, ); - private readonly _voteCommand = new VoteDelegateCommand(this.stores, this.events); + private readonly _stakeCommand = new StakeCommand(this.stores, this.events); private readonly _changeCommissionCommand = new ChangeCommissionCommand(this.stores, this.events); private readonly _claimRewardsCommand = new ClaimRewardsCommand(this.stores, this.events); // eslint-disable-next-line @typescript-eslint/member-ordering public commands = [ - this._delegateRegistrationCommand, + this._registerValidatorCommand, this._reportMisbehaviorCommand, this._unlockCommand, this._updateGeneratorKeyCommand, - this._voteCommand, + this._stakeCommand, this._changeCommissionCommand, this._claimRewardsCommand, ]; @@ -130,23 +130,23 @@ export class DPoSModule extends BaseModule { public constructor() { super(); - this.stores.register(DelegateStore, new DelegateStore(this.name)); + this.stores.register(ValidatorStore, new ValidatorStore(this.name)); this.stores.register(GenesisDataStore, new GenesisDataStore(this.name)); this.stores.register(NameStore, new NameStore(this.name)); this.stores.register(PreviousTimestampStore, new PreviousTimestampStore(this.name)); this.stores.register(SnapshotStore, new SnapshotStore(this.name)); - this.stores.register(VoterStore, new VoterStore(this.name)); - this.stores.register(EligibleDelegatesStore, new EligibleDelegatesStore(this.name)); + this.stores.register(StakerStore, new StakerStore(this.name)); + this.stores.register(EligibleValidatorsStore, new EligibleValidatorsStore(this.name)); - this.events.register(DelegateBannedEvent, new DelegateBannedEvent(this.name)); - this.events.register(DelegatePunishedEvent, new DelegatePunishedEvent(this.name)); - this.events.register(DelegateRegisteredEvent, new DelegateRegisteredEvent(this.name)); - this.events.register(DelegateVotedEvent, new DelegateVotedEvent(this.name)); + this.events.register(ValidatorBannedEvent, new ValidatorBannedEvent(this.name)); + this.events.register(ValidatorPunishedEvent, new ValidatorPunishedEvent(this.name)); + this.events.register(ValidatorRegisteredEvent, new ValidatorRegisteredEvent(this.name)); + this.events.register(ValidatorStakedEvent, new ValidatorStakedEvent(this.name)); this.events.register(CommissionChangeEvent, new CommissionChangeEvent(this.name)); } public get name() { - return 'dpos'; + return 'pos'; } public addDependencies( @@ -158,7 +158,7 @@ export class DPoSModule extends BaseModule { this._validatorsMethod = validatorsMethod; this._tokenMethod = tokenMethod; - this._delegateRegistrationCommand.addDependencies(this._tokenMethod, this._validatorsMethod); + this._registerValidatorCommand.addDependencies(this._tokenMethod, this._validatorsMethod); this._reportMisbehaviorCommand.addDependencies({ tokenMethod: this._tokenMethod, validatorsMethod: this._validatorsMethod, @@ -167,7 +167,7 @@ export class DPoSModule extends BaseModule { tokenMethod: this._tokenMethod, }); this._updateGeneratorKeyCommand.addDependencies(this._validatorsMethod); - this._voteCommand.addDependencies({ + this._stakeCommand.addDependencies({ tokenMethod: this._tokenMethod, internalMethod: this._internalMethod, }); @@ -180,26 +180,31 @@ export class DPoSModule extends BaseModule { return { endpoints: [ { - name: this.endpoint.getAllDelegates.name, - response: getAllDelegatesResponseSchema, + name: this.endpoint.getAllValidators.name, + response: getAllValidatorsResponseSchema, }, { - name: this.endpoint.getDelegate.name, - request: getDelegateRequestSchema, - response: getDelegateResponseSchema, + name: this.endpoint.getValidator.name, + request: getValidatorRequestSchema, + response: getValidatorResponseSchema, }, { - name: this.endpoint.getVoter.name, - request: getVoterRequestSchema, - response: getVoterResponseSchema, + name: this.endpoint.getStaker.name, + request: getStakerRequestSchema, + response: getStakerResponseSchema, }, { name: this.endpoint.getConstants.name, response: configSchema, }, { - name: this.endpoint.getGovernanceTokenID.name, - response: getGovernanceTokenIDResponseSchema, + name: this.endpoint.getPoSTokenID.name, + response: getPoSTokenIDResponseSchema, + }, + { + name: this.endpoint.getClaimableRewards.name, + request: getClaimableRewardsRequestSchema, + response: getClaimableRewardsResponseSchema, }, { name: this.endpoint.getClaimableRewards.name, @@ -212,9 +217,9 @@ export class DPoSModule extends BaseModule { response: getLockedRewardsResponseSchema, }, { - name: this.endpoint.getLockedVotedAmount.name, - request: getLockedVotedAmountRequestSchema, - response: getLockedVotedAmountResponseSchema, + name: this.endpoint.getLockedStakedAmount.name, + request: getLockedStakedAmountRequestSchema, + response: getLockedStakedAmountResponseSchema, }, { name: this.endpoint.getValidatorsByStake.name, @@ -244,14 +249,12 @@ export class DPoSModule extends BaseModule { // eslint-disable-next-line @typescript-eslint/require-await public async init(args: ModuleInitArgs) { const { moduleConfig } = args; - const defaultGovernanceTokenID = `${args.genesisConfig.chainID}${Buffer.alloc(4).toString( - 'hex', - )}`; + const defaultPoSTokenID = `${args.genesisConfig.chainID}${Buffer.alloc(4).toString('hex')}`; const config = objects.mergeDeep( {}, { ...defaultConfig, - governanceTokenID: defaultGovernanceTokenID, + posTokenID: defaultPoSTokenID, }, moduleConfig, ) as ModuleConfigJSON; @@ -263,30 +266,30 @@ export class DPoSModule extends BaseModule { this.endpoint.init(this.name, this._moduleConfig, this._tokenMethod); this._reportMisbehaviorCommand.init({ - governanceTokenID: this._moduleConfig.governanceTokenID, - factorSelfVotes: this._moduleConfig.factorSelfVotes, + posTokenID: this._moduleConfig.posTokenID, + factorSelfStakes: this._moduleConfig.factorSelfStakes, }); - this._delegateRegistrationCommand.init({ + this._registerValidatorCommand.init({ tokenIDFee: this._moduleConfig.tokenIDFee, - delegateRegistrationFee: this._moduleConfig.delegateRegistrationFee, + validatorRegistrationFee: this._moduleConfig.validatorRegistrationFee, }); this._unlockCommand.init({ - governanceTokenID: this._moduleConfig.governanceTokenID, + posTokenID: this._moduleConfig.posTokenID, roundLength: this._moduleConfig.roundLength, }); - this._voteCommand.init({ - governanceTokenID: this._moduleConfig.governanceTokenID, - factorSelfVotes: BigInt(this._moduleConfig.factorSelfVotes), + this._stakeCommand.init({ + posTokenID: this._moduleConfig.posTokenID, + factorSelfStakes: BigInt(this._moduleConfig.factorSelfStakes), }); this._changeCommissionCommand.init({ commissionIncreasePeriod: this._moduleConfig.commissionIncreasePeriod, maxCommissionIncreaseRate: this._moduleConfig.maxCommissionIncreaseRate, }); - this.stores.get(EligibleDelegatesStore).init(this._moduleConfig); - this._voteCommand.init({ - governanceTokenID: this._moduleConfig.governanceTokenID, - factorSelfVotes: BigInt(this._moduleConfig.factorSelfVotes), + this.stores.get(EligibleValidatorsStore).init(this._moduleConfig); + this._stakeCommand.init({ + posTokenID: this._moduleConfig.posTokenID, + factorSelfStakes: BigInt(this._moduleConfig.factorSelfStakes), }); } @@ -300,54 +303,54 @@ export class DPoSModule extends BaseModule { validator.validate(genesisStoreSchema, genesisStore); // validators property check - const dposValidatorAddresses = []; - const dposValidatorNames = []; - const dposValidatorAddressMap = new dataStructures.BufferMap(); - for (const dposValidator of genesisStore.validators) { - if (!isUsername(dposValidator.name)) { - throw new Error(`Invalid validator name ${dposValidator.name}.`); + const posValidatorAddresses = []; + const posValidatorNames = []; + const posValidatorAddressMap = new dataStructures.BufferMap(); + for (const posValidator of genesisStore.validators) { + if (!isUsername(posValidator.name)) { + throw new Error(`Invalid validator name ${posValidator.name}.`); } - if (dposValidator.lastCommissionIncreaseHeight > context.header.height) { + if (posValidator.lastCommissionIncreaseHeight > context.header.height) { throw new Error( `Invalid lastCommissionIncreaseHeight ${ - dposValidator.lastCommissionIncreaseHeight - } for ${cryptoAddress.getLisk32AddressFromAddress(dposValidator.address)}.`, + posValidator.lastCommissionIncreaseHeight + } for ${cryptoAddress.getLisk32AddressFromAddress(posValidator.address)}.`, ); } // sharingCoefficients must be sorted by tokenID - if (!isSharingCoefficientSorted(dposValidator.sharingCoefficients)) { + if (!isSharingCoefficientSorted(posValidator.sharingCoefficients)) { throw new Error('SharingCoefficients must be sorted by tokenID.'); } - dposValidatorAddressMap.set(dposValidator.address, dposValidator); - dposValidatorAddresses.push(dposValidator.address); - dposValidatorNames.push(dposValidator.name); + posValidatorAddressMap.set(posValidator.address, posValidator); + posValidatorAddresses.push(posValidator.address); + posValidatorNames.push(posValidator.name); } - if (!objectUtils.bufferArrayUniqueItems(dposValidatorAddresses)) { + if (!objectUtils.bufferArrayUniqueItems(posValidatorAddresses)) { throw new Error('Validator address is not unique.'); } - if (new Set(dposValidatorNames).size !== dposValidatorNames.length) { + if (new Set(posValidatorNames).size !== posValidatorNames.length) { throw new Error('Validator name is not unique.'); } - // voters property check - const voterAddresses = []; - for (const voter of genesisStore.voters) { - if (voter.sentVotes.length > MAX_NUMBER_SENT_VOTES) { - throw new Error(`Sent vote exceeds max vote ${MAX_NUMBER_SENT_VOTES}.`); + // stakers property check + const stakerAddresses = []; + for (const staker of genesisStore.stakers) { + if (staker.sentStakes.length > MAX_NUMBER_SENT_STAKES) { + throw new Error(`Sent stake exceeds max stake ${MAX_NUMBER_SENT_STAKES}.`); } - if (!objectUtils.bufferArrayUniqueItems(voter.sentVotes.map(v => v.delegateAddress))) { - throw new Error('Sent vote delegate address is not unique.'); + if (!objectUtils.bufferArrayUniqueItems(staker.sentStakes.map(v => v.validatorAddress))) { + throw new Error('Sent stake validator address is not unique.'); } - if (!objectUtils.bufferArrayOrderByLex(voter.sentVotes.map(v => v.delegateAddress))) { - throw new Error('Sent vote delegate address is not lexicographically ordered.'); + if (!objectUtils.bufferArrayOrderByLex(staker.sentStakes.map(v => v.validatorAddress))) { + throw new Error('Sent stake validator address is not lexicographically ordered.'); } - for (const votes of voter.sentVotes) { - const dposValidator = dposValidatorAddressMap.get(votes.delegateAddress); - if (!dposValidator) { - throw new Error('Sent vote includes non existing validator address.'); + for (const stakes of staker.sentStakes) { + const posValidator = posValidatorAddressMap.get(stakes.validatorAddress); + if (!posValidator) { + throw new Error('Sent stake includes non existing validator address.'); } - for (const sharingCoefficient of votes.voteSharingCoefficients) { - const targetCoefficient = dposValidator.sharingCoefficients.find(co => + for (const sharingCoefficient of stakes.stakeSharingCoefficients) { + const targetCoefficient = posValidator.sharingCoefficients.find(co => co.tokenID.equals(sharingCoefficient.tokenID), ); if ( @@ -360,91 +363,93 @@ export class DPoSModule extends BaseModule { } } // sharingCoefficients must be sorted by tokenID - if (!isSharingCoefficientSorted(votes.voteSharingCoefficients)) { - throw new Error('voteSharingCoefficients must be sorted by tokenID.'); + if (!isSharingCoefficientSorted(stakes.stakeSharingCoefficients)) { + throw new Error('stakeSharingCoefficients must be sorted by tokenID.'); } } - if (voter.pendingUnlocks.length > MAX_NUMBER_PENDING_UNLOCKS) { + if (staker.pendingUnlocks.length > MAX_NUMBER_PENDING_UNLOCKS) { throw new Error(`PendingUnlocks exceeds max unlocking ${MAX_NUMBER_PENDING_UNLOCKS}.`); } - const sortingPendingUnlocks = [...voter.pendingUnlocks]; + const sortingPendingUnlocks = [...staker.pendingUnlocks]; sortUnlocking(sortingPendingUnlocks); - for (let i = 0; i < voter.pendingUnlocks.length; i += 1) { - const original = voter.pendingUnlocks[i]; + for (let i = 0; i < staker.pendingUnlocks.length; i += 1) { + const original = staker.pendingUnlocks[i]; const target = sortingPendingUnlocks[i]; if (!equalUnlocking(original, target)) { throw new Error('PendingUnlocks are not lexicographically ordered.'); } } - if (voter.pendingUnlocks.some(v => !dposValidatorAddressMap.has(v.delegateAddress))) { + if (staker.pendingUnlocks.some(v => !posValidatorAddressMap.has(v.validatorAddress))) { throw new Error('Pending unlocks includes non existing validator address.'); } - voterAddresses.push(voter.address); + stakerAddresses.push(staker.address); } - if (!objectUtils.bufferArrayUniqueItems(voterAddresses)) { - throw new Error('Voter address is not unique.'); + if (!objectUtils.bufferArrayUniqueItems(stakerAddresses)) { + throw new Error('Staker address is not unique.'); } // check genesis state - if (!objectUtils.bufferArrayUniqueItems(genesisStore.genesisData.initDelegates)) { - throw new Error('Init delegates address is not unique.'); + if (!objectUtils.bufferArrayUniqueItems(genesisStore.genesisData.initValidators)) { + throw new Error('Init validators address is not unique.'); } - if (genesisStore.genesisData.initDelegates.some(v => !dposValidatorAddressMap.has(v))) { - throw new Error('Init delegates includes non existing validator address.'); + if (genesisStore.genesisData.initValidators.some(v => !posValidatorAddressMap.has(v))) { + throw new Error('Init validators includes non existing validator address.'); } - if (genesisStore.genesisData.initDelegates.length > this._moduleConfig.numberActiveDelegates) { + if ( + genesisStore.genesisData.initValidators.length > this._moduleConfig.numberActiveValidators + ) { throw new Error( - `Init delegates is greater than number of active delegates ${this._moduleConfig.numberActiveDelegates}.`, + `Init validators is greater than number of active validators ${this._moduleConfig.numberActiveValidators}.`, ); } - const voterStore = this.stores.get(VoterStore); - const voteMap = new dataStructures.BufferMap<{ selfVotes: bigint; voteReceived: bigint }>(); - for (const voter of genesisStore.voters) { - for (const sentVote of voter.sentVotes) { - const delegate = voteMap.get(sentVote.delegateAddress) ?? { - selfVotes: BigInt(0), - voteReceived: BigInt(0), + const stakerStore = this.stores.get(StakerStore); + const stakeMap = new dataStructures.BufferMap<{ selfStake: bigint; stakeReceived: bigint }>(); + for (const staker of genesisStore.stakers) { + for (const sentStake of staker.sentStakes) { + const validatorData = stakeMap.get(sentStake.validatorAddress) ?? { + selfStake: BigInt(0), + stakeReceived: BigInt(0), }; - delegate.voteReceived += sentVote.amount; - if (!isUInt64(delegate.voteReceived)) { - throw new Error('Votes received out of range.'); + validatorData.stakeReceived += sentStake.amount; + if (!isUInt64(validatorData.stakeReceived)) { + throw new Error('Stakes received out of range.'); } - if (sentVote.delegateAddress.equals(voter.address)) { - delegate.selfVotes += sentVote.amount; - if (!isUInt64(delegate.selfVotes)) { - throw new Error('Self vote out of range.'); + if (sentStake.validatorAddress.equals(staker.address)) { + validatorData.selfStake += sentStake.amount; + if (!isUInt64(validatorData.selfStake)) { + throw new Error('Self stake out of range.'); } } - voteMap.set(sentVote.delegateAddress, delegate); + stakeMap.set(sentStake.validatorAddress, validatorData); } - await voterStore.set(context, voter.address, { - sentVotes: voter.sentVotes, - pendingUnlocks: voter.pendingUnlocks, + await stakerStore.set(context, staker.address, { + sentStakes: staker.sentStakes, + pendingUnlocks: staker.pendingUnlocks, }); } - const delegateStore = this.stores.get(DelegateStore); + const validatorStore = this.stores.get(ValidatorStore); const nameSubstore = this.stores.get(NameStore); - for (const dposValidator of genesisStore.validators) { - const voteInfo = voteMap.get(dposValidator.address) ?? { - selfVotes: BigInt(0), - voteReceived: BigInt(0), + for (const posValidator of genesisStore.validators) { + const stakeInfo = stakeMap.get(posValidator.address) ?? { + selfStake: BigInt(0), + stakeReceived: BigInt(0), }; - await delegateStore.set(context, dposValidator.address, { - name: dposValidator.name, - totalVotesReceived: voteInfo.voteReceived, - selfVotes: voteInfo.selfVotes, - lastGeneratedHeight: dposValidator.lastGeneratedHeight, - isBanned: dposValidator.isBanned, - pomHeights: dposValidator.pomHeights, - consecutiveMissedBlocks: dposValidator.consecutiveMissedBlocks, - commission: dposValidator.commission, - lastCommissionIncreaseHeight: dposValidator.lastCommissionIncreaseHeight, - sharingCoefficients: dposValidator.sharingCoefficients, + await validatorStore.set(context, posValidator.address, { + name: posValidator.name, + totalStakeReceived: stakeInfo.stakeReceived, + selfStake: stakeInfo.selfStake, + lastGeneratedHeight: posValidator.lastGeneratedHeight, + isBanned: posValidator.isBanned, + pomHeights: posValidator.pomHeights, + consecutiveMissedBlocks: posValidator.consecutiveMissedBlocks, + commission: posValidator.commission, + lastCommissionIncreaseHeight: posValidator.lastCommissionIncreaseHeight, + sharingCoefficients: posValidator.sharingCoefficients, }); - await nameSubstore.set(context, Buffer.from(dposValidator.name, 'utf-8'), { - delegateAddress: dposValidator.address, + await nameSubstore.set(context, Buffer.from(posValidator.name, 'utf-8'), { + validatorAddress: posValidator.address, }); } @@ -457,7 +462,7 @@ export class DPoSModule extends BaseModule { await genesisDataStore.set(context, EMPTY_KEY, { height: context.header.height, initRounds: genesisStore.genesisData.initRounds, - initDelegates: genesisStore.genesisData.initDelegates, + initValidators: genesisStore.genesisData.initValidators, }); } @@ -469,47 +474,47 @@ export class DPoSModule extends BaseModule { } const genesisStore = codec.decode(genesisStoreSchema, assetBytes); const methodContext = context.getMethodContext(); - for (const dposValidator of genesisStore.validators) { + for (const posValidator of genesisStore.validators) { const valid = await this._validatorsMethod.registerValidatorKeys( methodContext, - dposValidator.address, - dposValidator.blsKey, - dposValidator.generatorKey, - dposValidator.proofOfPossession, + posValidator.address, + posValidator.blsKey, + posValidator.generatorKey, + posValidator.proofOfPossession, ); if (!valid) { throw new Error('Invalid validator key.'); } } - const voterStore = this.stores.get(VoterStore); - const allVoters = await voterStore.iterate(context, { + const stakerStore = this.stores.get(StakerStore); + const allStakers = await stakerStore.iterate(context, { gte: Buffer.alloc(20), lte: Buffer.alloc(20, 255), }); - for (const voterData of allVoters) { - let votedAmount = BigInt(0); - for (const sentVotes of voterData.value.sentVotes) { - votedAmount += sentVotes.amount; + for (const stakerData of allStakers) { + let stakedAmount = BigInt(0); + for (const sentStakes of stakerData.value.sentStakes) { + stakedAmount += sentStakes.amount; } - for (const pendingUnlock of voterData.value.pendingUnlocks) { - votedAmount += pendingUnlock.amount; + for (const pendingUnlock of stakerData.value.pendingUnlocks) { + stakedAmount += pendingUnlock.amount; } const lockedAmount = await this._tokenMethod.getLockedAmount( methodContext, - voterData.key, - this._moduleConfig.governanceTokenID, + stakerData.key, + this._moduleConfig.posTokenID, this.name, ); - if (lockedAmount !== votedAmount) { - throw new Error('Voted amount is not locked'); + if (lockedAmount !== stakedAmount) { + throw new Error('Staked amount is not locked'); } } - const initDelegates = [...genesisStore.genesisData.initDelegates]; - initDelegates.sort((a, b) => a.compare(b)); + const initValidators = [...genesisStore.genesisData.initValidators]; + initValidators.sort((a, b) => a.compare(b)); const validators = []; let aggregateBFTWeight = BigInt(0); - for (const validatorAddress of initDelegates) { + for (const validatorAddress of initValidators) { validators.push({ address: validatorAddress, bftWeight: BigInt(1), @@ -540,7 +545,7 @@ export class DPoSModule extends BaseModule { await this._updateProductivity(context, previousTimestamp); if (isLastBlockOfRound) { - await this._createVoteWeightSnapshot(context); + await this._createStakeWeightSnapshot(context); } const didBootstrapRoundsEnd = await this._didBootstrapRoundsEnd(context); @@ -551,27 +556,27 @@ export class DPoSModule extends BaseModule { await previousTimestampStore.set(context, EMPTY_KEY, { timestamp: header.timestamp }); } - private async _createVoteWeightSnapshot(context: BlockAfterExecuteContext): Promise { + private async _createStakeWeightSnapshot(context: BlockAfterExecuteContext): Promise { const snapshotHeight = context.header.height + 1; const round = new Rounds({ blocksPerRound: this._moduleConfig.roundLength }); - const snapshotRound = round.calcRound(snapshotHeight) + DELEGATE_LIST_ROUND_OFFSET; - context.logger.debug(`Creating vote weight snapshot for round: ${snapshotRound.toString()}`); + const snapshotRound = round.calcRound(snapshotHeight) + VALIDATOR_LIST_ROUND_OFFSET; + context.logger.debug(`Creating stake weight snapshot for round: ${snapshotRound.toString()}`); - const eligibleDelegateStore = this.stores.get(EligibleDelegatesStore); - const eligibleDelegatesList = await eligibleDelegateStore.getAll(context); - const delegateWeightSnapshot = []; - for (const { key, value } of eligibleDelegatesList) { + const eligibleValidatorStore = this.stores.get(EligibleValidatorsStore); + const eligibleValidatorsList = await eligibleValidatorStore.getAll(context); + const validatorWeightSnapshot = []; + for (const { key, value } of eligibleValidatorsList) { if ( value.lastPomHeight === 0 || value.lastPomHeight < snapshotHeight - this._moduleConfig.punishmentWindow ) { - const [address, weight] = eligibleDelegateStore.splitKey(key); - delegateWeightSnapshot.push({ address, weight }); + const [address, weight] = eligibleValidatorStore.splitKey(key); + validatorWeightSnapshot.push({ address, weight }); } } const snapshotData: SnapshotStoreData = { - delegateWeightSnapshot, + validatorWeightSnapshot, }; const snapshotStore = this.stores.get(SnapshotStore); @@ -582,7 +587,7 @@ export class DPoSModule extends BaseModule { // Remove outdated information const oldData = await snapshotStore.iterate(context, { gte: utils.intToBuffer(0, 4), - lte: utils.intToBuffer(Math.max(0, snapshotRound - DELEGATE_LIST_ROUND_OFFSET - 1), 4), + lte: utils.intToBuffer(Math.max(0, snapshotRound - VALIDATOR_LIST_ROUND_OFFSET - 1), 4), }); for (const { key } of oldData) { await snapshotStore.del(context, key); @@ -593,22 +598,22 @@ export class DPoSModule extends BaseModule { const round = new Rounds({ blocksPerRound: this._moduleConfig.roundLength }); const { height } = context.header; const nextRound = round.calcRound(height) + 1; - context.logger.debug(nextRound, 'Updating delegate list for'); + context.logger.debug(nextRound, 'Updating validator list for'); const snapshotStore = this.stores.get(SnapshotStore); const snapshot = await snapshotStore.get(context, utils.intToBuffer(nextRound, 4)); const genesisData = await this.stores.get(GenesisDataStore).get(context, EMPTY_KEY); const methodContext = context.getMethodContext(); - const activeValidators = await this._getActiveDelegates( + const activeValidators = await this._getActiveValidators( context, - snapshot.delegateWeightSnapshot, + snapshot.validatorWeightSnapshot, nextRound, ); const validators = []; - const activeDelegateMap = new dataStructures.BufferMap(); + const activeValidatorMap = new dataStructures.BufferMap(); for (const v of activeValidators) { - activeDelegateMap.set(v.address, true); + activeValidatorMap.set(v.address, true); validators.push(v); } @@ -617,23 +622,23 @@ export class DPoSModule extends BaseModule { height + 1 - Math.floor((this._moduleConfig.roundLength * 3) / 2), this._moduleConfig.roundLength, ); - // select standby delegates - let standbyDelegates: ValidatorWeight[] = []; - if (nextRound > genesisData.initRounds + this._moduleConfig.numberActiveDelegates) { - const candidates = snapshot.delegateWeightSnapshot.filter( - v => !activeDelegateMap.has(v.address), + // select standby validators + let standbyValidators: ValidatorWeight[] = []; + if (nextRound > genesisData.initRounds + this._moduleConfig.numberActiveValidators) { + const candidates = snapshot.validatorWeightSnapshot.filter( + v => !activeValidatorMap.has(v.address), ); - if (this._moduleConfig.numberStandbyDelegates === 2) { + if (this._moduleConfig.numberStandbyValidators === 2) { const randomSeed2 = await this._randomMethod.getRandomBytes( methodContext, height + 1 - 2 * this._moduleConfig.roundLength, this._moduleConfig.roundLength, ); - standbyDelegates = selectStandbyDelegates(candidates, randomSeed1, randomSeed2); - validators.push(...standbyDelegates); - } else if (this._moduleConfig.numberStandbyDelegates === 1) { - standbyDelegates = selectStandbyDelegates(candidates, randomSeed1); - validators.push(...standbyDelegates); + standbyValidators = selectStandbyValidators(candidates, randomSeed1, randomSeed2); + validators.push(...standbyValidators); + } else if (this._moduleConfig.numberStandbyValidators === 1) { + standbyValidators = selectStandbyValidators(candidates, randomSeed1); + validators.push(...standbyValidators); } } // if there is no validator, then no update @@ -642,7 +647,7 @@ export class DPoSModule extends BaseModule { } // Update the validators - const shuffledValidators = shuffleDelegateList(randomSeed1, validators); + const shuffledValidators = shuffleValidatorList(randomSeed1, validators); let aggregateBFTWeight = BigInt(0); const bftValidators: { address: Buffer; bftWeight: bigint }[] = []; for (const v of shuffledValidators) { @@ -667,7 +672,7 @@ export class DPoSModule extends BaseModule { const { logger, header, getMethodContext } = context; const round = new Rounds({ blocksPerRound: this._moduleConfig.roundLength }); - logger.debug(round, 'Updating delegates productivity for round'); + logger.debug(round, 'Updating validators productivity for round'); const newHeight = header.height; const methodContext = getMethodContext(); @@ -677,36 +682,36 @@ export class DPoSModule extends BaseModule { header.timestamp, ); - const delegateStore = this.stores.get(DelegateStore); - const eligibleDelegateStore = this.stores.get(EligibleDelegatesStore); + const validatorStore = this.stores.get(ValidatorStore); + const eligibleValidatorStore = this.stores.get(EligibleValidatorsStore); for (const addressString of Object.keys(missedBlocks)) { const address = Buffer.from(addressString, 'binary'); - const delegate = await delegateStore.get(context, address); - delegate.consecutiveMissedBlocks += missedBlocks[addressString]; + const validatorData = await validatorStore.get(context, address); + validatorData.consecutiveMissedBlocks += missedBlocks[addressString]; if ( - delegate.consecutiveMissedBlocks > this._moduleConfig.failSafeMissedBlocks && - newHeight - delegate.lastGeneratedHeight > this._moduleConfig.failSafeInactiveWindow + validatorData.consecutiveMissedBlocks > this._moduleConfig.failSafeMissedBlocks && + newHeight - validatorData.lastGeneratedHeight > this._moduleConfig.failSafeInactiveWindow ) { - delegate.isBanned = true; - await eligibleDelegateStore.update( + validatorData.isBanned = true; + await eligibleValidatorStore.update( context, address, - getDelegateWeight( - BigInt(this._moduleConfig.factorSelfVotes), - delegate.selfVotes, - delegate.totalVotesReceived, + getValidatorWeight( + BigInt(this._moduleConfig.factorSelfStakes), + validatorData.selfStake, + validatorData.totalStakeReceived, ), - delegate, + validatorData, ); } - await delegateStore.set(context, address, delegate); + await validatorStore.set(context, address, validatorData); } - const generator = await delegateStore.get(context, header.generatorAddress); + const generator = await validatorStore.get(context, header.generatorAddress); generator.consecutiveMissedBlocks = 0; generator.lastGeneratedHeight = newHeight; - await delegateStore.set(context, header.generatorAddress, generator); + await validatorStore.set(context, header.generatorAddress, generator); } private async _didBootstrapRoundsEnd(context: BlockAfterExecuteContext) { @@ -720,45 +725,45 @@ export class DPoSModule extends BaseModule { return nextHeightRound > initRounds; } - // _getActiveDelegates assumes to be called after initRounds is passed + // _getActiveValidators assumes to be called after initRounds is passed // snapshotValidators is expected to be sorted desc by weight - private async _getActiveDelegates( + private async _getActiveValidators( context: BlockAfterExecuteContext, - snapshotValidators: SnapshotStoreData['delegateWeightSnapshot'], + snapshotValidators: SnapshotStoreData['validatorWeightSnapshot'], round: number, ): Promise { const genesisData = await this.stores.get(GenesisDataStore).get(context, EMPTY_KEY); // After initRounds, each round introduce one new slot for selected validators - if (round < genesisData.initRounds + this._moduleConfig.numberActiveDelegates) { + if (round < genesisData.initRounds + this._moduleConfig.numberActiveValidators) { const numInitValidators = - genesisData.initRounds + this._moduleConfig.numberActiveDelegates - round; - const numElectedValidators = this._moduleConfig.numberActiveDelegates - numInitValidators; - const activeDelegates = snapshotValidators.slice(0, numElectedValidators); - for (const address of genesisData.initDelegates) { - // when activeDelegate is filled, don't add anymore - if (activeDelegates.length === this._moduleConfig.numberActiveDelegates) { + genesisData.initRounds + this._moduleConfig.numberActiveValidators - round; + const numElectedValidators = this._moduleConfig.numberActiveValidators - numInitValidators; + const activeValidators = snapshotValidators.slice(0, numElectedValidators); + for (const address of genesisData.initValidators) { + // when activeValidator is filled, don't add anymore + if (activeValidators.length === this._moduleConfig.numberActiveValidators) { break; } // it should not add duplicate address - if (activeDelegates.findIndex(d => d.address.equals(address)) > -1) { + if (activeValidators.findIndex(d => d.address.equals(address)) > -1) { continue; } - activeDelegates.push({ address, weight: BigInt(1) }); + activeValidators.push({ address, weight: BigInt(1) }); } - return activeDelegates; + return activeValidators; } - // Delegate selection is out of init rounds - const activeDelegates = - snapshotValidators.length > this._moduleConfig.numberActiveDelegates - ? snapshotValidators.slice(0, this._moduleConfig.numberActiveDelegates) + // Validator selection is out of init rounds + const activeValidators = + snapshotValidators.length > this._moduleConfig.numberActiveValidators + ? snapshotValidators.slice(0, this._moduleConfig.numberActiveValidators) : snapshotValidators; // No capping is required const capValue = this._moduleConfig.maxBFTWeightCap; - if (activeDelegates.length < Math.ceil(MAX_CAP / capValue)) { - return activeDelegates; + if (activeValidators.length < Math.ceil(MAX_CAP / capValue)) { + return activeValidators; } // cap the weights - return this._capWeight(activeDelegates, this._moduleConfig.maxBFTWeightCap); + return this._capWeight(activeValidators, this._moduleConfig.maxBFTWeightCap); } private _capWeight(validators: ValidatorWeight[], capValue: number) { diff --git a/framework/src/modules/dpos_v2/rounds.ts b/framework/src/modules/pos/rounds.ts similarity index 100% rename from framework/src/modules/dpos_v2/rounds.ts rename to framework/src/modules/pos/rounds.ts diff --git a/framework/src/modules/dpos_v2/schemas.ts b/framework/src/modules/pos/schemas.ts similarity index 78% rename from framework/src/modules/dpos_v2/schemas.ts rename to framework/src/modules/pos/schemas.ts index f56d1c9f3a8..a6c9262956c 100644 --- a/framework/src/modules/dpos_v2/schemas.ts +++ b/framework/src/modules/pos/schemas.ts @@ -21,10 +21,10 @@ import { ED25519_PUBLIC_KEY_LENGTH, } from './constants'; -export const delegateRegistrationCommandParamsSchema = { - $id: '/dpos/command/registerDelegateParams', +export const validatorRegistrationCommandParamsSchema = { + $id: '/pos/command/registerValidatorParams', type: 'object', - required: ['name', 'blsKey', 'proofOfPossession', 'generatorKey', 'delegateRegistrationFee'], + required: ['name', 'blsKey', 'proofOfPossession', 'generatorKey', 'validatorRegistrationFee'], properties: { name: { dataType: 'string', @@ -48,7 +48,7 @@ export const delegateRegistrationCommandParamsSchema = { maxLength: ED25519_PUBLIC_KEY_LENGTH, fieldNumber: 4, }, - delegateRegistrationFee: { + validatorRegistrationFee: { dataType: 'uint64', fieldNumber: 5, }, @@ -56,7 +56,7 @@ export const delegateRegistrationCommandParamsSchema = { }; export const updateGeneratorKeyCommandParamsSchema = { - $id: '/dpos/command/updateGeneratorKeyParams', + $id: '/pos/command/updateGeneratorKeyParams', type: 'object', required: ['generatorKey'], properties: { @@ -69,21 +69,21 @@ export const updateGeneratorKeyCommandParamsSchema = { }, }; -export const voteCommandParamsSchema = { - $id: '/dpos/command/voteDelegateParams', +export const stakeCommandParamsSchema = { + $id: '/pos/command/stakeValidatorParams', type: 'object', - required: ['votes'], + required: ['stakes'], properties: { - votes: { + stakes: { type: 'array', fieldNumber: 1, minItems: 1, maxItems: 20, items: { type: 'object', - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', @@ -99,7 +99,7 @@ export const voteCommandParamsSchema = { }; export const pomCommandParamsSchema = { - $id: '/dpos/command/reportMisbehaviorParams', + $id: '/pos/command/reportMisbehaviorParams', type: 'object', required: ['header1', 'header2'], properties: { @@ -115,7 +115,7 @@ export const pomCommandParamsSchema = { }; export const changeCommissionCommandParamsSchema = { - $id: '/dpos/command/changeCommissionCommandParams', + $id: '/pos/command/changeCommissionCommandParams', type: 'object', required: ['newCommission'], properties: { @@ -128,10 +128,10 @@ export const changeCommissionCommandParamsSchema = { }; export const configSchema = { - $id: '/dpos/config', + $id: '/pos/config', type: 'object', properties: { - factorSelfVotes: { + factorSelfStakes: { type: 'integer', format: 'uint32', }, @@ -139,7 +139,7 @@ export const configSchema = { type: 'integer', format: 'uint32', }, - maxNumberSentVotes: { + maxNumberSentStakes: { type: 'integer', format: 'uint32', }, @@ -167,15 +167,15 @@ export const configSchema = { type: 'string', format: 'uint64', }, - numberActiveDelegates: { + numberActiveValidators: { type: 'integer', format: 'uint32', }, - numberStandbyDelegates: { + numberStandbyValidators: { type: 'integer', format: 'uint32', }, - governanceTokenID: { + posTokenID: { type: 'string', format: 'hex', }, @@ -183,7 +183,7 @@ export const configSchema = { type: 'string', format: 'hex', }, - delegateRegistrationFee: { + validatorRegistrationFee: { type: 'string', format: 'uint64', }, @@ -203,28 +203,28 @@ export const configSchema = { }, }, required: [ - 'factorSelfVotes', + 'factorSelfStakes', 'maxLengthName', - 'maxNumberSentVotes', + 'maxNumberSentStakes', 'maxNumberPendingUnlocks', 'failSafeMissedBlocks', 'failSafeInactiveWindow', 'punishmentWindow', 'roundLength', 'minWeightStandby', - 'numberActiveDelegates', - 'numberStandbyDelegates', - 'governanceTokenID', + 'numberActiveValidators', + 'numberStandbyValidators', + 'posTokenID', 'tokenIDFee', - 'delegateRegistrationFee', + 'validatorRegistrationFee', 'maxBFTWeightCap', ], }; export const genesisStoreSchema = { - $id: '/dpos/module/genesis', + $id: '/pos/module/genesis', type: 'object', - required: ['validators', 'voters', 'genesisData'], + required: ['validators', 'stakers', 'genesisData'], properties: { validators: { type: 'array', @@ -325,26 +325,26 @@ export const genesisStoreSchema = { }, }, }, - voters: { + stakers: { type: 'array', fieldNumber: 2, items: { type: 'object', - required: ['address', 'sentVotes', 'pendingUnlocks'], + required: ['address', 'sentStakes', 'pendingUnlocks'], properties: { address: { dataType: 'bytes', format: 'lisk32', fieldNumber: 1, }, - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 2, items: { type: 'object', - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', format: 'lisk32', fieldNumber: 1, @@ -353,7 +353,7 @@ export const genesisStoreSchema = { dataType: 'uint64', fieldNumber: 2, }, - voteSharingCoefficients: { + stakeSharingCoefficients: { type: 'array', fieldNumber: 3, items: { @@ -382,9 +382,9 @@ export const genesisStoreSchema = { fieldNumber: 3, items: { type: 'object', - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', @@ -393,7 +393,7 @@ export const genesisStoreSchema = { dataType: 'uint64', fieldNumber: 2, }, - unvoteHeight: { + unstakeHeight: { dataType: 'uint32', fieldNumber: 3, }, @@ -406,13 +406,13 @@ export const genesisStoreSchema = { genesisData: { type: 'object', fieldNumber: 3, - required: ['initRounds', 'initDelegates'], + required: ['initRounds', 'initValidators'], properties: { initRounds: { dataType: 'uint32', fieldNumber: 1, }, - initDelegates: { + initValidators: { type: 'array', fieldNumber: 2, items: { dataType: 'bytes', format: 'lisk32' }, @@ -422,13 +422,13 @@ export const genesisStoreSchema = { }, }; -const delegateJSONSchema = { +const validatorJSONSchema = { type: 'object', required: [ 'address', 'name', - 'totalVotesReceived', - 'selfVotes', + 'totalStakeReceived', + 'selfStake', 'lastGeneratedHeight', 'isBanned', 'pomHeights', @@ -442,11 +442,11 @@ const delegateJSONSchema = { name: { type: 'string', }, - totalVotesReceived: { + totalStakeReceived: { type: 'string', format: 'uint64', }, - selfVotes: { + selfStake: { type: 'string', format: 'uint64', }, @@ -468,8 +468,8 @@ const delegateJSONSchema = { }, }; -export const getDelegateRequestSchema = { - $id: 'modules/dpos/endpoint/getDelegateRequest', +export const getValidatorRequestSchema = { + $id: 'modules/pos/endpoint/getValidatorRequest', type: 'object', required: ['address'], properties: { @@ -480,26 +480,26 @@ export const getDelegateRequestSchema = { }, }; -export const getDelegateResponseSchema = { - $id: 'modules/dpos/endpoint/getDelegateResponse', - ...delegateJSONSchema, +export const getValidatorResponseSchema = { + $id: 'modules/pos/endpoint/getValidatorResponse', + ...validatorJSONSchema, }; -export const getVoterRequestSchema = getDelegateRequestSchema; +export const getStakerRequestSchema = getValidatorRequestSchema; -export const getVoterResponseSchema = { - $id: 'modules/dpos/endpoint/getVoterResponse', +export const getStakerResponseSchema = { + $id: 'modules/pos/endpoint/getStakerResponse', type: 'object', - required: ['sentVotes', 'pendingUnlocks'], + required: ['sentStakes', 'pendingUnlocks'], properties: { - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 1, items: { type: 'object', - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], properties: { - delegateAddress: { + validatorAddress: { type: 'string', format: 'lisk32', }, @@ -515,9 +515,9 @@ export const getVoterResponseSchema = { fieldNumber: 2, items: { type: 'object', - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], properties: { - delegateAddress: { + validatorAddress: { type: 'string', format: 'lisk32', }, @@ -525,7 +525,7 @@ export const getVoterResponseSchema = { type: 'string', format: 'uint64', }, - unvoteHeight: { + unstakeHeight: { type: 'integer', format: 'uint32', }, @@ -535,20 +535,20 @@ export const getVoterResponseSchema = { }, }; -export const getAllDelegatesResponseSchema = { - $id: 'modules/dpos/endpoint/getAllDelegatesResponse', +export const getAllValidatorsResponseSchema = { + $id: 'modules/pos/endpoint/getAllValidatorsResponse', type: 'object', - required: ['delegates'], + required: ['validators'], properties: { - delegates: { + validators: { type: 'array', - items: delegateJSONSchema, + items: validatorJSONSchema, }, }, }; -export const getGovernanceTokenIDResponseSchema = { - $id: 'modules/dpos/endpoint/getGovernanceTokenIDResponse', +export const getPoSTokenIDResponseSchema = { + $id: 'modules/pos/endpoint/getPoSTokenIDResponse', type: 'object', required: ['tokenID'], properties: { @@ -560,7 +560,7 @@ export const getGovernanceTokenIDResponseSchema = { }; export const getValidatorsByStakeRequestSchema = { - $id: 'modules/dpos/endpoint/getValidatorsByStakeRequest', + $id: 'modules/pos/endpoint/getValidatorsByStakeRequest', type: 'object', properties: { limit: { @@ -571,19 +571,19 @@ export const getValidatorsByStakeRequestSchema = { }; export const getValidatorsByStakeResponseSchema = { - $id: 'modules/dpos/endpoint/getValidatorsByStakeResponse', + $id: 'modules/pos/endpoint/getValidatorsByStakeResponse', type: 'object', required: ['validators'], properties: { validators: { type: 'array', - items: delegateJSONSchema, + items: validatorJSONSchema, }, }, }; export const getLockedRewardsRequestSchema = { - $id: 'modules/dpos/endpoint/getLockedRewardsRequest', + $id: 'modules/pos/endpoint/getLockedRewardsRequest', type: 'object', required: ['address', 'tokenID'], properties: { @@ -599,7 +599,7 @@ export const getLockedRewardsRequestSchema = { }; export const getLockedRewardsResponseSchema = { - $id: 'modules/dpos/endpoint/getLockedRewardsResponse', + $id: 'modules/pos/endpoint/getLockedRewardsResponse', type: 'object', required: ['rewards'], properties: { @@ -611,7 +611,7 @@ export const getLockedRewardsResponseSchema = { }; export const getClaimableRewardsRequestSchema = { - $id: 'modules/dpos/endpoint/getClaimableRewardsRequest', + $id: 'modules/pos/endpoint/getClaimableRewardsRequest', type: 'object', required: ['address'], properties: { @@ -623,7 +623,7 @@ export const getClaimableRewardsRequestSchema = { }; export const getClaimableRewardsResponseSchema = { - $id: 'modules/dpos/endpoint/getClaimableRewardsResponse', + $id: 'modules/pos/endpoint/getClaimableRewardsResponse', type: 'object', properties: { rewards: { @@ -645,8 +645,8 @@ export const getClaimableRewardsResponseSchema = { }, }; -export const getLockedVotedAmountRequestSchema = { - $id: 'modules/dpos/endpoint/getLockedVotedAmountRequest', +export const getLockedStakedAmountRequestSchema = { + $id: 'modules/pos/endpoint/getLockedStakedAmountRequest', type: 'object', required: ['address'], properties: { @@ -657,8 +657,8 @@ export const getLockedVotedAmountRequestSchema = { }, }; -export const getLockedVotedAmountResponseSchema = { - $id: 'modules/dpos/endpoint/getLockedVotedAmountResponse', +export const getLockedStakedAmountResponseSchema = { + $id: 'modules/pos/endpoint/getLockedStakedAmountResponse', type: 'object', required: ['amount'], properties: { @@ -670,7 +670,7 @@ export const getLockedVotedAmountResponseSchema = { }; export const getPendingUnlocksRequestSchema = { - $id: 'modules/dpos/endpoint/getPendingUnlocksRequest', + $id: 'modules/pos/endpoint/getPendingUnlocksRequest', type: 'object', required: ['address'], properties: { @@ -682,7 +682,7 @@ export const getPendingUnlocksRequestSchema = { }; export const getPendingUnlocksResponseSchema = { - $id: 'modules/dpos/endpoint/getPendingUnlocksResponse', + $id: 'modules/pos/endpoint/getPendingUnlocksResponse', type: 'object', required: ['amount'], properties: { @@ -691,14 +691,14 @@ export const getPendingUnlocksResponseSchema = { items: { type: 'object', required: [ - 'delegateAddress', + 'validatorAddress', 'amount', - 'unvoteHeight', + 'unstakeHeight', 'expectedUnlockableHeight', 'unlockable', ], properties: { - delegateAddress: { + validatorAddress: { type: 'string', format: 'lisk32', }, @@ -706,7 +706,7 @@ export const getPendingUnlocksResponseSchema = { type: 'string', format: 'uint64', }, - unvoteHeight: { + unstakeHeight: { type: 'integer', format: 'uint32', }, diff --git a/framework/src/modules/dpos_v2/stores/eligible_delegates.ts b/framework/src/modules/pos/stores/eligible_validators.ts similarity index 72% rename from framework/src/modules/dpos_v2/stores/eligible_delegates.ts rename to framework/src/modules/pos/stores/eligible_validators.ts index 52a18a06235..83267c62cd5 100644 --- a/framework/src/modules/dpos_v2/stores/eligible_delegates.ts +++ b/framework/src/modules/pos/stores/eligible_validators.ts @@ -14,15 +14,15 @@ import { BaseStore, ImmutableStoreGetter, StoreGetter } from '../../base_store'; import { ModuleConfig } from '../types'; -import { getDelegateWeight } from '../utils'; -import { DelegateAccount } from './delegate'; +import { getValidatorWeight } from '../utils'; +import { ValidatorAccount } from './validator'; -export interface EligibleDelegate { +export interface EligibleValidator { lastPomHeight: number; } -export const eligibleDelegatesStoreSchema = { - $id: '/dpos/eligibleDelegates', +export const eligibleValidatorsStoreSchema = { + $id: '/pos/eligibleValidators', type: 'object', required: ['lastPomHeight'], properties: { @@ -36,8 +36,8 @@ export const eligibleDelegatesStoreSchema = { // uint64 + address const KEY_LENGTH = 8 + 20; -export class EligibleDelegatesStore extends BaseStore { - public schema = eligibleDelegatesStoreSchema; +export class EligibleValidatorsStore extends BaseStore { + public schema = eligibleValidatorsStoreSchema; private _config!: ModuleConfig; @@ -45,9 +45,9 @@ export class EligibleDelegatesStore extends BaseStore { this._config = config; } - public getKey(address: Buffer, delegateWeight: bigint): Buffer { + public getKey(address: Buffer, validatorWeight: bigint): Buffer { const buffer = Buffer.alloc(8); - buffer.writeBigUInt64BE(delegateWeight); + buffer.writeBigUInt64BE(validatorWeight); return Buffer.concat([buffer, address]); } @@ -78,27 +78,27 @@ export class EligibleDelegatesStore extends BaseStore { context: StoreGetter, address: Buffer, oldWeight: bigint, - delegate: DelegateAccount, + validator: ValidatorAccount, ): Promise { const oldKey = this.getKey(address, oldWeight); await this.del(context, oldKey); - if (delegate.isBanned) { + if (validator.isBanned) { return; } - const newWeight = getDelegateWeight( - BigInt(this._config.factorSelfVotes), - delegate.selfVotes, - delegate.totalVotesReceived, + const newWeight = getValidatorWeight( + BigInt(this._config.factorSelfStakes), + validator.selfStake, + validator.totalStakeReceived, ); if (newWeight < this._config.minWeightStandby) { return; } - const lastPomHeight = delegate.pomHeights.length - ? delegate.pomHeights[delegate.pomHeights.length - 1] + const lastPomHeight = validator.pomHeights.length + ? validator.pomHeights[validator.pomHeights.length - 1] : 0; await this.set(context, this.getKey(address, newWeight), { lastPomHeight }); diff --git a/framework/src/modules/dpos_v2/stores/genesis.ts b/framework/src/modules/pos/stores/genesis.ts similarity index 88% rename from framework/src/modules/dpos_v2/stores/genesis.ts rename to framework/src/modules/pos/stores/genesis.ts index e009813592b..1fd5ac6b6b0 100644 --- a/framework/src/modules/dpos_v2/stores/genesis.ts +++ b/framework/src/modules/pos/stores/genesis.ts @@ -16,13 +16,13 @@ import { BaseStore } from '../../base_store'; export interface GenesisData { height: number; initRounds: number; - initDelegates: Buffer[]; + initValidators: Buffer[]; } export const genesisDataStoreSchema = { - $id: '/dpos/store/genesis', + $id: '/pos/store/genesis', type: 'object', - required: ['height', 'initRounds', 'initDelegates'], + required: ['height', 'initRounds', 'initValidators'], properties: { height: { dataType: 'uint32', @@ -32,7 +32,7 @@ export const genesisDataStoreSchema = { dataType: 'uint32', fieldNumber: 2, }, - initDelegates: { + initValidators: { type: 'array', fieldNumber: 3, items: { diff --git a/framework/src/modules/dpos_v2/stores/name.ts b/framework/src/modules/pos/stores/name.ts similarity index 88% rename from framework/src/modules/dpos_v2/stores/name.ts rename to framework/src/modules/pos/stores/name.ts index 5d84504939b..1e615e8d4ba 100644 --- a/framework/src/modules/dpos_v2/stores/name.ts +++ b/framework/src/modules/pos/stores/name.ts @@ -14,15 +14,15 @@ import { BaseStore } from '../../base_store'; export interface NameStoreData { - delegateAddress: Buffer; + validatorAddress: Buffer; } export const nameStoreSchema = { - $id: '/dpos/name', + $id: '/pos/name', type: 'object', - required: ['delegateAddress'], + required: ['validatorAddress'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', diff --git a/framework/src/modules/dpos_v2/stores/previous_timestamp.ts b/framework/src/modules/pos/stores/previous_timestamp.ts similarity index 95% rename from framework/src/modules/dpos_v2/stores/previous_timestamp.ts rename to framework/src/modules/pos/stores/previous_timestamp.ts index 2ecb1e67d67..fe42ba48b28 100644 --- a/framework/src/modules/dpos_v2/stores/previous_timestamp.ts +++ b/framework/src/modules/pos/stores/previous_timestamp.ts @@ -18,7 +18,7 @@ export interface PreviousTimestampData { } export const previousTimestampStoreSchema = { - $id: '/dpos/store/previousTimestamp', + $id: '/pos/store/previousTimestamp', type: 'object', required: ['timestamp'], properties: { diff --git a/framework/src/modules/dpos_v2/stores/snapshot.ts b/framework/src/modules/pos/stores/snapshot.ts similarity index 89% rename from framework/src/modules/dpos_v2/stores/snapshot.ts rename to framework/src/modules/pos/stores/snapshot.ts index 9bcf0c327ca..ec0162c8072 100644 --- a/framework/src/modules/dpos_v2/stores/snapshot.ts +++ b/framework/src/modules/pos/stores/snapshot.ts @@ -14,18 +14,18 @@ import { BaseStore } from '../../base_store'; export interface SnapshotStoreData { - delegateWeightSnapshot: { + validatorWeightSnapshot: { address: Buffer; weight: bigint; }[]; } export const snapshotStoreSchema = { - $id: '/dpos/store/snapshot', + $id: '/pos/store/snapshot', type: 'object', - required: ['delegateWeightSnapshot'], + required: ['validatorWeightSnapshot'], properties: { - delegateWeightSnapshot: { + validatorWeightSnapshot: { type: 'array', fieldNumber: 1, items: { diff --git a/framework/src/modules/dpos_v2/stores/voter.ts b/framework/src/modules/pos/stores/staker.ts similarity index 75% rename from framework/src/modules/dpos_v2/stores/voter.ts rename to framework/src/modules/pos/stores/staker.ts index 839bffee8fc..d0b1d2906d5 100644 --- a/framework/src/modules/dpos_v2/stores/voter.ts +++ b/framework/src/modules/pos/stores/staker.ts @@ -14,21 +14,21 @@ import { NotFoundError } from '@liskhq/lisk-db'; import { BaseStore, ImmutableStoreGetter } from '../../base_store'; import { MAX_NUMBER_BYTES_Q96, TOKEN_ID_LENGTH } from '../constants'; -import { VoterData } from '../types'; +import { StakerData } from '../types'; -export const voterStoreSchema = { - $id: '/dpos/voter', +export const stakerStoreSchema = { + $id: '/pos/staker', type: 'object', - required: ['sentVotes', 'pendingUnlocks'], + required: ['sentStakes', 'pendingUnlocks'], properties: { - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 1, items: { type: 'object', - required: ['delegateAddress', 'amount', 'voteSharingCoefficients'], + required: ['validatorAddress', 'amount', 'stakeSharingCoefficients'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', @@ -37,7 +37,7 @@ export const voterStoreSchema = { dataType: 'uint64', fieldNumber: 2, }, - voteSharingCoefficients: { + stakeSharingCoefficients: { type: 'array', fieldNumber: 3, items: { @@ -66,9 +66,9 @@ export const voterStoreSchema = { fieldNumber: 2, items: { type: 'object', - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], properties: { - delegateAddress: { + validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', @@ -77,7 +77,7 @@ export const voterStoreSchema = { dataType: 'uint64', fieldNumber: 2, }, - unvoteHeight: { + unstakeHeight: { dataType: 'uint32', fieldNumber: 3, }, @@ -87,23 +87,23 @@ export const voterStoreSchema = { }, }; -export class VoterStore extends BaseStore { - public schema = voterStoreSchema; +export class StakerStore extends BaseStore { + public schema = stakerStoreSchema; public async getOrDefault(context: ImmutableStoreGetter, address: Buffer) { try { - const voterData = await this.get(context, address); - return voterData; + const stakerData = await this.get(context, address); + return stakerData; } catch (error) { if (!(error instanceof NotFoundError)) { throw error; } - const voterData = { - sentVotes: [], + const stakerData = { + sentStakes: [], pendingUnlocks: [], }; - return voterData; + return stakerData; } } } diff --git a/framework/src/modules/dpos_v2/stores/delegate.ts b/framework/src/modules/pos/stores/validator.ts similarity index 80% rename from framework/src/modules/dpos_v2/stores/delegate.ts rename to framework/src/modules/pos/stores/validator.ts index c577d2ccf11..821286e504b 100644 --- a/framework/src/modules/dpos_v2/stores/delegate.ts +++ b/framework/src/modules/pos/stores/validator.ts @@ -14,30 +14,30 @@ import { JSONObject } from '../../../types'; import { BaseStore } from '../../base_store'; import { MAX_NUMBER_BYTES_Q96, TOKEN_ID_LENGTH } from '../constants'; -import { VoteSharingCoefficient } from '../types'; +import { StakeSharingCoefficient } from '../types'; -export interface DelegateAccount { +export interface ValidatorAccount { name: string; - totalVotesReceived: bigint; - selfVotes: bigint; + totalStakeReceived: bigint; + selfStake: bigint; lastGeneratedHeight: number; isBanned: boolean; pomHeights: number[]; consecutiveMissedBlocks: number; commission: number; lastCommissionIncreaseHeight: number; - sharingCoefficients: VoteSharingCoefficient[]; + sharingCoefficients: StakeSharingCoefficient[]; } -export type DelegateAccountJSON = JSONObject; +export type ValidatorAccountJSON = JSONObject; -export const delegateStoreSchema = { - $id: '/dpos/delegate', +export const validatorStoreSchema = { + $id: '/pos/validator', type: 'object', required: [ 'name', - 'totalVotesReceived', - 'selfVotes', + 'totalStakeReceived', + 'selfStake', 'lastGeneratedHeight', 'isBanned', 'pomHeights', @@ -51,11 +51,11 @@ export const delegateStoreSchema = { dataType: 'string', fieldNumber: 1, }, - totalVotesReceived: { + totalStakeReceived: { dataType: 'uint64', fieldNumber: 2, }, - selfVotes: { + selfStake: { dataType: 'uint64', fieldNumber: 3, }, @@ -108,6 +108,6 @@ export const delegateStoreSchema = { }, }; -export class DelegateStore extends BaseStore { - public schema = delegateStoreSchema; +export class ValidatorStore extends BaseStore { + public schema = validatorStoreSchema; } diff --git a/framework/src/modules/dpos_v2/types.ts b/framework/src/modules/pos/types.ts similarity index 78% rename from framework/src/modules/dpos_v2/types.ts rename to framework/src/modules/pos/types.ts index 0007802ba84..95a7908166a 100644 --- a/framework/src/modules/dpos_v2/types.ts +++ b/framework/src/modules/pos/types.ts @@ -22,20 +22,20 @@ import { JSONObject } from '../../types'; export type TokenID = Buffer; export interface ModuleConfig { - factorSelfVotes: number; + factorSelfStakes: number; maxLengthName: number; - maxNumberSentVotes: number; + maxNumberSentStakes: number; maxNumberPendingUnlocks: number; failSafeMissedBlocks: number; failSafeInactiveWindow: number; punishmentWindow: number; roundLength: number; minWeightStandby: bigint; - numberActiveDelegates: number; - numberStandbyDelegates: number; - governanceTokenID: TokenID; + numberActiveValidators: number; + numberStandbyValidators: number; + posTokenID: TokenID; tokenIDFee: Buffer; - delegateRegistrationFee: bigint; + validatorRegistrationFee: bigint; maxBFTWeightCap: number; commissionIncreasePeriod: number; maxCommissionIncreaseRate: number; @@ -121,45 +121,45 @@ export interface TokenMethod { } export interface UnlockingObject { - readonly delegateAddress: Buffer; + readonly validatorAddress: Buffer; readonly amount: bigint; - readonly unvoteHeight: number; + readonly unstakeHeight: number; } export interface UpdateGeneratorKeyParams { generatorKey: Buffer; } -export interface DelegateRegistrationParams { +export interface ValidatorRegistrationParams { name: string; blsKey: Buffer; proofOfPossession: Buffer; generatorKey: Buffer; - delegateRegistrationFee: bigint; + validatorRegistrationFee: bigint; } -export interface VoteSharingCoefficient { +export interface StakeSharingCoefficient { tokenID: Buffer; coefficient: Buffer; } -export interface DelegateAccount { +export interface ValidatorAccount { name: string; - totalVotesReceived: bigint; - selfVotes: bigint; + totalStakeReceived: bigint; + selfStake: bigint; lastGeneratedHeight: number; isBanned: boolean; pomHeights: number[]; consecutiveMissedBlocks: number; commission: number; lastCommissionIncreaseHeight: number; - sharingCoefficients: VoteSharingCoefficient[]; + sharingCoefficients: StakeSharingCoefficient[]; } -export interface DelegateAccountJSON { +export interface ValidatorAccountJSON { name: string; - totalVotesReceived: string; - selfVotes: string; + totalStakeReceived: string; + selfStake: string; lastGeneratedHeight: number; isBanned: boolean; pomHeights: number[]; @@ -167,41 +167,41 @@ export interface DelegateAccountJSON { address: string; } -export interface VoterDataJSON { - sentVotes: { - delegateAddress: string; +export interface StakerDataJSON { + sentStakes: { + validatorAddress: string; amount: string; }[]; pendingUnlocks: { - delegateAddress: string; + validatorAddress: string; amount: string; - unvoteHeight: number; + unstakeHeight: number; }[]; } -export interface VoteObject { - delegateAddress: Buffer; +export interface StakeObject { + validatorAddress: Buffer; amount: bigint; - voteSharingCoefficients: VoteSharingCoefficient[]; + stakeSharingCoefficients: StakeSharingCoefficient[]; } -export interface VoterData { - sentVotes: VoteObject[]; +export interface StakerData { + sentStakes: StakeObject[]; pendingUnlocks: UnlockingObject[]; } export interface NameStoreData { - delegateAddress: Buffer; + validatorAddress: Buffer; } -export interface VoteTransactionParams { - votes: VoteObject[]; +export interface StakeTransactionParams { + stakes: StakeObject[]; } -export interface BlockHeaderAssetForDPOS { +export interface BlockHeaderAssetForPOS { seedReveal: Buffer; maxHeightPreviouslyForged: number; - maxHeightPrevoted: number; + maxHeightPrestaked: number; } export interface PomTransactionParams { @@ -234,7 +234,7 @@ export interface PreviousTimestampData { export interface GenesisData { height: number; initRounds: number; - initDelegates: Buffer[]; + initValidators: Buffer[]; } export interface GenesisStore { @@ -250,38 +250,38 @@ export interface GenesisStore { consecutiveMissedBlocks: number; commission: number; lastCommissionIncreaseHeight: number; - sharingCoefficients: VoteSharingCoefficient[]; + sharingCoefficients: StakeSharingCoefficient[]; }[]; - voters: { + stakers: { address: Buffer; - sentVotes: { - delegateAddress: Buffer; + sentStakes: { + validatorAddress: Buffer; amount: bigint; - voteSharingCoefficients: VoteSharingCoefficient[]; + stakeSharingCoefficients: StakeSharingCoefficient[]; }[]; pendingUnlocks: { - delegateAddress: Buffer; + validatorAddress: Buffer; amount: bigint; - unvoteHeight: number; + unstakeHeight: number; }[]; }[]; genesisData: { initRounds: number; - initDelegates: Buffer[]; + initValidators: Buffer[]; }; } export interface GetUnlockHeightResponse { pendingUnlocks: { - delegateAddress: string; + validatorAddress: string; amount: string; - unvoteHeight: number; + unstakeHeight: number; expectedUnlockableHeight: number; unlockable: boolean; }[]; } -export interface GetGovernanceTokenIDResponse { +export interface GetPoSTokenIDResponse { tokenID: string; } @@ -290,7 +290,7 @@ export interface GetValidatorsByStakeRequest { } export interface GetValidatorsByStakeResponse { - validators: (DelegateAccountJSON & { address: string })[]; + validators: (ValidatorAccountJSON & { address: string })[]; } export interface GetLockedRewardsRequest { diff --git a/framework/src/modules/dpos_v2/utils.ts b/framework/src/modules/pos/utils.ts similarity index 58% rename from framework/src/modules/dpos_v2/utils.ts rename to framework/src/modules/pos/utils.ts index ad2d46c086d..80efe586939 100644 --- a/framework/src/modules/dpos_v2/utils.ts +++ b/framework/src/modules/pos/utils.ts @@ -14,24 +14,24 @@ import { utils, ed } from '@liskhq/lisk-cryptography'; import { math } from '@liskhq/lisk-utils'; -import { ModuleConfig, ModuleConfigJSON, UnlockingObject, VoteSharingCoefficient } from './types'; +import { ModuleConfig, ModuleConfigJSON, UnlockingObject, StakeSharingCoefficient } from './types'; import { PUNISHMENT_PERIOD, - PUNISHMENT_WINDOW_VOTES, - PUNISHMENT_WINDOW_SELF_VOTES, - LOCKING_PERIOD_SELF_VOTES, - LOCKING_PERIOD_VOTES, + PUNISHMENT_WINDOW_STAKES, + PUNISHMENT_WINDOW_SELF_STAKES, + LOCKING_PERIOD_SELF_STAKES, + LOCKING_PERIOD_STAKES, } from './constants'; const { q96 } = math; export const sortUnlocking = (unlocks: UnlockingObject[]): void => { unlocks.sort((a, b) => { - if (!a.delegateAddress.equals(b.delegateAddress)) { - return a.delegateAddress.compare(b.delegateAddress); + if (!a.validatorAddress.equals(b.validatorAddress)) { + return a.validatorAddress.compare(b.validatorAddress); } - if (a.unvoteHeight !== b.unvoteHeight) { - return b.unvoteHeight - a.unvoteHeight; + if (a.unstakeHeight !== b.unstakeHeight) { + return b.unstakeHeight - a.unstakeHeight; } const diff = b.amount - a.amount; if (diff > BigInt(0)) { @@ -46,9 +46,9 @@ export const sortUnlocking = (unlocks: UnlockingObject[]): void => { }; export const equalUnlocking = (a: UnlockingObject, b: UnlockingObject): boolean => - a.delegateAddress.equals(b.delegateAddress) && + a.validatorAddress.equals(b.validatorAddress) && a.amount === b.amount && - a.unvoteHeight === b.unvoteHeight; + a.unstakeHeight === b.unstakeHeight; export const isNullCharacterIncluded = (input: string): boolean => new RegExp(/\\0|\\u0000|\\x00/).test(input); @@ -78,73 +78,73 @@ export interface ValidatorWeight { weight: bigint; } -export const pickStandByDelegate = ( - delegateWeights: ReadonlyArray, +export const pickStandByValidator = ( + validatorWeights: ReadonlyArray, randomSeed: Buffer, ): number => { const seedNumber = randomSeed.readBigUInt64BE(); - const totalVoteWeight = delegateWeights.reduce( + const totalStakeWeight = validatorWeights.reduce( (prev, current) => prev + BigInt(current.weight), BigInt(0), ); - let threshold = seedNumber % totalVoteWeight; - for (let i = 0; i < delegateWeights.length; i += 1) { - const voteWeight = BigInt(delegateWeights[i].weight); - if (voteWeight > threshold) { + let threshold = seedNumber % totalStakeWeight; + for (let i = 0; i < validatorWeights.length; i += 1) { + const validatorWeight = BigInt(validatorWeights[i].weight); + if (validatorWeight > threshold) { return i; } - threshold -= voteWeight; + threshold -= validatorWeight; } return -1; }; -export const shuffleDelegateList = ( +export const shuffleValidatorList = ( previousRoundSeed1: Buffer, addresses: ValidatorWeight[], ): ValidatorWeight[] => { - const delegateList = [...addresses].map(delegate => ({ - ...delegate, + const validatorList = [...addresses].map(validator => ({ + ...validator, })) as { address: Buffer; roundHash: Buffer; weight: bigint }[]; - for (const delegate of delegateList) { - const seedSource = Buffer.concat([previousRoundSeed1, delegate.address]); - delegate.roundHash = utils.hash(seedSource); + for (const validator of validatorList) { + const seedSource = Buffer.concat([previousRoundSeed1, validator.address]); + validator.roundHash = utils.hash(seedSource); } - delegateList.sort((delegate1, delegate2) => { - const diff = delegate1.roundHash.compare(delegate2.roundHash); + validatorList.sort((validator1, validator2) => { + const diff = validator1.roundHash.compare(validator2.roundHash); if (diff !== 0) { return diff; } - return delegate1.address.compare(delegate2.address); + return validator1.address.compare(validator2.address); }); - return delegateList; + return validatorList; }; -export const selectStandbyDelegates = ( - delegateWeights: ValidatorWeight[], +export const selectStandbyValidators = ( + validatorWeights: ValidatorWeight[], randomSeed1: Buffer, randomSeed2?: Buffer, ): ValidatorWeight[] => { const numberOfCandidates = 1 + (randomSeed2 !== undefined ? 1 : 0); - // if delegate weights is smaller than number selecting, select all - if (delegateWeights.length <= numberOfCandidates) { - return delegateWeights; + // if validator weights is smaller than number selecting, select all + if (validatorWeights.length <= numberOfCandidates) { + return validatorWeights; } const result: ValidatorWeight[] = []; - const index = pickStandByDelegate(delegateWeights, randomSeed1); - const [selected] = delegateWeights.splice(index, 1); + const index = pickStandByValidator(validatorWeights, randomSeed1); + const [selected] = validatorWeights.splice(index, 1); result.push(selected); // if seed2 is missing, return only 1 if (!randomSeed2) { return result; } - const secondIndex = pickStandByDelegate(delegateWeights, randomSeed2); - const [secondStandby] = delegateWeights.splice(secondIndex, 1); + const secondIndex = pickStandByValidator(validatorWeights, randomSeed2); + const [secondStandby] = validatorWeights.splice(secondIndex, 1); result.push(secondStandby); return result; @@ -162,20 +162,20 @@ export const isCurrentlyPunished = (height: number, pomHeights: ReadonlyArray - delegateAddress.equals(senderAddress) ? LOCKING_PERIOD_SELF_VOTES : LOCKING_PERIOD_VOTES; +export const getWaitTime = (senderAddress: Buffer, validatorAddress: Buffer): number => + validatorAddress.equals(senderAddress) ? LOCKING_PERIOD_SELF_STAKES : LOCKING_PERIOD_STAKES; -export const getPunishTime = (senderAddress: Buffer, delegateAddress: Buffer): number => - delegateAddress.equals(senderAddress) ? PUNISHMENT_PERIOD : PUNISHMENT_WINDOW_VOTES; +export const getPunishTime = (senderAddress: Buffer, validatorAddress: Buffer): number => + validatorAddress.equals(senderAddress) ? PUNISHMENT_PERIOD : PUNISHMENT_WINDOW_STAKES; export const hasWaited = ( unlockingObject: UnlockingObject, senderAddress: Buffer, height: number, ) => { - const delayedAvailability = getWaitTime(senderAddress, unlockingObject.delegateAddress); + const delayedAvailability = getWaitTime(senderAddress, unlockingObject.validatorAddress); - return !(height - unlockingObject.unvoteHeight < delayedAvailability); + return !(height - unlockingObject.unstakeHeight < delayedAvailability); }; export const isPunished = ( @@ -189,10 +189,10 @@ export const isPunished = ( } const lastPomHeight = pomHeights[pomHeights.length - 1]; - const waitTime = getWaitTime(senderAddress, unlockingObject.delegateAddress); - const punishTime = getPunishTime(senderAddress, unlockingObject.delegateAddress); + const waitTime = getWaitTime(senderAddress, unlockingObject.validatorAddress); + const punishTime = getPunishTime(senderAddress, unlockingObject.validatorAddress); return ( - height - lastPomHeight < punishTime && lastPomHeight < unlockingObject.unvoteHeight + waitTime + height - lastPomHeight < punishTime && lastPomHeight < unlockingObject.unstakeHeight + waitTime ); }; @@ -209,14 +209,14 @@ export const isCertificateGenerated = (options: { roundLength: number; }): boolean => lastHeightOfRound( - options.unlockObject.unvoteHeight + 2 * options.roundLength, + options.unlockObject.unstakeHeight + 2 * options.roundLength, options.genesisHeight, options.roundLength, ) <= options.maxHeightCertified; export const getMinPunishedHeight = ( senderAddress: Buffer, - delegateAddress: Buffer, + validatorAddress: Buffer, pomHeights: number[], ): number => { if (pomHeights.length === 0) { @@ -226,18 +226,18 @@ export const getMinPunishedHeight = ( const lastPomHeight = Math.max(...pomHeights); // https://github.com/LiskHQ/lips/blob/master/proposals/lip-0024.md#update-to-validity-of-unlock-transaction - return senderAddress.equals(delegateAddress) - ? lastPomHeight + PUNISHMENT_WINDOW_SELF_VOTES - : lastPomHeight + PUNISHMENT_WINDOW_VOTES; + return senderAddress.equals(validatorAddress) + ? lastPomHeight + PUNISHMENT_WINDOW_SELF_STAKES + : lastPomHeight + PUNISHMENT_WINDOW_STAKES; }; export const getPunishmentPeriod = ( senderAddress: Buffer, - delegateAddress: Buffer, + validatorAddress: Buffer, pomHeights: number[], currentHeight: number, ): number => { - const minPunishedHeight = getMinPunishedHeight(senderAddress, delegateAddress, pomHeights); + const minPunishedHeight = getMinPunishedHeight(senderAddress, validatorAddress, pomHeights); const remainingBlocks = minPunishedHeight - currentHeight; return remainingBlocks < 0 ? 0 : remainingBlocks; @@ -249,26 +249,26 @@ export function getModuleConfig(config: ModuleConfigJSON): ModuleConfig { return { ...config, minWeightStandby: BigInt(config.minWeightStandby), - governanceTokenID: Buffer.from(config.governanceTokenID, 'hex'), + posTokenID: Buffer.from(config.posTokenID, 'hex'), tokenIDFee: Buffer.from(config.tokenIDFee, 'hex'), - delegateRegistrationFee: BigInt(config.delegateRegistrationFee), + validatorRegistrationFee: BigInt(config.validatorRegistrationFee), }; } -export const getDelegateWeight = ( - factorSelfVotes: bigint, - selfVotes: bigint, - totalVotesReceived: bigint, +export const getValidatorWeight = ( + factorSelfStakes: bigint, + selfStake: bigint, + totalStakeReceived: bigint, ) => { - const cap = selfVotes * factorSelfVotes; - if (cap < totalVotesReceived) { + const cap = selfStake * factorSelfStakes; + if (cap < totalStakeReceived) { return cap; } - return totalVotesReceived; + return totalStakeReceived; }; export const isSharingCoefficientSorted = ( - sharingCoefficients: VoteSharingCoefficient[], + sharingCoefficients: StakeSharingCoefficient[], ): boolean => { const sharingCoefficientsCopy = [...sharingCoefficients]; sharingCoefficientsCopy.sort((a, b) => a.tokenID.compare(b.tokenID)); @@ -280,14 +280,14 @@ export const isSharingCoefficientSorted = ( return true; }; -export const calculateVoteRewards = ( - voteSharingCoefficient: VoteSharingCoefficient, +export const calculateStakeRewards = ( + stakeSharingCoefficient: StakeSharingCoefficient, amount: bigint, - delegateSharingCoefficient: VoteSharingCoefficient, + validatorSharingCoefficient: StakeSharingCoefficient, ): bigint => { const qAmount = q96(amount); - const qVoteSharingCoefficient = q96(voteSharingCoefficient.coefficient); - const qDelegateSharingCoefficient = q96(delegateSharingCoefficient.coefficient); - const reward = qDelegateSharingCoefficient.sub(qVoteSharingCoefficient).mul(qAmount); + const qStakeSharingCoefficient = q96(stakeSharingCoefficient.coefficient); + const qValidatorSharingCoefficient = q96(validatorSharingCoefficient.coefficient); + const reward = qValidatorSharingCoefficient.sub(qStakeSharingCoefficient).mul(qAmount); return reward.floor(); }; diff --git a/framework/src/testing/block_processing_env.ts b/framework/src/testing/block_processing_env.ts index 8d5dcf2b3e9..133a154d059 100644 --- a/framework/src/testing/block_processing_env.ts +++ b/framework/src/testing/block_processing_env.ts @@ -45,7 +45,7 @@ import { AuthModule } from '../modules/auth'; import { FeeModule } from '../modules/fee'; import { RewardModule } from '../modules/reward'; import { RandomModule } from '../modules/random'; -import { DPoSModule } from '../modules/dpos_v2'; +import { PoSModule } from '../modules/pos'; import { Generator } from '../engine/generator'; import { ABIHandler } from '../abi_handler/abi_handler'; import { generateGenesisBlock } from '../genesis_block'; @@ -62,7 +62,7 @@ type Options = { interface BlockProcessingParams { modules?: BaseModule[]; options?: Options; - initDelegates?: Buffer[]; + initValidators?: Buffer[]; logLevel?: string; } @@ -176,7 +176,7 @@ export const getBlockProcessingEnv = async ( const feeModule = new FeeModule(); const rewardModule = new RewardModule(); const randomModule = new RandomModule(); - const dposModule = new DPoSModule(); + const posModule = new PoSModule(); const modules = [ validatorsModule, authModule, @@ -184,7 +184,7 @@ export const getBlockProcessingEnv = async ( feeModule, rewardModule, randomModule, - dposModule, + posModule, ]; const stateMachine = new StateMachine(); const logger = createLogger({ name: 'blockProcessingEnv', logLevel: params.logLevel ?? 'none' }); @@ -192,7 +192,7 @@ export const getBlockProcessingEnv = async ( // resolve dependencies feeModule.addDependencies(tokenModule.method); rewardModule.addDependencies(tokenModule.method, randomModule.method); - dposModule.addDependencies(randomModule.method, validatorsModule.method, tokenModule.method); + posModule.addDependencies(randomModule.method, validatorsModule.method, tokenModule.method); // register modules stateMachine.registerModule(authModule); @@ -201,7 +201,7 @@ export const getBlockProcessingEnv = async ( stateMachine.registerModule(feeModule); stateMachine.registerModule(rewardModule); stateMachine.registerModule(randomModule); - stateMachine.registerModule(dposModule); + stateMachine.registerModule(posModule); const blockAssets = blockAssetsJSON.map(asset => ({ ...asset, data: codec.fromJSON>(asset.schema, asset.data), diff --git a/framework/src/testing/fixtures/config.ts b/framework/src/testing/fixtures/config.ts index 014e4091d9a..6a0dba4d6b7 100644 --- a/framework/src/testing/fixtures/config.ts +++ b/framework/src/testing/fixtures/config.ts @@ -70,7 +70,7 @@ export const getKeysFromDefaultConfig = (address: Buffer) => { ); if (!account) { throw new Error( - `Delegate with address: ${cryptoAddress.getLisk32AddressFromAddress( + `Validator with address: ${cryptoAddress.getLisk32AddressFromAddress( address, )} does not exists in default config`, ); diff --git a/framework/src/testing/fixtures/genesis-asset.ts b/framework/src/testing/fixtures/genesis-asset.ts index 6830d36b80d..4118caaf3e2 100644 --- a/framework/src/testing/fixtures/genesis-asset.ts +++ b/framework/src/testing/fixtures/genesis-asset.ts @@ -14,7 +14,7 @@ */ import { address } from '@liskhq/lisk-cryptography'; -import { genesisStoreSchema } from '../../modules/dpos_v2/schemas'; +import { genesisStoreSchema } from '../../modules/pos/schemas'; import { genesisTokenStoreSchema } from '../../modules/token'; import * as accounts from './keys_fixture.json'; @@ -46,7 +46,7 @@ export const blockAssetsJSON = [ schema: genesisTokenStoreSchema, }, { - module: 'dpos', + module: 'pos', data: { validators: accounts.keys.map((account, i) => ({ address: account.address, @@ -62,10 +62,10 @@ export const blockAssetsJSON = [ lastCommissionIncreaseHeight: 0, sharingCoefficients: [], })), - voters: [], + stakers: [], genesisData: { initRounds: 3, - initDelegates: accounts.keys.slice(0, 101).map(account => account.address), + initValidators: accounts.keys.slice(0, 101).map(account => account.address), }, }, schema: genesisStoreSchema, diff --git a/framework/src/types.ts b/framework/src/types.ts index dddb42446b3..d713c8d4857 100644 --- a/framework/src/types.ts +++ b/framework/src/types.ts @@ -31,7 +31,7 @@ export interface PluginOptions extends Record { readonly loadAsChildProcess?: boolean; } -export interface DelegateConfig { +export interface ValidatorConfig { readonly address: string; readonly encryptedPassphrase: string; readonly hashOnion: { diff --git a/framework/test/fixtures/config/devnet/delegates_for_first_round.json b/framework/test/fixtures/config/devnet/validators_for_first_round.json similarity index 100% rename from framework/test/fixtures/config/devnet/delegates_for_first_round.json rename to framework/test/fixtures/config/devnet/validators_for_first_round.json diff --git a/framework/test/fixtures/genesis_delegates.json b/framework/test/fixtures/genesis_validators.json similarity index 99% rename from framework/test/fixtures/genesis_delegates.json rename to framework/test/fixtures/genesis_validators.json index 8f68ca3c186..65c69b9706f 100644 --- a/framework/test/fixtures/genesis_delegates.json +++ b/framework/test/fixtures/genesis_validators.json @@ -7,7 +7,7 @@ "secondPublicKey": null } ], - "delegates": [ + "validators": [ { "passphrase": "endless focus guilt bronze hold economy bulk parent soon tower cement venue", "privateKey": "a30c9e2b10599702b985d18fee55721b56691877cd2c70bbdc1911818dabc9b9508a965871253595b36e2f8dc27bff6e67b39bdd466531be9c6f8c401253979c", diff --git a/framework/test/fixtures/dpos_forger_selection b/framework/test/fixtures/pos_forger_selection similarity index 100% rename from framework/test/fixtures/dpos_forger_selection rename to framework/test/fixtures/pos_forger_selection diff --git a/framework/test/fixtures/dpos_random_seed_generation b/framework/test/fixtures/pos_random_seed_generation similarity index 100% rename from framework/test/fixtures/dpos_random_seed_generation rename to framework/test/fixtures/pos_random_seed_generation diff --git a/framework/test/fixtures/dpos_delegate_shuffling b/framework/test/fixtures/pos_validator_shuffling similarity index 100% rename from framework/test/fixtures/dpos_delegate_shuffling rename to framework/test/fixtures/pos_validator_shuffling diff --git a/framework/test/functional/actions/__snapshots__/application.spec.ts.snap b/framework/test/functional/actions/__snapshots__/application.spec.ts.snap index 2b2e460e1b9..42b794460a2 100644 --- a/framework/test/functional/actions/__snapshots__/application.spec.ts.snap +++ b/framework/test/functional/actions/__snapshots__/application.spec.ts.snap @@ -9,10 +9,10 @@ Object { "dataType": "bytes", "fieldNumber": 1, }, - "dpos": Object { + "pos": Object { "fieldNumber": 5, "properties": Object { - "delegate": Object { + "validator": Object { "fieldNumber": 1, "properties": Object { "consecutiveMissedBlocks": Object { @@ -34,7 +34,7 @@ Object { }, "type": "array", }, - "totalVotesReceived": Object { + "totalStakeReceived": Object { "dataType": "uint64", "fieldNumber": 6, }, @@ -49,11 +49,11 @@ Object { "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived", + "totalStakeReceived", ], "type": "object", }, - "sentVotes": Object { + "sentStakes": Object { "fieldNumber": 2, "items": Object { "properties": Object { @@ -61,13 +61,13 @@ Object { "dataType": "uint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", ], "type": "object", @@ -82,19 +82,19 @@ Object { "dataType": "uint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, }, - "unvoteHeight": Object { + "unstakeHeight": Object { "dataType": "uint32", "fieldNumber": 3, }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", - "unvoteHeight", + "unstakeHeight", ], "type": "object", }, @@ -153,7 +153,7 @@ Object { "token", "sequence", "keys", - "dpos", + "pos", ], "type": "object", }, @@ -243,10 +243,10 @@ Object { "dataType": "bytes", "fieldNumber": 1, }, - "dpos": Object { + "pos": Object { "fieldNumber": 5, "properties": Object { - "delegate": Object { + "validator": Object { "fieldNumber": 1, "properties": Object { "consecutiveMissedBlocks": Object { @@ -268,7 +268,7 @@ Object { }, "type": "array", }, - "totalVotesReceived": Object { + "totalStakeReceived": Object { "dataType": "uint64", "fieldNumber": 6, }, @@ -283,11 +283,11 @@ Object { "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived", + "totalStakeReceived", ], "type": "object", }, - "sentVotes": Object { + "sentStakes": Object { "fieldNumber": 2, "items": Object { "properties": Object { @@ -295,13 +295,13 @@ Object { "dataType": "uint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", ], "type": "object", @@ -316,19 +316,19 @@ Object { "dataType": "uint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, }, - "unvoteHeight": Object { + "unstakeHeight": Object { "dataType": "uint32", "fieldNumber": 3, }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", - "unvoteHeight", + "unstakeHeight", ], "type": "object", }, @@ -387,13 +387,13 @@ Object { "token", "sequence", "keys", - "dpos", + "pos", ], "type": "object", }, "type": "array", }, - "initDelegates": Object { + "initValidators": Object { "fieldNumber": 2, "items": Object { "dataType": "bytes", @@ -409,7 +409,7 @@ Object { }, "required": Array [ "accounts", - "initDelegates", + "initValidators", "initRounds", ], "type": "object", @@ -566,11 +566,11 @@ Object { }, Object { "assetID": 0, - "assetName": "registerDelegate", + "assetName": "registerValidator", "moduleID": 5, - "moduleName": "dpos", + "moduleName": "pos", "schema": Object { - "$id": "lisk/dpos/register", + "$id": "lisk/pos/register", "properties": Object { "username": Object { "dataType": "string", @@ -587,13 +587,13 @@ Object { }, Object { "assetID": 1, - "assetName": "voteDelegate", + "assetName": "stake", "moduleID": 5, - "moduleName": "dpos", + "moduleName": "pos", "schema": Object { - "$id": "lisk/dpos/vote", + "$id": "lisk/pos/stake", "properties": Object { - "votes": Object { + "stakes": Object { "fieldNumber": 1, "items": Object { "properties": Object { @@ -601,7 +601,7 @@ Object { "dataType": "sint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, "maxLength": 20, @@ -609,7 +609,7 @@ Object { }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", ], "type": "object", @@ -620,7 +620,7 @@ Object { }, }, "required": Array [ - "votes", + "stakes", ], "type": "object", }, @@ -629,9 +629,9 @@ Object { "assetID": 2, "assetName": "unlockToken", "moduleID": 5, - "moduleName": "dpos", + "moduleName": "pos", "schema": Object { - "$id": "lisk/dpos/unlock", + "$id": "lisk/pos/unlock", "properties": Object { "unlockObjects": Object { "fieldNumber": 1, @@ -641,21 +641,21 @@ Object { "dataType": "uint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, "maxLength": 20, "minLength": 20, }, - "unvoteHeight": Object { + "unstakeHeight": Object { "dataType": "uint32", "fieldNumber": 3, }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", - "unvoteHeight", + "unstakeHeight", ], "type": "object", }, @@ -672,11 +672,11 @@ Object { }, Object { "assetID": 3, - "assetName": "reportDelegateMisbehavior", + "assetName": "reportValidatorMisbehavior", "moduleID": 5, - "moduleName": "dpos", + "moduleName": "pos", "schema": Object { - "$id": "lisk/dpos/pom", + "$id": "lisk/pos/pom", "properties": Object { "header1": Object { "$id": "block-header1", diff --git a/framework/test/functional/actions/delegates.spec.ts b/framework/test/functional/actions/delegates.spec.ts index fed33dcec34..9ce5138fcdd 100644 --- a/framework/test/functional/actions/delegates.spec.ts +++ b/framework/test/functional/actions/delegates.spec.ts @@ -16,11 +16,11 @@ // import { createApplication, closeApplication, waitNBlocks } from '../utils/application'; // import { Application } from '../../../src'; -// describe('Delegate related actions', () => { +// describe('Validator related actions', () => { // let app: Application; // beforeAll(async () => { -// app = await createApplication('actions-delegate'); +// app = await createApplication('actions-validator'); // await waitNBlocks(app, 1); // }); @@ -28,16 +28,16 @@ // await closeApplication(app); // }); -// describe('getAllDelegates', () => { -// it('should return list of delegates', async () => { -// const delegates = await app['_channel'].invoke<{ [key: string]: string }[]>( -// 'dpos:getAllDelegates', +// describe('getAllValidators', () => { +// it('should return list of validators', async () => { +// const validators = await app['_channel'].invoke<{ [key: string]: string }[]>( +// 'pos:getAllValidators', // ); -// expect(delegates).toBeArray(); -// expect(delegates).toHaveLength(103); -// delegates.map(delegate => { -// expect(delegate.username).toBeString(); -// return expect(delegate.address).toBeString(); +// expect(validators).toBeArray(); +// expect(validators).toHaveLength(103); +// validators.map(validator => { +// expect(validator.username).toBeString(); +// return expect(validator.address).toBeString(); // }); // }); // }); diff --git a/framework/test/functional/rpc-api/ipc/ipc_client_in_memory.spec.ts b/framework/test/functional/rpc-api/ipc/ipc_client_in_memory.spec.ts index 018aa0520c6..fbbfc216fb1 100644 --- a/framework/test/functional/rpc-api/ipc/ipc_client_in_memory.spec.ts +++ b/framework/test/functional/rpc-api/ipc/ipc_client_in_memory.spec.ts @@ -113,7 +113,7 @@ describe('method client ipc mode', () => { const actions = await await client.invoke('app_getRegisteredActions'); expect(actions).toBeArray(); expect(actions).toContain('app_getConnectedPeers'); - expect(actions).toContain('dpos_getAllDelegates'); + expect(actions).toContain('pos_getAllValidators'); expect(actions).toContain('hello_callGreet'); }); }); @@ -138,17 +138,17 @@ describe('method client ipc mode', () => { }); describe('module actions', () => { - it('should return all the delegates', async () => { + it('should return all the validators', async () => { // Act - const delegates = await client.invoke('dpos_getAllDelegates'); + const validators = await client.invoke('pos_getAllValidators'); // Assert - expect(delegates).toHaveLength(103); + expect(validators).toHaveLength(103); }); it('should throw an error on invalid action', async () => { // Assert - await expect(client.invoke('token_getAllDelegates')).rejects.toThrow( - "Action 'token_getAllDelegates' is not registered to bus", + await expect(client.invoke('token_getAllValidators')).rejects.toThrow( + "Action 'token_getAllValidators' is not registered to bus", ); }); }); diff --git a/framework/test/functional/rpc-api/ws/ws_client.spec.ts b/framework/test/functional/rpc-api/ws/ws_client.spec.ts index ddda4419a35..7ae2ca2144e 100644 --- a/framework/test/functional/rpc-api/ws/ws_client.spec.ts +++ b/framework/test/functional/rpc-api/ws/ws_client.spec.ts @@ -109,17 +109,17 @@ describe('method client ws mode', () => { }); describe('module actions', () => { - it('should return all the delegates', async () => { + it('should return all the validators', async () => { // Act - const delegates = await client.invoke('dpos:getAllDelegates'); + const validators = await client.invoke('pos:getAllValidators'); // Assert - expect(delegates).toHaveLength(103); + expect(validators).toHaveLength(103); }); it('should throw an error on invalid action', async () => { // Assert - await expect(client.invoke('token:getAllDelegates')).rejects.toThrow( - "Action 'token:getAllDelegates' is not registered to bus", + await expect(client.invoke('token:getAllValidators')).rejects.toThrow( + "Action 'token:getAllValidators' is not registered to bus", ); }); }); diff --git a/framework/test/integration/node/__snapshots__/genesis_block.spec.ts.snap b/framework/test/integration/node/__snapshots__/genesis_block.spec.ts.snap index 6f388cac806..dd72cf1af08 100644 --- a/framework/test/integration/node/__snapshots__/genesis_block.spec.ts.snap +++ b/framework/test/integration/node/__snapshots__/genesis_block.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`genesis block given the application has not been initialized when chain module is bootstrapped should have correct delegate list 1`] = ` +exports[`genesis block given the application has not been initialized when chain module is bootstrapped should have correct validator list 1`] = ` Array [ "lskzbfnydosaoobnohtwxaf6ukw6uux7kjw4n9x9z", "lskz3efmer9ue4m79zdfysmkc2juywap4sq3x4x8v", diff --git a/framework/test/integration/node/genesis_block.spec.ts b/framework/test/integration/node/genesis_block.spec.ts index f0dad3d69fc..ec3b58f8400 100644 --- a/framework/test/integration/node/genesis_block.spec.ts +++ b/framework/test/integration/node/genesis_block.spec.ts @@ -59,7 +59,7 @@ describe('genesis block', () => { tokenAsset as Buffer, ); - // Get delegate accounts in genesis block from the database + // Get validator accounts in genesis block from the database expect.assertions(decoded.userSubstore.length); for (const data of decoded.userSubstore) { const balance = await processEnv.invoke<{ availableBalance: string }>( @@ -73,7 +73,7 @@ describe('genesis block', () => { } }); - it('should have correct delegate list', async () => { + it('should have correct validator list', async () => { const validators = await processEnv.invoke<{ list: { address: string; nextAllocatedTime: number }[]; }>('chain_getGeneratorList', {}); diff --git a/framework/test/integration/node/processor/block_process/process_block.spec.ts b/framework/test/integration/node/processor/block_process/process_block.spec.ts index 44a17de95fa..7ce215ff9b1 100644 --- a/framework/test/integration/node/processor/block_process/process_block.spec.ts +++ b/framework/test/integration/node/processor/block_process/process_block.spec.ts @@ -18,8 +18,8 @@ import { address } from '@liskhq/lisk-cryptography'; import { nodeUtils } from '../../../../utils'; import * as testing from '../../../../../src/testing'; import { - createDelegateRegisterTransaction, - createDelegateVoteTransaction, + createValidatorRegisterTransaction, + createValidatorStakeTransaction, createTransferTransaction, defaultTokenID, } from '../../../../utils/mocks/transaction'; @@ -154,7 +154,7 @@ describe('Process block', () => { }); }); - describe('given a block generated by invalid delegate', () => { + describe('given a block generated by invalid validator', () => { describe('when processing the block', () => { let newBlock: Block; @@ -208,7 +208,7 @@ describe('Process block', () => { }); }); - describe('given an account is already a delegate', () => { + describe('given an account is already a validator', () => { let newBlock: Block; let transaction: Transaction; @@ -216,7 +216,7 @@ describe('Process block', () => { const targetAuthData = await processEnv.invoke<{ nonce: string }>('auth_getAuthAccount', { address: address.getLisk32AddressFromAddress(account.address), }); - transaction = createDelegateRegisterTransaction({ + transaction = createValidatorRegisterTransaction({ nonce: BigInt(targetAuthData.nonce), fee: BigInt('3000000000'), username: 'number1', @@ -230,8 +230,8 @@ describe('Process block', () => { await processEnv.process(newBlock); }); - describe('when processing a block with a transaction which has votes for the delegate', () => { - it('should update the sender balance and the vote of the sender', async () => { + describe('when processing a block with a transaction which has stakes for the validator', () => { + it('should update the sender balance and the stake of the sender', async () => { // Arrange const senderAuthData = await processEnv.invoke<{ nonce: string }>('auth_getAuthAccount', { address: address.getLisk32AddressFromAddress(account.address), @@ -244,13 +244,13 @@ describe('Process block', () => { }, ); const voteAmount = BigInt('1000000000'); - const voteTransaction = createDelegateVoteTransaction({ + const voteTransaction = createValidatorStakeTransaction({ nonce: BigInt(senderAuthData.nonce), chainID, privateKey: account.privateKey, - votes: [ + stakes: [ { - delegateAddress: account.address, + validatorAddress: account.address, amount: voteAmount, }, ], @@ -265,18 +265,18 @@ describe('Process block', () => { address: address.getLisk32AddressFromAddress(account.address), tokenID: defaultTokenID(processEnv.getNetworkId()).toString('hex'), }); - const votes = await processEnv.invoke<{ sentVotes: Record[] }>( - 'dpos_getVoter', + const stakes = await processEnv.invoke<{ sentStakes: Record[] }>( + 'pos_getStaker', { address: address.getLisk32AddressFromAddress(account.address) }, ); - expect(votes.sentVotes).toHaveLength(1); + expect(stakes.sentStakes).toHaveLength(1); expect(balance.availableBalance).toEqual( (BigInt(senderBalance.availableBalance) - voteAmount - voteTransaction.fee).toString(), ); }); }); - describe('when processing a block with a transaction which has delegate registration from the same account', () => { + describe('when processing a block with a transaction which has validator registration from the same account', () => { let invalidBlock: Block; let invalidTx: Transaction; @@ -284,7 +284,7 @@ describe('Process block', () => { const senderAuthData = await processEnv.invoke<{ nonce: string }>('auth_getAuthAccount', { address: address.getLisk32AddressFromAddress(account.address), }); - invalidTx = createDelegateRegisterTransaction({ + invalidTx = createValidatorRegisterTransaction({ nonce: BigInt(senderAuthData.nonce), fee: BigInt('5000000000'), username: 'number1', @@ -311,10 +311,10 @@ describe('Process block', () => { }); it('should have the same account state as before', async () => { - const delegate = await processEnv.invoke<{ name: string }>('dpos_getDelegate', { + const validator = await processEnv.invoke<{ name: string }>('pos_getValidator', { address: address.getLisk32AddressFromAddress(account.address), }); - expect(delegate.name).toEqual('number1'); + expect(validator.name).toEqual('number1'); }); it('should not save the block to the database', async () => { diff --git a/framework/test/integration/node/processor/delete_block.spec.ts b/framework/test/integration/node/processor/delete_block.spec.ts index 476d5df4f95..355e325fe6b 100644 --- a/framework/test/integration/node/processor/delete_block.spec.ts +++ b/framework/test/integration/node/processor/delete_block.spec.ts @@ -25,8 +25,8 @@ import { codec } from '@liskhq/lisk-codec'; import { address, utils } from '@liskhq/lisk-cryptography'; import { nodeUtils } from '../../../utils'; import { - createDelegateRegisterTransaction, - createDelegateVoteTransaction, + createValidatorRegisterTransaction, + createValidatorStakeTransaction, createTransferTransaction, defaultTokenID, } from '../../../utils/mocks/transaction'; @@ -209,7 +209,7 @@ describe('Delete block', () => { chainID, privateKey: Buffer.from(genesis.privateKey, 'hex'), }); - const transaction2 = createDelegateRegisterTransaction({ + const transaction2 = createValidatorRegisterTransaction({ nonce: BigInt(0), username: 'rand', chainID, @@ -218,13 +218,13 @@ describe('Delete block', () => { generatorKey: recipientAccount.publicKey, privateKey: recipientAccount.privateKey, }); - const transaction3 = createDelegateVoteTransaction({ + const transaction3 = createValidatorStakeTransaction({ nonce: BigInt(1), chainID, privateKey: recipientAccount.privateKey, - votes: [ + stakes: [ { - delegateAddress: recipientAccount.address, + validatorAddress: recipientAccount.address, amount: BigInt('100000000000'), }, ], @@ -245,7 +245,7 @@ describe('Delete block', () => { const newBlock = await processEnv.createBlock([]); await processEnv.process(newBlock); - // TODO: #7666 after vote command changes the eligible delegate, it should enable + // TODO: #7666 after stake command changes the eligible validator, it should enable // const validatorsAfter = await processEnv // .getConsensus() // ['_bft'].method.getBFTParameters( diff --git a/framework/test/integration/node/processor/report_misbehavior_transaction.spec.ts b/framework/test/integration/node/processor/report_misbehavior_transaction.spec.ts index 13ad098a709..726b4edb5cc 100644 --- a/framework/test/integration/node/processor/report_misbehavior_transaction.spec.ts +++ b/framework/test/integration/node/processor/report_misbehavior_transaction.spec.ts @@ -61,7 +61,7 @@ describe('Transaction order', () => { processEnv.cleanup({ databasePath }); }); - describe('when report misbehavior transaction is submitted against the delegate', () => { + describe('when report misbehavior transaction is submitted against the validator', () => { it('should accept the block with transaction', async () => { // get last block const { header } = processEnv.getLastBlock(); @@ -90,13 +90,13 @@ describe('Transaction order', () => { const nextBlock = await processEnv.createBlock([tx]); await processEnv.process(nextBlock); - const updatedDelegate = await processEnv.invoke<{ pomHeights: number[] }>( - 'dpos_getDelegate', + const updatedValidator = await processEnv.invoke<{ pomHeights: number[] }>( + 'pos_getValidator', { address: blockGenerator.address, }, ); - expect(updatedDelegate.pomHeights).toHaveLength(1); + expect(updatedValidator.pomHeights).toHaveLength(1); const balance = await processEnv.invoke<{ availableBalance: string }>('token_getBalance', { address: blockGenerator.address, tokenID: defaultTokenID(processEnv.getNetworkId()).toString('hex'), diff --git a/framework/test/integration/node/processor/transaction_order.spec.ts b/framework/test/integration/node/processor/transaction_order.spec.ts index e155184d706..d34845dc0d0 100644 --- a/framework/test/integration/node/processor/transaction_order.spec.ts +++ b/framework/test/integration/node/processor/transaction_order.spec.ts @@ -16,10 +16,10 @@ import { address } from '@liskhq/lisk-cryptography'; import { nodeUtils } from '../../../utils'; import { createTransferTransaction, - createDelegateRegisterTransaction, + createValidatorRegisterTransaction, createMultiSignRegisterTransaction, createMultisignatureTransferTransaction, - createDelegateVoteTransaction, + createValidatorStakeTransaction, } from '../../../utils/mocks/transaction'; import * as testing from '../../../../src/testing'; @@ -76,7 +76,7 @@ describe('Transaction order', () => { }); }); - describe('when account register as delegate and make self vote', () => { + describe('when account register as validator and make self stake', () => { let newBlock: Block; beforeAll(async () => { @@ -92,29 +92,29 @@ describe('Transaction order', () => { chainID, privateKey: Buffer.from(genesis.privateKey, 'hex'), }); - const registerDelegateTx = createDelegateRegisterTransaction({ + const registerValidatorTx = createValidatorRegisterTransaction({ nonce: BigInt(0), fee: BigInt('1100000000'), - username: 'new_delegate', + username: 'new_validator', chainID, blsKey: newAccount.blsPublicKey, blsProofOfPossession: newAccount.blsPoP, generatorKey: newAccount.publicKey, privateKey: newAccount.privateKey, }); - const selfVoteTx = createDelegateVoteTransaction({ + const selfVoteTx = createValidatorStakeTransaction({ nonce: BigInt('1'), fee: BigInt('100000000'), - votes: [ + stakes: [ { - delegateAddress: newAccount.address, + validatorAddress: newAccount.address, amount: BigInt('1000000000'), }, ], chainID, privateKey: newAccount.privateKey, }); - newBlock = await processEnv.createBlock([fundingTx, registerDelegateTx, selfVoteTx]); + newBlock = await processEnv.createBlock([fundingTx, registerValidatorTx, selfVoteTx]); await processEnv.process(newBlock); }); diff --git a/framework/test/unit/controller/controller.spec.ts b/framework/test/unit/controller/controller.spec.ts index 77174c16acc..efd3eeb2562 100644 --- a/framework/test/unit/controller/controller.spec.ts +++ b/framework/test/unit/controller/controller.spec.ts @@ -124,7 +124,7 @@ describe('Controller Class', () => { name: 'plugin2', }); - controller.registerEndpoint('dpos', {}); + controller.registerEndpoint('pos', {}); controller.registerEndpoint('auth', {}); controller.registerPlugin(inMemoryPlugin, { loadAsChildProcess: false }); controller.registerPlugin(childProcessPlugin, { loadAsChildProcess: true }); diff --git a/framework/test/unit/engine/bft/bft_processing.spec.ts b/framework/test/unit/engine/bft/bft_processing.spec.ts index 9962a8e4c44..0cdcba78325 100644 --- a/framework/test/unit/engine/bft/bft_processing.spec.ts +++ b/framework/test/unit/engine/bft/bft_processing.spec.ts @@ -23,20 +23,20 @@ import { STORE_PREFIX_BFT_VOTES, } from '../../../../src/engine/bft/constants'; import { bftParametersSchema, BFTVotes, bftVotesSchema } from '../../../../src/engine/bft/schemas'; -import * as scenario4DelegatesMissedSlots from './bft_processing/4_delegates_missed_slots.json'; -import * as scenario4DelegatesSimple from './bft_processing/4_delegates_simple.json'; -import * as scenario5DelegatesSwitchedCompletely from './bft_processing/5_delegates_switched_completely.json'; -import * as scenario7DelegatesPartialSwitch from './bft_processing/7_delegates_partial_switch.json'; -import * as scenario11DelegatesPartialSwitch from './bft_processing/11_delegates_partial_switch.json'; +import * as scenario4ValidatorsMissedSlots from './bft_processing/4_validators_missed_slots.json'; +import * as scenario4ValidatorsSimple from './bft_processing/4_validators_simple.json'; +import * as scenario5ValidatorsSwitchedCompletely from './bft_processing/5_validators_switched_completely.json'; +import * as scenario7ValidatorsPartialSwitch from './bft_processing/7_validators_partial_switch.json'; +import * as scenario11ValidatorsPartialSwitch from './bft_processing/11_validators_partial_switch.json'; import { Validator } from '../../../../src/abi'; describe('BFT processing', () => { const bftScenarios = [ - scenario4DelegatesMissedSlots, - scenario4DelegatesSimple, - scenario5DelegatesSwitchedCompletely, - scenario7DelegatesPartialSwitch, - scenario11DelegatesPartialSwitch, + scenario4ValidatorsMissedSlots, + scenario4ValidatorsSimple, + scenario5ValidatorsSwitchedCompletely, + scenario7ValidatorsPartialSwitch, + scenario11ValidatorsPartialSwitch, ]; for (const scenario of bftScenarios) { @@ -48,7 +48,7 @@ describe('BFT processing', () => { beforeAll(async () => { bftModule = new BFTModule(); - await bftModule.init(scenario.config.activeDelegates, 0, 10); + await bftModule.init(scenario.config.activeValidators, 0, 10); db = new InMemoryDatabase(); stateStore = new StateStore(db); @@ -56,7 +56,7 @@ describe('BFT processing', () => { MODULE_STORE_PREFIX_BFT, STORE_PREFIX_BFT_PARAMETERS, ); - const threshold = Math.floor((scenario.config.activeDelegates * 2) / 3) + 1; + const threshold = Math.floor((scenario.config.activeValidators * 2) / 3) + 1; const validators: (Validator & { minHeightActive: number })[] = []; for (const testCase of scenario.testCases) { const generatorAddress = address.getAddressFromPublicKey( @@ -65,7 +65,7 @@ describe('BFT processing', () => { if (validators.find(v => v.address.equals(generatorAddress)) === undefined) { validators.push({ address: generatorAddress, - minHeightActive: testCase.input.blockHeader.delegateMinHeightActive, + minHeightActive: testCase.input.blockHeader.validatorMinHeightActive, bftWeight: BigInt(1), generatorKey: Buffer.from(testCase.input.blockHeader.generatorPublicKey, 'hex'), blsKey: utils.getRandomBytes(42), @@ -102,7 +102,7 @@ describe('BFT processing', () => { }); for (const testCase of scenario.testCases) { - it(`should have accurate information when ${testCase.input.delegateName} forge block at height = ${testCase.input.blockHeader.height}`, async () => { + it(`should have accurate information when ${testCase.input.validatorName} forge block at height = ${testCase.input.blockHeader.height}`, async () => { // Arrange const generatorAddress = address.getAddressFromPublicKey( Buffer.from(testCase.input.blockHeader.generatorPublicKey, 'hex'), @@ -136,7 +136,7 @@ describe('BFT processing', () => { if (v.address.equals(generatorAddress)) { return { ...v, - minActiveHeight: testCase.input.blockHeader.delegateMinHeightActive, + minActiveHeight: testCase.input.blockHeader.validatorMinHeightActive, }; } return v; diff --git a/framework/test/unit/engine/bft/bft_votes.spec.ts b/framework/test/unit/engine/bft/bft_votes.spec.ts index 66001fc6e05..ebf88b7d933 100644 --- a/framework/test/unit/engine/bft/bft_votes.spec.ts +++ b/framework/test/unit/engine/bft/bft_votes.spec.ts @@ -237,7 +237,7 @@ describe('BFT votes', () => { expect(paramsCache.getParameters).not.toHaveBeenCalled(); }); - it('should not vote on blocks if generator is not in the validators', async () => { + it('should not stake on blocks if generator is not in the validators', async () => { jest.spyOn(paramsCache, 'getParameters'); insertBlockBFTInfo( bftVotes, diff --git a/framework/test/unit/engine/bft/module.spec.ts b/framework/test/unit/engine/bft/module.spec.ts index ff1305d10ad..6696d8b3ec8 100644 --- a/framework/test/unit/engine/bft/module.spec.ts +++ b/framework/test/unit/engine/bft/module.spec.ts @@ -39,7 +39,7 @@ describe('bft module', () => { }); describe('initGenesisState', () => { - it('should initialize vote store', async () => { + it('should initialize stake store', async () => { const stateStore = new StateStore(new InMemoryDatabase()); const genesisHeight = 20; diff --git a/framework/test/unit/engine/consensus/synchronizer/block_synchronization_mechanism/block_synchronization_mechanism.spec.ts b/framework/test/unit/engine/consensus/synchronizer/block_synchronization_mechanism/block_synchronization_mechanism.spec.ts index 12ffd2b4a81..bc87835ade0 100644 --- a/framework/test/unit/engine/consensus/synchronizer/block_synchronization_mechanism/block_synchronization_mechanism.spec.ts +++ b/framework/test/unit/engine/consensus/synchronizer/block_synchronization_mechanism/block_synchronization_mechanism.spec.ts @@ -1243,7 +1243,7 @@ describe('block_synchronization_mechanism', () => { }); describe('isValidFor', () => { - it('should return true if the difference in block slots between the current block slot and the finalized block slot of the system is bigger than delegatesPerRound*3', async () => { + it('should return true if the difference in block slots between the current block slot and the finalized block slot of the system is bigger than validatorsPerRound*3', async () => { when(chainModule.dataAccess.getBlockHeaderByHeight) .calledWith(finalizedHeight) .mockResolvedValue(genesisBlock.header as never); @@ -1252,7 +1252,7 @@ describe('block_synchronization_mechanism', () => { expect(isValid).toBeTruthy(); }); - it('should return false if the difference in block slots between the current block slot and the finalized block slot of the system is smaller than delegatesPerRound*3', async () => { + it('should return false if the difference in block slots between the current block slot and the finalized block slot of the system is smaller than validatorsPerRound*3', async () => { when(chainModule.dataAccess.getBlockHeaderByHeight) .calledWith(finalizedHeight) .mockResolvedValue( diff --git a/framework/test/unit/engine/consensus/synchronizer/fast_chain_switching_mechanism/fast_chain_switching_mechanism.spec.ts b/framework/test/unit/engine/consensus/synchronizer/fast_chain_switching_mechanism/fast_chain_switching_mechanism.spec.ts index 965f7ac3160..58cc72a1f6b 100644 --- a/framework/test/unit/engine/consensus/synchronizer/fast_chain_switching_mechanism/fast_chain_switching_mechanism.spec.ts +++ b/framework/test/unit/engine/consensus/synchronizer/fast_chain_switching_mechanism/fast_chain_switching_mechanism.spec.ts @@ -149,7 +149,7 @@ describe('fast_chain_switching_mechanism', () => { blockExecutor.getCurrentValidators.mockResolvedValue([ { address: address.getAddressFromPublicKey(defaultGenerator.publicKey), - voteWeight: BigInt(0), + validatorWeight: BigInt(0), }, ]); const isValid = await fastChainSwitchingMechanism.isValidFor( @@ -419,7 +419,7 @@ describe('fast_chain_switching_mechanism', () => { ); }); - it('should abort the syncing mechanism if the difference in height between the common block and the received block is > delegatesPerRound*2', async () => { + it('should abort the syncing mechanism if the difference in height between the common block and the received block is > validatorsPerRound*2', async () => { // Arrange const storageReturnValue = [ { @@ -450,7 +450,7 @@ describe('fast_chain_switching_mechanism', () => { .mockResolvedValue(highestCommonBlock as never); // Act - // the difference in height between the common block and the received block is > delegatesPerRound*2 + // the difference in height between the common block and the received block is > validatorsPerRound*2 const receivedBlock = await createValidDefaultBlock({ header: { height: highestCommonBlock.height + numberOfValidators * 2 + 1, @@ -470,12 +470,12 @@ describe('fast_chain_switching_mechanism', () => { ); }); - it('should abort the syncing mechanism if the difference in height between the common block and the last block is > delegatesPerRound*2', async () => { + it('should abort the syncing mechanism if the difference in height between the common block and the last block is > validatorsPerRound*2', async () => { // Arrange const highestCommonBlock = createFakeBlockHeader({ height: lastBlock.header.height + 1, }); - // Difference in height between the common block and the last block is > delegatesPerRound*2 + // Difference in height between the common block and the last block is > validatorsPerRound*2 lastBlock = await createValidDefaultBlock({ header: { height: highestCommonBlock.height + numberOfValidators * 2 + 1, diff --git a/framework/test/unit/engine/generator/generator.spec.ts b/framework/test/unit/engine/generator/generator.spec.ts index ed12179cb85..a4b4e270123 100644 --- a/framework/test/unit/engine/generator/generator.spec.ts +++ b/framework/test/unit/engine/generator/generator.spec.ts @@ -190,7 +190,7 @@ describe('generator', () => { } }); - it('should load all 101 delegates', async () => { + it('should load all 101 validators', async () => { await generator.init({ blockchainDB, generatorDB, diff --git a/framework/test/unit/modules/dpos_v2/commands/__snapshots__/pom.spec.ts.snap b/framework/test/unit/modules/dpos_v2/commands/__snapshots__/pom.spec.ts.snap deleted file mode 100644 index 347c16e3313..00000000000 --- a/framework/test/unit/modules/dpos_v2/commands/__snapshots__/pom.spec.ts.snap +++ /dev/null @@ -1,43 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ReportMisbehaviorCommand constructor should have valid schema 1`] = ` -Object { - "$id": "/dpos/command/reportMisbehaviorParams", - "properties": Object { - "header1": Object { - "dataType": "bytes", - "fieldNumber": 1, - }, - "header2": Object { - "dataType": "bytes", - "fieldNumber": 2, - }, - }, - "required": Array [ - "header1", - "header2", - ], - "type": "object", -} -`; - -exports[`ReportMisbehaviorCommand constructor should have valid schema 1`] = ` -Object { - "$id": "/dpos/command/reportMisbehaviorParams", - "properties": Object { - "header1": Object { - "dataType": "bytes", - "fieldNumber": 1, - }, - "header2": Object { - "dataType": "bytes", - "fieldNumber": 2, - }, - }, - "required": Array [ - "header1", - "header2", - ], - "type": "object", -} -`; diff --git a/framework/test/unit/modules/dpos_v2/commands/vote_delegate.spec.ts b/framework/test/unit/modules/dpos_v2/commands/vote_delegate.spec.ts deleted file mode 100644 index 1b02598efd6..00000000000 --- a/framework/test/unit/modules/dpos_v2/commands/vote_delegate.spec.ts +++ /dev/null @@ -1,1871 +0,0 @@ -/* - * Copyright © 2021 Lisk Foundation - * - * See the LICENSE file at the top-level directory of this distribution - * for licensing information. - * - * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, - * no part of this software, including this file, may be copied, modified, - * propagated, or distributed except according to the terms contained in the - * LICENSE file. - * - * Removal or modification of this copyright notice is prohibited. - */ - -import { Transaction } from '@liskhq/lisk-chain'; -import { codec } from '@liskhq/lisk-codec'; -import { address, utils } from '@liskhq/lisk-cryptography'; -import { validator } from '@liskhq/lisk-validator'; -import { VoteDelegateCommand, VerifyStatus, DPoSModule } from '../../../../../src'; -import { - MAX_NUMBER_PENDING_UNLOCKS, - MODULE_NAME_DPOS, - PoSEventResult, -} from '../../../../../src/modules/dpos_v2/constants'; -import { DelegateVotedEvent } from '../../../../../src/modules/dpos_v2/events/delegate_voted'; -import { InternalMethod } from '../../../../../src/modules/dpos_v2/internal_method'; -import { DelegateAccount, DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; -import { EligibleDelegatesStore } from '../../../../../src/modules/dpos_v2/stores/eligible_delegates'; -import { VoterStore } from '../../../../../src/modules/dpos_v2/stores/voter'; -import { VoteObject, VoteTransactionParams } from '../../../../../src/modules/dpos_v2/types'; -import { EventQueue, MethodContext } from '../../../../../src/state_machine'; -import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; - -import { createTransactionContext, InMemoryPrefixedStateDB } from '../../../../../src/testing'; -import { createStoreGetter } from '../../../../../src/testing/utils'; -import { liskToBeddows } from '../../../../utils/assets'; -import { DEFAULT_LOCAL_ID } from '../../../../utils/mocks/transaction'; - -describe('VoteCommand', () => { - const dpos = new DPoSModule(); - const checkEventResult = ( - eventQueue: EventQueue, - length: number, - EventClass: any, - index: number, - expectedResult: any, - result: any, - ) => { - expect(eventQueue.getEvents()).toHaveLength(length); - expect(eventQueue.getEvents()[index].toObject().name).toEqual(new EventClass('token').name); - - const eventData = codec.decode>( - new EventClass('token').schema, - eventQueue.getEvents()[index].toObject().data, - ); - - expect(eventData).toEqual({ ...expectedResult, result }); - }; - - const defaultConfig = { - factorSelfVotes: 10, - maxLengthName: 20, - maxNumberSentVotes: 10, - maxNumberPendingUnlocks: 20, - failSafeMissedBlocks: 50, - failSafeInactiveWindow: 260000, - punishmentWindow: 780000, - roundLength: 103, - minWeightStandby: (BigInt(1000) * BigInt(10 ** 8)).toString(), - numberActiveDelegates: 101, - numberStandbyDelegates: 2, - governanceTokenID: '0000000000000000', - tokenIDFee: '0000000000000000', - delegateRegistrationFee: (BigInt(10) * BigInt(10) ** BigInt(8)).toString(), - maxBFTWeightCap: 500, - }; - const lastBlockHeight = 200; - const governanceTokenID = DEFAULT_LOCAL_ID; - const senderPublicKey = utils.getRandomBytes(32); - const senderAddress = address.getAddressFromPublicKey(senderPublicKey); - const delegateAddress1 = utils.getRandomBytes(20); - const delegateAddress2 = utils.getRandomBytes(20); - const delegateAddress3 = utils.getRandomBytes(20); - const delegate1VoteAmount = liskToBeddows(90); - const delegate2VoteAmount = liskToBeddows(50); - - let delegateInfo1: DelegateAccount; - let delegateInfo2: DelegateAccount; - let delegateInfo3: DelegateAccount; - let voterStore: VoterStore; - let delegateStore: DelegateStore; - let context: any; - let transaction: any; - let command: VoteDelegateCommand; - let transactionParams: Buffer; - let transactionParamsDecoded: any; - let stateStore: PrefixedStateReadWriter; - let lockFn: any; - let tokenMethod: any; - let internalMethod: InternalMethod; - let mockAssignVoteRewards: jest.SpyInstance< - Promise, - [ - methodContext: MethodContext, - voterAddress: Buffer, - sentVote: VoteObject, - delegateData: DelegateAccount, - ] - >; - - beforeEach(async () => { - lockFn = jest.fn(); - tokenMethod = { - lock: lockFn, - unlock: jest.fn(), - getAvailableBalance: jest.fn(), - burn: jest.fn(), - transfer: jest.fn(), - getLockedAmount: jest.fn(), - }; - await dpos.init({ - genesisConfig: {} as any, - moduleConfig: defaultConfig, - generatorConfig: {}, - }); - internalMethod = new InternalMethod(dpos.stores, dpos.events, dpos.name); - internalMethod.addDependencies(tokenMethod); - mockAssignVoteRewards = jest.spyOn(internalMethod, 'assignVoteRewards').mockResolvedValue(); - command = new VoteDelegateCommand(dpos.stores, dpos.events); - command.addDependencies({ - tokenMethod, - internalMethod, - }); - command.init({ - governanceTokenID: DEFAULT_LOCAL_ID, - factorSelfVotes: BigInt(10), - }); - - stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - - delegateInfo1 = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: 'someDelegate1', - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - delegateInfo2 = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: 'someDelegate2', - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - delegateInfo3 = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: 'someDelegate3', - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress2, delegateInfo2); - - voterStore = dpos.stores.get(VoterStore); - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress2, delegateInfo2); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress3, delegateInfo3); - }); - - describe('constructor', () => { - it('should have valid name', () => { - expect(command.name).toEqual('voteDelegate'); - }); - - it('should have valid schema', () => { - expect(command.schema).toMatchSnapshot(); - }); - }); - - describe('verify', () => { - beforeEach(() => { - transaction = new Transaction({ - module: 'dpos', - command: 'vote', - fee: BigInt(1500000), - nonce: BigInt(0), - params: Buffer.alloc(0), - senderPublicKey: utils.getRandomBytes(32), - signatures: [], - }); - }); - - describe('schema validation', () => { - describe('when transaction.params.votes does not include any vote', () => { - beforeEach(() => { - transactionParamsDecoded = { - votes: [], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - }); - - it('should return errors', async () => { - const verificationResult = await command.verify(context); - expect((verificationResult.error as any).value.message).toInclude( - 'must NOT have fewer than 1 items', - ); - }); - }); - - describe('when transaction.params.votes includes more than 20 elements', () => { - beforeEach(() => { - transactionParamsDecoded = { - votes: Array(21) - .fill(0) - .map(() => ({ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(0) })), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - }); - - it('should return errors', async () => { - const verificationResult = await command.verify(context); - expect((verificationResult.error as any).value.message).toInclude( - 'must NOT have more than 20 items', - ); - }); - }); - - describe('when transaction.params.votes includes amount which is less than int64 range', () => { - beforeEach(() => { - transactionParamsDecoded = { - votes: [ - { - delegateAddress: utils.getRandomBytes(20), - amount: BigInt(-1) * BigInt(2) ** BigInt(63) - BigInt(1), - }, - ], - }; - }); - - it('should return errors', () => { - expect(() => validator.validate(command.schema, transactionParamsDecoded)).toThrow( - 'should pass "dataType" keyword validation', - ); - }); - }); - - describe('when transaction.params.votes includes amount which is greater than int64 range', () => { - beforeEach(() => { - transactionParamsDecoded = { - votes: [ - { - delegateAddress: utils.getRandomBytes(20), - amount: BigInt(2) ** BigInt(63) + BigInt(1), - }, - ], - }; - }); - - it('should return errors', () => { - expect(() => validator.validate(command.schema, transactionParamsDecoded)).toThrow( - 'should pass "dataType" keyword validation', - ); - }); - }); - }); - - describe('when transaction.params.votes contains valid contents', () => { - it('should not throw errors with valid upvote case', async () => { - // Arrange - transactionParamsDecoded = { - votes: [{ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(20) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); - }); - - it('should not throw errors with valid downvote cast', async () => { - // Arrange - transactionParamsDecoded = { - votes: [{ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(-20) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); - }); - - it('should not throw errors with valid mixed votes case', async () => { - // Arrange - transactionParamsDecoded = { - votes: [ - { delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(20) }, - { delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(-20) }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); - }); - }); - - describe('when transaction.params.votes contains more than 10 positive votes', () => { - it('should throw error', async () => { - // Arrange - transactionParamsDecoded = { - votes: Array(11) - .fill(0) - .map(() => ({ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(10) })), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Upvote can only be casted up to 10.', - ); - }); - }); - - describe('when transaction.params.votes contains more than 10 negative votes', () => { - it('should throw error', async () => { - // Arrange - transactionParamsDecoded = { - votes: Array(11) - .fill(0) - .map(() => ({ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(-10) })), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Downvote can only be casted up to 10.', - ); - }); - }); - - describe('when transaction.params.votes includes duplicate delegates within positive amount', () => { - it('should throw error', async () => { - // Arrange - const delegateAddress = utils.getRandomBytes(20); - transactionParamsDecoded = { - votes: Array(2) - .fill(0) - .map(() => ({ delegateAddress, amount: liskToBeddows(10) })), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Delegate address must be unique.', - ); - }); - }); - - describe('when transaction.params.votes includes duplicate delegates within positive and negative amount', () => { - it('should throw error', async () => { - // Arrange - const delegateAddress = utils.getRandomBytes(20); - transactionParamsDecoded = { - votes: [ - { delegateAddress, amount: liskToBeddows(10) }, - { delegateAddress, amount: liskToBeddows(-10) }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Delegate address must be unique.', - ); - }); - }); - - describe('when transaction.params.votes includes zero amount', () => { - it('should throw error', async () => { - // Arrange - const delegateAddress = utils.getRandomBytes(20); - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: liskToBeddows(0) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Amount cannot be 0.', - ); - }); - }); - - describe('when transaction.params.votes includes positive amount which is not multiple of 10 * 10^8', () => { - it('should throw an error', async () => { - // Arrange - const delegateAddress = utils.getRandomBytes(20); - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: BigInt(20) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Amount should be multiple of 10 * 10^8.', - ); - }); - }); - - describe('when transaction.params.votes includes negative amount which is not multiple of 10 * 10^8', () => { - it('should throw error', async () => { - // Arrange - const delegateAddress = utils.getRandomBytes(20); - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: BigInt(-20) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - }).createCommandVerifyContext(command.schema); - - // Assert - await expect(command.verify(context)).resolves.toHaveProperty( - 'error.message', - 'Amount should be multiple of 10 * 10^8.', - ); - }); - }); - }); - - describe('execute', () => { - beforeEach(() => { - transaction = new Transaction({ - module: 'dpos', - command: 'vote', - fee: BigInt(1500000), - nonce: BigInt(0), - params: transactionParams, - senderPublicKey, - signatures: [], - }); - }); - describe('when transaction.params.votes contain positive amount', () => { - it('should emit DelegateVotedEvent with VOTE_SUCCESSFUL result', async () => { - // Arrange - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress1, amount: liskToBeddows(10) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).resolves.toBeUndefined(); - - checkEventResult( - context.eventQueue, - 1, - DelegateVotedEvent, - 0, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[0].delegateAddress, - amount: transactionParamsDecoded.votes[0].amount, - }, - PoSEventResult.VOTE_SUCCESSFUL, - ); - }); - - it('should throw error if vote amount is more than balance', async () => { - // Arrange - transactionParamsDecoded = { - votes: [{ delegateAddress: utils.getRandomBytes(20), amount: liskToBeddows(100) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - lockFn.mockRejectedValue(new Error('Not enough balance to lock')); - - // Assert - await expect(command.execute(context)).rejects.toThrow(); - }); - - it('should make account to have correct balance', async () => { - // Arrange - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - // Assert - expect(lockFn).toHaveBeenCalledTimes(2); - expect(lockFn).toHaveBeenCalledWith( - expect.anything(), - senderAddress, - MODULE_NAME_DPOS, - governanceTokenID, - delegate1VoteAmount, - ); - expect(lockFn).toHaveBeenCalledWith( - expect.anything(), - senderAddress, - MODULE_NAME_DPOS, - governanceTokenID, - delegate2VoteAmount, - ); - }); - - it('should not change pendingUnlocks', async () => { - // Arrange - voterStore = dpos.stores.get(VoterStore); - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress1, amount: delegate1VoteAmount }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const { pendingUnlocks } = await voterStore.get( - createStoreGetter(stateStore), - senderAddress, - ); - - // Assert - expect(pendingUnlocks).toHaveLength(0); - }); - - it('should order voterData.sentVotes', async () => { - // Arrange - voterStore = dpos.stores.get(VoterStore); - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress2, delegateInfo2); - - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const { sentVotes } = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - const sentVotesCopy = sentVotes.slice(0); - sentVotesCopy.sort((a: any, b: any) => a.delegateAddress.compare(b.delegateAddress)); - - // Assert - expect(sentVotes).toStrictEqual(sentVotesCopy); - }); - - it('should make upvoted delegate account to have correct totalVotesReceived', async () => { - // Arrange - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress2, delegateInfo2); - - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const { totalVotesReceived: totalVotesReceived1 } = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress1, - ); - const { totalVotesReceived: totalVotesReceived2 } = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress2, - ); - - // Assert - expect(totalVotesReceived1).toBe(delegate1VoteAmount); - expect(totalVotesReceived2).toBe(delegate2VoteAmount); - }); - - it('should update vote object when it exists before and create if it does not exist', async () => { - // Arrange - voterStore = dpos.stores.get(VoterStore); - delegateStore = dpos.stores.get(DelegateStore); - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegateInfo1); - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress1, amount: delegate1VoteAmount }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect( - voterStore.get(createStoreGetter(stateStore), senderAddress), - ).rejects.toThrow(); - - await command.execute(context); - const { sentVotes } = await voterStore.get(createStoreGetter(stateStore), senderAddress); - expect(sentVotes[0]).toEqual({ - delegateAddress: delegateAddress1, - amount: delegate1VoteAmount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }); - }); - }); - - describe('when transaction.params.votes contain negative amount which makes voterStore.sentVotes to be 0 entries', () => { - beforeEach(async () => { - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount * BigInt(-1) }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount * BigInt(-1) }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - lockFn.mockClear(); - }); - - it('should emit DelegateVotedEvent with VOTE_SUCCESSFUL result', async () => { - await expect(command.execute(context)).resolves.toBeUndefined(); - - for (let i = 0; i < 2; i += 2) { - checkEventResult( - context.eventQueue, - 2, - DelegateVotedEvent, - 0, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[i].delegateAddress, - amount: transactionParamsDecoded.votes[i].amount, - }, - PoSEventResult.VOTE_SUCCESSFUL, - ); - } - }); - - it('should not change account balance', async () => { - // Act - await command.execute(context); - - // Assert - expect(lockFn).toHaveBeenCalledTimes(0); - }); - - it('should remove vote which has zero amount', async () => { - // Arrange - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress1, amount: delegate1VoteAmount * BigInt(-1) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const voterData = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - // Assert - expect(voterData.sentVotes).toHaveLength(1); - expect(voterData.sentVotes[0].delegateAddress).not.toEqual(delegateAddress1); - }); - - it('should update vote which has non-zero amount', async () => { - // Arrange - const downVoteAmount = liskToBeddows(10); - - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress1, amount: downVoteAmount * BigInt(-1) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const voterData = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - // Assert - expect( - voterData.sentVotes.find((v: any) => v.delegateAddress.equals(delegateAddress1)), - ).toEqual({ - delegateAddress: delegateAddress1, - amount: delegate1VoteAmount - downVoteAmount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }); - }); - - it('should make account to have correct unlocking', async () => { - // Arrange - await command.execute(context); - - const voterData = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - // Assert - expect(voterData.pendingUnlocks).toHaveLength(2); - expect(voterData.pendingUnlocks).toEqual( - [ - { - delegateAddress: delegateAddress1, - amount: delegate1VoteAmount, - unvoteHeight: lastBlockHeight + 1, - }, - { - delegateAddress: delegateAddress2, - amount: delegate2VoteAmount, - unvoteHeight: lastBlockHeight + 1, - }, - ].sort((a, b) => a.delegateAddress.compare(b.delegateAddress)), - ); - }); - - it('should order voterData.pendingUnlocks', async () => { - // Arrange - await command.execute(context); - - const voterData = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - // Assert - expect(voterData.pendingUnlocks).toHaveLength(2); - expect(voterData.pendingUnlocks.map((d: any) => d.delegateAddress)).toEqual( - [delegateAddress1, delegateAddress2].sort((a, b) => a.compare(b)), - ); - }); - - it('should make downvoted delegate account to have correct totalVotesReceived', async () => { - // Arrange - await command.execute(context); - - const delegateData1 = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress1, - ); - const delegateData2 = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress2, - ); - - // Assert - expect(delegateData1.totalVotesReceived).toEqual(BigInt(0)); - expect(delegateData2.totalVotesReceived).toEqual(BigInt(0)); - }); - - it('should throw error and emit DelegateVotedEvent with VOTE_FAILED_INVALID_UNVOTE_PARAMETERS result when downvoted delegate is not already upvoted', async () => { - // Arrange - const downVoteAmount = liskToBeddows(10); - - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress3, amount: downVoteAmount * BigInt(-1) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow( - 'Cannot cast downvote to delegate who is not upvoted.', - ); - - checkEventResult( - context.eventQueue, - 1, - DelegateVotedEvent, - 0, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[0].delegateAddress, - amount: transactionParamsDecoded.votes[0].amount, - }, - PoSEventResult.VOTE_FAILED_INVALID_UNVOTE_PARAMETERS, - ); - }); - }); - - describe('when transaction.params.votes contain negative and positive amount', () => { - const positiveVoteDelegate1 = liskToBeddows(10); - const negativeVoteDelegate2 = liskToBeddows(-20); - beforeEach(async () => { - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: positiveVoteDelegate1 }, - { delegateAddress: delegateAddress2, amount: negativeVoteDelegate2 }, - ].sort((a, b) => -1 * a.delegateAddress.compare(b.delegateAddress)), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - lockFn.mockClear(); - }); - - it('should assign reward to voter for downvote and upvote for already voted delegate', async () => { - await expect(command.execute(context)).resolves.toBeUndefined(); - - expect(mockAssignVoteRewards).toHaveBeenCalledTimes(2); - }); - - it('should assign sharingCoefficients of the delegate to the corresponding sentVote of the voter for that delegate', async () => { - const sharingCoefficients = [ - { - tokenID: Buffer.alloc(8), - coefficient: Buffer.alloc(24, 0), - }, - { - tokenID: Buffer.alloc(8), - coefficient: Buffer.alloc(24, 1), - }, - ]; - - const delegate1 = await delegateStore.get(createStoreGetter(stateStore), delegateAddress1); - const delegate2 = await delegateStore.get(createStoreGetter(stateStore), delegateAddress2); - - delegate1.sharingCoefficients = sharingCoefficients; - delegate2.sharingCoefficients = sharingCoefficients; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress1, delegate1); - await delegateStore.set(createStoreGetter(stateStore), delegateAddress2, delegate2); - - await expect(command.execute(context)).resolves.toBeUndefined(); - - const { sentVotes } = await voterStore.get(createStoreGetter(stateStore), senderAddress); - - expect( - sentVotes.find(sentVote => sentVote.delegateAddress.equals(delegateAddress1))! - .voteSharingCoefficients, - ).toEqual(sharingCoefficients); - expect( - sentVotes.find(sentVote => sentVote.delegateAddress.equals(delegateAddress2))! - .voteSharingCoefficients, - ).toEqual(sharingCoefficients); - }); - - it('should not assign rewards to voter for first upvote for the delegate', async () => { - transactionParamsDecoded = { - votes: [{ delegateAddress: delegateAddress3, amount: positiveVoteDelegate1 }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await expect(command.execute(context)).resolves.toBeUndefined(); - }); - - it('should update voted delegate in EligibleDelegateStore', async () => { - const delegateAddress = utils.getRandomBytes(20); - const selfVotes = BigInt(2) + BigInt(defaultConfig.minWeightStandby); - - const delegateInfo = { - ...delegateInfo1, - selfVotes, - totalVotesReceived: BigInt(1) + BigInt(100) * BigInt(defaultConfig.minWeightStandby), - }; - const expectedWeight = BigInt(10) * selfVotes; - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: positiveVoteDelegate1 }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - transaction.params = transactionParams; - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const eligibleDelegateStore = dpos.stores.get(EligibleDelegatesStore); - - expect( - await eligibleDelegateStore.get( - context, - eligibleDelegateStore.getKey(delegateAddress, expectedWeight), - ), - ).toBeDefined(); - - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: BigInt(-2) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - transaction.params = transactionParams; - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - expect( - await eligibleDelegateStore.get( - context, - eligibleDelegateStore.getKey(delegateAddress, expectedWeight), - ), - ).toBeDefined(); - }); - - it('should make voter to have correct balance', async () => { - // Arrange - await command.execute(context); - - // Assert - expect(lockFn).toHaveBeenCalledTimes(1); - expect(lockFn).toHaveBeenCalledWith( - expect.anything(), - senderAddress, - MODULE_NAME_DPOS, - governanceTokenID, - positiveVoteDelegate1, - ); - }); - - it('should make voter to have correct unlocking', async () => { - // Arrange - await command.execute(context); - - const voterData = await voterStore.get(createStoreGetter(stateStore), senderAddress); - // Assert - expect(voterData.pendingUnlocks).toHaveLength(1); - expect(voterData.pendingUnlocks).toEqual([ - { - delegateAddress: delegateAddress2, - amount: BigInt(-1) * negativeVoteDelegate2, - unvoteHeight: lastBlockHeight + 1, - }, - ]); - }); - - it('should make upvoted delegate account to have correct totalVotesReceived', async () => { - // Arrange - await command.execute(context); - - const delegateData1 = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress1, - ); - - // Assert - expect(delegateData1.totalVotesReceived).toEqual( - delegate1VoteAmount + positiveVoteDelegate1, - ); - }); - - it('should make downvoted delegate account to have correct totalVotesReceived', async () => { - // Arrange - await command.execute(context); - - const delegateData2 = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress2, - ); - - // Assert - expect(delegateData2.totalVotesReceived).toEqual( - delegate2VoteAmount + negativeVoteDelegate2, - ); - }); - }); - - describe('when transaction.params.votes contain invalid data', () => { - beforeEach(() => { - transactionParamsDecoded = { - votes: [ - { delegateAddress: delegateAddress1, amount: delegate1VoteAmount }, - { delegateAddress: delegateAddress2, amount: delegate2VoteAmount }, - ].sort((a, b) => -1 * a.delegateAddress.compare(b.delegateAddress)), - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - lockFn.mockClear(); - }); - - describe('when transaction.params.votes contain delegate address which is not registered', () => { - it('should throw error and emit DelegateVotedEevnt with VOTE_FAILED_NON_REGISTERED_DELEGATE failure', async () => { - // Arrange - const nonExistingDelegateAddress = utils.getRandomBytes(20); - - transactionParamsDecoded = { - ...transactionParamsDecoded, - votes: [{ delegateAddress: nonExistingDelegateAddress, amount: liskToBeddows(76) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow(); - - checkEventResult( - context.eventQueue, - 1, - DelegateVotedEvent, - 0, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[0].delegateAddress, - amount: transactionParamsDecoded.votes[0].amount, - }, - PoSEventResult.VOTE_FAILED_NON_REGISTERED_DELEGATE, - ); - }); - }); - - describe('when transaction.params.votes positive amount makes voterData.sentVotes entries more than 10', () => { - it('should throw error and emit DelegateVotedEvent with VOTE_FAILED_TOO_MANY_SENT_VOTES failure', async () => { - // Arrange - const votes = []; - - for (let i = 0; i < 12; i += 1) { - const delegateAddress = utils.getRandomBytes(20); - - const delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: `someDelegate${i}`, - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - votes.push({ - delegateAddress, - amount: liskToBeddows(10), - }); - } - - transactionParamsDecoded = { votes }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow('Sender can only vote upto 10.'); - - checkEventResult( - context.eventQueue, - 11, - DelegateVotedEvent, - 10, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[10].delegateAddress, - amount: transactionParamsDecoded.votes[10].amount, - }, - PoSEventResult.VOTE_FAILED_TOO_MANY_SENT_VOTES, - ); - }); - }); - - describe('when transaction.params.votes negative amount decrease voterData.sentVotes entries yet positive amount makes account exceeds more than 10', () => { - it('should throw error and emit DelegateVotedEvent with VOTE_FAILED_TOO_MANY_SENT_VOTES failure', async () => { - // Arrange - const initialDelegateAmount = 8; - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - - // Suppose account already voted for 8 delegates - for (let i = 0; i < initialDelegateAmount; i += 1) { - const delegateAddress = utils.getRandomBytes(20); - - const delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: `someDelegate${i}`, - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - - const vote = { - delegateAddress, - amount: liskToBeddows(20), - voteSharingCoefficients: [ - { tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }, - ], - }; - voterData.sentVotes.push(vote); - } - - await voterStore.set(createStoreGetter(stateStore), senderAddress, voterData); - - // We have 2 negative votes - const votes = [ - { - delegateAddress: voterData.sentVotes[0].delegateAddress, - amount: liskToBeddows(-10), - }, - { - delegateAddress: voterData.sentVotes[1].delegateAddress, - amount: liskToBeddows(-10), - }, - ]; - - // We have 3 positive votes - for (let i = 0; i < 3; i += 1) { - const delegateAddress = utils.getRandomBytes(20); - - const delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: `someDelegate${i + initialDelegateAmount}`, - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - - votes.push({ - delegateAddress, - amount: liskToBeddows(10), - }); - } - - // Account already contains 8 positive votes - // now we added 2 negative votes and 3 new positive votes - // which will make total positive votes to grow over 10 - transactionParamsDecoded = { votes }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow('Sender can only vote upto 10.'); - - checkEventResult( - context.eventQueue, - 5, - DelegateVotedEvent, - 4, - { - senderAddress, - delegateAddress: votes[4].delegateAddress, - amount: votes[4].amount, - }, - PoSEventResult.VOTE_FAILED_TOO_MANY_SENT_VOTES, - ); - }); - }); - - describe('when transaction.params.votes has negative amount and makes voterData.pendingUnlocks more than 20 entries', () => { - it('should throw error and emit DelegateVotedEvent with VOTE_FAILED_TOO_MANY_PENDING_UNLOCKS failure', async () => { - // Arrange - const initialDelegateAmountForUnlocks = 19; - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - - // Suppose account already 19 unlocking - for (let i = 0; i < initialDelegateAmountForUnlocks; i += 1) { - const delegateAddress = utils.getRandomBytes(20); - - const delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: `someDelegate${i}`, - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - - const pendingUnlock = { - delegateAddress, - amount: liskToBeddows(20), - unvoteHeight: i, - }; - voterData.pendingUnlocks.push(pendingUnlock); - } - - // Suppose account have 5 positive votes - for (let i = 0; i < 5; i += 1) { - const delegateAddress = utils.getRandomBytes(20); - - const delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: `someDelegate${i}`, - pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - - const vote = { - delegateAddress, - amount: liskToBeddows(20), - voteSharingCoefficients: [], - }; - voterData.sentVotes.push(vote); - } - - await voterStore.set(createStoreGetter(stateStore), senderAddress, voterData); - - // We have 2 negative votes - const votes = [ - { - delegateAddress: voterData.sentVotes[0].delegateAddress, - amount: liskToBeddows(-10), - }, - { - delegateAddress: voterData.sentVotes[1].delegateAddress, - amount: liskToBeddows(-10), - }, - ]; - - // Account already contains 19 unlocking and 5 positive votes - // now we added 2 negative votes - // which will make total unlocking to grow over 20 - transactionParamsDecoded = { votes }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow( - `Pending unlocks cannot exceed ${MAX_NUMBER_PENDING_UNLOCKS.toString()}.`, - ); - - checkEventResult( - context.eventQueue, - 2, - DelegateVotedEvent, - 1, - { - senderAddress, - delegateAddress: votes[1].delegateAddress, - amount: votes[1].amount, - }, - PoSEventResult.VOTE_FAILED_TOO_MANY_PENDING_UNLOCKS, - ); - - expect(mockAssignVoteRewards).toHaveBeenCalledTimes(votes.length); - }); - }); - - describe('when transaction.params.votes negative amount exceeds the previously voted amount', () => { - it('should throw error and emit DelegateVotedEvent with VOTE_FAILED_INVALID_UNVOTE_PARAMETERS', async () => { - // Arrange - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - voterData.sentVotes.push({ - delegateAddress: delegateAddress1, - amount: liskToBeddows(70), - voteSharingCoefficients: [], - }); - await voterStore.set(createStoreGetter(stateStore), senderAddress, voterData); - - transactionParamsDecoded = { - votes: [ - { - delegateAddress: delegateAddress1, - amount: liskToBeddows(-80), - }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - }).createCommandExecuteContext(command.schema); - - // Assert - await expect(command.execute(context)).rejects.toThrow( - 'The unvote amount exceeds the voted amount for this delegate.', - ); - - checkEventResult( - context.eventQueue, - 1, - DelegateVotedEvent, - 0, - { - senderAddress, - delegateAddress: transactionParamsDecoded.votes[0].delegateAddress, - amount: transactionParamsDecoded.votes[0].amount, - }, - PoSEventResult.VOTE_FAILED_INVALID_UNVOTE_PARAMETERS, - ); - }); - }); - }); - - describe('when transaction.params.votes contains self-vote', () => { - const senderVoteAmountPositive = liskToBeddows(80); - const senderVoteAmountNegative = liskToBeddows(20); - let totalVotesReceived: bigint; - let selfVotes: bigint; - beforeEach(async () => { - totalVotesReceived = BigInt(20); - selfVotes = BigInt(20); - - const delegateInfo = { - ...delegateInfo1, - totalVotesReceived, - selfVotes, - }; - await delegateStore.set(createStoreGetter(stateStore), senderAddress, delegateInfo); - - transactionParamsDecoded = { - votes: [{ delegateAddress: senderAddress, amount: senderVoteAmountPositive }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - lockFn.mockClear(); - }); - - it('should update votes and totalVotesReceived', async () => { - // Act & Assign - await command.execute(context); - - const delegateData = await delegateStore.get(createStoreGetter(stateStore), senderAddress); - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - // Assert - expect(delegateData.totalVotesReceived).toEqual( - totalVotesReceived + senderVoteAmountPositive, - ); - expect(voterData.sentVotes).toHaveLength(1); - expect(lockFn).toHaveBeenCalledWith( - expect.anything(), - senderAddress, - MODULE_NAME_DPOS, - governanceTokenID, - senderVoteAmountPositive, - ); - }); - - it('should change delegateData.selfVotes and totalVotesReceived with positive vote', async () => { - // Act & Assign - await command.execute(context); - - const delegateData = await delegateStore.get(createStoreGetter(stateStore), senderAddress); - // Assert - expect(delegateData.totalVotesReceived).toEqual( - totalVotesReceived + senderVoteAmountPositive, - ); - expect(delegateData.selfVotes).toEqual(selfVotes + senderVoteAmountPositive); - }); - - it('should change delegateData.selfVotes, totalVotesReceived and unlocking with negative vote', async () => { - // Act & Assign - await command.execute(context); - - transactionParamsDecoded = { - votes: [ - { delegateAddress: senderAddress, amount: senderVoteAmountNegative * BigInt(-1) }, - ], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const delegateData = await delegateStore.get(createStoreGetter(stateStore), senderAddress); - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - - // Assert - expect(delegateData.totalVotesReceived).toEqual( - totalVotesReceived + senderVoteAmountPositive - senderVoteAmountNegative, - ); - expect(delegateData.selfVotes).toEqual( - totalVotesReceived + senderVoteAmountPositive - senderVoteAmountNegative, - ); - expect(voterData.sentVotes).toHaveLength(1); - expect(voterData.sentVotes).toEqual([ - { - delegateAddress: senderAddress, - amount: senderVoteAmountPositive - senderVoteAmountNegative, - voteSharingCoefficients: [ - { - tokenID: Buffer.alloc(8), - coefficient: Buffer.alloc(24), - }, - ], - }, - ]); - expect(voterData.pendingUnlocks).toHaveLength(1); - expect(voterData.pendingUnlocks).toEqual([ - { - delegateAddress: senderAddress, - amount: senderVoteAmountNegative, - unvoteHeight: lastBlockHeight + 1, - }, - ]); - }); - }); - - describe('when transaction.params.votes does not contain self-vote', () => { - const senderVoteAmountPositive = liskToBeddows(80); - const senderVoteAmountNegative = liskToBeddows(20); - const delegateSelfVote = liskToBeddows(2000); - const delegateAddress = utils.getRandomBytes(20); - let delegateInfo; - beforeEach(async () => { - delegateInfo = { - consecutiveMissedBlocks: 0, - isBanned: false, - lastGeneratedHeight: 5, - name: 'delegate', - pomHeights: [], - selfVotes: delegateSelfVote, - totalVotesReceived: delegateSelfVote, - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }; - - await delegateStore.set(createStoreGetter(stateStore), delegateAddress, delegateInfo); - - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: senderVoteAmountPositive }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - lockFn.mockClear(); - }); - - it('should not change delegateData.selfVotes but should update totalVotesReceived with positive vote', async () => { - // Act & Assign - await command.execute(context); - - const delegateData = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress, - ); - // Assert - expect(delegateData.totalVotesReceived).toEqual( - senderVoteAmountPositive + delegateSelfVote, - ); - expect(delegateData.selfVotes).toEqual(delegateSelfVote); - }); - - it('should not change delegateData.selfVotes but should change totalVotesReceived and unlocking with negative vote', async () => { - // Act & Assign - await command.execute(context); - - transactionParamsDecoded = { - votes: [{ delegateAddress, amount: senderVoteAmountNegative * BigInt(-1) }], - }; - - transactionParams = codec.encode(command.schema, transactionParamsDecoded); - - transaction.params = transactionParams; - - context = createTransactionContext({ - transaction, - stateStore, - header: { - height: lastBlockHeight, - } as any, - }).createCommandExecuteContext(command.schema); - - await command.execute(context); - - const delegateData = await delegateStore.get( - createStoreGetter(stateStore), - delegateAddress, - ); - const voterData = await voterStore.getOrDefault( - createStoreGetter(stateStore), - senderAddress, - ); - - // Assert - expect(delegateData.totalVotesReceived).toEqual( - senderVoteAmountPositive - senderVoteAmountNegative + delegateSelfVote, - ); - expect(delegateData.selfVotes).toEqual(delegateSelfVote); - expect(voterData.sentVotes).toHaveLength(1); - expect(voterData.sentVotes).toEqual([ - { - delegateAddress, - amount: senderVoteAmountPositive - senderVoteAmountNegative, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], - }, - ]); - expect(voterData.pendingUnlocks).toHaveLength(1); - expect(voterData.pendingUnlocks).toEqual([ - { - delegateAddress, - amount: senderVoteAmountNegative, - unvoteHeight: lastBlockHeight + 1, - }, - ]); - }); - }); - }); -}); diff --git a/framework/test/unit/modules/dpos_v2/endpoint.spec.ts b/framework/test/unit/modules/dpos_v2/endpoint.spec.ts deleted file mode 100644 index 58a7170fee6..00000000000 --- a/framework/test/unit/modules/dpos_v2/endpoint.spec.ts +++ /dev/null @@ -1,675 +0,0 @@ -/* - * Copyright © 2021 Lisk Foundation - * - * See the LICENSE file at the top-level directory of this distribution - * for licensing information. - * - * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, - * no part of this software, including this file, may be copied, modified, - * propagated, or distributed except according to the terms contained in the - * LICENSE file. - * - * Removal or modification of this copyright notice is prohibited. - */ - -import { address as cryptoAddress, utils } from '@liskhq/lisk-cryptography'; -import { codec } from '@liskhq/lisk-codec'; -import { math } from '@liskhq/lisk-utils'; -import { - defaultConfig, - EMPTY_KEY, - PUNISHMENT_WINDOW_VOTES, - LOCKING_PERIOD_SELF_VOTES, - LOCKING_PERIOD_VOTES, -} from '../../../../src/modules/dpos_v2/constants'; -import { DPoSEndpoint } from '../../../../src/modules/dpos_v2/endpoint'; -import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; -import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; -import { - ModuleConfig, - VoterData, - VoteSharingCoefficient, -} from '../../../../src/modules/dpos_v2/types'; -import { DPoSModule } from '../../../../src'; -import { VoterStore, voterStoreSchema } from '../../../../src/modules/dpos_v2/stores/voter'; -import { DelegateStore } from '../../../../src/modules/dpos_v2/stores/delegate'; -import { createStoreGetter } from '../../../../src/testing/utils'; -import { - createFakeBlockHeader, - createTransientModuleEndpointContext, -} from '../../../../src/testing'; -import { GenesisDataStore } from '../../../../src/modules/dpos_v2/stores/genesis'; -import { EligibleDelegatesStore } from '../../../../src/modules/dpos_v2/stores/eligible_delegates'; -import { calculateVoteRewards } from '../../../../src/modules/dpos_v2/utils'; - -const { q96 } = math; - -describe('DposModuleEndpoint', () => { - const dpos = new DPoSModule(); - - let dposEndpoint: DPoSEndpoint; - let stateStore: PrefixedStateReadWriter; - let voterSubStore: VoterStore; - let delegateSubStore: DelegateStore; - let genesisSubStore: GenesisDataStore; - let eligibleDelegatesSubStore: EligibleDelegatesStore; - - const address = utils.getRandomBytes(20); - const address1 = utils.getRandomBytes(20); - const address2 = utils.getRandomBytes(20); - - const addressVoter = utils.getRandomBytes(20); - const voterData: VoterData = { - sentVotes: [ - { - delegateAddress: utils.getRandomBytes(20), - amount: BigInt(0), - voteSharingCoefficients: [], - }, - ], - pendingUnlocks: [ - { - delegateAddress: utils.getRandomBytes(20), - amount: BigInt(0), - unvoteHeight: 0, - }, - ], - }; - - const token1 = Buffer.from('1000000000000010', 'hex'); - const token2 = Buffer.from('1000000000000020', 'hex'); - const voterCoefficient1 = q96(2).toBuffer(); - const voterCoefficient2 = q96(5).toBuffer(); - const delegateCoefficient1 = q96(3).toBuffer(); - const delegateCoefficient2 = q96(6).toBuffer(); - - const voterSharingCoefficient1: VoteSharingCoefficient = { - tokenID: token1, - coefficient: voterCoefficient1, - }; - const voterSharingCoefficient2: VoteSharingCoefficient = { - tokenID: token2, - coefficient: voterCoefficient2, - }; - const delegateSharingCoefficient1: VoteSharingCoefficient = { - tokenID: token1, - coefficient: delegateCoefficient1, - }; - const delegateSharingCoefficient2: VoteSharingCoefficient = { - tokenID: token2, - coefficient: delegateCoefficient2, - }; - - const delegateData = { - name: 'delegate1', - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), - lastGeneratedHeight: 0, - isBanned: false, - pomHeights: [0], - consecutiveMissedBlocks: 0, - address: cryptoAddress.getLisk32AddressFromAddress(address), - commission: 0, - lastCommissionIncreaseHeight: 0, - sharingCoefficients: [delegateSharingCoefficient1, delegateSharingCoefficient2], - }; - - const config: ModuleConfig = { - ...defaultConfig, - minWeightStandby: BigInt(defaultConfig.minWeightStandby), - governanceTokenID: Buffer.from('1000000000000002', 'hex'), - tokenIDFee: Buffer.from(defaultConfig.tokenIDFee, 'hex'), - delegateRegistrationFee: BigInt(defaultConfig.delegateRegistrationFee), - }; - - beforeEach(() => { - dposEndpoint = new DPoSEndpoint(dpos.stores, dpos.offchainStores); - dposEndpoint.init('dpos', config, { - getAvailableBalance: jest.fn(), - getLockedAmount: jest.fn(), - burn: jest.fn(), - lock: jest.fn(), - transfer: jest.fn(), - unlock: jest.fn(), - }); - stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - voterSubStore = dpos.stores.get(VoterStore); - delegateSubStore = dpos.stores.get(DelegateStore); - genesisSubStore = dpos.stores.get(GenesisDataStore); - eligibleDelegatesSubStore = dpos.stores.get(EligibleDelegatesStore); - }); - - describe('getVoter', () => { - describe('when input address is valid', () => { - it('should return correct voter data corresponding to the input address', async () => { - await voterSubStore.set(createStoreGetter(stateStore), address, voterData); - const voterDataReturned = await dposEndpoint.getVoter( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ); - - expect(voterDataReturned).toStrictEqual(codec.toJSON(voterStoreSchema, voterData)); - }); - - it('should return valid JSON output', async () => { - await voterSubStore.set(createStoreGetter(stateStore), address, voterData); - const voterDataReturned = await dposEndpoint.getVoter( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ); - - expect(voterDataReturned.sentVotes[0].delegateAddress).toBeString(); - expect(voterDataReturned.sentVotes[0].amount).toBeString(); - expect(voterDataReturned.pendingUnlocks[0].delegateAddress).toBeString(); - expect(voterDataReturned.pendingUnlocks[0].amount).toBeString(); - }); - }); - }); - - describe('getDelegate', () => { - describe('when input address is valid', () => { - it('should return correct delegate data corresponding to the input address', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address, delegateData); - const delegateDataReturned = await dposEndpoint.getDelegate( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ); - - const delegateDataJSON = { - ...delegateData, - totalVotesReceived: delegateData.totalVotesReceived.toString(), - selfVotes: delegateData.selfVotes.toString(), - address: cryptoAddress.getLisk32AddressFromAddress(address), - sharingCoefficients: [ - { - tokenID: token1.toString('hex'), - coefficient: delegateCoefficient1.toString('hex'), - }, - { - tokenID: token2.toString('hex'), - coefficient: delegateCoefficient2.toString('hex'), - }, - ], - }; - - expect(delegateDataReturned).toStrictEqual(delegateDataJSON); - }); - - it('should return valid JSON output', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address, delegateData); - const delegateDataReturned = await dposEndpoint.getDelegate( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ); - - expect(delegateDataReturned.totalVotesReceived).toBeString(); - expect(delegateDataReturned.selfVotes).toBeString(); - }); - }); - }); - - describe('getAllDelegates', () => { - describe('when input address is valid', () => { - const address1Str = cryptoAddress.getLisk32AddressFromAddress(address1); - const address2Str = cryptoAddress.getLisk32AddressFromAddress(address2); - - const addresses = [address1Str, address2Str]; - - const delegateData1 = Object.assign(delegateData, { address: address1Str }); - const delegateData2 = Object.assign(delegateData, { address: address2Str }); - - // CAUTION! - // getAllDelegates() returns data in random order - it('should return correct data for all delegates', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address1, delegateData1); - await delegateSubStore.set(createStoreGetter(stateStore), address2, delegateData2); - const { delegates: delegatesDataReturned } = await dposEndpoint.getAllDelegates( - createTransientModuleEndpointContext({ stateStore }), - ); - - expect(addresses).toContain(delegatesDataReturned[0].address); - expect(addresses).toContain(delegatesDataReturned[1].address); - }); - - it('should return valid JSON output', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address, delegateData1); - await delegateSubStore.set(createStoreGetter(stateStore), address1, delegateData2); - const { delegates: delegatesDataReturned } = await dposEndpoint.getAllDelegates( - createTransientModuleEndpointContext({ stateStore }), - ); - - expect(delegatesDataReturned[0].totalVotesReceived).toBeString(); - expect(delegatesDataReturned[0].selfVotes).toBeString(); - expect(delegatesDataReturned[1].totalVotesReceived).toBeString(); - expect(delegatesDataReturned[1].selfVotes).toBeString(); - }); - }); - }); - - describe('getLockedVotedAmount', () => { - beforeEach(async () => { - const context = createStoreGetter(stateStore); - await voterSubStore.set(context, address, { - sentVotes: [ - { delegateAddress: address1, amount: BigInt(200), voteSharingCoefficients: [] }, - { delegateAddress: address2, amount: BigInt(10), voteSharingCoefficients: [] }, - ], - pendingUnlocks: [{ amount: BigInt(30), delegateAddress: address1, unvoteHeight: 99 }], - }); - }); - - it('should reject with invalid params', async () => { - await expect( - dposEndpoint.getLockedVotedAmount( - createTransientModuleEndpointContext({ stateStore, params: { address: true } }), - ), - ).rejects.toThrow('Lisk validator found 1 error[s]:'); - }); - - it('should return amount locked for votes', async () => { - const resp = await dposEndpoint.getLockedVotedAmount( - createTransientModuleEndpointContext({ - stateStore, - params: { address: cryptoAddress.getLisk32AddressFromAddress(address) }, - }), - ); - expect(resp.amount).toEqual(Number(200 + 10 + 30).toString()); - }); - }); - - describe('getConstants', () => { - it('should return DPoSModule configuration', async () => { - const constants = await dposEndpoint.getConstants(); - - expect(constants).toStrictEqual({ - ...defaultConfig, - governanceTokenID: config.governanceTokenID.toString('hex'), - }); - }); - }); - - describe('getPendingUnlocks', () => { - it('should reject if input address is invalid', async () => { - await expect( - dposEndpoint.getPendingUnlocks( - createTransientModuleEndpointContext({ - params: { - address: 1, - }, - }), - ), - ).rejects.toThrow('Parameter address must be a string'); - }); - - it('should reject if input address is not lisk32 format', async () => { - await expect( - dposEndpoint.getPendingUnlocks( - createTransientModuleEndpointContext({ - params: { - address: 'lskos7tnf5jx4e6jq400000000000000000000000', - }, - }), - ), - ).rejects.toThrow('Invalid character found in address'); - }); - - it('should return empty if voter does not exist', async () => { - await expect( - dposEndpoint.getPendingUnlocks( - createTransientModuleEndpointContext({ - params: { - address: 'lskos7tnf5jx4e6jq4bf5z4gwo2ow5he4khn75gpo', - }, - }), - ), - ).resolves.toEqual({ pendingUnlocks: [] }); - }); - - it('should return return all pending unlocks with expected unlockable heights', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address, { - ...delegateData, - name: 'delegate', - pomHeights: [], - }); - await delegateSubStore.set(createStoreGetter(stateStore), address1, { - ...delegateData, - name: 'delegate1', - pomHeights: [], - }); - const pomHeight = 260000; - await delegateSubStore.set(createStoreGetter(stateStore), address2, { - ...delegateData, - name: 'delegate2', - pomHeights: [pomHeight], - }); - const pendingUnlocks = [ - { - amount: BigInt(200), - delegateAddress: address, - unvoteHeight: 100000, - }, - { - amount: BigInt(200), - delegateAddress: address1, - unvoteHeight: 300000, - }, - { - amount: BigInt(500), - delegateAddress: address2, - unvoteHeight: 250000, - }, - ]; - await voterSubStore.set(createStoreGetter(stateStore), address, { - sentVotes: [], - pendingUnlocks, - }); - await genesisSubStore.set(createStoreGetter(stateStore), EMPTY_KEY, { - height: 0, - initDelegates: [], - initRounds: 3, - }); - - await expect( - dposEndpoint.getPendingUnlocks( - createTransientModuleEndpointContext({ - stateStore, - context: { - header: createFakeBlockHeader({ - height: 1000000, - timestamp: 100000, - aggregateCommit: { - aggregationBits: Buffer.alloc(0), - certificateSignature: Buffer.alloc(0), - height: 250000, - }, - }), - }, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ), - ).resolves.toEqual({ - pendingUnlocks: [ - { - ...pendingUnlocks[0], - delegateAddress: cryptoAddress.getLisk32AddressFromAddress( - pendingUnlocks[0].delegateAddress, - ), - amount: pendingUnlocks[0].amount.toString(), - unlockable: true, - expectedUnlockableHeight: pendingUnlocks[0].unvoteHeight + LOCKING_PERIOD_SELF_VOTES, - }, - { - ...pendingUnlocks[1], - delegateAddress: cryptoAddress.getLisk32AddressFromAddress( - pendingUnlocks[1].delegateAddress, - ), - amount: pendingUnlocks[1].amount.toString(), - unlockable: false, - expectedUnlockableHeight: pendingUnlocks[1].unvoteHeight + LOCKING_PERIOD_VOTES, - }, - { - ...pendingUnlocks[2], - delegateAddress: cryptoAddress.getLisk32AddressFromAddress( - pendingUnlocks[2].delegateAddress, - ), - amount: pendingUnlocks[2].amount.toString(), - unlockable: false, - expectedUnlockableHeight: pomHeight + PUNISHMENT_WINDOW_VOTES, - }, - ], - }); - }); - }); - - describe('getGovernanceTokenID', () => { - it('should return governanceTokenID', async () => { - await expect( - dposEndpoint.getGovernanceTokenID(createTransientModuleEndpointContext({ stateStore })), - ).resolves.toEqual({ - tokenID: config.governanceTokenID.toString('hex'), - }); - }); - }); - - describe('getValidatorsByStake', () => { - beforeEach(async () => { - const context = createStoreGetter(stateStore); - await eligibleDelegatesSubStore.set( - context, - eligibleDelegatesSubStore.getKey(address, BigInt(20)), - { lastPomHeight: 0 }, - ); - await eligibleDelegatesSubStore.set( - context, - eligibleDelegatesSubStore.getKey(address1, BigInt(50)), - { lastPomHeight: 0 }, - ); - await eligibleDelegatesSubStore.set( - context, - eligibleDelegatesSubStore.getKey(address2, BigInt(100)), - { lastPomHeight: 0 }, - ); - - await delegateSubStore.set(context, address, { - ...delegateData, - name: '1', - }); - await delegateSubStore.set(context, address1, { - ...delegateData, - name: '2', - }); - await delegateSubStore.set(context, address2, { - ...delegateData, - name: '3', - }); - }); - - it('should reject with invalid params', async () => { - await expect( - dposEndpoint.getValidatorsByStake( - createTransientModuleEndpointContext({ stateStore, params: { limit: true } }), - ), - ).rejects.toThrow('Lisk validator found 1 error[s]:'); - }); - - it('should return validators with default limit', async () => { - const resp = await dposEndpoint.getValidatorsByStake( - createTransientModuleEndpointContext({ stateStore }), - ); - expect(resp.validators).toHaveLength(3); - expect(resp.validators[0]).toEqual({ - ...delegateData, - name: '3', - totalVotesReceived: delegateData.totalVotesReceived.toString(), - selfVotes: delegateData.selfVotes.toString(), - sharingCoefficients: delegateData.sharingCoefficients.map(co => ({ - tokenID: co.tokenID.toString('hex'), - coefficient: co.coefficient.toString('hex'), - })), - }); - }); - - it('should return all validators with limit', async () => { - const resp = await dposEndpoint.getValidatorsByStake( - createTransientModuleEndpointContext({ stateStore, params: { limit: 2 } }), - ); - expect(resp.validators).toHaveLength(2); - expect(resp.validators[0]).toEqual({ - ...delegateData, - name: '3', - address: cryptoAddress.getLisk32AddressFromAddress(address2), - totalVotesReceived: delegateData.totalVotesReceived.toString(), - selfVotes: delegateData.selfVotes.toString(), - sharingCoefficients: delegateData.sharingCoefficients.map(co => ({ - tokenID: co.tokenID.toString('hex'), - coefficient: co.coefficient.toString('hex'), - })), - }); - expect(resp.validators[1]).toEqual({ - ...delegateData, - address: cryptoAddress.getLisk32AddressFromAddress(address1), - name: '2', - totalVotesReceived: delegateData.totalVotesReceived.toString(), - selfVotes: delegateData.selfVotes.toString(), - sharingCoefficients: delegateData.sharingCoefficients.map(co => ({ - tokenID: co.tokenID.toString('hex'), - coefficient: co.coefficient.toString('hex'), - })), - }); - }); - }); - - describe('getLockedRewards', () => { - beforeEach(async () => { - const context = createStoreGetter(stateStore); - await voterSubStore.set(context, address, { - sentVotes: [ - { delegateAddress: address1, amount: BigInt(200), voteSharingCoefficients: [] }, - { delegateAddress: address2, amount: BigInt(10), voteSharingCoefficients: [] }, - ], - pendingUnlocks: [{ amount: BigInt(30), delegateAddress: address1, unvoteHeight: 99 }], - }); - - (dposEndpoint['_tokenMethod'].getLockedAmount as jest.Mock).mockResolvedValue(BigInt(5000)); - }); - - it('should reject with invalid params', async () => { - await expect( - dposEndpoint.getLockedRewards( - createTransientModuleEndpointContext({ stateStore, params: { limit: true } }), - ), - ).rejects.toThrow('Lisk validator found 2 error[s]:'); - }); - - it('should reject with invalid token ID params', async () => { - await expect( - dposEndpoint.getLockedRewards( - createTransientModuleEndpointContext({ - stateStore, - params: { address: cryptoAddress.getLisk32AddressFromAddress(address), tokenID: 123 }, - }), - ), - ).rejects.toThrow('Lisk validator found 1 error[s]:'); - }); - - it('should return full amount when token ID requested is not governance tokenID', async () => { - const resp = await dposEndpoint.getLockedRewards( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - tokenID: Buffer.alloc(8).toString('hex'), - }, - }), - ); - expect(resp.reward).toEqual('5000'); - }); - - it('should return amount without the amount locked for votes with token ID requested is the governance token ID', async () => { - const resp = await dposEndpoint.getLockedRewards( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - tokenID: config.governanceTokenID.toString('hex'), - }, - }), - ); - expect(resp.reward).toEqual(Number(5000 - 200 - 10 - 30).toString()); - }); - }); - - describe('getClaimableRewards', () => { - it('should return rewards when voted for 1 delegate which got rewards in 2 tokens', async () => { - const amount = BigInt(200); - const context = createStoreGetter(stateStore); - await delegateSubStore.set(context, address, delegateData); - await voterSubStore.set(context, addressVoter, { - sentVotes: [ - { - delegateAddress: address, - amount, - voteSharingCoefficients: [voterSharingCoefficient1, voterSharingCoefficient2], - }, - ], - pendingUnlocks: [], - }); - - const response = await dposEndpoint.getClaimableRewards( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(addressVoter), - }, - }), - ); - - expect(response.rewards).toHaveLength(2); - expect(response).toEqual({ - rewards: [ - { - tokenID: voterSharingCoefficient1.tokenID.toString('hex'), - reward: calculateVoteRewards( - voterSharingCoefficient1, - amount, - delegateSharingCoefficient1, - ).toString(), - }, - { - tokenID: voterSharingCoefficient2.tokenID.toString('hex'), - reward: calculateVoteRewards( - voterSharingCoefficient2, - amount, - delegateSharingCoefficient2, - ).toString(), - }, - ], - }); - }); - - it('should exclude self vote from the claimable rewards', async () => { - const amount = BigInt(200); - const context = createStoreGetter(stateStore); - await delegateSubStore.set(context, address, delegateData); - await voterSubStore.set(context, address, { - sentVotes: [ - { - delegateAddress: address, - amount, - voteSharingCoefficients: [voterSharingCoefficient1, voterSharingCoefficient2], - }, - ], - pendingUnlocks: [], - }); - - const response = await dposEndpoint.getClaimableRewards( - createTransientModuleEndpointContext({ - stateStore, - params: { - address: cryptoAddress.getLisk32AddressFromAddress(address), - }, - }), - ); - - expect(response).toEqual({ rewards: [] }); - }); - }); -}); diff --git a/framework/test/unit/modules/dynamic_rewards/module.spec.ts b/framework/test/unit/modules/dynamic_rewards/module.spec.ts index f774f2a4545..4e414efa6e6 100644 --- a/framework/test/unit/modules/dynamic_rewards/module.spec.ts +++ b/framework/test/unit/modules/dynamic_rewards/module.spec.ts @@ -22,7 +22,7 @@ import { import { RewardMintedEvent } from '../../../../src/modules/reward/events/reward_minted'; import { DynamicRewardModule } from '../../../../src/modules/dynamic_rewards'; import { - DPoSMethod, + PoSMethod, RandomMethod, TokenMethod, ValidatorsMethod, @@ -48,13 +48,13 @@ import { describe('DynamicRewardModule', () => { const defaultRoundLength = 103; - const defaultNumberOfActiveDelegates = 101; + const defaultNumberOfActiveValidators = 101; let rewardModule: DynamicRewardModule; let tokenMethod: TokenMethod; let randomMethod: RandomMethod; let validatorsMethod: ValidatorsMethod; - let dposMethod: DPoSMethod; + let posMethod: PoSMethod; beforeEach(async () => { rewardModule = new DynamicRewardModule(); @@ -69,13 +69,13 @@ describe('DynamicRewardModule', () => { getGeneratorsBetweenTimestamps: jest.fn(), getValidatorsParams: jest.fn(), }; - dposMethod = { - getNumberOfActiveDelegates: jest.fn().mockReturnValue(defaultNumberOfActiveDelegates), + posMethod = { + getNumberOfActiveValidators: jest.fn().mockReturnValue(defaultNumberOfActiveValidators), getRoundLength: jest.fn().mockReturnValue(defaultRoundLength), updateSharedRewards: jest.fn(), isEndOfRound: jest.fn(), }; - rewardModule.addDependencies(tokenMethod, randomMethod, validatorsMethod, dposMethod); + rewardModule.addDependencies(tokenMethod, randomMethod, validatorsMethod, posMethod); }); describe('init', () => { @@ -156,13 +156,13 @@ describe('DynamicRewardModule', () => { let standbyValidatorAddress: Buffer; let stateStore: PrefixedStateReadWriter; - const activeDelegate = 4; + const activeValidator = 4; const minimumReward = (BigInt(defaultConfig.brackets[0]) * - BigInt(defaultConfig.factorMinimumRewardActiveDelegates)) / + BigInt(defaultConfig.factorMinimumRewardActiveValidators)) / DECIMAL_PERCENT_FACTOR; - const totalRewardActiveDelegate = BigInt(defaultConfig.brackets[0]) * BigInt(activeDelegate); - const ratioReward = totalRewardActiveDelegate - minimumReward * BigInt(activeDelegate); + const totalRewardActiveValidator = BigInt(defaultConfig.brackets[0]) * BigInt(activeValidator); + const ratioReward = totalRewardActiveValidator - minimumReward * BigInt(activeValidator); beforeEach(async () => { generatorAddress = utils.getRandomBytes(20); @@ -188,10 +188,10 @@ describe('DynamicRewardModule', () => { ]; (validatorsMethod.getValidatorsParams as jest.Mock).mockResolvedValue({ validators }); - (dposMethod.getNumberOfActiveDelegates as jest.Mock).mockReturnValue(activeDelegate); + (posMethod.getNumberOfActiveValidators as jest.Mock).mockReturnValue(activeValidator); }); - it('should store minimal reward for active delegates when full round is forged', async () => { + it('should store minimal reward for active validators when full round is forged', async () => { // Round is already completed once const generatorMap = new Array(defaultRoundLength).fill(0).reduce(prev => { // eslint-disable-next-line no-param-reassign @@ -340,7 +340,7 @@ describe('DynamicRewardModule', () => { rewardModule['_moduleConfig'].tokenID, BigInt(defaultConfig.brackets[0]), ); - expect(dposMethod.updateSharedRewards).toHaveBeenCalledWith( + expect(posMethod.updateSharedRewards).toHaveBeenCalledWith( expect.anything(), blockExecuteContext.header.generatorAddress, rewardModule['_moduleConfig'].tokenID, @@ -359,7 +359,7 @@ describe('DynamicRewardModule', () => { ); expect(tokenMethod.mint).not.toHaveBeenCalled(); - expect(dposMethod.updateSharedRewards).not.toHaveBeenCalled(); + expect(posMethod.updateSharedRewards).not.toHaveBeenCalled(); }); it('should store timestamp when end of round', async () => { @@ -373,7 +373,7 @@ describe('DynamicRewardModule', () => { header: blockHeader, }).getBlockAfterExecuteContext(); - (dposMethod.isEndOfRound as jest.Mock).mockResolvedValue(true); + (posMethod.isEndOfRound as jest.Mock).mockResolvedValue(true); await rewardModule.afterTransactionsExecute(blockExecuteContext); diff --git a/framework/test/unit/modules/pos/commands/__snapshots__/report_misbehavior.spec.ts.snap b/framework/test/unit/modules/pos/commands/__snapshots__/report_misbehavior.spec.ts.snap new file mode 100644 index 00000000000..5a3267a2db4 --- /dev/null +++ b/framework/test/unit/modules/pos/commands/__snapshots__/report_misbehavior.spec.ts.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ReportMisbehaviorCommand constructor should have valid schema 1`] = ` +Object { + "$id": "/pos/command/reportMisbehaviorParams", + "properties": Object { + "header1": Object { + "dataType": "bytes", + "fieldNumber": 1, + }, + "header2": Object { + "dataType": "bytes", + "fieldNumber": 2, + }, + }, + "required": Array [ + "header1", + "header2", + ], + "type": "object", +} +`; diff --git a/framework/test/unit/modules/dpos_v2/commands/__snapshots__/vote_delegate.spec.ts.snap b/framework/test/unit/modules/pos/commands/__snapshots__/stake.spec.ts.snap similarity index 73% rename from framework/test/unit/modules/dpos_v2/commands/__snapshots__/vote_delegate.spec.ts.snap rename to framework/test/unit/modules/pos/commands/__snapshots__/stake.spec.ts.snap index 971f12ae4a0..3c6bad5f6b7 100644 --- a/framework/test/unit/modules/dpos_v2/commands/__snapshots__/vote_delegate.spec.ts.snap +++ b/framework/test/unit/modules/pos/commands/__snapshots__/stake.spec.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`VoteCommand constructor should have valid schema 1`] = ` +exports[`StakeCommand constructor should have valid schema 1`] = ` Object { - "$id": "/dpos/command/voteDelegateParams", + "$id": "/pos/command/stakeValidatorParams", "properties": Object { - "votes": Object { + "stakes": Object { "fieldNumber": 1, "items": Object { "properties": Object { @@ -12,14 +12,14 @@ Object { "dataType": "sint64", "fieldNumber": 2, }, - "delegateAddress": Object { + "validatorAddress": Object { "dataType": "bytes", "fieldNumber": 1, "format": "lisk32", }, }, "required": Array [ - "delegateAddress", + "validatorAddress", "amount", ], "type": "object", @@ -30,7 +30,7 @@ Object { }, }, "required": Array [ - "votes", + "stakes", ], "type": "object", } diff --git a/framework/test/unit/modules/dpos_v2/commands/change_commission.spec.ts b/framework/test/unit/modules/pos/commands/change_commission.spec.ts similarity index 79% rename from framework/test/unit/modules/dpos_v2/commands/change_commission.spec.ts rename to framework/test/unit/modules/pos/commands/change_commission.spec.ts index ba5942c8183..7efa404af9f 100644 --- a/framework/test/unit/modules/dpos_v2/commands/change_commission.spec.ts +++ b/framework/test/unit/modules/pos/commands/change_commission.spec.ts @@ -16,41 +16,41 @@ import { Transaction } from '@liskhq/lisk-chain'; import { codec } from '@liskhq/lisk-codec'; import { utils } from '@liskhq/lisk-cryptography'; import * as testing from '../../../../../src/testing'; -import { ChangeCommissionCommand } from '../../../../../src/modules/dpos_v2/commands/change_commission'; -import { changeCommissionCommandParamsSchema as schema } from '../../../../../src/modules/dpos_v2/schemas'; -import { ChangeCommissionParams } from '../../../../../src/modules/dpos_v2/types'; +import { ChangeCommissionCommand } from '../../../../../src/modules/pos/commands/change_commission'; +import { changeCommissionCommandParamsSchema as schema } from '../../../../../src/modules/pos/schemas'; +import { ChangeCommissionParams } from '../../../../../src/modules/pos/types'; import { EventQueue, VerifyStatus } from '../../../../../src/state_machine'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { InMemoryPrefixedStateDB } from '../../../../../src/testing/in_memory_prefixed_state'; -import { DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; -import { DPoSModule } from '../../../../../src'; +import { ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; +import { PoSModule } from '../../../../../src'; import { createStoreGetter } from '../../../../../src/testing/utils'; import { COMMISSION_INCREASE_PERIOD, MAX_COMMISSION, MAX_COMMISSION_INCREASE_RATE, -} from '../../../../../src/modules/dpos_v2/constants'; +} from '../../../../../src/modules/pos/constants'; import { createFakeBlockHeader } from '../../../../../src/testing'; -import { CommissionChangeEvent } from '../../../../../src/modules/dpos_v2/events/commission_change'; +import { CommissionChangeEvent } from '../../../../../src/modules/pos/events/commission_change'; describe('Change Commission command', () => { - const dpos = new DPoSModule(); - const changeCommissionCommand = new ChangeCommissionCommand(dpos.stores, dpos.events); + const pos = new PoSModule(); + const changeCommissionCommand = new ChangeCommissionCommand(pos.stores, pos.events); changeCommissionCommand.init({ commissionIncreasePeriod: COMMISSION_INCREASE_PERIOD, maxCommissionIncreaseRate: MAX_COMMISSION_INCREASE_RATE, }); let stateStore: PrefixedStateReadWriter; - let delegateStore: DelegateStore; + let validatorStore: ValidatorStore; let commissionChangedEvent: CommissionChangeEvent; const publicKey = utils.getRandomBytes(32); - const delegateDetails = { + const validatorDetails = { name: 'PamelaAnderson', - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [], @@ -61,11 +61,11 @@ describe('Change Commission command', () => { }; const commandParams: ChangeCommissionParams = { - newCommission: delegateDetails.commission + MAX_COMMISSION_INCREASE_RATE - 1, + newCommission: validatorDetails.commission + MAX_COMMISSION_INCREASE_RATE - 1, }; const encodedCommandParams = codec.encode(schema, commandParams); const transactionDetails = { - module: 'dpos', + module: 'pos', command: changeCommissionCommand.name, senderPublicKey: publicKey, nonce: BigInt(0), @@ -97,15 +97,15 @@ describe('Change Commission command', () => { beforeEach(async () => { stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateStore = dpos.stores.get(DelegateStore); + validatorStore = pos.stores.get(ValidatorStore); - await delegateStore.set( + await validatorStore.set( createStoreGetter(stateStore), transaction.senderAddress, - delegateDetails, + validatorDetails, ); - commissionChangedEvent = dpos.events.get(CommissionChangeEvent); + commissionChangedEvent = pos.events.get(CommissionChangeEvent); jest.spyOn(commissionChangedEvent, 'log'); }); @@ -124,8 +124,8 @@ describe('Change Commission command', () => { expect(result.status).toBe(VerifyStatus.OK); }); - it('should return error when changing commission of an unregistered delegate', async () => { - await delegateStore.del(createStoreGetter(stateStore), transaction.senderAddress); + it('should return error when changing commission of an unregistered validator', async () => { + await validatorStore.del(createStoreGetter(stateStore), transaction.senderAddress); const context = testing .createTransactionContext({ @@ -139,7 +139,7 @@ describe('Change Commission command', () => { expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude( - 'Transaction sender has not registered as a delegate.', + 'Transaction sender has not registered as a validator.', ); }); @@ -161,7 +161,7 @@ describe('Change Commission command', () => { }); it('should return error when requested commission change is higher than allowed', async () => { - commandParams.newCommission = delegateDetails.commission + MAX_COMMISSION_INCREASE_RATE + 1; + commandParams.newCommission = validatorDetails.commission + MAX_COMMISSION_INCREASE_RATE + 1; transactionDetails.params = codec.encode(schema, commandParams); transaction = new Transaction(transactionDetails); @@ -202,7 +202,7 @@ describe('Change Commission command', () => { }); describe('execute', () => { - it('should update last commission increase height in the delegate store after INCREASING commission', async () => { + it('should update last commission increase height in the validator store after INCREASING commission', async () => { const context = testing .createTransactionContext({ stateStore, @@ -212,13 +212,13 @@ describe('Change Commission command', () => { .createCommandExecuteContext(schema); await changeCommissionCommand.execute(context); - const delegate = await delegateStore.get(context, transaction.senderAddress); + const validator = await validatorStore.get(context, transaction.senderAddress); - expect(delegate.commission).toBe(commandParams.newCommission); - expect(delegate.lastCommissionIncreaseHeight).toBe(COMMISSION_INCREASE_PERIOD + 1); + expect(validator.commission).toBe(commandParams.newCommission); + expect(validator.lastCommissionIncreaseHeight).toBe(COMMISSION_INCREASE_PERIOD + 1); }); - it('should NOT update last commission increase height in the delegate store after DECREASING commission', async () => { + it('should NOT update last commission increase height in the validator store after DECREASING commission', async () => { commandParams.newCommission = 50; transactionDetails.params = codec.encode(schema, commandParams); transaction = new Transaction(transactionDetails); @@ -232,10 +232,10 @@ describe('Change Commission command', () => { .createCommandExecuteContext(schema); await changeCommissionCommand.execute(context); - const delegate = await delegateStore.get(context, transaction.senderAddress); + const validator = await validatorStore.get(context, transaction.senderAddress); - expect(delegate.commission).toBe(commandParams.newCommission); - expect(delegate.lastCommissionIncreaseHeight).toBe(0); + expect(validator.commission).toBe(commandParams.newCommission); + expect(validator.lastCommissionIncreaseHeight).toBe(0); }); it('should emit event after changing commission', async () => { @@ -251,15 +251,15 @@ describe('Change Commission command', () => { // check if the event has been dispatched correctly expect(commissionChangedEvent.log).toHaveBeenCalledWith(expect.anything(), { - delegateAddress: transaction.senderAddress, - oldCommission: delegateDetails.commission, + validatorAddress: transaction.senderAddress, + oldCommission: validatorDetails.commission, newCommission: commandParams.newCommission, }); // check if the event is in the event queue - checkEventResult(context.eventQueue, CommissionChangeEvent, 'dpos', { - delegateAddress: transaction.senderAddress, - oldCommission: delegateDetails.commission, + checkEventResult(context.eventQueue, CommissionChangeEvent, 'pos', { + validatorAddress: transaction.senderAddress, + oldCommission: validatorDetails.commission, newCommission: commandParams.newCommission, }); }); diff --git a/framework/test/unit/modules/dpos_v2/commands/claim_rewards.spec.ts b/framework/test/unit/modules/pos/commands/claim_rewards.spec.ts similarity index 59% rename from framework/test/unit/modules/dpos_v2/commands/claim_rewards.spec.ts rename to framework/test/unit/modules/pos/commands/claim_rewards.spec.ts index 4e06bbac689..f13810505a7 100644 --- a/framework/test/unit/modules/dpos_v2/commands/claim_rewards.spec.ts +++ b/framework/test/unit/modules/pos/commands/claim_rewards.spec.ts @@ -15,34 +15,34 @@ import { Transaction } from '@liskhq/lisk-chain'; import { utils, address } from '@liskhq/lisk-cryptography'; import { testing } from '../../../../../src'; -import { ClaimRewardsCommand } from '../../../../../src/modules/dpos_v2/commands/claim_rewards'; -import { MAX_NUMBER_BYTES_Q96 } from '../../../../../src/modules/dpos_v2/constants'; -import { InternalMethod } from '../../../../../src/modules/dpos_v2/internal_method'; -import { DPoSModule } from '../../../../../src/modules/dpos_v2/module'; -import { DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; -import { VoterStore } from '../../../../../src/modules/dpos_v2/stores/voter'; -import { DelegateAccount, TokenMethod, VoterData } from '../../../../../src/modules/dpos_v2/types'; +import { ClaimRewardsCommand } from '../../../../../src/modules/pos/commands/claim_rewards'; +import { MAX_NUMBER_BYTES_Q96 } from '../../../../../src/modules/pos/constants'; +import { InternalMethod } from '../../../../../src/modules/pos/internal_method'; +import { PoSModule } from '../../../../../src/modules/pos/module'; +import { ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; +import { StakerStore } from '../../../../../src/modules/pos/stores/staker'; +import { ValidatorAccount, TokenMethod, StakerData } from '../../../../../src/modules/pos/types'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { createFakeBlockHeader, InMemoryPrefixedStateDB } from '../../../../../src/testing'; import { createStoreGetter } from '../../../../../src/testing/utils'; describe('Change Commission command', () => { - const dpos = new DPoSModule(); + const pos = new PoSModule(); const publicKey = utils.getRandomBytes(32); const senderAddress = address.getAddressFromPublicKey(publicKey); let claimRewardsCommand: ClaimRewardsCommand; let internalMethod: InternalMethod; let tokenMethod: TokenMethod; let stateStore: PrefixedStateReadWriter; - let delegateStore: DelegateStore; - let voterStore: VoterStore; + let validatorStore: ValidatorStore; + let stakerStore: StakerStore; let transaction: Transaction; - let voterData: VoterData; - let delegateInfo1: DelegateAccount; - let delegateInfo2: DelegateAccount; + let stakerData: StakerData; + let validatorInfo1: ValidatorAccount; + let validatorInfo2: ValidatorAccount; beforeEach(async () => { - internalMethod = new InternalMethod(dpos.stores, dpos.events, dpos.name); + internalMethod = new InternalMethod(pos.stores, pos.events, pos.name); tokenMethod = { lock: jest.fn(), unlock: jest.fn(), @@ -52,10 +52,10 @@ describe('Change Commission command', () => { getLockedAmount: jest.fn(), }; internalMethod.addDependencies(tokenMethod); - claimRewardsCommand = new ClaimRewardsCommand(dpos.stores, dpos.events); + claimRewardsCommand = new ClaimRewardsCommand(pos.stores, pos.events); claimRewardsCommand.addDependencies({ internalMethod }); const transactionDetails = { - module: 'dpos', + module: 'pos', command: claimRewardsCommand.name, senderPublicKey: publicKey, nonce: BigInt(0), @@ -65,59 +65,59 @@ describe('Change Commission command', () => { }; transaction = new Transaction(transactionDetails); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateStore = dpos.stores.get(DelegateStore); - voterStore = dpos.stores.get(VoterStore); - voterData = { - sentVotes: [ + validatorStore = pos.stores.get(ValidatorStore); + stakerStore = pos.stores.get(StakerStore); + stakerData = { + sentStakes: [ { - delegateAddress: senderAddress, + validatorAddress: senderAddress, amount: BigInt(10), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }, { - delegateAddress: Buffer.alloc(20, 1), + validatorAddress: Buffer.alloc(20, 1), amount: BigInt(20), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: Buffer.alloc(0), coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }, ], pendingUnlocks: [], }; - delegateInfo1 = { + validatorInfo1 = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate1', + name: 'validator1', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }; - delegateInfo2 = { + validatorInfo2 = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate1', + name: 'validator1', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(32) }], }; - await delegateStore.set(createStoreGetter(stateStore), senderAddress, delegateInfo1); - await delegateStore.set(createStoreGetter(stateStore), Buffer.alloc(20, 1), delegateInfo2); - jest.spyOn(internalMethod, 'assignVoteRewards').mockResolvedValue(); + await validatorStore.set(createStoreGetter(stateStore), senderAddress, validatorInfo1); + await validatorStore.set(createStoreGetter(stateStore), Buffer.alloc(20, 1), validatorInfo2); + jest.spyOn(internalMethod, 'assignStakeRewards').mockResolvedValue(); }); describe('execute', () => { - it('should throw if voter data does not exist for the sender address', async () => { + it('should throw if staker data does not exist for the sender address', async () => { const context = testing .createTransactionContext({ stateStore, @@ -129,8 +129,8 @@ describe('Change Commission command', () => { await expect(claimRewardsCommand.execute(context)).rejects.toThrow(); }); - it('should call method assign vote rewards for each entry in sent votes and update the voter data correctly if voter data exists for the sender address', async () => { - await voterStore.set(createStoreGetter(stateStore), senderAddress, voterData); + it('should call method assign stake rewards for each entry in sent stakes and update the staker data correctly if staker data exists for the sender address', async () => { + await stakerStore.set(createStoreGetter(stateStore), senderAddress, stakerData); const context = testing .createTransactionContext({ stateStore, @@ -140,14 +140,14 @@ describe('Change Commission command', () => { .createCommandExecuteContext>(); await claimRewardsCommand.execute(context); - const updatedVoterData = await voterStore.get(context, senderAddress); + const updatedStakerData = await stakerStore.get(context, senderAddress); - expect(internalMethod.assignVoteRewards).toHaveBeenCalledTimes(voterData.sentVotes.length); - expect(updatedVoterData.sentVotes[0].voteSharingCoefficients).toStrictEqual( - delegateInfo1.sharingCoefficients, + expect(internalMethod.assignStakeRewards).toHaveBeenCalledTimes(stakerData.sentStakes.length); + expect(updatedStakerData.sentStakes[0].stakeSharingCoefficients).toStrictEqual( + validatorInfo1.sharingCoefficients, ); - expect(updatedVoterData.sentVotes[1].voteSharingCoefficients).toStrictEqual( - delegateInfo2.sharingCoefficients, + expect(updatedStakerData.sentStakes[1].stakeSharingCoefficients).toStrictEqual( + validatorInfo2.sharingCoefficients, ); }); }); diff --git a/framework/test/unit/modules/dpos_v2/commands/pom.spec.ts b/framework/test/unit/modules/pos/commands/report_misbehavior.spec.ts similarity index 82% rename from framework/test/unit/modules/dpos_v2/commands/pom.spec.ts rename to framework/test/unit/modules/pos/commands/report_misbehavior.spec.ts index 8a2e8f11b57..fcc5c40d435 100644 --- a/framework/test/unit/modules/dpos_v2/commands/pom.spec.ts +++ b/framework/test/unit/modules/pos/commands/report_misbehavior.spec.ts @@ -18,38 +18,38 @@ import { objects } from '@liskhq/lisk-utils'; import { address, utils, legacy } from '@liskhq/lisk-cryptography'; import { codec } from '@liskhq/lisk-codec'; import { Status } from '@liskhq/lisk-transaction-pool/dist-node/types'; -import { ReportMisbehaviorCommand, VerifyStatus, DPoSModule } from '../../../../../src'; +import { ReportMisbehaviorCommand, VerifyStatus, PoSModule } from '../../../../../src'; import * as testing from '../../../../../src/testing'; import { defaultConfig, - LOCKING_PERIOD_SELF_VOTES, + LOCKING_PERIOD_SELF_STAKES, REPORTING_PUNISHMENT_REWARD, -} from '../../../../../src/modules/dpos_v2/constants'; +} from '../../../../../src/modules/pos/constants'; import { TokenMethod, ValidatorsMethod, PomTransactionParams, -} from '../../../../../src/modules/dpos_v2/types'; +} from '../../../../../src/modules/pos/types'; import { DEFAULT_LOCAL_ID } from '../../../../utils/mocks/transaction'; import * as bftUtil from '../../../../../src/engine/bft/utils'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { InMemoryPrefixedStateDB } from '../../../../../src/testing/in_memory_prefixed_state'; -import { DelegateAccount, DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; +import { ValidatorAccount, ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; import { createStoreGetter } from '../../../../../src/testing/utils'; -import { EligibleDelegatesStore } from '../../../../../src/modules/dpos_v2/stores/eligible_delegates'; +import { EligibleValidatorsStore } from '../../../../../src/modules/pos/stores/eligible_validators'; describe('ReportMisbehaviorCommand', () => { - const dpos = new DPoSModule(); + const pos = new PoSModule(); let pomCommand: ReportMisbehaviorCommand; let stateStore: PrefixedStateReadWriter; - let delegateSubstore: DelegateStore; + let validatorSubstore: ValidatorStore; let mockTokenMethod: TokenMethod; let mockValidatorsMethod: ValidatorsMethod; const blockHeight = 8760000; const reportPunishmentReward = REPORTING_PUNISHMENT_REWARD; let context: any; - let misBehavingDelegate: DelegateAccount; - let normalDelegate: DelegateAccount; + let misBehavingValidator: ValidatorAccount; + let normalValidator: ValidatorAccount; let header1: BlockHeader; let header2: BlockHeader; let transaction: any; @@ -60,13 +60,13 @@ describe('ReportMisbehaviorCommand', () => { const header = testing.createFakeBlockHeader({ height: blockHeight, }); - const { publicKey: delegate1PublicKey } = legacy.getPrivateAndPublicKeyFromPassphrase( + const { publicKey: validator1PublicKey } = legacy.getPrivateAndPublicKeyFromPassphrase( utils.getRandomBytes(20).toString('utf8'), ); - const delegate1Address = address.getAddressFromPublicKey(delegate1PublicKey); - const defaultDelegateInfo = { - totalVotesReceived: BigInt(100000000), - selfVotes: BigInt(0), + const validator1Address = address.getAddressFromPublicKey(validator1PublicKey); + const defaultValidatorInfo = { + totalStakeReceived: BigInt(100000000), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [], @@ -77,14 +77,14 @@ describe('ReportMisbehaviorCommand', () => { }; beforeEach(async () => { - dpos.stores.get(EligibleDelegatesStore).init({ + pos.stores.get(EligibleValidatorsStore).init({ ...defaultConfig, minWeightStandby: BigInt(defaultConfig.minWeightStandby), - governanceTokenID: Buffer.alloc(8), + posTokenID: Buffer.alloc(8), tokenIDFee: Buffer.alloc(8), - delegateRegistrationFee: BigInt(defaultConfig.delegateRegistrationFee), + validatorRegistrationFee: BigInt(defaultConfig.validatorRegistrationFee), }); - pomCommand = new ReportMisbehaviorCommand(dpos.stores, dpos.events); + pomCommand = new ReportMisbehaviorCommand(pos.stores, pos.events); mockTokenMethod = { lock: jest.fn(), unlock: jest.fn(), @@ -105,19 +105,19 @@ describe('ReportMisbehaviorCommand', () => { validatorsMethod: mockValidatorsMethod, }); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateSubstore = dpos.stores.get(DelegateStore); + validatorSubstore = pos.stores.get(ValidatorStore); - misBehavingDelegate = { name: 'misBehavingDelegate', ...defaultDelegateInfo }; - normalDelegate = { name: 'normalDelegate', ...defaultDelegateInfo }; + misBehavingValidator = { name: 'misBehavingValidator', ...defaultValidatorInfo }; + normalValidator = { name: 'normalValidator', ...defaultValidatorInfo }; const { id: id1, ...fakeBlockHeader1 } = testing .createFakeBlockHeader({ - generatorAddress: delegate1Address, + generatorAddress: validator1Address, }) .toObject(); const { id: id2, ...fakeBlockHeader2 } = testing .createFakeBlockHeader({ - generatorAddress: delegate1Address, + generatorAddress: validator1Address, }) .toObject(); @@ -125,13 +125,13 @@ describe('ReportMisbehaviorCommand', () => { header2 = fakeBlockHeader2 as BlockHeader; pomCommand.init({ - governanceTokenID: DEFAULT_LOCAL_ID, - factorSelfVotes: 10, + posTokenID: DEFAULT_LOCAL_ID, + factorSelfStakes: 10, }); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); transaction = new Transaction({ - module: 'dpos', - command: 'reportDelegateMisbehavior', + module: 'pos', + command: 'reportValidatorMisbehavior', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -139,10 +139,10 @@ describe('ReportMisbehaviorCommand', () => { signatures: [publicKey], }); - await delegateSubstore.set(createStoreGetter(stateStore), senderAddress, { + await validatorSubstore.set(createStoreGetter(stateStore), senderAddress, { name: 'mrrobot', - totalVotesReceived: BigInt(10000000000), - selfVotes: BigInt(1000000000), + totalStakeReceived: BigInt(10000000000), + selfStake: BigInt(1000000000), lastGeneratedHeight: 100, isBanned: false, pomHeights: [], @@ -151,11 +151,11 @@ describe('ReportMisbehaviorCommand', () => { lastCommissionIncreaseHeight: 0, sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate1Address, normalDelegate); - await delegateSubstore.set( + await validatorSubstore.set(createStoreGetter(stateStore), validator1Address, normalValidator); + await validatorSubstore.set( createStoreGetter(stateStore), - delegate1Address, - misBehavingDelegate, + validator1Address, + misBehavingValidator, ); }); @@ -287,11 +287,11 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.verify(context)).rejects.toThrow('Invalid block signature.'); }); - it('should throw an error when maxPunishableHeight is greater than or equal to LOCKING_PERIOD_SELF_VOTES', async () => { + it('should throw an error when maxPunishableHeight is greater than or equal to LOCKING_PERIOD_SELF_STAKES', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, { ...header1, - height: LOCKING_PERIOD_SELF_VOTES, + height: LOCKING_PERIOD_SELF_STAKES, }), header2: codec.encode(blockHeaderSchema, { ...header2 }), }; @@ -318,12 +318,12 @@ describe('ReportMisbehaviorCommand', () => { header2: { ...header2, height: block2Height }, }; - const updatedDelegateAccount = objects.cloneDeep(misBehavingDelegate); - updatedDelegateAccount.pomHeights = [transactionParamsPreDecoded.header1.height + 10]; - await delegateSubstore.set( + const updatedValidatorAccount = objects.cloneDeep(misBehavingValidator); + updatedValidatorAccount.pomHeights = [transactionParamsPreDecoded.header1.height + 10]; + await validatorSubstore.set( createStoreGetter(stateStore), - delegate1Address, - updatedDelegateAccount, + validator1Address, + updatedValidatorAccount, ); transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, transactionParamsPreDecoded.header1), @@ -341,7 +341,7 @@ describe('ReportMisbehaviorCommand', () => { jest.spyOn(BlockHeader.prototype, 'validateSignature').mockReturnValue(undefined); - await expect(pomCommand.verify(context)).rejects.toThrow('Delegate is already punished.'); + await expect(pomCommand.verify(context)).rejects.toThrow('Validator is already punished.'); }); it('should throw error if misbehaving account is already banned', async () => { @@ -353,12 +353,12 @@ describe('ReportMisbehaviorCommand', () => { header2: { ...header2, height: block2Height }, }; - const updatedDelegateAccount = objects.cloneDeep(misBehavingDelegate); - updatedDelegateAccount.isBanned = true; - await delegateSubstore.set( + const updatedValidatorAccount = objects.cloneDeep(misBehavingValidator); + updatedValidatorAccount.isBanned = true; + await validatorSubstore.set( createStoreGetter(stateStore), - delegate1Address, - updatedDelegateAccount, + validator1Address, + updatedValidatorAccount, ); transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, transactionParamsPreDecoded.header1), @@ -376,7 +376,7 @@ describe('ReportMisbehaviorCommand', () => { jest.spyOn(BlockHeader.prototype, 'validateSignature').mockReturnValue(undefined); - await expect(pomCommand.verify(context)).rejects.toThrow('Delegate is already banned.'); + await expect(pomCommand.verify(context)).rejects.toThrow('Validator is already banned.'); }); it('should throw error if both headers are the same', async () => { @@ -428,12 +428,12 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); }); - it('should not throw error when first height is equal to second height but equal maxHeightPrevoted', async () => { + it('should not throw error when first height is equal to second height but equal maxHeightPrestaked', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, { ...header1, height: 10999, - asset: { ...header1, maxHeightPrevoted: 1099 }, + asset: { ...header1, maxHeightPrestaked: 1099 }, }), header2: codec.encode(blockHeaderSchema, { ...header2, height: 10999 }), }; @@ -451,12 +451,12 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); }); - it('should not throw error when first height is greater than the second height but equal maxHeightPrevoted', async () => { + it('should not throw error when first height is greater than the second height but equal maxHeightPrestaked', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, { ...header1, height: 10999, - asset: { ...header1, maxHeightPrevoted: 1099 }, + asset: { ...header1, maxHeightPrestaked: 1099 }, }), header2: codec.encode(blockHeaderSchema, { ...header2, height: 11999 }), }; @@ -500,17 +500,17 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.verify(context)).not.toReject(); }); - it('should not throw error when maxHeightPrevoted is greater than the second maxHeightPrevoted', async () => { + it('should not throw error when maxHeightPrestaked is greater than the second maxHeightPrestaked', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, { ...header1, height: 133, - asset: { ...header1, maxHeightPrevoted: 101 }, + asset: { ...header1, maxHeightPrestaked: 101 }, }), header2: codec.encode(blockHeaderSchema, { ...header2, height: 123, - asset: { ...header1, maxHeightPrevoted: 98 }, + asset: { ...header1, maxHeightPrestaked: 98 }, }), }; transactionParams = codec.encode(pomCommand.schema, transactionParamsDecoded); @@ -560,7 +560,7 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.execute(context)).resolves.toBeUndefined(); }); - it('should throw error if misbehaving account is not a delegate', async () => { + it('should throw error if misbehaving account is not a validator', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, { ...transactionParamsPreDecoded.header1, @@ -581,7 +581,7 @@ describe('ReportMisbehaviorCommand', () => { await expect(pomCommand.execute(context)).rejects.toThrow(); }); - it('should reward the sender with 1 LSK if delegate has enough balance', async () => { + it('should reward the sender with 1 LSK if validator has enough balance', async () => { const remainingBalance = reportPunishmentReward + BigInt('10000000000'); transactionParamsDecoded = { @@ -599,21 +599,21 @@ describe('ReportMisbehaviorCommand', () => { .createCommandExecuteContext(pomCommand.schema); when(pomCommand['_tokenMethod'].getAvailableBalance as any) - .calledWith(expect.anything(), delegate1Address, DEFAULT_LOCAL_ID) + .calledWith(expect.anything(), validator1Address, DEFAULT_LOCAL_ID) .mockResolvedValue(remainingBalance as never); await pomCommand.execute(context); expect(pomCommand['_tokenMethod'].transfer).toHaveBeenCalledWith( expect.anything(), - delegate1Address, + validator1Address, context.transaction.senderAddress, DEFAULT_LOCAL_ID, reportPunishmentReward, ); }); - it('should not reward the sender if delegate does not has enough minimum remaining balance', async () => { + it('should not reward the sender if validator does not has enough minimum remaining balance', async () => { const remainingBalance = BigInt(100); transactionParamsDecoded = { @@ -631,7 +631,7 @@ describe('ReportMisbehaviorCommand', () => { .createCommandExecuteContext(pomCommand.schema); when(pomCommand['_tokenMethod'].getAvailableBalance as any) - .calledWith(expect.anything(), delegate1Address, DEFAULT_LOCAL_ID) + .calledWith(expect.anything(), validator1Address, DEFAULT_LOCAL_ID) .mockResolvedValue(remainingBalance as never); await pomCommand.execute(context); @@ -639,14 +639,14 @@ describe('ReportMisbehaviorCommand', () => { // If amount is zero, it should not call the transfer expect(pomCommand['_tokenMethod'].transfer).not.toHaveBeenCalledWith( expect.anything(), - delegate1Address, + validator1Address, context.transaction.senderAddress, DEFAULT_LOCAL_ID, BigInt(0), ); }); - it('should add (remaining balance - min remaining balance) of delegate to balance of the sender if delegate balance is less than report punishment reward', async () => { + it('should add (remaining balance - min remaining balance) of validator to balance of the sender if validator balance is less than report punishment reward', async () => { const remainingBalance = reportPunishmentReward - BigInt(1); transactionParamsDecoded = { @@ -664,14 +664,14 @@ describe('ReportMisbehaviorCommand', () => { .createCommandExecuteContext(pomCommand.schema); when(pomCommand['_tokenMethod'].getAvailableBalance as any) - .calledWith(expect.anything(), delegate1Address, DEFAULT_LOCAL_ID) + .calledWith(expect.anything(), validator1Address, DEFAULT_LOCAL_ID) .mockResolvedValue(remainingBalance as never); await pomCommand.execute(context); expect(pomCommand['_tokenMethod'].transfer).toHaveBeenCalledWith( expect.anything(), - delegate1Address, + validator1Address, context.transaction.senderAddress, DEFAULT_LOCAL_ID, remainingBalance, @@ -695,23 +695,23 @@ describe('ReportMisbehaviorCommand', () => { await pomCommand.execute(context); - const updatedDelegate = await delegateSubstore.get( + const updatedValidator = await validatorSubstore.get( createStoreGetter(stateStore), - delegate1Address, + validator1Address, ); - expect(updatedDelegate.pomHeights).toEqual([blockHeight]); + expect(updatedValidator.pomHeights).toEqual([blockHeight]); }); it('should set isBanned property to true if pomHeights.length === 5', async () => { const pomHeights = [500, 1000, 2000, 4550]; - const updatedDelegateAccount = objects.cloneDeep(misBehavingDelegate); - updatedDelegateAccount.pomHeights = objects.cloneDeep(pomHeights); - updatedDelegateAccount.isBanned = false; - await delegateSubstore.set( + const updatedValidatorAccount = objects.cloneDeep(misBehavingValidator); + updatedValidatorAccount.pomHeights = objects.cloneDeep(pomHeights); + updatedValidatorAccount.isBanned = false; + await validatorSubstore.set( createStoreGetter(stateStore), - delegate1Address, - updatedDelegateAccount, + validator1Address, + updatedValidatorAccount, ); transactionParamsDecoded = { @@ -730,21 +730,21 @@ describe('ReportMisbehaviorCommand', () => { await pomCommand.execute(context); - const updatedDelegate = await delegateSubstore.get( + const updatedValidator = await validatorSubstore.get( createStoreGetter(stateStore), - delegate1Address, + validator1Address, ); - expect(updatedDelegate.pomHeights).toEqual([...pomHeights, blockHeight]); - expect(updatedDelegate.pomHeights).toHaveLength(5); - expect(updatedDelegate.isBanned).toBeTrue(); + expect(updatedValidator.pomHeights).toEqual([...pomHeights, blockHeight]); + expect(updatedValidator.pomHeights).toHaveLength(5); + expect(updatedValidator.isBanned).toBeTrue(); const events = context.eventQueue.getEvents(); expect(events).toHaveLength(2); - expect(events[1].toObject().name).toEqual('delegateBanned'); + expect(events[1].toObject().name).toEqual('validatorBanned'); }); - it('should emit a DelegatePunishedEvent', async () => { + it('should emit a ValidatorPunishedEvent', async () => { transactionParamsDecoded = { header1: codec.encode(blockHeaderSchema, transactionParamsPreDecoded.header1), header2: codec.encode(blockHeaderSchema, transactionParamsPreDecoded.header2), @@ -763,18 +763,18 @@ describe('ReportMisbehaviorCommand', () => { const events = context.eventQueue.getEvents(); expect(events).toHaveLength(1); - expect(events[0].toObject().name).toEqual('delegatePunished'); + expect(events[0].toObject().name).toEqual('validatorPunished'); }); - it('should not return balance if sender and delegate account are same', async () => { + it('should not return balance if sender and validator account are same', async () => { transaction = new Transaction({ - module: 'dpos', - command: 'reportDelegateMisbehavior', - senderPublicKey: delegate1PublicKey, + module: 'pos', + command: 'reportValidatorMisbehavior', + senderPublicKey: validator1PublicKey, nonce: BigInt(0), fee: BigInt(100000000), params: Buffer.alloc(0), - signatures: [delegate1PublicKey], + signatures: [validator1PublicKey], }); transactionParamsDecoded = { diff --git a/framework/test/unit/modules/pos/commands/stake.spec.ts b/framework/test/unit/modules/pos/commands/stake.spec.ts new file mode 100644 index 00000000000..52c36d78e72 --- /dev/null +++ b/framework/test/unit/modules/pos/commands/stake.spec.ts @@ -0,0 +1,1914 @@ +/* + * Copyright © 2021 Lisk Foundation + * + * See the LICENSE file at the top-level directory of this distribution + * for licensing information. + * + * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, + * no part of this software, including this file, may be copied, modified, + * propagated, or distributed except according to the terms contained in the + * LICENSE file. + * + * Removal or modification of this copyright notice is prohibited. + */ + +import { Transaction } from '@liskhq/lisk-chain'; +import { codec } from '@liskhq/lisk-codec'; +import { address, utils } from '@liskhq/lisk-cryptography'; +import { validator } from '@liskhq/lisk-validator'; +import { StakeCommand, VerifyStatus, PoSModule } from '../../../../../src'; +import { + MAX_NUMBER_PENDING_UNLOCKS, + MODULE_NAME_POS, + PoSEventResult, +} from '../../../../../src/modules/pos/constants'; +import { ValidatorStakedEvent } from '../../../../../src/modules/pos/events/validator_staked'; +import { InternalMethod } from '../../../../../src/modules/pos/internal_method'; +import { ValidatorAccount, ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; +import { EligibleValidatorsStore } from '../../../../../src/modules/pos/stores/eligible_validators'; +import { StakerStore } from '../../../../../src/modules/pos/stores/staker'; +import { StakeObject, StakeTransactionParams } from '../../../../../src/modules/pos/types'; +import { EventQueue, MethodContext } from '../../../../../src/state_machine'; +import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; + +import { createTransactionContext, InMemoryPrefixedStateDB } from '../../../../../src/testing'; +import { createStoreGetter } from '../../../../../src/testing/utils'; +import { liskToBeddows } from '../../../../utils/assets'; +import { DEFAULT_LOCAL_ID } from '../../../../utils/mocks/transaction'; + +describe('StakeCommand', () => { + const pos = new PoSModule(); + const checkEventResult = ( + eventQueue: EventQueue, + length: number, + EventClass: any, + index: number, + expectedResult: any, + result: any, + ) => { + expect(eventQueue.getEvents()).toHaveLength(length); + expect(eventQueue.getEvents()[index].toObject().name).toEqual(new EventClass('token').name); + + const eventData = codec.decode>( + new EventClass('token').schema, + eventQueue.getEvents()[index].toObject().data, + ); + + expect(eventData).toEqual({ ...expectedResult, result }); + }; + + const defaultConfig = { + factorSelfStakes: 10, + maxLengthName: 20, + maxNumberSentStakes: 10, + maxNumberPendingUnlocks: 20, + failSafeMissedBlocks: 50, + failSafeInactiveWindow: 260000, + punishmentWindow: 780000, + roundLength: 103, + minWeightStandby: (BigInt(1000) * BigInt(10 ** 8)).toString(), + numberActiveValidators: 101, + numberStandbyValidators: 2, + posTokenID: '0000000000000000', + tokenIDFee: '0000000000000000', + validatorRegistrationFee: (BigInt(10) * BigInt(10) ** BigInt(8)).toString(), + maxBFTWeightCap: 500, + }; + const lastBlockHeight = 200; + const posTokenID = DEFAULT_LOCAL_ID; + const senderPublicKey = utils.getRandomBytes(32); + const senderAddress = address.getAddressFromPublicKey(senderPublicKey); + const validatorAddress1 = utils.getRandomBytes(20); + const validatorAddress2 = utils.getRandomBytes(20); + const validatorAddress3 = utils.getRandomBytes(20); + const validator1StakeAmount = liskToBeddows(90); + const validator2StakeAmount = liskToBeddows(50); + + let validatorInfo1: ValidatorAccount; + let validatorInfo2: ValidatorAccount; + let validatorInfo3: ValidatorAccount; + let stakerStore: StakerStore; + let validatorStore: ValidatorStore; + let context: any; + let transaction: any; + let command: StakeCommand; + let transactionParams: Buffer; + let transactionParamsDecoded: any; + let stateStore: PrefixedStateReadWriter; + let lockFn: any; + let tokenMethod: any; + let internalMethod: InternalMethod; + let mockAssignStakeRewards: jest.SpyInstance< + Promise, + [ + methodContext: MethodContext, + stakerAddress: Buffer, + sentStake: StakeObject, + validatorData: ValidatorAccount, + ] + >; + + beforeEach(async () => { + lockFn = jest.fn(); + tokenMethod = { + lock: lockFn, + unlock: jest.fn(), + getAvailableBalance: jest.fn(), + burn: jest.fn(), + transfer: jest.fn(), + getLockedAmount: jest.fn(), + }; + await pos.init({ + genesisConfig: {} as any, + moduleConfig: defaultConfig, + generatorConfig: {}, + }); + internalMethod = new InternalMethod(pos.stores, pos.events, pos.name); + internalMethod.addDependencies(tokenMethod); + mockAssignStakeRewards = jest.spyOn(internalMethod, 'assignStakeRewards').mockResolvedValue(); + command = new StakeCommand(pos.stores, pos.events); + command.addDependencies({ + tokenMethod, + internalMethod, + }); + command.init({ + posTokenID: DEFAULT_LOCAL_ID, + factorSelfStakes: BigInt(10), + }); + + stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); + + validatorInfo1 = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: 'someValidator1', + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + validatorInfo2 = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: 'someValidator2', + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + validatorInfo3 = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: 'someValidator3', + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress2, validatorInfo2); + + stakerStore = pos.stores.get(StakerStore); + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress2, validatorInfo2); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress3, validatorInfo3); + }); + + describe('constructor', () => { + it('should have valid name', () => { + expect(command.name).toEqual('stake'); + }); + + it('should have valid schema', () => { + expect(command.schema).toMatchSnapshot(); + }); + }); + + describe('verify', () => { + beforeEach(() => { + transaction = new Transaction({ + module: 'pos', + command: 'stake', + fee: BigInt(1500000), + nonce: BigInt(0), + params: Buffer.alloc(0), + senderPublicKey: utils.getRandomBytes(32), + signatures: [], + }); + }); + + describe('schema validation', () => { + describe('when transaction.params.stakes does not include any stake', () => { + beforeEach(() => { + transactionParamsDecoded = { + stakes: [], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + }); + + it('should return errors', async () => { + const verificationResult = await command.verify(context); + expect((verificationResult.error as any).value.message).toInclude( + 'must NOT have fewer than 1 items', + ); + }); + }); + + describe('when transaction.params.stakes includes more than 20 elements', () => { + beforeEach(() => { + transactionParamsDecoded = { + stakes: Array(21) + .fill(0) + .map(() => ({ + validatorAddress: utils.getRandomBytes(20), + amount: liskToBeddows(0), + })), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + }); + + it('should return errors', async () => { + const verificationResult = await command.verify(context); + expect((verificationResult.error as any).value.message).toInclude( + 'must NOT have more than 20 items', + ); + }); + }); + + describe('when transaction.params.stakes includes amount which is less than int64 range', () => { + beforeEach(() => { + transactionParamsDecoded = { + stakes: [ + { + validatorAddress: utils.getRandomBytes(20), + amount: BigInt(-1) * BigInt(2) ** BigInt(63) - BigInt(1), + }, + ], + }; + }); + + it('should return errors', () => { + expect(() => validator.validate(command.schema, transactionParamsDecoded)).toThrow( + 'should pass "dataType" keyword validation', + ); + }); + }); + + describe('when transaction.params.stakes includes amount which is greater than int64 range', () => { + beforeEach(() => { + transactionParamsDecoded = { + stakes: [ + { + validatorAddress: utils.getRandomBytes(20), + amount: BigInt(2) ** BigInt(63) + BigInt(1), + }, + ], + }; + }); + + it('should return errors', () => { + expect(() => validator.validate(command.schema, transactionParamsDecoded)).toThrow( + 'should pass "dataType" keyword validation', + ); + }); + }); + }); + + describe('when transaction.params.stakes contains valid contents', () => { + it('should not throw errors with valid upstake case', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [{ validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(20) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); + }); + + it('should not throw errors with valid downstake cast', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [{ validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(-20) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); + }); + + it('should not throw errors with valid mixed stakes case', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [ + { validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(20) }, + { validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(-20) }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty('status', VerifyStatus.OK); + }); + }); + + describe('when transaction.params.stakes contains more than 10 positive stakes', () => { + it('should throw error', async () => { + // Arrange + transactionParamsDecoded = { + stakes: Array(11) + .fill(0) + .map(() => ({ validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(10) })), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Upstake can only be casted up to 10.', + ); + }); + }); + + describe('when transaction.params.stakes contains more than 10 negative stakes', () => { + it('should throw error', async () => { + // Arrange + transactionParamsDecoded = { + stakes: Array(11) + .fill(0) + .map(() => ({ + validatorAddress: utils.getRandomBytes(20), + amount: liskToBeddows(-10), + })), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Downstake can only be casted up to 10.', + ); + }); + }); + + describe('when transaction.params.stakes includes duplicate validators within positive amount', () => { + it('should throw error', async () => { + // Arrange + const validatorAddress = utils.getRandomBytes(20); + transactionParamsDecoded = { + stakes: Array(2) + .fill(0) + .map(() => ({ validatorAddress, amount: liskToBeddows(10) })), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Validator address must be unique.', + ); + }); + }); + + describe('when transaction.params.stakes includes duplicate validators within positive and negative amount', () => { + it('should throw error', async () => { + // Arrange + const validatorAddress = utils.getRandomBytes(20); + transactionParamsDecoded = { + stakes: [ + { validatorAddress, amount: liskToBeddows(10) }, + { validatorAddress, amount: liskToBeddows(-10) }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Validator address must be unique.', + ); + }); + }); + + describe('when transaction.params.stakes includes zero amount', () => { + it('should throw error', async () => { + // Arrange + const validatorAddress = utils.getRandomBytes(20); + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: liskToBeddows(0) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Amount cannot be 0.', + ); + }); + }); + + describe('when transaction.params.stakes includes positive amount which is not multiple of 10 * 10^8', () => { + it('should throw an error', async () => { + // Arrange + const validatorAddress = utils.getRandomBytes(20); + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: BigInt(20) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Amount should be multiple of 10 * 10^8.', + ); + }); + }); + + describe('when transaction.params.stakes includes negative amount which is not multiple of 10 * 10^8', () => { + it('should throw error', async () => { + // Arrange + const validatorAddress = utils.getRandomBytes(20); + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: BigInt(-20) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + }).createCommandVerifyContext(command.schema); + + // Assert + await expect(command.verify(context)).resolves.toHaveProperty( + 'error.message', + 'Amount should be multiple of 10 * 10^8.', + ); + }); + }); + }); + + describe('execute', () => { + beforeEach(() => { + transaction = new Transaction({ + module: 'pos', + command: 'stake', + fee: BigInt(1500000), + nonce: BigInt(0), + params: transactionParams, + senderPublicKey, + signatures: [], + }); + }); + describe('when transaction.params.stakes contain positive amount', () => { + it('should emit ValidatorStakedEvent with STAKE_SUCCESSFUL result', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress1, amount: liskToBeddows(10) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).resolves.toBeUndefined(); + + checkEventResult( + context.eventQueue, + 1, + ValidatorStakedEvent, + 0, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[0].validatorAddress, + amount: transactionParamsDecoded.stakes[0].amount, + }, + PoSEventResult.STAKE_SUCCESSFUL, + ); + }); + + it('should throw error if stake amount is more than balance', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [{ validatorAddress: utils.getRandomBytes(20), amount: liskToBeddows(100) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + lockFn.mockRejectedValue(new Error('Not enough balance to lock')); + + // Assert + await expect(command.execute(context)).rejects.toThrow(); + }); + + it('should make account to have correct balance', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + // Assert + expect(lockFn).toHaveBeenCalledTimes(2); + expect(lockFn).toHaveBeenCalledWith( + expect.anything(), + senderAddress, + MODULE_NAME_POS, + posTokenID, + validator1StakeAmount, + ); + expect(lockFn).toHaveBeenCalledWith( + expect.anything(), + senderAddress, + MODULE_NAME_POS, + posTokenID, + validator2StakeAmount, + ); + }); + + it('should not change pendingUnlocks', async () => { + // Arrange + stakerStore = pos.stores.get(StakerStore); + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress1, amount: validator1StakeAmount }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const { pendingUnlocks } = await stakerStore.get( + createStoreGetter(stateStore), + senderAddress, + ); + + // Assert + expect(pendingUnlocks).toHaveLength(0); + }); + + it('should order stakerData.sentStakes', async () => { + // Arrange + stakerStore = pos.stores.get(StakerStore); + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress2, validatorInfo2); + + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const { sentStakes } = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + const sentStakesCopy = sentStakes.slice(0); + sentStakesCopy.sort((a: any, b: any) => a.validatorAddress.compare(b.validatorAddress)); + + // Assert + expect(sentStakes).toStrictEqual(sentStakesCopy); + }); + + it('should make upstaked validator account to have correct totalStakeReceived', async () => { + // Arrange + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress2, validatorInfo2); + + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const { totalStakeReceived: totalStakeReceived1 } = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress1, + ); + const { totalStakeReceived: totalStakeReceived2 } = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress2, + ); + + // Assert + expect(totalStakeReceived1).toBe(validator1StakeAmount); + expect(totalStakeReceived2).toBe(validator2StakeAmount); + }); + + it('should update stake object when it exists before and create if it does not exist', async () => { + // Arrange + stakerStore = pos.stores.get(StakerStore); + validatorStore = pos.stores.get(ValidatorStore); + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validatorInfo1); + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress1, amount: validator1StakeAmount }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect( + stakerStore.get(createStoreGetter(stateStore), senderAddress), + ).rejects.toThrow(); + + await command.execute(context); + const { sentStakes } = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + expect(sentStakes[0]).toEqual({ + validatorAddress: validatorAddress1, + amount: validator1StakeAmount, + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }); + }); + }); + + describe('when transaction.params.stakes contain negative amount which makes stakerStore.sentStakes to be 0 entries', () => { + beforeEach(async () => { + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount * BigInt(-1) }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount * BigInt(-1) }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + lockFn.mockClear(); + }); + + it('should emit ValidatorStakedEvent with STAKE_SUCCESSFUL result', async () => { + await expect(command.execute(context)).resolves.toBeUndefined(); + + for (let i = 0; i < 2; i += 2) { + checkEventResult( + context.eventQueue, + 2, + ValidatorStakedEvent, + 0, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[i].validatorAddress, + amount: transactionParamsDecoded.stakes[i].amount, + }, + PoSEventResult.STAKE_SUCCESSFUL, + ); + } + }); + + it('should not change account balance', async () => { + // Act + await command.execute(context); + + // Assert + expect(lockFn).toHaveBeenCalledTimes(0); + }); + + it('should remove stake which has zero amount', async () => { + // Arrange + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount * BigInt(-1) }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const stakerData = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + // Assert + expect(stakerData.sentStakes).toHaveLength(1); + expect(stakerData.sentStakes[0].validatorAddress).not.toEqual(validatorAddress1); + }); + + it('should update stake which has non-zero amount', async () => { + // Arrange + const downStakeAmount = liskToBeddows(10); + + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress1, amount: downStakeAmount * BigInt(-1) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const stakerData = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + // Assert + expect( + stakerData.sentStakes.find((v: any) => v.validatorAddress.equals(validatorAddress1)), + ).toEqual({ + validatorAddress: validatorAddress1, + amount: validator1StakeAmount - downStakeAmount, + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }); + }); + + it('should make account to have correct unlocking', async () => { + // Arrange + await command.execute(context); + + const stakerData = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + // Assert + expect(stakerData.pendingUnlocks).toHaveLength(2); + expect(stakerData.pendingUnlocks).toEqual( + [ + { + validatorAddress: validatorAddress1, + amount: validator1StakeAmount, + unstakeHeight: lastBlockHeight + 1, + }, + { + validatorAddress: validatorAddress2, + amount: validator2StakeAmount, + unstakeHeight: lastBlockHeight + 1, + }, + ].sort((a, b) => a.validatorAddress.compare(b.validatorAddress)), + ); + }); + + it('should order stakerData.pendingUnlocks', async () => { + // Arrange + await command.execute(context); + + const stakerData = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + // Assert + expect(stakerData.pendingUnlocks).toHaveLength(2); + expect(stakerData.pendingUnlocks.map((d: any) => d.validatorAddress)).toEqual( + [validatorAddress1, validatorAddress2].sort((a, b) => a.compare(b)), + ); + }); + + it('should make downstaked validator account to have correct totalStakeReceived', async () => { + // Arrange + await command.execute(context); + + const validatorData1 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress1, + ); + const validatorData2 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress2, + ); + + // Assert + expect(validatorData1.totalStakeReceived).toEqual(BigInt(0)); + expect(validatorData2.totalStakeReceived).toEqual(BigInt(0)); + }); + + it('should throw error and emit ValidatorStakedEvent with STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS result when downstaked validator is not already upstaked', async () => { + // Arrange + const downStakeAmount = liskToBeddows(10); + + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress3, amount: downStakeAmount * BigInt(-1) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow( + 'Cannot cast downstake to validator who is not upstaked.', + ); + + checkEventResult( + context.eventQueue, + 1, + ValidatorStakedEvent, + 0, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[0].validatorAddress, + amount: transactionParamsDecoded.stakes[0].amount, + }, + PoSEventResult.STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS, + ); + }); + }); + + describe('when transaction.params.stakes contain negative and positive amount', () => { + const positiveStakeValidator1 = liskToBeddows(10); + const negativeStakeValidator2 = liskToBeddows(-20); + beforeEach(async () => { + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: positiveStakeValidator1 }, + { validatorAddress: validatorAddress2, amount: negativeStakeValidator2 }, + ].sort((a, b) => -1 * a.validatorAddress.compare(b.validatorAddress)), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + lockFn.mockClear(); + }); + + it('should assign reward to staker for downstake and upstake for already staked validator', async () => { + await expect(command.execute(context)).resolves.toBeUndefined(); + + expect(mockAssignStakeRewards).toHaveBeenCalledTimes(2); + }); + + it('should assign sharingCoefficients of the validator to the corresponding sentStake of the staker for that validator', async () => { + const sharingCoefficients = [ + { + tokenID: Buffer.alloc(8), + coefficient: Buffer.alloc(24, 0), + }, + { + tokenID: Buffer.alloc(8), + coefficient: Buffer.alloc(24, 1), + }, + ]; + + const validator1 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress1, + ); + const validator2 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress2, + ); + + validator1.sharingCoefficients = sharingCoefficients; + validator2.sharingCoefficients = sharingCoefficients; + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress1, validator1); + await validatorStore.set(createStoreGetter(stateStore), validatorAddress2, validator2); + + await expect(command.execute(context)).resolves.toBeUndefined(); + + const { sentStakes } = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + + expect( + sentStakes.find(sentStake => sentStake.validatorAddress.equals(validatorAddress1))! + .stakeSharingCoefficients, + ).toEqual(sharingCoefficients); + expect( + sentStakes.find(sentStake => sentStake.validatorAddress.equals(validatorAddress2))! + .stakeSharingCoefficients, + ).toEqual(sharingCoefficients); + }); + + it('should not assign rewards to staker for first upstake for the validator', async () => { + transactionParamsDecoded = { + stakes: [{ validatorAddress: validatorAddress3, amount: positiveStakeValidator1 }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await expect(command.execute(context)).resolves.toBeUndefined(); + }); + + it('should update staked validator in EligibleValidatorStore', async () => { + const validatorAddress = utils.getRandomBytes(20); + const selfStake = BigInt(2) + BigInt(defaultConfig.minWeightStandby); + + const validatorInfo = { + ...validatorInfo1, + selfStake, + totalStakeReceived: BigInt(1) + BigInt(100) * BigInt(defaultConfig.minWeightStandby), + }; + const expectedWeight = BigInt(10) * selfStake; + await validatorStore.set(createStoreGetter(stateStore), validatorAddress, validatorInfo); + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: positiveStakeValidator1 }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + transaction.params = transactionParams; + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const eligibleValidatorStore = pos.stores.get(EligibleValidatorsStore); + + expect( + await eligibleValidatorStore.get( + context, + eligibleValidatorStore.getKey(validatorAddress, expectedWeight), + ), + ).toBeDefined(); + + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: BigInt(-2) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + transaction.params = transactionParams; + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + expect( + await eligibleValidatorStore.get( + context, + eligibleValidatorStore.getKey(validatorAddress, expectedWeight), + ), + ).toBeDefined(); + }); + + it('should make staker to have correct balance', async () => { + // Arrange + await command.execute(context); + + // Assert + expect(lockFn).toHaveBeenCalledTimes(1); + expect(lockFn).toHaveBeenCalledWith( + expect.anything(), + senderAddress, + MODULE_NAME_POS, + posTokenID, + positiveStakeValidator1, + ); + }); + + it('should make staker to have correct unlocking', async () => { + // Arrange + await command.execute(context); + + const stakerData = await stakerStore.get(createStoreGetter(stateStore), senderAddress); + // Assert + expect(stakerData.pendingUnlocks).toHaveLength(1); + expect(stakerData.pendingUnlocks).toEqual([ + { + validatorAddress: validatorAddress2, + amount: BigInt(-1) * negativeStakeValidator2, + unstakeHeight: lastBlockHeight + 1, + }, + ]); + }); + + it('should make upstaked validator account to have correct totalStakeReceived', async () => { + // Arrange + await command.execute(context); + + const validatorData1 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress1, + ); + + // Assert + expect(validatorData1.totalStakeReceived).toEqual( + validator1StakeAmount + positiveStakeValidator1, + ); + }); + + it('should make downstaked validator account to have correct totalStakeReceived', async () => { + // Arrange + await command.execute(context); + + const validatorData2 = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress2, + ); + + // Assert + expect(validatorData2.totalStakeReceived).toEqual( + validator2StakeAmount + negativeStakeValidator2, + ); + }); + }); + + describe('when transaction.params.stakes contain invalid data', () => { + beforeEach(() => { + transactionParamsDecoded = { + stakes: [ + { validatorAddress: validatorAddress1, amount: validator1StakeAmount }, + { validatorAddress: validatorAddress2, amount: validator2StakeAmount }, + ].sort((a, b) => -1 * a.validatorAddress.compare(b.validatorAddress)), + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + lockFn.mockClear(); + }); + + describe('when transaction.params.stakes contain validator address which is not registered', () => { + it('should throw error and emit ValidatorStakedEevnt with STAKE_FAILED_NON_REGISTERED_VALIDATOR failure', async () => { + // Arrange + const nonExistingValidatorAddress = utils.getRandomBytes(20); + + transactionParamsDecoded = { + ...transactionParamsDecoded, + stakes: [{ validatorAddress: nonExistingValidatorAddress, amount: liskToBeddows(76) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow(); + + checkEventResult( + context.eventQueue, + 1, + ValidatorStakedEvent, + 0, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[0].validatorAddress, + amount: transactionParamsDecoded.stakes[0].amount, + }, + PoSEventResult.STAKE_FAILED_NON_REGISTERED_VALIDATOR, + ); + }); + }); + + describe('when transaction.params.stakes positive amount makes stakerData.sentStakes entries more than 10', () => { + it('should throw error and emit ValidatorStakedEvent with STAKE_FAILED_TOO_MANY_SENT_STAKES failure', async () => { + // Arrange + const stakes = []; + + for (let i = 0; i < 12; i += 1) { + const validatorAddress = utils.getRandomBytes(20); + + const validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: `someValidator${i}`, + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set( + createStoreGetter(stateStore), + validatorAddress, + validatorInfo, + ); + stakes.push({ + validatorAddress, + amount: liskToBeddows(10), + }); + } + + transactionParamsDecoded = { stakes }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow('Sender can only stake upto 10.'); + + checkEventResult( + context.eventQueue, + 11, + ValidatorStakedEvent, + 10, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[10].validatorAddress, + amount: transactionParamsDecoded.stakes[10].amount, + }, + PoSEventResult.STAKE_FAILED_TOO_MANY_SENT_STAKES, + ); + }); + }); + + describe('when transaction.params.stakes negative amount decrease stakerData.sentStakes entries yet positive amount makes account exceeds more than 10', () => { + it('should throw error and emit ValidatorStakedEvent with STAKE_FAILED_TOO_MANY_SENT_STAKES failure', async () => { + // Arrange + const initialValidatorAmount = 8; + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + + // Suppose account already staked for 8 validators + for (let i = 0; i < initialValidatorAmount; i += 1) { + const validatorAddress = utils.getRandomBytes(20); + + const validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: `someValidator${i}`, + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set( + createStoreGetter(stateStore), + validatorAddress, + validatorInfo, + ); + + const stake = { + validatorAddress, + amount: liskToBeddows(20), + stakeSharingCoefficients: [ + { tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }, + ], + }; + stakerData.sentStakes.push(stake); + } + + await stakerStore.set(createStoreGetter(stateStore), senderAddress, stakerData); + + // We have 2 negative stakes + const stakes = [ + { + validatorAddress: stakerData.sentStakes[0].validatorAddress, + amount: liskToBeddows(-10), + }, + { + validatorAddress: stakerData.sentStakes[1].validatorAddress, + amount: liskToBeddows(-10), + }, + ]; + + // We have 3 positive stakes + for (let i = 0; i < 3; i += 1) { + const validatorAddress = utils.getRandomBytes(20); + + const validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: `someValidator${i + initialValidatorAmount}`, + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set( + createStoreGetter(stateStore), + validatorAddress, + validatorInfo, + ); + + stakes.push({ + validatorAddress, + amount: liskToBeddows(10), + }); + } + + // Account already contains 8 positive stakes + // now we added 2 negative stakes and 3 new positive stakes + // which will make total positive stakes to grow over 10 + transactionParamsDecoded = { stakes }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow('Sender can only stake upto 10.'); + + checkEventResult( + context.eventQueue, + 5, + ValidatorStakedEvent, + 4, + { + senderAddress, + validatorAddress: stakes[4].validatorAddress, + amount: stakes[4].amount, + }, + PoSEventResult.STAKE_FAILED_TOO_MANY_SENT_STAKES, + ); + }); + }); + + describe('when transaction.params.stakes has negative amount and makes stakerData.pendingUnlocks more than 20 entries', () => { + it('should throw error and emit ValidatorStakedEvent with STAKE_FAILED_TOO_MANY_PENDING_UNLOCKS failure', async () => { + // Arrange + const initialValidatorAmountForUnlocks = 19; + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + + // Suppose account already 19 unlocking + for (let i = 0; i < initialValidatorAmountForUnlocks; i += 1) { + const validatorAddress = utils.getRandomBytes(20); + + const validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: `someValidator${i}`, + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set( + createStoreGetter(stateStore), + validatorAddress, + validatorInfo, + ); + + const pendingUnlock = { + validatorAddress, + amount: liskToBeddows(20), + unstakeHeight: i, + }; + stakerData.pendingUnlocks.push(pendingUnlock); + } + + // Suppose account have 5 positive stakes + for (let i = 0; i < 5; i += 1) { + const validatorAddress = utils.getRandomBytes(20); + + const validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: `someValidator${i}`, + pomHeights: [], + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set( + createStoreGetter(stateStore), + validatorAddress, + validatorInfo, + ); + + const stake = { + validatorAddress, + amount: liskToBeddows(20), + stakeSharingCoefficients: [], + }; + stakerData.sentStakes.push(stake); + } + + await stakerStore.set(createStoreGetter(stateStore), senderAddress, stakerData); + + // We have 2 negative stakes + const stakes = [ + { + validatorAddress: stakerData.sentStakes[0].validatorAddress, + amount: liskToBeddows(-10), + }, + { + validatorAddress: stakerData.sentStakes[1].validatorAddress, + amount: liskToBeddows(-10), + }, + ]; + + // Account already contains 19 unlocking and 5 positive stakes + // now we added 2 negative stakes + // which will make total unlocking to grow over 20 + transactionParamsDecoded = { stakes }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow( + `Pending unlocks cannot exceed ${MAX_NUMBER_PENDING_UNLOCKS.toString()}.`, + ); + + checkEventResult( + context.eventQueue, + 2, + ValidatorStakedEvent, + 1, + { + senderAddress, + validatorAddress: stakes[1].validatorAddress, + amount: stakes[1].amount, + }, + PoSEventResult.STAKE_FAILED_TOO_MANY_PENDING_UNLOCKS, + ); + + expect(mockAssignStakeRewards).toHaveBeenCalledTimes(stakes.length); + }); + }); + + describe('when transaction.params.stakes negative amount exceeds the previously staked amount', () => { + it('should throw error and emit ValidatorStakedEvent with STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS', async () => { + // Arrange + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + stakerData.sentStakes.push({ + validatorAddress: validatorAddress1, + amount: liskToBeddows(70), + stakeSharingCoefficients: [], + }); + await stakerStore.set(createStoreGetter(stateStore), senderAddress, stakerData); + + transactionParamsDecoded = { + stakes: [ + { + validatorAddress: validatorAddress1, + amount: liskToBeddows(-80), + }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + }).createCommandExecuteContext(command.schema); + + // Assert + await expect(command.execute(context)).rejects.toThrow( + 'The unstake amount exceeds the staked amount for this validator.', + ); + + checkEventResult( + context.eventQueue, + 1, + ValidatorStakedEvent, + 0, + { + senderAddress, + validatorAddress: transactionParamsDecoded.stakes[0].validatorAddress, + amount: transactionParamsDecoded.stakes[0].amount, + }, + PoSEventResult.STAKE_FAILED_INVALID_UNSTAKE_PARAMETERS, + ); + }); + }); + }); + + describe('when transaction.params.stakes contains self-stake', () => { + const senderStakeAmountPositive = liskToBeddows(80); + const senderStakeAmountNegative = liskToBeddows(20); + let totalStakeReceived: bigint; + let selfStake: bigint; + beforeEach(async () => { + totalStakeReceived = BigInt(20); + selfStake = BigInt(20); + + const validatorInfo = { + ...validatorInfo1, + totalStakeReceived, + selfStake, + }; + await validatorStore.set(createStoreGetter(stateStore), senderAddress, validatorInfo); + + transactionParamsDecoded = { + stakes: [{ validatorAddress: senderAddress, amount: senderStakeAmountPositive }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + lockFn.mockClear(); + }); + + it('should update stakes and totalStakeReceived', async () => { + // Act & Assign + await command.execute(context); + + const validatorData = await validatorStore.get( + createStoreGetter(stateStore), + senderAddress, + ); + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + // Assert + expect(validatorData.totalStakeReceived).toEqual( + totalStakeReceived + senderStakeAmountPositive, + ); + expect(stakerData.sentStakes).toHaveLength(1); + expect(lockFn).toHaveBeenCalledWith( + expect.anything(), + senderAddress, + MODULE_NAME_POS, + posTokenID, + senderStakeAmountPositive, + ); + }); + + it('should change validatorData.selfStake and totalStakeReceived with positive stake', async () => { + // Act & Assign + await command.execute(context); + + const validatorData = await validatorStore.get( + createStoreGetter(stateStore), + senderAddress, + ); + // Assert + expect(validatorData.totalStakeReceived).toEqual( + totalStakeReceived + senderStakeAmountPositive, + ); + expect(validatorData.selfStake).toEqual(selfStake + senderStakeAmountPositive); + }); + + it('should change validatorData.selfStake, totalStakeReceived and unlocking with negative stake', async () => { + // Act & Assign + await command.execute(context); + + transactionParamsDecoded = { + stakes: [ + { validatorAddress: senderAddress, amount: senderStakeAmountNegative * BigInt(-1) }, + ], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const validatorData = await validatorStore.get( + createStoreGetter(stateStore), + senderAddress, + ); + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + + // Assert + expect(validatorData.totalStakeReceived).toEqual( + totalStakeReceived + senderStakeAmountPositive - senderStakeAmountNegative, + ); + expect(validatorData.selfStake).toEqual( + totalStakeReceived + senderStakeAmountPositive - senderStakeAmountNegative, + ); + expect(stakerData.sentStakes).toHaveLength(1); + expect(stakerData.sentStakes).toEqual([ + { + validatorAddress: senderAddress, + amount: senderStakeAmountPositive - senderStakeAmountNegative, + stakeSharingCoefficients: [ + { + tokenID: Buffer.alloc(8), + coefficient: Buffer.alloc(24), + }, + ], + }, + ]); + expect(stakerData.pendingUnlocks).toHaveLength(1); + expect(stakerData.pendingUnlocks).toEqual([ + { + validatorAddress: senderAddress, + amount: senderStakeAmountNegative, + unstakeHeight: lastBlockHeight + 1, + }, + ]); + }); + }); + + describe('when transaction.params.stakes does not contain self-stake', () => { + const senderStakeAmountPositive = liskToBeddows(80); + const senderStakeAmountNegative = liskToBeddows(20); + const validatorSelfStake = liskToBeddows(2000); + const validatorAddress = utils.getRandomBytes(20); + let validatorInfo; + beforeEach(async () => { + validatorInfo = { + consecutiveMissedBlocks: 0, + isBanned: false, + lastGeneratedHeight: 5, + name: 'validator', + pomHeights: [], + selfStake: validatorSelfStake, + totalStakeReceived: validatorSelfStake, + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }; + + await validatorStore.set(createStoreGetter(stateStore), validatorAddress, validatorInfo); + + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: senderStakeAmountPositive }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + lockFn.mockClear(); + }); + + it('should not change validatorData.selfStake but should update totalStakeReceived with positive stake', async () => { + // Act & Assign + await command.execute(context); + + const validatorData = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress, + ); + // Assert + expect(validatorData.totalStakeReceived).toEqual( + senderStakeAmountPositive + validatorSelfStake, + ); + expect(validatorData.selfStake).toEqual(validatorSelfStake); + }); + + it('should not change validatorData.selfStake but should change totalStakeReceived and unlocking with negative stake', async () => { + // Act & Assign + await command.execute(context); + + transactionParamsDecoded = { + stakes: [{ validatorAddress, amount: senderStakeAmountNegative * BigInt(-1) }], + }; + + transactionParams = codec.encode(command.schema, transactionParamsDecoded); + + transaction.params = transactionParams; + + context = createTransactionContext({ + transaction, + stateStore, + header: { + height: lastBlockHeight, + } as any, + }).createCommandExecuteContext(command.schema); + + await command.execute(context); + + const validatorData = await validatorStore.get( + createStoreGetter(stateStore), + validatorAddress, + ); + const stakerData = await stakerStore.getOrDefault( + createStoreGetter(stateStore), + senderAddress, + ); + + // Assert + expect(validatorData.totalStakeReceived).toEqual( + senderStakeAmountPositive - senderStakeAmountNegative + validatorSelfStake, + ); + expect(validatorData.selfStake).toEqual(validatorSelfStake); + expect(stakerData.sentStakes).toHaveLength(1); + expect(stakerData.sentStakes).toEqual([ + { + validatorAddress, + amount: senderStakeAmountPositive - senderStakeAmountNegative, + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + }, + ]); + expect(stakerData.pendingUnlocks).toHaveLength(1); + expect(stakerData.pendingUnlocks).toEqual([ + { + validatorAddress, + amount: senderStakeAmountNegative, + unstakeHeight: lastBlockHeight + 1, + }, + ]); + }); + }); + }); +}); diff --git a/framework/test/unit/modules/dpos_v2/commands/unlock.spec.ts b/framework/test/unit/modules/pos/commands/unlock.spec.ts similarity index 51% rename from framework/test/unit/modules/dpos_v2/commands/unlock.spec.ts rename to framework/test/unit/modules/pos/commands/unlock.spec.ts index 673b3af0e94..4d439948c4d 100644 --- a/framework/test/unit/modules/dpos_v2/commands/unlock.spec.ts +++ b/framework/test/unit/modules/pos/commands/unlock.spec.ts @@ -18,34 +18,34 @@ import * as testing from '../../../../../src/testing'; import { UnlockCommand, CommandExecuteContext, - DPoSModule, + PoSModule, CommandVerifyContext, } from '../../../../../src'; import { defaultConfig, EMPTY_KEY, - PUNISHMENT_WINDOW_SELF_VOTES, - PUNISHMENT_WINDOW_VOTES, - LOCKING_PERIOD_SELF_VOTES, - LOCKING_PERIOD_VOTES, -} from '../../../../../src/modules/dpos_v2/constants'; -import { TokenMethod, UnlockingObject, VoterData } from '../../../../../src/modules/dpos_v2/types'; + PUNISHMENT_WINDOW_SELF_STAKES, + PUNISHMENT_WINDOW_STAKES, + LOCKING_PERIOD_SELF_STAKES, + LOCKING_PERIOD_STAKES, +} from '../../../../../src/modules/pos/constants'; +import { TokenMethod, UnlockingObject, StakerData } from '../../../../../src/modules/pos/types'; import { liskToBeddows } from '../../../../utils/assets'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { InMemoryPrefixedStateDB } from '../../../../../src/testing'; -import { DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; -import { VoterStore } from '../../../../../src/modules/dpos_v2/stores/voter'; +import { ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; +import { StakerStore } from '../../../../../src/modules/pos/stores/staker'; import { createStoreGetter } from '../../../../../src/testing/utils'; -import { GenesisDataStore } from '../../../../../src/modules/dpos_v2/stores/genesis'; +import { GenesisDataStore } from '../../../../../src/modules/pos/stores/genesis'; import { VerifyStatus } from '../../../../../src/state_machine'; describe('UnlockCommand', () => { - const dpos = new DPoSModule(); + const pos = new PoSModule(); let unlockCommand: UnlockCommand; let stateStore: PrefixedStateReadWriter; - let delegateSubstore: DelegateStore; - let voterSubstore: VoterStore; + let validatorSubstore: ValidatorStore; + let stakerSubstore: StakerStore; let genesisSubstore: GenesisDataStore; let mockTokenMethod: TokenMethod; let blockHeight: number; @@ -56,30 +56,30 @@ describe('UnlockCommand', () => { let nonUnlockableObject: UnlockingObject; let context: CommandExecuteContext; let verifyContext: CommandVerifyContext; - let storedData: VoterData; - const delegate1 = { - name: 'delegate1', + let storedData: StakerData; + const validator1 = { + name: 'validator1', address: utils.getRandomBytes(32), amount: liskToBeddows(100), }; - const delegate2 = { - name: 'delegate2', + const validator2 = { + name: 'validator2', address: utils.getRandomBytes(32), amount: liskToBeddows(200), }; - const delegate3 = { - name: 'delegate3', + const validator3 = { + name: 'validator3', address: utils.getRandomBytes(32), amount: liskToBeddows(300), }; - const delegate4 = { - name: 'delegate4', + const validator4 = { + name: 'validator4', address: utils.getRandomBytes(32), amount: liskToBeddows(400), }; - const defaultDelegateInfo = { - totalVotesReceived: BigInt(100000000), - selfVotes: BigInt(0), + const defaultValidatorInfo = { + totalStakeReceived: BigInt(100000000), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [], @@ -90,7 +90,7 @@ describe('UnlockCommand', () => { }; const publicKey = utils.getRandomBytes(32); const transaction = new Transaction({ - module: 'dpos', + module: 'pos', command: 'unlock', senderPublicKey: publicKey, nonce: BigInt(0), @@ -104,7 +104,7 @@ describe('UnlockCommand', () => { ); beforeEach(() => { - unlockCommand = new UnlockCommand(dpos.stores, dpos.events); + unlockCommand = new UnlockCommand(pos.stores, pos.events); mockTokenMethod = { lock: jest.fn(), unlock: jest.fn(), @@ -118,12 +118,12 @@ describe('UnlockCommand', () => { }); unlockCommand.init({ roundLength: defaultConfig.roundLength, - governanceTokenID: Buffer.alloc(8), + posTokenID: Buffer.alloc(8), }); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateSubstore = dpos.stores.get(DelegateStore); - voterSubstore = dpos.stores.get(VoterStore); - genesisSubstore = dpos.stores.get(GenesisDataStore); + validatorSubstore = pos.stores.get(ValidatorStore); + stakerSubstore = pos.stores.get(StakerStore); + genesisSubstore = pos.stores.get(GenesisDataStore); blockHeight = 8760000; header = testing.createFakeBlockHeader({ height: blockHeight, @@ -153,7 +153,7 @@ describe('UnlockCommand', () => { it('should return an error if transaction params are not empty', async () => { const transactionX = new Transaction({ - module: 'dpos', + module: 'pos', command: 'unlock', senderPublicKey: publicKey, nonce: BigInt(0), @@ -182,38 +182,38 @@ describe('UnlockCommand', () => { }); }); - describe(`when non self-voted non-punished account waits ${LOCKING_PERIOD_VOTES} blocks since unvoteHeight`, () => { + describe(`when non self-staked non-punished account waits ${LOCKING_PERIOD_STAKES} blocks since unstakeHeight`, () => { beforeEach(async () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate1.address, { - name: delegate1.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator1.address, { + name: validator1.name, + ...defaultValidatorInfo, }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate2.address, { - name: delegate2.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator2.address, { + name: validator2.name, + ...defaultValidatorInfo, }); unlockableObject = { - delegateAddress: delegate1.address, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_VOTES, + validatorAddress: validator1.address, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_STAKES, }; nonUnlockableObject = { - delegateAddress: delegate2.address, - amount: delegate2.amount, - unvoteHeight: blockHeight, + validatorAddress: validator2.address, + amount: validator2.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, + validatorAddress: unlockableObject.validatorAddress, amount: unlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [unlockableObject, nonUnlockableObject], @@ -227,53 +227,53 @@ describe('UnlockCommand', () => { }) .createCommandExecuteContext(); await unlockCommand.execute(context); - storedData = await voterSubstore.get( + storedData = await stakerSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); }); - it('should remove eligible pending unlock from voter substore', () => { + it('should remove eligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject); }); - it('should not remove ineligible pending unlock from voter substore', () => { + it('should not remove ineligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).toContainEqual(nonUnlockableObject); }); }); - describe(`when self-voted non-punished account waits ${LOCKING_PERIOD_SELF_VOTES} blocks since unvoteHeight`, () => { + describe(`when self-staked non-punished account waits ${LOCKING_PERIOD_SELF_STAKES} blocks since unstakeHeight`, () => { beforeEach(async () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - ...defaultDelegateInfo, - name: 'nonpunishedselfvoter', + await validatorSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + ...defaultValidatorInfo, + name: 'nonpunishedselfstaker', }); unlockableObject = { - delegateAddress: transaction.senderAddress, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_SELF_VOTES, + validatorAddress: transaction.senderAddress, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_SELF_STAKES, }; nonUnlockableObject = { - delegateAddress: transaction.senderAddress, - amount: delegate2.amount, - unvoteHeight: blockHeight, + validatorAddress: transaction.senderAddress, + amount: validator2.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, - amount: delegate1.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + validatorAddress: unlockableObject.validatorAddress, + amount: validator1.amount, + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, { - delegateAddress: nonUnlockableObject.delegateAddress, - amount: delegate2.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + validatorAddress: nonUnlockableObject.validatorAddress, + amount: validator2.amount, + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [unlockableObject, nonUnlockableObject], @@ -287,91 +287,91 @@ describe('UnlockCommand', () => { }) .createCommandExecuteContext(); await unlockCommand.execute(context); - storedData = await voterSubstore.get( + storedData = await stakerSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); }); - it('should remove eligible pending unlock from voter substore', () => { + it('should remove eligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject); }); - it('should not remove ineligible pending unlock from voter substore', () => { + it('should not remove ineligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).toContainEqual(nonUnlockableObject); }); }); - describe(`when non self-voted punished account waits ${PUNISHMENT_WINDOW_VOTES} blocks and unvoteHeight + ${LOCKING_PERIOD_VOTES} blocks since last pomHeight`, () => { + describe(`when non self-staked punished account waits ${PUNISHMENT_WINDOW_STAKES} blocks and unstakeHeight + ${LOCKING_PERIOD_STAKES} blocks since last pomHeight`, () => { beforeEach(async () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate1.address, { - ...defaultDelegateInfo, - name: 'punishedvoter1', - pomHeights: [blockHeight - PUNISHMENT_WINDOW_VOTES], + await validatorSubstore.set(createStoreGetter(stateStore), validator1.address, { + ...defaultValidatorInfo, + name: 'punishedstaker1', + pomHeights: [blockHeight - PUNISHMENT_WINDOW_STAKES], }); - // This covers scenario: has not waited pomHeight + 260,000 blocks but waited unvoteHeight + 2000 blocks and pomHeight is more than unvoteHeight + 2000 blocks - await delegateSubstore.set(createStoreGetter(stateStore), delegate2.address, { - ...defaultDelegateInfo, - name: 'punishedvoter2', + // This covers scenario: has not waited pomHeight + 260,000 blocks but waited unstakeHeight + 2000 blocks and pomHeight is more than unstakeHeight + 2000 blocks + await validatorSubstore.set(createStoreGetter(stateStore), validator2.address, { + ...defaultValidatorInfo, + name: 'punishedstaker2', pomHeights: [blockHeight], }); - // This covers scenario: has not waited pomHeight + 260,000 blocks but waited unvoteHeight + 2000 blocks and pomHeight is equal to unvoteHeight + 2000 blocks - await delegateSubstore.set(createStoreGetter(stateStore), delegate3.address, { - ...defaultDelegateInfo, - name: 'punishedvoter3', + // This covers scenario: has not waited pomHeight + 260,000 blocks but waited unstakeHeight + 2000 blocks and pomHeight is equal to unstakeHeight + 2000 blocks + await validatorSubstore.set(createStoreGetter(stateStore), validator3.address, { + ...defaultValidatorInfo, + name: 'punishedstaker3', pomHeights: [blockHeight - 1000], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate4.address, { - ...defaultDelegateInfo, - name: 'punishedvoter4', - pomHeights: [blockHeight - PUNISHMENT_WINDOW_VOTES], + await validatorSubstore.set(createStoreGetter(stateStore), validator4.address, { + ...defaultValidatorInfo, + name: 'punishedstaker4', + pomHeights: [blockHeight - PUNISHMENT_WINDOW_STAKES], }); unlockableObject = { - delegateAddress: delegate1.address, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_VOTES, + validatorAddress: validator1.address, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_STAKES, }; unlockableObject2 = { - delegateAddress: delegate2.address, - amount: delegate2.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_VOTES - 1000, + validatorAddress: validator2.address, + amount: validator2.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_STAKES - 1000, }; unlockableObject3 = { - delegateAddress: delegate3.address, - amount: delegate3.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_VOTES - 1000, + validatorAddress: validator3.address, + amount: validator3.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_STAKES - 1000, }; nonUnlockableObject = { - delegateAddress: delegate4.address, - amount: delegate4.amount, - unvoteHeight: blockHeight, + validatorAddress: validator4.address, + amount: validator4.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, + validatorAddress: unlockableObject.validatorAddress, amount: unlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, { - delegateAddress: unlockableObject2.delegateAddress, + validatorAddress: unlockableObject2.validatorAddress, amount: unlockableObject2.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, { - delegateAddress: unlockableObject3.delegateAddress, + validatorAddress: unlockableObject3.validatorAddress, amount: unlockableObject3.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, { - delegateAddress: nonUnlockableObject.delegateAddress, + validatorAddress: nonUnlockableObject.validatorAddress, amount: nonUnlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [ @@ -390,56 +390,56 @@ describe('UnlockCommand', () => { }) .createCommandExecuteContext(); await unlockCommand.execute(context); - storedData = await voterSubstore.get( + storedData = await stakerSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); }); - it('should remove eligible pending unlock from voter substore', () => { + it('should remove eligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject); expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject2); expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject3); }); - it('should not remove ineligible pending unlock from voter substore', () => { + it('should not remove ineligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).toContainEqual(nonUnlockableObject); }); }); - describe(`when self-voted punished account waits ${PUNISHMENT_WINDOW_SELF_VOTES} blocks and waits unvoteHeight + ${LOCKING_PERIOD_SELF_VOTES} blocks since pomHeight`, () => { + describe(`when self-staked punished account waits ${PUNISHMENT_WINDOW_SELF_STAKES} blocks and waits unstakeHeight + ${LOCKING_PERIOD_SELF_STAKES} blocks since pomHeight`, () => { beforeEach(async () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - ...defaultDelegateInfo, - name: 'punishedselfvoter', - pomHeights: [blockHeight - PUNISHMENT_WINDOW_SELF_VOTES], + await validatorSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + ...defaultValidatorInfo, + name: 'punishedselfstaker', + pomHeights: [blockHeight - PUNISHMENT_WINDOW_SELF_STAKES], }); unlockableObject = { - delegateAddress: transaction.senderAddress, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_SELF_VOTES, + validatorAddress: transaction.senderAddress, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_SELF_STAKES, }; nonUnlockableObject = { - delegateAddress: transaction.senderAddress, - amount: delegate2.amount, - unvoteHeight: blockHeight, + validatorAddress: transaction.senderAddress, + amount: validator2.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, + validatorAddress: unlockableObject.validatorAddress, amount: unlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, { - delegateAddress: nonUnlockableObject.delegateAddress, + validatorAddress: nonUnlockableObject.validatorAddress, amount: nonUnlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [unlockableObject, nonUnlockableObject], @@ -453,44 +453,44 @@ describe('UnlockCommand', () => { }) .createCommandExecuteContext(); await unlockCommand.execute(context); - storedData = await voterSubstore.get( + storedData = await stakerSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); }); - it('should remove eligible pending unlock from voter substore', () => { + it('should remove eligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject); }); - it('should not remove ineligible pending unlock from voter substore', () => { + it('should not remove ineligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).toContainEqual(nonUnlockableObject); }); }); - describe(`when self-voted punished account does not wait ${PUNISHMENT_WINDOW_SELF_VOTES} blocks and waits unvoteHeight + ${LOCKING_PERIOD_SELF_VOTES} blocks since pomHeight`, () => { + describe(`when self-staked punished account does not wait ${PUNISHMENT_WINDOW_SELF_STAKES} blocks and waits unstakeHeight + ${LOCKING_PERIOD_SELF_STAKES} blocks since pomHeight`, () => { beforeEach(async () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - ...defaultDelegateInfo, - name: 'punishedselfvoter', + await validatorSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + ...defaultValidatorInfo, + name: 'punishedselfstaker', pomHeights: [blockHeight - 1], }); nonUnlockableObject = { - delegateAddress: transaction.senderAddress, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_SELF_VOTES, + validatorAddress: transaction.senderAddress, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_SELF_STAKES, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: nonUnlockableObject.delegateAddress, + validatorAddress: nonUnlockableObject.validatorAddress, amount: nonUnlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [nonUnlockableObject], @@ -507,7 +507,7 @@ describe('UnlockCommand', () => { it('should throw error', async () => { await expect(unlockCommand.execute(context)).rejects.toThrow( - 'No eligible voter data was found for unlocking', + 'No eligible staker data was found for unlocking', ); }); }); @@ -517,34 +517,34 @@ describe('UnlockCommand', () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 10, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate1.address, { - name: delegate1.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator1.address, { + name: validator1.name, + ...defaultValidatorInfo, }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate2.address, { - name: delegate2.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator2.address, { + name: validator2.name, + ...defaultValidatorInfo, }); nonUnlockableObject = { - delegateAddress: delegate2.address, - amount: delegate2.amount, - unvoteHeight: blockHeight, + validatorAddress: validator2.address, + amount: validator2.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, + validatorAddress: unlockableObject.validatorAddress, amount: unlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [nonUnlockableObject], }); }); - it('should not unlock any votes', async () => { + it('should not unlock any stakes', async () => { // Arrange context = testing .createTransactionContext({ @@ -563,7 +563,7 @@ describe('UnlockCommand', () => { .createCommandExecuteContext(); await expect(unlockCommand.execute(context)).rejects.toThrow( - 'No eligible voter data was found for unlocking', + 'No eligible staker data was found for unlocking', ); }); }); @@ -573,33 +573,33 @@ describe('UnlockCommand', () => { await genesisSubstore.set(createStoreGetter(stateStore), EMPTY_KEY, { height: 8760000, initRounds: 1, - initDelegates: [], + initValidators: [], }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate1.address, { - name: delegate1.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator1.address, { + name: validator1.name, + ...defaultValidatorInfo, }); - await delegateSubstore.set(createStoreGetter(stateStore), delegate2.address, { - name: delegate2.name, - ...defaultDelegateInfo, + await validatorSubstore.set(createStoreGetter(stateStore), validator2.address, { + name: validator2.name, + ...defaultValidatorInfo, }); unlockableObject = { - delegateAddress: delegate1.address, - amount: delegate1.amount, - unvoteHeight: blockHeight - LOCKING_PERIOD_VOTES, + validatorAddress: validator1.address, + amount: validator1.amount, + unstakeHeight: blockHeight - LOCKING_PERIOD_STAKES, }; nonUnlockableObject = { - delegateAddress: delegate2.address, - amount: delegate2.amount, - unvoteHeight: blockHeight, + validatorAddress: validator2.address, + amount: validator2.amount, + unstakeHeight: blockHeight, }; - await voterSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { - sentVotes: [ + await stakerSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + sentStakes: [ { - delegateAddress: unlockableObject.delegateAddress, + validatorAddress: unlockableObject.validatorAddress, amount: unlockableObject.amount, - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [unlockableObject, nonUnlockableObject], @@ -613,17 +613,17 @@ describe('UnlockCommand', () => { }) .createCommandExecuteContext(); await unlockCommand.execute(context); - storedData = await voterSubstore.get( + storedData = await stakerSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); }); - it('should remove eligible pending unlock from voter substore', () => { + it('should remove eligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).not.toContainEqual(unlockableObject); }); - it('should not remove ineligible pending unlock from voter substore', () => { + it('should not remove ineligible pending unlock from staker substore', () => { expect(storedData.pendingUnlocks).toContainEqual(nonUnlockableObject); }); }); diff --git a/framework/test/unit/modules/dpos_v2/commands/delegate_registration.spec.ts b/framework/test/unit/modules/pos/commands/validator_registration.spec.ts similarity index 60% rename from framework/test/unit/modules/dpos_v2/commands/delegate_registration.spec.ts rename to framework/test/unit/modules/pos/commands/validator_registration.spec.ts index 63ec4765281..79fc3358f6b 100644 --- a/framework/test/unit/modules/dpos_v2/commands/delegate_registration.spec.ts +++ b/framework/test/unit/modules/pos/commands/validator_registration.spec.ts @@ -16,33 +16,33 @@ import { Transaction } from '@liskhq/lisk-chain'; import { codec } from '@liskhq/lisk-codec'; import { utils } from '@liskhq/lisk-cryptography'; import * as testing from '../../../../../src/testing'; -import { DelegateRegistrationCommand } from '../../../../../src/modules/dpos_v2/commands/delegate_registration'; -import { delegateRegistrationCommandParamsSchema } from '../../../../../src/modules/dpos_v2/schemas'; +import { RegisterValidatorCommand } from '../../../../../src/modules/pos/commands/register_validator'; +import { validatorRegistrationCommandParamsSchema } from '../../../../../src/modules/pos/schemas'; import { - DelegateRegistrationParams, + ValidatorRegistrationParams, TokenMethod, ValidatorsMethod, -} from '../../../../../src/modules/dpos_v2/types'; +} from '../../../../../src/modules/pos/types'; import { EventQueue, VerifyStatus } from '../../../../../src/state_machine'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { InMemoryPrefixedStateDB } from '../../../../../src/testing/in_memory_prefixed_state'; -import { DelegateStore } from '../../../../../src/modules/dpos_v2/stores/delegate'; -import { NameStore } from '../../../../../src/modules/dpos_v2/stores/name'; -import { DPoSModule } from '../../../../../src'; +import { ValidatorStore } from '../../../../../src/modules/pos/stores/validator'; +import { NameStore } from '../../../../../src/modules/pos/stores/name'; +import { PoSModule } from '../../../../../src'; import { createStoreGetter } from '../../../../../src/testing/utils'; import { COMMISSION, - DELEGATE_REGISTRATION_FEE, + VALIDATOR_REGISTRATION_FEE, TOKEN_ID_FEE, -} from '../../../../../src/modules/dpos_v2/constants'; -import { DelegateRegisteredEvent } from '../../../../../src/modules/dpos_v2/events/delegate_registered'; +} from '../../../../../src/modules/pos/constants'; +import { ValidatorRegisteredEvent } from '../../../../../src/modules/pos/events/validator_registered'; -describe('Delegate registration command', () => { - const dpos = new DPoSModule(); - let delegateRegistrationCommand: DelegateRegistrationCommand; - let delegateRegisteredEvent: DelegateRegisteredEvent; +describe('Validator registration command', () => { + const pos = new PoSModule(); + let validatorRegistrationCommand: RegisterValidatorCommand; + let validatorRegisteredEvent: ValidatorRegisteredEvent; let stateStore: PrefixedStateReadWriter; - let delegateSubstore: DelegateStore; + let validatorSubstore: ValidatorStore; let nameSubstore: NameStore; let mockTokenMethod: TokenMethod; let mockValidatorsMethod: ValidatorsMethod; @@ -52,12 +52,12 @@ describe('Delegate registration command', () => { generatorKey: utils.getRandomBytes(32), blsKey: utils.getRandomBytes(48), proofOfPossession: utils.getRandomBytes(96), - delegateRegistrationFee: DELEGATE_REGISTRATION_FEE, + validatorRegistrationFee: VALIDATOR_REGISTRATION_FEE, }; - const defaultDelegateInfo = { + const defaultValidatorInfo = { name: transactionParams.name, - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [], @@ -67,13 +67,13 @@ describe('Delegate registration command', () => { sharingCoefficients: [], }; const encodedTransactionParams = codec.encode( - delegateRegistrationCommandParamsSchema, + validatorRegistrationCommandParamsSchema, transactionParams, ); const publicKey = utils.getRandomBytes(32); const transaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -106,10 +106,10 @@ describe('Delegate registration command', () => { }; beforeEach(() => { - delegateRegistrationCommand = new DelegateRegistrationCommand(dpos.stores, dpos.events); - delegateRegistrationCommand.init({ + validatorRegistrationCommand = new RegisterValidatorCommand(pos.stores, pos.events); + validatorRegistrationCommand.init({ tokenIDFee: TOKEN_ID_FEE, - delegateRegistrationFee: DELEGATE_REGISTRATION_FEE, + validatorRegistrationFee: VALIDATOR_REGISTRATION_FEE, }); mockTokenMethod = { lock: jest.fn(), @@ -126,13 +126,13 @@ describe('Delegate registration command', () => { getGeneratorsBetweenTimestamps: jest.fn(), setValidatorsParams: jest.fn(), }; - delegateRegistrationCommand.addDependencies(mockTokenMethod, mockValidatorsMethod); + validatorRegistrationCommand.addDependencies(mockTokenMethod, mockValidatorsMethod); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateSubstore = dpos.stores.get(DelegateStore); - nameSubstore = dpos.stores.get(NameStore); + validatorSubstore = pos.stores.get(ValidatorStore); + nameSubstore = pos.stores.get(NameStore); - delegateRegisteredEvent = dpos.events.get(DelegateRegisteredEvent); - jest.spyOn(delegateRegisteredEvent, 'log'); + validatorRegisteredEvent = pos.events.get(ValidatorRegisteredEvent); + jest.spyOn(validatorRegisteredEvent, 'log'); }); describe('verify', () => { @@ -142,22 +142,22 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.OK); }); it('should return error if name is invalid', async () => { - const invalidParams = codec.encode(delegateRegistrationCommandParamsSchema, { + const invalidParams = codec.encode(validatorRegistrationCommandParamsSchema, { ...transactionParams, name: '*@#&$_2', }); const invalidTransaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -169,23 +169,23 @@ describe('Delegate registration command', () => { transaction: invalidTransaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude("'name' is in an unsupported format"); }); it('should return error if generatorKey is invalid', async () => { - const invalidParams = codec.encode(delegateRegistrationCommandParamsSchema, { + const invalidParams = codec.encode(validatorRegistrationCommandParamsSchema, { ...transactionParams, generatorKey: utils.getRandomBytes(64), }); const invalidTransaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -197,23 +197,23 @@ describe('Delegate registration command', () => { transaction: invalidTransaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude("Property '.generatorKey' maxLength exceeded"); }); it('should return error if blsKey is invalid', async () => { - const invalidParams = codec.encode(delegateRegistrationCommandParamsSchema, { + const invalidParams = codec.encode(validatorRegistrationCommandParamsSchema, { ...transactionParams, blsKey: utils.getRandomBytes(64), }); const invalidTransaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -225,23 +225,23 @@ describe('Delegate registration command', () => { transaction: invalidTransaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude("Property '.blsKey' maxLength exceeded"); }); it('should return error if proofOfPossession is invalid', async () => { - const invalidParams = codec.encode(delegateRegistrationCommandParamsSchema, { + const invalidParams = codec.encode(validatorRegistrationCommandParamsSchema, { ...transactionParams, proofOfPossession: utils.getRandomBytes(64), }); const invalidTransaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -253,10 +253,10 @@ describe('Delegate registration command', () => { transaction: invalidTransaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude("'.proofOfPossession' minLength not satisfied"); @@ -266,7 +266,7 @@ describe('Delegate registration command', () => { await nameSubstore.set( createStoreGetter(stateStore), Buffer.from(transactionParams.name, 'utf8'), - { delegateAddress: transaction.senderAddress }, + { validatorAddress: transaction.senderAddress }, ); const context = testing .createTransactionContext({ @@ -274,10 +274,10 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude( @@ -285,11 +285,11 @@ describe('Delegate registration command', () => { ); }); - it('should return error if store key address already exists in delegate store', async () => { - await delegateSubstore.set( + it('should return error if store key address already exists in validator store', async () => { + await validatorSubstore.set( createStoreGetter(stateStore), transaction.senderAddress, - defaultDelegateInfo, + defaultValidatorInfo, ); const context = testing .createTransactionContext({ @@ -297,27 +297,30 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude( - 'Delegate substore must not have an entry for the store key address', + 'Validator substore must not have an entry for the store key address', ); }); - it('should return error if delegate registration fee is different from what is required in config', async () => { - const invalidTransactionParams = { ...transactionParams, delegateRegistrationFee: BigInt(0) }; + it('should return error if validator registration fee is different from what is required in config', async () => { + const invalidTransactionParams = { + ...transactionParams, + validatorRegistrationFee: BigInt(0), + }; const encodedInvalidTransactionParams = codec.encode( - delegateRegistrationCommandParamsSchema, + validatorRegistrationCommandParamsSchema, invalidTransactionParams, ); const invalidTransaction = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', senderPublicKey: publicKey, nonce: BigInt(0), fee: BigInt(100000000), @@ -325,10 +328,10 @@ describe('Delegate registration command', () => { signatures: [publicKey], }); - await delegateSubstore.set( + await validatorSubstore.set( createStoreGetter(stateStore), invalidTransaction.senderAddress, - defaultDelegateInfo, + defaultValidatorInfo, ); const context = testing .createTransactionContext({ @@ -336,31 +339,31 @@ describe('Delegate registration command', () => { transaction: invalidTransaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); - expect(result.error?.message).toInclude('Invalid delegate registration fee.'); + expect(result.error?.message).toInclude('Invalid validator registration fee.'); }); it('should return error if account does not have enough balance for the registration fee', async () => { mockTokenMethod.getAvailableBalance = jest .fn() - .mockResolvedValue(DELEGATE_REGISTRATION_FEE - BigInt(1)); - delegateRegistrationCommand = new DelegateRegistrationCommand(dpos.stores, dpos.events); - delegateRegistrationCommand.init({ + .mockResolvedValue(VALIDATOR_REGISTRATION_FEE - BigInt(1)); + validatorRegistrationCommand = new RegisterValidatorCommand(pos.stores, pos.events); + validatorRegistrationCommand.init({ tokenIDFee: TOKEN_ID_FEE, - delegateRegistrationFee: DELEGATE_REGISTRATION_FEE, + validatorRegistrationFee: VALIDATOR_REGISTRATION_FEE, }); - delegateRegistrationCommand.addDependencies(mockTokenMethod, mockValidatorsMethod); + validatorRegistrationCommand.addDependencies(mockTokenMethod, mockValidatorsMethod); - await delegateSubstore.set( + await validatorSubstore.set( createStoreGetter(stateStore), transaction.senderAddress, - defaultDelegateInfo, + defaultValidatorInfo, ); const context = testing .createTransactionContext({ @@ -368,15 +371,15 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandVerifyContext( - delegateRegistrationCommandParamsSchema, + .createCommandVerifyContext( + validatorRegistrationCommandParamsSchema, ); - const result = await delegateRegistrationCommand.verify(context); + const result = await validatorRegistrationCommand.verify(context); expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude( - 'Not sufficient amount for delegate registration fee.', + 'Not sufficient amount for validator registration fee.', ); }); }); @@ -388,10 +391,10 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandExecuteContext( - delegateRegistrationCommandParamsSchema, + .createCommandExecuteContext( + validatorRegistrationCommandParamsSchema, ); - await delegateRegistrationCommand.execute(context); + await validatorRegistrationCommand.execute(context); expect(mockValidatorsMethod.registerValidatorKeys).toHaveBeenCalledWith( expect.anything(), @@ -411,74 +414,74 @@ describe('Delegate registration command', () => { transaction, chainID, }) - .createCommandExecuteContext( - delegateRegistrationCommandParamsSchema, + .createCommandExecuteContext( + validatorRegistrationCommandParamsSchema, ); - await expect(delegateRegistrationCommand.execute(context)).rejects.toThrow( + await expect(validatorRegistrationCommand.execute(context)).rejects.toThrow( 'Failed to register validator keys', ); }); - it('should set delegate info in delegate substore', async () => { + it('should set validator info in validator substore', async () => { const context = testing .createTransactionContext({ stateStore, transaction, chainID, }) - .createCommandExecuteContext( - delegateRegistrationCommandParamsSchema, + .createCommandExecuteContext( + validatorRegistrationCommandParamsSchema, ); - await delegateRegistrationCommand.execute(context); - const storedData = await delegateSubstore.get( + await validatorRegistrationCommand.execute(context); + const storedData = await validatorSubstore.get( createStoreGetter(stateStore), transaction.senderAddress, ); - expect(storedData).toEqual(defaultDelegateInfo); + expect(storedData).toEqual(defaultValidatorInfo); }); - it('should set delegate name in name substore', async () => { + it('should set validator name in name substore', async () => { const context = testing .createTransactionContext({ stateStore, transaction, chainID, }) - .createCommandExecuteContext( - delegateRegistrationCommandParamsSchema, + .createCommandExecuteContext( + validatorRegistrationCommandParamsSchema, ); - await delegateRegistrationCommand.execute(context); + await validatorRegistrationCommand.execute(context); const storedData = await nameSubstore.get( context, Buffer.from(transactionParams.name, 'utf8'), ); - expect(storedData.delegateAddress).toEqual(transaction.senderAddress); + expect(storedData.validatorAddress).toEqual(transaction.senderAddress); }); - it('should emit an event when a delegate is registered', async () => { + it('should emit an event when a validator is registered', async () => { const context = testing .createTransactionContext({ stateStore, transaction, chainID, }) - .createCommandExecuteContext( - delegateRegistrationCommandParamsSchema, + .createCommandExecuteContext( + validatorRegistrationCommandParamsSchema, ); - await delegateRegistrationCommand.execute(context); + await validatorRegistrationCommand.execute(context); // check if the event has been dispatched correctly - expect(delegateRegisteredEvent.log).toHaveBeenCalledWith(expect.anything(), { + expect(validatorRegisteredEvent.log).toHaveBeenCalledWith(expect.anything(), { address: transaction.senderAddress, name: transactionParams.name, }); // check if the event is in the event queue - checkEventResult(context.eventQueue, DelegateRegisteredEvent, 'dpos', { + checkEventResult(context.eventQueue, ValidatorRegisteredEvent, 'pos', { address: transaction.senderAddress, name: transactionParams.name, }); diff --git a/framework/test/unit/modules/pos/endpoint.spec.ts b/framework/test/unit/modules/pos/endpoint.spec.ts new file mode 100644 index 00000000000..18e91dd0cf8 --- /dev/null +++ b/framework/test/unit/modules/pos/endpoint.spec.ts @@ -0,0 +1,675 @@ +/* + * Copyright © 2021 Lisk Foundation + * + * See the LICENSE file at the top-level directory of this distribution + * for licensing information. + * + * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, + * no part of this software, including this file, may be copied, modified, + * propagated, or distributed except according to the terms contained in the + * LICENSE file. + * + * Removal or modification of this copyright notice is prohibited. + */ + +import { address as cryptoAddress, utils } from '@liskhq/lisk-cryptography'; +import { codec } from '@liskhq/lisk-codec'; +import { math } from '@liskhq/lisk-utils'; +import { + defaultConfig, + EMPTY_KEY, + PUNISHMENT_WINDOW_STAKES, + LOCKING_PERIOD_SELF_STAKES, + LOCKING_PERIOD_STAKES, +} from '../../../../src/modules/pos/constants'; +import { PoSEndpoint } from '../../../../src/modules/pos/endpoint'; +import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; +import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; +import { + ModuleConfig, + StakerData, + StakeSharingCoefficient, +} from '../../../../src/modules/pos/types'; +import { PoSModule } from '../../../../src'; +import { StakerStore, stakerStoreSchema } from '../../../../src/modules/pos/stores/staker'; +import { ValidatorStore } from '../../../../src/modules/pos/stores/validator'; +import { createStoreGetter } from '../../../../src/testing/utils'; +import { + createFakeBlockHeader, + createTransientModuleEndpointContext, +} from '../../../../src/testing'; +import { GenesisDataStore } from '../../../../src/modules/pos/stores/genesis'; +import { EligibleValidatorsStore } from '../../../../src/modules/pos/stores/eligible_validators'; +import { calculateStakeRewards } from '../../../../src/modules/pos/utils'; + +const { q96 } = math; + +describe('PosModuleEndpoint', () => { + const pos = new PoSModule(); + + let posEndpoint: PoSEndpoint; + let stateStore: PrefixedStateReadWriter; + let stakerSubStore: StakerStore; + let validatorSubStore: ValidatorStore; + let genesisSubStore: GenesisDataStore; + let eligibleValidatorsSubStore: EligibleValidatorsStore; + + const address = utils.getRandomBytes(20); + const address1 = utils.getRandomBytes(20); + const address2 = utils.getRandomBytes(20); + + const addressStaker = utils.getRandomBytes(20); + const stakerData: StakerData = { + sentStakes: [ + { + validatorAddress: utils.getRandomBytes(20), + amount: BigInt(0), + stakeSharingCoefficients: [], + }, + ], + pendingUnlocks: [ + { + validatorAddress: utils.getRandomBytes(20), + amount: BigInt(0), + unstakeHeight: 0, + }, + ], + }; + + const token1 = Buffer.from('1000000000000010', 'hex'); + const token2 = Buffer.from('1000000000000020', 'hex'); + const stakerCoefficient1 = q96(2).toBuffer(); + const stakerCoefficient2 = q96(5).toBuffer(); + const validatorCoefficient1 = q96(3).toBuffer(); + const validatorCoefficient2 = q96(6).toBuffer(); + + const stakerSharingCoefficient1: StakeSharingCoefficient = { + tokenID: token1, + coefficient: stakerCoefficient1, + }; + const stakerSharingCoefficient2: StakeSharingCoefficient = { + tokenID: token2, + coefficient: stakerCoefficient2, + }; + const validatorSharingCoefficient1: StakeSharingCoefficient = { + tokenID: token1, + coefficient: validatorCoefficient1, + }; + const validatorSharingCoefficient2: StakeSharingCoefficient = { + tokenID: token2, + coefficient: validatorCoefficient2, + }; + + const validatorData = { + name: 'validator1', + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), + lastGeneratedHeight: 0, + isBanned: false, + pomHeights: [0], + consecutiveMissedBlocks: 0, + address: cryptoAddress.getLisk32AddressFromAddress(address), + commission: 0, + lastCommissionIncreaseHeight: 0, + sharingCoefficients: [validatorSharingCoefficient1, validatorSharingCoefficient2], + }; + + const config: ModuleConfig = { + ...defaultConfig, + minWeightStandby: BigInt(defaultConfig.minWeightStandby), + posTokenID: Buffer.from('1000000000000002', 'hex'), + tokenIDFee: Buffer.from(defaultConfig.tokenIDFee, 'hex'), + validatorRegistrationFee: BigInt(defaultConfig.validatorRegistrationFee), + }; + + beforeEach(() => { + posEndpoint = new PoSEndpoint(pos.stores, pos.offchainStores); + posEndpoint.init('pos', config, { + getAvailableBalance: jest.fn(), + getLockedAmount: jest.fn(), + burn: jest.fn(), + lock: jest.fn(), + transfer: jest.fn(), + unlock: jest.fn(), + }); + stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); + stakerSubStore = pos.stores.get(StakerStore); + validatorSubStore = pos.stores.get(ValidatorStore); + genesisSubStore = pos.stores.get(GenesisDataStore); + eligibleValidatorsSubStore = pos.stores.get(EligibleValidatorsStore); + }); + + describe('getStaker', () => { + describe('when input address is valid', () => { + it('should return correct staker data corresponding to the input address', async () => { + await stakerSubStore.set(createStoreGetter(stateStore), address, stakerData); + const stakerDataReturned = await posEndpoint.getStaker( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ); + + expect(stakerDataReturned).toStrictEqual(codec.toJSON(stakerStoreSchema, stakerData)); + }); + + it('should return valid JSON output', async () => { + await stakerSubStore.set(createStoreGetter(stateStore), address, stakerData); + const stakerDataReturned = await posEndpoint.getStaker( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ); + + expect(stakerDataReturned.sentStakes[0].validatorAddress).toBeString(); + expect(stakerDataReturned.sentStakes[0].amount).toBeString(); + expect(stakerDataReturned.pendingUnlocks[0].validatorAddress).toBeString(); + expect(stakerDataReturned.pendingUnlocks[0].amount).toBeString(); + }); + }); + }); + + describe('getValidator', () => { + describe('when input address is valid', () => { + it('should return correct validator data corresponding to the input address', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address, validatorData); + const validatorDataReturned = await posEndpoint.getValidator( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ); + + const validatorDataJSON = { + ...validatorData, + totalStakeReceived: validatorData.totalStakeReceived.toString(), + selfStake: validatorData.selfStake.toString(), + address: cryptoAddress.getLisk32AddressFromAddress(address), + sharingCoefficients: [ + { + tokenID: token1.toString('hex'), + coefficient: validatorCoefficient1.toString('hex'), + }, + { + tokenID: token2.toString('hex'), + coefficient: validatorCoefficient2.toString('hex'), + }, + ], + }; + + expect(validatorDataReturned).toStrictEqual(validatorDataJSON); + }); + + it('should return valid JSON output', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address, validatorData); + const validatorDataReturned = await posEndpoint.getValidator( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ); + + expect(validatorDataReturned.totalStakeReceived).toBeString(); + expect(validatorDataReturned.selfStake).toBeString(); + }); + }); + }); + + describe('getAllValidators', () => { + describe('when input address is valid', () => { + const address1Str = cryptoAddress.getLisk32AddressFromAddress(address1); + const address2Str = cryptoAddress.getLisk32AddressFromAddress(address2); + + const addresses = [address1Str, address2Str]; + + const validatorData1 = Object.assign(validatorData, { address: address1Str }); + const validatorData2 = Object.assign(validatorData, { address: address2Str }); + + // CAUTION! + // getAllValidators() returns data in random order + it('should return correct data for all validators', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address1, validatorData1); + await validatorSubStore.set(createStoreGetter(stateStore), address2, validatorData2); + const { validators: validatorsDataReturned } = await posEndpoint.getAllValidators( + createTransientModuleEndpointContext({ stateStore }), + ); + + expect(addresses).toContain(validatorsDataReturned[0].address); + expect(addresses).toContain(validatorsDataReturned[1].address); + }); + + it('should return valid JSON output', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address, validatorData1); + await validatorSubStore.set(createStoreGetter(stateStore), address1, validatorData2); + const { validators: validatorsDataReturned } = await posEndpoint.getAllValidators( + createTransientModuleEndpointContext({ stateStore }), + ); + + expect(validatorsDataReturned[0].totalStakeReceived).toBeString(); + expect(validatorsDataReturned[0].selfStake).toBeString(); + expect(validatorsDataReturned[1].totalStakeReceived).toBeString(); + expect(validatorsDataReturned[1].selfStake).toBeString(); + }); + }); + }); + + describe('getLockedStakedAmount', () => { + beforeEach(async () => { + const context = createStoreGetter(stateStore); + await stakerSubStore.set(context, address, { + sentStakes: [ + { validatorAddress: address1, amount: BigInt(200), stakeSharingCoefficients: [] }, + { validatorAddress: address2, amount: BigInt(10), stakeSharingCoefficients: [] }, + ], + pendingUnlocks: [{ amount: BigInt(30), validatorAddress: address1, unstakeHeight: 99 }], + }); + }); + + it('should reject with invalid params', async () => { + await expect( + posEndpoint.getLockedStakedAmount( + createTransientModuleEndpointContext({ stateStore, params: { address: true } }), + ), + ).rejects.toThrow('Lisk validator found 1 error[s]:'); + }); + + it('should return amount locked for stakes', async () => { + const resp = await posEndpoint.getLockedStakedAmount( + createTransientModuleEndpointContext({ + stateStore, + params: { address: cryptoAddress.getLisk32AddressFromAddress(address) }, + }), + ); + expect(resp.amount).toEqual(Number(200 + 10 + 30).toString()); + }); + }); + + describe('getConstants', () => { + it('should return PoSModule configuration', async () => { + const constants = await posEndpoint.getConstants(); + + expect(constants).toStrictEqual({ + ...defaultConfig, + posTokenID: config.posTokenID.toString('hex'), + }); + }); + }); + + describe('getPendingUnlocks', () => { + it('should reject if input address is invalid', async () => { + await expect( + posEndpoint.getPendingUnlocks( + createTransientModuleEndpointContext({ + params: { + address: 1, + }, + }), + ), + ).rejects.toThrow('Parameter address must be a string'); + }); + + it('should reject if input address is not lisk32 format', async () => { + await expect( + posEndpoint.getPendingUnlocks( + createTransientModuleEndpointContext({ + params: { + address: 'lskos7tnf5jx4e6jq400000000000000000000000', + }, + }), + ), + ).rejects.toThrow('Invalid character found in address'); + }); + + it('should return empty if staker does not exist', async () => { + await expect( + posEndpoint.getPendingUnlocks( + createTransientModuleEndpointContext({ + params: { + address: 'lskos7tnf5jx4e6jq4bf5z4gwo2ow5he4khn75gpo', + }, + }), + ), + ).resolves.toEqual({ pendingUnlocks: [] }); + }); + + it('should return return all pending unlocks with expected unlockable heights', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address, { + ...validatorData, + name: 'validator', + pomHeights: [], + }); + await validatorSubStore.set(createStoreGetter(stateStore), address1, { + ...validatorData, + name: 'validator1', + pomHeights: [], + }); + const pomHeight = 260000; + await validatorSubStore.set(createStoreGetter(stateStore), address2, { + ...validatorData, + name: 'validator2', + pomHeights: [pomHeight], + }); + const pendingUnlocks = [ + { + amount: BigInt(200), + validatorAddress: address, + unstakeHeight: 100000, + }, + { + amount: BigInt(200), + validatorAddress: address1, + unstakeHeight: 300000, + }, + { + amount: BigInt(500), + validatorAddress: address2, + unstakeHeight: 250000, + }, + ]; + await stakerSubStore.set(createStoreGetter(stateStore), address, { + sentStakes: [], + pendingUnlocks, + }); + await genesisSubStore.set(createStoreGetter(stateStore), EMPTY_KEY, { + height: 0, + initValidators: [], + initRounds: 3, + }); + + await expect( + posEndpoint.getPendingUnlocks( + createTransientModuleEndpointContext({ + stateStore, + context: { + header: createFakeBlockHeader({ + height: 1000000, + timestamp: 100000, + aggregateCommit: { + aggregationBits: Buffer.alloc(0), + certificateSignature: Buffer.alloc(0), + height: 250000, + }, + }), + }, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ), + ).resolves.toEqual({ + pendingUnlocks: [ + { + ...pendingUnlocks[0], + validatorAddress: cryptoAddress.getLisk32AddressFromAddress( + pendingUnlocks[0].validatorAddress, + ), + amount: pendingUnlocks[0].amount.toString(), + unlockable: true, + expectedUnlockableHeight: pendingUnlocks[0].unstakeHeight + LOCKING_PERIOD_SELF_STAKES, + }, + { + ...pendingUnlocks[1], + validatorAddress: cryptoAddress.getLisk32AddressFromAddress( + pendingUnlocks[1].validatorAddress, + ), + amount: pendingUnlocks[1].amount.toString(), + unlockable: false, + expectedUnlockableHeight: pendingUnlocks[1].unstakeHeight + LOCKING_PERIOD_STAKES, + }, + { + ...pendingUnlocks[2], + validatorAddress: cryptoAddress.getLisk32AddressFromAddress( + pendingUnlocks[2].validatorAddress, + ), + amount: pendingUnlocks[2].amount.toString(), + unlockable: false, + expectedUnlockableHeight: pomHeight + PUNISHMENT_WINDOW_STAKES, + }, + ], + }); + }); + }); + + describe('getPoSTokenID', () => { + it('should return posTokenID', async () => { + await expect( + posEndpoint.getPoSTokenID(createTransientModuleEndpointContext({ stateStore })), + ).resolves.toEqual({ + tokenID: config.posTokenID.toString('hex'), + }); + }); + }); + + describe('getValidatorsByStake', () => { + beforeEach(async () => { + const context = createStoreGetter(stateStore); + await eligibleValidatorsSubStore.set( + context, + eligibleValidatorsSubStore.getKey(address, BigInt(20)), + { lastPomHeight: 0 }, + ); + await eligibleValidatorsSubStore.set( + context, + eligibleValidatorsSubStore.getKey(address1, BigInt(50)), + { lastPomHeight: 0 }, + ); + await eligibleValidatorsSubStore.set( + context, + eligibleValidatorsSubStore.getKey(address2, BigInt(100)), + { lastPomHeight: 0 }, + ); + + await validatorSubStore.set(context, address, { + ...validatorData, + name: '1', + }); + await validatorSubStore.set(context, address1, { + ...validatorData, + name: '2', + }); + await validatorSubStore.set(context, address2, { + ...validatorData, + name: '3', + }); + }); + + it('should reject with invalid params', async () => { + await expect( + posEndpoint.getValidatorsByStake( + createTransientModuleEndpointContext({ stateStore, params: { limit: true } }), + ), + ).rejects.toThrow('Lisk validator found 1 error[s]:'); + }); + + it('should return validators with default limit', async () => { + const resp = await posEndpoint.getValidatorsByStake( + createTransientModuleEndpointContext({ stateStore }), + ); + expect(resp.validators).toHaveLength(3); + expect(resp.validators[0]).toEqual({ + ...validatorData, + name: '3', + totalStakeReceived: validatorData.totalStakeReceived.toString(), + selfStake: validatorData.selfStake.toString(), + sharingCoefficients: validatorData.sharingCoefficients.map(co => ({ + tokenID: co.tokenID.toString('hex'), + coefficient: co.coefficient.toString('hex'), + })), + }); + }); + + it('should return all validators with limit', async () => { + const resp = await posEndpoint.getValidatorsByStake( + createTransientModuleEndpointContext({ stateStore, params: { limit: 2 } }), + ); + expect(resp.validators).toHaveLength(2); + expect(resp.validators[0]).toEqual({ + ...validatorData, + name: '3', + address: cryptoAddress.getLisk32AddressFromAddress(address2), + totalStakeReceived: validatorData.totalStakeReceived.toString(), + selfStake: validatorData.selfStake.toString(), + sharingCoefficients: validatorData.sharingCoefficients.map(co => ({ + tokenID: co.tokenID.toString('hex'), + coefficient: co.coefficient.toString('hex'), + })), + }); + expect(resp.validators[1]).toEqual({ + ...validatorData, + address: cryptoAddress.getLisk32AddressFromAddress(address1), + name: '2', + totalStakeReceived: validatorData.totalStakeReceived.toString(), + selfStake: validatorData.selfStake.toString(), + sharingCoefficients: validatorData.sharingCoefficients.map(co => ({ + tokenID: co.tokenID.toString('hex'), + coefficient: co.coefficient.toString('hex'), + })), + }); + }); + }); + + describe('getLockedRewards', () => { + beforeEach(async () => { + const context = createStoreGetter(stateStore); + await stakerSubStore.set(context, address, { + sentStakes: [ + { validatorAddress: address1, amount: BigInt(200), stakeSharingCoefficients: [] }, + { validatorAddress: address2, amount: BigInt(10), stakeSharingCoefficients: [] }, + ], + pendingUnlocks: [{ amount: BigInt(30), validatorAddress: address1, unstakeHeight: 99 }], + }); + + (posEndpoint['_tokenMethod'].getLockedAmount as jest.Mock).mockResolvedValue(BigInt(5000)); + }); + + it('should reject with invalid params', async () => { + await expect( + posEndpoint.getLockedRewards( + createTransientModuleEndpointContext({ stateStore, params: { limit: true } }), + ), + ).rejects.toThrow('Lisk validator found 2 error[s]:'); + }); + + it('should reject with invalid token ID params', async () => { + await expect( + posEndpoint.getLockedRewards( + createTransientModuleEndpointContext({ + stateStore, + params: { address: cryptoAddress.getLisk32AddressFromAddress(address), tokenID: 123 }, + }), + ), + ).rejects.toThrow('Lisk validator found 1 error[s]:'); + }); + + it('should return full amount when token ID requested is not governance tokenID', async () => { + const resp = await posEndpoint.getLockedRewards( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + tokenID: Buffer.alloc(8).toString('hex'), + }, + }), + ); + expect(resp.reward).toEqual('5000'); + }); + + it('should return amount without the amount locked for stakes with token ID requested is the governance token ID', async () => { + const resp = await posEndpoint.getLockedRewards( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + tokenID: config.posTokenID.toString('hex'), + }, + }), + ); + expect(resp.reward).toEqual(Number(5000 - 200 - 10 - 30).toString()); + }); + }); + + describe('getClaimableRewards', () => { + it('should return rewards when staked for 1 validator which got rewards in 2 tokens', async () => { + const amount = BigInt(200); + const context = createStoreGetter(stateStore); + await validatorSubStore.set(context, address, validatorData); + await stakerSubStore.set(context, addressStaker, { + sentStakes: [ + { + validatorAddress: address, + amount, + stakeSharingCoefficients: [stakerSharingCoefficient1, stakerSharingCoefficient2], + }, + ], + pendingUnlocks: [], + }); + + const response = await posEndpoint.getClaimableRewards( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(addressStaker), + }, + }), + ); + + expect(response.rewards).toHaveLength(2); + expect(response).toEqual({ + rewards: [ + { + tokenID: stakerSharingCoefficient1.tokenID.toString('hex'), + reward: calculateStakeRewards( + stakerSharingCoefficient1, + amount, + validatorSharingCoefficient1, + ).toString(), + }, + { + tokenID: stakerSharingCoefficient2.tokenID.toString('hex'), + reward: calculateStakeRewards( + stakerSharingCoefficient2, + amount, + validatorSharingCoefficient2, + ).toString(), + }, + ], + }); + }); + + it('should exclude self stake from the claimable rewards', async () => { + const amount = BigInt(200); + const context = createStoreGetter(stateStore); + await validatorSubStore.set(context, address, validatorData); + await stakerSubStore.set(context, address, { + sentStakes: [ + { + validatorAddress: address, + amount, + stakeSharingCoefficients: [stakerSharingCoefficient1, stakerSharingCoefficient2], + }, + ], + pendingUnlocks: [], + }); + + const response = await posEndpoint.getClaimableRewards( + createTransientModuleEndpointContext({ + stateStore, + params: { + address: cryptoAddress.getLisk32AddressFromAddress(address), + }, + }), + ); + + expect(response).toEqual({ rewards: [] }); + }); + }); +}); diff --git a/framework/test/unit/modules/dpos_v2/genesis_block_test_data.ts b/framework/test/unit/modules/pos/genesis_block_test_data.ts similarity index 62% rename from framework/test/unit/modules/dpos_v2/genesis_block_test_data.ts rename to framework/test/unit/modules/pos/genesis_block_test_data.ts index cf3656c7550..2bf0ed4906d 100644 --- a/framework/test/unit/modules/dpos_v2/genesis_block_test_data.ts +++ b/framework/test/unit/modules/pos/genesis_block_test_data.ts @@ -40,45 +40,45 @@ validators.sort((a, b) => a.address.compare(b.address)); export const validAsset = { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, { address: validators[1].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }; @@ -93,28 +93,28 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, ], @@ -128,28 +128,28 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Invalid validator name', @@ -164,28 +164,28 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Validator name is not unique', @@ -200,28 +200,28 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Validator address is not unique', @@ -245,182 +245,182 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'SharingCoefficients must be sorted by tokenID', ], [ - 'Exceed max vote', + 'Exceed max stake', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: validators.slice(0, 22).map(v => ({ - delegateAddress: v.address, + sentStakes: validators.slice(0, 22).map(v => ({ + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, - 'Sent vote exceeds max vote', + 'Sent stake exceeds max stake', ], [ - 'sent vote delegate address is not unique', + 'sent stake validator address is not unique', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[1].address, + validatorAddress: validators[1].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ...validators.slice(1, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, - 'Sent vote delegate address is not unique', + 'Sent stake validator address is not unique', ], [ - 'sent vote delegate address is not ordered', + 'sent stake validator address is not ordered', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[1].address, + validatorAddress: validators[1].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ...validators.slice(2, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, - 'Sent vote delegate address is not lexicographically ordered', + 'Sent stake validator address is not lexicographically ordered', ], [ - 'sent vote delegate address is not validator', + 'sent stake validator address is not validator', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: Buffer.alloc(20, 0), + validatorAddress: Buffer.alloc(20, 0), amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ...validators.slice(1, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, - 'Sent vote includes non existing validator address', + 'Sent stake includes non existing validator address', ], [ - 'sent vote sharing coefficients is not sorted', + 'sent stake sharing coefficients is not sorted', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: Buffer.from([1, 0, 0, 0, 0, 0, 0, 0]), coefficient: Buffer.from([1, 0, 0, 0]), @@ -432,29 +432,29 @@ export const invalidAssets: any[] = [ ], }, ...validators.slice(1, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Validator does not have corresponding sharing coefficient or the coefficient value is not consistent', ], [ - 'sent vote sharing coefficients is matching', + 'sent stake sharing coefficients is matching', { validators: [ { @@ -472,14 +472,14 @@ export const invalidAssets: any[] = [ }, ...validators.slice(1, 101), ], - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), coefficient: Buffer.from([255, 0, 0, 0]), @@ -487,23 +487,23 @@ export const invalidAssets: any[] = [ ], }, ...validators.slice(1, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Validator does not have corresponding sharing coefficient or the coefficient value is not consistent', @@ -512,28 +512,28 @@ export const invalidAssets: any[] = [ 'exceed max unlocking', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ ...validators.slice(0, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ ...validators.slice(0, 21).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, })), ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'PendingUnlocks exceeds max unlocking', @@ -542,212 +542,212 @@ export const invalidAssets: any[] = [ 'pendingUnlocks is not ordered', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ ...validators.slice(0, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: validators[1].address, + validatorAddress: validators[1].address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ...validators.slice(2, 20).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, })), ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'PendingUnlocks are not lexicographically ordered', ], [ - 'pendingUnlocks include non validator delegate address', + 'pendingUnlocks include non validator validator address', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ ...validators.slice(0, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ { - delegateAddress: Buffer.alloc(20, 0), + validatorAddress: Buffer.alloc(20, 0), amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ...validators.slice(1, 20).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, })), ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, 'Pending unlocks includes non existing validator address', ], [ - 'not unique voter address', + 'not unique staker address', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ ...validators.slice(0, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ ...validators.slice(0, 20).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, })), ], }, { address: validators[0].address, - sentVotes: [ + sentStakes: [ ...validators.slice(0, 10).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], })), ], pendingUnlocks: [ ...validators.slice(0, 20).map(v => ({ - delegateAddress: v.address, + validatorAddress: v.address, amount: BigInt(1000) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, })), ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 101).map(v => v.address), + initValidators: validators.slice(0, 101).map(v => v.address), }, }, - 'Voter address is not unique', + 'Staker address is not unique', ], [ - 'non unique init delegate', + 'non unique init validator', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: [validators[1].address, ...validators.slice(1, 101).map(v => v.address)], + initValidators: [validators[1].address, ...validators.slice(1, 101).map(v => v.address)], }, }, - 'Init delegates address is not unique', + 'Init validators address is not unique', ], [ - 'non validator init delegate', + 'non validator init validator', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: [Buffer.alloc(20, 0), ...validators.slice(1, 101).map(v => v.address)], + initValidators: [Buffer.alloc(20, 0), ...validators.slice(1, 101).map(v => v.address)], }, }, - 'Init delegates includes non existing validator address', + 'Init validators includes non existing validator address', ], [ - 'more than number of active validators init delegate', + 'more than number of active validators init validator', { validators, - voters: [ + stakers: [ { address: validators[0].address, - sentVotes: [ + sentStakes: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(1000) * BigInt(100000000), - voteSharingCoefficients: [], + stakeSharingCoefficients: [], }, ], pendingUnlocks: [ { - delegateAddress: validators[0].address, + validatorAddress: validators[0].address, amount: BigInt(10) * BigInt(100000000), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }, ], genesisData: { initRounds: 3, - initDelegates: validators.slice(0, 105).map(v => v.address), + initValidators: validators.slice(0, 105).map(v => v.address), }, }, - 'Init delegates is greater than number of active delegates', + 'Init validators is greater than number of active validators', ], ]; diff --git a/framework/test/unit/modules/dpos_v2/internal_method.spec.ts b/framework/test/unit/modules/pos/internal_method.spec.ts similarity index 60% rename from framework/test/unit/modules/dpos_v2/internal_method.spec.ts rename to framework/test/unit/modules/pos/internal_method.spec.ts index cc6b9bc42f7..39db714da50 100644 --- a/framework/test/unit/modules/dpos_v2/internal_method.spec.ts +++ b/framework/test/unit/modules/pos/internal_method.spec.ts @@ -13,21 +13,21 @@ */ import { codec } from '@liskhq/lisk-codec'; -import { RewardsAssignedEvent } from '../../../../src/modules/dpos_v2/events/rewards_assigned'; -import { InternalMethod } from '../../../../src/modules/dpos_v2/internal_method'; +import { RewardsAssignedEvent } from '../../../../src/modules/pos/events/rewards_assigned'; +import { InternalMethod } from '../../../../src/modules/pos/internal_method'; import { NamedRegistry } from '../../../../src/modules/named_registry'; import { createNewMethodContext } from '../../../../src/state_machine/method_context'; import { InMemoryPrefixedStateDB } from '../../../../src/testing'; -import * as utils from '../../../../src/modules/dpos_v2/utils'; +import * as utils from '../../../../src/modules/pos/utils'; import { MethodContext, TokenMethod } from '../../../../src'; -import { DelegateAccount } from '../../../../src/modules/dpos_v2/stores/delegate'; +import { ValidatorAccount } from '../../../../src/modules/pos/stores/validator'; import { - VoteObject, - VoterData, - VoteSharingCoefficient, -} from '../../../../src/modules/dpos_v2/types'; + StakeObject, + StakerData, + StakeSharingCoefficient, +} from '../../../../src/modules/pos/types'; import { EventQueue } from '../../../../src/state_machine'; -import { MAX_NUMBER_BYTES_Q96 } from '../../../../src/modules/dpos_v2/constants'; +import { MAX_NUMBER_BYTES_Q96 } from '../../../../src/modules/pos/constants'; describe('InternalMethod', () => { const checkEventResult = ( @@ -38,16 +38,16 @@ describe('InternalMethod', () => { expectedResult: any, ) => { expect(eventQueue.getEvents()).toHaveLength(length); - expect(eventQueue.getEvents()[index].toObject().name).toEqual(new EventClass('dpos').name); + expect(eventQueue.getEvents()[index].toObject().name).toEqual(new EventClass('pos').name); const eventData = codec.decode>( - new EventClass('dpos').schema, + new EventClass('pos').schema, eventQueue.getEvents()[index].toObject().data, ); expect(eventData).toEqual(expectedResult); }; - const moduleName = 'dpos'; + const moduleName = 'pos'; const stores: NamedRegistry = new NamedRegistry(); const events: NamedRegistry = new NamedRegistry(); const internalMethod: InternalMethod = new InternalMethod(stores, events, moduleName); @@ -59,24 +59,24 @@ describe('InternalMethod', () => { const tokenID1 = Buffer.concat([chainID, localTokenID1]); const tokenID2 = Buffer.concat([chainID, localTokenID2]); const tokenID3 = Buffer.concat([chainID, localTokenID3]); - const delegateAddress = Buffer.alloc(20); - const voterAddress = Buffer.alloc(20, 1); + const validatorAddress = Buffer.alloc(20); + const stakerAddress = Buffer.alloc(20, 1); const zeroReward = BigInt(0); - const voteReward = BigInt(10); - const indexWithDelegateVote = 0; + const stakeReward = BigInt(10); + const indexWithValidatorStake = 0; events.register(RewardsAssignedEvent, new RewardsAssignedEvent(moduleName)); internalMethod.addDependencies(tokenMethod); let methodContext: MethodContext; - let voterData: VoterData; - let delegateData: DelegateAccount; - let calculateVoteRewardsMock: jest.SpyInstance< + let stakerData: StakerData; + let validatorData: ValidatorAccount; + let calculateStakeRewardsMock: jest.SpyInstance< bigint, [ - voteSharingCoefficient: VoteSharingCoefficient, + stakeSharingCoefficient: StakeSharingCoefficient, amount: bigint, - delegateSharingCoefficient: VoteSharingCoefficient, + validatorSharingCoefficient: StakeSharingCoefficient, ] >; let unlockMock: jest.SpyInstance< @@ -96,12 +96,12 @@ describe('InternalMethod', () => { beforeEach(() => { methodContext = createNewMethodContext(new InMemoryPrefixedStateDB()); - voterData = { - sentVotes: [ + stakerData = { + sentStakes: [ { - delegateAddress, + validatorAddress, amount: BigInt(10), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }, @@ -109,14 +109,14 @@ describe('InternalMethod', () => { pendingUnlocks: [], }; - delegateData = { + validatorData = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, name: 'Hawthorne', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -128,167 +128,167 @@ describe('InternalMethod', () => { unlockMock = jest.spyOn(tokenMethod, 'unlock').mockResolvedValue(); transferMock = jest.spyOn(tokenMethod, 'transfer').mockResolvedValue(); - calculateVoteRewardsMock = jest - .spyOn(utils, 'calculateVoteRewards') - .mockReturnValue(voteReward); + calculateStakeRewardsMock = jest + .spyOn(utils, 'calculateStakeRewards') + .mockReturnValue(stakeReward); }); - describe('assignVoteRewards', () => { - describe('when self-vote', () => { + describe('assignStakeRewards', () => { + describe('when self-stake', () => { it('should not perform reward calculation, token unlock and transfer logic or emit RewardsAssignedEvent', async () => { - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - delegateAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + validatorAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); - expect(calculateVoteRewardsMock).toHaveBeenCalledTimes(0); + expect(calculateStakeRewardsMock).toHaveBeenCalledTimes(0); expect(unlockMock).toHaveBeenCalledTimes(0); expect(transferMock).toHaveBeenCalledTimes(0); expect(methodContext.eventQueue.getEvents()).toHaveLength(0); }); }); - describe('when not self-vote', () => { - it('should insert sharing coefficients for non-existing tokenIDs to sent vote from sharingCoefficients of the voted delegate and sort by tokenID', async () => { - voterData.sentVotes[0].voteSharingCoefficients = [ + describe('when not self-stake', () => { + it('should insert sharing coefficients for non-existing tokenIDs to sent stake from sharingCoefficients of the staked validator and sort by tokenID', async () => { + stakerData.sentStakes[0].stakeSharingCoefficients = [ { tokenID: tokenID2, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ]; - const sentVote: VoteObject = { - delegateAddress, + const sentStake: StakeObject = { + validatorAddress, amount: BigInt(10), - voteSharingCoefficients: [ + stakeSharingCoefficients: [ { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, { tokenID: tokenID2, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, { tokenID: tokenID3, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }; - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); - expect(calculateVoteRewardsMock).toHaveBeenNthCalledWith( + expect(calculateStakeRewardsMock).toHaveBeenNthCalledWith( 1, { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, - sentVote.amount, + sentStake.amount, { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ); - expect(calculateVoteRewardsMock).toHaveBeenNthCalledWith( + expect(calculateStakeRewardsMock).toHaveBeenNthCalledWith( 2, { tokenID: tokenID2, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, - sentVote.amount, + sentStake.amount, { tokenID: tokenID2, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ); - expect(calculateVoteRewardsMock).toHaveBeenNthCalledWith( + expect(calculateStakeRewardsMock).toHaveBeenNthCalledWith( 3, { tokenID: tokenID3, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, - sentVote.amount, + sentStake.amount, { tokenID: tokenID3, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ); }); - it('should calculate vote reward for each sharing coefficient of voted delegate', async () => { - await internalMethod.assignVoteRewards( + it('should calculate stake reward for each sharing coefficient of staked validator', async () => { + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); - expect(calculateVoteRewardsMock).toHaveBeenCalledTimes( - delegateData.sharingCoefficients.length, + expect(calculateStakeRewardsMock).toHaveBeenCalledTimes( + validatorData.sharingCoefficients.length, ); }); describe('when calculated reward is not zero', () => { - it('should unlock reward amout from voted delegate for each tokenID of sharing coefficients', async () => { - delegateData.sharingCoefficients = [ + it('should unlock reward amout from staked validator for each tokenID of sharing coefficients', async () => { + validatorData.sharingCoefficients = [ { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ]; - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); - expect(unlockMock).toHaveBeenCalledTimes(delegateData.sharingCoefficients.length); + expect(unlockMock).toHaveBeenCalledTimes(validatorData.sharingCoefficients.length); expect(unlockMock).toHaveBeenNthCalledWith( 1, methodContext, - voterData.sentVotes[indexWithDelegateVote].delegateAddress, + stakerData.sentStakes[indexWithValidatorStake].validatorAddress, moduleName, tokenID1, - voteReward, + stakeReward, ); }); - it('should transfer reward amount to voter from voted delegate for each tokenID of sharing coefficients', async () => { - delegateData.sharingCoefficients = [ + it('should transfer reward amount to staker from staked validator for each tokenID of sharing coefficients', async () => { + validatorData.sharingCoefficients = [ { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ]; - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); expect(transferMock).toHaveBeenNthCalledWith( 1, methodContext, - voterData.sentVotes[indexWithDelegateVote].delegateAddress, - voterAddress, + stakerData.sentStakes[indexWithValidatorStake].validatorAddress, + stakerAddress, tokenID1, - voteReward, + stakeReward, ); }); - it('should emit RewardsAssignedEvent for each sharing coefficient of voted delegate', async () => { - delegateData.sharingCoefficients = [ + it('should emit RewardsAssignedEvent for each sharing coefficient of staked validator', async () => { + validatorData.sharingCoefficients = [ { tokenID: tokenID1, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ]; - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); expect(methodContext.eventQueue.getEvents()).toHaveLength(1); checkEventResult(methodContext.eventQueue, 1, RewardsAssignedEvent, 0, { - voterAddress, - delegateAddress, + stakerAddress, + validatorAddress, tokenID: tokenID1, - amount: voteReward, + amount: stakeReward, }); }); }); describe('when calculated reward is zero', () => { beforeEach(() => { - calculateVoteRewardsMock = jest - .spyOn(utils, 'calculateVoteRewards') + calculateStakeRewardsMock = jest + .spyOn(utils, 'calculateStakeRewards') .mockReturnValue(zeroReward); }); it('should not perform token unlock and transfer logic or emit RewardsAssignedEvent', async () => { - await internalMethod.assignVoteRewards( + await internalMethod.assignStakeRewards( methodContext, - voterAddress, - voterData.sentVotes[indexWithDelegateVote], - delegateData, + stakerAddress, + stakerData.sentStakes[indexWithValidatorStake], + validatorData, ); expect(unlockMock).toHaveBeenCalledTimes(0); diff --git a/framework/test/unit/modules/dpos_v2/method.spec.ts b/framework/test/unit/modules/pos/method.spec.ts similarity index 60% rename from framework/test/unit/modules/dpos_v2/method.spec.ts rename to framework/test/unit/modules/pos/method.spec.ts index d5779eab5a1..4558f80e768 100644 --- a/framework/test/unit/modules/dpos_v2/method.spec.ts +++ b/framework/test/unit/modules/pos/method.spec.ts @@ -14,53 +14,53 @@ import { math } from '@liskhq/lisk-utils'; import { utils } from '@liskhq/lisk-cryptography'; -import { DPoSMethod } from '../../../../src/modules/dpos_v2/method'; +import { PoSMethod } from '../../../../src/modules/pos/method'; import { MethodContext } from '../../../../src/state_machine/method_context'; import { EventQueue } from '../../../../src/state_machine'; import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; -import { DPoSModule } from '../../../../src/modules/dpos_v2/module'; -import { VoterStore } from '../../../../src/modules/dpos_v2/stores/voter'; -import { DelegateStore } from '../../../../src/modules/dpos_v2/stores/delegate'; -import { NameStore } from '../../../../src/modules/dpos_v2/stores/name'; +import { PoSModule } from '../../../../src/modules/pos/module'; +import { StakerStore } from '../../../../src/modules/pos/stores/staker'; +import { ValidatorStore } from '../../../../src/modules/pos/stores/validator'; +import { NameStore } from '../../../../src/modules/pos/stores/name'; import { createStoreGetter } from '../../../../src/testing/utils'; import { COMMISSION_INCREASE_PERIOD, MAX_COMMISSION_INCREASE_RATE, MAX_NUMBER_BYTES_Q96, -} from '../../../../src/modules/dpos_v2/constants'; +} from '../../../../src/modules/pos/constants'; -describe('DposModuleApi', () => { - const dpos = new DPoSModule(); +describe('PoSMethod', () => { + const pos = new PoSModule(); - let dposMethod: DPoSMethod; + let posMethod: PoSMethod; let methodContext: MethodContext; let stateStore: PrefixedStateReadWriter; - let voterSubStore: VoterStore; - let delegateSubStore: DelegateStore; + let stakerSubStore: StakerStore; + let validatorSubStore: ValidatorStore; let nameSubStore: NameStore; const address = utils.getRandomBytes(20); - const voterData = { - sentVotes: [ + const stakerData = { + sentStakes: [ { - delegateAddress: utils.getRandomBytes(20), + validatorAddress: utils.getRandomBytes(20), amount: BigInt(0), - voteSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], + stakeSharingCoefficients: [{ tokenID: Buffer.alloc(8), coefficient: Buffer.alloc(24) }], }, ], pendingUnlocks: [ { - delegateAddress: utils.getRandomBytes(20), + validatorAddress: utils.getRandomBytes(20), amount: BigInt(0), - unvoteHeight: 0, + unstakeHeight: 0, }, ], }; - const delegateData = { - name: 'delegate1', - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), + const validatorData = { + name: 'validator1', + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [0], @@ -71,22 +71,22 @@ describe('DposModuleApi', () => { }; beforeEach(() => { - dposMethod = new DPoSMethod(dpos.stores, dpos.events); + posMethod = new PoSMethod(pos.stores, pos.events); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - voterSubStore = dpos.stores.get(VoterStore); - delegateSubStore = dpos.stores.get(DelegateStore); - nameSubStore = dpos.stores.get(NameStore); + stakerSubStore = pos.stores.get(StakerStore); + validatorSubStore = pos.stores.get(ValidatorStore); + nameSubStore = pos.stores.get(NameStore); methodContext = new MethodContext({ stateStore, eventQueue: new EventQueue(0) }); }); describe('isNameAvailable', () => { describe('when name already exists', () => { it('should return false', async () => { - await nameSubStore.set(createStoreGetter(stateStore), Buffer.from(delegateData.name), { - delegateAddress: Buffer.alloc(0), + await nameSubStore.set(createStoreGetter(stateStore), Buffer.from(validatorData.name), { + validatorAddress: Buffer.alloc(0), }); await expect( - dposMethod.isNameAvailable(methodContext, delegateData.name), + posMethod.isNameAvailable(methodContext, validatorData.name), ).resolves.toBeFalse(); }); }); @@ -94,7 +94,7 @@ describe('DposModuleApi', () => { describe('when name does not exist and exceeds the maximum length', () => { it('should return false', async () => { await expect( - dposMethod.isNameAvailable( + posMethod.isNameAvailable( methodContext, 'nnwkfnwkfnkwrnfkrnfeknekerfnkjenejnfekfnekfnjkdnwknw', ), @@ -104,14 +104,14 @@ describe('DposModuleApi', () => { describe('when name does not exist and has length less than 1', () => { it('should return false', async () => { - await expect(dposMethod.isNameAvailable(methodContext, '')).resolves.toBeFalse(); + await expect(posMethod.isNameAvailable(methodContext, '')).resolves.toBeFalse(); }); }); describe('when name does not exist and contains invalid symbol', () => { it('should return false', async () => { await expect( - dposMethod.isNameAvailable(methodContext, 'Ajldnfdf-_.dv$%&^#'), + posMethod.isNameAvailable(methodContext, 'Ajldnfdf-_.dv$%&^#'), ).resolves.toBeFalse(); }); }); @@ -119,37 +119,37 @@ describe('DposModuleApi', () => { describe('when name does not exist and is a valid name', () => { it('should return true', async () => { await expect( - dposMethod.isNameAvailable(methodContext, 'abcdefghijklmnopqrstuvwxyz0123456789!@$&_.'), + posMethod.isNameAvailable(methodContext, 'abcdefghijklmnopqrstuvwxyz0123456789!@$&_.'), ).resolves.toBeFalse(); }); }); }); - describe('getVoter', () => { + describe('getStaker', () => { describe('when input address is valid', () => { - it('should return correct voter data corresponding to the input address', async () => { - await voterSubStore.set(createStoreGetter(stateStore), address, voterData); - const voterDataReturned = await dposMethod.getVoter(methodContext, address); + it('should return correct staker data corresponding to the input address', async () => { + await stakerSubStore.set(createStoreGetter(stateStore), address, stakerData); + const stakerDataReturned = await posMethod.getStaker(methodContext, address); - expect(voterDataReturned).toStrictEqual(voterData); + expect(stakerDataReturned).toStrictEqual(stakerData); }); }); }); - describe('getDelegate', () => { + describe('getValidator', () => { describe('when input address is valid', () => { - it('should return correct delegate data corresponding to the input address', async () => { - await delegateSubStore.set(createStoreGetter(stateStore), address, delegateData); - const delegateDataReturned = await dposMethod.getDelegate(methodContext, address); + it('should return correct validator data corresponding to the input address', async () => { + await validatorSubStore.set(createStoreGetter(stateStore), address, validatorData); + const validatorDataReturned = await posMethod.getValidator(methodContext, address); - expect(delegateDataReturned).toStrictEqual(delegateData); + expect(validatorDataReturned).toStrictEqual(validatorData); }); }); }); describe('updateSharedRewards', () => { const { q96 } = math; - const moduleName = 'dpos'; + const moduleName = 'pos'; const address1 = Buffer.from('bf2e956611a4bd24e7dabc6c66d243327a87028f', 'hex'); const address2 = Buffer.from('e6746edf586bb2a64d977add677afaebed7730e3', 'hex'); const address3 = Buffer.from('ea50b241deee288208800f1ab0ae9940fbde54db', 'hex'); @@ -161,14 +161,14 @@ describe('DposModuleApi', () => { const tokenID2 = Buffer.concat([chainID, localTokenID2]); const tokenID3 = Buffer.concat([chainID, localTokenID3]); - const delegateData1 = { + const validatorData1 = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate1', + name: 'validator1', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(0), + selfStake: BigInt(0), + totalStakeReceived: BigInt(0), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -177,14 +177,14 @@ describe('DposModuleApi', () => { { tokenID: tokenID3, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }; - const delegateData2 = { + const validatorData2 = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate2', + name: 'validator2', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(4), + selfStake: BigInt(0), + totalStakeReceived: BigInt(4), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -192,14 +192,14 @@ describe('DposModuleApi', () => { { tokenID: tokenID3, coefficient: Buffer.alloc(MAX_NUMBER_BYTES_Q96) }, ], }; - const delegateData3 = { + const validatorData3 = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate3', + name: 'validator3', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(4), + selfStake: BigInt(0), + totalStakeReceived: BigInt(4), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -209,20 +209,20 @@ describe('DposModuleApi', () => { ], }; const defaultConfig = { - factorSelfVotes: 10, + factorSelfStakes: 10, maxLengthName: 20, - maxNumberSentVotes: 10, + maxNumberSentStakes: 10, maxNumberPendingUnlocks: 20, failSafeMissedBlocks: 50, failSafeInactiveWindow: 260000, punishmentWindow: 780000, roundLength: 103, minWeightStandby: BigInt(1000) * BigInt(10 ** 8), - numberActiveDelegates: 101, - numberStandbyDelegates: 2, - governanceTokenID: Buffer.from('0000000000000000', 'hex'), + numberActiveValidators: 101, + numberStandbyValidators: 2, + posTokenID: Buffer.from('0000000000000000', 'hex'), tokenIDFee: Buffer.from('0000000000000000', 'hex'), - delegateRegistrationFee: BigInt(10) * BigInt(10) ** BigInt(8), + validatorRegistrationFee: BigInt(10) * BigInt(10) ** BigInt(8), maxBFTWeightCap: 500, commissionIncreasePeriod: COMMISSION_INCREASE_PERIOD, maxCommissionIncreaseRate: MAX_COMMISSION_INCREASE_RATE, @@ -231,42 +231,42 @@ describe('DposModuleApi', () => { beforeEach(async () => { tokenMethod = { lock: jest.fn() }; - dposMethod.init(moduleName, defaultConfig, tokenMethod); - await delegateSubStore.set(createStoreGetter(stateStore), address1, delegateData1); - await delegateSubStore.set(createStoreGetter(stateStore), address2, delegateData2); - await delegateSubStore.set(createStoreGetter(stateStore), address3, delegateData3); + posMethod.init(moduleName, defaultConfig, tokenMethod); + await validatorSubStore.set(createStoreGetter(stateStore), address1, validatorData1); + await validatorSubStore.set(createStoreGetter(stateStore), address2, validatorData2); + await validatorSubStore.set(createStoreGetter(stateStore), address3, validatorData3); jest.spyOn(tokenMethod, 'lock'); - jest.spyOn(delegateSubStore, 'set'); + jest.spyOn(validatorSubStore, 'set'); }); - it('should return if totalVotesReceived is 0', async () => { + it('should return if totalStakeReceived is 0', async () => { await expect( - dposMethod.updateSharedRewards(methodContext, address1, tokenID1, BigInt(50)), + posMethod.updateSharedRewards(methodContext, address1, tokenID1, BigInt(50)), ).resolves.toBeUndefined(); expect(tokenMethod.lock).not.toHaveBeenCalled(); - expect(delegateSubStore.set).not.toHaveBeenCalled(); + expect(validatorSubStore.set).not.toHaveBeenCalled(); }); - it('should initialize sharing coefficient to zero and set the appropriate amounts in correct order to delegate store for the specified token if there does not exist an item in delegateStore for the token id', async () => { + it('should initialize sharing coefficient to zero and set the appropriate amounts in correct order to validator store for the specified token if there does not exist an item in validatorStore for the token id', async () => { const newTokenID = tokenID2; const reward = BigInt(50); const rewardQ = q96(reward); - const commissionQ = q96(BigInt(delegateData2.commission)); + const commissionQ = q96(BigInt(validatorData2.commission)); const rewardFractionQ = q96(BigInt(1)).sub(commissionQ.div(q96(BigInt(10000)))); - const selfVotesQ = q96(delegateData2.selfVotes); - const totalVotesQ = q96(delegateData2.totalVotesReceived); + const selfStakeQ = q96(validatorData2.selfStake); + const totalStakesQ = q96(validatorData2.totalStakeReceived); const oldSharingCoefficient = q96(0); - const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalVotesQ); - const sharedRewards = sharingCoefficientIncrease.mul(totalVotesQ.sub(selfVotesQ)).floor(); + const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalStakesQ); + const sharedRewards = sharingCoefficientIncrease.mul(totalStakesQ.sub(selfStakeQ)).floor(); const newSharingCoefficient = oldSharingCoefficient.add(sharingCoefficientIncrease); - const updatedDelegateData = { + const updatedValidatorData = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate2', + name: 'validator2', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(4), + selfStake: BigInt(0), + totalStakeReceived: BigInt(4), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -277,10 +277,10 @@ describe('DposModuleApi', () => { }; await expect( - dposMethod.updateSharedRewards(methodContext, address2, newTokenID, reward), + posMethod.updateSharedRewards(methodContext, address2, newTokenID, reward), ).resolves.toBeUndefined(); expect(tokenMethod.lock).toHaveBeenCalledTimes(1); - expect(delegateSubStore.set).toHaveBeenCalledTimes(1); + expect(validatorSubStore.set).toHaveBeenCalledTimes(1); expect(tokenMethod.lock).toHaveBeenCalledWith( methodContext, address2, @@ -288,32 +288,32 @@ describe('DposModuleApi', () => { newTokenID, sharedRewards, ); - expect(delegateSubStore.set).toHaveBeenCalledWith( + expect(validatorSubStore.set).toHaveBeenCalledWith( methodContext, address2, - updatedDelegateData, + updatedValidatorData, ); }); - it('should lock the appropriate amount of rewards and update the delegate store with updated sharing coefficients if the token id is already present', async () => { + it('should lock the appropriate amount of rewards and update the validator store with updated sharing coefficients if the token id is already present', async () => { const reward = BigInt(70); const rewardQ = q96(reward); - const commissionQ = q96(BigInt(delegateData3.commission)); + const commissionQ = q96(BigInt(validatorData3.commission)); const rewardFractionQ = q96(BigInt(1)).sub(commissionQ.div(q96(BigInt(10000)))); - const selfVotesQ = q96(delegateData3.selfVotes); - const totalVotesQ = q96(delegateData3.totalVotesReceived); - const oldSharingCoefficient = q96(delegateData3.sharingCoefficients[1].coefficient); - const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalVotesQ); - const sharedRewards = sharingCoefficientIncrease.mul(totalVotesQ.sub(selfVotesQ)).floor(); + const selfStakeQ = q96(validatorData3.selfStake); + const totalStakesQ = q96(validatorData3.totalStakeReceived); + const oldSharingCoefficient = q96(validatorData3.sharingCoefficients[1].coefficient); + const sharingCoefficientIncrease = rewardQ.muldiv(rewardFractionQ, totalStakesQ); + const sharedRewards = sharingCoefficientIncrease.mul(totalStakesQ.sub(selfStakeQ)).floor(); const newSharingCoefficient = oldSharingCoefficient.add(sharingCoefficientIncrease); - const updatedDelegateData = { + const updatedValidatorData = { consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 5, - name: 'delegate3', + name: 'validator3', pomHeights: [], - selfVotes: BigInt(0), - totalVotesReceived: BigInt(4), + selfStake: BigInt(0), + totalStakeReceived: BigInt(4), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [ @@ -324,10 +324,10 @@ describe('DposModuleApi', () => { }; await expect( - dposMethod.updateSharedRewards(methodContext, address3, tokenID2, reward), + posMethod.updateSharedRewards(methodContext, address3, tokenID2, reward), ).resolves.toBeUndefined(); expect(tokenMethod.lock).toHaveBeenCalledTimes(1); - expect(delegateSubStore.set).toHaveBeenCalledTimes(1); + expect(validatorSubStore.set).toHaveBeenCalledTimes(1); expect(tokenMethod.lock).toHaveBeenCalledWith( methodContext, address3, @@ -335,10 +335,10 @@ describe('DposModuleApi', () => { tokenID2, sharedRewards, ); - expect(delegateSubStore.set).toHaveBeenCalledWith( + expect(validatorSubStore.set).toHaveBeenCalledWith( methodContext, address3, - updatedDelegateData, + updatedValidatorData, ); }); }); diff --git a/framework/test/unit/modules/dpos_v2/module.spec.ts b/framework/test/unit/modules/pos/module.spec.ts similarity index 59% rename from framework/test/unit/modules/dpos_v2/module.spec.ts rename to framework/test/unit/modules/pos/module.spec.ts index aae9b309ddf..89be8561946 100644 --- a/framework/test/unit/modules/dpos_v2/module.spec.ts +++ b/framework/test/unit/modules/pos/module.spec.ts @@ -17,12 +17,12 @@ import { utils } from '@liskhq/lisk-cryptography'; import { when } from 'jest-when'; import { codec } from '@liskhq/lisk-codec'; import { GenesisConfig } from '../../../../src/types'; -import { DPoSModule } from '../../../../src/modules/dpos_v2'; -import * as forgerSelectionLessTHan103Scenario from '../../../fixtures/dpos_forger_selection/dpos_forger_selection_less_than_103.json'; -import * as forgerSelectionZeroStandbyScenario from '../../../fixtures/dpos_forger_selection/dpos_forger_selection_0_standby.json'; -import * as forgerSelectionOneStandbyScenario from '../../../fixtures/dpos_forger_selection/dpos_forger_selection_exactly_1_standby.json'; -import * as forgerSelectionTwoStandbyScenario from '../../../fixtures/dpos_forger_selection/dpos_forger_selection_exactly_2_standby.json'; -import * as forgerSelectionMoreThan2StandByScenario from '../../../fixtures/dpos_forger_selection/dpos_forger_selection_more_than_2_standby.json'; +import { PoSModule } from '../../../../src/modules/pos'; +import * as forgerSelectionLessTHan103Scenario from '../../../fixtures/pos_forger_selection/pos_forger_selection_less_than_103.json'; +import * as forgerSelectionZeroStandbyScenario from '../../../fixtures/pos_forger_selection/pos_forger_selection_0_standby.json'; +import * as forgerSelectionOneStandbyScenario from '../../../fixtures/pos_forger_selection/pos_forger_selection_exactly_1_standby.json'; +import * as forgerSelectionTwoStandbyScenario from '../../../fixtures/pos_forger_selection/pos_forger_selection_exactly_2_standby.json'; +import * as forgerSelectionMoreThan2StandByScenario from '../../../fixtures/pos_forger_selection/pos_forger_selection_more_than_2_standby.json'; import { BlockAfterExecuteContext, BlockContext, @@ -34,44 +34,44 @@ import { createGenesisBlockContext, createTransientMethodContext, } from '../../../../src/testing'; -import { genesisStoreSchema } from '../../../../src/modules/dpos_v2/schemas'; -import { GenesisData, ValidatorsMethod } from '../../../../src/modules/dpos_v2/types'; +import { genesisStoreSchema } from '../../../../src/modules/pos/schemas'; +import { GenesisData, ValidatorsMethod } from '../../../../src/modules/pos/types'; import { GenesisBlockExecuteContext, Validator } from '../../../../src/state_machine/types'; import { invalidAssets, validAsset } from './genesis_block_test_data'; import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; -import { DelegateAccount, DelegateStore } from '../../../../src/modules/dpos_v2/stores/delegate'; -import { VoterStore } from '../../../../src/modules/dpos_v2/stores/voter'; -import { NameStore } from '../../../../src/modules/dpos_v2/stores/name'; -import { PreviousTimestampStore } from '../../../../src/modules/dpos_v2/stores/previous_timestamp'; -import { GenesisDataStore } from '../../../../src/modules/dpos_v2/stores/genesis'; -import { SnapshotStore } from '../../../../src/modules/dpos_v2/stores/snapshot'; +import { ValidatorAccount, ValidatorStore } from '../../../../src/modules/pos/stores/validator'; +import { StakerStore } from '../../../../src/modules/pos/stores/staker'; +import { NameStore } from '../../../../src/modules/pos/stores/name'; +import { PreviousTimestampStore } from '../../../../src/modules/pos/stores/previous_timestamp'; +import { GenesisDataStore } from '../../../../src/modules/pos/stores/genesis'; +import { SnapshotStore } from '../../../../src/modules/pos/stores/snapshot'; import { createStoreGetter } from '../../../../src/testing/utils'; import { COMMISSION_INCREASE_PERIOD, MAX_COMMISSION_INCREASE_RATE, TOKEN_ID_LENGTH, -} from '../../../../src/modules/dpos_v2/constants'; -import { EligibleDelegatesStore } from '../../../../src/modules/dpos_v2/stores/eligible_delegates'; -import { getDelegateWeight, ValidatorWeight } from '../../../../src/modules/dpos_v2/utils'; +} from '../../../../src/modules/pos/constants'; +import { EligibleValidatorsStore } from '../../../../src/modules/pos/stores/eligible_validators'; +import { getValidatorWeight, ValidatorWeight } from '../../../../src/modules/pos/utils'; -describe('DPoS module', () => { +describe('PoS module', () => { const EMPTY_KEY = Buffer.alloc(0); const defaultConfig = { - factorSelfVotes: 10, + factorSelfStakes: 10, maxLengthName: 20, - maxNumberSentVotes: 10, + maxNumberSentStakes: 10, maxNumberPendingUnlocks: 20, failSafeMissedBlocks: 50, failSafeInactiveWindow: 260000, punishmentWindow: 780000, roundLength: 103, minWeightStandby: (BigInt(1000) * BigInt(10 ** 8)).toString(), - numberActiveDelegates: 101, - numberStandbyDelegates: 2, - governanceTokenID: '0000000000000000', + numberActiveValidators: 101, + numberStandbyValidators: 2, + posTokenID: '0000000000000000', tokenIDFee: '0000000000000000', - delegateRegistrationFee: (BigInt(10) * BigInt(10) ** BigInt(8)).toString(), + validatorRegistrationFee: (BigInt(10) * BigInt(10) ** BigInt(8)).toString(), maxBFTWeightCap: 500, commissionIncreasePeriod: COMMISSION_INCREASE_PERIOD, maxCommissionIncreaseRate: MAX_COMMISSION_INCREASE_RATE, @@ -89,40 +89,40 @@ describe('DPoS module', () => { return a.address.compare(b.address); }); - let dpos: DPoSModule; + let pos: PoSModule; beforeEach(() => { - dpos = new DPoSModule(); + pos = new PoSModule(); }); describe('init', () => { it('should initialize config with default value when module config is empty', async () => { await expect( - dpos.init({ + pos.init({ genesisConfig: { chainID: '00000000' } as any, moduleConfig: {}, generatorConfig: {}, }), ).resolves.toBeUndefined(); - expect(dpos['_moduleConfig']).toEqual({ + expect(pos['_moduleConfig']).toEqual({ ...defaultConfig, minWeightStandby: BigInt(defaultConfig.minWeightStandby), - governanceTokenID: Buffer.alloc(TOKEN_ID_LENGTH), + posTokenID: Buffer.alloc(TOKEN_ID_LENGTH), tokenIDFee: Buffer.from(defaultConfig.tokenIDFee, 'hex'), - delegateRegistrationFee: BigInt(defaultConfig.delegateRegistrationFee), + validatorRegistrationFee: BigInt(defaultConfig.validatorRegistrationFee), }); }); it('should initialize config with given value', async () => { await expect( - dpos.init({ + pos.init({ genesisConfig: { chainID: '00000000' } as any, moduleConfig: { ...defaultConfig, maxLengthName: 50 }, generatorConfig: {}, }), ).toResolve(); - expect(dpos['_moduleConfig'].maxLengthName).toEqual(50); + expect(pos['_moduleConfig'].maxLengthName).toEqual(50); }); }); @@ -153,9 +153,9 @@ describe('DPoS module', () => { transfer: jest.fn(), getLockedAmount: jest.fn().mockResolvedValue(BigInt(101000000000)), }; - dpos.addDependencies(randomMethod, validatorMethod, tokenMethod); + pos.addDependencies(randomMethod, validatorMethod, tokenMethod); - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: {} as GenesisConfig, moduleConfig: defaultConfig, @@ -169,12 +169,12 @@ describe('DPoS module', () => { const context = createGenesisBlockContext({ stateStore, header: createFakeBlockHeader({ height: 12345 }), - assets: new BlockAssets([{ module: dpos.name, data: assetBytes }]), + assets: new BlockAssets([{ module: pos.name, data: assetBytes }]), }).createInitGenesisStateContext(); - jest.spyOn(dpos, 'finalizeGenesisState'); + jest.spyOn(pos, 'finalizeGenesisState'); - await expect(dpos.initGenesisState(context)).rejects.toThrow(errString as string); - expect(dpos.finalizeGenesisState).not.toHaveBeenCalled(); + await expect(pos.initGenesisState(context)).rejects.toThrow(errString as string); + expect(pos.finalizeGenesisState).not.toHaveBeenCalled(); }); }); @@ -186,89 +186,89 @@ describe('DPoS module', () => { const assetBytes = codec.encode(genesisStoreSchema, validAsset); genesisContext = createGenesisBlockContext({ stateStore, - assets: new BlockAssets([{ module: dpos.name, data: assetBytes }]), + assets: new BlockAssets([{ module: pos.name, data: assetBytes }]), }); context = genesisContext.createInitGenesisStateContext(); }); - it('should store self vote and received votes', async () => { - await expect(dpos.initGenesisState(context)).resolves.toBeUndefined(); - await expect(dpos.finalizeGenesisState(context)).toResolve(); + it('should store self stake and received stakes', async () => { + await expect(pos.initGenesisState(context)).resolves.toBeUndefined(); + await expect(pos.finalizeGenesisState(context)).toResolve(); - const delegateStore = dpos.stores.get(DelegateStore); - await expect(delegateStore.get(context, validAsset.voters[0].address)).resolves.toEqual({ + const validatorStore = pos.stores.get(ValidatorStore); + await expect(validatorStore.get(context, validAsset.stakers[0].address)).resolves.toEqual({ name: expect.any(String), consecutiveMissedBlocks: 0, isBanned: false, lastGeneratedHeight: 0, pomHeights: [], - selfVotes: BigInt(100000000000), - totalVotesReceived: BigInt(200000000000), + selfStake: BigInt(100000000000), + totalStakeReceived: BigInt(200000000000), commission: 0, lastCommissionIncreaseHeight: 0, sharingCoefficients: [], }); }); - it('should store all the votes', async () => { - await expect(dpos.initGenesisState(context)).toResolve(); - const voterStore = dpos.stores.get(VoterStore); - expect.assertions(validAsset.voters.length + 1); - for (const voter of validAsset.voters) { - await expect(voterStore.get(context, voter.address)).resolves.toEqual({ - sentVotes: voter.sentVotes, - pendingUnlocks: voter.pendingUnlocks, + it('should store all the stakes', async () => { + await expect(pos.initGenesisState(context)).toResolve(); + const stakerStore = pos.stores.get(StakerStore); + expect.assertions(validAsset.stakers.length + 1); + for (const staker of validAsset.stakers) { + await expect(stakerStore.get(context, staker.address)).resolves.toEqual({ + sentStakes: staker.sentStakes, + pendingUnlocks: staker.pendingUnlocks, }); } }); - it('should store all the delegates', async () => { - await expect(dpos.initGenesisState(context)).toResolve(); - const usernameStore = dpos.stores.get(NameStore); + it('should store all the validators', async () => { + await expect(pos.initGenesisState(context)).toResolve(); + const usernameStore = pos.stores.get(NameStore); const allNames = await usernameStore.iterate(context, { gte: Buffer.from([0]), lte: Buffer.from([255]), }); expect(allNames).toHaveLength(validAsset.validators.length); - const delegateStore = dpos.stores.get(DelegateStore); - const allDelegates = await delegateStore.iterate(context, { + const validatorStore = pos.stores.get(ValidatorStore); + const allValidators = await validatorStore.iterate(context, { gte: Buffer.alloc(20, 0), lte: Buffer.alloc(20, 255), }); - expect(allDelegates).toHaveLength(validAsset.validators.length); + expect(allValidators).toHaveLength(validAsset.validators.length); }); it('should store previous timestamp', async () => { - await expect(dpos.initGenesisState(context)).toResolve(); + await expect(pos.initGenesisState(context)).toResolve(); - const previousTimestampStore = dpos.stores.get(PreviousTimestampStore); + const previousTimestampStore = pos.stores.get(PreviousTimestampStore); await expect(previousTimestampStore.get(context, EMPTY_KEY)).resolves.toEqual({ timestamp: context.header.timestamp, }); }); it('should store genesis data', async () => { - await expect(dpos.initGenesisState(context)).toResolve(); + await expect(pos.initGenesisState(context)).toResolve(); - const genesisDataStore = dpos.stores.get(GenesisDataStore); + const genesisDataStore = pos.stores.get(GenesisDataStore); await expect(genesisDataStore.get(context, EMPTY_KEY)).resolves.toEqual({ height: context.header.height, initRounds: validAsset.genesisData.initRounds, - initDelegates: validAsset.genesisData.initDelegates, + initValidators: validAsset.genesisData.initValidators, }); }); - it('should register all active delegates as BFT validators', async () => { - await expect(dpos.initGenesisState(context)).toResolve(); - await expect(dpos.finalizeGenesisState(context)).toResolve(); + it('should register all active validators as BFT validators', async () => { + await expect(pos.initGenesisState(context)).toResolve(); + await expect(pos.finalizeGenesisState(context)).toResolve(); - expect(dpos['_validatorsMethod'].setValidatorsParams).toHaveBeenCalledWith( + expect(pos['_validatorsMethod'].setValidatorsParams).toHaveBeenCalledWith( expect.any(Object), expect.any(Object), BigInt(68), BigInt(68), - validAsset.genesisData.initDelegates.map(d => ({ + validAsset.genesisData.initValidators.map(d => ({ bftWeight: BigInt(1), address: d, })), @@ -276,51 +276,51 @@ describe('DPoS module', () => { }); it('should fail if registerValidatorKeys return false', async () => { - (dpos['_validatorsMethod'].registerValidatorKeys as jest.Mock).mockResolvedValue(false); + (pos['_validatorsMethod'].registerValidatorKeys as jest.Mock).mockResolvedValue(false); - await expect(dpos.initGenesisState(context)).toResolve(); - await expect(dpos.finalizeGenesisState(context)).rejects.toThrow('Invalid validator key'); + await expect(pos.initGenesisState(context)).toResolve(); + await expect(pos.finalizeGenesisState(context)).rejects.toThrow('Invalid validator key'); }); it('should fail if getLockedAmount return different value', async () => { - (dpos['_tokenMethod'].getLockedAmount as jest.Mock).mockResolvedValue(BigInt(0)); + (pos['_tokenMethod'].getLockedAmount as jest.Mock).mockResolvedValue(BigInt(0)); - await expect(dpos.initGenesisState(context)).toResolve(); - await expect(dpos.finalizeGenesisState(context)).rejects.toThrow( - 'Voted amount is not locked', + await expect(pos.initGenesisState(context)).toResolve(); + await expect(pos.finalizeGenesisState(context)).rejects.toThrow( + 'Staked amount is not locked', ); }); }); }); - describe('_createVoteWeightSnapshot', () => { + describe('_createStakeWeightSnapshot', () => { beforeEach(async () => { - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: {} as GenesisConfig, moduleConfig: defaultConfig, }); }); - describe('when all eligible delegates are not punished', () => { - const fixtures = forgerSelectionLessTHan103Scenario.testCases.input.voteWeights; + describe('when all eligible validators are not punished', () => { + const fixtures = forgerSelectionLessTHan103Scenario.testCases.input.validatorWeights; let context: BlockAfterExecuteContext; let stateStore: PrefixedStateReadWriter; beforeEach(async () => { stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - const eligibleDelegateStore = dpos.stores.get(EligibleDelegatesStore); + const eligibleValidatorStore = pos.stores.get(EligibleValidatorsStore); for (const data of fixtures) { const ctx = createTransientMethodContext({ stateStore }); - await eligibleDelegateStore.set( + await eligibleValidatorStore.set( ctx, - eligibleDelegateStore.getKey( + eligibleValidatorStore.getKey( Buffer.from(data.address, 'hex'), - getDelegateWeight( - BigInt(defaultConfig.factorSelfVotes), - BigInt(data.voteWeight), - BigInt(data.voteWeight), + getValidatorWeight( + BigInt(defaultConfig.factorSelfStakes), + BigInt(data.validatorWeight), + BigInt(data.validatorWeight), ), ), { lastPomHeight: 0 }, @@ -332,18 +332,18 @@ describe('DPoS module', () => { }).getBlockAfterExecuteContext(); }); - it('should create a snapshot which include all delegates', async () => { - await dpos['_createVoteWeightSnapshot'](context); + it('should create a snapshot which include all validators', async () => { + await pos['_createStakeWeightSnapshot'](context); - const snapshotStore = dpos.stores.get(SnapshotStore); + const snapshotStore = pos.stores.get(SnapshotStore); const snapshot = await snapshotStore.get(context, utils.intToBuffer(11 + 2, 4)); - expect(snapshot.delegateWeightSnapshot).toHaveLength(fixtures.length); + expect(snapshot.validatorWeightSnapshot).toHaveLength(fixtures.length); }); }); - describe('when there are delegates who are PoMed', () => { - const fixtures = forgerSelectionMoreThan2StandByScenario.testCases.input.voteWeights; + describe('when there are validators who are PoMed', () => { + const fixtures = forgerSelectionMoreThan2StandByScenario.testCases.input.validatorWeights; let context: BlockAfterExecuteContext; let stateStore: PrefixedStateReadWriter; @@ -354,71 +354,74 @@ describe('DPoS module', () => { stateStore, header: createFakeBlockHeader({ height: 1030000 }), }).getBlockAfterExecuteContext(); - const eligibleDelegateStore = dpos.stores.get(EligibleDelegatesStore); - // set first delegate banned - await eligibleDelegateStore.set( + const eligibleValidatorStore = pos.stores.get(EligibleValidatorsStore); + // set first validator banned + await eligibleValidatorStore.set( context, - eligibleDelegateStore.getKey( + eligibleValidatorStore.getKey( Buffer.from(fixtures[0].address, 'hex'), - BigInt(fixtures[0].voteWeight), + BigInt(fixtures[0].validatorWeight), ), { lastPomHeight: 1000, }, ); - await eligibleDelegateStore.set( + await eligibleValidatorStore.set( context, - eligibleDelegateStore.getKey( + eligibleValidatorStore.getKey( Buffer.from(fixtures[1].address, 'hex'), - BigInt(fixtures[1].voteWeight), + BigInt(fixtures[1].validatorWeight), ), { lastPomHeight: 250001, }, ); - await eligibleDelegateStore.set( + await eligibleValidatorStore.set( context, - eligibleDelegateStore.getKey( + eligibleValidatorStore.getKey( Buffer.from(fixtures[2].address, 'hex'), - BigInt(fixtures[2].voteWeight), + BigInt(fixtures[2].validatorWeight), ), { lastPomHeight: 250000, }, ); for (const data of fixtures.slice(3)) { - await eligibleDelegateStore.set( + await eligibleValidatorStore.set( context, - eligibleDelegateStore.getKey(Buffer.from(data.address, 'hex'), BigInt(data.voteWeight)), + eligibleValidatorStore.getKey( + Buffer.from(data.address, 'hex'), + BigInt(data.validatorWeight), + ), { lastPomHeight: 0, }, ); } - const snapshotStore = dpos.stores.get(SnapshotStore); + const snapshotStore = pos.stores.get(SnapshotStore); await snapshotStore.set(context, utils.intToBuffer(10000, 4), { - delegateWeightSnapshot: [], + validatorWeightSnapshot: [], }); await snapshotStore.set(context, utils.intToBuffer(10001, 4), { - delegateWeightSnapshot: [], + validatorWeightSnapshot: [], }); await snapshotStore.set(context, utils.intToBuffer(10002, 4), { - delegateWeightSnapshot: [], + validatorWeightSnapshot: [], }); - await dpos['_createVoteWeightSnapshot'](context); + await pos['_createStakeWeightSnapshot'](context); }); - it('should create a snapshot which includes all delegates who are not currently punished', async () => { - const snapshotStore = dpos.stores.get(SnapshotStore); + it('should create a snapshot which includes all validators who are not currently punished', async () => { + const snapshotStore = pos.stores.get(SnapshotStore); const snapshot = await snapshotStore.get(context, utils.intToBuffer(10001 + 2, 4)); - // Remove punished delegates - expect(snapshot.delegateWeightSnapshot).toHaveLength(fixtures.length - 1); + // Remove punished validators + expect(snapshot.validatorWeightSnapshot).toHaveLength(fixtures.length - 1); }); it('should remove the snapshot older than 3 rounds', async () => { - const snapshotStore = dpos.stores.get(SnapshotStore); + const snapshotStore = pos.stores.get(SnapshotStore); await expect(snapshotStore.has(context, utils.intToBuffer(10000, 4))).resolves.toBeFalse(); await expect(snapshotStore.has(context, utils.intToBuffer(10001, 4))).resolves.toBeTrue(); @@ -429,7 +432,7 @@ describe('DPoS module', () => { describe('_updateValidators', () => { beforeEach(async () => { - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: {} as GenesisConfig, moduleConfig: defaultConfig, @@ -450,14 +453,14 @@ describe('DPoS module', () => { // eslint-disable-next-line jest/valid-title,no-loop-func describe(scenario.title, () => { it('should result in the expected forgers list', async () => { - // Forger selection relies on vote weight to be sorted - const delegates = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); const stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); const blockContext = createBlockContext({ header: createFakeBlockHeader({ @@ -466,14 +469,14 @@ describe('DPoS module', () => { stateStore, }); const context = blockContext.getBlockAfterExecuteContext(); - await dpos.stores.get(GenesisDataStore).set(context, EMPTY_KEY, { + await pos.stores.get(GenesisDataStore).set(context, EMPTY_KEY, { height: 0, initRounds: 3, - initDelegates: [], + initValidators: [], }); - const snapshotStore = dpos.stores.get(SnapshotStore); + const snapshotStore = pos.stores.get(SnapshotStore); await snapshotStore.set(context, utils.intToBuffer(defaultRound, 4), { - delegateWeightSnapshot: delegates, + validatorWeightSnapshot: validators, }); const randomMethod = { getRandomBytes: jest @@ -502,9 +505,9 @@ describe('DPoS module', () => { getLockedAmount: jest.fn(), }; - dpos.addDependencies(randomMethod, validatorMethod, tokenMethod); + pos.addDependencies(randomMethod, validatorMethod, tokenMethod); - await dpos['_updateValidators'](context); + await pos['_updateValidators'](context); expect(validatorMethod.setValidatorsParams).toHaveBeenCalledTimes(1); }); @@ -512,7 +515,7 @@ describe('DPoS module', () => { } }); - describe('when there are enough standby delegates', () => { + describe('when there are enough standby validators', () => { const defaultRound = 123; let validatorMethod: ValidatorsMethod; let blockContext: BlockContext; @@ -520,14 +523,14 @@ describe('DPoS module', () => { const scenario = forgerSelectionMoreThan2StandByScenario; beforeEach(async () => { - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); const stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); blockContext = createBlockContext({ @@ -536,19 +539,19 @@ describe('DPoS module', () => { }), stateStore, }); - await dpos.stores + await pos.stores .get(GenesisDataStore) .set(blockContext.getBlockExecuteContext(), EMPTY_KEY, { height: 0, initRounds: 3, - initDelegates: [], + initValidators: [], }); - const snapshotStore = dpos.stores.get(SnapshotStore); + const snapshotStore = pos.stores.get(SnapshotStore); await snapshotStore.set( blockContext.getBlockExecuteContext(), utils.intToBuffer(defaultRound, 4), { - delegateWeightSnapshot: delegates, + validatorWeightSnapshot: validators, }, ); const randomMethod = { @@ -577,20 +580,20 @@ describe('DPoS module', () => { getLockedAmount: jest.fn(), }; - dpos.addDependencies(randomMethod, validatorMethod, tokenMethod); + pos.addDependencies(randomMethod, validatorMethod, tokenMethod); - await dpos['_updateValidators'](blockContext.getBlockAfterExecuteContext()); + await pos['_updateValidators'](blockContext.getBlockAfterExecuteContext()); }); - it('should have activeDelegates + standbyDelegates delegates in the generators list', () => { + it('should have activeValidators + standbyValidators validators in the generators list', () => { expect((validatorMethod.setValidatorsParams as jest.Mock).mock.calls[0][4]).toHaveLength( defaultConfig.roundLength, ); }); - it('should store selected stand by delegates in the generators list', () => { + it('should store selected stand by validators in the generators list', () => { const { selectedForgers } = scenario.testCases.output; - const standbyDelegatesInFixture = [ + const standbyValidatorsInFixture = [ Buffer.from(selectedForgers[selectedForgers.length - 1], 'hex'), Buffer.from(selectedForgers[selectedForgers.length - 2], 'hex'), ].sort((a, b) => a.compare(b)); @@ -600,14 +603,14 @@ describe('DPoS module', () => { const standbyCandidatesAddresses = updatedValidators .filter( validator => - standbyDelegatesInFixture.find(fixture => fixture.equals(validator.address)) !== + standbyValidatorsInFixture.find(fixture => fixture.equals(validator.address)) !== undefined, ) .sort((a, b) => a.address.compare(b.address)) .map(validator => validator.address); expect(standbyCandidatesAddresses).toHaveLength(2); - expect(standbyCandidatesAddresses).toEqual(standbyDelegatesInFixture); + expect(standbyCandidatesAddresses).toEqual(standbyValidatorsInFixture); }); }); }); @@ -618,13 +621,13 @@ describe('DPoS module', () => { let validatorsMethod: any; let stateStore: PrefixedStateReadWriter; - let delegateData: DelegateAccount[]; - let delegateAddresses: Buffer[]; + let validatorData: ValidatorAccount[]; + let validatorAddresses: Buffer[]; let previousTimestampStore: PreviousTimestampStore; - let delegateStore: DelegateStore; + let validatorStore: ValidatorStore; beforeEach(async () => { - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: { chainID: '00000000', @@ -638,14 +641,14 @@ describe('DPoS module', () => { getGeneratorsBetweenTimestamps: jest.fn(), }; - dpos.addDependencies(randomMethod, validatorsMethod, tokenMethod); + pos.addDependencies(randomMethod, validatorsMethod, tokenMethod); - delegateData = Array(103) + validatorData = Array(103) .fill({}) .map((_, index) => ({ - name: `delegate${index}`, - totalVotesReceived: BigInt(0), - selfVotes: BigInt(0), + name: `validator${index}`, + totalStakeReceived: BigInt(0), + selfStake: BigInt(0), lastGeneratedHeight: 0, isBanned: false, pomHeights: [], @@ -656,22 +659,22 @@ describe('DPoS module', () => { { tokenID: Buffer.alloc(TOKEN_ID_LENGTH), coefficient: Buffer.alloc(24) }, ], })); - delegateAddresses = Array.from({ length: 103 }, _ => utils.getRandomBytes(20)); + validatorAddresses = Array.from({ length: 103 }, _ => utils.getRandomBytes(20)); - previousTimestampStore = dpos.stores.get(PreviousTimestampStore); - delegateStore = dpos.stores.get(DelegateStore); + previousTimestampStore = pos.stores.get(PreviousTimestampStore); + validatorStore = pos.stores.get(ValidatorStore); for (let i = 0; i < 103; i += 1) { - await delegateStore.set( + await validatorStore.set( createStoreGetter(stateStore), - delegateAddresses[i], - delegateData[i], + validatorAddresses[i], + validatorData[i], ); } }); - describe('When only 1 delegate forged since last block', () => { - it('should increment "consecutiveMissedBlocks" for every forgers except forging delegate', async () => { - const generatorAddress = delegateAddresses[delegateAddresses.length - 1]; + describe('When only 1 validator forged since last block', () => { + it('should increment "consecutiveMissedBlocks" for every forgers except forging validator', async () => { + const generatorAddress = validatorAddresses[validatorAddresses.length - 1]; const previousTimestamp = 9260; const currentTimestamp = 10290; const lastForgedHeight = 926; @@ -691,39 +694,39 @@ describe('DPoS module', () => { }); const missedBlocks: Record = {}; - // Make every delegate miss its block-slot except gte and end slots + // Make every validator miss its block-slot except gte and end slots for (let i = 0; i < 102; i += 1) { - missedBlocks[delegateAddresses[i].toString('binary')] = 1; + missedBlocks[validatorAddresses[i].toString('binary')] = 1; } when(validatorsMethod.getGeneratorsBetweenTimestamps) .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - expect.assertions(delegateAddresses.length + 1); - for (const delegateAddress of delegateAddresses) { - const currentDelegate = await delegateStore.get( + expect.assertions(validatorAddresses.length + 1); + for (const validatorAddress of validatorAddresses) { + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - delegateAddress, + validatorAddress, ); - if (delegateAddress.equals(generatorAddress)) { - expect(currentDelegate.consecutiveMissedBlocks).toBe(0); - expect(currentDelegate.lastGeneratedHeight).toBe(nextForgedHeight); + if (validatorAddress.equals(generatorAddress)) { + expect(currentValidator.consecutiveMissedBlocks).toBe(0); + expect(currentValidator.lastGeneratedHeight).toBe(nextForgedHeight); } else { - expect(currentDelegate.consecutiveMissedBlocks).toBe(1); + expect(currentValidator.consecutiveMissedBlocks).toBe(1); } } }); }); - describe('When only 2 delegate missed a block since last block', () => { + describe('When only 2 validator missed a block since last block', () => { it('should increment "consecutiveMissedBlocks" only for forgers who missed a block', async () => { - const generatorAddress = delegateAddresses[delegateAddresses.length - 1]; + const generatorAddress = validatorAddresses[validatorAddresses.length - 1]; const missedForgers = [ - delegateAddresses[delegateAddresses.length - 2], - delegateAddresses[delegateAddresses.length - 3], + validatorAddresses[validatorAddresses.length - 2], + validatorAddresses[validatorAddresses.length - 3], ]; const previousTimestamp = 10260; const currentTimestamp = 10290; @@ -752,28 +755,28 @@ describe('DPoS module', () => { .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - expect.assertions(delegateAddresses.length); - for (const delegateAddress of delegateAddresses) { - const currentDelegate = await delegateStore.get( + expect.assertions(validatorAddresses.length); + for (const validatorAddress of validatorAddresses) { + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - delegateAddress, + validatorAddress, ); - if (missedForgers.some(missedForger => missedForger.equals(delegateAddress))) { - expect(currentDelegate.consecutiveMissedBlocks).toBe(1); + if (missedForgers.some(missedForger => missedForger.equals(validatorAddress))) { + expect(currentValidator.consecutiveMissedBlocks).toBe(1); } else { - expect(currentDelegate.consecutiveMissedBlocks).toBe(0); + expect(currentValidator.consecutiveMissedBlocks).toBe(0); } } }); }); - describe('When delegate missed more than 1 blocks since last block', () => { - it('should increment "consecutiveMissedBlocks" for the number of blocks that delegate missed', async () => { - const generatorIndex = delegateAddresses.length - 1; - const generatorAddress = delegateAddresses[generatorIndex]; - const missedMoreThan1Block = delegateAddresses.slice(generatorIndex - 5, generatorIndex); + describe('When validator missed more than 1 blocks since last block', () => { + it('should increment "consecutiveMissedBlocks" for the number of blocks that validator missed', async () => { + const generatorIndex = validatorAddresses.length - 1; + const generatorAddress = validatorAddresses[generatorIndex]; + const missedMoreThan1Block = validatorAddresses.slice(generatorIndex - 5, generatorIndex); const previousTimestamp = 9200; const currentTimestamp = 10290; const lastForgedHeight = 926; @@ -793,40 +796,40 @@ describe('DPoS module', () => { }); const missedBlocks: Record = {}; - for (const delegateAddress of delegateAddresses) { - missedBlocks[delegateAddress.toString('binary')] = 1; + for (const validatorAddress of validatorAddresses) { + missedBlocks[validatorAddress.toString('binary')] = 1; } - for (const delegateAddress of missedMoreThan1Block) { - missedBlocks[delegateAddress.toString('binary')] += 1; + for (const validatorAddress of missedMoreThan1Block) { + missedBlocks[validatorAddress.toString('binary')] += 1; } when(validatorsMethod.getGeneratorsBetweenTimestamps) .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - expect.assertions(delegateAddresses.length); - for (const delegateAddress of delegateAddresses) { - const currentDelegate = await delegateStore.get( + expect.assertions(validatorAddresses.length); + for (const validatorAddress of validatorAddresses) { + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - delegateAddress, + validatorAddress, ); - if (missedMoreThan1Block.some(missedForger => missedForger.equals(delegateAddress))) { - expect(currentDelegate.consecutiveMissedBlocks).toBe(2); - } else if (delegateAddress.equals(generatorAddress)) { - expect(currentDelegate.consecutiveMissedBlocks).toBe(0); + if (missedMoreThan1Block.some(missedForger => missedForger.equals(validatorAddress))) { + expect(currentValidator.consecutiveMissedBlocks).toBe(2); + } else if (validatorAddress.equals(generatorAddress)) { + expect(currentValidator.consecutiveMissedBlocks).toBe(0); } else { - expect(currentDelegate.consecutiveMissedBlocks).toBe(1); + expect(currentValidator.consecutiveMissedBlocks).toBe(1); } } }); }); - describe('When all delegates successfully forges a block', () => { + describe('When all validators successfully forges a block', () => { it('must NOT update "consecutiveMissedBlocks" for anyone', async () => { - const generatorIndex = delegateAddresses.length - 1; - const generatorAddress = delegateAddresses[generatorIndex]; + const generatorIndex = validatorAddresses.length - 1; + const generatorAddress = validatorAddresses[generatorIndex]; const previousTimestamp = 10283; const currentTimestamp = 10290; const lastForgedHeight = 926; @@ -851,17 +854,17 @@ describe('DPoS module', () => { .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - expect.assertions(delegateAddresses.length + 1); - for (const delegateAddress of delegateAddresses) { - const currentDelegate = await delegateStore.get( + expect.assertions(validatorAddresses.length + 1); + for (const validatorAddress of validatorAddresses) { + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - delegateAddress, + validatorAddress, ); - expect(currentDelegate.consecutiveMissedBlocks).toBe(0); - if (delegateAddress.equals(generatorAddress)) { - expect(currentDelegate.lastGeneratedHeight).toBe(nextForgedHeight); + expect(currentValidator.consecutiveMissedBlocks).toBe(0); + if (validatorAddress.equals(generatorAddress)) { + expect(currentValidator.lastGeneratedHeight).toBe(nextForgedHeight); } } }); @@ -869,10 +872,10 @@ describe('DPoS module', () => { describe('when forger missed a block has 50 consecutive missed block, but forged within 260k blocks', () => { it('should not ban the missed forger', async () => { - const generatorIndex = delegateAddresses.length - 1; - const missedDelegateIndex = generatorIndex - 1; - const generatorAddress = delegateAddresses[generatorIndex]; - const missedDelegate = delegateAddresses[missedDelegateIndex]; + const generatorIndex = validatorAddresses.length - 1; + const missedValidatorIndex = generatorIndex - 1; + const generatorAddress = validatorAddresses[generatorIndex]; + const missedValidator = validatorAddresses[missedValidatorIndex]; const previousTimestamp = 10000270; const currentTimestamp = 10000290; const lastForgedHeight = 920006; @@ -892,38 +895,38 @@ describe('DPoS module', () => { }); const missedBlocks: Record = {}; - missedBlocks[missedDelegate.toString('binary')] = 1; + missedBlocks[missedValidator.toString('binary')] = 1; when(validatorsMethod.getGeneratorsBetweenTimestamps) .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - delegateData[missedDelegateIndex].consecutiveMissedBlocks = 50; - delegateData[missedDelegateIndex].lastGeneratedHeight = nextForgedHeight - 260000 + 5000; + validatorData[missedValidatorIndex].consecutiveMissedBlocks = 50; + validatorData[missedValidatorIndex].lastGeneratedHeight = nextForgedHeight - 260000 + 5000; - await delegateStore.set( + await validatorStore.set( createStoreGetter(stateStore), - missedDelegate, - delegateData[missedDelegateIndex], + missedValidator, + validatorData[missedValidatorIndex], ); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - const currentDelegate = await delegateStore.get( + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - missedDelegate, + missedValidator, ); - expect(currentDelegate.isBanned).toBeFalse(); - expect(currentDelegate.consecutiveMissedBlocks).toBe(51); + expect(currentValidator.isBanned).toBeFalse(); + expect(currentValidator.consecutiveMissedBlocks).toBe(51); }); }); describe('when forger missed a block has not forged within 260k blocks, but does not have 50 consecutive missed block', () => { it('should not ban the missed forger', async () => { - const generatorIndex = delegateAddresses.length - 1; - const missedDelegateIndex = generatorIndex - 1; - const generatorAddress = delegateAddresses[generatorIndex]; - const missedDelegate = delegateAddresses[missedDelegateIndex]; + const generatorIndex = validatorAddresses.length - 1; + const missedValidatorIndex = generatorIndex - 1; + const generatorAddress = validatorAddresses[generatorIndex]; + const missedValidator = validatorAddresses[missedValidatorIndex]; const previousTimestamp = 10000270; const currentTimestamp = 10000290; const lastForgedHeight = 920006; @@ -943,38 +946,38 @@ describe('DPoS module', () => { }); const missedBlocks: Record = {}; - missedBlocks[missedDelegate.toString('binary')] = 1; + missedBlocks[missedValidator.toString('binary')] = 1; when(validatorsMethod.getGeneratorsBetweenTimestamps) .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - delegateData[missedDelegateIndex].consecutiveMissedBlocks = 40; - delegateData[missedDelegateIndex].lastGeneratedHeight = nextForgedHeight - 260000 - 1; + validatorData[missedValidatorIndex].consecutiveMissedBlocks = 40; + validatorData[missedValidatorIndex].lastGeneratedHeight = nextForgedHeight - 260000 - 1; - await delegateStore.set( + await validatorStore.set( createStoreGetter(stateStore), - missedDelegate, - delegateData[missedDelegateIndex], + missedValidator, + validatorData[missedValidatorIndex], ); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - const currentDelegate = await delegateStore.get( + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - missedDelegate, + missedValidator, ); - expect(currentDelegate.isBanned).toBeFalse(); - expect(currentDelegate.consecutiveMissedBlocks).toBe(41); + expect(currentValidator.isBanned).toBeFalse(); + expect(currentValidator.consecutiveMissedBlocks).toBe(41); }); }); describe('when forger missed a block has 50 consecutive missed block, and not forged within 260k blocks', () => { it('should ban the missed forger', async () => { - const generatorIndex = delegateAddresses.length - 1; - const missedDelegateIndex = generatorIndex - 1; - const generatorAddress = delegateAddresses[generatorIndex]; - const missedDelegate = delegateAddresses[missedDelegateIndex]; + const generatorIndex = validatorAddresses.length - 1; + const missedValidatorIndex = generatorIndex - 1; + const generatorAddress = validatorAddresses[generatorIndex]; + const missedValidator = validatorAddresses[missedValidatorIndex]; const previousTimestamp = 10000270; const currentTimestamp = 10000290; const lastForgedHeight = 920006; @@ -994,175 +997,175 @@ describe('DPoS module', () => { }); const missedBlocks: Record = {}; - missedBlocks[missedDelegate.toString('binary')] = 1; + missedBlocks[missedValidator.toString('binary')] = 1; when(validatorsMethod.getGeneratorsBetweenTimestamps) .calledWith(context.getMethodContext(), previousTimestamp, currentTimestamp) .mockReturnValue(missedBlocks); - delegateData[missedDelegateIndex].consecutiveMissedBlocks = 50; - delegateData[missedDelegateIndex].lastGeneratedHeight = nextForgedHeight - 260000 - 1; + validatorData[missedValidatorIndex].consecutiveMissedBlocks = 50; + validatorData[missedValidatorIndex].lastGeneratedHeight = nextForgedHeight - 260000 - 1; - await delegateStore.set( + await validatorStore.set( createStoreGetter(stateStore), - missedDelegate, - delegateData[missedDelegateIndex], + missedValidator, + validatorData[missedValidatorIndex], ); - await dpos['_updateProductivity'](context, previousTimestamp); + await pos['_updateProductivity'](context, previousTimestamp); - const currentDelegate = await delegateStore.get( + const currentValidator = await validatorStore.get( createStoreGetter(stateStore), - missedDelegate, + missedValidator, ); - expect(currentDelegate.isBanned).toBeTrue(); - expect(currentDelegate.consecutiveMissedBlocks).toBe(51); + expect(currentValidator.isBanned).toBeTrue(); + expect(currentValidator.consecutiveMissedBlocks).toBe(51); }); }); }); - describe('_getActiveDelegates', () => { + describe('_getActiveValidators', () => { let stateStore: PrefixedStateReadWriter; let context: BlockAfterExecuteContext; const scenario = forgerSelectionMoreThan2StandByScenario; - const initDelegates = new Array(101).fill(0).map(() => utils.getRandomBytes(20)); + const initValidators = new Array(101).fill(0).map(() => utils.getRandomBytes(20)); beforeEach(async () => { - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: {} as GenesisConfig, moduleConfig: defaultConfig, }); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - await dpos.stores.get(GenesisDataStore).set(createStoreGetter(stateStore), EMPTY_KEY, { + await pos.stores.get(GenesisDataStore).set(createStoreGetter(stateStore), EMPTY_KEY, { height: 0, initRounds: 3, - initDelegates, + initValidators, }); - jest.spyOn(dpos, '_capWeight' as never); + jest.spyOn(pos, '_capWeight' as never); }); - describe('when current round is less than initRounds + numberOfActiveDelegates', () => { - it('should select init delegates for initRounds + numberOfActiveDelegates - round', async () => { + describe('when current round is less than initRounds + numberOfActiveValidators', () => { + it('should select init validators for initRounds + numberOfActiveValidators - round', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); - const result = await dpos['_getActiveDelegates'](context, delegates, 6); - expect(result).toHaveLength(defaultConfig.numberActiveDelegates); - const fromInitDelegates = result.filter( - v => initDelegates.findIndex(address => v.address.equals(address)) > -1, + const result = await pos['_getActiveValidators'](context, validators, 6); + expect(result).toHaveLength(defaultConfig.numberActiveValidators); + const fromInitValidators = result.filter( + v => initValidators.findIndex(address => v.address.equals(address)) > -1, ); - expect(fromInitDelegates).toHaveLength(3 + defaultConfig.numberActiveDelegates - 6); + expect(fromInitValidators).toHaveLength(3 + defaultConfig.numberActiveValidators - 6); }); - it('should not select the same delegate twice', async () => { + it('should not select the same validator twice', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); - // Overwrite the snapshot validator address to be the one in init delegates - const [duplicateAddress] = initDelegates; - delegates[0].address = duplicateAddress; + sortValidatorsByWeightDesc(validators); + // Overwrite the snapshot validator address to be the one in init validators + const [duplicateAddress] = initValidators; + validators[0].address = duplicateAddress; - const result = await dpos['_getActiveDelegates'](context, delegates, 6); + const result = await pos['_getActiveValidators'](context, validators, 6); - expect(result).toHaveLength(defaultConfig.numberActiveDelegates); - const duplicateAddressList = result.filter(v => v.address.equals(initDelegates[0])); + expect(result).toHaveLength(defaultConfig.numberActiveValidators); + const duplicateAddressList = result.filter(v => v.address.equals(initValidators[0])); expect(duplicateAddressList).toHaveLength(1); }); - it('should not select from init delegates if there is not enough snapshot validators', async () => { + it('should not select from init validators if there is not enough snapshot validators', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ].slice(10); - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); - // Overwrite the snapshot validator address to be the one in init delegates - const [duplicateAddress] = initDelegates; - delegates[0].address = duplicateAddress; + // Overwrite the snapshot validator address to be the one in init validators + const [duplicateAddress] = initValidators; + validators[0].address = duplicateAddress; - const result = await dpos['_getActiveDelegates'](context, delegates, 6); + const result = await pos['_getActiveValidators'](context, validators, 6); - expect(result).toHaveLength(defaultConfig.numberActiveDelegates); + expect(result).toHaveLength(defaultConfig.numberActiveValidators); }); }); - describe('when current round is more than initRounds + numberOfActiveDelegates', () => { - it('should all if snapshotValidators is less than numberOfActiveDelegates', async () => { + describe('when current round is more than initRounds + numberOfActiveValidators', () => { + it('should all if snapshotValidators is less than numberOfActiveValidators', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ].slice(0, 10); - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); - const result = await dpos['_getActiveDelegates'](context, delegates, 104); + const result = await pos['_getActiveValidators'](context, validators, 104); expect(result).toHaveLength(10); - expect(dpos['_capWeight']).not.toHaveBeenCalled(); + expect(pos['_capWeight']).not.toHaveBeenCalled(); }); - it('should numberOfActiveDelegates if snapshotValidators is longer', async () => { + it('should numberOfActiveValidators if snapshotValidators is longer', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); - const result = await dpos['_getActiveDelegates'](context, delegates, 104); - expect(result).toHaveLength(defaultConfig.numberActiveDelegates); + const result = await pos['_getActiveValidators'](context, validators, 104); + expect(result).toHaveLength(defaultConfig.numberActiveValidators); }); - it('should cap the weight if activeDelegates is more than capValue', async () => { + it('should cap the weight if activeValidators is more than capValue', async () => { context = createBlockContext({ stateStore, }).getBlockAfterExecuteContext(); - // Forger selection relies on vote weight to be sorted - const delegates: { address: Buffer; weight: bigint }[] = [ - ...scenario.testCases.input.voteWeights.map(d => ({ + // Forger selection relies on stake weight to be sorted + const validators: { address: Buffer; weight: bigint }[] = [ + ...scenario.testCases.input.validatorWeights.map(d => ({ address: Buffer.from(d.address, 'hex'), - weight: BigInt(d.voteWeight), + weight: BigInt(d.validatorWeight), })), ]; - sortValidatorsByWeightDesc(delegates); + sortValidatorsByWeightDesc(validators); - await dpos['_getActiveDelegates'](context, delegates, 104); - expect(dpos['_capWeight']).toHaveBeenCalledWith( + await pos['_getActiveValidators'](context, validators, 104); + expect(pos['_capWeight']).toHaveBeenCalledWith( expect.any(Array), defaultConfig.maxBFTWeightCap, ); @@ -1211,7 +1214,7 @@ describe('DPoS module', () => { ]; for (const c of cases) { - dpos['_capWeight'](c.validators, c.capValue); + pos['_capWeight'](c.validators, c.capValue); expect(c.validators).toEqual(c.expectedValidators); } }); @@ -1221,7 +1224,7 @@ describe('DPoS module', () => { const genesisData: GenesisData = { height: 0, initRounds: 3, - initDelegates: [], + initValidators: [], }; const bootstrapRounds = genesisData.initRounds; @@ -1238,19 +1241,19 @@ describe('DPoS module', () => { let genesisDataStore: GenesisDataStore; beforeEach(async () => { - await dpos.init({ + await pos.init({ generatorConfig: {}, genesisConfig: { chainID: '00000000', } as GenesisConfig, moduleConfig: defaultConfig, }); - dpos.addDependencies(randomMethod, validatorsMethod, tokenMethod); + pos.addDependencies(randomMethod, validatorsMethod, tokenMethod); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - previousTimestampStore = dpos.stores.get(PreviousTimestampStore); - genesisDataStore = dpos.stores.get(GenesisDataStore); + previousTimestampStore = pos.stores.get(PreviousTimestampStore); + genesisDataStore = pos.stores.get(GenesisDataStore); await genesisDataStore.set( createTransientMethodContext({ stateStore }), @@ -1258,9 +1261,9 @@ describe('DPoS module', () => { genesisData, ); - jest.spyOn(dpos as any, '_createVoteWeightSnapshot').mockImplementation(); - jest.spyOn(dpos as any, '_updateProductivity').mockImplementation(); - jest.spyOn(dpos as any, '_updateValidators').mockImplementation(); + jest.spyOn(pos as any, '_createStakeWeightSnapshot').mockImplementation(); + jest.spyOn(pos as any, '_updateProductivity').mockImplementation(); + jest.spyOn(pos as any, '_updateValidators').mockImplementation(); }); describe('when its the last block of round after bootstrap period', () => { @@ -1281,17 +1284,17 @@ describe('DPoS module', () => { timestamp: previousTimestamp, }); - await dpos.afterTransactionsExecute(context); + await pos.afterTransactionsExecute(context); }); - it('should create vote weight snapshot', () => { - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledTimes(1); - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledWith(context); + it('should create stake weight snapshot', () => { + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledTimes(1); + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledWith(context); }); it('should update validators', () => { - expect(dpos['_updateValidators']).toHaveBeenCalledTimes(1); - expect(dpos['_updateValidators']).toHaveBeenCalledWith(context); + expect(pos['_updateValidators']).toHaveBeenCalledTimes(1); + expect(pos['_updateValidators']).toHaveBeenCalledWith(context); }); }); @@ -1313,15 +1316,15 @@ describe('DPoS module', () => { timestamp: previousTimestamp, }); - await dpos.afterTransactionsExecute(context); + await pos.afterTransactionsExecute(context); }); - it('should not create vote weight snapshot', () => { - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledTimes(0); + it('should not create stake weight snapshot', () => { + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledTimes(0); }); it('should not update validators', () => { - expect(dpos['_updateValidators']).toHaveBeenCalledTimes(0); + expect(pos['_updateValidators']).toHaveBeenCalledTimes(0); }); }); @@ -1343,17 +1346,17 @@ describe('DPoS module', () => { timestamp: previousTimestamp, }); - await dpos.afterTransactionsExecute(context); + await pos.afterTransactionsExecute(context); }); - it('should create vote weight snapshot', () => { - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledTimes(1); - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledWith(context); + it('should create stake weight snapshot', () => { + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledTimes(1); + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledWith(context); }); it('should update validators', () => { - expect(dpos['_updateValidators']).toHaveBeenCalledTimes(1); - expect(dpos['_updateValidators']).toHaveBeenCalledWith(context); + expect(pos['_updateValidators']).toHaveBeenCalledTimes(1); + expect(pos['_updateValidators']).toHaveBeenCalledWith(context); }); }); @@ -1375,16 +1378,16 @@ describe('DPoS module', () => { timestamp: previousTimestamp, }); - await dpos.afterTransactionsExecute(context); + await pos.afterTransactionsExecute(context); }); - it('should create vote weight snapshot', () => { - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledTimes(1); - expect(dpos['_createVoteWeightSnapshot']).toHaveBeenCalledWith(context); + it('should create stake weight snapshot', () => { + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledTimes(1); + expect(pos['_createStakeWeightSnapshot']).toHaveBeenCalledWith(context); }); it('should not update validators', () => { - expect(dpos['_updateValidators']).toHaveBeenCalledTimes(0); + expect(pos['_updateValidators']).toHaveBeenCalledTimes(0); }); }); @@ -1406,7 +1409,7 @@ describe('DPoS module', () => { timestamp: previousTimestamp, }); - await dpos.afterTransactionsExecute(context); + await pos.afterTransactionsExecute(context); }); it('should set previousTimestamp to current timestamp', async () => { diff --git a/framework/test/unit/modules/dpos_v2/stores/eligible_delegates_store.spec.ts b/framework/test/unit/modules/pos/stores/eligible_validators_store.spec.ts similarity index 52% rename from framework/test/unit/modules/dpos_v2/stores/eligible_delegates_store.spec.ts rename to framework/test/unit/modules/pos/stores/eligible_validators_store.spec.ts index d22555e51d5..f4dccb606aa 100644 --- a/framework/test/unit/modules/dpos_v2/stores/eligible_delegates_store.spec.ts +++ b/framework/test/unit/modules/pos/stores/eligible_validators_store.spec.ts @@ -14,35 +14,35 @@ import { utils } from '@liskhq/lisk-cryptography'; import { StoreGetter } from '../../../../../src/modules/base_store'; -import { defaultConfig, TOKEN_ID_LENGTH } from '../../../../../src/modules/dpos_v2/constants'; -import { EligibleDelegatesStore } from '../../../../../src/modules/dpos_v2/stores/eligible_delegates'; +import { defaultConfig, TOKEN_ID_LENGTH } from '../../../../../src/modules/pos/constants'; +import { EligibleValidatorsStore } from '../../../../../src/modules/pos/stores/eligible_validators'; import { PrefixedStateReadWriter } from '../../../../../src/state_machine/prefixed_state_read_writer'; import { InMemoryPrefixedStateDB } from '../../../../../src/testing/in_memory_prefixed_state'; import { createStoreGetter } from '../../../../../src/testing/utils'; -describe('EligibleDelegatesStore', () => { +describe('EligibleValidatorsStore', () => { let stateStore: PrefixedStateReadWriter; - let eligibleDelegatesStore: EligibleDelegatesStore; + let eligibleValidatorsStore: EligibleValidatorsStore; let context: StoreGetter; const storeKeys = []; - const eligibleDelegates = [ + const eligibleValidators = [ { address: Buffer.from('fa1c00809ff1b10cd269a711eef40a465ba4a9cb'), - delegateWeight: BigInt(10), + validatorWeight: BigInt(10), lastPomHeight: 278, }, { address: Buffer.from('e81fa3d9650e6427c2e35c6b41c249589e5da84c'), - delegateWeight: BigInt(11), + validatorWeight: BigInt(11), lastPomHeight: 478, }, { address: Buffer.from('14b23e2adad2afd2990bc80907989d96ee20cff6'), - delegateWeight: BigInt(12), + validatorWeight: BigInt(12), lastPomHeight: 978, }, ]; - const defaultDelegateAccount = { + const defaultValidatorAccount = { name: 'rand', commission: 0, consecutiveMissedBlocks: 0, @@ -50,37 +50,37 @@ describe('EligibleDelegatesStore', () => { lastCommissionIncreaseHeight: 0, lastGeneratedHeight: 0, pomHeights: [], - selfVotes: BigInt(200000000000), - totalVotesReceived: BigInt(250000000000), + selfStake: BigInt(200000000000), + totalStakeReceived: BigInt(250000000000), sharingCoefficients: [], }; beforeEach(async () => { stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); context = createStoreGetter(stateStore); - eligibleDelegatesStore = new EligibleDelegatesStore('dpos'); - eligibleDelegatesStore.init({ + eligibleValidatorsStore = new EligibleValidatorsStore('pos'); + eligibleValidatorsStore.init({ ...defaultConfig, tokenIDFee: Buffer.from(defaultConfig.tokenIDFee, 'hex'), minWeightStandby: BigInt(defaultConfig.minWeightStandby), - governanceTokenID: Buffer.alloc(TOKEN_ID_LENGTH), - delegateRegistrationFee: BigInt(defaultConfig.delegateRegistrationFee), + posTokenID: Buffer.alloc(TOKEN_ID_LENGTH), + validatorRegistrationFee: BigInt(defaultConfig.validatorRegistrationFee), }); - for (const eligibleDelegate of eligibleDelegates) { - const key = eligibleDelegatesStore.getKey( - eligibleDelegate.address, - eligibleDelegate.delegateWeight, + for (const eligibleValidator of eligibleValidators) { + const key = eligibleValidatorsStore.getKey( + eligibleValidator.address, + eligibleValidator.validatorWeight, ); storeKeys.push(key); - await eligibleDelegatesStore.set(context, key, { - lastPomHeight: eligibleDelegate.lastPomHeight, + await eligibleValidatorsStore.set(context, key, { + lastPomHeight: eligibleValidator.lastPomHeight, }); } }); describe('getTop', () => { - it('should get keys and values for top n delegates in order of delegate weight', async () => { - const returnedValue = await eligibleDelegatesStore.getTop(context, 2); + it('should get keys and values for top n validators in order of validator weight', async () => { + const returnedValue = await eligibleValidatorsStore.getTop(context, 2); expect(returnedValue).toHaveLength(2); expect(returnedValue[0].value.lastPomHeight).toEqual(978); @@ -90,7 +90,7 @@ describe('EligibleDelegatesStore', () => { describe('getAll', () => { it('should get all keys and values in correct order', async () => { - const returnedValue = await eligibleDelegatesStore.getAll(context); + const returnedValue = await eligibleValidatorsStore.getAll(context); expect(returnedValue).toHaveLength(3); expect(returnedValue[0].value.lastPomHeight).toEqual(978); @@ -101,68 +101,68 @@ describe('EligibleDelegatesStore', () => { describe('splitKey', () => { it('should return address and weight', () => { const address = utils.getRandomBytes(20); - const key = eligibleDelegatesStore.getKey(address, BigInt(999)); - expect(eligibleDelegatesStore.splitKey(key)).toEqual([address, BigInt(999)]); + const key = eligibleValidatorsStore.getKey(address, BigInt(999)); + expect(eligibleValidatorsStore.splitKey(key)).toEqual([address, BigInt(999)]); }); }); describe('update', () => { - it('should delete original key and not insert if delegate is banned', async () => { - await eligibleDelegatesStore.update(context, eligibleDelegates[0].address, BigInt(10), { - ...defaultDelegateAccount, + it('should delete original key and not insert if validator is banned', async () => { + await eligibleValidatorsStore.update(context, eligibleValidators[0].address, BigInt(10), { + ...defaultValidatorAccount, isBanned: true, }); await expect( - eligibleDelegatesStore.has( + eligibleValidatorsStore.has( context, - eligibleDelegatesStore.getKey( - eligibleDelegates[0].address, - defaultDelegateAccount.totalVotesReceived, + eligibleValidatorsStore.getKey( + eligibleValidators[0].address, + defaultValidatorAccount.totalStakeReceived, ), ), ).resolves.toBeFalse(); }); - it('should delete original key and not insert if delegate does not have minWeight', async () => { - await eligibleDelegatesStore.update(context, eligibleDelegates[0].address, BigInt(10), { - ...defaultDelegateAccount, - selfVotes: BigInt(0), + it('should delete original key and not insert if validator does not have minWeight', async () => { + await eligibleValidatorsStore.update(context, eligibleValidators[0].address, BigInt(10), { + ...defaultValidatorAccount, + selfStake: BigInt(0), }); await expect( - eligibleDelegatesStore.has( + eligibleValidatorsStore.has( context, - eligibleDelegatesStore.getKey(eligibleDelegates[0].address, BigInt(0)), + eligibleValidatorsStore.getKey(eligibleValidators[0].address, BigInt(0)), ), ).resolves.toBeFalse(); }); it('should insert new key with latest pomHeight', async () => { - await eligibleDelegatesStore.update(context, eligibleDelegates[0].address, BigInt(10), { - ...defaultDelegateAccount, + await eligibleValidatorsStore.update(context, eligibleValidators[0].address, BigInt(10), { + ...defaultValidatorAccount, pomHeights: [10, 20, 30], }); await expect( - eligibleDelegatesStore.get( + eligibleValidatorsStore.get( context, - eligibleDelegatesStore.getKey( - eligibleDelegates[0].address, - defaultDelegateAccount.totalVotesReceived, + eligibleValidatorsStore.getKey( + eligibleValidators[0].address, + defaultValidatorAccount.totalStakeReceived, ), ), ).resolves.toEqual({ lastPomHeight: 30 }); }); - it('should insert new key with 0 if delegate does not have pomHeights', async () => { - await eligibleDelegatesStore.update(context, eligibleDelegates[0].address, BigInt(10), { - ...defaultDelegateAccount, + it('should insert new key with 0 if validator does not have pomHeights', async () => { + await eligibleValidatorsStore.update(context, eligibleValidators[0].address, BigInt(10), { + ...defaultValidatorAccount, }); await expect( - eligibleDelegatesStore.get( + eligibleValidatorsStore.get( context, - eligibleDelegatesStore.getKey( - eligibleDelegates[0].address, - defaultDelegateAccount.totalVotesReceived, + eligibleValidatorsStore.getKey( + eligibleValidators[0].address, + defaultValidatorAccount.totalStakeReceived, ), ), ).resolves.toEqual({ lastPomHeight: 0 }); diff --git a/framework/test/unit/modules/dpos_v2/update_generator_key.spec.ts b/framework/test/unit/modules/pos/update_generator_key.spec.ts similarity index 86% rename from framework/test/unit/modules/dpos_v2/update_generator_key.spec.ts rename to framework/test/unit/modules/pos/update_generator_key.spec.ts index f95640c4d72..d07c29f8270 100644 --- a/framework/test/unit/modules/dpos_v2/update_generator_key.spec.ts +++ b/framework/test/unit/modules/pos/update_generator_key.spec.ts @@ -16,29 +16,29 @@ import { Transaction } from '@liskhq/lisk-chain'; import { codec } from '@liskhq/lisk-codec'; import { utils } from '@liskhq/lisk-cryptography'; import * as testing from '../../../../src/testing'; -import { UpdateGeneratorKeyCommand } from '../../../../src/modules/dpos_v2/commands/update_generator_key'; -import { updateGeneratorKeyCommandParamsSchema } from '../../../../src/modules/dpos_v2/schemas'; -import { UpdateGeneratorKeyParams, ValidatorsMethod } from '../../../../src/modules/dpos_v2/types'; +import { UpdateGeneratorKeyCommand } from '../../../../src/modules/pos/commands/update_generator_key'; +import { updateGeneratorKeyCommandParamsSchema } from '../../../../src/modules/pos/schemas'; +import { UpdateGeneratorKeyParams, ValidatorsMethod } from '../../../../src/modules/pos/types'; import { VerifyStatus } from '../../../../src/state_machine'; import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; -import { DPoSModule } from '../../../../src/modules/dpos_v2/module'; -import { DelegateStore } from '../../../../src/modules/dpos_v2/stores/delegate'; +import { PoSModule } from '../../../../src/modules/pos/module'; +import { ValidatorStore } from '../../../../src/modules/pos/stores/validator'; import { createStoreGetter } from '../../../../src/testing/utils'; describe('Update generator key command', () => { - const dpos = new DPoSModule(); + const pos = new PoSModule(); let updateGeneratorCommand: UpdateGeneratorKeyCommand; let stateStore: PrefixedStateReadWriter; - let delegateSubstore: DelegateStore; + let validatorSubstore: ValidatorStore; const transactionParams = codec.encode(updateGeneratorKeyCommandParamsSchema, { generatorKey: utils.getRandomBytes(32), }); const publicKey = utils.getRandomBytes(32); const transaction = new Transaction({ - module: 'dpos', + module: 'pos', command: 'updateGeneratorKey', senderPublicKey: publicKey, nonce: BigInt(0), @@ -53,14 +53,14 @@ describe('Update generator key command', () => { const mockValidatorsMethod = { setValidatorGeneratorKey: jest.fn() }; beforeEach(async () => { - updateGeneratorCommand = new UpdateGeneratorKeyCommand(dpos.stores, dpos.events); + updateGeneratorCommand = new UpdateGeneratorKeyCommand(pos.stores, pos.events); updateGeneratorCommand.addDependencies((mockValidatorsMethod as unknown) as ValidatorsMethod); stateStore = new PrefixedStateReadWriter(new InMemoryPrefixedStateDB()); - delegateSubstore = dpos.stores.get(DelegateStore); - await delegateSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { + validatorSubstore = pos.stores.get(ValidatorStore); + await validatorSubstore.set(createStoreGetter(stateStore), transaction.senderAddress, { name: 'mrrobot', - totalVotesReceived: BigInt(10000000000), - selfVotes: BigInt(1000000000), + totalStakeReceived: BigInt(10000000000), + selfStake: BigInt(1000000000), lastGeneratedHeight: 100, isBanned: false, pomHeights: [], @@ -92,7 +92,7 @@ describe('Update generator key command', () => { generatorKey: utils.getRandomBytes(64), }); const invalidTransaction = new Transaction({ - module: 'dpos', + module: 'pos', command: 'updateGeneratorKey', senderPublicKey: publicKey, nonce: BigInt(0), @@ -128,7 +128,7 @@ describe('Update generator key command', () => { expect(result.status).toBe(VerifyStatus.FAIL); expect(result.error?.message).toInclude( - 'Delegate substore must have an entry for the store key address', + 'Validator substore must have an entry for the store key address', ); }); }); diff --git a/framework/test/unit/modules/dpos_v2/utils.spec.ts b/framework/test/unit/modules/pos/utils.spec.ts similarity index 50% rename from framework/test/unit/modules/dpos_v2/utils.spec.ts rename to framework/test/unit/modules/pos/utils.spec.ts index 10ce92b16f3..001ed5d7dd2 100644 --- a/framework/test/unit/modules/dpos_v2/utils.spec.ts +++ b/framework/test/unit/modules/pos/utils.spec.ts @@ -13,41 +13,41 @@ */ import { address as cryptoAddress } from '@liskhq/lisk-cryptography'; import { math } from '@liskhq/lisk-utils'; -import { defaultConfig, TOKEN_ID_LENGTH } from '../../../../src/modules/dpos_v2/constants'; -import { ModuleConfig, VoteSharingCoefficient } from '../../../../src/modules/dpos_v2/types'; +import { defaultConfig, TOKEN_ID_LENGTH } from '../../../../src/modules/pos/constants'; +import { ModuleConfig, StakeSharingCoefficient } from '../../../../src/modules/pos/types'; import { - calculateVoteRewards, + calculateStakeRewards, getModuleConfig, - shuffleDelegateList, -} from '../../../../src/modules/dpos_v2/utils'; -import * as delegateShufflingScenario from '../../../fixtures/dpos_delegate_shuffling/uniformly_shuffled_delegate_list.json'; + shuffleValidatorList, +} from '../../../../src/modules/pos/utils'; +import * as validatorShufflingScenario from '../../../fixtures/pos_validator_shuffling/uniformly_shuffled_validator_list.json'; const { q96 } = math; describe('utils', () => { - describe('shuffleDelegateList', () => { - const { previousRoundSeed1 } = delegateShufflingScenario.testCases.input; - const addressList = [...delegateShufflingScenario.testCases.input.delegateList].map( + describe('shuffleValidatorList', () => { + const { previousRoundSeed1 } = validatorShufflingScenario.testCases.input; + const addressList = [...validatorShufflingScenario.testCases.input.validatorList].map( address => ({ address: Buffer.from(address, 'hex'), weight: BigInt(1), }), ); - it('should return a list of uniformly shuffled list of delegates', () => { - const shuffledDelegateList = shuffleDelegateList( + it('should return a list of uniformly shuffled list of validators', () => { + const shuffledValidatorList = shuffleValidatorList( Buffer.from(previousRoundSeed1, 'hex'), addressList, ); - expect(shuffledDelegateList).toHaveLength(addressList.length); - shuffledDelegateList.forEach(delegate => + expect(shuffledValidatorList).toHaveLength(addressList.length); + shuffledValidatorList.forEach(validator => expect( addressList.map(a => cryptoAddress.getLisk32AddressFromAddress(a.address)), - ).toContain(cryptoAddress.getLisk32AddressFromAddress(delegate.address)), + ).toContain(cryptoAddress.getLisk32AddressFromAddress(validator.address)), ); - expect(shuffledDelegateList.map(b => b.address.toString('hex'))).toEqual( - delegateShufflingScenario.testCases.output.delegateList, + expect(shuffledValidatorList.map(b => b.address.toString('hex'))).toEqual( + validatorShufflingScenario.testCases.output.validatorList, ); }); }); @@ -57,47 +57,47 @@ describe('utils', () => { const expected: ModuleConfig = { ...defaultConfig, minWeightStandby: BigInt(defaultConfig.minWeightStandby), - governanceTokenID: Buffer.alloc(TOKEN_ID_LENGTH), + posTokenID: Buffer.alloc(TOKEN_ID_LENGTH), tokenIDFee: Buffer.from(defaultConfig.tokenIDFee, 'hex'), - delegateRegistrationFee: BigInt(defaultConfig.delegateRegistrationFee), + validatorRegistrationFee: BigInt(defaultConfig.validatorRegistrationFee), }; const actual: ModuleConfig = getModuleConfig({ ...defaultConfig, - governanceTokenID: '0000000000000000', + posTokenID: '0000000000000000', }); expect(actual).toStrictEqual(expected); }); }); - describe('calculateVoteRewards', () => { - const delegateSharingCoefficient: VoteSharingCoefficient = { + describe('calculateStakeRewards', () => { + const validatorSharingCoefficient: StakeSharingCoefficient = { tokenID: Buffer.alloc(TOKEN_ID_LENGTH), coefficient: q96(100).toBuffer(), }; - const voteSharingCoefficient: VoteSharingCoefficient = { + const stakeSharingCoefficient: StakeSharingCoefficient = { tokenID: Buffer.alloc(TOKEN_ID_LENGTH), coefficient: q96(10).toBuffer(), }; const amount = BigInt(10); - it('should calculate the vote reward', () => { + it('should calculate the stake reward', () => { const qAmount = q96(amount); - const qVoteSharingCoefficient = q96(voteSharingCoefficient.coefficient); - const qDelegateSharingCoefficient = q96(delegateSharingCoefficient.coefficient); - const expectedReward = qDelegateSharingCoefficient - .sub(qVoteSharingCoefficient) + const qStakeSharingCoefficient = q96(stakeSharingCoefficient.coefficient); + const qValidatorSharingCoefficient = q96(validatorSharingCoefficient.coefficient); + const expectedReward = qValidatorSharingCoefficient + .sub(qStakeSharingCoefficient) .mul(qAmount) .floor(); - const reward = calculateVoteRewards( - voteSharingCoefficient, + const reward = calculateStakeRewards( + stakeSharingCoefficient, amount, - delegateSharingCoefficient, + validatorSharingCoefficient, ); expect(reward).toEqual(expectedReward); diff --git a/framework/test/unit/modules/random/endpoint.spec.ts b/framework/test/unit/modules/random/endpoint.spec.ts index 723dc7a2596..4ab88d55c8f 100644 --- a/framework/test/unit/modules/random/endpoint.spec.ts +++ b/framework/test/unit/modules/random/endpoint.spec.ts @@ -21,7 +21,7 @@ import { ValidatorRevealsStore } from '../../../../src/modules/random/stores/val import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_state_read_writer'; import { createTransientModuleEndpointContext } from '../../../../src/testing'; import { InMemoryPrefixedStateDB } from '../../../../src/testing/in_memory_prefixed_state'; -import * as genesisDelegates from '../../../fixtures/genesis_delegates.json'; +import * as genesisValidators from '../../../fixtures/genesis_validators.json'; describe('RandomModuleEndpoint', () => { let randomEndpoint: RandomEndpoint; @@ -30,25 +30,25 @@ describe('RandomModuleEndpoint', () => { const validatorsData = [ { generatorAddress: cryptography.address.getAddressFromLisk32Address( - genesisDelegates.delegates[0].address, + genesisValidators.validators[0].address, ), - seedReveal: Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[0], 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[0].hashOnion.hashes[0], 'hex'), height: 1, valid: true, }, { generatorAddress: cryptography.address.getAddressFromLisk32Address( - genesisDelegates.delegates[1].address, + genesisValidators.validators[1].address, ), - seedReveal: Buffer.from(genesisDelegates.delegates[1].hashOnion.hashes[1], 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[1].hashOnion.hashes[1], 'hex'), height: 3, valid: true, }, { generatorAddress: cryptography.address.getAddressFromLisk32Address( - genesisDelegates.delegates[2].address, + genesisValidators.validators[2].address, ), - seedReveal: Buffer.from(genesisDelegates.delegates[2].hashOnion.hashes[1], 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[2].hashOnion.hashes[1], 'hex'), height: 5, valid: true, }, @@ -74,7 +74,7 @@ describe('RandomModuleEndpoint', () => { describe('isSeedRevealValid', () => { it('should throw error when seedReveal provided in params is invalid', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; + const { address } = genesisValidators.validators[0]; const hashToBeChecked = '12345%$#6'; context.params = { generatorAddress: address, seedReveal: hashToBeChecked }; @@ -87,10 +87,10 @@ describe('RandomModuleEndpoint', () => { it('should throw error when generatorAddress provided in params is invalid', async () => { // Arrange const address = ['address']; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const hashes = cryptography.utils.hashOnion( Buffer.from(seed, 'hex'), - genesisDelegates.delegates[0].hashOnion.distance, + genesisValidators.validators[0].hashOnion.distance, 1, ); const hashToBeChecked = hashes[1].toString('hex'); @@ -116,11 +116,11 @@ describe('RandomModuleEndpoint', () => { it('should return true for a valid seed reveal', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const hashes = cryptography.utils.hashOnion( Buffer.from(seed, 'hex'), - genesisDelegates.delegates[0].hashOnion.distance, + genesisValidators.validators[0].hashOnion.distance, 1, ); const hashToBeChecked = hashes[1].toString('hex'); @@ -135,11 +135,11 @@ describe('RandomModuleEndpoint', () => { it('should return true if no last seed reveal found', async () => { // Arrange - const { address } = genesisDelegates.delegates[4]; - const seed = genesisDelegates.delegates[4].hashOnion.hashes[0]; + const { address } = genesisValidators.validators[4]; + const seed = genesisValidators.validators[4].hashOnion.hashes[0]; const hashes = cryptography.utils.hashOnion( Buffer.from(seed, 'hex'), - genesisDelegates.delegates[0].hashOnion.distance, + genesisValidators.validators[0].hashOnion.distance, 1, ); const hashToBeChecked = hashes[3].toString('hex'); @@ -154,11 +154,11 @@ describe('RandomModuleEndpoint', () => { it('should return false for an invalid seed reveal when last seed is not hash of the given reveal', async () => { // Arrange - const { address } = genesisDelegates.delegates[1]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[1]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const hashes = cryptography.utils.hashOnion( Buffer.from(seed, 'hex'), - genesisDelegates.delegates[0].hashOnion.distance, + genesisValidators.validators[0].hashOnion.distance, 1, ); const hashToBeChecked = hashes[3].toString('hex'); @@ -175,8 +175,8 @@ describe('RandomModuleEndpoint', () => { describe('setHashOnion', () => { it('should create a new seed and store it in the offchain store', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[1].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[1].hashOnion.hashes[1]; const count = 1000; const distance = 10; @@ -202,7 +202,7 @@ describe('RandomModuleEndpoint', () => { it('should throw error when address provided in params is invalid', async () => { // Arrange const address = ['address']; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 1000; context.params = { address, seed, count, distance }; @@ -215,7 +215,7 @@ describe('RandomModuleEndpoint', () => { it('should throw error when seed provided in params is invalid', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; + const { address } = genesisValidators.validators[0]; const seed = ['seed']; const count = 1000; const distance = 1000; @@ -229,8 +229,8 @@ describe('RandomModuleEndpoint', () => { it('should throw error when count provided in params is invalid', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 'count'; const distance = 1000; context.params = { address, seed, count, distance }; @@ -243,8 +243,8 @@ describe('RandomModuleEndpoint', () => { it('should throw error when distance provided in params is invalid', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 'distance'; context.params = { address, seed, count, distance }; @@ -257,8 +257,8 @@ describe('RandomModuleEndpoint', () => { it('should throw error when count is less than 1', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 0; const distance = 1000; context.params = { address, seed, count, distance }; @@ -271,8 +271,8 @@ describe('RandomModuleEndpoint', () => { it('should throw error when distance is less than 1', async () => { // Arrange - const { address } = genesisDelegates.delegates[0]; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + const { address } = genesisValidators.validators[0]; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 0; context.params = { address, seed, count, distance }; @@ -289,8 +289,8 @@ describe('RandomModuleEndpoint', () => { beforeEach(async () => { // Arrange - address = genesisDelegates.delegates[0].address; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + address = genesisValidators.validators[0].address; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 10; @@ -317,11 +317,11 @@ describe('RandomModuleEndpoint', () => { let address2: string; beforeEach(async () => { - address = genesisDelegates.delegates[0].address; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + address = genesisValidators.validators[0].address; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 10; - address2 = genesisDelegates.delegates[1].address; + address2 = genesisValidators.validators[1].address; await randomEndpoint.setHashOnion({ ...context, params: { address, seed, count, distance } }); await randomEndpoint.setHashOnion({ @@ -385,11 +385,11 @@ describe('RandomModuleEndpoint', () => { beforeEach(async () => { // Arrange - address = genesisDelegates.delegates[0].address; - const seed = genesisDelegates.delegates[0].hashOnion.hashes[1]; + address = genesisValidators.validators[0].address; + const seed = genesisValidators.validators[0].hashOnion.hashes[1]; const count = 1000; const distance = 10; - address2 = genesisDelegates.delegates[1].address; + address2 = genesisValidators.validators[1].address; await randomEndpoint.setHashOnion({ ...context, params: { address, seed, count, distance } }); await randomEndpoint.setHashOnion({ @@ -425,7 +425,7 @@ describe('RandomModuleEndpoint', () => { expect(seedUsage).toEqual({ count: 20, height: 2121, - seed: genesisDelegates.delegates[0].hashOnion.hashes[1], + seed: genesisValidators.validators[0].hashOnion.hashes[1], }); }); diff --git a/framework/test/unit/modules/random/method.spec.ts b/framework/test/unit/modules/random/method.spec.ts index 2c73238b982..f4c52853a9d 100644 --- a/framework/test/unit/modules/random/method.spec.ts +++ b/framework/test/unit/modules/random/method.spec.ts @@ -22,9 +22,9 @@ import { blockHeaderAssetRandomModule } from '../../../../src/modules/random/sch import { bitwiseXOR } from '../../../../src/modules/random/utils'; import { MethodContext } from '../../../../src/state_machine'; import { createTransientMethodContext } from '../../../../src/testing'; -import * as genesisDelegates from '../../../fixtures/genesis_delegates.json'; -import { testCases } from './dpos_random_seed_generation/dpos_random_seed_generation_other_rounds.json'; -import * as randomSeedsMultipleRounds from '../../../fixtures/dpos_random_seed_generation/dpos_random_seed_generation_other_rounds.json'; +import * as genesisValidators from '../../../fixtures/genesis_validators.json'; +import { testCases } from './pos_random_seed_generation/pos_random_seed_generation_other_rounds.json'; +import * as randomSeedsMultipleRounds from '../../../fixtures/pos_random_seed_generation/pos_random_seed_generation_other_rounds.json'; import { RandomModule } from '../../../../src/modules/random'; import { ValidatorRevealsStore, @@ -43,8 +43,8 @@ describe('RandomModuleMethod', () => { const emptyBytes = Buffer.alloc(0); describe('isSeedRevealValid', () => { - const twoRoundsDelegates: ValidatorSeedReveal[] = []; - const twoRoundsDelegatesHashes: { [key: string]: Buffer[] } = {}; + const twoRoundsValidators: ValidatorSeedReveal[] = []; + const twoRoundsValidatorsHashes: { [key: string]: Buffer[] } = {}; for (const generator of testCases[0].input.blocks) { const generatorAddress = cryptography.address.getAddressFromPublicKey( @@ -52,17 +52,17 @@ describe('RandomModuleMethod', () => { ); const seedReveal = Buffer.from(generator.asset.seedReveal, 'hex'); - twoRoundsDelegates.push({ + twoRoundsValidators.push({ generatorAddress, seedReveal, height: generator.height, valid: true, }); - if (!twoRoundsDelegatesHashes[generatorAddress.toString('hex')]) { - twoRoundsDelegatesHashes[generatorAddress.toString('hex')] = []; + if (!twoRoundsValidatorsHashes[generatorAddress.toString('hex')]) { + twoRoundsValidatorsHashes[generatorAddress.toString('hex')] = []; } - twoRoundsDelegatesHashes[generatorAddress.toString('hex')].push(seedReveal); + twoRoundsValidatorsHashes[generatorAddress.toString('hex')].push(seedReveal); } beforeEach(async () => { @@ -70,13 +70,13 @@ describe('RandomModuleMethod', () => { context = createTransientMethodContext({}); randomStore = randomModule.stores.get(ValidatorRevealsStore); await randomStore.set(context, emptyBytes, { - validatorReveals: twoRoundsDelegates.slice(0, 103), + validatorReveals: twoRoundsValidators.slice(0, 103), }); }); it('should throw error when asset is undefined', async () => { // Arrange - const delegateAddress = cryptography.address.getAddressFromPublicKey( + const validatorAddress = cryptography.address.getAddressFromPublicKey( Buffer.from(testCases[0].input.blocks[0].generatorPublicKey, 'hex'), ); @@ -87,12 +87,12 @@ describe('RandomModuleMethod', () => { // Act & Assert await expect( - randomMethod.isSeedRevealValid(context, delegateAddress, new BlockAssets([blockAsset])), + randomMethod.isSeedRevealValid(context, validatorAddress, new BlockAssets([blockAsset])), ).rejects.toThrow('Block asset is missing.'); }); it('should return true for a valid seed reveal', async () => { - for (const [address, hashes] of Object.entries(twoRoundsDelegatesHashes)) { + for (const [address, hashes] of Object.entries(twoRoundsValidatorsHashes)) { // Arrange const blockAsset: BlockAsset = { module: randomModule.name, @@ -112,7 +112,7 @@ describe('RandomModuleMethod', () => { it('should return true if no last seed reveal found', async () => { // Arrange await randomStore.set(context, emptyBytes, { validatorReveals: [] }); - for (const [address, hashes] of Object.entries(twoRoundsDelegatesHashes)) { + for (const [address, hashes] of Object.entries(twoRoundsValidatorsHashes)) { const blockAsset: BlockAsset = { module: randomModule.name, data: codec.encode(blockHeaderAssetRandomModule, { seedReveal: hashes[1] }), @@ -129,8 +129,8 @@ describe('RandomModuleMethod', () => { }); it('should return false for an invalid seed reveal when last seed is not hash of the given reveal', async () => { - await randomStore.set(context, emptyBytes, { validatorReveals: twoRoundsDelegates }); - for (const [address, hashes] of Object.entries(twoRoundsDelegatesHashes)) { + await randomStore.set(context, emptyBytes, { validatorReveals: twoRoundsValidators }); + for (const [address, hashes] of Object.entries(twoRoundsValidatorsHashes)) { // Arrange const blockAsset: BlockAsset = { module: randomModule.name, @@ -151,38 +151,38 @@ describe('RandomModuleMethod', () => { describe('getRandomBytes', () => { const validatorsData = [ { - generatorAddress: Buffer.from(genesisDelegates.delegates[0].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[1], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[0].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[0].hashOnion.hashes[1], 'hex'), height: 11, valid: true, }, { - generatorAddress: Buffer.from(genesisDelegates.delegates[0].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[2], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[0].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[0].hashOnion.hashes[2], 'hex'), height: 13, valid: true, }, { - generatorAddress: Buffer.from(genesisDelegates.delegates[0].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[3], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[0].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[0].hashOnion.hashes[3], 'hex'), height: 17, valid: true, }, { - generatorAddress: Buffer.from(genesisDelegates.delegates[0].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[4], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[0].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[0].hashOnion.hashes[4], 'hex'), height: 19, valid: true, }, { - generatorAddress: Buffer.from(genesisDelegates.delegates[1].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[1].hashOnion.hashes[1], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[1].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[1].hashOnion.hashes[1], 'hex'), height: 14, valid: true, }, { - generatorAddress: Buffer.from(genesisDelegates.delegates[2].address, 'hex'), - seedReveal: Buffer.from(genesisDelegates.delegates[2].hashOnion.hashes[1], 'hex'), + generatorAddress: Buffer.from(genesisValidators.validators[2].address, 'hex'), + seedReveal: Buffer.from(genesisValidators.validators[2].hashOnion.hashes[1], 'hex'), height: 15, valid: false, }, @@ -222,8 +222,8 @@ describe('RandomModuleMethod', () => { const randomSeed = strippedHashOfIntegerBuffer(height + numberOfSeeds); const hashesExpected = [ - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[1], 'hex'), - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[2], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[2], 'hex'), ]; // Do XOR of randomSeed with hashes of seed reveal with height >= randomStoreValidator.height >= height + numberOfSeeds const xorExpected = bitwiseXOR([ @@ -243,9 +243,9 @@ describe('RandomModuleMethod', () => { const randomSeed = strippedHashOfIntegerBuffer(height + numberOfSeeds); const hashesExpected = [ - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[1], 'hex'), - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[2], 'hex'), - Buffer.from(genesisDelegates.delegates[1].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[2], 'hex'), + Buffer.from(genesisValidators.validators[1].hashOnion.hashes[1], 'hex'), ]; // Do XOR of randomSeed with hashes of seed reveal with height >= randomStoreValidator.height >= height + numberOfSeeds const xorExpected = bitwiseXOR([ @@ -265,9 +265,9 @@ describe('RandomModuleMethod', () => { const randomSeed = strippedHashOfIntegerBuffer(height + numberOfSeeds); const hashesExpected = [ - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[1], 'hex'), - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[2], 'hex'), - Buffer.from(genesisDelegates.delegates[1].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[2], 'hex'), + Buffer.from(genesisValidators.validators[1].hashOnion.hashes[1], 'hex'), ]; // Do XOR of randomSeed with hashes of seed reveal with height >= randomStoreValidator.height >= height + numberOfSeeds const xorExpected = bitwiseXOR([ @@ -287,7 +287,7 @@ describe('RandomModuleMethod', () => { const randomSeed = strippedHashOfIntegerBuffer(height + numberOfSeeds); const hashesExpected = [ - Buffer.from(genesisDelegates.delegates[0].hashOnion.hashes[1], 'hex'), + Buffer.from(genesisValidators.validators[0].hashOnion.hashes[1], 'hex'), ]; // Do XOR of randomSeed with hashes of seed reveal with height >= randomStoreValidator.height >= height + numberOfSeeds const xorExpected = bitwiseXOR([randomSeed, hashesExpected[0]]); diff --git a/framework/test/unit/modules/random/dpos_random_seed_generation b/framework/test/unit/modules/random/pos_random_seed_generation similarity index 100% rename from framework/test/unit/modules/random/dpos_random_seed_generation rename to framework/test/unit/modules/random/pos_random_seed_generation diff --git a/framework/test/unit/modules/random/random_module.spec.ts b/framework/test/unit/modules/random/random_module.spec.ts index 078f218c089..f95cde0cc53 100644 --- a/framework/test/unit/modules/random/random_module.spec.ts +++ b/framework/test/unit/modules/random/random_module.spec.ts @@ -16,7 +16,7 @@ import { utils, address } from '@liskhq/lisk-cryptography'; import { codec } from '@liskhq/lisk-codec'; import { BlockAssets, StateStore } from '@liskhq/lisk-chain'; import { InMemoryDatabase } from '@liskhq/lisk-db'; -import * as genesisDelegates from '../../../fixtures/genesis_delegates.json'; +import * as genesisValidators from '../../../fixtures/genesis_validators.json'; import { RandomModule } from '../../../../src/modules/random'; import { UsedHashOnionStoreObject, @@ -37,10 +37,10 @@ import { PrefixedStateReadWriter } from '../../../../src/state_machine/prefixed_ import { ValidatorRevealsStore } from '../../../../src/modules/random/stores/validator_reveals'; import { HashOnionStore } from '../../../../src/modules/random/stores/hash_onion'; -const convertDelegateFixture = (delegates: typeof genesisDelegates.delegates) => - delegates.map(delegate => ({ - address: delegate.address, - hashOnion: delegate.hashOnion, +const convertValidatorFixture = (validators: typeof genesisValidators.validators) => + validators.map(validator => ({ + address: validator.address, + hashOnion: validator.hashOnion, })); describe('RandomModule', () => { @@ -57,15 +57,15 @@ describe('RandomModule', () => { const db = new InMemoryDatabase(); const hashOnionStore = randomModule.offchainStores.get(HashOnionStore); offchainStore = new StateStore(db); - for (const delegate of genesisDelegates.delegates) { + for (const validator of genesisValidators.validators) { await hashOnionStore.set( // eslint-disable-next-line no-loop-func { getOffchainStore: (p1, p2) => offchainStore.getStore(p1, p2) }, - address.getAddressFromLisk32Address(delegate.address), + address.getAddressFromLisk32Address(validator.address), { - count: delegate.hashOnion.count, - distance: delegate.hashOnion.distance, - hashes: delegate.hashOnion.hashes.map(h => Buffer.from(h, 'hex')), + count: validator.hashOnion.count, + distance: validator.hashOnion.distance, + hashes: validator.hashOnion.hashes.map(h => Buffer.from(h, 'hex')), }, ); } @@ -96,7 +96,7 @@ describe('RandomModule', () => { }); describe('insertAssets', () => { - const targetDelegate = genesisDelegates.delegates[0]; + const targetValidator = genesisValidators.validators[0]; const defaultUsedHashOnion: UsedHashOnionStoreObject = { usedHashOnions: [ @@ -128,7 +128,7 @@ describe('RandomModule', () => { ], }; - const targetDelegateAddress = address.getAddressFromLisk32Address(targetDelegate.address); + const targetValidatorAddress = address.getAddressFromLisk32Address(targetValidator.address); it('should assign seed reveal to block header asset', async () => { // Arrange @@ -140,17 +140,17 @@ describe('RandomModule', () => { getMethodContext: jest.fn() as any, getStore: jest.fn() as any, // getOffchainStore: jest.fn() as any, - header: { height: 15, generatorAddress: targetDelegateAddress } as any, + header: { height: 15, generatorAddress: targetValidatorAddress } as any, }); await randomModule.offchainStores .get(UsedHashOnionsStore) - .set(blockGenerateContext, targetDelegateAddress, defaultUsedHashOnion); + .set(blockGenerateContext, targetValidatorAddress, defaultUsedHashOnion); - const seed = targetDelegate.hashOnion.hashes[1]; + const seed = targetValidator.hashOnion.hashes[1]; const hashes = utils.hashOnion( Buffer.from(seed, 'hex'), - targetDelegate.hashOnion.distance, + targetValidator.hashOnion.distance, 1, ); @@ -171,7 +171,7 @@ describe('RandomModule', () => { await expect( randomModule.offchainStores .get(UsedHashOnionsStore) - .get(blockGenerateContext, targetDelegateAddress), + .get(blockGenerateContext, targetValidatorAddress), ).resolves.toEqual(defaultUsedHashOnionUpdated); }); @@ -185,23 +185,23 @@ describe('RandomModule', () => { getOffchainStore: (p1, p2) => offchainStore.getStore(p1, p2), getMethodContext: jest.fn() as any, getStore: jest.fn() as any, - header: { height: 15, generatorAddress: targetDelegateAddress } as any, + header: { height: 15, generatorAddress: targetValidatorAddress } as any, }); await randomModule.offchainStores .get(UsedHashOnionsStore) - .set(blockGenerateContext, targetDelegateAddress, defaultUsedHashOnion); + .set(blockGenerateContext, targetValidatorAddress, defaultUsedHashOnion); - const seed = targetDelegate.hashOnion.hashes[1]; + const seed = targetValidator.hashOnion.hashes[1]; const hashes = utils.hashOnion( Buffer.from(seed, 'hex'), - targetDelegate.hashOnion.distance, + targetValidator.hashOnion.distance, 1, ); // Act await randomModule.init({ - generatorConfig: { hashOnions: convertDelegateFixture(genesisDelegates.delegates) }, + generatorConfig: { hashOnions: convertValidatorFixture(genesisValidators.validators) }, genesisConfig: {} as GenesisConfig, moduleConfig: {}, }); @@ -216,7 +216,7 @@ describe('RandomModule', () => { await expect( randomModule.offchainStores .get(UsedHashOnionsStore) - .get(blockGenerateContext, targetDelegateAddress), + .get(blockGenerateContext, targetValidatorAddress), ).resolves.toEqual(defaultUsedHashOnionUpdated); }); @@ -246,16 +246,16 @@ describe('RandomModule', () => { getOffchainStore: (p1, p2) => offchainStore.getStore(p1, p2), getMethodContext: jest.fn() as any, getStore: jest.fn() as any, - header: { height: 15, generatorAddress: targetDelegateAddress } as any, + header: { height: 15, generatorAddress: targetValidatorAddress } as any, }); await randomModule.offchainStores .get(UsedHashOnionsStore) - .set(blockGenerateContext, targetDelegateAddress, usedHashOnionInput); + .set(blockGenerateContext, targetValidatorAddress, usedHashOnionInput); - const seed = targetDelegate.hashOnion.hashes[1]; + const seed = targetValidator.hashOnion.hashes[1]; const hashes = utils.hashOnion( Buffer.from(seed, 'hex'), - targetDelegate.hashOnion.distance, + targetValidator.hashOnion.distance, 1, ); @@ -276,7 +276,7 @@ describe('RandomModule', () => { await expect( randomModule.offchainStores .get(UsedHashOnionsStore) - .get(blockGenerateContext, targetDelegateAddress), + .get(blockGenerateContext, targetValidatorAddress), ).resolves.toEqual(defaultUsedHashOnionUpdated); }); @@ -290,24 +290,24 @@ describe('RandomModule', () => { chainID: defaultChainID, getMethodContext: jest.fn() as any, getStore: jest.fn() as any, - header: { height: 15, generatorAddress: targetDelegateAddress } as any, + header: { height: 15, generatorAddress: targetValidatorAddress } as any, finalizedHeight, }); - const seed = targetDelegate.hashOnion.hashes[1]; + const seed = targetValidator.hashOnion.hashes[1]; const hashes = utils.hashOnion( Buffer.from(seed, 'hex'), - targetDelegate.hashOnion.distance, + targetValidator.hashOnion.distance, 1, ); await randomModule.offchainStores .get(UsedHashOnionsStore) - .set(blockGenerateContext, targetDelegateAddress, defaultUsedHashOnion); + .set(blockGenerateContext, targetValidatorAddress, defaultUsedHashOnion); // Act await randomModule.init({ - generatorConfig: { hashOnions: convertDelegateFixture(genesisDelegates.delegates) }, + generatorConfig: { hashOnions: convertValidatorFixture(genesisValidators.validators) }, genesisConfig: {} as GenesisConfig, moduleConfig: {}, }); @@ -323,7 +323,7 @@ describe('RandomModule', () => { await expect( randomModule.offchainStores .get(UsedHashOnionsStore) - .get(blockGenerateContext, targetDelegateAddress), + .get(blockGenerateContext, targetValidatorAddress), ).resolves.toEqual({ usedHashOnions: defaultUsedHashOnionUpdated.usedHashOnions.filter( u => u.height > finalizedHeight, @@ -333,9 +333,9 @@ describe('RandomModule', () => { it('should use random seedReveal when all seedReveal are used', async () => { // Arrange - const forgingDelegates = convertDelegateFixture(genesisDelegates.delegates); - const maxCount = (forgingDelegates as any).find( - (d: { address: string }) => d.address === targetDelegate.address, + const forgingValidators = convertValidatorFixture(genesisValidators.validators); + const maxCount = (forgingValidators as any).find( + (d: { address: string }) => d.address === targetValidator.address, ).hashOnion.count; const usedHashOnionInput: UsedHashOnionStoreObject = { @@ -371,11 +371,11 @@ describe('RandomModule', () => { chainID: defaultChainID, getMethodContext: jest.fn() as any, getStore: jest.fn() as any, - header: { height: 15, generatorAddress: targetDelegateAddress } as any, + header: { height: 15, generatorAddress: targetValidatorAddress } as any, }); await randomModule.offchainStores .get(UsedHashOnionsStore) - .set(blockGenerateContext, targetDelegateAddress, usedHashOnionInput); + .set(blockGenerateContext, targetValidatorAddress, usedHashOnionInput); // Act await randomModule.init({ @@ -390,7 +390,7 @@ describe('RandomModule', () => { await expect( randomModule.offchainStores .get(UsedHashOnionsStore) - .get(blockGenerateContext, targetDelegateAddress), + .get(blockGenerateContext, targetValidatorAddress), ).resolves.toEqual(usedHashOnionOutput); expect(blockGenerateContext.logger.warn).toHaveBeenCalledWith( 'All of the hash onion has been used already. Please update to the new hash onion.', @@ -412,7 +412,7 @@ describe('RandomModule', () => { getStore: jest.fn() as any, header: { height: 15, - generatorAddress: address.getAddressFromLisk32Address(targetDelegate.address), + generatorAddress: address.getAddressFromLisk32Address(targetValidator.address), } as any, }); @@ -426,7 +426,7 @@ describe('RandomModule', () => { const usedHashOnionStore = randomModule.offchainStores.get(UsedHashOnionsStore); await usedHashOnionStore.set( blockGenerateContext, - Buffer.from(targetDelegate.address, 'hex'), + Buffer.from(targetValidator.address, 'hex'), { usedHashOnions: [] }, ); diff --git a/framework/test/unit/modules/token/cc_commands/cc_transfer.spec.ts b/framework/test/unit/modules/token/cc_commands/cc_transfer.spec.ts index 92a493f7363..7ccfe268683 100644 --- a/framework/test/unit/modules/token/cc_commands/cc_transfer.spec.ts +++ b/framework/test/unit/modules/token/cc_commands/cc_transfer.spec.ts @@ -50,7 +50,7 @@ describe('CrossChain Transfer Command', () => { availableBalance: BigInt(10000000000), lockedBalances: [ { - module: 'dpos', + module: 'pos', amount: defaultAmount, }, ], diff --git a/framework/test/unit/modules/token/cc_method.spec.ts b/framework/test/unit/modules/token/cc_method.spec.ts index 4c2cbf8bdfb..1df505bf158 100644 --- a/framework/test/unit/modules/token/cc_method.spec.ts +++ b/framework/test/unit/modules/token/cc_method.spec.ts @@ -52,7 +52,7 @@ describe('TokenInteroperableMethod', () => { availableBalance: BigInt(10000000000), lockedBalances: [ { - module: 'dpos', + module: 'pos', amount: BigInt(100000000), }, ], @@ -503,7 +503,7 @@ describe('TokenInteroperableMethod', () => { storePrefix: Buffer.from([0, 0]), storeValue: codec.encode(userStoreSchema, { availableBalance: defaultAccount.availableBalance * BigInt(2), - lockedBalances: [{ module: 'dpos', amount: BigInt(20) }], + lockedBalances: [{ module: 'pos', amount: BigInt(20) }], }), terminatedChainID: sendingChainID, }), @@ -539,7 +539,7 @@ describe('TokenInteroperableMethod', () => { storePrefix: userStore.subStorePrefix, storeValue: codec.encode(userStoreSchema, { availableBalance: defaultAccount.availableBalance * BigInt(2), - lockedBalances: [{ module: 'dpos', amount: BigInt(20) }], + lockedBalances: [{ module: 'pos', amount: BigInt(20) }], }), terminatedChainID: sendingChainID, }), @@ -611,7 +611,7 @@ describe('TokenInteroperableMethod', () => { storePrefix: userStore.subStorePrefix, storeValue: codec.encode(userStoreSchema, { availableBalance: defaultAccount.availableBalance * BigInt(2), - lockedBalances: [{ module: 'dpos', amount: BigInt(20) }], + lockedBalances: [{ module: 'pos', amount: BigInt(20) }], }), terminatedChainID: sendingChainID, }), @@ -648,7 +648,7 @@ describe('TokenInteroperableMethod', () => { storePrefix: userStore.subStorePrefix, storeValue: codec.encode(userStoreSchema, { availableBalance: defaultEscrowAmount, - lockedBalances: [{ module: 'dpos', amount: BigInt(20) }], + lockedBalances: [{ module: 'pos', amount: BigInt(20) }], }), terminatedChainID: sendingChainID, }), diff --git a/framework/test/unit/modules/token/endpoint.spec.ts b/framework/test/unit/modules/token/endpoint.spec.ts index 794fb5c962d..3d7dcfc4f99 100644 --- a/framework/test/unit/modules/token/endpoint.spec.ts +++ b/framework/test/unit/modules/token/endpoint.spec.ts @@ -44,7 +44,7 @@ describe('token endpoint', () => { availableBalance: BigInt(10000000000), lockedBalances: [ { - module: 'dpos', + module: 'pos', amount: BigInt(100000000), }, ], diff --git a/framework/test/unit/modules/token/init_genesis_state_fixture.ts b/framework/test/unit/modules/token/init_genesis_state_fixture.ts index ed9d2a26034..575f7cbb6d5 100644 --- a/framework/test/unit/modules/token/init_genesis_state_fixture.ts +++ b/framework/test/unit/modules/token/init_genesis_state_fixture.ts @@ -19,21 +19,21 @@ const validData = { address: Buffer.alloc(20, 0), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: oneUnit, - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, { address: Buffer.alloc(20, 0), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 1, 0]), availableBalance: oneUnit, - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, { address: Buffer.alloc(20, 1), tokenID: Buffer.from([0, 0, 0, 2, 0, 0, 0, 0]), availableBalance: oneUnit, lockedBalances: [ - { module: 'dpos', amount: oneUnit }, { module: 'fee', amount: oneUnit }, + { module: 'pos', amount: oneUnit }, ], }, ], @@ -72,7 +72,7 @@ export const invalidGenesisAssets = [ address: Buffer.alloc(10, 0), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: oneUnit, - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, ...validData.userSubstore.slice(1), ], @@ -88,7 +88,7 @@ export const invalidGenesisAssets = [ address: Buffer.alloc(20, 0), tokenID: Buffer.from([9, 0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: oneUnit, - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, ...validData.userSubstore.slice(1), ], @@ -104,7 +104,7 @@ export const invalidGenesisAssets = [ address: Buffer.alloc(20, 0), tokenID: Buffer.from([9, 0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: BigInt('1000000000000000000000000000'), - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, ...validData.userSubstore.slice(1), ], @@ -120,7 +120,7 @@ export const invalidGenesisAssets = [ address: Buffer.alloc(20, 9), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: BigInt('1000'), - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, ...validData.userSubstore.slice(1), ], @@ -139,7 +139,7 @@ export const invalidGenesisAssets = [ availableBalance: BigInt('1000'), lockedBalances: [ { module: 'token', amount: oneUnit }, - { module: 'dpos', amount: oneUnit }, + { module: 'pos', amount: oneUnit }, ], }, ], @@ -273,21 +273,21 @@ export const invalidGenesisAssets = [ address: Buffer.alloc(20, 0), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: BigInt(2) ** BigInt(64) - BigInt(10), - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, { address: Buffer.alloc(20, 0), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 1, 0]), availableBalance: oneUnit, - lockedBalances: [{ module: 'dpos', amount: oneUnit }], + lockedBalances: [{ module: 'pos', amount: oneUnit }], }, { address: Buffer.alloc(20, 1), tokenID: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), availableBalance: BigInt(2) ** BigInt(64) - BigInt(10), lockedBalances: [ - { module: 'dpos', amount: oneUnit }, { module: 'fee', amount: oneUnit }, + { module: 'pos', amount: oneUnit }, ], }, ], diff --git a/framework/test/unit/modules/token/method.spec.ts b/framework/test/unit/modules/token/method.spec.ts index 4e23db99b29..c49a0d1a222 100644 --- a/framework/test/unit/modules/token/method.spec.ts +++ b/framework/test/unit/modules/token/method.spec.ts @@ -55,7 +55,7 @@ describe('token module', () => { availableBalance: BigInt(10000000000), lockedBalances: [ { - module: 'dpos', + module: 'pos', amount: BigInt(100000000), }, ], @@ -183,7 +183,7 @@ describe('token module', () => { it('should return balance if data exists', async () => { await expect( - method.getLockedAmount(methodContext, defaultAddress, defaultTokenID, 'dpos'), + method.getLockedAmount(methodContext, defaultAddress, defaultTokenID, 'pos'), ).resolves.toEqual(defaultAccount.lockedBalances[0].amount); }); }); @@ -939,7 +939,7 @@ describe('token module', () => { method.lock( methodContext, utils.getRandomBytes(20), - 'dpos', + 'pos', defaultTokenID, defaultAccount.availableBalance + BigInt(1), ), @@ -956,7 +956,7 @@ describe('token module', () => { method.lock( methodContext, defaultAddress, - 'dpos', + 'pos', defaultTokenID, defaultAccount.availableBalance + BigInt(1), ), @@ -999,7 +999,7 @@ describe('token module', () => { methodContext, userStore.getKey(defaultAddress, defaultTokenID), ); - expect(lockedBalances[0].module).toEqual('dpos'); + expect(lockedBalances[0].module).toEqual('pos'); checkEventResult(methodContext.eventQueue, LockEvent, TokenEventResult.SUCCESSFUL); }); }); @@ -1007,7 +1007,7 @@ describe('token module', () => { describe('unlock', () => { it('should reject if address does not exist', async () => { await expect( - method.unlock(methodContext, utils.getRandomBytes(20), 'dpos', defaultTokenID, BigInt(10)), + method.unlock(methodContext, utils.getRandomBytes(20), 'pos', defaultTokenID, BigInt(10)), ).rejects.toThrow('does not exist'); checkEventResult( methodContext.eventQueue, @@ -1032,7 +1032,7 @@ describe('token module', () => { method.unlock( methodContext, defaultAddress, - 'dpos', + 'pos', defaultTokenID, defaultAccount.lockedBalances[0].amount + BigInt(1), ), @@ -1049,7 +1049,7 @@ describe('token module', () => { method.unlock( methodContext, defaultAddress, - 'dpos', + 'pos', defaultTokenID, defaultAccount.lockedBalances[0].amount - BigInt(1), ), @@ -1068,7 +1068,7 @@ describe('token module', () => { method.unlock( methodContext, defaultAddress, - 'dpos', + 'pos', defaultTokenID, defaultAccount.lockedBalances[0].amount, ), diff --git a/framework/test/unit/modules/token/stores/user.spec.ts b/framework/test/unit/modules/token/stores/user.spec.ts index 9f6b28af6e5..3486c1ed8fc 100644 --- a/framework/test/unit/modules/token/stores/user.spec.ts +++ b/framework/test/unit/modules/token/stores/user.spec.ts @@ -25,7 +25,7 @@ describe('UserStore', () => { const defaultData = { availableBalance: BigInt(100), - lockedBalances: [{ module: 'dpos', amount: BigInt(99) }], + lockedBalances: [{ module: 'pos', amount: BigInt(99) }], }; let store: UserStore; @@ -80,7 +80,7 @@ describe('UserStore', () => { await store.save(context, defaultAddress, defaultTokenID, { availableBalance: BigInt(100), lockedBalances: [ - { module: 'dpos', amount: BigInt(99) }, + { module: 'pos', amount: BigInt(99) }, { module: 'chain', amount: BigInt(10) }, ], }); @@ -90,14 +90,14 @@ describe('UserStore', () => { expect(setValue.availableBalance).toEqual(BigInt(100)); expect(setValue.lockedBalances).toHaveLength(2); expect(setValue.lockedBalances[0].module).toEqual('chain'); - expect(setValue.lockedBalances[1].module).toEqual('dpos'); + expect(setValue.lockedBalances[1].module).toEqual('pos'); }); it('should removed zero locked balance element', async () => { await store.save(context, defaultAddress, defaultTokenID, { availableBalance: BigInt(100), lockedBalances: [ - { module: 'dpos', amount: BigInt(99) }, + { module: 'pos', amount: BigInt(99) }, { module: 'dps', amount: BigInt(0) }, { module: 'chain', amount: BigInt(10) }, ], @@ -108,7 +108,7 @@ describe('UserStore', () => { expect(setValue.availableBalance).toEqual(BigInt(100)); expect(setValue.lockedBalances).toHaveLength(2); expect(setValue.lockedBalances[0].module).toEqual('chain'); - expect(setValue.lockedBalances[1].module).toEqual('dpos'); + expect(setValue.lockedBalances[1].module).toEqual('pos'); }); }); diff --git a/framework/test/unit/modules/validators/method.spec.ts b/framework/test/unit/modules/validators/method.spec.ts index 8f2339173d2..879731f8c92 100644 --- a/framework/test/unit/modules/validators/method.spec.ts +++ b/framework/test/unit/modules/validators/method.spec.ts @@ -21,7 +21,7 @@ import { INVALID_BLS_KEY, KeyRegResult, } from '../../../../src/modules/validators/constants'; -import * as generatorList from '../../../fixtures/config/devnet/delegates_for_first_round.json'; +import * as generatorList from '../../../fixtures/config/devnet/validators_for_first_round.json'; import { MethodContext, createNewMethodContext, diff --git a/framework/test/unit/state_machine/event_queue.spec.ts b/framework/test/unit/state_machine/event_queue.spec.ts index 8b7c2e38deb..0f83bcc61a4 100644 --- a/framework/test/unit/state_machine/event_queue.spec.ts +++ b/framework/test/unit/state_machine/event_queue.spec.ts @@ -27,8 +27,8 @@ describe('EventQueue', () => { topics: [utils.getRandomBytes(32), utils.getRandomBytes(20)], }, { - module: 'dpos', - name: 'DPOS Event Name', + module: 'pos', + name: 'POS Event Name', height: 12, data: utils.getRandomBytes(20), topics: [utils.getRandomBytes(32), utils.getRandomBytes(20)], diff --git a/framework/test/utils/configs/config_constants.ts b/framework/test/utils/configs/config_constants.ts index 88d467170ed..678222869a1 100644 --- a/framework/test/utils/configs/config_constants.ts +++ b/framework/test/utils/configs/config_constants.ts @@ -14,7 +14,7 @@ export const constantsConfig = (overriddenConfigProperties = {}) => ({ blockTime: 10, - delegateListRoundOffset: 2, + validatorListRoundOffset: 2, chainID: '10000000', rewards: { milestones: [ @@ -31,8 +31,8 @@ export const constantsConfig = (overriddenConfigProperties = {}) => ({ bftBatchSize: 103, minRemainingBalance: '5000000', minFeePerByte: 1000, - activeDelegates: 101, - standbyDelegates: 2, + activeValidators: 101, + standbyValidators: 2, maxTransactionsSize: 15 * 1024, modules: {}, ...overriddenConfigProperties, diff --git a/framework/test/utils/mocks/transaction.ts b/framework/test/utils/mocks/transaction.ts index b3fa1faaea2..7a2b87b44b3 100644 --- a/framework/test/utils/mocks/transaction.ts +++ b/framework/test/utils/mocks/transaction.ts @@ -23,12 +23,12 @@ import { multisigRegMsgSchema, registerMultisignatureParamsSchema, } from '../../../src/modules/auth/schemas'; -import { DELEGATE_REGISTRATION_FEE } from '../../../src/modules/dpos_v2/constants'; +import { VALIDATOR_REGISTRATION_FEE } from '../../../src/modules/pos/constants'; import { - delegateRegistrationCommandParamsSchema, + validatorRegistrationCommandParamsSchema, pomCommandParamsSchema, - voteCommandParamsSchema, -} from '../../../src/modules/dpos_v2/schemas'; + stakeCommandParamsSchema, +} from '../../../src/modules/pos/schemas'; import { TransferCommand } from '../../../src/modules/token/commands/transfer'; import { transferParamsSchema } from '../../../src/modules/token/schemas'; @@ -69,7 +69,7 @@ export const createTransferTransaction = (input: { return tx; }; -export const createDelegateRegisterTransaction = (input: { +export const createValidatorRegisterTransaction = (input: { nonce: bigint; chainID: Buffer; privateKey: Buffer; @@ -80,17 +80,17 @@ export const createDelegateRegisterTransaction = (input: { fee?: bigint; }): Transaction => { const publicKey = ed.getPublicKeyFromPrivateKey(input.privateKey); - const encodedAsset = codec.encode(delegateRegistrationCommandParamsSchema, { + const encodedAsset = codec.encode(validatorRegistrationCommandParamsSchema, { name: input.username, generatorKey: input.generatorKey, blsKey: input.blsKey, proofOfPossession: input.blsProofOfPossession, - delegateRegistrationFee: DELEGATE_REGISTRATION_FEE, + validatorRegistrationFee: VALIDATOR_REGISTRATION_FEE, }); const tx = new Transaction({ - module: 'dpos', - command: 'registerDelegate', + module: 'pos', + command: 'registerValidator', nonce: input.nonce, senderPublicKey: publicKey, fee: input.fee ?? BigInt('2500000000'), @@ -103,21 +103,21 @@ export const createDelegateRegisterTransaction = (input: { return tx; }; -export const createDelegateVoteTransaction = (input: { +export const createValidatorStakeTransaction = (input: { nonce: bigint; chainID: Buffer; privateKey: Buffer; fee?: bigint; - votes: { delegateAddress: Buffer; amount: bigint }[]; + stakes: { validatorAddress: Buffer; amount: bigint }[]; }): Transaction => { - const encodedAsset = codec.encode(voteCommandParamsSchema, { - votes: input.votes, + const encodedAsset = codec.encode(stakeCommandParamsSchema, { + stakes: input.stakes, }); const publicKey = ed.getPublicKeyFromPrivateKey(input.privateKey); const tx = new Transaction({ - module: 'dpos', - command: 'voteDelegate', + module: 'pos', + command: 'stake', nonce: input.nonce, senderPublicKey: publicKey, fee: input.fee ?? BigInt('100000000'), @@ -260,7 +260,7 @@ export const createReportMisbehaviorTransaction = (input: { const publicKey = ed.getPublicKeyFromPrivateKey(input.privateKey); const tx = new Transaction({ - module: 'dpos', + module: 'pos', command: 'reportMisbehavior', nonce: input.nonce, senderPublicKey: publicKey, diff --git a/framework/tsconfig.json b/framework/tsconfig.json index 5d44a99041b..38b8fd2f6fe 100644 --- a/framework/tsconfig.json +++ b/framework/tsconfig.json @@ -4,5 +4,5 @@ "outDir": "dist-node" }, "include": ["src/**/*"], - "exclude": ["src/modules/dpos/*", "src/modules/sequence/*", "src/modules/keys/*"] + "exclude": ["src/modules/pos/*", "src/modules/sequence/*", "src/modules/keys/*"] } diff --git a/protocol-specs/config/devnet.json b/protocol-specs/config/devnet.json index f4e363181e0..d045093a9fb 100644 --- a/protocol-specs/config/devnet.json +++ b/protocol-specs/config/devnet.json @@ -3,7 +3,7 @@ "MAX_PAYLOAD_LENGTH": 15360, "BLOCK_TIME": 10, "TOTAL_AMOUNT": "10000000000000000", - "ACTIVE_DELEGATES": 101, + "ACTIVE_VALIDATORS": 101, "REWARDS": { "MILESTONES": ["500000000", "400000000", "300000000", "200000000", "100000000"], "OFFSET": 2160, @@ -1048,7 +1048,7 @@ "timestamp": 0, "senderPublicKey": "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f", "asset": { - "votes": [ + "stakes": [ "+9d3058175acab969f41ad9b86f7a2926c74258670fe56b37c429c01fca9f2f0f", "+141b16ac8d5bd150f16b1caa08f689057ca4c4434445e56661831f4e671b7c0a", "+3ff32442bb6da7d60c1b7752b24e6467813c9b698e0f278d48c43580da972135", @@ -1163,7 +1163,7 @@ "id": "6524861224470851795" }, "forging": { - "delegates": [ + "validators": [ { "encryptedPassphrase": "iterations=1&salt=476d4299531718af8c88156aab0bb7d6&cipherText=663dde611776d87029ec188dc616d96d813ecabcef62ed0ad05ffe30528f5462c8d499db943ba2ded55c3b7c506815d8db1c2d4c35121e1d27e740dc41f6c405ce8ab8e3120b23f546d8b35823a30639&iv=1a83940b72adc57ec060a648&tag=b5b1e6c6e225c428a4473735bc8f1fc9&version=1", "publicKey": "9d3058175acab969f41ad9b86f7a2926c74258670fe56b37c429c01fca9f2f0f" diff --git a/protocol-specs/config/devnet_genesis_delegates.json b/protocol-specs/config/devnet_genesis_delegates.json index 275e09be9d5..5f580b896ed 100644 --- a/protocol-specs/config/devnet_genesis_delegates.json +++ b/protocol-specs/config/devnet_genesis_delegates.json @@ -4,7 +4,7 @@ "publicKey": "5d28e992b80172f38d3a2f9592cad740fd18d3c2e187745cd5f7badf285ed819", "secondPublicKey": null, "username": "genesis_4", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -15,7 +15,7 @@ "rank": 32, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 50 }, { @@ -23,7 +23,7 @@ "publicKey": "9503d36c0810f9ac1a9d7d45bf778387a2baab151a45d77ac1289fbe29abb18f", "secondPublicKey": null, "username": "genesis_35", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -34,7 +34,7 @@ "rank": 56, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -42,7 +42,7 @@ "publicKey": "399a7d14610c4da8800ed929fc6a05133deb8fbac8403dec93226e96fa7590ee", "secondPublicKey": null, "username": "genesis_12", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -53,7 +53,7 @@ "rank": 21, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -61,7 +61,7 @@ "publicKey": "74583aba9c0b92e4f08c8c75e6df341c255ca007971195ff64d6f909dc4b7177", "secondPublicKey": null, "username": "genesis_73", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -72,7 +72,7 @@ "rank": 46, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -80,7 +80,7 @@ "publicKey": "b00269bd169f0f89bd2f278788616521dd1539868ced5a63b652208a04ee1556", "secondPublicKey": null, "username": "genesis_19", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -91,7 +91,7 @@ "rank": 71, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -99,7 +99,7 @@ "publicKey": "3476bba16437ee0e04a29daa34d753139fbcfc14152372d7be5b7c75d51bac6c", "secondPublicKey": null, "username": "genesis_50", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -110,7 +110,7 @@ "rank": 19, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -118,7 +118,7 @@ "publicKey": "4fe5cd087a319956ddc05725651e56486961b7d5733ecd23e26e463bf9253bb5", "secondPublicKey": null, "username": "genesis_5", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -129,7 +129,7 @@ "rank": 28, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -137,7 +137,7 @@ "publicKey": "386217d98eee87268a54d2d76ce9e801ac86271284d793154989e37cb31bcd0e", "secondPublicKey": null, "username": "genesis_16", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -148,7 +148,7 @@ "rank": 20, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -156,7 +156,7 @@ "publicKey": "1cc68fa0b12521158e09779fd5978ccc0ac26bf99320e00a9549b542dd9ada16", "secondPublicKey": null, "username": "genesis_21", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -167,7 +167,7 @@ "rank": 12, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -175,7 +175,7 @@ "publicKey": "6fb2e0882cd9d895e1e441b9f9be7f98e877aa0a16ae230ee5caceb7a1b896ae", "secondPublicKey": null, "username": "genesis_64", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -186,7 +186,7 @@ "rank": 44, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -194,7 +194,7 @@ "publicKey": "a796e9c0516a40ccd0eee7a32fdc2dc297fee40a9c76fef9c1bb0cf41ae69750", "secondPublicKey": null, "username": "genesis_6", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -205,7 +205,7 @@ "rank": 68, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -213,7 +213,7 @@ "publicKey": "82174ee408161186e650427032f4cfb2496f429b4157da78888cbcea39c387fc", "secondPublicKey": null, "username": "genesis_32", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -224,7 +224,7 @@ "rank": 48, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -232,7 +232,7 @@ "publicKey": "47b9b07df72d38c19867c6a8c12429e6b8e4d2be48b27cd407da590c7a2af0dc", "secondPublicKey": null, "username": "genesis_42", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -243,7 +243,7 @@ "rank": 25, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -251,7 +251,7 @@ "publicKey": "b5341e839b25c4cc2aaf421704c0fb6ba987d537678e23e45d3ca32454a2908c", "secondPublicKey": null, "username": "genesis_24", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -262,7 +262,7 @@ "rank": 73, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -270,7 +270,7 @@ "publicKey": "948b8b509579306694c00833ec1c0f81e964487db2206ddb1517bfeca2b0dc1b", "secondPublicKey": null, "username": "genesis_18", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -281,7 +281,7 @@ "rank": 54, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -289,7 +289,7 @@ "publicKey": "6164b0cc68f8de44cde90c78e838b9ee1d6041fa61cf0cfbd834d76bb369a10e", "secondPublicKey": null, "username": "genesis_49", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -300,7 +300,7 @@ "rank": 34, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -308,7 +308,7 @@ "publicKey": "a50a55d4476bb118ba5121a07b51c185a8fe0a92b65840143b006b9820124df4", "secondPublicKey": null, "username": "genesis_36", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -319,7 +319,7 @@ "rank": 67, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -327,7 +327,7 @@ "publicKey": "1af35b29ca515ff5b805a5e3a0ab8c518915b780d5988e76b0672a71b5a3be02", "secondPublicKey": null, "username": "genesis_14", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -338,7 +338,7 @@ "rank": 10, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -346,7 +346,7 @@ "publicKey": "67651d29dc8d94bcb1174d5bd602762850a89850503b01a5ffde3b726b43d3d2", "secondPublicKey": null, "username": "genesis_7", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -357,7 +357,7 @@ "rank": 39, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -365,7 +365,7 @@ "publicKey": "910da2a8e20f25ccbcb029fdcafd369b43d75e5bc4dc6d92352c29404acc350f", "secondPublicKey": null, "username": "genesis_46", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -376,7 +376,7 @@ "rank": 53, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -384,7 +384,7 @@ "publicKey": "9d3058175acab969f41ad9b86f7a2926c74258670fe56b37c429c01fca9f2f0f", "secondPublicKey": null, "username": "genesis_1", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -395,7 +395,7 @@ "rank": 63, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -403,7 +403,7 @@ "publicKey": "19ffdf99dee16e4be2db4b0e000b56ab3a4e10bee9f457d8988f75ff7a79fc00", "secondPublicKey": null, "username": "genesis_27", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -414,7 +414,7 @@ "rank": 9, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -422,7 +422,7 @@ "publicKey": "6d462852d410e84ca199a34d7ccad443784471f22cf3de37c531ce3b87ebbc41", "secondPublicKey": null, "username": "genesis_89", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -433,7 +433,7 @@ "rank": 41, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -441,7 +441,7 @@ "publicKey": "edbb9828fbe62da2a59afbc8623e8ebc5ed2f9b7f77a0cd1cdcf55edea30521c", "secondPublicKey": null, "username": "genesis_61", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -452,7 +452,7 @@ "rank": 93, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -460,7 +460,7 @@ "publicKey": "b6ac700bf890b887e218dbd55b8f6b091dfc5a684d0fd7a6f69db7dc0313b51b", "secondPublicKey": null, "username": "genesis_62", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -471,7 +471,7 @@ "rank": 74, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -479,7 +479,7 @@ "publicKey": "19d55c023d85d6061d1e196fa440a50907878e2d425bcd893366fa04bc23b4de", "secondPublicKey": null, "username": "genesis_88", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -490,7 +490,7 @@ "rank": 8, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -498,7 +498,7 @@ "publicKey": "fab7b58be4c1e9542c342023b52e9d359ea89a3af34440bdb97318273e8555f0", "secondPublicKey": null, "username": "genesis_71", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -509,7 +509,7 @@ "rank": 100, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -517,7 +517,7 @@ "publicKey": "31402977c7eaf9e38d18d0689a45d719d615de941f7e80f6db388453b46f4df5", "secondPublicKey": null, "username": "genesis_97", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -528,7 +528,7 @@ "rank": 18, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -536,7 +536,7 @@ "publicKey": "6f04988de7e63537c8f14e84b0eb51e0ea9c5da8b4b9256243b3e40b1aeccb76", "secondPublicKey": null, "username": "genesis_53", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -547,7 +547,7 @@ "rank": 43, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -555,7 +555,7 @@ "publicKey": "68680ca0bcd4676489976837edeac305c34f652e970386013ef26e67589a2516", "secondPublicKey": null, "username": "genesis_82", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -566,7 +566,7 @@ "rank": 40, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -574,7 +574,7 @@ "publicKey": "96c16a6251e1b9a8c918d5821a5aa8dfb9385607258338297221c5a226eca5c6", "secondPublicKey": null, "username": "genesis_45", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -585,7 +585,7 @@ "rank": 58, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -593,7 +593,7 @@ "publicKey": "2f9b9a43b915bb8dcea45ea3b8552ebec202eb196a7889c2495d948e15f4a724", "secondPublicKey": null, "username": "genesis_34", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -604,7 +604,7 @@ "rank": 17, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -612,7 +612,7 @@ "publicKey": "f7b9751d59dd6be6029aa36a81a3f6436e2970cf4348845ab6254678fb946c18", "secondPublicKey": null, "username": "genesis_56", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -623,7 +623,7 @@ "rank": 97, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -631,7 +631,7 @@ "publicKey": "a10ed9c59dac2c4b8264dc34f2d318719fb5f20ecdd8d6be2d7abfe32294f20d", "secondPublicKey": null, "username": "genesis_75", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -642,7 +642,7 @@ "rank": 65, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -650,7 +650,7 @@ "publicKey": "27f43391cca75cbc82d1750307649508d1d318cd015f1f172b97318f17ab954e", "secondPublicKey": null, "username": "genesis_67", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -661,7 +661,7 @@ "rank": 15, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -669,7 +669,7 @@ "publicKey": "f25af3c59ac7f5155c7a9f36762bd941b9dc9c5c051a1bc2d4e34ed773dd04a3", "secondPublicKey": null, "username": "genesis_83", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -680,7 +680,7 @@ "rank": 94, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -688,7 +688,7 @@ "publicKey": "73fec19d4bfe361c0680a7cfd24b3f744a1c1b29d932c4d89ce6157679f8af7d", "secondPublicKey": null, "username": "genesis_92", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -699,7 +699,7 @@ "rank": 45, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -707,7 +707,7 @@ "publicKey": "85b07e51ffe528f272b7eb734d0496158f2b0f890155ebe59ba2989a8ccc9a49", "secondPublicKey": null, "username": "genesis_28", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -718,7 +718,7 @@ "rank": 49, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -726,7 +726,7 @@ "publicKey": "526931663cbee883ff22369172cba091a5dd5fa1200284fa790d7aeca53d37af", "secondPublicKey": null, "username": "genesis_55", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -737,7 +737,7 @@ "rank": 29, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -745,7 +745,7 @@ "publicKey": "b137de324fcc79dd1a21ae39a2ee8eed05e76b86d8e89d378f8bb766afb8719f", "secondPublicKey": null, "username": "genesis_96", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -756,7 +756,7 @@ "rank": 72, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -764,7 +764,7 @@ "publicKey": "86499879448d1b0215d59cbf078836e3d7d9d2782d56a2274a568761bff36f19", "secondPublicKey": null, "username": "genesis_17", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -775,7 +775,7 @@ "rank": 50, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -783,7 +783,7 @@ "publicKey": "141b16ac8d5bd150f16b1caa08f689057ca4c4434445e56661831f4e671b7c0a", "secondPublicKey": null, "username": "genesis_2", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -794,7 +794,7 @@ "rank": 7, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -802,7 +802,7 @@ "publicKey": "47c8b3d6a9e418f0920ef58383260bcd04799db150612d4ff6eb399bcd07f216", "secondPublicKey": null, "username": "genesis_40", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -813,7 +813,7 @@ "rank": 26, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -821,7 +821,7 @@ "publicKey": "5c4af5cb0c1c92df2ed4feeb9751e54e951f9d3f77196511f13e636cf6064e74", "secondPublicKey": null, "username": "genesis_11", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -832,7 +832,7 @@ "rank": 31, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -840,7 +840,7 @@ "publicKey": "d3e3c8348bca51461eabfc382f8a01e8e284db54104ad37ec0695d48ae5531ac", "secondPublicKey": null, "username": "genesis_84", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -851,7 +851,7 @@ "rank": 84, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -859,7 +859,7 @@ "publicKey": "9a0f19e60581003b70291cf4a874e8217b04871e676b2c53c85a18ab95c2683b", "secondPublicKey": null, "username": "genesis_65", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -870,7 +870,7 @@ "rank": 60, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -878,7 +878,7 @@ "publicKey": "0779ca873bbda77f2850965c8a3a3d40a6ee4ec56af55f0a3f16c7c34c0f298b", "secondPublicKey": null, "username": "genesis_91", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -889,7 +889,7 @@ "rank": 5, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -897,7 +897,7 @@ "publicKey": "94b163c5a5ad346db1c84edaff51604164476cf78b8834b6b610dd03bd6b65d9", "secondPublicKey": null, "username": "genesis_48", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -908,7 +908,7 @@ "rank": 55, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -916,7 +916,7 @@ "publicKey": "95ea7eb026e250741be85e3593166ef0c4cb3a6eb9114dba8f0974987f10403f", "secondPublicKey": null, "username": "genesis_30", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -927,7 +927,7 @@ "rank": 57, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -935,7 +935,7 @@ "publicKey": "1e82c7db09da2010e7f5fef24d83bc46238a20ef7ecdf12d9f32e4318a818777", "secondPublicKey": null, "username": "genesis_93", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -946,7 +946,7 @@ "rank": 14, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -954,7 +954,7 @@ "publicKey": "c61d0822bbdbfe2a0b5503daff0ce8441c623115c94c0cfcf047a51f8b7160d3", "secondPublicKey": null, "username": "genesis_76", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -965,7 +965,7 @@ "rank": 80, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -973,7 +973,7 @@ "publicKey": "1e6ce18addd973ad432f05f16a4c86372eaca054cbdbcaf1169ad6df033f6b85", "secondPublicKey": null, "username": "genesis_66", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -984,7 +984,7 @@ "rank": 13, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -992,7 +992,7 @@ "publicKey": "e42bfabc4a61f02131760af5f2fa0311007932a819a508da25f2ce6af2468156", "secondPublicKey": null, "username": "genesis_94", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1003,7 +1003,7 @@ "rank": 89, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1011,7 +1011,7 @@ "publicKey": "9c16751dbe57f4dff7b3fb8911a62c0cb2bdee6240e3f3fefe76832788cb14c6", "secondPublicKey": null, "username": "genesis_58", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1022,7 +1022,7 @@ "rank": 62, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1030,7 +1030,7 @@ "publicKey": "9a7452495138cf7cf5a1564c3ef16b186dd8ab4f96423f160e22a3aec6eb614f", "secondPublicKey": null, "username": "genesis_43", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1041,7 +1041,7 @@ "rank": 61, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1049,7 +1049,7 @@ "publicKey": "64db2bce729e302f6021047dfd39b6c53caf83b42da4b5b881cb153a3fb31613", "secondPublicKey": null, "username": "genesis_80", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1060,7 +1060,7 @@ "rank": 38, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1068,7 +1068,7 @@ "publicKey": "4bde949c19a0803631768148019473929b5f8661e9e48efb8d895efa9dd24aef", "secondPublicKey": null, "username": "genesis_33", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1079,7 +1079,7 @@ "rank": 27, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1087,7 +1087,7 @@ "publicKey": "5f6cc5a8aac752d37c676b0d46a798f7625e37dfa1e96091983274e04ab7ffe2", "secondPublicKey": null, "username": "genesis_57", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1098,7 +1098,7 @@ "rank": 33, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1106,7 +1106,7 @@ "publicKey": "03e811dda4f51323ac712cd12299410830d655ddffb104f2c9974d90bf8c583a", "secondPublicKey": null, "username": "genesis_79", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -1117,7 +1117,7 @@ "rank": 4, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1125,7 +1125,7 @@ "publicKey": "3be2eb47134d5158e5f7d52076b624b76744b3fba8aa50791b46ba21408524c9", "secondPublicKey": null, "username": "genesis_85", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1136,7 +1136,7 @@ "rank": 22, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 50 }, { @@ -1144,7 +1144,7 @@ "publicKey": "cdd68a321ea737e82bce23d2208040f79471d36f2e6f84c74ea36ab26245e522", "secondPublicKey": null, "username": "genesis_69", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1155,7 +1155,7 @@ "rank": 81, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1163,7 +1163,7 @@ "publicKey": "55405aed8c3a1eabe678be3ad4d36043d6ef8e637d213b84ee703d87f6b250ed", "secondPublicKey": null, "username": "genesis_26", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1174,7 +1174,7 @@ "rank": 30, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1182,7 +1182,7 @@ "publicKey": "9986cedd4b5a28e4c81d9b4bff0461dddaa25099df00b8632fe99e88df28ce73", "secondPublicKey": null, "username": "genesis_78", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -1193,7 +1193,7 @@ "rank": 59, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1201,7 +1201,7 @@ "publicKey": "3ff32442bb6da7d60c1b7752b24e6467813c9b698e0f278d48c43580da972135", "secondPublicKey": null, "username": "genesis_3", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1212,7 +1212,7 @@ "rank": 24, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1220,7 +1220,7 @@ "publicKey": "3ea481498521e9fb1201b2295d0e9afa826ac6a3ef51de2f00365f915ac7ac06", "secondPublicKey": null, "username": "genesis_10", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1231,7 +1231,7 @@ "rank": 23, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1239,7 +1239,7 @@ "publicKey": "f9f6ff873c10c24eba834be28a56415a49c9c67b7c0ee9f106da827847168986", "secondPublicKey": null, "username": "genesis_70", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1250,7 +1250,7 @@ "rank": 99, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1258,7 +1258,7 @@ "publicKey": "0186d6cbee0c9b1a9783e7202f57fc234b1d98197ada1cc29cfbdf697a636ef1", "secondPublicKey": null, "username": "genesis_60", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1269,7 +1269,7 @@ "rank": 2, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1277,7 +1277,7 @@ "publicKey": "f62062b7590d46f382fb8c37a26ab0a1bd512951777aedcaa96822230727d3a1", "secondPublicKey": null, "username": "genesis_98", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1288,7 +1288,7 @@ "rank": 96, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1296,7 +1296,7 @@ "publicKey": "07935c642c7409c365258c8488760e96a851cee618aec72eeeb135c9c827f0f9", "secondPublicKey": null, "username": "genesis_54", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1307,7 +1307,7 @@ "rank": 6, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1315,7 +1315,7 @@ "publicKey": "640dfec4541daed209a455577d7ba519ad92b18692edd9ae71d1a02958f47b1b", "secondPublicKey": null, "username": "genesis_9", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1326,7 +1326,7 @@ "rank": 36, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1334,7 +1334,7 @@ "publicKey": "e818ac2e8e9ffacd2d49f0f2f6739e16711644194d10bb1a8e9e434603125fa1", "secondPublicKey": null, "username": "genesis_87", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1345,7 +1345,7 @@ "rank": 91, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1353,7 +1353,7 @@ "publicKey": "904c294899819cce0283d8d351cb10febfa0e9f0acd90a820ec8eb90a7084c37", "secondPublicKey": null, "username": "genesis_101", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1364,7 +1364,7 @@ "rank": 52, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1372,7 +1372,7 @@ "publicKey": "644a971f2c0d0d4b657d050fca27e5f9265e3dfa02a71f7fbf834cc2f2a6a4c8", "secondPublicKey": null, "username": "genesis_68", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1383,7 +1383,7 @@ "rank": 37, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1391,7 +1391,7 @@ "publicKey": "9f2fcc688518324273da230afff9756312bf23592174896fab669c2d78b1533c", "secondPublicKey": null, "username": "genesis_86", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1402,7 +1402,7 @@ "rank": 64, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1410,7 +1410,7 @@ "publicKey": "031e27beab583e2c94cb3167d128fc1a356c1ae88adfcfaa2334abffa3ae0b4c", "secondPublicKey": null, "username": "genesis_77", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1421,7 +1421,7 @@ "rank": 3, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1429,7 +1429,7 @@ "publicKey": "ba2ea5e324eeb42fa6f4d1132a1d79911721e8507033bb0abd49715f531877b4", "secondPublicKey": null, "username": "genesis_59", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1440,7 +1440,7 @@ "rank": 75, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1448,7 +1448,7 @@ "publicKey": "a10f963752b3a44702dfa48b429ac742bea94d97849b1180a36750df3a783621", "secondPublicKey": null, "username": "genesis_22", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1459,7 +1459,7 @@ "rank": 66, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1467,7 +1467,7 @@ "publicKey": "8a0bcba8e909036b7a0fdb244f049d847b117d871d203ef7cc4c3917c94fd5fd", "secondPublicKey": null, "username": "genesis_29", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1478,7 +1478,7 @@ "rank": 51, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1486,7 +1486,7 @@ "publicKey": "fc8672466cc16688b5e239a784cd0e4c0acf214af039d9b2bf7a006da4043883", "secondPublicKey": null, "username": "genesis_37", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1497,7 +1497,7 @@ "rank": 101, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1505,7 +1505,7 @@ "publicKey": "6e904b2f678eb3b6c3042acb188a607d903d441d61508d047fe36b3c982995c8", "secondPublicKey": null, "username": "genesis_13", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -1516,7 +1516,7 @@ "rank": 42, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1524,7 +1524,7 @@ "publicKey": "f33f93aa1f3ddcfd4e42d3206ddaab966f7f1b6672e5096d6da6adefd38edc67", "secondPublicKey": null, "username": "genesis_23", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1535,7 +1535,7 @@ "rank": 95, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1543,7 +1543,7 @@ "publicKey": "eabfe7093ef2394deb1b84287f2ceb1b55fe638edc3358a28fc74f64b3498094", "secondPublicKey": null, "username": "genesis_47", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1554,7 +1554,7 @@ "rank": 92, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1562,7 +1562,7 @@ "publicKey": "db821a4f828db977c6a8d186cc4a44280a6ef6f54ac18ec9eb32f78735f38683", "secondPublicKey": null, "username": "genesis_38", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1573,7 +1573,7 @@ "rank": 87, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1581,7 +1581,7 @@ "publicKey": "addb0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9", "secondPublicKey": null, "username": "genesis_100", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1592,7 +1592,7 @@ "rank": 70, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1600,7 +1600,7 @@ "publicKey": "ba7acc3bcbd47dbf13d744e57f696341c260ce2ea8f332919f18cb543b1f3fc7", "secondPublicKey": null, "username": "genesis_39", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1611,7 +1611,7 @@ "rank": 76, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1619,7 +1619,7 @@ "publicKey": "da673805f349faf9ca1db167cb941b27f4517a36d23b3c21da4159cff0045fbe", "secondPublicKey": null, "username": "genesis_25", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1630,7 +1630,7 @@ "rank": 86, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1638,7 +1638,7 @@ "publicKey": "c3d1bc76dea367512df3832c437c7b2c95508e140f655425a733090da86fb82d", "secondPublicKey": null, "username": "genesis_8", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 198018, "multiMin": 0, @@ -1649,7 +1649,7 @@ "rank": 78, "fees": 198018, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1657,7 +1657,7 @@ "publicKey": "cf8a3bf23d1936a34facc4ff63d86d21cc2e1ac17e0010035dc3ef7ae85010dc", "secondPublicKey": null, "username": "genesis_31", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1668,7 +1668,7 @@ "rank": 82, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1676,7 +1676,7 @@ "publicKey": "d1c3a2cb254554971db289b917a665b5c547617d6fd20c2d6051bc5dfc805b34", "secondPublicKey": null, "username": "genesis_41", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1687,7 +1687,7 @@ "rank": 83, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1695,7 +1695,7 @@ "publicKey": "e13a0267444e026fe755ec128858bf3c519864631e0e4c474ba33f2470a18b83", "secondPublicKey": null, "username": "genesis_20", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1706,7 +1706,7 @@ "rank": 88, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1714,7 +1714,7 @@ "publicKey": "bf9f5cfc548d29983cc0dfa5c4ec47c66c31df0f87aa669869678996902ab47f", "secondPublicKey": null, "username": "genesis_95", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1725,7 +1725,7 @@ "rank": 77, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1733,7 +1733,7 @@ "publicKey": "c4dfedeb4f639f749e498a2307f1545ddd6bda62e5503ac1832b122c4a5aedf9", "secondPublicKey": null, "username": "genesis_44", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1744,7 +1744,7 @@ "rank": 79, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 50 }, { @@ -1752,7 +1752,7 @@ "publicKey": "01389197bbaf1afb0acd47bbfeabb34aca80fb372a8f694a1c0716b3398db746", "secondPublicKey": null, "username": "genesis_51", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1763,7 +1763,7 @@ "rank": 1, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1771,7 +1771,7 @@ "publicKey": "2b6f49383af36fd9f1a72d5d2708c8c354add89aaea7edc702c420e2d5fdf22e", "secondPublicKey": null, "username": "genesis_74", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99100, "multiMin": 0, @@ -1782,7 +1782,7 @@ "rank": 16, "fees": 99100, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1790,7 +1790,7 @@ "publicKey": "d8daea40fd098d4d546aa76b8e006ce4368c052ffe2c26b6eb843e925d54a408", "secondPublicKey": null, "username": "genesis_15", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1801,7 +1801,7 @@ "rank": 85, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1809,7 +1809,7 @@ "publicKey": "e6d075e3e396673c853210f74f8fe6db5e814c304bb9cd7f362018881a21f76c", "secondPublicKey": null, "username": "genesis_90", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1820,7 +1820,7 @@ "rank": 90, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 50 }, { @@ -1828,7 +1828,7 @@ "publicKey": "1b5a93c7622c666b0228236a70ee1a31407828b71bfb6daaa29a1509e87d4d3c", "secondPublicKey": null, "username": "genesis_72", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1839,7 +1839,7 @@ "rank": 11, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1847,7 +1847,7 @@ "publicKey": "76c9494237e608d43fd6fb0114106a7517f5503cf79d7482db58a02304339b6c", "secondPublicKey": null, "username": "genesis_99", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1858,7 +1858,7 @@ "rank": 47, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1866,7 +1866,7 @@ "publicKey": "62bbb3c41e43df73de2c3f87e6577d095b84cf6deb1b2d6e87612a9156b980f8", "secondPublicKey": null, "username": "genesis_63", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 0, "multiMin": 0, @@ -1877,7 +1877,7 @@ "rank": 35, "fees": 0, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 0 }, { @@ -1885,7 +1885,7 @@ "publicKey": "aa33af13b440746b4f24312cba5fa910eb077ce6b16b84ebb482cb7720b5c686", "secondPublicKey": null, "username": "genesis_52", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 99009, "multiMin": 0, @@ -1896,7 +1896,7 @@ "rank": 69, "fees": 99009, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 }, { @@ -1904,7 +1904,7 @@ "publicKey": "f827f60366fae9f9ed65384979de780f4a18c6dbfbefb1c7d100957dde51a06d", "secondPublicKey": null, "username": "genesis_81", - "isDelegate": true, + "isValidator": true, "secondSignature": false, "balance": 297027, "multiMin": 0, @@ -1915,7 +1915,7 @@ "rank": 98, "fees": 297027, "rewards": 0, - "vote": "9999899990000000", + "stake": "9999899990000000", "productivity": 100 } ] diff --git a/protocol-specs/config/genesis_block_v2.json b/protocol-specs/config/genesis_block_v2.json index 10413c5f4d9..5cbe66bfc5e 100644 --- a/protocol-specs/config/genesis_block_v2.json +++ b/protocol-specs/config/genesis_block_v2.json @@ -1040,7 +1040,7 @@ "senderPublicKey": "5c554d43301786aec29a09b13b485176e81d1532347a351aeafe018c199fd7ca", "signature": "f695b3f6e657d0cbc5e5602a07b32e1704884d8db4beecf0c589c769ebf017472e90d0f8cc4f00b502a540e4c1d4ba2d2fbbaaf4a457dc14d405206531bbb609", "asset": { - "votes": [ + "stakes": [ "+27bac3eec40f65394197a93c93e3e03f427ec04271ec3e45d933b9550c8ab015", "+1d4677e06f870449f271f859e299e3514718e4b8498c1bd832daa7843b83d9c5", "+bee5dfc9e2dca043c3fe898199f5acfc510c274d98f463a0660aca0c375242ca", diff --git a/protocol-specs/generator_outputs/bft_processing/11_delegates_partial_switch.json b/protocol-specs/generator_outputs/bft_processing/11_validators_partial_switch.json similarity index 93% rename from protocol-specs/generator_outputs/bft_processing/11_delegates_partial_switch.json rename to protocol-specs/generator_outputs/bft_processing/11_validators_partial_switch.json index 245e7e96be0..e687818c0df 100644 --- a/protocol-specs/generator_outputs/bft_processing/11_delegates_partial_switch.json +++ b/protocol-specs/generator_outputs/bft_processing/11_validators_partial_switch.json @@ -2,22 +2,22 @@ "title": "BFT processing generation", "summary": "Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification", "config": { - "activeDelegates": 11, + "activeValidators": 11, "finalizedHeight": 0 }, "runner": "bft_processing", - "handler": "11_delegates_partial_switch", + "handler": "11_validators_partial_switch", "testCases": [ { "description": "When block with height 1 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7748076420210162913", "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -33,13 +33,13 @@ { "description": "When block with height 2 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "15308683162207262446", "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -56,13 +56,13 @@ { "description": "When block with height 3 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5622533601426856843", "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -80,13 +80,13 @@ { "description": "When block with height 4 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5414021058608832454", "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -105,13 +105,13 @@ { "description": "When block with height 5 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "17234451680913495083", "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -131,13 +131,13 @@ { "description": "When block with height 6 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "16714758248282885559", "height": 6, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -158,13 +158,13 @@ { "description": "When block with height 7 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "8719647946811673230", "height": 7, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -186,13 +186,13 @@ { "description": "When block with height 8 is forged", "input": { - "delegateName": "D8", + "validatorName": "D8", "blockHeader": { "id": "3198191471355371895", "height": 8, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "8866be938b09f9abb626b9f48e7310b0b33735d8dbbf9ebd328d6ac4a821c440", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -215,13 +215,13 @@ { "description": "When block with height 9 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "1826242805484023040", "height": 9, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -247,13 +247,13 @@ { "description": "When block with height 10 is forged", "input": { - "delegateName": "D10", + "validatorName": "D10", "blockHeader": { "id": "5351644240885712040", "height": 10, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "cf4f97b6a8663ebcb37a82737670360c8c05d3f0fe2b9b8d2002d31ed663fae5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 } }, @@ -281,13 +281,13 @@ { "description": "When block with height 11 is forged", "input": { - "delegateName": "D11", + "validatorName": "D11", "blockHeader": { "id": "5748892369479747538", "height": 11, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "75a894c0b07adcd17be59d6ddc7cdd2d6d8b2a10ccae7fefdb0a3c536a7151a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 } }, @@ -317,13 +317,13 @@ { "description": "When block with height 12 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7733195345837784852", "height": 12, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 } }, @@ -355,13 +355,13 @@ { "description": "When block with height 13 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "4601451072787876934", "height": 13, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 } }, @@ -395,13 +395,13 @@ { "description": "When block with height 14 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "9594822875653870441", "height": 14, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -437,13 +437,13 @@ { "description": "When block with height 15 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "16585062417031443062", "height": 15, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -481,13 +481,13 @@ { "description": "When block with height 16 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "12789931371912649502", "height": 16, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 } }, @@ -527,13 +527,13 @@ { "description": "When block with height 17 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "4981918036555779351", "height": 17, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 } }, @@ -575,13 +575,13 @@ { "description": "When block with height 18 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "5677167347966923126", "height": 18, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -625,13 +625,13 @@ { "description": "When block with height 19 is forged", "input": { - "delegateName": "D8", + "validatorName": "D8", "blockHeader": { "id": "10664789664901441495", "height": 19, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "8866be938b09f9abb626b9f48e7310b0b33735d8dbbf9ebd328d6ac4a821c440", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } }, @@ -677,13 +677,13 @@ { "description": "When block with height 20 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "17711031119314540266", "height": 20, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 12 } }, @@ -731,13 +731,13 @@ { "description": "When block with height 21 is forged", "input": { - "delegateName": "D10", + "validatorName": "D10", "blockHeader": { "id": "8019615789267006368", "height": 21, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "cf4f97b6a8663ebcb37a82737670360c8c05d3f0fe2b9b8d2002d31ed663fae5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 13 } }, @@ -787,13 +787,13 @@ { "description": "When block with height 22 is forged", "input": { - "delegateName": "D11", + "validatorName": "D11", "blockHeader": { "id": "8673720435704263435", "height": 22, "maxHeightPreviouslyForged": 11, "generatorPublicKey": "75a894c0b07adcd17be59d6ddc7cdd2d6d8b2a10ccae7fefdb0a3c536a7151a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 14 } }, @@ -845,13 +845,13 @@ { "description": "When block with height 23 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "6007699706281844106", "height": 23, "maxHeightPreviouslyForged": 12, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 15 } }, @@ -905,13 +905,13 @@ { "description": "When block with height 24 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "13994197425134364572", "height": 24, "maxHeightPreviouslyForged": 13, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 16 } }, @@ -967,13 +967,13 @@ { "description": "When block with height 25 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "13233097926675734316", "height": 25, "maxHeightPreviouslyForged": 14, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 17 } }, @@ -1031,13 +1031,13 @@ { "description": "When block with height 26 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "6889463652104827991", "height": 26, "maxHeightPreviouslyForged": 15, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 18 } }, @@ -1097,13 +1097,13 @@ { "description": "When block with height 27 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "7423746163586646358", "height": 27, "maxHeightPreviouslyForged": 16, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 19 } }, @@ -1165,13 +1165,13 @@ { "description": "When block with height 28 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "6476623794736544246", "height": 28, "maxHeightPreviouslyForged": 17, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 20 } }, @@ -1235,13 +1235,13 @@ { "description": "When block with height 29 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "3824500196583291025", "height": 29, "maxHeightPreviouslyForged": 18, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 21 } }, @@ -1307,13 +1307,13 @@ { "description": "When block with height 30 is forged", "input": { - "delegateName": "D8", + "validatorName": "D8", "blockHeader": { "id": "7082861240554195963", "height": 30, "maxHeightPreviouslyForged": 19, "generatorPublicKey": "8866be938b09f9abb626b9f48e7310b0b33735d8dbbf9ebd328d6ac4a821c440", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 22 } }, @@ -1381,13 +1381,13 @@ { "description": "When block with height 31 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "16942035922560182651", "height": 31, "maxHeightPreviouslyForged": 20, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 23 } }, @@ -1457,13 +1457,13 @@ { "description": "When block with height 32 is forged", "input": { - "delegateName": "D10", + "validatorName": "D10", "blockHeader": { "id": "16329097976039504304", "height": 32, "maxHeightPreviouslyForged": 21, "generatorPublicKey": "cf4f97b6a8663ebcb37a82737670360c8c05d3f0fe2b9b8d2002d31ed663fae5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 24 } }, @@ -1535,13 +1535,13 @@ { "description": "When block with height 33 is forged", "input": { - "delegateName": "D11", + "validatorName": "D11", "blockHeader": { "id": "14335991531000451860", "height": 33, "maxHeightPreviouslyForged": 22, "generatorPublicKey": "75a894c0b07adcd17be59d6ddc7cdd2d6d8b2a10ccae7fefdb0a3c536a7151a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 25 } }, @@ -1615,13 +1615,13 @@ { "description": "When block with height 34 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "9720176785496629553", "height": 34, "maxHeightPreviouslyForged": 31, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 26 } }, @@ -1697,13 +1697,13 @@ { "description": "When block with height 35 is forged", "input": { - "delegateName": "D - New", + "validatorName": "D - New", "blockHeader": { "id": "11462789541162015536", "height": 35, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "491527e8b388e213a7c3bcb4710f0613a720ac0538186d477786cb4cb287847e", - "delegateMinHeightActive": 34, + "validatorMinHeightActive": 34, "maxHeightPrevoted": 26 } }, @@ -1780,13 +1780,13 @@ { "description": "When block with height 36 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "8549248847186084585", "height": 36, "maxHeightPreviouslyForged": 27, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 26 } }, @@ -1864,13 +1864,13 @@ { "description": "When block with height 37 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "8818528793225264558", "height": 37, "maxHeightPreviouslyForged": 23, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 26 } }, diff --git a/protocol-specs/generator_outputs/bft_processing/4_delegates_missed_slots.json b/protocol-specs/generator_outputs/bft_processing/4_validators_missed_slots.json similarity index 90% rename from protocol-specs/generator_outputs/bft_processing/4_delegates_missed_slots.json rename to protocol-specs/generator_outputs/bft_processing/4_validators_missed_slots.json index 6eaaea36aca..627fb893de3 100644 --- a/protocol-specs/generator_outputs/bft_processing/4_delegates_missed_slots.json +++ b/protocol-specs/generator_outputs/bft_processing/4_validators_missed_slots.json @@ -2,22 +2,22 @@ "title": "BFT processing generation", "summary": "Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification", "config": { - "activeDelegates": 4, + "activeValidators": 4, "finalizedHeight": 0 }, "runner": "bft_processing", - "handler": "4_delegates_missed_slots", + "handler": "4_validators_missed_slots", "testCases": [ { "description": "When block with height 1 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7748076420210162913", "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -33,13 +33,13 @@ { "description": "When block with height 2 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "15308683162207262446", "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -56,13 +56,13 @@ { "description": "When block with height 3 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5622533601426856843", "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -80,13 +80,13 @@ { "description": "When block with height 4 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5414021058608832454", "height": 4, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -107,13 +107,13 @@ { "description": "When block with height 5 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "17234451680913495083", "height": 5, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -135,13 +135,13 @@ { "description": "When block with height 6 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "16714758248282885559", "height": 6, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -164,13 +164,13 @@ { "description": "When block with height 7 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "8719647946811673230", "height": 7, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -194,13 +194,13 @@ { "description": "When block with height 8 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "3198191471355371895", "height": 8, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -225,13 +225,13 @@ { "description": "When block with height 9 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "1826242805484023040", "height": 9, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -258,13 +258,13 @@ { "description": "When block with height 10 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "5351644240885712040", "height": 10, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -292,13 +292,13 @@ { "description": "When block with height 11 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5748892369479747538", "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -327,13 +327,13 @@ { "description": "When block with height 12 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "7733195345837784852", "height": 12, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 9, + "validatorMinHeightActive": 9, "maxHeightPrevoted": 9 } }, @@ -364,13 +364,13 @@ { "description": "When block with height 13 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "4601451072787876934", "height": 13, "maxHeightPreviouslyForged": 12, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -403,13 +403,13 @@ { "description": "When block with height 14 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "9594822875653870441", "height": 14, "maxHeightPreviouslyForged": 13, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -443,13 +443,13 @@ { "description": "When block with height 15 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "16585062417031443062", "height": 15, "maxHeightPreviouslyForged": 14, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -484,13 +484,13 @@ { "description": "When block with height 16 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "12789931371912649502", "height": 16, "maxHeightPreviouslyForged": 13, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -526,13 +526,13 @@ { "description": "When block with height 17 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "4981918036555779351", "height": 17, "maxHeightPreviouslyForged": 14, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -569,13 +569,13 @@ { "description": "When block with height 18 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5677167347966923126", "height": 18, "maxHeightPreviouslyForged": 16, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 15 } }, @@ -614,13 +614,13 @@ { "description": "When block with height 19 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "10664789664901441495", "height": 19, "maxHeightPreviouslyForged": 18, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 15 } }, @@ -660,13 +660,13 @@ { "description": "When block with height 20 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "17711031119314540266", "height": 20, "maxHeightPreviouslyForged": 18, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 15 } }, diff --git a/protocol-specs/generator_outputs/bft_processing/4_delegates_simple.json b/protocol-specs/generator_outputs/bft_processing/4_validators_simple.json similarity index 89% rename from protocol-specs/generator_outputs/bft_processing/4_delegates_simple.json rename to protocol-specs/generator_outputs/bft_processing/4_validators_simple.json index e004bf5f30d..0073feb5117 100644 --- a/protocol-specs/generator_outputs/bft_processing/4_delegates_simple.json +++ b/protocol-specs/generator_outputs/bft_processing/4_validators_simple.json @@ -2,22 +2,22 @@ "title": "BFT processing generation", "summary": "Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification", "config": { - "activeDelegates": 4, + "activeValidators": 4, "finalizedHeight": 0 }, "runner": "bft_processing", - "handler": "4_delegates_simple", + "handler": "4_validators_simple", "testCases": [ { "description": "When block with height 1 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7748076420210162913", "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -33,13 +33,13 @@ { "description": "When block with height 2 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "15308683162207262446", "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -56,13 +56,13 @@ { "description": "When block with height 3 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5622533601426856843", "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -80,13 +80,13 @@ { "description": "When block with height 4 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5414021058608832454", "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -107,13 +107,13 @@ { "description": "When block with height 5 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "17234451680913495083", "height": 5, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 } }, @@ -136,13 +136,13 @@ { "description": "When block with height 6 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "16714758248282885559", "height": 6, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 } }, @@ -167,13 +167,13 @@ { "description": "When block with height 7 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "8719647946811673230", "height": 7, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 } }, @@ -200,13 +200,13 @@ { "description": "When block with height 8 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "3198191471355371895", "height": 8, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 } }, @@ -235,13 +235,13 @@ { "description": "When block with height 9 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "1826242805484023040", "height": 9, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -272,13 +272,13 @@ { "description": "When block with height 10 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "5351644240885712040", "height": 10, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -311,13 +311,13 @@ { "description": "When block with height 11 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5748892369479747538", "height": 11, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 } }, @@ -352,13 +352,13 @@ { "description": "When block with height 12 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "7733195345837784852", "height": 12, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 } }, diff --git a/protocol-specs/generator_outputs/bft_processing/5_delegates_switched_completely.json b/protocol-specs/generator_outputs/bft_processing/5_validators_switched_completely.json similarity index 92% rename from protocol-specs/generator_outputs/bft_processing/5_delegates_switched_completely.json rename to protocol-specs/generator_outputs/bft_processing/5_validators_switched_completely.json index 90357d5dc07..39408f8d46c 100644 --- a/protocol-specs/generator_outputs/bft_processing/5_delegates_switched_completely.json +++ b/protocol-specs/generator_outputs/bft_processing/5_validators_switched_completely.json @@ -2,22 +2,22 @@ "title": "BFT processing generation", "summary": "Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification", "config": { - "activeDelegates": 5, + "activeValidators": 5, "finalizedHeight": 0 }, "runner": "bft_processing", - "handler": "5_delegates_switched_completely", + "handler": "5_validators_switched_completely", "testCases": [ { "description": "When block with height 1 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7748076420210162913", "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -33,13 +33,13 @@ { "description": "When block with height 2 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "15308683162207262446", "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -56,13 +56,13 @@ { "description": "When block with height 3 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5622533601426856843", "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -80,13 +80,13 @@ { "description": "When block with height 4 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5414021058608832454", "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -105,13 +105,13 @@ { "description": "When block with height 5 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "17234451680913495083", "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -133,13 +133,13 @@ { "description": "When block with height 6 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "16714758248282885559", "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 } }, @@ -163,13 +163,13 @@ { "description": "When block with height 7 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "8719647946811673230", "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 } }, @@ -195,13 +195,13 @@ { "description": "When block with height 8 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "3198191471355371895", "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 } }, @@ -229,13 +229,13 @@ { "description": "When block with height 9 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "1826242805484023040", "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 } }, @@ -265,13 +265,13 @@ { "description": "When block with height 10 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "5351644240885712040", "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -303,13 +303,13 @@ { "description": "When block with height 11 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "5748892369479747538", "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -343,13 +343,13 @@ { "description": "When block with height 12 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "7733195345837784852", "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 } }, @@ -385,13 +385,13 @@ { "description": "When block with height 13 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "4601451072787876934", "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 } }, @@ -429,13 +429,13 @@ { "description": "When block with height 14 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "9594822875653870441", "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 } }, @@ -475,13 +475,13 @@ { "description": "When block with height 15 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "16585062417031443062", "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } }, @@ -523,13 +523,13 @@ { "description": "When block with height 16 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "12789931371912649502", "height": 16, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 16, + "validatorMinHeightActive": 16, "maxHeightPrevoted": 12 } }, @@ -572,13 +572,13 @@ { "description": "When block with height 17 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "4981918036555779351", "height": 17, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 16, + "validatorMinHeightActive": 16, "maxHeightPrevoted": 12 } }, @@ -622,13 +622,13 @@ { "description": "When block with height 18 is forged", "input": { - "delegateName": "D8", + "validatorName": "D8", "blockHeader": { "id": "5677167347966923126", "height": 18, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "8866be938b09f9abb626b9f48e7310b0b33735d8dbbf9ebd328d6ac4a821c440", - "delegateMinHeightActive": 16, + "validatorMinHeightActive": 16, "maxHeightPrevoted": 12 } }, @@ -673,13 +673,13 @@ { "description": "When block with height 19 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "10664789664901441495", "height": 19, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 16, + "validatorMinHeightActive": 16, "maxHeightPrevoted": 12 } }, @@ -725,13 +725,13 @@ { "description": "When block with height 20 is forged", "input": { - "delegateName": "D10", + "validatorName": "D10", "blockHeader": { "id": "17711031119314540266", "height": 20, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "cf4f97b6a8663ebcb37a82737670360c8c05d3f0fe2b9b8d2002d31ed663fae5", - "delegateMinHeightActive": 16, + "validatorMinHeightActive": 16, "maxHeightPrevoted": 16 } }, @@ -779,13 +779,13 @@ { "description": "When block with height 21 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "8019615789267006368", "height": 21, "maxHeightPreviouslyForged": 11, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 17 } }, @@ -834,13 +834,13 @@ { "description": "When block with height 22 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "8673720435704263435", "height": 22, "maxHeightPreviouslyForged": 12, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 17 } }, @@ -890,13 +890,13 @@ { "description": "When block with height 23 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "6007699706281844106", "height": 23, "maxHeightPreviouslyForged": 13, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 17 } }, @@ -947,13 +947,13 @@ { "description": "When block with height 24 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "13994197425134364572", "height": 24, "maxHeightPreviouslyForged": 14, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 17 } }, @@ -1005,13 +1005,13 @@ { "description": "When block with height 25 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "13233097926675734316", "height": 25, "maxHeightPreviouslyForged": 15, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 21 } }, @@ -1065,13 +1065,13 @@ { "description": "When block with height 26 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "6889463652104827991", "height": 26, "maxHeightPreviouslyForged": 21, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 22 } }, @@ -1126,13 +1126,13 @@ { "description": "When block with height 27 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "7423746163586646358", "height": 27, "maxHeightPreviouslyForged": 22, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 21, + "validatorMinHeightActive": 21, "maxHeightPrevoted": 23 } }, @@ -1188,13 +1188,13 @@ { "description": "When block with height 28 is forged", "input": { - "delegateName": "D9", + "validatorName": "D9", "blockHeader": { "id": "6476623794736544246", "height": 28, "maxHeightPreviouslyForged": 19, "generatorPublicKey": "80346e3d249bae58cc40792a8c82a6d89c1300ef71859a2ab959379d2a42cc26", - "delegateMinHeightActive": 26, + "validatorMinHeightActive": 26, "maxHeightPrevoted": 24 } }, @@ -1250,13 +1250,13 @@ { "description": "When block with height 29 is forged", "input": { - "delegateName": "D10", + "validatorName": "D10", "blockHeader": { "id": "3824500196583291025", "height": 29, "maxHeightPreviouslyForged": 20, "generatorPublicKey": "cf4f97b6a8663ebcb37a82737670360c8c05d3f0fe2b9b8d2002d31ed663fae5", - "delegateMinHeightActive": 26, + "validatorMinHeightActive": 26, "maxHeightPrevoted": 24 } }, @@ -1312,13 +1312,13 @@ { "description": "When block with height 30 is forged", "input": { - "delegateName": "D8", + "validatorName": "D8", "blockHeader": { "id": "7082861240554195963", "height": 30, "maxHeightPreviouslyForged": 18, "generatorPublicKey": "8866be938b09f9abb626b9f48e7310b0b33735d8dbbf9ebd328d6ac4a821c440", - "delegateMinHeightActive": 26, + "validatorMinHeightActive": 26, "maxHeightPrevoted": 26 } }, diff --git a/protocol-specs/generator_outputs/bft_processing/7_delegates_partial_switch.json b/protocol-specs/generator_outputs/bft_processing/7_validators_partial_switch.json similarity index 92% rename from protocol-specs/generator_outputs/bft_processing/7_delegates_partial_switch.json rename to protocol-specs/generator_outputs/bft_processing/7_validators_partial_switch.json index 49ffd230b8b..1292024e920 100644 --- a/protocol-specs/generator_outputs/bft_processing/7_delegates_partial_switch.json +++ b/protocol-specs/generator_outputs/bft_processing/7_validators_partial_switch.json @@ -2,22 +2,22 @@ "title": "BFT processing generation", "summary": "Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification", "config": { - "activeDelegates": 7, + "activeValidators": 7, "finalizedHeight": 0 }, "runner": "bft_processing", - "handler": "7_delegates_partial_switch", + "handler": "7_validators_partial_switch", "testCases": [ { "description": "When block with height 1 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "7748076420210162913", "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -33,13 +33,13 @@ { "description": "When block with height 2 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "15308683162207262446", "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -56,13 +56,13 @@ { "description": "When block with height 3 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "5622533601426856843", "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -80,13 +80,13 @@ { "description": "When block with height 4 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5414021058608832454", "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -105,13 +105,13 @@ { "description": "When block with height 5 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "17234451680913495083", "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 } }, @@ -131,13 +131,13 @@ { "description": "When block with height 6 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "16714758248282885559", "height": 6, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 } }, @@ -160,13 +160,13 @@ { "description": "When block with height 7 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "8719647946811673230", "height": 7, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 } }, @@ -191,13 +191,13 @@ { "description": "When block with height 8 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "3198191471355371895", "height": 8, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 } }, @@ -224,13 +224,13 @@ { "description": "When block with height 9 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "1826242805484023040", "height": 9, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 } }, @@ -259,13 +259,13 @@ { "description": "When block with height 10 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "5351644240885712040", "height": 10, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 } }, @@ -296,13 +296,13 @@ { "description": "When block with height 11 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5748892369479747538", "height": 11, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 } }, @@ -335,13 +335,13 @@ { "description": "When block with height 12 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "7733195345837784852", "height": 12, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -375,13 +375,13 @@ { "description": "When block with height 13 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "4601451072787876934", "height": 13, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -416,13 +416,13 @@ { "description": "When block with height 14 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "9594822875653870441", "height": 14, "maxHeightPreviouslyForged": 11, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -458,13 +458,13 @@ { "description": "When block with height 15 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "16585062417031443062", "height": 15, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -500,13 +500,13 @@ { "description": "When block with height 16 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "12789931371912649502", "height": 16, "maxHeightPreviouslyForged": 12, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -544,13 +544,13 @@ { "description": "When block with height 17 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "4981918036555779351", "height": 17, "maxHeightPreviouslyForged": 14, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -589,13 +589,13 @@ { "description": "When block with height 18 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "5677167347966923126", "height": 18, "maxHeightPreviouslyForged": 15, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -635,13 +635,13 @@ { "description": "When block with height 19 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "10664789664901441495", "height": 19, "maxHeightPreviouslyForged": 16, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -682,13 +682,13 @@ { "description": "When block with height 20 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "17711031119314540266", "height": 20, "maxHeightPreviouslyForged": 17, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -730,13 +730,13 @@ { "description": "When block with height 21 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "8019615789267006368", "height": 21, "maxHeightPreviouslyForged": 18, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -779,13 +779,13 @@ { "description": "When block with height 22 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "8673720435704263435", "height": 22, "maxHeightPreviouslyForged": 19, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -829,13 +829,13 @@ { "description": "When block with height 23 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "6007699706281844106", "height": 23, "maxHeightPreviouslyForged": 20, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -880,13 +880,13 @@ { "description": "When block with height 24 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "13994197425134364572", "height": 24, "maxHeightPreviouslyForged": 21, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -932,13 +932,13 @@ { "description": "When block with height 25 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "13233097926675734316", "height": 25, "maxHeightPreviouslyForged": 22, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -985,13 +985,13 @@ { "description": "When block with height 26 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "6889463652104827991", "height": 26, "maxHeightPreviouslyForged": 23, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1039,13 +1039,13 @@ { "description": "When block with height 27 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "7423746163586646358", "height": 27, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1093,13 +1093,13 @@ { "description": "When block with height 28 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "6476623794736544246", "height": 28, "maxHeightPreviouslyForged": 25, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1149,13 +1149,13 @@ { "description": "When block with height 29 is forged", "input": { - "delegateName": "D7", + "validatorName": "D7", "blockHeader": { "id": "3824500196583291025", "height": 29, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "831381a14e90356ed8c78b5fbf15758f3c243e1eb29301f144bd5e6b474d577e", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1205,13 +1205,13 @@ { "description": "When block with height 30 is forged", "input": { - "delegateName": "D5", + "validatorName": "D5", "blockHeader": { "id": "7082861240554195963", "height": 30, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "e6bbdb9f6ddd65d94c52e8cb552acb8682b0aec91c9eba2dc13ed70976198807", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1262,13 +1262,13 @@ { "description": "When block with height 31 is forged", "input": { - "delegateName": "D2", + "validatorName": "D2", "blockHeader": { "id": "16942035922560182651", "height": 31, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1320,13 +1320,13 @@ { "description": "When block with height 32 is forged", "input": { - "delegateName": "D3", + "validatorName": "D3", "blockHeader": { "id": "16329097976039504304", "height": 32, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1379,13 +1379,13 @@ { "description": "When block with height 33 is forged", "input": { - "delegateName": "D1", + "validatorName": "D1", "blockHeader": { "id": "14335991531000451860", "height": 33, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1439,13 +1439,13 @@ { "description": "When block with height 34 is forged", "input": { - "delegateName": "D6", + "validatorName": "D6", "blockHeader": { "id": "9720176785496629553", "height": 34, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "a5e64124704630218f66b2f27c913e2d37a6ae57cc717b08b829d62cbc4d79fb", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 } }, @@ -1501,13 +1501,13 @@ { "description": "When block with height 35 is forged", "input": { - "delegateName": "D4", + "validatorName": "D4", "blockHeader": { "id": "11462789541162015536", "height": 35, "maxHeightPreviouslyForged": 29, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 30 } }, diff --git a/protocol-specs/generator_outputs/bft_processing/bft_invalid_block_headers.json b/protocol-specs/generator_outputs/bft_processing/bft_invalid_block_headers.json index d7cd1f8a5fc..7b86a0963ca 100644 --- a/protocol-specs/generator_outputs/bft_processing/bft_invalid_block_headers.json +++ b/protocol-specs/generator_outputs/bft_processing/bft_invalid_block_headers.json @@ -2,7 +2,7 @@ "title": "BFT processing generation", "summary": "Generate set of invalid blocks headers for BFT", "config": { - "activeDelegates": 5, + "activeValidators": 5, "finalizedHeight": 0 }, "runner": "bft_processing", @@ -17,7 +17,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -25,7 +25,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -33,7 +33,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -41,7 +41,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -49,7 +49,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -57,7 +57,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -65,7 +65,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -73,7 +73,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -81,7 +81,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -89,7 +89,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -97,7 +97,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -105,7 +105,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -113,7 +113,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -121,7 +121,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -129,7 +129,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -139,7 +139,7 @@ "height": 16, "maxHeightPreviouslyForged": 11, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 22 }, "output": { @@ -149,7 +149,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -157,7 +157,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -165,7 +165,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -173,7 +173,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -181,7 +181,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -189,7 +189,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -197,7 +197,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -205,7 +205,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -213,7 +213,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -221,7 +221,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -229,7 +229,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -237,7 +237,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -245,7 +245,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -253,7 +253,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -261,7 +261,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -276,7 +276,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -284,7 +284,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -292,7 +292,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -300,7 +300,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -308,7 +308,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -316,7 +316,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -324,7 +324,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -332,7 +332,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -340,7 +340,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -348,7 +348,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -356,7 +356,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -364,7 +364,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -372,7 +372,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -380,7 +380,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -388,7 +388,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -398,7 +398,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 12 }, "output": { @@ -408,7 +408,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -416,7 +416,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -424,7 +424,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -432,7 +432,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -440,7 +440,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -448,7 +448,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -456,7 +456,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -464,7 +464,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -472,7 +472,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -480,7 +480,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -488,7 +488,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -496,7 +496,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -504,7 +504,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -512,7 +512,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -520,7 +520,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -535,7 +535,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -543,7 +543,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -551,7 +551,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -559,7 +559,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -567,7 +567,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -575,7 +575,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -583,7 +583,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -591,7 +591,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -599,7 +599,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -607,7 +607,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -615,7 +615,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -623,7 +623,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -631,7 +631,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -639,7 +639,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -647,7 +647,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -657,7 +657,7 @@ "height": 10, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 12 }, "output": { @@ -667,7 +667,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -675,7 +675,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -683,7 +683,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -691,7 +691,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -699,7 +699,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -707,7 +707,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -715,7 +715,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -723,7 +723,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -731,7 +731,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -739,7 +739,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -747,7 +747,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -755,7 +755,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -763,7 +763,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -771,7 +771,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -779,7 +779,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -794,7 +794,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -802,7 +802,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -810,7 +810,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -818,7 +818,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -826,7 +826,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -834,7 +834,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -842,7 +842,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -850,7 +850,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -858,7 +858,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -866,7 +866,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -874,7 +874,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -882,7 +882,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -890,7 +890,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -898,7 +898,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -906,7 +906,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -916,7 +916,7 @@ "height": 16, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 12 }, "output": { @@ -926,7 +926,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -934,7 +934,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -942,7 +942,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -950,7 +950,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -958,7 +958,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -966,7 +966,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -974,7 +974,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -982,7 +982,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -990,7 +990,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -998,7 +998,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -1006,7 +1006,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 7 }, { @@ -1014,7 +1014,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -1022,7 +1022,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -1030,7 +1030,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -1038,7 +1038,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -1053,7 +1053,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1061,7 +1061,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1069,7 +1069,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1077,7 +1077,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1085,7 +1085,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -1093,7 +1093,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -1101,7 +1101,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -1109,7 +1109,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -1117,7 +1117,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -1125,7 +1125,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -1133,7 +1133,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 13 }, { @@ -1141,7 +1141,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -1149,7 +1149,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -1157,7 +1157,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -1165,7 +1165,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] @@ -1175,7 +1175,7 @@ "height": 16, "maxHeightPreviouslyForged": 11, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 12 }, "output": { @@ -1185,7 +1185,7 @@ "height": 1, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1193,7 +1193,7 @@ "height": 2, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1201,7 +1201,7 @@ "height": 3, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1209,7 +1209,7 @@ "height": 4, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 0 }, { @@ -1217,7 +1217,7 @@ "height": 5, "maxHeightPreviouslyForged": 0, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 1 }, { @@ -1225,7 +1225,7 @@ "height": 6, "maxHeightPreviouslyForged": 1, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 2 }, { @@ -1233,7 +1233,7 @@ "height": 7, "maxHeightPreviouslyForged": 2, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 3 }, { @@ -1241,7 +1241,7 @@ "height": 8, "maxHeightPreviouslyForged": 3, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 4 }, { @@ -1249,7 +1249,7 @@ "height": 9, "maxHeightPreviouslyForged": 4, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 5 }, { @@ -1257,7 +1257,7 @@ "height": 10, "maxHeightPreviouslyForged": 5, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 6 }, { @@ -1265,7 +1265,7 @@ "height": 11, "maxHeightPreviouslyForged": 6, "generatorPublicKey": "6352b9c9d2a263eaa701b53314e3021607d41e1ba6d799270f08adcba50841b7", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 13 }, { @@ -1273,7 +1273,7 @@ "height": 12, "maxHeightPreviouslyForged": 7, "generatorPublicKey": "f7a73f303f46ada157ce3cea5ffff1290a291e255fcd26678a185fd8aee33054", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 8 }, { @@ -1281,7 +1281,7 @@ "height": 13, "maxHeightPreviouslyForged": 8, "generatorPublicKey": "544d87cbf83b7c1572bb0d9f95abd5db89d0930bbb91980ea0dd7942a1cd38a3", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 9 }, { @@ -1289,7 +1289,7 @@ "height": 14, "maxHeightPreviouslyForged": 9, "generatorPublicKey": "c2d2f82c6015fd7ed00a9e1585927a8039d63cb7afd4f7c03ad059a93c2bd6b5", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 10 }, { @@ -1297,7 +1297,7 @@ "height": 15, "maxHeightPreviouslyForged": 10, "generatorPublicKey": "377be71f1a125ededfc70ac406f4a04b62551bf37e7636ca2b86e124aaedbe5a", - "delegateMinHeightActive": 1, + "validatorMinHeightActive": 1, "maxHeightPrevoted": 11 } ] diff --git a/protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_delegate_list.json b/protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_validator_list.json similarity index 97% rename from protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_delegate_list.json rename to protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_validator_list.json index c5062ca7740..5de11ef1e3d 100644 --- a/protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_delegate_list.json +++ b/protocol-specs/generator_outputs/dpos_delegate_shuffling/uniformly_shuffled_validator_list.json @@ -1,13 +1,13 @@ { - "title": "Uniform shuffling of delegate list in each round", - "summary": "A uniformly shuffled delegate list is generated", + "title": "Uniform shuffling of validator list in each round", + "summary": "A uniformly shuffled validator list is generated", "config": "devnet", - "runner": "dpos_delegate_shuffling", - "handler": "uniformly_shuffled_delegate_list", + "runner": "pos_validator_shuffling", + "handler": "uniformly_shuffled_validator_list", "testCases": { "input": { "previousRoundSeed1": "b9acc2f1fda3666bfb34107f1c6dccc4", - "delegateList": [ + "validatorList": [ "fa1c00809ff1b10cd269a711eef40a465ba4a9cb", "e81fa3d9650e6427c2e35c6b41c249589e5da84c", "14b23e2adad2afd2990bc80907989d96ee20cff6", @@ -114,7 +114,7 @@ ] }, "output": { - "delegateList": [ + "validatorList": [ "2bb5618f06242cc7ec62fe0a186513bcb3ed53ea", "73df2ff5335cc6e79f8edc4b858b327c0140fd82", "6dcafaba258e48898ada6af21ec341e095c040c5", diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection.json similarity index 66% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection.json index eca2335b830..6d4b2728966 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection.json @@ -1,213 +1,213 @@ { - "title": "Forger selection with less than 103 delegates", - "summary": "A set of voteWeights which include less than 103 delegates", + "title": "Forger selection with less than 103 validators", + "summary": "A set of validatorWeights which include less than 103 validators", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection", "testCases": { "input": { "randomSeed1": "225723ef50cbad5e11dd4edf23da652c", "randomSeed2": "9c65ff262b4f4ccc6d56bcbf5a6a1957", - "voteWeights": [ + "validatorWeights": [ { "address": "17445261029985757682L", - "voteWeight": "179000000000" + "validatorWeight": "179000000000" }, { "address": "11415976932052179071L", - "voteWeight": "138000000000" + "validatorWeight": "138000000000" }, { "address": "9765891287475640276L", - "voteWeight": "31000000000" + "validatorWeight": "31000000000" }, { "address": "4102087139774289888L", - "voteWeight": "95000000000" + "validatorWeight": "95000000000" }, { "address": "15027331904927922591L", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "address": "15447941585334874698L", - "voteWeight": "44000000000" + "validatorWeight": "44000000000" }, { "address": "14076016694687207163L", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "5164775232262799503L", - "voteWeight": "119000000000" + "validatorWeight": "119000000000" }, { "address": "310359256014510232L", - "voteWeight": "27000000000" + "validatorWeight": "27000000000" }, { "address": "14328920721728974211L", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "4159590768989187399L", - "voteWeight": "155000000000" + "validatorWeight": "155000000000" }, { "address": "6073162593284253473L", - "voteWeight": "61000000000" + "validatorWeight": "61000000000" }, { "address": "8851646800294505573L", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "address": "6981135650713011410L", - "voteWeight": "57000000000" + "validatorWeight": "57000000000" }, { "address": "8483962610686961873L", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "1576280924440128431L", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "14430572789532052599L", - "voteWeight": "65000000000" + "validatorWeight": "65000000000" }, { "address": "3884148014090014843L", - "voteWeight": "54000000000" + "validatorWeight": "54000000000" }, { "address": "756858191295379912L", - "voteWeight": "163000000000" + "validatorWeight": "163000000000" }, { "address": "9995502198146164918L", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "address": "4478708894922238722L", - "voteWeight": "60000000000" + "validatorWeight": "60000000000" }, { "address": "11443797498744358057L", - "voteWeight": "180000000000" + "validatorWeight": "180000000000" }, { "address": "14699182743554061640L", - "voteWeight": "4000000000" + "validatorWeight": "4000000000" }, { "address": "16542042234759126919L", - "voteWeight": "7000000000" + "validatorWeight": "7000000000" }, { "address": "8370688930480894612L", - "voteWeight": "115000000000" + "validatorWeight": "115000000000" }, { "address": "7143852660979673049L", - "voteWeight": "16000000000" + "validatorWeight": "16000000000" }, { "address": "5082942213599097036L", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "address": "15091740656486087255L", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "1077757466598813024L", - "voteWeight": "17000000000" + "validatorWeight": "17000000000" }, { "address": "14651580431625711079L", - "voteWeight": "148000000000" + "validatorWeight": "148000000000" }, { "address": "8021717926680796524L", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "10693535129491210519L", - "voteWeight": "123000000000" + "validatorWeight": "123000000000" }, { "address": "6037194059856211793L", - "voteWeight": "48000000000" + "validatorWeight": "48000000000" }, { "address": "16811217358276028276L", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "2173885918056306903L", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "9270469969873479439L", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "14488867556178460748L", - "voteWeight": "136000000000" + "validatorWeight": "136000000000" }, { "address": "16837660994878196884L", - "voteWeight": "64000000000" + "validatorWeight": "64000000000" }, { "address": "7968581010655334932L", - "voteWeight": "62000000000" + "validatorWeight": "62000000000" }, { "address": "4680865271553937387L", - "voteWeight": "164000000000" + "validatorWeight": "164000000000" }, { "address": "15810429210464703596L", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "1831879006612450128L", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "11389504724429377366L", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "address": "5156806555160425378L", - "voteWeight": "166000000000" + "validatorWeight": "166000000000" }, { "address": "6188872984399937647L", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "14147785780613817096L", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "10863363360046118674L", - "voteWeight": "124000000000" + "validatorWeight": "124000000000" }, { "address": "9175647381172646691L", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "282515081768164621L", - "voteWeight": "5000000000" + "validatorWeight": "5000000000" }, { "address": "9731562613157534875L", - "voteWeight": "178000000000" + "validatorWeight": "178000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_0_standby.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_0_standby.json similarity index 75% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_0_standby.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_0_standby.json index 9cae3839115..d2cee42dac1 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_0_standby.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_0_standby.json @@ -1,425 +1,425 @@ { - "title": "Forger selection with 0 standby delegates", - "summary": "A set of voteWeights which include no eligible standby delegates", + "title": "Forger selection with 0 standby validators", + "summary": "A set of validatorWeights which include no eligible standby validators", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection_0_standby", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection_0_standby", "testCases": { "input": { "randomSeed1": "153b526559a367c9dd9206fc28cb9eb3", "randomSeed2": "3b915b0d57aa557f2291d2c0698017c9", - "voteWeights": [ + "validatorWeights": [ { "address": "502a9f99fda655700f573bb12dc5feb70b68fac5", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "c07f87e0f6f94c44db57bed59180b93a964eaca1", - "voteWeight": "164000000000" + "validatorWeight": "164000000000" }, { "address": "592d9bddb6949fca8accbefac58e2b7b10d81039", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "e81460e65e75b15282411bbad71dd4a142bd15fc", - "voteWeight": "28000000000" + "validatorWeight": "28000000000" }, { "address": "11d1bda3a6ff41ee2041909e1cf20db44c989ab4", - "voteWeight": "88000000000" + "validatorWeight": "88000000000" }, { "address": "6500ebf5b2fee2232b0fbf70a9a82178ba6936d7", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "address": "989f40e7501469f9179f3f541b541a146a9fad3b", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "0f0b031d66e5bbdd4cf152d46341281026d8c590", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "b6ad85aa0507825f4435ab5c7f01188027b5383d", - "voteWeight": "122000000000" + "validatorWeight": "122000000000" }, { "address": "0040eeb337b43eacb0321bd296ee44e0b7e5823f", - "voteWeight": "57000000000" + "validatorWeight": "57000000000" }, { "address": "3bf6b8d8ca837175e97974e88cc84ea591946c0e", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "6232e0e9ea69aaa85e63e334c90442cd78f7f8da", - "voteWeight": "75000000000" + "validatorWeight": "75000000000" }, { "address": "36af358e6b7e5b59a5a5223cffd0a8020d14918f", - "voteWeight": "165000000000" + "validatorWeight": "165000000000" }, { "address": "c07b8e111865283a91096f2defbfb89e2277e0d1", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "53f969143c1febfc703eaf2bc97e73ff61b57bf9", - "voteWeight": "150000000000" + "validatorWeight": "150000000000" }, { "address": "60bf1a27b784993d31ce5db92564a63d76b9ab29", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "4ef2c4e43f1669df4617dd21e499fc957f12b021", - "voteWeight": "125000000000" + "validatorWeight": "125000000000" }, { "address": "2b4105d38fdd16c36b062808c12921df7f74fb8e", - "voteWeight": "157000000000" + "validatorWeight": "157000000000" }, { "address": "180a6782853334f31dc083a7000629d1ad26d3cf", - "voteWeight": "45000000000" + "validatorWeight": "45000000000" }, { "address": "fa10e3f4c054a7f271631705021c4aaa466e40f6", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "90fd30068f32d036dc67dc7bfd74cd12ccb9b2ed", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "4891f2bbc0b03122b80634cbf56c76227544d74a", - "voteWeight": "81000000000" + "validatorWeight": "81000000000" }, { "address": "563478e9a592a5e044433e833b953ddc2b355d16", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "a75f639083b43db22558e888ca3d2fdcfbe94990", - "voteWeight": "153000000000" + "validatorWeight": "153000000000" }, { "address": "00448ec8ec5fa571be30ed437bbeb712ff224181", - "voteWeight": "127000000000" + "validatorWeight": "127000000000" }, { "address": "4cec15d36cdeda41450b542bde31e0dd02b29e0b", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "e3f728622b5974ffb3973b24f65f597bd7a93fba", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "a40f58ada988427e3fa4119d944e9cb4747b07e7", - "voteWeight": "129000000000" + "validatorWeight": "129000000000" }, { "address": "619b7675b353f925064942c5567ed547a2be1029", - "voteWeight": "14000000000" + "validatorWeight": "14000000000" }, { "address": "385579592eed0f9813429a5c00c8002f11393770", - "voteWeight": "53000000000" + "validatorWeight": "53000000000" }, { "address": "5030be0afc0f61b0da53c25389e32a11d3f31883", - "voteWeight": "32000000000" + "validatorWeight": "32000000000" }, { "address": "2ef40646995156a3ff864e115d32784f7e0f23b3", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "address": "03deddfb8a0c918fd19a303347b1bacf2fa16789", - "voteWeight": "131000000000" + "validatorWeight": "131000000000" }, { "address": "7c3703247f4ccc77ba9c47b521fa809f86f564dd", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "0666adef7e532e4aa8bc17af45fd369c64819727", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "527f532eb39c9af5d062c01f054f49955186c326", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "address": "30fe6220ef930168d97108ca43aaf310ab4b984e", - "voteWeight": "39000000000" + "validatorWeight": "39000000000" }, { "address": "1bb623fcc44cd2934eb2b86f1496835bb2778a92", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "eb42c2d9dbe5df7b53e54da057bd9d250a17b8be", - "voteWeight": "12000000000" + "validatorWeight": "12000000000" }, { "address": "2d9a5adf1125371d2109ffb558f612b0dcaf012b", - "voteWeight": "152000000000" + "validatorWeight": "152000000000" }, { "address": "4d7f1ee4fb11a55d057ac1b3c21e7bc64c60db6d", - "voteWeight": "13000000000" + "validatorWeight": "13000000000" }, { "address": "f139594031418739a4cc613f230b8ce460ea02d6", - "voteWeight": "137000000000" + "validatorWeight": "137000000000" }, { "address": "601fb8f3ea396d916b0c5a8f2ed695a2fa5e5f14", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "fc304bcaeb1d2a47c0ea0b6c09f586a1e0e9ca09", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "4d5226e4d3a2305ea13b20a3219b1e3b4a26de30", - "voteWeight": "146000000000" + "validatorWeight": "146000000000" }, { "address": "aa525f481348895eddcd34b3fd5eabd6fb080f63", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "988b3c5dc85478387041eb2707e33a47e37fbf88", - "voteWeight": "42000000000" + "validatorWeight": "42000000000" }, { "address": "73ea6e05e36e8da58b064c7cc9ab44538945a55d", - "voteWeight": "87000000000" + "validatorWeight": "87000000000" }, { "address": "a9c0d038c7d3ec177819f81396dc69a2050b18bb", - "voteWeight": "26000000000" + "validatorWeight": "26000000000" }, { "address": "d23d7b584b5dead562eeebdc138e5dc30d62213c", - "voteWeight": "72000000000" + "validatorWeight": "72000000000" }, { "address": "2d8af8147af28cdf88dff035bb54cd08657b8abd", - "voteWeight": "44000000000" + "validatorWeight": "44000000000" }, { "address": "27b48b219868ff8fc30abee046538e9c432066b0", - "voteWeight": "1000000000" + "validatorWeight": "1000000000" }, { "address": "705b9904dd0aab6c2c7fef0d947838a29843b44f", - "voteWeight": "80000000000" + "validatorWeight": "80000000000" }, { "address": "bfcd989d3d53fdb14c16923e9ad8bebdc4ee8ba9", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "address": "ce25aac51fde4229028a0bf7bb700e82168cf921", - "voteWeight": "118000000000" + "validatorWeight": "118000000000" }, { "address": "f8025970d15978d9c5c49c01df93bb94c0fa712b", - "voteWeight": "95000000000" + "validatorWeight": "95000000000" }, { "address": "e9c29559f1017dc6e260cc9a965b7dbd20913332", - "voteWeight": "181000000000" + "validatorWeight": "181000000000" }, { "address": "ae7f56d112c1f43898b60ae2f63ab23dca585dbe", - "voteWeight": "152000000000" + "validatorWeight": "152000000000" }, { "address": "ee0b841f1b8560fced7e8c9c5a9a4399b368ef3e", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "address": "457d7c47ab28dc7334f3e3215aff6a5d65e55b67", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "75714e5916537ae59c2416eba5a6d2284d8e69be", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "0279d566343cb69fd23829b6bae6a00aca921793", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "9aae40ebe29dd6c38f4ff039ea140b11a68f93e7", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "address": "e92ce7563051f584bdad8aa1c4d8a45a94dc5e5d", - "voteWeight": "29000000000" + "validatorWeight": "29000000000" }, { "address": "7086380537676d000a5e76c97f8f41e034549d7a", - "voteWeight": "118000000000" + "validatorWeight": "118000000000" }, { "address": "5cf2d34cfa252f59d016c31327fb7f10e6127155", - "voteWeight": "87000000000" + "validatorWeight": "87000000000" }, { "address": "3ef82128dc21b0d66c082858f8d9f5c41291dd8b", - "voteWeight": "170000000000" + "validatorWeight": "170000000000" }, { "address": "79d0f9f05e89f4c6617162a2286d240a6be19303", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "address": "a91dc57c279bb3537847135eb66a68875be5419c", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "e243b0de311935974e5859f98b869b3fe0b75bab", - "voteWeight": "99000000000" + "validatorWeight": "99000000000" }, { "address": "0e5f0eb56d6f64ff94b8ac466ec3850960039e66", - "voteWeight": "35000000000" + "validatorWeight": "35000000000" }, { "address": "1aab8ee863b2c26531344b9a9823b61ebd21daed", - "voteWeight": "168000000000" + "validatorWeight": "168000000000" }, { "address": "650e527943e3b3444d2e78801ad36963dbbbe9e6", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "3564f531c8dbe767b90f244a48cf7251cd42496e", - "voteWeight": "172000000000" + "validatorWeight": "172000000000" }, { "address": "7de3e7061e9277a58db798997d8e8f3d60c58ee9", - "voteWeight": "43000000000" + "validatorWeight": "43000000000" }, { "address": "caaa0f31b585ce6780c90048a948cf10b9712dee", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "9443b0971f4d9cbf66ef2b1a1d5ac72bb8aae401", - "voteWeight": "127000000000" + "validatorWeight": "127000000000" }, { "address": "9dc8320fd22e5d69869072acb5315b16a70f9d2c", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "4e1006dcb1f81c612bf1bf6310990cd5126165c5", - "voteWeight": "125000000000" + "validatorWeight": "125000000000" }, { "address": "339485bbac77ff5328525310c8b92be7cd3a8941", - "voteWeight": "2000000000" + "validatorWeight": "2000000000" }, { "address": "9225ce26792b4b05c09e09816564969b903049df", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "c0437ae552c2968f22b71810ead9f421303533f3", - "voteWeight": "141000000000" + "validatorWeight": "141000000000" }, { "address": "3e21ed880952531745043c8d6dcd3ebe2e81ba34", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "aa8b58e30c41e2678d49ac140b3c457bd67f9183", - "voteWeight": "147000000000" + "validatorWeight": "147000000000" }, { "address": "f4c3f233d5e28f399ba45cee5186997a851dc821", - "voteWeight": "183000000000" + "validatorWeight": "183000000000" }, { "address": "dfe08bd8f5df08347d791816838973e634e77e22", - "voteWeight": "123000000000" + "validatorWeight": "123000000000" }, { "address": "0b57a0a48f38e313da5a59fbf37367591b7b8951", - "voteWeight": "99000000000" + "validatorWeight": "99000000000" }, { "address": "e129ce4b91d24078d9c414949b8b361f1148c7c0", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "51cc7ea6e3eceeb1ed1a6f37aa992a786b6a55e2", - "voteWeight": "27000000000" + "validatorWeight": "27000000000" }, { "address": "8491b26f247bf9a2ba36008a4b7643db1139d9de", - "voteWeight": "162000000000" + "validatorWeight": "162000000000" }, { "address": "330f04672d2f25b31d56511681a633f3ffa9153e", - "voteWeight": "139000000000" + "validatorWeight": "139000000000" }, { "address": "60bfe5d27d8879b65d136fd4e03bf4730fb02f0e", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "address": "a6b09279590c5e7fee9376a2287c8afa62a3b4c8", - "voteWeight": "138000000000" + "validatorWeight": "138000000000" }, { "address": "89a0d427632e02231ca5aa3a16250e69f476e3c2", - "voteWeight": "116000000000" + "validatorWeight": "116000000000" }, { "address": "343e29ae0f24539c5f526594e3346cfbd83425d4", - "voteWeight": "169000000000" + "validatorWeight": "169000000000" }, { "address": "8b72ec2d25e73390b4e3e6f523969d9f99fc28b9", - "voteWeight": "163000000000" + "validatorWeight": "163000000000" }, { "address": "d4f4a713f7e461bdb868c318462b81d4b4f42d53", - "voteWeight": "20000000000" + "validatorWeight": "20000000000" }, { "address": "1c58d94b2e29d4dafcfe17ca995d9005b9351934", - "voteWeight": "19000000000" + "validatorWeight": "19000000000" }, { "address": "1ca5872a985b4285b2681f669e4332537d1ef3b4", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "5f2cc15a4664c578b7482314f8b60395ab1f13b4", - "voteWeight": "49000000000" + "validatorWeight": "49000000000" }, { "address": "b16a4fabe66cfa4e52cb86dad2c85abb7bbb3f46", - "voteWeight": "79000000000" + "validatorWeight": "79000000000" }, { "address": "8fecd7acee6d40658b917edbfc2ee54011c47316", - "voteWeight": "183000000000" + "validatorWeight": "183000000000" }, { "address": "3a775a50d83c91989fe960c668dc79d23c5323c3", - "voteWeight": "140000000000" + "validatorWeight": "140000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_1_standby.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_1_standby.json similarity index 74% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_1_standby.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_1_standby.json index 9ea440e57f1..e11ed100f22 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_1_standby.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_1_standby.json @@ -1,425 +1,425 @@ { - "title": "Forger selection with exactly 1 standby delegate", - "summary": "A set of voteWeights which include 1 eligible standby delegate", + "title": "Forger selection with exactly 1 standby validator", + "summary": "A set of validatorWeights which include 1 eligible standby validator", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection_exactly_1_standby", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection_exactly_1_standby", "testCases": { "input": { "randomSeed1": "0a80d262beed565657a45faf13dc7200", "randomSeed2": "554c112294971da0f97b21f91f3b3f93", - "voteWeights": [ + "validatorWeights": [ { "address": "628e1b844d2495e5352158a7ef37262a2e8a4674", - "voteWeight": "18360000000000" + "validatorWeight": "18360000000000" }, { "address": "ea681fda4f913242f751344b9e9ca6abed827d6a", - "voteWeight": "2154000000000" + "validatorWeight": "2154000000000" }, { "address": "2aa91f3da5a1d91be402b73de3e1f5b5afa4e901", - "voteWeight": "4533000000000" + "validatorWeight": "4533000000000" }, { "address": "f527765b548e45cc8d9bde604dd559ed9137aa7c", - "voteWeight": "13837000000000" + "validatorWeight": "13837000000000" }, { "address": "2d168b5415598bee85475e584fdbd12469aec2fa", - "voteWeight": "1321000000000" + "validatorWeight": "1321000000000" }, { "address": "87cd1638359e4e89258d94496d9519576029ae07", - "voteWeight": "16210000000000" + "validatorWeight": "16210000000000" }, { "address": "4a170dd0c888be0d3c1ca667cf07f4f64b5f03ce", - "voteWeight": "45000000000" + "validatorWeight": "45000000000" }, { "address": "7ef294535c678618448d46fff06fabba49fddb27", - "voteWeight": "3547000000000" + "validatorWeight": "3547000000000" }, { "address": "5a105b4aff51a880ed1bf6216b78fda13153e0a2", - "voteWeight": "6084000000000" + "validatorWeight": "6084000000000" }, { "address": "df2501fa30915040fdb046848daf7da3b2c1fbe8", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "90dfd2ce750a28d9e4aaad80767ccf002111bdc5", - "voteWeight": "5685000000000" + "validatorWeight": "5685000000000" }, { "address": "1ecd355500a300bb6af7d8fe30d3a50ccff3a60a", - "voteWeight": "8810000000000" + "validatorWeight": "8810000000000" }, { "address": "20b7e14d595170e61778b463e650f1e7dc9f7c53", - "voteWeight": "2625000000000" + "validatorWeight": "2625000000000" }, { "address": "ae5580f3b800d9ec1068d23d5ea7febfa6d48869", - "voteWeight": "4225000000000" + "validatorWeight": "4225000000000" }, { "address": "e77918452dfd65e116ab804fef7519702da83719", - "voteWeight": "17433000000000" + "validatorWeight": "17433000000000" }, { "address": "d9a085dc90c82331da0075f43a4ead8e8d852a0d", - "voteWeight": "5178000000000" + "validatorWeight": "5178000000000" }, { "address": "288b0d5ace9144be2b4d6b5134f32103aedc6a39", - "voteWeight": "16956000000000" + "validatorWeight": "16956000000000" }, { "address": "f536eabad6a097691bfe9b336c4fd4d9df552294", - "voteWeight": "16452000000000" + "validatorWeight": "16452000000000" }, { "address": "04508e3c1011ade4ccd814794d14ffd27f5ee3ba", - "voteWeight": "11841000000000" + "validatorWeight": "11841000000000" }, { "address": "974d81bed0bba20e0cf70c53adcfb3031f51b36b", - "voteWeight": "11242000000000" + "validatorWeight": "11242000000000" }, { "address": "2035b0dd0ea511e67cd086c84632b2657f6c477a", - "voteWeight": "1011000000000" + "validatorWeight": "1011000000000" }, { "address": "d14718c0e1219d3292663b58e67d1f9fab1c16f1", - "voteWeight": "14098000000000" + "validatorWeight": "14098000000000" }, { "address": "2237a7c978363abf85a1aed92298e0f8485ad910", - "voteWeight": "4152000000000" + "validatorWeight": "4152000000000" }, { "address": "ac66584d2063c15ebc7fe6ca4404ae4123682a7e", - "voteWeight": "2811000000000" + "validatorWeight": "2811000000000" }, { "address": "de32cfb703c129d6cb40b27cab9999958a5b36e3", - "voteWeight": "5920000000000" + "validatorWeight": "5920000000000" }, { "address": "fe47ed87e279d327322cba143bcfb0ec48aca3ee", - "voteWeight": "8547000000000" + "validatorWeight": "8547000000000" }, { "address": "317317c4b62c5d92943807f1cfdd8a54b947c6f7", - "voteWeight": "815000000000" + "validatorWeight": "815000000000" }, { "address": "b4760d02e627b12ce23984118511f6b5e0195941", - "voteWeight": "15709000000000" + "validatorWeight": "15709000000000" }, { "address": "367f9c9b716dfc89492c1294b6eb37fcce998588", - "voteWeight": "1822000000000" + "validatorWeight": "1822000000000" }, { "address": "e65049556a7570e79e9ebcc1f15500c81c033086", - "voteWeight": "13268000000000" + "validatorWeight": "13268000000000" }, { "address": "e0dbd00f1140c8883318484445c6b4c9d98d23b1", - "voteWeight": "5167000000000" + "validatorWeight": "5167000000000" }, { "address": "bc2eb6f094e2ed1d026d81c46bc3c6e64db683ce", - "voteWeight": "108000000000" + "validatorWeight": "108000000000" }, { "address": "adce62617ffa92b6b401aa467f08b728115efa32", - "voteWeight": "16467000000000" + "validatorWeight": "16467000000000" }, { "address": "b728b046c1661dde24e3f86e5d76f6767d44e80f", - "voteWeight": "4827000000000" + "validatorWeight": "4827000000000" }, { "address": "e91022974563c973d35d193c6ab7ccddd777b19c", - "voteWeight": "6640000000000" + "validatorWeight": "6640000000000" }, { "address": "9b86f87ca47e19f4494cac5355f23ad30a10b119", - "voteWeight": "3187000000000" + "validatorWeight": "3187000000000" }, { "address": "e4ca8cd3fa2d5d9d0555c3ad4f0eaa5936b4f4f8", - "voteWeight": "9736000000000" + "validatorWeight": "9736000000000" }, { "address": "766e3f5693a7448c49924de84c1c27402ffb91d6", - "voteWeight": "2068000000000" + "validatorWeight": "2068000000000" }, { "address": "f01ef62446fb1b4e830824c4b7efff323c96724d", - "voteWeight": "6104000000000" + "validatorWeight": "6104000000000" }, { "address": "e1b8a2d2c76f7643e9d5e0afd0c15a4bbe3d5082", - "voteWeight": "3211000000000" + "validatorWeight": "3211000000000" }, { "address": "e0447a74685573bc95ed2504f4905dfc572973a8", - "voteWeight": "15498000000000" + "validatorWeight": "15498000000000" }, { "address": "8f1a9213dd629e8143f92ec25dfee4b944cf00cc", - "voteWeight": "2891000000000" + "validatorWeight": "2891000000000" }, { "address": "530e6c9e40e41cfe7f5a2da7837fcb220614e045", - "voteWeight": "14812000000000" + "validatorWeight": "14812000000000" }, { "address": "d92e54965b194c2d8189800e98442b6278395358", - "voteWeight": "9433000000000" + "validatorWeight": "9433000000000" }, { "address": "befa592a7e556b5b108ce603c2181d0f848f8620", - "voteWeight": "8948000000000" + "validatorWeight": "8948000000000" }, { "address": "eb754b16af8aa3535479264b690385eb74905dd0", - "voteWeight": "10874000000000" + "validatorWeight": "10874000000000" }, { "address": "c6551d505c18b000ecec80d5bde57e53b582528f", - "voteWeight": "7822000000000" + "validatorWeight": "7822000000000" }, { "address": "145c6f5e000f95745752a080b02b91533231c4d7", - "voteWeight": "13525000000000" + "validatorWeight": "13525000000000" }, { "address": "3aa364517e3bfdd7c3ffa629228c78e1d4392cc9", - "voteWeight": "10566000000000" + "validatorWeight": "10566000000000" }, { "address": "4bdda03ae27ff959f8f80951713948073abd1e6f", - "voteWeight": "11307000000000" + "validatorWeight": "11307000000000" }, { "address": "24cf7a5700c41dba9d80d7082462b7fb6cde2153", - "voteWeight": "10581000000000" + "validatorWeight": "10581000000000" }, { "address": "399364ed48ba8ea71b1fa4b3d4d3b223f21e01a1", - "voteWeight": "7728000000000" + "validatorWeight": "7728000000000" }, { "address": "5dc38e3e86bb4b74326fe80844033b856d0b9fc5", - "voteWeight": "5679000000000" + "validatorWeight": "5679000000000" }, { "address": "a979385ce7ffefe4dbbb418d2ef4b7a45462f4a1", - "voteWeight": "16477000000000" + "validatorWeight": "16477000000000" }, { "address": "2d9ba66e0392654e2d87b0026d9429595c129425", - "voteWeight": "2369000000000" + "validatorWeight": "2369000000000" }, { "address": "8fe3f40503d7acb823aa920e34746b73d8eb175d", - "voteWeight": "1498000000000" + "validatorWeight": "1498000000000" }, { "address": "4d9b93a33dd302013dd2907df1699dbfdabf9311", - "voteWeight": "12638000000000" + "validatorWeight": "12638000000000" }, { "address": "d42fe7ad479f42196061e37ee882ec13c13fc117", - "voteWeight": "13391000000000" + "validatorWeight": "13391000000000" }, { "address": "e0722012190fe4b0be3592241631c619cd479632", - "voteWeight": "11713000000000" + "validatorWeight": "11713000000000" }, { "address": "4cb8a27d3dcb7d731c3824d3ea60181e2a4083cf", - "voteWeight": "375000000000" + "validatorWeight": "375000000000" }, { "address": "d6636eef1ad9d16f0e36b40b217693d9593a87b2", - "voteWeight": "6659000000000" + "validatorWeight": "6659000000000" }, { "address": "62f1f8c958c29efddffeb1fa52bd283c7e47369a", - "voteWeight": "12633000000000" + "validatorWeight": "12633000000000" }, { "address": "ee613ea1006893066b6f97697124b15d92cbad53", - "voteWeight": "16160000000000" + "validatorWeight": "16160000000000" }, { "address": "97b7dfddb781d062d47b37cbf4ef89a294a434a8", - "voteWeight": "5025000000000" + "validatorWeight": "5025000000000" }, { "address": "7c70bcd6267a11b559c58af621f23af7cc78447c", - "voteWeight": "11065000000000" + "validatorWeight": "11065000000000" }, { "address": "e08bbaf945dcbd00a96b01e489e0d938c52a0244", - "voteWeight": "1809000000000" + "validatorWeight": "1809000000000" }, { "address": "3f77daa4185853ebfdd2bd1d10bd88a25ea1a574", - "voteWeight": "10201000000000" + "validatorWeight": "10201000000000" }, { "address": "b131a599e743538492b008d003cad5c94e415c55", - "voteWeight": "1057000000000" + "validatorWeight": "1057000000000" }, { "address": "68368620ecb3f324ef6d38686656e3c2fe24cef6", - "voteWeight": "4243000000000" + "validatorWeight": "4243000000000" }, { "address": "304d6cd294e599028408b773ac8fa2dd0ad3ea7b", - "voteWeight": "17646000000000" + "validatorWeight": "17646000000000" }, { "address": "a5bd8083c0e727410e3695b872e539732b0be7a4", - "voteWeight": "56000000000" + "validatorWeight": "56000000000" }, { "address": "e0e8d3c869eb70ef6a802591b3eda97ed5578160", - "voteWeight": "11314000000000" + "validatorWeight": "11314000000000" }, { "address": "7eba9c3b967f45897d4a36dc0a84f377e25cf4c9", - "voteWeight": "13915000000000" + "validatorWeight": "13915000000000" }, { "address": "fe03b404fbee471aef839f025a73793f5a27e032", - "voteWeight": "8776000000000" + "validatorWeight": "8776000000000" }, { "address": "5c0ed59671441e00ce5b411a585eb927c7c69a75", - "voteWeight": "11621000000000" + "validatorWeight": "11621000000000" }, { "address": "8ad7b7462c66da4d4f35f800480bcf643bbf34e7", - "voteWeight": "3933000000000" + "validatorWeight": "3933000000000" }, { "address": "61a4d0d93308d01e4b31df1ca54ffb6b37295cf8", - "voteWeight": "3097000000000" + "validatorWeight": "3097000000000" }, { "address": "abdc8f6bbda5591c3b9737c177b77d2a2a2d325e", - "voteWeight": "11477000000000" + "validatorWeight": "11477000000000" }, { "address": "faf2d8a822360844888f8213206fd8d9e8b221b8", - "voteWeight": "2997000000000" + "validatorWeight": "2997000000000" }, { "address": "3e677ca70338e5c0aa2b6d9a9d7dc9650bd8c44b", - "voteWeight": "9270000000000" + "validatorWeight": "9270000000000" }, { "address": "b51285831e2135818b06fd62fe82d18a11669dd7", - "voteWeight": "4955000000000" + "validatorWeight": "4955000000000" }, { "address": "b7a1902577f6c164decad22b085ba590e23aaf04", - "voteWeight": "4100000000000" + "validatorWeight": "4100000000000" }, { "address": "dbd9c2a72f2bfdc3e18ddd50aa2bed4b38345c6b", - "voteWeight": "3738000000000" + "validatorWeight": "3738000000000" }, { "address": "77d14cb16ff98eb043e2a92a0f9ad91052759c52", - "voteWeight": "12405000000000" + "validatorWeight": "12405000000000" }, { "address": "d5c0efd0cb4e306f4a37235e5464fc3a6307e016", - "voteWeight": "10956000000000" + "validatorWeight": "10956000000000" }, { "address": "4e6b2f6476cae1fc92b0a261d8a635676d3f678b", - "voteWeight": "1634000000000" + "validatorWeight": "1634000000000" }, { "address": "24b45ef2d6593117868e37e6e4f011de8c75e5c4", - "voteWeight": "1055000000000" + "validatorWeight": "1055000000000" }, { "address": "c1676ffd296e4c6ab5c903312897876aca143763", - "voteWeight": "11759000000000" + "validatorWeight": "11759000000000" }, { "address": "99b61fb373c35bbc6a05b50e30b9a3653a3cc019", - "voteWeight": "16087000000000" + "validatorWeight": "16087000000000" }, { "address": "ee715889a8f057fe1a74e7c54f253aeea393d9ab", - "voteWeight": "7520000000000" + "validatorWeight": "7520000000000" }, { "address": "f66424613759e8901d0997080eec173c979fc37c", - "voteWeight": "2271000000000" + "validatorWeight": "2271000000000" }, { "address": "74139d6d04842dae14c8b01c4b78667a6481973b", - "voteWeight": "14132000000000" + "validatorWeight": "14132000000000" }, { "address": "33904bda543f397cf396d3456ad9d17e657c2ad6", - "voteWeight": "17087000000000" + "validatorWeight": "17087000000000" }, { "address": "2cd7ce77e8d7e9ae3c04ee6ddca8a72b4eb7ecf9", - "voteWeight": "15547000000000" + "validatorWeight": "15547000000000" }, { "address": "f985a1b879b1316ced651046ed9381da2afb4431", - "voteWeight": "8656000000000" + "validatorWeight": "8656000000000" }, { "address": "a1cecc24e324b290f0f7a722a8b117cb20a63821", - "voteWeight": "162000000000" + "validatorWeight": "162000000000" }, { "address": "06eb1d23ed916d948d177355ad6628e0a75d3291", - "voteWeight": "13094000000000" + "validatorWeight": "13094000000000" }, { "address": "ad46109e73ce971c450f77f86bfd7a992292766a", - "voteWeight": "13523000000000" + "validatorWeight": "13523000000000" }, { "address": "85086013da8b6bb2449d7d35e362d849ad1b41ca", - "voteWeight": "1375000000000" + "validatorWeight": "1375000000000" }, { "address": "8a9d6c833f2539efb56e883c456de51c50289d80", - "voteWeight": "1066000000000" + "validatorWeight": "1066000000000" }, { "address": "0633c034d5e5e160fb464722b0a3c26974649336", - "voteWeight": "1006000000000" + "validatorWeight": "1006000000000" }, { "address": "94bb28a30888425965a664972ec90b7460b13029", - "voteWeight": "3887000000000" + "validatorWeight": "3887000000000" }, { "address": "72189094dffeb994cae9eee06d71638f96c381fd", - "voteWeight": "2000000000" + "validatorWeight": "2000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_2_standby.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_2_standby.json similarity index 74% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_2_standby.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_2_standby.json index 3d0ff4bc24f..458e1883bec 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_exactly_2_standby.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_exactly_2_standby.json @@ -1,425 +1,425 @@ { - "title": "Forger selection with more than 1 standby delegate", - "summary": "A set of voteWeights which include 2 eligible standby delegates", + "title": "Forger selection with more than 1 standby validator", + "summary": "A set of validatorWeights which include 2 eligible standby validators", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection_exactly_2_standby", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection_exactly_2_standby", "testCases": { "input": { "randomSeed1": "eb596af61f13f2dcb043ac23b9e48987", "randomSeed2": "5717710b24f9ad4617dc70939fd05c15", - "voteWeights": [ + "validatorWeights": [ { "address": "974220530fbc7fe9a7ae264291d100ccb0f31995", - "voteWeight": "4417000000000" + "validatorWeight": "4417000000000" }, { "address": "ce2f23f3a64f98d047b0ebf95abc494e756862da", - "voteWeight": "3193000000000" + "validatorWeight": "3193000000000" }, { "address": "8219a1280139782dca3e0a23276bbcf1fc51e3d7", - "voteWeight": "3488000000000" + "validatorWeight": "3488000000000" }, { "address": "9cefd80238c85da98d2b6223b01d081df9a44220", - "voteWeight": "10435000000000" + "validatorWeight": "10435000000000" }, { "address": "d0bb81d6d7dd2ebf7d552de2442ab2b63e721c77", - "voteWeight": "15295000000000" + "validatorWeight": "15295000000000" }, { "address": "86c9ae659019ce0bf03e930ef63c841c3497b8be", - "voteWeight": "13083000000000" + "validatorWeight": "13083000000000" }, { "address": "8014de0219a3a7daba0e39cb86abf4f0bef41890", - "voteWeight": "7638000000000" + "validatorWeight": "7638000000000" }, { "address": "495abf615560748860623ae79c9d363ce2cdd350", - "voteWeight": "13569000000000" + "validatorWeight": "13569000000000" }, { "address": "a4b641f30212148d7f8b01d712df26693fb3a3b1", - "voteWeight": "10160000000000" + "validatorWeight": "10160000000000" }, { "address": "ccc37a8265016dc99fa4c9ecaca5c1ffd0f96d2e", - "voteWeight": "2886000000000" + "validatorWeight": "2886000000000" }, { "address": "8965ce2863a1e0bb05a31dafea51943eb88c3738", - "voteWeight": "6211000000000" + "validatorWeight": "6211000000000" }, { "address": "5fe743fbf6693fcbfcac621fb5eb31b5ced441e9", - "voteWeight": "14093000000000" + "validatorWeight": "14093000000000" }, { "address": "f19958a6aa1a0ada54d2cbb89791d0976d26a874", - "voteWeight": "12805000000000" + "validatorWeight": "12805000000000" }, { "address": "04be24cdb49d27ce6f570ee17524f2ccd308950f", - "voteWeight": "12199000000000" + "validatorWeight": "12199000000000" }, { "address": "b36e8e489476997f96f723b99e488a498a4675d7", - "voteWeight": "2334000000000" + "validatorWeight": "2334000000000" }, { "address": "1927feb0515fcfb9c739eb081e8c1df94ff0e1e2", - "voteWeight": "7683000000000" + "validatorWeight": "7683000000000" }, { "address": "620bc0927ac8ac4f58e89cdef6d2df44ae0b7a04", - "voteWeight": "8793000000000" + "validatorWeight": "8793000000000" }, { "address": "8f111ef7a4ed4332b20d4ac13770a475e63c20e0", - "voteWeight": "9205000000000" + "validatorWeight": "9205000000000" }, { "address": "90fde7da68aca929f2c2373fbc891198c8f46869", - "voteWeight": "5918000000000" + "validatorWeight": "5918000000000" }, { "address": "a177d9508061c67a502cda20afd5e1019b8e0320", - "voteWeight": "3162000000000" + "validatorWeight": "3162000000000" }, { "address": "739439fa9ca7f03194683babfb72dc6856fe55be", - "voteWeight": "16242000000000" + "validatorWeight": "16242000000000" }, { "address": "671a35f220419f9b778abbc59763396a096a6b7f", - "voteWeight": "12985000000000" + "validatorWeight": "12985000000000" }, { "address": "deacb26855aefd6c7c590132a5a6b833761f170b", - "voteWeight": "4894000000000" + "validatorWeight": "4894000000000" }, { "address": "c956d6b3a39ea9adab2aeac2c9572c2d34270c3c", - "voteWeight": "18295000000000" + "validatorWeight": "18295000000000" }, { "address": "24041fdbe29ddd1a8f5e0c6df83a4a0d16d7cfd8", - "voteWeight": "9109000000000" + "validatorWeight": "9109000000000" }, { "address": "0090c75fd90fe7ff9010320b1d636d779a6d8080", - "voteWeight": "18265000000000" + "validatorWeight": "18265000000000" }, { "address": "0f3d47eef61a934021447234e63b2f47f982d065", - "voteWeight": "1056000000000" + "validatorWeight": "1056000000000" }, { "address": "0f862ce596471f880b87368b2423437b66a5b14f", - "voteWeight": "11570000000000" + "validatorWeight": "11570000000000" }, { "address": "df5d69d3621841d539a967800ed2e640538d32af", - "voteWeight": "3053000000000" + "validatorWeight": "3053000000000" }, { "address": "1663aa8edaa4945101475d7c1266b3ecaefd25c7", - "voteWeight": "8028000000000" + "validatorWeight": "8028000000000" }, { "address": "1c0a9695190d6acc5cd3f9de5bc9e6d4efd0b2c8", - "voteWeight": "11847000000000" + "validatorWeight": "11847000000000" }, { "address": "ecf35e39bf5d519f62ecce5d8eab2cb90b01443c", - "voteWeight": "9661000000000" + "validatorWeight": "9661000000000" }, { "address": "d31543f307b8122b19e331440d5914422fd639aa", - "voteWeight": "1835000000000" + "validatorWeight": "1835000000000" }, { "address": "35223a42f4129a26e4e167d057bb03a248222a06", - "voteWeight": "14602000000000" + "validatorWeight": "14602000000000" }, { "address": "0b9fa3509216032958fddcf27ba4d96db9774144", - "voteWeight": "15394000000000" + "validatorWeight": "15394000000000" }, { "address": "724ef2b4357cd1e5c9990339db68e589d74f8743", - "voteWeight": "7636000000000" + "validatorWeight": "7636000000000" }, { "address": "322b2129fa0572383a24fa6b7c0b92f7f731a201", - "voteWeight": "14607000000000" + "validatorWeight": "14607000000000" }, { "address": "2e129a40ff1ceb05c3661b5393bc2349ae66712f", - "voteWeight": "4851000000000" + "validatorWeight": "4851000000000" }, { "address": "b02c6e5c0495673d972ddfa091b8880f500a7d03", - "voteWeight": "17437000000000" + "validatorWeight": "17437000000000" }, { "address": "51663c65345019ad678e199636a1ca4f42a166da", - "voteWeight": "6108000000000" + "validatorWeight": "6108000000000" }, { "address": "df1e39039d11104dcdc868817965d28658e5e7f1", - "voteWeight": "4442000000000" + "validatorWeight": "4442000000000" }, { "address": "ac0bc374f43ffc437fe0295672186f0fa71eca14", - "voteWeight": "13565000000000" + "validatorWeight": "13565000000000" }, { "address": "c7f36f6f33c63eb4b18791eecaf045c27beddb0d", - "voteWeight": "695000000000" + "validatorWeight": "695000000000" }, { "address": "f3b0144d1b062c808ef1ca7e10fa5902688c1515", - "voteWeight": "16183000000000" + "validatorWeight": "16183000000000" }, { "address": "fad140a0eb35908a7931ca3935911a3cea21d817", - "voteWeight": "12652000000000" + "validatorWeight": "12652000000000" }, { "address": "355b5b39a85eda7097f704de3d2fdd59dca3fbb5", - "voteWeight": "12619000000000" + "validatorWeight": "12619000000000" }, { "address": "7a0d6bc8d4ab70312dc47e737fc1fb26d8eb6ab4", - "voteWeight": "5970000000000" + "validatorWeight": "5970000000000" }, { "address": "80677764c610369f08189ac643f4f3a0ab6dbd8a", - "voteWeight": "17766000000000" + "validatorWeight": "17766000000000" }, { "address": "95a419546a925b8ca10b3c21a88150a149d521c1", - "voteWeight": "17106000000000" + "validatorWeight": "17106000000000" }, { "address": "288afbad7ded1b83b9f736b5946a670e38d4a9bc", - "voteWeight": "1662000000000" + "validatorWeight": "1662000000000" }, { "address": "9998ea6a60bf3f68871c4add8242a62cb08b6eeb", - "voteWeight": "9707000000000" + "validatorWeight": "9707000000000" }, { "address": "9166ef6615054219a4691362bdd215e06810d35d", - "voteWeight": "16887000000000" + "validatorWeight": "16887000000000" }, { "address": "0c54702ecec15b9a59d842b4385bec7c43695376", - "voteWeight": "306700000000" + "validatorWeight": "306700000000" }, { "address": "9fc348ae95a35796be2424a50ea77fc3e2c357ba", - "voteWeight": "14996000000000" + "validatorWeight": "14996000000000" }, { "address": "1be67cd8fc624e63767e7074e0145d16e07a571c", - "voteWeight": "2749000000000" + "validatorWeight": "2749000000000" }, { "address": "5d694b5246a565cdeebc8bd9e09c916657f6a5dc", - "voteWeight": "133400000000" + "validatorWeight": "133400000000" }, { "address": "c7523d8f8540442bfdf6e1a1127d9e71eda4bec5", - "voteWeight": "6899000000000" + "validatorWeight": "6899000000000" }, { "address": "0cdec38828e14d6aa1badb069c9619ce741def53", - "voteWeight": "5904000000000" + "validatorWeight": "5904000000000" }, { "address": "573f50430032f249759a3e6f0aa6bfcee00e68f4", - "voteWeight": "5684000000000" + "validatorWeight": "5684000000000" }, { "address": "c0c2cfebe0f5692fe27614e63314a1f5173bac90", - "voteWeight": "8035000000000" + "validatorWeight": "8035000000000" }, { "address": "d6796acc8e859fc5125b347d0d8f8ff26e00757e", - "voteWeight": "8367000000000" + "validatorWeight": "8367000000000" }, { "address": "10911ed28ac81dd8a378d380f79f37486cf59956", - "voteWeight": "6260000000000" + "validatorWeight": "6260000000000" }, { "address": "5daacd2f506f5a3611fd9548e7b24326d95a92dd", - "voteWeight": "15317000000000" + "validatorWeight": "15317000000000" }, { "address": "47b5b2b5036084a98df339c4b7985ee3fa86517b", - "voteWeight": "741000000000" + "validatorWeight": "741000000000" }, { "address": "ded706b137d7a9db82050c0a7a615e5a38341253", - "voteWeight": "4521000000000" + "validatorWeight": "4521000000000" }, { "address": "4aab9f8e831f5e7f8362e8cadb225088d4f80f91", - "voteWeight": "15277000000000" + "validatorWeight": "15277000000000" }, { "address": "bd687e0c559ae6906c88640591cfe9f93e135218", - "voteWeight": "11917000000000" + "validatorWeight": "11917000000000" }, { "address": "836405486dca3b2694686a01249f2144cb94a13b", - "voteWeight": "11086000000000" + "validatorWeight": "11086000000000" }, { "address": "a1d55de4e27db7e8bdf60daf394f7233d0477c5a", - "voteWeight": "7444000000000" + "validatorWeight": "7444000000000" }, { "address": "cefdcfc2bdac5884e4d35cbd58c83535c01997b0", - "voteWeight": "16271000000000" + "validatorWeight": "16271000000000" }, { "address": "b8cf37d1f7300aa5a24bf159e4ab8c47648fb1fa", - "voteWeight": "10163000000000" + "validatorWeight": "10163000000000" }, { "address": "c23a3f47418d8d29440b243c5a5110ab00d60169", - "voteWeight": "446000000000" + "validatorWeight": "446000000000" }, { "address": "5ea3e0b205c766e5dda0228dad8a87da7b4bfb06", - "voteWeight": "7353000000000" + "validatorWeight": "7353000000000" }, { "address": "bc05e3ac94a0cbdcdbd96d5a822e5d1fa5773a77", - "voteWeight": "4016000000000" + "validatorWeight": "4016000000000" }, { "address": "e54f55ef2b34fcddedea1e441e8990f3e30578fa", - "voteWeight": "8082000000000" + "validatorWeight": "8082000000000" }, { "address": "3ab2d19af2bc57ea9444a0aecc69ab22afbebd42", - "voteWeight": "8758000000000" + "validatorWeight": "8758000000000" }, { "address": "69dc1f4a5e56039294cd0e6bae96fd42e30cac02", - "voteWeight": "1978000000000" + "validatorWeight": "1978000000000" }, { "address": "f615adade9f0ac313e06c2455b3fcd999ed499ca", - "voteWeight": "9645000000000" + "validatorWeight": "9645000000000" }, { "address": "3d829d2c2c71668d5902ca24478b635da7f15a4a", - "voteWeight": "13466000000000" + "validatorWeight": "13466000000000" }, { "address": "1d4f568f1c871cbade7c1926fb7e838b9984eaa2", - "voteWeight": "6586000000000" + "validatorWeight": "6586000000000" }, { "address": "928719b9b1ba2642f3577d2c57123fc8f45d9309", - "voteWeight": "231000000000" + "validatorWeight": "231000000000" }, { "address": "333899e5ed7cd5741e82e71b0b6b418a2d26fdc5", - "voteWeight": "871000000000" + "validatorWeight": "871000000000" }, { "address": "fafbea758f17d2e6912f51b0b10690abd5e9627e", - "voteWeight": "6091000000000" + "validatorWeight": "6091000000000" }, { "address": "d73b77dfc710f5ec0ca5710af1a1c15336aa04f1", - "voteWeight": "8901000000000" + "validatorWeight": "8901000000000" }, { "address": "eac9942e59efb18cdd7298fc10e29b58356b3c02", - "voteWeight": "17059000000000" + "validatorWeight": "17059000000000" }, { "address": "7b2459ff0c1e7a80efb2ae6b69f4b5f6b1e8a5d4", - "voteWeight": "2190000000000" + "validatorWeight": "2190000000000" }, { "address": "a85204d9a4d689b042b54a12b1e8725586e113c3", - "voteWeight": "4709000000000" + "validatorWeight": "4709000000000" }, { "address": "56a95065ffc927f7ff581a68efa145c5ad8b240e", - "voteWeight": "17590000000000" + "validatorWeight": "17590000000000" }, { "address": "344225995799ec5a9974782a0f4eb15e2d3aa355", - "voteWeight": "7245000000000" + "validatorWeight": "7245000000000" }, { "address": "a57c955b95224adf1f54521d625a0ec6658122a8", - "voteWeight": "14475000000000" + "validatorWeight": "14475000000000" }, { "address": "de5a59881eb5e288d8d0c6913e9091ea378b6877", - "voteWeight": "8959000000000" + "validatorWeight": "8959000000000" }, { "address": "b0131ed02d6bf4fe1addb6f880ed48115b34b23b", - "voteWeight": "2060000000000" + "validatorWeight": "2060000000000" }, { "address": "ab3dc0112ed7f31f7eabba658f5d9b847038ccca", - "voteWeight": "6748000000000" + "validatorWeight": "6748000000000" }, { "address": "d274f89a763e1cd79ac09a2d8b370a9e3fc5a46e", - "voteWeight": "13781000000000" + "validatorWeight": "13781000000000" }, { "address": "2b2f222ebb9fb8550b05a5d12325cda08035441a", - "voteWeight": "4832000000000" + "validatorWeight": "4832000000000" }, { "address": "3549354f43d94fe8135b06e24935d3ff490a6dac", - "voteWeight": "6353000000000" + "validatorWeight": "6353000000000" }, { "address": "66e0838ecb69da082687c852f32db32602541bf3", - "voteWeight": "8393000000000" + "validatorWeight": "8393000000000" }, { "address": "8e7d24a52160ad7a65c76d5268785553707c6666", - "voteWeight": "1170000000000" + "validatorWeight": "1170000000000" }, { "address": "bb0b67c015f4e9624444d8428f6b3a4def11d9a4", - "voteWeight": "852000000000" + "validatorWeight": "852000000000" }, { "address": "f4deb58061c4e5ea1e9167083c9c6d0f73df630a", - "voteWeight": "13785000000000" + "validatorWeight": "13785000000000" }, { "address": "0c7d4406be25bd608ea244180a494214a7630c55", - "voteWeight": "10409000000000" + "validatorWeight": "10409000000000" }, { "address": "fbdd3475d0a8fc0e79b12d0b3ee79ad795c29925", - "voteWeight": "110000000000" + "validatorWeight": "110000000000" }, { "address": "854e0ef4c5474884f45bddc71c46eccc63d93989", - "voteWeight": "13823000000000" + "validatorWeight": "13823000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_less_than_103.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_less_than_103.json similarity index 74% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_less_than_103.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_less_than_103.json index cc2aeac8dc7..0f1317328e7 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_less_than_103.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_less_than_103.json @@ -1,213 +1,213 @@ { - "title": "Forger selection with less than 103 delegates", - "summary": "A set of voteWeights which include less than 103 delegates", + "title": "Forger selection with less than 103 validators", + "summary": "A set of validatorWeights which include less than 103 validators", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection_less_than_103", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection_less_than_103", "testCases": { "input": { "randomSeed1": "225723ef50cbad5e11dd4edf23da652c", "randomSeed2": "9c65ff262b4f4ccc6d56bcbf5a6a1957", - "voteWeights": [ + "validatorWeights": [ { "address": "bf2e956611a4bd24e7dabc6c66d243327a87028f", - "voteWeight": "179000000000" + "validatorWeight": "179000000000" }, { "address": "e6746edf586bb2a64d977add677afaebed7730e3", - "voteWeight": "138000000000" + "validatorWeight": "138000000000" }, { "address": "ea50b241deee288208800f1ab0ae9940fbde54db", - "voteWeight": "31000000000" + "validatorWeight": "31000000000" }, { "address": "dbe5a42f398594fda7c44a9d2e27d00ad9a18452", - "voteWeight": "95000000000" + "validatorWeight": "95000000000" }, { "address": "37a5bbc6c5015109030177184dbe51c2ce4d420b", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "address": "626d9f43c10c2013533efc7ad4f694394f5dc376", - "voteWeight": "44000000000" + "validatorWeight": "44000000000" }, { "address": "7b381c99a14f747760275eee062ab14bdc280614", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "d6b3b4cb1019ad8c72f99aedda97a2c17d1fa7d3", - "voteWeight": "119000000000" + "validatorWeight": "119000000000" }, { "address": "44bdbe5c8061b667c6bd576570df691a009e6a52", - "voteWeight": "27000000000" + "validatorWeight": "27000000000" }, { "address": "fa861e99086b7d76f3bdc7a3ba841d6c856b9aad", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "17f7b895dad086016bad9c39c4e13735cd283984", - "voteWeight": "155000000000" + "validatorWeight": "155000000000" }, { "address": "8e9f358beff811cd268be0549e369b5fcc779c0d", - "voteWeight": "61000000000" + "validatorWeight": "61000000000" }, { "address": "3be0308d4d16dc304196089a5b6709ce0d054ba3", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "address": "a4661b14a4da0ac2544438f54084ea8af7d98242", - "voteWeight": "57000000000" + "validatorWeight": "57000000000" }, { "address": "00c7ae5c0aab5c3eb2d9854e033fba31e369818a", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "77b01ed6147966a6dd065ca1b4f61b4467db26e0", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "e9b60b7e4b4dc39bc08afaac67b5cf9d2c1fdd15", - "voteWeight": "65000000000" + "validatorWeight": "65000000000" }, { "address": "7221cbc43718ab0785533b3e272e972f66311e1a", - "voteWeight": "54000000000" + "validatorWeight": "54000000000" }, { "address": "f2b3e5c9f8490a25d8fa4247f3cdefd3e1a0f38b", - "voteWeight": "163000000000" + "validatorWeight": "163000000000" }, { "address": "83b29499fe12a928b18e945d74bfbc5d1325c480", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "address": "1ec754b81be4ec39a488a493358273c0772960ee", - "voteWeight": "60000000000" + "validatorWeight": "60000000000" }, { "address": "2a58066b75bafc98964cef5d355b87f75860103e", - "voteWeight": "180000000000" + "validatorWeight": "180000000000" }, { "address": "b1d67d379afdd4a3c96db5dac19436b795da3fed", - "voteWeight": "4000000000" + "validatorWeight": "4000000000" }, { "address": "f85c5f7b404e0a1a19a11cc4d17a56829b5ada64", - "voteWeight": "7000000000" + "validatorWeight": "7000000000" }, { "address": "72cfbf0931284ea351814ce9ee986dd38b4e235f", - "voteWeight": "115000000000" + "validatorWeight": "115000000000" }, { "address": "10d55530ff1ad18004aae226f15e166b5a2b3cda", - "voteWeight": "16000000000" + "validatorWeight": "16000000000" }, { "address": "e0ccccc3a4d47eb570397059c61d2524184a3e66", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "address": "8f21e33bd4b41b6d5c6c43fed305ebd22f4a3b32", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "a223e0ef9022e57630db6c81b08b10e03e9d46f6", - "voteWeight": "17000000000" + "validatorWeight": "17000000000" }, { "address": "deb79e414ec4206de74366df5aa296b639723793", - "voteWeight": "148000000000" + "validatorWeight": "148000000000" }, { "address": "6cbb6ee8151ad26f09469b449714a202f0fe061a", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "8ccb390c0c6351e5f73bc23fe9fcfa81a1935b19", - "voteWeight": "123000000000" + "validatorWeight": "123000000000" }, { "address": "83827bfefdacbe00d78371c610ea37c20883f9d3", - "voteWeight": "48000000000" + "validatorWeight": "48000000000" }, { "address": "2051c041d5474754d90e3577577c1dd06f832cd0", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "2d6a13814cbca1b482be23c4dbd937491b5dd9da", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "be995e03cbf2569bea858ee3ed418142884b0bb7", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "176554635df1533c9c8232bf1db56c7875438afb", - "voteWeight": "136000000000" + "validatorWeight": "136000000000" }, { "address": "fa322aa8a86ae7c753434f6a2a4e6e8aefe86846", - "voteWeight": "64000000000" + "validatorWeight": "64000000000" }, { "address": "46dcc595281858061189097fe9685fc693a65fb9", - "voteWeight": "62000000000" + "validatorWeight": "62000000000" }, { "address": "f4e60b57dcf2a578d19d4d8cc972ce77d170d5fa", - "voteWeight": "164000000000" + "validatorWeight": "164000000000" }, { "address": "2421ad6e3dd3156dbfd03c2b55c302a9e726a751", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "492ce85d0f9bab0a1a7cfd22075ca4ed2db1dc42", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "51e345f7b430ae930699ee1637b9f3adecb93915", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "address": "462897799043bbd7d545cd19ff17085bd3f2540f", - "voteWeight": "166000000000" + "validatorWeight": "166000000000" }, { "address": "d01bc3db7dfac7bbcb7a88a2adc915dc985bd935", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "19d76c9f32d05d6f406b4fc0c6241102609e8f48", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "308c56b6847b6c8d6132da412cfe1e1d89ffcb32", - "voteWeight": "124000000000" + "validatorWeight": "124000000000" }, { "address": "24b2a6b0a1fb01d9bccf5bb667d3a147fbd7de20", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "02f4ecc46c2fdf70cfb37d519d968a20217b90ce", - "voteWeight": "5000000000" + "validatorWeight": "5000000000" }, { "address": "96bb07ae3b8114d26e58be82aa31b15a1eb6db09", - "voteWeight": "178000000000" + "validatorWeight": "178000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_more_than_2_standby.json b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_more_than_2_standby.json similarity index 71% rename from protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_more_than_2_standby.json rename to protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_more_than_2_standby.json index 12e88d87e71..471577914fa 100644 --- a/protocol-specs/generator_outputs/dpos_forger_selection/dpos_forger_selection_more_than_2_standby.json +++ b/protocol-specs/generator_outputs/dpos_forger_selection/pos_forger_selection_more_than_2_standby.json @@ -1,613 +1,613 @@ { - "title": "Forger selection with more than 2 standby delegates", - "summary": "A set of voteWeights which include more than 2 eligible standby delegates", + "title": "Forger selection with more than 2 standby validators", + "summary": "A set of validatorWeights which include more than 2 eligible standby validators", "config": "devnet", - "runner": "dpos_forger_selection", - "handler": "dpos_forger_selection_more_than_2_standby", + "runner": "pos_forger_selection", + "handler": "pos_forger_selection_more_than_2_standby", "testCases": { "input": { "randomSeed1": "b9acc2f1fda3666bfb34107f1c6dccc4", "randomSeed2": "fe47a9e4083414c1b50fccbbadec4205", - "voteWeights": [ + "validatorWeights": [ { "address": "b8982f66903a6bfa5d6994c08ddf97707200d316", - "voteWeight": "2130000000000" + "validatorWeight": "2130000000000" }, { "address": "f1b5b0c9d35957ca463b817467782ffa5d2e6945", - "voteWeight": "5304000000000" + "validatorWeight": "5304000000000" }, { "address": "a47e822534cc01a960b0c61407a02b5a55b84cd9", - "voteWeight": "7295000000000" + "validatorWeight": "7295000000000" }, { "address": "40b482f0e92773cf718bb0e9526b3fb2a35f86a4", - "voteWeight": "4140000000000" + "validatorWeight": "4140000000000" }, { "address": "f5022fb85925d1303c0071d1a8c42ec8e70e2552", - "voteWeight": "10556000000000" + "validatorWeight": "10556000000000" }, { "address": "68ae286f34ed63063cc8d640cf02d4351673cea0", - "voteWeight": "4467000000000" + "validatorWeight": "4467000000000" }, { "address": "457d22cdab02c32829f034364488b943edda602b", - "voteWeight": "11790000000000" + "validatorWeight": "11790000000000" }, { "address": "b2eba1f6ae9bc5f117d5e468568fc5a659d02c44", - "voteWeight": "14837000000000" + "validatorWeight": "14837000000000" }, { "address": "012252a13c9fb7117dc0adefa8c908a95a967598", - "voteWeight": "17861000000000" + "validatorWeight": "17861000000000" }, { "address": "68034297eb7b832c7b17f528d813c3213d670d23", - "voteWeight": "17967000000000" + "validatorWeight": "17967000000000" }, { "address": "3e2214ac94000e7c516838872827c7bc168237e2", - "voteWeight": "14571000000000" + "validatorWeight": "14571000000000" }, { "address": "4c67218a8afcf02e9e8b73d61b6259eab3f615ed", - "voteWeight": "13057000000000" + "validatorWeight": "13057000000000" }, { "address": "e8a04f6b9ca288e13c75cefc28d9d3843bfdb30c", - "voteWeight": "9619000000000" + "validatorWeight": "9619000000000" }, { "address": "c6cc69c2495231daf3fc3e71fe1416b3502a3717", - "voteWeight": "3510000000000" + "validatorWeight": "3510000000000" }, { "address": "bd5e5423daf7d947f263721b5c04e3fb0efea832", - "voteWeight": "8213000000000" + "validatorWeight": "8213000000000" }, { "address": "54bc83371d60f5a573ef623d654bedb2625208c1", - "voteWeight": "10353000000000" + "validatorWeight": "10353000000000" }, { "address": "6370d5921c876c1cd01b97344b3516e1b97614d1", - "voteWeight": "2087000000000" + "validatorWeight": "2087000000000" }, { "address": "d1afd2c87d15d0ed83a55fab3443e21272ac17a9", - "voteWeight": "14269000000000" + "validatorWeight": "14269000000000" }, { "address": "fa8969a94c6ba2842a8ef6371ab35637d1330539", - "voteWeight": "12138000000000" + "validatorWeight": "12138000000000" }, { "address": "3e89fe8b155c4128ee943b368d4374cfa7658722", - "voteWeight": "10879000000000" + "validatorWeight": "10879000000000" }, { "address": "0622e8fde13558fe526a51b2850e15b969518fa0", - "voteWeight": "1509000000000" + "validatorWeight": "1509000000000" }, { "address": "eac74c72ad9c5450903095e2eaf0837a327e931a", - "voteWeight": "16638000000000" + "validatorWeight": "16638000000000" }, { "address": "4d11d0774ec4f3bfe5f59f868a2e4bdd04bd6619", - "voteWeight": "13919000000000" + "validatorWeight": "13919000000000" }, { "address": "d0bd2f894b93ad053c3b3d2daffd342f9e7ec4f8", - "voteWeight": "14703000000000" + "validatorWeight": "14703000000000" }, { "address": "cdaf5ba88dcf81fcc00598b16c13a9d54775614b", - "voteWeight": "2252000000000" + "validatorWeight": "2252000000000" }, { "address": "15576ebac2097988ecdfdfd755697b44e1e8540d", - "voteWeight": "10464000000000" + "validatorWeight": "10464000000000" }, { "address": "b33b01ee876b248f22af6173f198d1d06a8b4e0b", - "voteWeight": "16748000000000" + "validatorWeight": "16748000000000" }, { "address": "15a1a4cf3bc75aeeb50614814d2b812627dd58f1", - "voteWeight": "1982000000000" + "validatorWeight": "1982000000000" }, { "address": "0fa290a0ea4dbc697ca93cb3d27f9ccf5e602a0b", - "voteWeight": "1264000000000" + "validatorWeight": "1264000000000" }, { "address": "bc98f22d583a341e6681278e8dc64cb57188cafb", - "voteWeight": "14571000000000" + "validatorWeight": "14571000000000" }, { "address": "e2b37b80ccda065d10777eef5f825ccc9bf95c53", - "voteWeight": "6422000000000" + "validatorWeight": "6422000000000" }, { "address": "b5c96c3a90c3bb99de174172b1f234928cdb6591", - "voteWeight": "8188000000000" + "validatorWeight": "8188000000000" }, { "address": "513900715c34c9c6cd3e430b1a71cd06e16700c3", - "voteWeight": "325000000000" + "validatorWeight": "325000000000" }, { "address": "95ac7fe1e86eca80d97826a1a5a3e7641b90cde9", - "voteWeight": "11800000000000" + "validatorWeight": "11800000000000" }, { "address": "18863071de0a7433a36f02c99e125163f19d17e2", - "voteWeight": "13791000000000" + "validatorWeight": "13791000000000" }, { "address": "d152405521972e71abed81e4d5815667baea1abb", - "voteWeight": "11369000000000" + "validatorWeight": "11369000000000" }, { "address": "5c1166bbc53856648c87580b49644bbab9e8ce4b", - "voteWeight": "7515000000000" + "validatorWeight": "7515000000000" }, { "address": "e080daeb01e6fd76e76497a9a109d0dcb693356e", - "voteWeight": "11882000000000" + "validatorWeight": "11882000000000" }, { "address": "d2904952a51e21a8cb2592eda94e581ed4540385", - "voteWeight": "10332000000000" + "validatorWeight": "10332000000000" }, { "address": "67013324918faf245cf455d0858ba4e293116d7b", - "voteWeight": "3402000000000" + "validatorWeight": "3402000000000" }, { "address": "f84b4aead893576f4ff584b33a86eb72b806e9c7", - "voteWeight": "3398000000000" + "validatorWeight": "3398000000000" }, { "address": "a2b416fc81dd4d36265402500c5d757db29023c2", - "voteWeight": "5374000000000" + "validatorWeight": "5374000000000" }, { "address": "4569135da2bb49090f1882ab6fc87e9c1408531b", - "voteWeight": "17927000000000" + "validatorWeight": "17927000000000" }, { "address": "730a8a554d21f79e7bb04d635ea42ecc7058d181", - "voteWeight": "15968000000000" + "validatorWeight": "15968000000000" }, { "address": "5b73e146f561878f3e86265a959b570e722f9222", - "voteWeight": "3991000000000" + "validatorWeight": "3991000000000" }, { "address": "19a14533349d5897eb4c47bf3c13ff04a348ee1e", - "voteWeight": "2313000000000" + "validatorWeight": "2313000000000" }, { "address": "2265e86e17ca9a0a5604431a3bcd081762962117", - "voteWeight": "5553000000000" + "validatorWeight": "5553000000000" }, { "address": "82a21fa6c4caf2239862cf06e7eca3e9e49a1961", - "voteWeight": "14225000000000" + "validatorWeight": "14225000000000" }, { "address": "32ce9689c521004717fe6536fe6d2ce5d01786b8", - "voteWeight": "1638000000000" + "validatorWeight": "1638000000000" }, { "address": "b4ab38b036c225b67d0a1db14bb0b76068a64492", - "voteWeight": "6264000000000" + "validatorWeight": "6264000000000" }, { "address": "7c89f68da3d1ebb42ce080c3ed1c2b12c528018f", - "voteWeight": "6501000000000" + "validatorWeight": "6501000000000" }, { "address": "9812d641947608596addd69812f7846512ff78f3", - "voteWeight": "15004000000000" + "validatorWeight": "15004000000000" }, { "address": "d988173e59083e98297c37b97ea01761e30bc316", - "voteWeight": "8151000000000" + "validatorWeight": "8151000000000" }, { "address": "95b3716727c551c1c738ae67555f72014ada49c9", - "voteWeight": "5968000000000" + "validatorWeight": "5968000000000" }, { "address": "a96861260057ba3d42ccb1a651adedc776282ded", - "voteWeight": "892000000000" + "validatorWeight": "892000000000" }, { "address": "f6b77ce2f67f1a6a69acefead3d83fde1ab5df81", - "voteWeight": "2292000000000" + "validatorWeight": "2292000000000" }, { "address": "2d26d2f049bef04fd61bce3a741f14e70cce1a9a", - "voteWeight": "17564000000000" + "validatorWeight": "17564000000000" }, { "address": "7069394299436565ce18a30e26fa4acc355e32ba", - "voteWeight": "15460000000000" + "validatorWeight": "15460000000000" }, { "address": "d4f541b1df80486c7f5da5c33e4b5a8c62bac011", - "voteWeight": "7064000000000" + "validatorWeight": "7064000000000" }, { "address": "5389fcf6c1dfcf84c44ec967f0752ef75dbbc083", - "voteWeight": "7774000000000" + "validatorWeight": "7774000000000" }, { "address": "5a98184a71d2b173ec14b00ade42fe1c16d1b833", - "voteWeight": "6488000000000" + "validatorWeight": "6488000000000" }, { "address": "7abb4de258ed5b69e9a62c01ebfb85a46df26f87", - "voteWeight": "14555000000000" + "validatorWeight": "14555000000000" }, { "address": "daba3e94ee10b72fcd801ea8d37d79d94aed7c41", - "voteWeight": "8762000000000" + "validatorWeight": "8762000000000" }, { "address": "a85b0fd020bc74ffdb154916f14810bb96d6302c", - "voteWeight": "16687000000000" + "validatorWeight": "16687000000000" }, { "address": "8ddba3b07d4cb99626a1b6de41f7ea0f5dfcc974", - "voteWeight": "14113000000000" + "validatorWeight": "14113000000000" }, { "address": "81e967a5c16469656763acb7ad7c1a4152cbea17", - "voteWeight": "10045000000000" + "validatorWeight": "10045000000000" }, { "address": "6bf9ad2d5bcf504ea9bfc48632260dab1ba99813", - "voteWeight": "3562000000000" + "validatorWeight": "3562000000000" }, { "address": "802d3bbd00dd9f65e6be3c1209c9328811547789", - "voteWeight": "15300000000000" + "validatorWeight": "15300000000000" }, { "address": "b2103e07c353a2e6bba0106b8cbe62e6926c06f2", - "voteWeight": "16832000000000" + "validatorWeight": "16832000000000" }, { "address": "fb8b2282d18d510220ebb1a51cb482903c7d0354", - "voteWeight": "5723000000000" + "validatorWeight": "5723000000000" }, { "address": "99e5a8cd768fcec38f8d8d8d24f794faa5057199", - "voteWeight": "2353000000000" + "validatorWeight": "2353000000000" }, { "address": "cac6357e3fc988b1edce922e8ab03bb89e5bf145", - "voteWeight": "18059000000000" + "validatorWeight": "18059000000000" }, { "address": "a699825136f2733aa4331ce69d9ab16c61156899", - "voteWeight": "11768000000000" + "validatorWeight": "11768000000000" }, { "address": "6ef5c311e7c64ef986a254c084dd22dbaea1247c", - "voteWeight": "13852000000000" + "validatorWeight": "13852000000000" }, { "address": "3a9c0d3ed54cc6c7cc16715ca0ade9852fe963fa", - "voteWeight": "1816000000000" + "validatorWeight": "1816000000000" }, { "address": "9668cf5d39de0c2cbadda29a1a62018b7de85c6c", - "voteWeight": "1767000000000" + "validatorWeight": "1767000000000" }, { "address": "1fdb1c6b31a9241f336cfc4cc0fc3099fe9ab5f5", - "voteWeight": "14574000000000" + "validatorWeight": "14574000000000" }, { "address": "11788879cc1940e69e5c376994f9defd339df01c", - "voteWeight": "15340000000000" + "validatorWeight": "15340000000000" }, { "address": "74acc43f4fb7dcfd045963e1a0d471c510d808d3", - "voteWeight": "15142000000000" + "validatorWeight": "15142000000000" }, { "address": "d1252a9b64b8e49c0c4215d5fd8108996898c57a", - "voteWeight": "11365000000000" + "validatorWeight": "11365000000000" }, { "address": "568bd94bc9e82cd5dc433330d52938e6b38f1b94", - "voteWeight": "1185000000000" + "validatorWeight": "1185000000000" }, { "address": "de560593fea4b8cb99b012a2439ad2807d562399", - "voteWeight": "8904000000000" + "validatorWeight": "8904000000000" }, { "address": "30e2dfdcb965cf25a165fecfe816f0583ecba530", - "voteWeight": "11422000000000" + "validatorWeight": "11422000000000" }, { "address": "e2c759ac984fd45704f3dc92f810da720f385971", - "voteWeight": "8146000000000" + "validatorWeight": "8146000000000" }, { "address": "64d8dd654d48ff709d5f76307671ee2289f79470", - "voteWeight": "10807000000000" + "validatorWeight": "10807000000000" }, { "address": "9d4751ccd0091515fabd0569d26e8515305768ce", - "voteWeight": "12149000000000" + "validatorWeight": "12149000000000" }, { "address": "bc5dbf6f7005864c231a1273d6b1039624075860", - "voteWeight": "12736000000000" + "validatorWeight": "12736000000000" }, { "address": "99dbb19dcb2e79dc0ce2647751c1b3fc54ee1e7f", - "voteWeight": "5642000000000" + "validatorWeight": "5642000000000" }, { "address": "14264ae633c077108f6cb49dd2659a219dcd1c6b", - "voteWeight": "3903000000000" + "validatorWeight": "3903000000000" }, { "address": "95d3f7ec72cd5477b569cd60698637dbcd924a87", - "voteWeight": "11235000000000" + "validatorWeight": "11235000000000" }, { "address": "491f8ccb0ef0c4f27a7c164eee955aaf9f4b720d", - "voteWeight": "14476000000000" + "validatorWeight": "14476000000000" }, { "address": "feb0a9cdd91785e4be3f8b4a14b7bf6a2e916da2", - "voteWeight": "5261000000000" + "validatorWeight": "5261000000000" }, { "address": "ea5988ce932ae90e6b6aedfa3f218ae5b3ef8eef", - "voteWeight": "9735000000000" + "validatorWeight": "9735000000000" }, { "address": "63a0aff1b108afd9b47089935520069c5a07366f", - "voteWeight": "6667000000000" + "validatorWeight": "6667000000000" }, { "address": "ed032078679cb233c6012d4a424bef2fc411e9fd", - "voteWeight": "17542000000000" + "validatorWeight": "17542000000000" }, { "address": "3ae234d361047b036e9d7fd8d2f275e0f0535445", - "voteWeight": "2757000000000" + "validatorWeight": "2757000000000" }, { "address": "4baa01973c436f33d023f45edb92e01e5d317994", - "voteWeight": "8003000000000" + "validatorWeight": "8003000000000" }, { "address": "ea5805a2ff7d71de35bbfb010ed635d361ede5c5", - "voteWeight": "17392000000000" + "validatorWeight": "17392000000000" }, { "address": "0d98cd8688dc5c64fd7722f36975193ac8a2b22b", - "voteWeight": "9919000000000" + "validatorWeight": "9919000000000" }, { "address": "599b3f04c823a82c6fa8f788d0ed8c02f0a2a33f", - "voteWeight": "14051000000000" + "validatorWeight": "14051000000000" }, { "address": "edde05aee2aa06171b7ee0acbc0342e72fb0c6dc", - "voteWeight": "6029000000000" + "validatorWeight": "6029000000000" }, { "address": "bb3c65abc378f9f25685e0ce0964a1196677bb57", - "voteWeight": "9998000000000" + "validatorWeight": "9998000000000" }, { "address": "727029f2d7aadfd2a00d928f442f2eac550fd5a0", - "voteWeight": "8376000000000" + "validatorWeight": "8376000000000" }, { "address": "12151328eccf982eb0c0f61b20f5b6cfa30e96e7", - "voteWeight": "7198000000000" + "validatorWeight": "7198000000000" }, { "address": "af3ceeaffa31dd88df5018f375a924333d00bf76", - "voteWeight": "14164000000000" + "validatorWeight": "14164000000000" }, { "address": "67a6cb487d741779e254f21ca9857419f2245371", - "voteWeight": "15401000000000" + "validatorWeight": "15401000000000" }, { "address": "a682d2abad902f269af7522e0f7a07e912d77ebe", - "voteWeight": "10118000000000" + "validatorWeight": "10118000000000" }, { "address": "057a0c2ba98c239c23f75d53ea893f9420066654", - "voteWeight": "6734000000000" + "validatorWeight": "6734000000000" }, { "address": "723e5725f350ac67921f98b88a94f1d2eefdec71", - "voteWeight": "6078000000000" + "validatorWeight": "6078000000000" }, { "address": "3d90d26438005deb02fad8a2569e483c0d939262", - "voteWeight": "17345000000000" + "validatorWeight": "17345000000000" }, { "address": "61dfdf80a2dde506b2c4bae53c23077eac77e459", - "voteWeight": "10251000000000" + "validatorWeight": "10251000000000" }, { "address": "0e8817d6207844598a9d9f867377e8e2d545e728", - "voteWeight": "14558000000000" + "validatorWeight": "14558000000000" }, { "address": "a50a1ea5491e3bb903562c30bb69451f022506c3", - "voteWeight": "5289000000000" + "validatorWeight": "5289000000000" }, { "address": "4849b8be378b8dec4541cb36382a4600e32a44e8", - "voteWeight": "3405000000000" + "validatorWeight": "3405000000000" }, { "address": "a410cf967ca1bef4a610be3b258f59949c86ffa8", - "voteWeight": "13233000000000" + "validatorWeight": "13233000000000" }, { "address": "bc457d99d6723e64bb0ffeb488c627c6e525a2a2", - "voteWeight": "10144000000000" + "validatorWeight": "10144000000000" }, { "address": "52c418d5e4c62f2599fb42a5c9fd1c88efdd1feb", - "voteWeight": "11148000000000" + "validatorWeight": "11148000000000" }, { "address": "2a3c956c07e82e0f9f21b635a9a3aef439a73305", - "voteWeight": "10934000000000" + "validatorWeight": "10934000000000" }, { "address": "272f126a5db1dc156f077f727ea5393b1ae86583", - "voteWeight": "463000000000" + "validatorWeight": "463000000000" }, { "address": "3130c94ac88871c80cba63f343c7efd39fe0c683", - "voteWeight": "9323000000000" + "validatorWeight": "9323000000000" }, { "address": "bbee7dde0e267750473b2941e485d491a1924685", - "voteWeight": "14944000000000" + "validatorWeight": "14944000000000" }, { "address": "80cbaf52a74a0fb1317429a04ed346d9fa5929d8", - "voteWeight": "15186000000000" + "validatorWeight": "15186000000000" }, { "address": "56915854c032bc16c204e573c70fc2bba62efc86", - "voteWeight": "1655000000000" + "validatorWeight": "1655000000000" }, { "address": "acb5152efe903aa2af7aaea5a2c516b44aceef70", - "voteWeight": "12075000000000" + "validatorWeight": "12075000000000" }, { "address": "bcca1186883ffea43adda6a96335e68b6a1e5423", - "voteWeight": "1275000000000" + "validatorWeight": "1275000000000" }, { "address": "3ea9743a62f37d47782bb5f2802d3e0787e70a8c", - "voteWeight": "16855000000000" + "validatorWeight": "16855000000000" }, { "address": "7271fccec796570a20aeaf43701e7ba5feca8555", - "voteWeight": "17897000000000" + "validatorWeight": "17897000000000" }, { "address": "574ef04a8587b794330b41607344fe696465d2b1", - "voteWeight": "8776000000000" + "validatorWeight": "8776000000000" }, { "address": "1bb86721d76b3a0fd336c7881a0a3ba3b53baded", - "voteWeight": "17001000000000" + "validatorWeight": "17001000000000" }, { "address": "619a684d3c96e7637da09253392c160bd7597c0e", - "voteWeight": "10657000000000" + "validatorWeight": "10657000000000" }, { "address": "170c93c5d5316a991e3cf38f75af60b2055f5c93", - "voteWeight": "11206000000000" + "validatorWeight": "11206000000000" }, { "address": "631d6eaa3aae6199c983d7dbfb2846e8d5f84956", - "voteWeight": "15427000000000" + "validatorWeight": "15427000000000" }, { "address": "91f84b4bae768a6ec26870e8904162b1b0fd3138", - "voteWeight": "10966000000000" + "validatorWeight": "10966000000000" }, { "address": "7653e0c81ce84fb8c8136811d4f4fb760948c168", - "voteWeight": "12567000000000" + "validatorWeight": "12567000000000" }, { "address": "e5dfefdf55b7cb29ac1561eb8fa65d4d15208806", - "voteWeight": "3197000000000" + "validatorWeight": "3197000000000" }, { "address": "de3703da8d1de29b609bf17d882f82581d84eea2", - "voteWeight": "13577000000000" + "validatorWeight": "13577000000000" }, { "address": "9dac147d34b48cdf72875d3b2f66931baf11e1e8", - "voteWeight": "5858000000000" + "validatorWeight": "5858000000000" }, { "address": "b5c9968fe4ddcc252ca96fde91a97b6a6b8f6395", - "voteWeight": "4103000000000" + "validatorWeight": "4103000000000" }, { "address": "1987ca1117960e0a6565d9e9291799810e97fd6f", - "voteWeight": "10621000000000" + "validatorWeight": "10621000000000" }, { "address": "8e4f78d9e7a68cacb7ea9d8c42284f56c373b64a", - "voteWeight": "14773000000000" + "validatorWeight": "14773000000000" }, { "address": "134496789490787deaf7a2e81ea7c0966afdee85", - "voteWeight": "787000000000" + "validatorWeight": "787000000000" }, { "address": "dc8cfaaf0be804a838bb1fa4b492b53efd8e3193", - "voteWeight": "15207000000000" + "validatorWeight": "15207000000000" }, { "address": "b607f69e8fab921137e582bbe928488ab3f73d69", - "voteWeight": "9412000000000" + "validatorWeight": "9412000000000" }, { "address": "ab3cf360ed7151faafeb24cda064c21e17987ad9", - "voteWeight": "14341000000000" + "validatorWeight": "14341000000000" }, { "address": "fe59fb6ecd21640c7d66654f64d88cade1bc4da4", - "voteWeight": "15513000000000" + "validatorWeight": "15513000000000" }, { "address": "a75d245452e15a6ce78b503cf4c33d0be1cf0e44", - "voteWeight": "3855000000000" + "validatorWeight": "3855000000000" }, { "address": "c6faed3348ed0d73424b7bef853cb7027ff23470", - "voteWeight": "15798000000000" + "validatorWeight": "15798000000000" }, { "address": "cf455b8e443ea22344cc8fe11d635c2fc1ed7bc3", - "voteWeight": "9454000000000" + "validatorWeight": "9454000000000" }, { "address": "2f06a14a7e4284606cc93ba399d268647c9b8d0b", - "voteWeight": "10397000000000" + "validatorWeight": "10397000000000" }, { "address": "0a448ef7167774b807b1e92ee532ba073425b2e0", - "voteWeight": "3021000000000" + "validatorWeight": "3021000000000" } ] }, diff --git a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_first_round.json b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_first_round.json similarity index 99% rename from protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_first_round.json rename to protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_first_round.json index e66eb82be5e..a881a89b486 100644 --- a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_first_round.json +++ b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_first_round.json @@ -4,8 +4,8 @@ "config": { "network": "devnet" }, - "runner": "dpos_random_seed_generation", - "handler": "dpos_random_seed_generation_first_round", + "runner": "pos_random_seed_generation", + "handler": "pos_random_seed_generation_first_round", "testCases": [ { "description": "Random seeds generation for first round", diff --git a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_invalid_seed_reveal.json b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_invalid_seed_reveal.json similarity index 99% rename from protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_invalid_seed_reveal.json rename to protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_invalid_seed_reveal.json index 76973475b06..636ec813cf2 100644 --- a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_invalid_seed_reveal.json +++ b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_invalid_seed_reveal.json @@ -1,14 +1,14 @@ { "title": "Random seed for invalid pre image", - "summary": "Random seeds generation for the case when a delegate have invalid pre-image for seed reveal", + "summary": "Random seeds generation for the case when a validator have invalid pre-image for seed reveal", "config": { "network": "devnet" }, - "runner": "dpos_random_seed_generation", - "handler": "dpos_random_seed_generation_invalid_seed_reveal", + "runner": "pos_random_seed_generation", + "handler": "pos_random_seed_generation_invalid_seed_reveal", "testCases": [ { - "description": "Random seeds generation for the case when a delegate have invalid pre-image for seed reveal", + "description": "Random seeds generation for the case when a validator have invalid pre-image for seed reveal", "config": { "blocksPerRound": 103 }, diff --git a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_forged_earlier.json b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_forged_earlier.json similarity index 99% rename from protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_forged_earlier.json rename to protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_forged_earlier.json index f128f1c1c81..21799168a37 100644 --- a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_forged_earlier.json +++ b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_forged_earlier.json @@ -1,14 +1,14 @@ { "title": "Random seed for not forged earlier", - "summary": "Random seeds generation for the case when delegate did not forged earlier", + "summary": "Random seeds generation for the case when validator did not forged earlier", "config": { "network": "devnet" }, - "runner": "dpos_random_seed_generation", - "handler": "dpos_random_seed_generation_not_forged_earlier", + "runner": "pos_random_seed_generation", + "handler": "pos_random_seed_generation_not_forged_earlier", "testCases": [ { - "description": "Random seeds generation for the case when delegate did not forged earlier", + "description": "Random seeds generation for the case when validator did not forged earlier", "config": { "blocksPerRound": 103 }, diff --git a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_passed_middle_of_round.json b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_passed_middle_of_round.json similarity index 99% rename from protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_passed_middle_of_round.json rename to protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_passed_middle_of_round.json index 0df7dae4094..b2a1195e86a 100644 --- a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_not_passed_middle_of_round.json +++ b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_not_passed_middle_of_round.json @@ -4,8 +4,8 @@ "config": { "network": "devnet" }, - "runner": "dpos_random_seed_generation", - "handler": "dpos_random_seed_generation_not_passed_middle_of_round", + "runner": "pos_random_seed_generation", + "handler": "pos_random_seed_generation_not_passed_middle_of_round", "testCases": [ { "description": "Random seed for round not passed the middle of the round", diff --git a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_other_rounds.json b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_other_rounds.json similarity index 99% rename from protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_other_rounds.json rename to protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_other_rounds.json index d8baefe2d61..77a80f49e39 100644 --- a/protocol-specs/generator_outputs/dpos_random_seed_generation/dpos_random_seed_generation_other_rounds.json +++ b/protocol-specs/generator_outputs/dpos_random_seed_generation/pos_random_seed_generation_other_rounds.json @@ -4,8 +4,8 @@ "config": { "network": "devnet" }, - "runner": "dpos_random_seed_generation", - "handler": "dpos_random_seed_generation_other_rounds", + "runner": "pos_random_seed_generation", + "handler": "pos_random_seed_generation_other_rounds", "testCases": [ { "description": "Random seeds generation for two rounds", diff --git a/protocol-specs/generator_outputs/lisk_codec/account_decodings.json b/protocol-specs/generator_outputs/lisk_codec/account_decodings.json index 7cd16633148..975e763e416 100644 --- a/protocol-specs/generator_outputs/lisk_codec/account_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/account_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "0a14e11a11364738225813f86ea85214400e5db08d6e100a1a200fd3c50a6d3bd17ea806c0566cf6cf10f6e3697d9bda1820b00cb14746bcccef20052a4608021220c8b8fbe474a2b63ccb9744a409569b0a465ee1803f80435aec1c5e7fc2d4ee1812206115424fec0ce9c3bac5a81b5c782827d1f956fb95f1ccfa36c566d04e4d72673299010a180a07436174756c6c6f1201551820204028003080c6868f0112270a20cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e41080c2d72f12270a209d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c61080e59a771a2b0a20655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5108088debe01188001", "schema": { - "$id": "accountSchema", + "$id": "/accountSchema", "type": "object", "properties": { "address": { @@ -60,7 +60,7 @@ "type": "object", "fieldNumber": 6, "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -87,7 +87,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -98,16 +98,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -116,7 +116,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -125,7 +125,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -133,12 +133,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } @@ -162,29 +162,29 @@ "optionalKeys": [] }, "asset": { - "delegate": { + "validator": { "username": "Catullo", "pomHeights": [85], "consecutiveMissedBlocks": 32, "lastForgedHeight": 64, "isBanned": false, - "totalVotesReceived": "300000000" + "totalStakeReceived": "300000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4", + "validatorAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4", "amount": "100000000" }, { - "delegateAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6", + "validatorAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6", "amount": "250000000" } ], "unlocking": [ { - "delegateAddress": "655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5", + "validatorAddress": "655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5", "amount": "400000000", - "unvoteHeight": 128 + "unstakeHeight": 128 } ] } @@ -196,7 +196,7 @@ "input": { "value": "0a14cd32c73e9851c7137980063b8af64aa5a31651f810001a0020002a020800320c0a0a0a001800200028003000", "schema": { - "$id": "accountSchema", + "$id": "/accountSchema", "type": "object", "properties": { "address": { @@ -244,7 +244,7 @@ "type": "object", "fieldNumber": 6, "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -271,7 +271,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -282,16 +282,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -300,7 +300,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -309,7 +309,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -317,12 +317,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } @@ -343,15 +343,15 @@ "optionalKeys": [] }, "asset": { - "delegate": { + "validator": { "username": "", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "0" + "totalStakeReceived": "0" }, - "sentVotes": [], + "sentStakes": [], "unlocking": [] } } diff --git a/protocol-specs/generator_outputs/lisk_codec/account_encodings.json b/protocol-specs/generator_outputs/lisk_codec/account_encodings.json index ecac37159eb..a366004048b 100644 --- a/protocol-specs/generator_outputs/lisk_codec/account_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/account_encodings.json @@ -24,35 +24,35 @@ "optionalKeys": [] }, "asset": { - "delegate": { + "validator": { "username": "Catullo", "pomHeights": [85], "consecutiveMissedBlocks": 32, "lastForgedHeight": 64, "isBanned": false, - "totalVotesReceived": "300000000" + "totalStakeReceived": "300000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4", + "validatorAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4", "amount": "100000000" }, { - "delegateAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6", + "validatorAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6", "amount": "250000000" } ], "unlocking": [ { - "delegateAddress": "655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5", + "validatorAddress": "655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5", "amount": "400000000", - "unvoteHeight": 128 + "unstakeHeight": 128 } ] } }, "schema": { - "$id": "accountSchema", + "$id": "/accountSchema", "type": "object", "properties": { "address": { @@ -100,7 +100,7 @@ "type": "object", "fieldNumber": 6, "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -127,7 +127,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -138,16 +138,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -156,7 +156,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -165,7 +165,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -173,12 +173,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } @@ -205,20 +205,20 @@ "optionalKeys": [] }, "asset": { - "delegate": { + "validator": { "username": "", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "0" + "totalStakeReceived": "0" }, - "sentVotes": [], + "sentStakes": [], "unlocking": [] } }, "schema": { - "$id": "accountSchema", + "$id": "/accountSchema", "type": "object", "properties": { "address": { @@ -266,7 +266,7 @@ "type": "object", "fieldNumber": 6, "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -293,7 +293,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -304,16 +304,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -322,7 +322,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -331,7 +331,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -339,12 +339,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } diff --git a/protocol-specs/generator_outputs/lisk_codec/arrays_decodings.json b/protocol-specs/generator_outputs/lisk_codec/arrays_decodings.json index dbf2ad97b3a..43abdbfbff5 100644 --- a/protocol-specs/generator_outputs/lisk_codec/arrays_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/arrays_decodings.json @@ -13,7 +13,7 @@ "value": "0a09030104010509020605", "schema": { "type": "object", - "$id": "array-schema-uint32", + "$id": "/arraySchemaUint32", "properties": { "list": { "type": "array", @@ -37,7 +37,7 @@ "value": "0a06010100010000", "schema": { "type": "object", - "$id": "array-schema-boolean", + "$id": "/arraySchemaBoolean", "properties": { "list": { "type": "array", @@ -61,7 +61,7 @@ "value": "0a046c69736b0a000a07676f676f676f67", "schema": { "type": "object", - "$id": "array-schema-string", + "$id": "/arraySchemaString", "properties": { "list": { "type": "array", @@ -85,7 +85,7 @@ "value": "0a2e0a286531316131313336343733383232353831336638366561383532313434303065356462303864366510a08d060a2e0a286161326131313336343733383232353831336638366561383532313434303065356462303866666610e0a712", "schema": { "type": "object", - "$id": "array-schema-object", + "$id": "/arraySchemaObject", "properties": { "list": { "type": "array", @@ -128,7 +128,7 @@ "value": "", "schema": { "type": "object", - "$id": "array-schema-uint32", + "$id": "/arraySchemaUint32", "properties": { "list": { "type": "array", diff --git a/protocol-specs/generator_outputs/lisk_codec/arrays_encodings.json b/protocol-specs/generator_outputs/lisk_codec/arrays_encodings.json index 2fe123a565b..600f27bb1a3 100644 --- a/protocol-specs/generator_outputs/lisk_codec/arrays_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/arrays_encodings.json @@ -15,7 +15,7 @@ }, "schema": { "type": "object", - "$id": "array-schema-uint32", + "$id": "/arraySchemaUint32", "properties": { "list": { "type": "array", @@ -39,7 +39,7 @@ }, "schema": { "type": "object", - "$id": "array-schema-boolean", + "$id": "/arraySchemaBoolean", "properties": { "list": { "type": "array", @@ -63,7 +63,7 @@ }, "schema": { "type": "object", - "$id": "array-schema-string", + "$id": "/arraySchemaString", "properties": { "list": { "type": "array", @@ -96,7 +96,7 @@ }, "schema": { "type": "object", - "$id": "array-schema-object", + "$id": "/arraySchemaObject", "properties": { "list": { "type": "array", @@ -130,7 +130,7 @@ }, "schema": { "type": "object", - "$id": "array-schema-uint32", + "$id": "/arraySchemaUint32", "properties": { "list": { "type": "array", diff --git a/protocol-specs/generator_outputs/lisk_codec/block_asset_decodings.json b/protocol-specs/generator_outputs/lisk_codec/block_asset_decodings.json index a183bf98608..83736608ae3 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_asset_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_asset_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "08990810b9ff361a10d59386e0ae435e292fbe0ebcdb954b75", "schema": { - "$id": "blockAssetSchema", + "$id": "/blockAssetSchema", "type": "object", "properties": { "maxHeightPreviouslyForged": { @@ -44,7 +44,7 @@ "input": { "value": "08001099081a10eaaf9d4c65cb501c811ef812847a5551", "schema": { - "$id": "blockAssetSchema", + "$id": "/blockAssetSchema", "type": "object", "properties": { "maxHeightPreviouslyForged": { diff --git a/protocol-specs/generator_outputs/lisk_codec/block_asset_encodings.json b/protocol-specs/generator_outputs/lisk_codec/block_asset_encodings.json index b8e766a425b..95452b55d45 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_asset_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_asset_encodings.json @@ -16,7 +16,7 @@ "seedReveal": "d59386e0ae435e292fbe0ebcdb954b75" }, "schema": { - "$id": "blockAssetSchema", + "$id": "/blockAssetSchema", "type": "object", "properties": { "maxHeightPreviouslyForged": { @@ -48,7 +48,7 @@ "seedReveal": "eaaf9d4c65cb501c811ef812847a5551" }, "schema": { - "$id": "blockAssetSchema", + "$id": "/blockAssetSchema", "type": "object", "properties": { "maxHeightPreviouslyForged": { diff --git a/protocol-specs/generator_outputs/lisk_codec/block_decodings.json b/protocol-specs/generator_outputs/lisk_codec/block_decodings.json index 69a2abd046f..4a4fd45fd05 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_decodings.json @@ -8,18 +8,18 @@ "handler": "block_decodings", "testCases": [ { - "description": "Decoding of valid block with transactions", + "description": "Decoding of valid block with payload", "input": { "value": "0a20ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad1220a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3122068a751863fe73b8ede8d832be628ff680d617fa15c74d00142f9025d5f37dd50", "schema": { - "$id": "blockSchema", + "$id": "/blockSchema", "type": "object", "properties": { "header": { "dataType": "bytes", "fieldNumber": 1 }, - "transactions": { + "payload": { "type": "array", "items": { "dataType": "bytes" @@ -27,13 +27,13 @@ "fieldNumber": 2 } }, - "required": ["header", "transactions"] + "required": ["header", "payload"] } }, "output": { "object": { "header": "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", - "transactions": [ + "payload": [ "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3", "68a751863fe73b8ede8d832be628ff680d617fa15c74d00142f9025d5f37dd50" ] @@ -41,18 +41,18 @@ } }, { - "description": "Decoding of valid block block without transactions", + "description": "Decoding of valid block block without payload", "input": { "value": "0a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "schema": { - "$id": "blockSchema", + "$id": "/blockSchema", "type": "object", "properties": { "header": { "dataType": "bytes", "fieldNumber": 1 }, - "transactions": { + "payload": { "type": "array", "items": { "dataType": "bytes" @@ -60,13 +60,13 @@ "fieldNumber": 2 } }, - "required": ["header", "transactions"] + "required": ["header", "payload"] } }, "output": { "object": { "header": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "transactions": [] + "payload": [] } } } diff --git a/protocol-specs/generator_outputs/lisk_codec/block_encodings.json b/protocol-specs/generator_outputs/lisk_codec/block_encodings.json index 798f3e58ac4..573d9e31368 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_encodings.json @@ -8,24 +8,24 @@ "handler": "block_encodings", "testCases": [ { - "description": "Encoding of valid block with transactions", + "description": "Encoding of valid block with payload", "input": { "object": { "header": "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", - "transactions": [ + "payload": [ "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3", "68a751863fe73b8ede8d832be628ff680d617fa15c74d00142f9025d5f37dd50" ] }, "schema": { - "$id": "blockSchema", + "$id": "/blockSchema", "type": "object", "properties": { "header": { "dataType": "bytes", "fieldNumber": 1 }, - "transactions": { + "payload": { "type": "array", "items": { "dataType": "bytes" @@ -33,7 +33,7 @@ "fieldNumber": 2 } }, - "required": ["header", "transactions"] + "required": ["header", "payload"] } }, "output": { @@ -41,21 +41,21 @@ } }, { - "description": "Encoding of valid block block without transactions", + "description": "Encoding of valid block block without payload", "input": { "object": { "header": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "transactions": [] + "payload": [] }, "schema": { - "$id": "blockSchema", + "$id": "/blockSchema", "type": "object", "properties": { "header": { "dataType": "bytes", "fieldNumber": 1 }, - "transactions": { + "payload": { "type": "array", "items": { "dataType": "bytes" @@ -63,7 +63,7 @@ "fieldNumber": 2 } }, - "required": ["header", "transactions"] + "required": ["header", "payload"] } }, "output": { diff --git a/protocol-specs/generator_outputs/lisk_codec/block_header_decodings.json b/protocol-specs/generator_outputs/lisk_codec/block_header_decodings.json index 7ddedd3018a..4005ce8811a 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_header_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_header_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "08011085f6b7f60518c3faf3052220ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad2a20a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3322068a751863fe73b8ede8d832be628ff680d617fa15c74d00142f9025d5f37dd50388088debe014220d59386e0ae435e292fbe0ebcdb954b75ed5fb3922091277cb19f798fc5d507184a408331b5123cac056e2ec8361c56e642db0ca0e13abe33696d23d4d00ad6de844919296e87abe8e172f67fd882b4c0b1c1804b7d9075ecf975cf2631d8d7efef0c", "schema": { - "$id": "blockHeaderSchema", + "$id": "/blockHeaderSchema", "type": "object", "properties": { "version": { @@ -83,7 +83,7 @@ "input": { "value": "080310ecf8b7f60518b9ff362220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b8552a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b8553220acc56344dea609e80cf5d4165e46917104fe701927847fc2a5d40e37574b2b38388088debe014220eaaf9d4c65cb501c811ef812847a55513181474d734ead1b95b7e1e5b574d2234a401e65032943af975c3cdef94b1fce639645bddb29265321e0277a0f48143ef7f6f6daa1046234a09cc593969ff04d8d082edd15a4a9b90a7b8865fcd9dac44300", "schema": { - "$id": "blockHeaderSchema", + "$id": "/blockHeaderSchema", "type": "object", "properties": { "version": { diff --git a/protocol-specs/generator_outputs/lisk_codec/block_header_encodings.json b/protocol-specs/generator_outputs/lisk_codec/block_header_encodings.json index 0ab2d62341e..c9a6f4ff004 100644 --- a/protocol-specs/generator_outputs/lisk_codec/block_header_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/block_header_encodings.json @@ -22,7 +22,7 @@ "signature": "8331b5123cac056e2ec8361c56e642db0ca0e13abe33696d23d4d00ad6de844919296e87abe8e172f67fd882b4c0b1c1804b7d9075ecf975cf2631d8d7efef0c" }, "schema": { - "$id": "blockHeaderSchema", + "$id": "/blockHeaderSchema", "type": "object", "properties": { "version": { @@ -93,7 +93,7 @@ "signature": "1e65032943af975c3cdef94b1fce639645bddb29265321e0277a0f48143ef7f6f6daa1046234a09cc593969ff04d8d082edd15a4a9b90a7b8865fcd9dac44300" }, "schema": { - "$id": "blockHeaderSchema", + "$id": "/blockHeaderSchema", "type": "object", "properties": { "version": { diff --git a/protocol-specs/generator_outputs/lisk_codec/boolean_decodings.json b/protocol-specs/generator_outputs/lisk_codec/boolean_decodings.json index 63978441a2d..7b2a9098691 100644 --- a/protocol-specs/generator_outputs/lisk_codec/boolean_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/boolean_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "0801", "schema": { - "$id": "object5", + "$id": "/object5", "type": "object", "properties": { "state": { @@ -33,7 +33,7 @@ "input": { "value": "0800", "schema": { - "$id": "object5", + "$id": "/object5", "type": "object", "properties": { "state": { diff --git a/protocol-specs/generator_outputs/lisk_codec/boolean_encodings.json b/protocol-specs/generator_outputs/lisk_codec/boolean_encodings.json index c1e5a1c7f42..2de18d3c8d3 100644 --- a/protocol-specs/generator_outputs/lisk_codec/boolean_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/boolean_encodings.json @@ -14,7 +14,7 @@ "state": true }, "schema": { - "$id": "object5", + "$id": "/object5", "type": "object", "properties": { "state": { @@ -35,7 +35,7 @@ "state": false }, "schema": { - "$id": "object5", + "$id": "/object5", "type": "object", "properties": { "state": { diff --git a/protocol-specs/generator_outputs/lisk_codec/bytes_decodings.json b/protocol-specs/generator_outputs/lisk_codec/bytes_decodings.json index f0a2497257f..de55d55afd4 100644 --- a/protocol-specs/generator_outputs/lisk_codec/bytes_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/bytes_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "0a14e11a11364738225813f86ea85214400e5db08d6e", "schema": { - "$id": "object9", + "$id": "/object9", "type": "object", "properties": { "address": { @@ -33,7 +33,7 @@ "input": { "value": "0a00", "schema": { - "$id": "object9", + "$id": "/object9", "type": "object", "properties": { "address": { diff --git a/protocol-specs/generator_outputs/lisk_codec/bytes_encodings.json b/protocol-specs/generator_outputs/lisk_codec/bytes_encodings.json index 3b3a9b30212..29c763c4e74 100644 --- a/protocol-specs/generator_outputs/lisk_codec/bytes_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/bytes_encodings.json @@ -14,7 +14,7 @@ "address": "e11a11364738225813f86ea85214400e5db08d6e" }, "schema": { - "$id": "object9", + "$id": "/object9", "type": "object", "properties": { "address": { @@ -35,7 +35,7 @@ "address": "" }, "schema": { - "$id": "object9", + "$id": "/object9", "type": "object", "properties": { "address": { diff --git a/protocol-specs/generator_outputs/lisk_codec/cart_sample_decodings.json b/protocol-specs/generator_outputs/lisk_codec/cart_sample_decodings.json index 03a7e1c447a..8dcfbbca5f6 100644 --- a/protocol-specs/generator_outputs/lisk_codec/cart_sample_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/cart_sample_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "08d2091080acb8f6051864221c089edbb10210d7041801221008d70410061a09537461746520546178221c089eeda50410bf0c1801221008bf0c10071a09537461746520546178", "schema": { - "$id": "cart_sample", + "$id": "/cartSample", "type": "object", "properties": { "orderId": { diff --git a/protocol-specs/generator_outputs/lisk_codec/cart_sample_encodings.json b/protocol-specs/generator_outputs/lisk_codec/cart_sample_encodings.json index 2ad62bc650b..01e3c700e1c 100644 --- a/protocol-specs/generator_outputs/lisk_codec/cart_sample_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/cart_sample_encodings.json @@ -42,7 +42,7 @@ ] }, "schema": { - "$id": "cart_sample", + "$id": "/cartSample", "type": "object", "properties": { "orderId": { diff --git a/protocol-specs/generator_outputs/lisk_codec/genesis_block_decodings.json b/protocol-specs/generator_outputs/lisk_codec/genesis_block_decodings.json index 6ce34c9b42d..bbe1cd13e1b 100644 --- a/protocol-specs/generator_outputs/lisk_codec/genesis_block_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/genesis_block_decodings.json @@ -12,9 +12,9 @@ "input": { "value": "0a7c0a1403f6d90b7dbd0497dc3a52d1c27e23bb8c75897f10001a20fc65777c1d4c00f1af5880c23ba7f60cd3bf84d1bf5c697abc4ffe17cf7acac020002a020800323a0a190a0a67656e657369735f33341800200028003080a094a58d1d121d0a1403f6d90b7dbd0497dc3a52d1c27e23bb8c75897f1080a094a58d1d0a5d0a140903f4c5cb599a7928aef27e314e98291d1e388810001a203f571324e9dc7b2481b71a7dc56637f1234504158986a242e90c33d8d20fdd9220002a020800321b0a190a0a67656e657369735f37341800200028003080a094a58d1d0a7c0a140ada6a2f6c8f891769366fc9aa6fd9f1facb36cf10001a20c69698ef30012964aafacfbe637bb63854b6109cc5c5f22aa4b3dc3e8dca821720002a020800323a0a190a0a67656e657369735f39381800200028003080a094a58d1d121d0a140ada6a2f6c8f891769366fc9aa6fd9f1facb36cf1080a094a58d1d121403f6d90b7dbd0497dc3a52d1c27e23bb8c75897f12140903f4c5cb599a7928aef27e314e98291d1e388812140ada6a2f6c8f891769366fc9aa6fd9f1facb36cf1803", "schema": { - "$id": "genesisBlockAssetSchema", + "$id": "/genesisBlockAssetSchema", "type": "object", - "required": ["accounts", "initDelegates", "initRounds"], + "required": ["accounts", "initValidators", "initRounds"], "properties": { "accounts": { "type": "array", @@ -66,7 +66,7 @@ "fieldNumber": 6, "type": "object", "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -93,7 +93,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -104,16 +104,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -122,7 +122,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -131,7 +131,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -139,12 +139,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } @@ -154,7 +154,7 @@ }, "fieldNumber": 1 }, - "initDelegates": { + "initValidators": { "type": "array", "items": { "dataType": "bytes" @@ -171,7 +171,7 @@ }, "output": { "object": { - "initDelegates": [ + "initValidators": [ "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "0903f4c5cb599a7928aef27e314e98291d1e3888", "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf" @@ -189,17 +189,17 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_34", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", + "validatorAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "amount": "1000000000000" } ], @@ -217,15 +217,15 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_74", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [], + "sentStakes": [], "unlocking": [] } }, @@ -240,17 +240,17 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_98", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", + "validatorAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", "amount": "1000000000000" } ], diff --git a/protocol-specs/generator_outputs/lisk_codec/genesis_block_encodings.json b/protocol-specs/generator_outputs/lisk_codec/genesis_block_encodings.json index 9d88ca458c7..15894080280 100644 --- a/protocol-specs/generator_outputs/lisk_codec/genesis_block_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/genesis_block_encodings.json @@ -11,7 +11,7 @@ "description": "Encoding of valid genesis block asset", "input": { "object": { - "initDelegates": [ + "initValidators": [ "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "0903f4c5cb599a7928aef27e314e98291d1e3888", "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf" @@ -29,17 +29,17 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_34", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", + "validatorAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "amount": "1000000000000" } ], @@ -57,15 +57,15 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_74", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [], + "sentStakes": [], "unlocking": [] } }, @@ -80,17 +80,17 @@ "numberOfSignatures": 0 }, "asset": { - "delegate": { + "validator": { "username": "genesis_98", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", + "validatorAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", "amount": "1000000000000" } ], @@ -100,9 +100,9 @@ ] }, "schema": { - "$id": "genesisBlockAssetSchema", + "$id": "/genesisBlockAssetSchema", "type": "object", - "required": ["accounts", "initDelegates", "initRounds"], + "required": ["accounts", "initValidators", "initRounds"], "properties": { "accounts": { "type": "array", @@ -154,7 +154,7 @@ "fieldNumber": 6, "type": "object", "properties": { - "delegate": { + "validator": { "type": "object", "fieldNumber": 1, "properties": { @@ -181,7 +181,7 @@ "dataType": "boolean", "fieldNumber": 5 }, - "totalVotesReceived": { + "totalStakeReceived": { "dataType": "uint64", "fieldNumber": 6 } @@ -192,16 +192,16 @@ "consecutiveMissedBlocks", "lastForgedHeight", "isBanned", - "totalVotesReceived" + "totalStakeReceived" ] }, - "sentVotes": { + "sentStakes": { "type": "array", "fieldNumber": 2, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -210,7 +210,7 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } }, "unlocking": { @@ -219,7 +219,7 @@ "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -227,12 +227,12 @@ "dataType": "uint64", "fieldNumber": 2 }, - "unvoteHeight": { + "unstakeHeight": { "dataType": "uint32", "fieldNumber": 3 } }, - "required": ["delegateAddress", "amount", "unvoteHeight"] + "required": ["validatorAddress", "amount", "unstakeHeight"] } } } @@ -242,7 +242,7 @@ }, "fieldNumber": 1 }, - "initDelegates": { + "initValidators": { "type": "array", "items": { "dataType": "bytes" diff --git a/protocol-specs/generator_outputs/lisk_codec/nested_array_decodings.json b/protocol-specs/generator_outputs/lisk_codec/nested_array_decodings.json index fb7d08d2071..37b0da78b37 100644 --- a/protocol-specs/generator_outputs/lisk_codec/nested_array_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/nested_array_decodings.json @@ -10,7 +10,7 @@ { "description": "Decoding of nested array object sample", "input": { - "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd02120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674", + "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd021210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674", "schema": { "$id": "/state/diff", "type": "object", @@ -73,16 +73,16 @@ ] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] } } }, { "description": "Decoding of nested array string sample", "input": { - "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a363961366261313966353836303563366664323630623939303961353130383532336462383412056469666635120564696666361205646966663712056469666635120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674", + "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a3639613662613139663538363035633666643236306239393039613531303835323364623834120564696666351205646966663612056469666637120564696666351210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674", "schema": { - "$id": "/state/diff-string", + "$id": "/state/diffString", "type": "object", "required": ["updated", "created"], "properties": { @@ -128,7 +128,7 @@ "value": ["diff5", "diff6", "diff7", "diff5"] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] } } } diff --git a/protocol-specs/generator_outputs/lisk_codec/nested_array_encoding.json b/protocol-specs/generator_outputs/lisk_codec/nested_array_encoding.json index c0d3a8982df..fab441223d9 100644 --- a/protocol-specs/generator_outputs/lisk_codec/nested_array_encoding.json +++ b/protocol-specs/generator_outputs/lisk_codec/nested_array_encoding.json @@ -26,7 +26,7 @@ ] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] }, "schema": { "$id": "/state/diff", @@ -74,7 +74,7 @@ } }, "output": { - "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd02120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674" + "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd021210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674" } }, { @@ -91,7 +91,7 @@ "value": ["diff5", "diff6", "diff7", "diff5"] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] }, "schema": { "$id": "/state/diff-string", @@ -129,7 +129,7 @@ } }, "output": { - "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a363961366261313966353836303563366664323630623939303961353130383532336462383412056469666635120564696666361205646966663712056469666635120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674" + "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a3639613662613139663538363035633666643236306239393039613531303835323364623834120564696666351205646966663612056469666637120564696666351210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674" } } ] diff --git a/protocol-specs/generator_outputs/lisk_codec/nested_array_encodings.json b/protocol-specs/generator_outputs/lisk_codec/nested_array_encodings.json index 70b03cec3a7..a8a4db4b936 100644 --- a/protocol-specs/generator_outputs/lisk_codec/nested_array_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/nested_array_encodings.json @@ -26,7 +26,7 @@ ] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] }, "schema": { "$id": "/state/diff", @@ -74,7 +74,7 @@ } }, "output": { - "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd02120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674" + "value": "0a4a0a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112050a013d100112060a012b10cd021210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674" } }, { @@ -91,10 +91,10 @@ "value": ["diff5", "diff6", "diff7", "diff5"] } ], - "created": ["chain:delegates", "consensus:bft"] + "created": ["chain:validators", "consensus:bft"] }, "schema": { - "$id": "/state/diff-string", + "$id": "/state/diffString", "type": "object", "required": ["updated", "created"], "properties": { @@ -129,7 +129,7 @@ } }, "output": { - "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a363961366261313966353836303563366664323630623939303961353130383532336462383412056469666635120564696666361205646966663712056469666635120f636861696e3a64656c656761746573120d636f6e73656e7375733a626674" + "value": "0a490a396163636f756e74733a616464726573733a6164343266386538363764363138313731626634393832653634323639343432313438663665313112056469666631120564696666320a550a376163636f756e74733a616464726573733a3639613662613139663538363035633666643236306239393039613531303835323364623834120564696666351205646966663612056469666637120564696666351210636861696e3a76616c696461746f7273120d636f6e73656e7375733a626674" } } ] diff --git a/protocol-specs/generator_outputs/lisk_codec/number_decodings.json b/protocol-specs/generator_outputs/lisk_codec/number_decodings.json index 4a4ea8c8924..233f30a50dc 100644 --- a/protocol-specs/generator_outputs/lisk_codec/number_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/number_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "080a", "schema": { - "$id": "number-schema-uint32", + "$id": "/numberSchemaUint32", "type": "object", "properties": { "number": { @@ -33,7 +33,7 @@ "input": { "value": "0813", "schema": { - "$id": "number-schema-sint32", + "$id": "/numberSchemaSint32", "type": "object", "properties": { "number": { @@ -54,7 +54,7 @@ "input": { "value": "08ffffc9a4d9cb54", "schema": { - "$id": "number-schema-uint64", + "$id": "/numberSchemaUint64", "type": "object", "properties": { "number": { @@ -75,7 +75,7 @@ "input": { "value": "08fdffffffffffff1f", "schema": { - "$id": "number-schema-sint64", + "$id": "/numberSchemaSint64", "type": "object", "properties": { "number": { diff --git a/protocol-specs/generator_outputs/lisk_codec/number_encodings.json b/protocol-specs/generator_outputs/lisk_codec/number_encodings.json index c9b6e9e9a27..828439ce16a 100644 --- a/protocol-specs/generator_outputs/lisk_codec/number_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/number_encodings.json @@ -14,7 +14,7 @@ "number": 10 }, "schema": { - "$id": "number-schema-uint32", + "$id": "/numberSchemaUint32", "type": "object", "properties": { "number": { @@ -35,7 +35,7 @@ "number": -10 }, "schema": { - "$id": "number-schema-sint32", + "$id": "/numberSchemaSint32", "type": "object", "properties": { "number": { @@ -56,7 +56,7 @@ "number": "372036854775807" }, "schema": { - "$id": "number-schema-uint64", + "$id": "/numberSchemaUint64", "type": "object", "properties": { "number": { @@ -77,7 +77,7 @@ "number": "-9007199254740991" }, "schema": { - "$id": "number-schema-sint64", + "$id": "/numberSchemaSint64", "type": "object", "properties": { "number": { diff --git a/protocol-specs/generator_outputs/lisk_codec/objects_decodings.json b/protocol-specs/generator_outputs/lisk_codec/objects_decodings.json index ce32c68bdac..aa331aed7dd 100644 --- a/protocol-specs/generator_outputs/lisk_codec/objects_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/objects_decodings.json @@ -10,9 +10,9 @@ { "description": "Decoding of object", "input": { - "value": "0a14e11a11364738225813f86ea85214400e5db08d6e1080ade2041801220864656c65676174652a2d0a25436865636b206f757420746865204c69736b2053444b206e6f7720696e2062696e61727921120408091009", + "value": "0a14e11a11364738225813f86ea85214400e5db08d6e1080ade2041801220976616c696461746f722a2d0a25436865636b206f757420746865204c69736b2053444b206e6f7720696e2062696e61727921120408091009", "schema": { - "$id": "object11", + "$id": "/object11", "type": "object", "properties": { "address": { @@ -23,7 +23,7 @@ "dataType": "uint64", "fieldNumber": 2 }, - "isDelegate": { + "isValidator": { "dataType": "boolean", "fieldNumber": 3 }, @@ -62,8 +62,8 @@ "object": { "address": "e11a11364738225813f86ea85214400e5db08d6e", "balance": "10000000", - "isDelegate": true, - "name": "delegate", + "isValidator": true, + "name": "validator", "asset": { "data": "Check out the Lisk SDK now in binary!", "fooBar": { @@ -79,7 +79,7 @@ "input": { "value": "08011801", "schema": { - "$id": "object12", + "$id": "/object12", "type": "object", "properties": { "isActive": { diff --git a/protocol-specs/generator_outputs/lisk_codec/objects_encodings.json b/protocol-specs/generator_outputs/lisk_codec/objects_encodings.json index 292e51ba6cf..b84b0f7a6ac 100644 --- a/protocol-specs/generator_outputs/lisk_codec/objects_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/objects_encodings.json @@ -13,8 +13,8 @@ "object": { "address": "e11a11364738225813f86ea85214400e5db08d6e", "balance": "10000000", - "isDelegate": true, - "name": "delegate", + "isValidator": true, + "name": "validator", "asset": { "data": "Check out the Lisk SDK now in binary!", "fooBar": { @@ -24,7 +24,7 @@ } }, "schema": { - "$id": "object11", + "$id": "/object11", "type": "object", "properties": { "address": { @@ -35,7 +35,7 @@ "dataType": "uint64", "fieldNumber": 2 }, - "isDelegate": { + "isValidator": { "dataType": "boolean", "fieldNumber": 3 }, @@ -71,7 +71,7 @@ } }, "output": { - "value": "0a14e11a11364738225813f86ea85214400e5db08d6e1080ade2041801220864656c65676174652a2d0a25436865636b206f757420746865204c69736b2053444b206e6f7720696e2062696e61727921120408091009" + "value": "0a14e11a11364738225813f86ea85214400e5db08d6e1080ade2041801220976616c696461746f722a2d0a25436865636b206f757420746865204c69736b2053444b206e6f7720696e2062696e61727921120408091009" } }, { @@ -82,7 +82,7 @@ "value": "1" }, "schema": { - "$id": "object12", + "$id": "/object12", "type": "object", "properties": { "isActive": { diff --git a/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_decodings.json b/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_decodings.json index 543d4859e23..69642a1b813 100644 --- a/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_decodings.json @@ -10,9 +10,9 @@ { "description": "Decoding of peer info sample", "input": { - "value": "0a07312e312e312e3110d7081a40663866653765636333653239663538663339643861353338663961333562383062346236616239363734663033303065323565333366663431323734616533322203322e302a11694e496744304d6233732f524d61586273320664617277696e387b", + "value": "0a07312e312e312e3110d7081a0831303030303030302203322e302a11694e496744304d6233732f524d61586273320664617277696e387b", "schema": { - "$id": "peerInfo", + "$id": "/peerInfo", "type": "object", "properties": { "ipAddress": { @@ -23,7 +23,7 @@ "dataType": "uint32", "fieldNumber": 2 }, - "networkIdentifier": { + "chainID": { "dataType": "string", "fieldNumber": 3 }, @@ -51,7 +51,7 @@ "object": { "ipAddress": "1.1.1.1", "wsPort": 1111, - "networkIdentifier": "f8fe7ecc3e29f58f39d8a538f9a35b80b4b6ab9674f0300e25e33ff41274ae32", + "chainID": "10000000", "networkVersion": "2.0", "nonce": "iNIgD0Mb3s/RMaXbs", "os": "darwin", diff --git a/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_encodings.json b/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_encodings.json index f02768e711f..721861e409a 100644 --- a/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/peer_info_sample_encodings.json @@ -13,14 +13,14 @@ "object": { "ipAddress": "1.1.1.1", "wsPort": 1111, - "networkIdentifier": "f8fe7ecc3e29f58f39d8a538f9a35b80b4b6ab9674f0300e25e33ff41274ae32", + "chainID": "10000000", "networkVersion": "2.0", "nonce": "iNIgD0Mb3s/RMaXbs", "os": "darwin", "height": 123 }, "schema": { - "$id": "peerInfo", + "$id": "/peerInfo", "type": "object", "properties": { "ipAddress": { @@ -31,7 +31,7 @@ "dataType": "uint32", "fieldNumber": 2 }, - "networkIdentifier": { + "chainID": { "dataType": "string", "fieldNumber": 3 }, @@ -56,7 +56,7 @@ } }, "output": { - "value": "0a07312e312e312e3110d7081a40663866653765636333653239663538663339643861353338663961333562383062346236616239363734663033303065323565333366663431323734616533322203322e302a11694e496744304d6233732f524d61586273320664617277696e387b" + "value": "0a07312e312e312e3110d7081a0831303030303030302203322e302a11694e496744304d6233732f524d61586273320664617277696e387b" } }, { @@ -68,7 +68,7 @@ "os": "darwin" }, "schema": { - "$id": "peerInfo", + "$id": "/peerInfo", "type": "object", "properties": { "ipAddress": { @@ -79,7 +79,7 @@ "dataType": "uint32", "fieldNumber": 2 }, - "networkIdentifier": { + "chainID": { "dataType": "string", "fieldNumber": 3 }, diff --git a/protocol-specs/generator_outputs/lisk_codec/string_decodings.json b/protocol-specs/generator_outputs/lisk_codec/string_decodings.json index bfcfcec334d..37911eef10b 100644 --- a/protocol-specs/generator_outputs/lisk_codec/string_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/string_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "0a12436865636b6f7574204c69736b2053444b21", "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { @@ -33,7 +33,7 @@ "input": { "value": "0a00", "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { @@ -54,7 +54,7 @@ "input": { "value": "0a2ee282ac2ec6922ee280b02ec5922ec2a32ec2a92ec2ae2ec2b52ec3862ec3bc2ec3bd2ec3b82ec3872ec2a52ec39f", "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { diff --git a/protocol-specs/generator_outputs/lisk_codec/string_encodings.json b/protocol-specs/generator_outputs/lisk_codec/string_encodings.json index b16d9a3e3d2..abf2615049b 100644 --- a/protocol-specs/generator_outputs/lisk_codec/string_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/string_encodings.json @@ -14,7 +14,7 @@ "data": "Checkout Lisk SDK!" }, "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { @@ -35,7 +35,7 @@ "data": "" }, "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { @@ -56,7 +56,7 @@ "data": "€.ƒ.‰.Œ.£.©.®.µ.Æ.ü.ý.ø.Ç.¥.ß" }, "schema": { - "$id": "string-schema", + "$id": "/stringSchema", "type": "object", "properties": { "data": { diff --git a/protocol-specs/generator_outputs/lisk_codec/transaction_decodings.json b/protocol-specs/generator_outputs/lisk_codec/transaction_decodings.json index 34e7df7be60..59ff3674a0c 100644 --- a/protocol-specs/generator_outputs/lisk_codec/transaction_decodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/transaction_decodings.json @@ -12,7 +12,7 @@ "input": { "value": "0814100118d284cb8d9f82e50220eb9a89e10b2a208f057d088a585d938c20d63e430a068d4cea384e588aa0b758c68fca21644dbc3214f214d75bbc4b2ea89e433f3a45af803725416ec33a40204514eb1152355799ece36d17037e5feb4871472c60763bdafe67eb6a38bec632a8e2e62f84a32cf764342a4708a65fbad194e37feec03940f0ff84d3df2a053a400b6730e5898ca56fe0dc1c73de9363f6fc8b335592ef10725a8463bff101a4943e60311f0b1a439a2c9e02cca1379b80a822f4ec48cf212bff1f1c757e92ec02", "schema": { - "$id": "baseTransactionSchema", + "$id": "/baseTransactionSchema", "type": "object", "properties": { "moduleID": { @@ -74,20 +74,20 @@ } }, { - "description": "Decoding of valid vote asset", + "description": "Decoding of valid stake asset", "input": { "value": "0a1c0a14cd32c73e9851c7137980063b8af64aa5a31651f810ffdf8bb4590a1d0a149d86ad24a3f030e5522b6598115bb4d70c1692c91080c0bebbc51a", "schema": { - "$id": "voteAssetSchema", + "$id": "/voteAssetSchema", "type": "object", "properties": { - "votes": { + "stakes": { "type": "array", "fieldNumber": 1, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -96,22 +96,22 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } } }, - "required": ["votes"] + "required": ["stakes"] } }, "output": { "object": { - "votes": [ + "stakes": [ { - "delegateAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8", + "validatorAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8", "amount": "-12000000000" }, { - "delegateAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9", + "validatorAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9", "amount": "456000000000" } ] @@ -123,7 +123,7 @@ "input": { "value": "0802122007d6389be6e2109613699c02e78253148989515c3867e4f490eafd004a95b2b412203e754d00815b6b248a981520afbaf913153a26d25e2d5283964779c65ceee7e81a20c8b8fbe474a2b63ccb9744a409569b0a465ee1803f80435aec1c5e7fc2d4ee181a206115424fec0ce9c3bac5a81b5c782827d1f956fb95f1ccfa36c566d04e4d7267", "schema": { - "$id": "multisigAssetSchema", + "$id": "/multisigAssetSchema", "type": "object", "properties": { "numberOfSignatures": { @@ -167,7 +167,7 @@ "input": { "value": "08021220c8b8fbe474a2b63ccb9744a409569b0a465ee1803f80435aec1c5e7fc2d4ee1812206115424fec0ce9c3bac5a81b5c782827d1f956fb95f1ccfa36c566d04e4d7267", "schema": { - "$id": "multisigAssetSchema", + "$id": "/multisigAssetSchema", "type": "object", "properties": { "numberOfSignatures": { diff --git a/protocol-specs/generator_outputs/lisk_codec/transaction_encodings.json b/protocol-specs/generator_outputs/lisk_codec/transaction_encodings.json index 12577e01f91..df75194f932 100644 --- a/protocol-specs/generator_outputs/lisk_codec/transaction_encodings.json +++ b/protocol-specs/generator_outputs/lisk_codec/transaction_encodings.json @@ -23,7 +23,7 @@ ] }, "schema": { - "$id": "baseTransactionSchema", + "$id": "/baseTransactionSchema", "type": "object", "properties": { "moduleID": { @@ -74,31 +74,31 @@ } }, { - "description": "Encoding of valid vote asset", + "description": "Encoding of valid stake asset", "input": { "object": { - "votes": [ + "stakes": [ { - "delegateAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8", + "validatorAddress": "cd32c73e9851c7137980063b8af64aa5a31651f8", "amount": "-12000000000" }, { - "delegateAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9", + "validatorAddress": "9d86ad24a3f030e5522b6598115bb4d70c1692c9", "amount": "456000000000" } ] }, "schema": { - "$id": "voteAssetSchema", + "$id": "/voteAssetSchema", "type": "object", "properties": { - "votes": { + "stakes": { "type": "array", "fieldNumber": 1, "items": { "type": "object", "properties": { - "delegateAddress": { + "validatorAddress": { "dataType": "bytes", "fieldNumber": 1 }, @@ -107,11 +107,11 @@ "fieldNumber": 2 } }, - "required": ["delegateAddress", "amount"] + "required": ["validatorAddress", "amount"] } } }, - "required": ["votes"] + "required": ["stakes"] } }, "output": { @@ -133,7 +133,7 @@ ] }, "schema": { - "$id": "multisigAssetSchema", + "$id": "/multisigAssetSchema", "type": "object", "properties": { "numberOfSignatures": { @@ -174,7 +174,7 @@ "optionalKeys": [] }, "schema": { - "$id": "multisigAssetSchema", + "$id": "/multisigAssetSchema", "type": "object", "properties": { "numberOfSignatures": { diff --git a/protocol-specs/generator_outputs/proof_of_misbehavior_transaction/proof_of_misbehavior_transaction.json b/protocol-specs/generator_outputs/proof_of_misbehavior_transaction/proof_of_misbehavior_transaction.json index d2f2be3f380..b647843a4fc 100644 --- a/protocol-specs/generator_outputs/proof_of_misbehavior_transaction/proof_of_misbehavior_transaction.json +++ b/protocol-specs/generator_outputs/proof_of_misbehavior_transaction/proof_of_misbehavior_transaction.json @@ -23,7 +23,7 @@ "publicKey": "addb0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9", "passphrase": "actress route auction pudding shiver crater forum liquid blouse imitate seven front", "balance": "10000000000000000", - "delegateName": "genesis_100" + "validatorName": "genesis_100" }, "chainID": "10000000" }, @@ -47,7 +47,7 @@ "publicKey": "addb0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9", "passphrase": "actress route auction pudding shiver crater forum liquid blouse imitate seven front", "balance": "10000000000000000", - "delegateName": "genesis_100" + "validatorName": "genesis_100" }, "chainID": "10000000" }, @@ -71,7 +71,7 @@ "publicKey": "addb0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9", "passphrase": "actress route auction pudding shiver crater forum liquid blouse imitate seven front", "balance": "10000000000000000", - "delegateName": "genesis_100" + "validatorName": "genesis_100" }, "chainID": "10000000" }, diff --git a/protocol-specs/generator_outputs/transaction_network_id_and_change_order/delegate_transaction_validate.json b/protocol-specs/generator_outputs/transaction_network_id_and_change_order/delegate_transaction_validate.json index 74c86b360a7..9ec1d6d870c 100644 --- a/protocol-specs/generator_outputs/transaction_network_id_and_change_order/delegate_transaction_validate.json +++ b/protocol-specs/generator_outputs/transaction_network_id_and_change_order/delegate_transaction_validate.json @@ -1,14 +1,14 @@ { - "title": "Valid delegate transaction", - "summary": "A valid delegate transaction", + "title": "Valid validator transaction", + "summary": "A valid validator transaction", "config": { "network": "devnet" }, "runner": "transaction_network_id_and_change_order", - "handler": "delegate_transaction_validate", + "handler": "validator_transaction_validate", "testCases": [ { - "description": "A valid delegate transaction", + "description": "A valid validator transaction", "input": { "account": { "passphrase": "wear protect skill sentence lift enter wild sting lottery power floor neglect", diff --git a/protocol-specs/generator_outputs/unlock_transaction/unlock_transaction.json b/protocol-specs/generator_outputs/unlock_transaction/unlock_transaction.json index 45ca66ec8f8..75fa23b7e8c 100644 --- a/protocol-specs/generator_outputs/unlock_transaction/unlock_transaction.json +++ b/protocol-specs/generator_outputs/unlock_transaction/unlock_transaction.json @@ -16,7 +16,7 @@ "address": "67aeac2f0dcaae0b7790777a3b4ba296c427dbeb" }, "chainID": "10000000", - "delegates": [ + "validators": [ { "publicKey": "5430e775505b3145c124d15dc7c84ca7c751ecb69faf653bfb1e0c91e6e22f8a", "address": "c84662196cbad0b3c84aca61b68edfaf9b89a9cb" diff --git a/protocol-specs/generator_outputs/vote_transaction/vote_transaction_10_upvotes.json b/protocol-specs/generator_outputs/vote_transaction/vote_transaction_10_upvotes.json index 95a6ba50fdc..bf8f7eff95b 100644 --- a/protocol-specs/generator_outputs/vote_transaction/vote_transaction_10_upvotes.json +++ b/protocol-specs/generator_outputs/vote_transaction/vote_transaction_10_upvotes.json @@ -1,6 +1,6 @@ { - "title": "Valid vote transaction", - "summary": "Cases of valid vote transaction with upvote, downvote and mixture of both", + "title": "Valid stake transaction", + "summary": "Cases of valid stake transaction with upvote, downvote and mixture of both", "config": { "network": "devnet" }, @@ -16,7 +16,7 @@ "address": "67aeac2f0dcaae0b7790777a3b4ba296c427dbeb" }, "chainID": "10000000", - "delegates": [ + "validators": [ { "passphrase": "vivid phrase noble marble puzzle result pony dream loud deliver catch liquid", "publicKey": "5430e775505b3145c124d15dc7c84ca7c751ecb69faf653bfb1e0c91e6e22f8a", @@ -132,7 +132,7 @@ "address": "67aeac2f0dcaae0b7790777a3b4ba296c427dbeb" }, "chainID": "10000000", - "delegates": [ + "validators": [ { "passphrase": "vivid phrase noble marble puzzle result pony dream loud deliver catch liquid", "publicKey": "5430e775505b3145c124d15dc7c84ca7c751ecb69faf653bfb1e0c91e6e22f8a", @@ -248,7 +248,7 @@ "address": "67aeac2f0dcaae0b7790777a3b4ba296c427dbeb" }, "chainID": "10000000", - "delegates": [ + "validators": [ { "passphrase": "vivid phrase noble marble puzzle result pony dream loud deliver catch liquid", "publicKey": "5430e775505b3145c124d15dc7c84ca7c751ecb69faf653bfb1e0c91e6e22f8a", diff --git a/protocol-specs/generators/bft_processing/11_delegates_partial_switch.csv b/protocol-specs/generators/bft_processing/11_delegates_partial_switch.csv index acd806a4eb8..51fa3d8059b 100644 --- a/protocol-specs/generators/bft_processing/11_delegates_partial_switch.csv +++ b/protocol-specs/generators/bft_processing/11_delegates_partial_switch.csv @@ -1,4 +1,4 @@ -Round,Delegate,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36, +Round,Validator,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36, 1,D1,0,0,1,1,Precommits,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,Prevotes,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,D2,0,0,1,2,Precommits,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/protocol-specs/generators/bft_processing/4_delegates_missed_slots.csv b/protocol-specs/generators/bft_processing/4_delegates_missed_slots.csv index 0e1ad7a12f7..109b48c0c93 100644 --- a/protocol-specs/generators/bft_processing/4_delegates_missed_slots.csv +++ b/protocol-specs/generators/bft_processing/4_delegates_missed_slots.csv @@ -1,4 +1,4 @@ -Round,Delegate,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 +Round,Validator,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 1,D1,0,0,1,1,Precommits,0,,,,,,,,,,,,,,,,,,, ,,,,,,Prevotes,1,,,,,,,,,,,,,,,,,,, ,D2,0,0,1,2,Precommits,0,0,,,,,,,,,,,,,,,,,, diff --git a/protocol-specs/generators/bft_processing/4_delegates_simple.csv b/protocol-specs/generators/bft_processing/4_delegates_simple.csv index fe5b323d775..46af8bef788 100644 --- a/protocol-specs/generators/bft_processing/4_delegates_simple.csv +++ b/protocol-specs/generators/bft_processing/4_delegates_simple.csv @@ -1,4 +1,4 @@ -Round,Delegate,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 +Round,Validator,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 1,D1,0,0,1,1,Precommits,0,,,,,,,,,,,,,,,,,,, ,,,,,,Prevotes,1,,,,,,,,,,,,,,,,,,, ,D2,0,0,1,2,Precommits,0,0,,,,,,,,,,,,,,,,,, diff --git a/protocol-specs/generators/bft_processing/5_delegates_switched_completely.csv b/protocol-specs/generators/bft_processing/5_delegates_switched_completely.csv index 464c180ac7b..eb209b3046a 100644 --- a/protocol-specs/generators/bft_processing/5_delegates_switched_completely.csv +++ b/protocol-specs/generators/bft_processing/5_delegates_switched_completely.csv @@ -1,4 +1,4 @@ -Round,Delegate,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 +Round,Validator,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 1,D1,0,0,1,1,Precommits,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,Prevotes,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,D2,0,0,1,2,Precommits,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/protocol-specs/generators/bft_processing/7_delegates_partial_switch.csv b/protocol-specs/generators/bft_processing/7_delegates_partial_switch.csv index 4008eaf18c0..e0a18362db5 100644 --- a/protocol-specs/generators/bft_processing/7_delegates_partial_switch.csv +++ b/protocol-specs/generators/bft_processing/7_delegates_partial_switch.csv @@ -1,4 +1,4 @@ -Round,Delegate,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 +Round,Validator,Previously Forged Height,Max Height Prevoted,Active Since Round,Height,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 1,D1,0,0,1,1,Precommits,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,Prevotes,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,D2,0,0,1,2,Precommits,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/protocol-specs/generators/bft_processing/index.js b/protocol-specs/generators/bft_processing/index.js index c027430a404..192374fa9d7 100644 --- a/protocol-specs/generators/bft_processing/index.js +++ b/protocol-specs/generators/bft_processing/index.js @@ -18,29 +18,29 @@ const path = require('path'); const BaseGenerator = require('../base_generator'); const { loadCSVFile, generateBlockHeader, generateBlockHeadersSeries } = require('../../utils/bft'); -const bftFinalityStepsGenerator = ({ activeDelegates, filePath }) => { +const bftFinalityStepsGenerator = ({ activeValidators, filePath }) => { const rows = loadCSVFile(path.join(__dirname, filePath)); - const threshold = Math.ceil((activeDelegates * 2) / 3); + const threshold = Math.ceil((activeValidators * 2) / 3); const steps = []; for (let i = 1; i < rows.length - 1; i += 2) { - const delegateName = rows[i][1]; + const validatorName = rows[i][1]; const maxHeightPreviouslyForged = parseInt(rows[i][2], 10); const maxHeightPrevoted = parseInt(rows[i][3], 10); - const delegateMinHeightActive = (parseInt(rows[i][4], 10) - 1) * activeDelegates + 1; + const validatorMinHeightActive = (parseInt(rows[i][4], 10) - 1) * activeValidators + 1; const height = parseInt(rows[i][5], 10); const blockHeader = generateBlockHeader({ - delegateName, + validatorName, height, maxHeightPreviouslyForged, maxHeightPrevoted, - delegateMinHeightActive, + validatorMinHeightActive, }); - const input = { delegateName, blockHeader }; + const input = { validatorName, blockHeader }; const preCommitsRow = rows[i].slice(7).map(Number); const preVotesRow = rows[i + 1].slice(7).map(Number); @@ -83,13 +83,13 @@ const bftFinalityStepsGenerator = ({ activeDelegates, filePath }) => { // Since BFT only keep track of 5 rounds Object.keys(preVotes) - .slice(0, -1 * activeDelegates * 5) + .slice(0, -1 * activeValidators * 5) .forEach(key => { delete preVotes[key]; }); Object.keys(preCommits) - .slice(0, -1 * activeDelegates * 5) + .slice(0, -1 * activeValidators * 5) .forEach(key => { delete preCommits[key]; }); @@ -111,34 +111,34 @@ const bftFinalityStepsGenerator = ({ activeDelegates, filePath }) => { return steps; }; -const bftFinalityTestSuiteGenerator = ({ activeDelegates, title, filePath }) => () => ({ +const bftFinalityTestSuiteGenerator = ({ activeValidators, title, filePath }) => () => ({ title: 'BFT processing generation', summary: 'Generate status of pre-votes, pre-commits, finalized height and pre-voted height as per BFT specification', - config: { activeDelegates, finalizedHeight: 0 }, + config: { activeValidators, finalizedHeight: 0 }, runner: 'bft_processing', handler: title, - testCases: bftFinalityStepsGenerator({ activeDelegates, filePath }), + testCases: bftFinalityStepsGenerator({ activeValidators, filePath }), }); /** * This will generate a test step where we have invalid header attribute passed * - * @param {int} activeDelegates + * @param {int} activeValidators * @return {{output: *, input: *, initialState: *}} */ -const invalidMaxHeightPrevoted = activeDelegates => { +const invalidMaxHeightPrevoted = activeValidators => { // We need minimum three rounds to perform verification of block headers const blockHeaders = generateBlockHeadersSeries({ - activeDelegates, - count: activeDelegates * 3 + 1, + activeValidators, + count: activeValidators * 3 + 1, }); const blockHeader = blockHeaders.pop(); // It's an invalid block header as the value for "maxHeightPrevoted" // didn't match with one BFT compute for this particular height - // which is normally incremented in sequence if same delegates keep forging + // which is normally incremented in sequence if same validators keep forging const invalidBlockHeader = { ...blockHeader, maxHeightPrevoted: blockHeader.maxHeightPrevoted + 10, @@ -158,27 +158,27 @@ const invalidMaxHeightPrevoted = activeDelegates => { }; /** - * This will generate a test step when delegated moved on different chain + * This will generate a test step when validatord moved on different chain * - * @param {int} activeDelegates + * @param {int} activeValidators * @return {{output: *, input: *, initialState: *}} */ -const invalidSameHeightBlock = activeDelegates => { +const invalidSameHeightBlock = activeValidators => { // We need minimum three rounds to perform verification of block headers const blockHeaders = generateBlockHeadersSeries({ - activeDelegates, - count: activeDelegates * 3 + 1, + activeValidators, + count: activeValidators * 3 + 1, }); const blockHeader = blockHeaders.pop(); - const delegateLastBlockHeader = blockHeaders[activeDelegates * 2]; + const validatorLastBlockHeader = blockHeaders[activeValidators * 2]; // If a block header have same height as previously forged block const invalidBlockHeader = { ...blockHeader, - // This delegate has forged block at first block of second round - maxHeightPreviouslyForged: delegateLastBlockHeader.maxHeightPreviouslyForged, - height: delegateLastBlockHeader.height, + // This validator has forged block at first block of second round + maxHeightPreviouslyForged: validatorLastBlockHeader.maxHeightPreviouslyForged, + height: validatorLastBlockHeader.height, }; return { @@ -193,28 +193,28 @@ const invalidSameHeightBlock = activeDelegates => { }; /** - * This will generate a test step when delegated moved on different chain + * This will generate a test step when validatord moved on different chain * - * @param {int} activeDelegates + * @param {int} activeValidators * @return {{output: *, input: *, initialState: *}} */ -const invalidLowerHeightBlock = activeDelegates => { +const invalidLowerHeightBlock = activeValidators => { // We need minimum three rounds to perform verification of block headers const blockHeaders = generateBlockHeadersSeries({ - activeDelegates, - count: activeDelegates * 3 + 1, + activeValidators, + count: activeValidators * 3 + 1, }); const blockHeader = blockHeaders.pop(); - const delegateLastBlockHeader = blockHeaders[activeDelegates * 2]; + const validatorLastBlockHeader = blockHeaders[activeValidators * 2]; // If a block header have height lower then previously forged height const invalidBlockHeader = { ...blockHeader, - // This delegate has forged block at first block of second round + // This validator has forged block at first block of second round // so we make it 1 less as last block of second round - maxHeightPreviouslyForged: delegateLastBlockHeader.maxHeightPreviouslyForged, - height: delegateLastBlockHeader.height - 1, + maxHeightPreviouslyForged: validatorLastBlockHeader.maxHeightPreviouslyForged, + height: validatorLastBlockHeader.height - 1, }; return { @@ -231,26 +231,26 @@ const invalidLowerHeightBlock = activeDelegates => { /** * This will generate a test step we found a missing block in the chain * - * @param {int} activeDelegates + * @param {int} activeValidators * @return {{output: *, input: *, initialState: *}} */ // eslint-disable-next-line no-unused-vars -const invalidPreviouslyForgedHeight = activeDelegates => { +const invalidPreviouslyForgedHeight = activeValidators => { // We need minimum three rounds to perform verification of block headers const blockHeaders = generateBlockHeadersSeries({ - activeDelegates, - count: activeDelegates * 3 + 1, + activeValidators, + count: activeValidators * 3 + 1, }); const blockHeader = blockHeaders.pop(); - const delegateLastBlockHeader = blockHeaders[activeDelegates * 2]; + const validatorLastBlockHeader = blockHeaders[activeValidators * 2]; // If a block header have height lower then previously forged height const invalidBlockHeader = { ...blockHeader, - // This delegate has forged block at first block of second round + // This validator has forged block at first block of second round // so we make it 1 less as last block of second round - maxHeightPreviouslyForged: delegateLastBlockHeader.height - 1, + maxHeightPreviouslyForged: validatorLastBlockHeader.height - 1, }; return { @@ -267,22 +267,22 @@ const invalidPreviouslyForgedHeight = activeDelegates => { /** * This will generate a test step when block is forged on a lower chain * - * @param {int} activeDelegates + * @param {int} activeValidators * @return {{output: *, input: *, initialState: *}} */ -const invalidLowerMaxHeightPrevoted = activeDelegates => { +const invalidLowerMaxHeightPrevoted = activeValidators => { // We need minimum three rounds to perform verification of block headers const blockHeaders = generateBlockHeadersSeries({ - activeDelegates, - count: activeDelegates * 3 + 1, + activeValidators, + count: activeValidators * 3 + 1, }); const blockHeader = blockHeaders.pop(); - const delegateLastBlockHeader = blockHeaders[activeDelegates * 2]; + const validatorLastBlockHeader = blockHeaders[activeValidators * 2]; - // If delegate last forged block have higher maxHeightPrevoted + // If validator last forged block have higher maxHeightPrevoted // value that means it moved to different chain - delegateLastBlockHeader.maxHeightPrevoted = blockHeader.maxHeightPrevoted + 1; + validatorLastBlockHeader.maxHeightPrevoted = blockHeader.maxHeightPrevoted + 1; const invalidBlockHeader = { ...blockHeader, }; @@ -298,18 +298,18 @@ const invalidLowerMaxHeightPrevoted = activeDelegates => { }; }; -const bftInvalidBlockHeaderTestSuiteGenerator = ({ activeDelegates }) => () => ({ +const bftInvalidBlockHeaderTestSuiteGenerator = ({ activeValidators }) => () => ({ title: 'BFT processing generation', summary: 'Generate set of invalid blocks headers for BFT', - config: { activeDelegates, finalizedHeight: 0 }, + config: { activeValidators, finalizedHeight: 0 }, runner: 'bft_processing', handler: 'bft_invalid_block_headers', testCases: [ - invalidMaxHeightPrevoted(activeDelegates), - invalidSameHeightBlock(activeDelegates), - invalidLowerHeightBlock(activeDelegates), - invalidPreviouslyForgedHeight(activeDelegates), - invalidLowerMaxHeightPrevoted(activeDelegates), + invalidMaxHeightPrevoted(activeValidators), + invalidSameHeightBlock(activeValidators), + invalidLowerHeightBlock(activeValidators), + invalidPreviouslyForgedHeight(activeValidators), + invalidLowerMaxHeightPrevoted(activeValidators), ], }); @@ -518,30 +518,30 @@ const bftForkChoiceTestSuiteGenerator = () => { BaseGenerator.runGenerator('bft_finality_processing', [ bftFinalityTestSuiteGenerator({ - activeDelegates: 4, - title: '4_delegates_missed_slots', - filePath: '4_delegates_missed_slots.csv', + activeValidators: 4, + title: '4_validators_missed_slots', + filePath: '4_validators_missed_slots.csv', }), bftFinalityTestSuiteGenerator({ - activeDelegates: 4, - title: '4_delegates_simple', - filePath: '4_delegates_simple.csv', + activeValidators: 4, + title: '4_validators_simple', + filePath: '4_validators_simple.csv', }), bftFinalityTestSuiteGenerator({ - activeDelegates: 5, - title: '5_delegates_switched_completely', - filePath: '5_delegates_switched_completely.csv', + activeValidators: 5, + title: '5_validators_switched_completely', + filePath: '5_validators_switched_completely.csv', }), bftFinalityTestSuiteGenerator({ - activeDelegates: 7, - title: '7_delegates_partial_switch', - filePath: '7_delegates_partial_switch.csv', + activeValidators: 7, + title: '7_validators_partial_switch', + filePath: '7_validators_partial_switch.csv', }), bftFinalityTestSuiteGenerator({ - activeDelegates: 11, - title: '11_delegates_partial_switch', - filePath: '11_delegates_partial_switch.csv', + activeValidators: 11, + title: '11_validators_partial_switch', + filePath: '11_validators_partial_switch.csv', }), - bftInvalidBlockHeaderTestSuiteGenerator({ activeDelegates: 5 }), + bftInvalidBlockHeaderTestSuiteGenerator({ activeValidators: 5 }), bftForkChoiceTestSuiteGenerator, ]); diff --git a/protocol-specs/generators/dpos_delegate_shuffling/README.md b/protocol-specs/generators/dpos_delegate_shuffling/README.md deleted file mode 100644 index 5960f6f1ebc..00000000000 --- a/protocol-specs/generators/dpos_delegate_shuffling/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Uniform shuffling of delegates - -A set of test generators for Uniform ordering of delegates list by LIP-0003 - -### Format - -#### Input - -- random seed: Random seed from the (round - 1). - -#### Output - -- Shuffled delegates list: list of addresses that is different in order from the previous delegate list. - -## Resources - -- [LIP-0003](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0003.md) diff --git a/protocol-specs/generators/dpos_delegate_shuffling/index.js b/protocol-specs/generators/dpos_delegate_shuffling/index.js deleted file mode 100644 index 0e0f7a63197..00000000000 --- a/protocol-specs/generators/dpos_delegate_shuffling/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2020 Lisk Foundation - * - * See the LICENSE file at the top-level directory of this distribution - * for licensing information. - * - * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, - * no part of this software, including this file, may be copied, modified, - * propagated, or distributed except according to the terms contained in the - * LICENSE file. - * - * Removal or modification of this copyright notice is prohibited. - */ - -'use strict'; - -const { utils } = require('@liskhq/lisk-cryptography'); -const BaseGenerator = require('../base_generator'); -const previousDelegateList = require('./delegate_address_list.json').delegateList; - -const generateShuffledDelegateList = () => { - const previousRoundSeed1 = 'b9acc2f1fda3666bfb34107f1c6dccc4'; - const delegateList = [...previousDelegateList].map(delegate => ({ - address: Buffer.from(delegate.address, 'hex'), - })); - for (const delegate of delegateList) { - const seedSource = Buffer.concat([Buffer.from(previousRoundSeed1, 'hex'), delegate.address]); - delegate.roundHash = utils.hash(seedSource); - } - - delegateList.sort((delegate1, delegate2) => { - const diff = delegate1.roundHash.compare(delegate2.roundHash); - if (diff !== 0) { - return diff; - } - return delegate1.address.compare(delegate2.address); - }); - - return { - input: { - previousRoundSeed1, - delegateList: previousDelegateList.map(delegate => delegate.address), - }, - output: { - delegateList: delegateList.map(delegate => delegate.address), - }, - }; -}; - -const uniformlyShuffledDelegateList = () => ({ - title: 'Uniform shuffling of delegate list in each round', - summary: 'A uniformly shuffled delegate list is generated', - config: 'devnet', - runner: 'dpos_delegate_shuffling', - handler: 'uniformly_shuffled_delegate_list', - testCases: generateShuffledDelegateList(), -}); - -module.exports = BaseGenerator.runGenerator('dpos_delegate_shuffling', [ - uniformlyShuffledDelegateList, -]); diff --git a/protocol-specs/generators/dpos_forger_selection/README.md b/protocol-specs/generators/dpos_forger_selection/README.md deleted file mode 100644 index e70d7947ac1..00000000000 --- a/protocol-specs/generators/dpos_forger_selection/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Standby delegates selection - -A set of test generators for standby delegate selection by LIP-0022 - -### Format - -#### Input - -- random seed 1: random seed to use -- random seed 2: random seed to use -- vote weights: delegates with address and voteWeight - -#### Output - -- Selected delegates: list of addresses which are selected for forging - -## Resources - -- [LIP-0022](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0022.md) diff --git a/protocol-specs/generators/lisk_codec/proto_files/account.proto b/protocol-specs/generators/lisk_codec/proto_files/account.proto index 9422cbf27cf..5298156dc8e 100644 --- a/protocol-specs/generators/lisk_codec/proto_files/account.proto +++ b/protocol-specs/generators/lisk_codec/proto_files/account.proto @@ -6,29 +6,29 @@ message Keys { repeated bytes optionalKeys = 3; } -message Delegate { +message Validator { required string username = 1; repeated uint32 pomHeights = 2 [packed=true]; required uint32 consecutiveMissedBlocks = 3; required uint32 lastForgedHeight = 4; required bool isBanned = 5; - required uint64 totalVotesReceived = 6; + required uint64 totalStakeReceived = 6; } message SentVotes { - required bytes delegateAddress = 1; + required bytes validatorAddress = 1; required uint64 amount = 2; } message Unlocking { - required bytes delegateAddress = 1; + required bytes validatorAddress = 1; required uint64 amount = 2; - required uint32 unvoteHeight = 3; + required uint32 unstakeHeight = 3; } message Asset { - required Delegate delegate = 1; - repeated SentVotes sentVotes = 2; + required Validator validator = 1; + repeated SentVotes sentStakes = 2; repeated Unlocking unlocking = 3; } diff --git a/protocol-specs/generators/lisk_codec/proto_files/block.proto b/protocol-specs/generators/lisk_codec/proto_files/block.proto index ca3532b7d93..e302907b65d 100644 --- a/protocol-specs/generators/lisk_codec/proto_files/block.proto +++ b/protocol-specs/generators/lisk_codec/proto_files/block.proto @@ -29,12 +29,12 @@ message BaseTransaction { } message Vote { - required bytes delegateAddress = 1; + required bytes validatorAddress = 1; required sint64 amount = 2; } message VoteTransaction { - repeated Vote votes = 1; + repeated Vote stakes = 1; } message MultisigTransaction { @@ -54,29 +54,29 @@ message Keys { repeated bytes optionalKeys = 3; } -message Delegate { +message Validator { required string username = 1; repeated uint32 pomHeights = 2 [packed=true]; required uint32 consecutiveMissedBlocks = 3; required uint32 lastForgedHeight = 4; required bool isBanned = 5; - required uint64 totalVotesReceived = 6; + required uint64 totalStakeReceived = 6; } message SentVotes { - required bytes delegateAddress = 1; + required bytes validatorAddress = 1; required uint64 amount = 2; } message Unlocking { - required bytes delegateAddress = 1; + required bytes validatorAddress = 1; required uint64 amount = 2; - required uint32 unvoteHeight = 3; + required uint32 unstakeHeight = 3; } message Asset { - required Delegate delegate = 1; - repeated SentVotes sentVotes = 2; + required Validator validator = 1; + repeated SentVotes sentStakes = 2; repeated Unlocking unlocking = 3; } @@ -91,6 +91,6 @@ message GenesisAccount { message GenesisBlockAsset { repeated GenesisAccount accounts = 1; - repeated bytes initDelegates = 2; + repeated bytes initValidators = 2; required uint32 initRounds = 3; -} \ No newline at end of file +} diff --git a/protocol-specs/generators/lisk_codec/proto_files/object.proto b/protocol-specs/generators/lisk_codec/proto_files/object.proto index b029c997580..d9594822f2e 100644 --- a/protocol-specs/generators/lisk_codec/proto_files/object.proto +++ b/protocol-specs/generators/lisk_codec/proto_files/object.proto @@ -13,7 +13,7 @@ message FooBar { message Objects { required bytes address = 1; required uint64 balance = 2; - required bool isDelegate = 3; + required bool isValidator = 3; required string name = 4; required Asset asset = 5; } diff --git a/protocol-specs/generators/lisk_codec/types_generators/account.js b/protocol-specs/generators/lisk_codec/types_generators/account.js index 5f18c76892d..740f771e602 100644 --- a/protocol-specs/generators/lisk_codec/types_generators/account.js +++ b/protocol-specs/generators/lisk_codec/types_generators/account.js @@ -49,7 +49,7 @@ const accountSchema = { type: 'object', fieldNumber: 6, properties: { - delegate: { + validator: { type: 'object', fieldNumber: 1, properties: { @@ -62,7 +62,7 @@ const accountSchema = { consecutiveMissedBlocks: { dataType: 'uint32', fieldNumber: 3 }, lastForgedHeight: { dataType: 'uint32', fieldNumber: 4 }, isBanned: { dataType: 'boolean', fieldNumber: 5 }, - totalVotesReceived: { dataType: 'uint64', fieldNumber: 6 }, + totalStakeReceived: { dataType: 'uint64', fieldNumber: 6 }, }, required: [ 'username', @@ -70,19 +70,19 @@ const accountSchema = { 'consecutiveMissedBlocks', 'lastForgedHeight', 'isBanned', - 'totalVotesReceived', + 'totalStakeReceived', ], }, - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 2, items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, }, - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], }, }, unlocking: { @@ -91,11 +91,11 @@ const accountSchema = { items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, - unvoteHeight: { dataType: 'uint32', fieldNumber: 3 }, + unstakeHeight: { dataType: 'uint32', fieldNumber: 3 }, }, - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], }, }, }, @@ -118,24 +118,24 @@ const validAccount1 = { optionalKeys: [], }, asset: { - delegate: { + validator: { username: 'Catullo', pomHeights: [85], consecutiveMissedBlocks: 32, lastForgedHeight: 64, isBanned: false, - totalVotesReceived: '300000000', + totalStakeReceived: '300000000', }, - sentVotes: [ + sentStakes: [ { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( 'cd32c73e9851c7137980063b8af64aa5a31651f8dcad258b682d2ddf091029e4', 'hex', ), amount: '100000000', }, { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( '9d86ad24a3f030e5522b6598115bb4d70c1692c9d8995ddfccb377379a2d86c6', 'hex', ), @@ -144,12 +144,12 @@ const validAccount1 = { ], unlocking: [ { - delegateAddress: Buffer.from( + validatorAddress: Buffer.from( '655e665765e3c42712d9a425b5b720d10457a5e45de0d4420e7c53ad73b02ef5', 'hex', ), amount: '400000000', - unvoteHeight: 128, + unstakeHeight: 128, }, ], }, @@ -166,15 +166,15 @@ const validAccount2 = { optionalKeys: [], }, asset: { - delegate: { + validator: { username: '', pomHeights: [], consecutiveMissedBlocks: 0, lastForgedHeight: 0, isBanned: false, - totalVotesReceived: '0', + totalStakeReceived: '0', }, - sentVotes: [], + sentStakes: [], unlocking: [], }, }; diff --git a/protocol-specs/generators/lisk_codec/types_generators/genesis_block_asset.js b/protocol-specs/generators/lisk_codec/types_generators/genesis_block_asset.js index 0c64b153394..8cf0f188453 100644 --- a/protocol-specs/generators/lisk_codec/types_generators/genesis_block_asset.js +++ b/protocol-specs/generators/lisk_codec/types_generators/genesis_block_asset.js @@ -22,7 +22,7 @@ const { GenesisBlockAsset } = prepareProtobuffersBlock(); const genesisBlockAssetSchema = { $id: '/genesisBlockAssetSchema', type: 'object', - required: ['accounts', 'initDelegates', 'initRounds'], + required: ['accounts', 'initValidators', 'initRounds'], properties: { accounts: { type: 'array', @@ -55,7 +55,7 @@ const genesisBlockAssetSchema = { fieldNumber: 6, type: 'object', properties: { - delegate: { + validator: { type: 'object', fieldNumber: 1, properties: { @@ -71,7 +71,7 @@ const genesisBlockAssetSchema = { }, lastForgedHeight: { dataType: 'uint32', fieldNumber: 4 }, isBanned: { dataType: 'boolean', fieldNumber: 5 }, - totalVotesReceived: { dataType: 'uint64', fieldNumber: 6 }, + totalStakeReceived: { dataType: 'uint64', fieldNumber: 6 }, }, required: [ 'username', @@ -79,19 +79,19 @@ const genesisBlockAssetSchema = { 'consecutiveMissedBlocks', 'lastForgedHeight', 'isBanned', - 'totalVotesReceived', + 'totalStakeReceived', ], }, - sentVotes: { + sentStakes: { type: 'array', fieldNumber: 2, items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, }, - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], }, }, unlocking: { @@ -100,11 +100,11 @@ const genesisBlockAssetSchema = { items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, - unvoteHeight: { dataType: 'uint32', fieldNumber: 3 }, + unstakeHeight: { dataType: 'uint32', fieldNumber: 3 }, }, - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], }, }, }, @@ -114,7 +114,7 @@ const genesisBlockAssetSchema = { }, fieldNumber: 1, }, - initDelegates: { + initValidators: { type: 'array', items: { dataType: 'bytes' }, fieldNumber: 2, @@ -124,7 +124,7 @@ const genesisBlockAssetSchema = { }; const validGenesisBlockAsset1 = { - initDelegates: [ + initValidators: [ Buffer.from('03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f', 'hex'), Buffer.from('0903f4c5cb599a7928aef27e314e98291d1e3888', 'hex'), Buffer.from('0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf', 'hex'), @@ -145,17 +145,17 @@ const validGenesisBlockAsset1 = { numberOfSignatures: 0, }, asset: { - delegate: { + validator: { username: 'genesis_34', pomHeights: [], consecutiveMissedBlocks: 0, lastForgedHeight: 0, isBanned: false, - totalVotesReceived: '1000000000000', + totalStakeReceived: '1000000000000', }, - sentVotes: [ + sentStakes: [ { - delegateAddress: Buffer.from('03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f', 'hex'), + validatorAddress: Buffer.from('03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f', 'hex'), amount: '1000000000000', }, ], @@ -176,15 +176,15 @@ const validGenesisBlockAsset1 = { numberOfSignatures: 0, }, asset: { - delegate: { + validator: { username: 'genesis_74', pomHeights: [], consecutiveMissedBlocks: 0, lastForgedHeight: 0, isBanned: false, - totalVotesReceived: '1000000000000', + totalStakeReceived: '1000000000000', }, - sentVotes: [], + sentStakes: [], unlocking: [], }, }, @@ -202,17 +202,17 @@ const validGenesisBlockAsset1 = { numberOfSignatures: 0, }, asset: { - delegate: { + validator: { username: 'genesis_98', pomHeights: [], consecutiveMissedBlocks: 0, lastForgedHeight: 0, isBanned: false, - totalVotesReceived: '1000000000000', + totalStakeReceived: '1000000000000', }, - sentVotes: [ + sentStakes: [ { - delegateAddress: Buffer.from('0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf', 'hex'), + validatorAddress: Buffer.from('0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf', 'hex'), amount: '1000000000000', }, ], diff --git a/protocol-specs/generators/lisk_codec/types_generators/nested_array.js b/protocol-specs/generators/lisk_codec/types_generators/nested_array.js index 9e9d4720f96..bd10c3f782a 100644 --- a/protocol-specs/generators/lisk_codec/types_generators/nested_array.js +++ b/protocol-specs/generators/lisk_codec/types_generators/nested_array.js @@ -35,7 +35,7 @@ const diff = { ], }, ], - created: ['chain:delegates', 'consensus:bft'], + created: ['chain:validators', 'consensus:bft'], }; const diffSchema = { $id: '/state/diff', @@ -93,7 +93,7 @@ const diffString = { value: ['diff5', 'diff6', 'diff7', 'diff5'], }, ], - created: ['chain:delegates', 'consensus:bft'], + created: ['chain:validators', 'consensus:bft'], }; const diffStringSchema = { $id: '/state/diffString', diff --git a/protocol-specs/generators/lisk_codec/types_generators/objects.js b/protocol-specs/generators/lisk_codec/types_generators/objects.js index eba5a5b5c11..3870e3e415c 100644 --- a/protocol-specs/generators/lisk_codec/types_generators/objects.js +++ b/protocol-specs/generators/lisk_codec/types_generators/objects.js @@ -22,8 +22,8 @@ const { Objects, ObjectWithOptionalProp } = prepareProtobuffersObjects(); const object = { address: Buffer.from('e11a11364738225813f86ea85214400e5db08d6e', 'hex'), balance: '10000000', - isDelegate: true, - name: 'delegate', + isValidator: true, + name: 'validator', asset: { data: 'Check out the Lisk SDK now in binary!', fooBar: { @@ -44,7 +44,7 @@ const objectSchema = { dataType: 'uint64', fieldNumber: 2, }, - isDelegate: { + isValidator: { dataType: 'boolean', fieldNumber: 3, }, diff --git a/protocol-specs/generators/lisk_codec/types_generators/transaction.js b/protocol-specs/generators/lisk_codec/types_generators/transaction.js index 6505a4b97c7..9b4b9afe1c0 100644 --- a/protocol-specs/generators/lisk_codec/types_generators/transaction.js +++ b/protocol-specs/generators/lisk_codec/types_generators/transaction.js @@ -42,20 +42,20 @@ const voteAssetSchema = { $id: '/voteAssetSchema', type: 'object', properties: { - votes: { + stakes: { type: 'array', fieldNumber: 1, items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'sint64', fieldNumber: 2 }, }, - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], }, }, }, - required: ['votes'], + required: ['stakes'], }; const multisigAssetSchema = { @@ -92,13 +92,13 @@ const validBaseTransaction = { }; const validVoteAsset = { - votes: [ + stakes: [ { - delegateAddress: Buffer.from('cd32c73e9851c7137980063b8af64aa5a31651f8', 'hex'), + validatorAddress: Buffer.from('cd32c73e9851c7137980063b8af64aa5a31651f8', 'hex'), amount: '-12000000000', }, { - delegateAddress: Buffer.from('9d86ad24a3f030e5522b6598115bb4d70c1692c9', 'hex'), + validatorAddress: Buffer.from('9d86ad24a3f030e5522b6598115bb4d70c1692c9', 'hex'), amount: '456000000000', }, ], @@ -140,7 +140,7 @@ module.exports = { output: { value: validBaseTransactionEncoded }, }, { - description: 'Encoding of valid vote asset', + description: 'Encoding of valid stake asset', input: { object: validVoteAsset, schema: voteAssetSchema }, output: { value: validVoteTransactionEncoded }, }, @@ -163,7 +163,7 @@ module.exports = { output: { object: validBaseTransaction }, }, { - description: 'Decoding of valid vote asset', + description: 'Decoding of valid stake asset', input: { value: validVoteTransactionEncoded, schema: voteAssetSchema }, output: { object: validVoteAsset }, }, diff --git a/protocol-specs/generators/pos_forger_selection/README.md b/protocol-specs/generators/pos_forger_selection/README.md new file mode 100644 index 00000000000..454823a76f0 --- /dev/null +++ b/protocol-specs/generators/pos_forger_selection/README.md @@ -0,0 +1,19 @@ +# Standby validators selection + +A set of test generators for standby validator selection by LIP-0022 + +### Format + +#### Input + +- random seed 1: random seed to use +- random seed 2: random seed to use +- stake weights: validators with address and validatorWeight + +#### Output + +- Selected validators: list of addresses which are selected for forging + +## Resources + +- [LIP-0022](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0022.md) diff --git a/protocol-specs/generators/dpos_forger_selection/index.js b/protocol-specs/generators/pos_forger_selection/index.js similarity index 56% rename from protocol-specs/generators/dpos_forger_selection/index.js rename to protocol-specs/generators/pos_forger_selection/index.js index aaee3b5ec2a..627db204abd 100644 --- a/protocol-specs/generators/dpos_forger_selection/index.js +++ b/protocol-specs/generators/pos_forger_selection/index.js @@ -15,19 +15,19 @@ 'use strict'; const BaseGenerator = require('../base_generator'); -const delegateWeightsWithMoreThan2EligibleStandBy = require('./delegate_weight_more_than_2_eligible_standby.json'); -const delegateWeightsWithExactly2EligibleStandBy = require('./delegate_weight_exactly_2_eligible_standby.json'); -const delegateWeightsWithExactly1EligibleStandBy = require('./delegate_weight_exactly_1_eligible_standby.json'); -const delegateWeightsWith0EligibleStandBy = require('./delegate_weight_0_eligible_standby.json'); -const delegateWeightsLessThan103 = require('./delegate_weight_less_than_103.json'); +const validatorWeightsWithMoreThan2EligibleStandBy = require('./validator_weight_more_than_2_eligible_standby.json'); +const validatorWeightsWithExactly2EligibleStandBy = require('./validator_weight_exactly_2_eligible_standby.json'); +const validatorWeightsWithExactly1EligibleStandBy = require('./validator_weight_exactly_1_eligible_standby.json'); +const validatorWeightsWith0EligibleStandBy = require('./validator_weight_0_eligible_standby.json'); +const validatorWeightsLessThan103 = require('./validator_weight_less_than_103.json'); const copyAndSort = list => { const copiedList = [...list.map(content => ({ ...content }))].map(l => ({ - voteWeight: BigInt(l.voteWeight), + validatorWeight: BigInt(l.validatorWeight), address: Buffer.from(l.address, 'hex'), })); copiedList.sort((a, b) => { - const diff = b.voteWeight - a.voteWeight; + const diff = b.validatorWeight - a.validatorWeight; if (diff > BigInt(0)) { return 1; } @@ -41,8 +41,8 @@ const copyAndSort = list => { const generateForgerSelectionWithMoreThan2EligibleStandBy = () => { const randomSeed1 = 'b9acc2f1fda3666bfb34107f1c6dccc4'; - const sortedList = copyAndSort(delegateWeightsWithMoreThan2EligibleStandBy.list); - // Select active delegate first + const sortedList = copyAndSort(validatorWeightsWithMoreThan2EligibleStandBy.list); + // Select active validator first const result = sortedList.slice(0, 101); const candidates = sortedList.slice(101); @@ -50,18 +50,18 @@ const generateForgerSelectionWithMoreThan2EligibleStandBy = () => { const randomSeed1Buffer = Buffer.from(randomSeed1, 'hex'); const seedNumber1 = randomSeed1Buffer.readBigUInt64BE(); const totalWeight = candidates.reduce( - (prev, current) => prev + BigInt(current.voteWeight), + (prev, current) => prev + BigInt(current.validatorWeight), BigInt(0), ); let randomInt1 = seedNumber1 % totalWeight; let selectedIndex = 0; for (const candidate of candidates) { - if (candidate.voteWeight > randomInt1) { + if (candidate.validatorWeight > randomInt1) { result.push(candidate); break; } - randomInt1 -= BigInt(candidate.voteWeight); + randomInt1 -= BigInt(candidate.validatorWeight); selectedIndex += 1; } // Remove selected candidate @@ -72,18 +72,18 @@ const generateForgerSelectionWithMoreThan2EligibleStandBy = () => { const randomSeed2Buffer = Buffer.from(randomSeed2, 'hex'); const seedNumber2 = randomSeed2Buffer.readBigUInt64BE(); const totalWeightAfterRemoving = candidates.reduce( - (prev, current) => prev + BigInt(current.voteWeight), + (prev, current) => prev + BigInt(current.validatorWeight), BigInt(0), ); let randomInt2 = seedNumber2 % totalWeightAfterRemoving; selectedIndex = 0; for (const candidate of candidates) { - if (candidate.voteWeight > randomInt2) { + if (candidate.validatorWeight > randomInt2) { result.push(candidate); break; } - randomInt2 -= BigInt(candidate.voteWeight); + randomInt2 -= BigInt(candidate.validatorWeight); selectedIndex += 1; } @@ -91,7 +91,7 @@ const generateForgerSelectionWithMoreThan2EligibleStandBy = () => { input: { randomSeed1, randomSeed2, - voteWeights: delegateWeightsWithMoreThan2EligibleStandBy.list, + validatorWeights: validatorWeightsWithMoreThan2EligibleStandBy.list, }, output: { selectedForgers: result.map(vw => vw.address), @@ -106,10 +106,10 @@ const generateForgerSelectionWithExactly1EligibleStandBy = () => { input: { randomSeed1, randomSeed2, - voteWeights: delegateWeightsWithExactly1EligibleStandBy.list, + validatorWeights: validatorWeightsWithExactly1EligibleStandBy.list, }, output: { - selectedForgers: copyAndSort(delegateWeightsWithExactly1EligibleStandBy.list) + selectedForgers: copyAndSort(validatorWeightsWithExactly1EligibleStandBy.list) .map(dw => dw.address) .slice(0, 103), }, @@ -123,27 +123,27 @@ const generateForgerSelectionWithExactly2EligibleStandBy = () => { input: { randomSeed1, randomSeed2, - voteWeights: delegateWeightsWithExactly2EligibleStandBy.list, + validatorWeights: validatorWeightsWithExactly2EligibleStandBy.list, }, output: { - selectedForgers: copyAndSort(delegateWeightsWithExactly2EligibleStandBy.list) + selectedForgers: copyAndSort(validatorWeightsWithExactly2EligibleStandBy.list) .map(dw => dw.address) .slice(0, 103), }, }; }; -const generateForgerSelectionWithLessThan103Delegates = () => { +const generateForgerSelectionWithLessThan103Validators = () => { const randomSeed1 = '225723ef50cbad5e11dd4edf23da652c'; const randomSeed2 = '9c65ff262b4f4ccc6d56bcbf5a6a1957'; return { input: { randomSeed1, randomSeed2, - voteWeights: delegateWeightsLessThan103.list, + validatorWeights: validatorWeightsLessThan103.list, }, output: { - selectedForgers: copyAndSort(delegateWeightsLessThan103.list) + selectedForgers: copyAndSort(validatorWeightsLessThan103.list) .map(dw => dw.address) .slice(0, 103), }, @@ -157,10 +157,10 @@ const generateForgerSelectionWithExactly0EligibleStandBy = () => { input: { randomSeed1, randomSeed2, - voteWeights: delegateWeightsWith0EligibleStandBy.list, + validatorWeights: validatorWeightsWith0EligibleStandBy.list, }, output: { - selectedForgers: copyAndSort(delegateWeightsWith0EligibleStandBy.list) + selectedForgers: copyAndSort(validatorWeightsWith0EligibleStandBy.list) .map(dw => dw.address) .slice(0, 103), }, @@ -168,54 +168,54 @@ const generateForgerSelectionWithExactly0EligibleStandBy = () => { }; const forgerSelectionWithMoreThan2EligibleStandBy = () => ({ - title: 'Forger selection with more than 2 standby delegates', - summary: 'A set of voteWeights which include more than 2 eligible standby delegates', + title: 'Forger selection with more than 2 standby validators', + summary: 'A set of validatorWeights which include more than 2 eligible standby validators', config: 'devnet', - runner: 'dpos_forger_selection', - handler: 'dpos_forger_selection_more_than_2_standby', + runner: 'pos_forger_selection', + handler: 'pos_forger_selection_more_than_2_standby', testCases: generateForgerSelectionWithMoreThan2EligibleStandBy(), }); const forgerSelectionWithExactly2EligibleStandBy = () => ({ - title: 'Forger selection with more than 1 standby delegate', - summary: 'A set of voteWeights which include 2 eligible standby delegates', + title: 'Forger selection with more than 1 standby validator', + summary: 'A set of validatorWeights which include 2 eligible standby validators', config: 'devnet', - runner: 'dpos_forger_selection', - handler: 'dpos_forger_selection_exactly_2_standby', + runner: 'pos_forger_selection', + handler: 'pos_forger_selection_exactly_2_standby', testCases: generateForgerSelectionWithExactly2EligibleStandBy(), }); const forgerSelectionWithExactly1EligibleStandBy = () => ({ - title: 'Forger selection with exactly 1 standby delegate', - summary: 'A set of voteWeights which include 1 eligible standby delegate', + title: 'Forger selection with exactly 1 standby validator', + summary: 'A set of validatorWeights which include 1 eligible standby validator', config: 'devnet', - runner: 'dpos_forger_selection', - handler: 'dpos_forger_selection_exactly_1_standby', + runner: 'pos_forger_selection', + handler: 'pos_forger_selection_exactly_1_standby', testCases: generateForgerSelectionWithExactly1EligibleStandBy(), }); const forgerSelectionWithExactly0EligibleStandBy = () => ({ - title: 'Forger selection with 0 standby delegates', - summary: 'A set of voteWeights which include no eligible standby delegates', + title: 'Forger selection with 0 standby validators', + summary: 'A set of validatorWeights which include no eligible standby validators', config: 'devnet', - runner: 'dpos_forger_selection', - handler: 'dpos_forger_selection_0_standby', + runner: 'pos_forger_selection', + handler: 'pos_forger_selection_0_standby', testCases: generateForgerSelectionWithExactly0EligibleStandBy(), }); -const forgerSelectionWithLessThan103Delegates = () => ({ - title: 'Forger selection with less than 103 delegates', - summary: 'A set of voteWeights which include less than 103 delegates', +const forgerSelectionWithLessThan103Validators = () => ({ + title: 'Forger selection with less than 103 validators', + summary: 'A set of validatorWeights which include less than 103 validators', config: 'devnet', - runner: 'dpos_forger_selection', - handler: 'dpos_forger_selection_less_than_103', - testCases: generateForgerSelectionWithLessThan103Delegates(), + runner: 'pos_forger_selection', + handler: 'pos_forger_selection_less_than_103', + testCases: generateForgerSelectionWithLessThan103Validators(), }); -module.exports = BaseGenerator.runGenerator('dpos_forger_selection', [ +module.exports = BaseGenerator.runGenerator('pos_forger_selection', [ forgerSelectionWithMoreThan2EligibleStandBy, forgerSelectionWithExactly2EligibleStandBy, forgerSelectionWithExactly1EligibleStandBy, forgerSelectionWithExactly0EligibleStandBy, - forgerSelectionWithLessThan103Delegates, + forgerSelectionWithLessThan103Validators, ]); diff --git a/protocol-specs/generators/dpos_forger_selection/sample_generator.js b/protocol-specs/generators/pos_forger_selection/sample_generator.js similarity index 74% rename from protocol-specs/generators/dpos_forger_selection/sample_generator.js rename to protocol-specs/generators/pos_forger_selection/sample_generator.js index ce911ed3c4e..5b1b19e2486 100644 --- a/protocol-specs/generators/dpos_forger_selection/sample_generator.js +++ b/protocol-specs/generators/pos_forger_selection/sample_generator.js @@ -21,32 +21,32 @@ const fs = require('fs'); const [amount = 150, filePath, fixedValue] = process.argv.slice(2); -const generateDelegates = (num, fixedNum) => { - const delegateList = []; +const generateValidators = (num, fixedNum) => { + const validatorList = []; for (let i = 0; i < num; i += 1) { const passphrase = Mnemonic.generateMnemonic(); const { publicKey } = ed.getKeys(passphrase); const address = utils.hash(Buffer.from(publicKey, 'hex')).slice(0, 20); const buf = crypto.randomBytes(8); const randomNumber = buf.readBigUInt64BE() / BigInt(10) ** BigInt(8); - const voteWeight = fixedValue + const validatorWeight = fixedValue ? BigInt(fixedNum) : randomNumber - (randomNumber % BigInt(10) ** BigInt(9)); - delegateList.push({ + validatorList.push({ address, - voteWeight, - // lsk: (voteWeight / (BigInt(10) ** BigInt(8))), + validatorWeight, + // lsk: (validatorWeight / (BigInt(10) ** BigInt(8))), }); } - return { list: delegateList }; + return { list: validatorList }; }; -const delegates = generateDelegates(amount, fixedValue); +const validators = generateValidators(amount, fixedValue); if (!filePath) { - console.info(delegates); + console.info(validators); process.exit(0); } -fs.writeFileSync(filePath, JSON.stringify(delegates, undefined, '\t')); +fs.writeFileSync(filePath, JSON.stringify(validators, undefined, '\t')); diff --git a/protocol-specs/generators/dpos_forger_selection/delegate_weight_0_eligible_standby.json b/protocol-specs/generators/pos_forger_selection/validator_weight_0_eligible_standby.json similarity index 64% rename from protocol-specs/generators/dpos_forger_selection/delegate_weight_0_eligible_standby.json rename to protocol-specs/generators/pos_forger_selection/validator_weight_0_eligible_standby.json index c2db19f5565..6b6bf716215 100644 --- a/protocol-specs/generators/dpos_forger_selection/delegate_weight_0_eligible_standby.json +++ b/protocol-specs/generators/pos_forger_selection/validator_weight_0_eligible_standby.json @@ -2,415 +2,415 @@ "list": [ { "address": "502a9f99fda655700f573bb12dc5feb70b68fac5", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "c07f87e0f6f94c44db57bed59180b93a964eaca1", - "voteWeight": "164000000000" + "validatorWeight": "164000000000" }, { "address": "592d9bddb6949fca8accbefac58e2b7b10d81039", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "e81460e65e75b15282411bbad71dd4a142bd15fc", - "voteWeight": "28000000000" + "validatorWeight": "28000000000" }, { "address": "11d1bda3a6ff41ee2041909e1cf20db44c989ab4", - "voteWeight": "88000000000" + "validatorWeight": "88000000000" }, { "address": "6500ebf5b2fee2232b0fbf70a9a82178ba6936d7", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "address": "989f40e7501469f9179f3f541b541a146a9fad3b", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "0f0b031d66e5bbdd4cf152d46341281026d8c590", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "b6ad85aa0507825f4435ab5c7f01188027b5383d", - "voteWeight": "122000000000" + "validatorWeight": "122000000000" }, { "address": "0040eeb337b43eacb0321bd296ee44e0b7e5823f", - "voteWeight": "57000000000" + "validatorWeight": "57000000000" }, { "address": "3bf6b8d8ca837175e97974e88cc84ea591946c0e", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "6232e0e9ea69aaa85e63e334c90442cd78f7f8da", - "voteWeight": "75000000000" + "validatorWeight": "75000000000" }, { "address": "36af358e6b7e5b59a5a5223cffd0a8020d14918f", - "voteWeight": "165000000000" + "validatorWeight": "165000000000" }, { "address": "c07b8e111865283a91096f2defbfb89e2277e0d1", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "53f969143c1febfc703eaf2bc97e73ff61b57bf9", - "voteWeight": "150000000000" + "validatorWeight": "150000000000" }, { "address": "60bf1a27b784993d31ce5db92564a63d76b9ab29", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "4ef2c4e43f1669df4617dd21e499fc957f12b021", - "voteWeight": "125000000000" + "validatorWeight": "125000000000" }, { "address": "2b4105d38fdd16c36b062808c12921df7f74fb8e", - "voteWeight": "157000000000" + "validatorWeight": "157000000000" }, { "address": "180a6782853334f31dc083a7000629d1ad26d3cf", - "voteWeight": "45000000000" + "validatorWeight": "45000000000" }, { "address": "fa10e3f4c054a7f271631705021c4aaa466e40f6", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "90fd30068f32d036dc67dc7bfd74cd12ccb9b2ed", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "4891f2bbc0b03122b80634cbf56c76227544d74a", - "voteWeight": "81000000000" + "validatorWeight": "81000000000" }, { "address": "563478e9a592a5e044433e833b953ddc2b355d16", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "a75f639083b43db22558e888ca3d2fdcfbe94990", - "voteWeight": "153000000000" + "validatorWeight": "153000000000" }, { "address": "00448ec8ec5fa571be30ed437bbeb712ff224181", - "voteWeight": "127000000000" + "validatorWeight": "127000000000" }, { "address": "4cec15d36cdeda41450b542bde31e0dd02b29e0b", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "e3f728622b5974ffb3973b24f65f597bd7a93fba", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "address": "a40f58ada988427e3fa4119d944e9cb4747b07e7", - "voteWeight": "129000000000" + "validatorWeight": "129000000000" }, { "address": "619b7675b353f925064942c5567ed547a2be1029", - "voteWeight": "14000000000" + "validatorWeight": "14000000000" }, { "address": "385579592eed0f9813429a5c00c8002f11393770", - "voteWeight": "53000000000" + "validatorWeight": "53000000000" }, { "address": "5030be0afc0f61b0da53c25389e32a11d3f31883", - "voteWeight": "32000000000" + "validatorWeight": "32000000000" }, { "address": "2ef40646995156a3ff864e115d32784f7e0f23b3", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "address": "03deddfb8a0c918fd19a303347b1bacf2fa16789", - "voteWeight": "131000000000" + "validatorWeight": "131000000000" }, { "address": "7c3703247f4ccc77ba9c47b521fa809f86f564dd", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "0666adef7e532e4aa8bc17af45fd369c64819727", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "527f532eb39c9af5d062c01f054f49955186c326", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "address": "30fe6220ef930168d97108ca43aaf310ab4b984e", - "voteWeight": "39000000000" + "validatorWeight": "39000000000" }, { "address": "1bb623fcc44cd2934eb2b86f1496835bb2778a92", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "eb42c2d9dbe5df7b53e54da057bd9d250a17b8be", - "voteWeight": "12000000000" + "validatorWeight": "12000000000" }, { "address": "2d9a5adf1125371d2109ffb558f612b0dcaf012b", - "voteWeight": "152000000000" + "validatorWeight": "152000000000" }, { "address": "4d7f1ee4fb11a55d057ac1b3c21e7bc64c60db6d", - "voteWeight": "13000000000" + "validatorWeight": "13000000000" }, { "address": "f139594031418739a4cc613f230b8ce460ea02d6", - "voteWeight": "137000000000" + "validatorWeight": "137000000000" }, { "address": "601fb8f3ea396d916b0c5a8f2ed695a2fa5e5f14", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "fc304bcaeb1d2a47c0ea0b6c09f586a1e0e9ca09", - "voteWeight": "94000000000" + "validatorWeight": "94000000000" }, { "address": "4d5226e4d3a2305ea13b20a3219b1e3b4a26de30", - "voteWeight": "146000000000" + "validatorWeight": "146000000000" }, { "address": "aa525f481348895eddcd34b3fd5eabd6fb080f63", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "988b3c5dc85478387041eb2707e33a47e37fbf88", - "voteWeight": "42000000000" + "validatorWeight": "42000000000" }, { "address": "73ea6e05e36e8da58b064c7cc9ab44538945a55d", - "voteWeight": "87000000000" + "validatorWeight": "87000000000" }, { "address": "a9c0d038c7d3ec177819f81396dc69a2050b18bb", - "voteWeight": "26000000000" + "validatorWeight": "26000000000" }, { "address": "d23d7b584b5dead562eeebdc138e5dc30d62213c", - "voteWeight": "72000000000" + "validatorWeight": "72000000000" }, { "address": "2d8af8147af28cdf88dff035bb54cd08657b8abd", - "voteWeight": "44000000000" + "validatorWeight": "44000000000" }, { "address": "27b48b219868ff8fc30abee046538e9c432066b0", - "voteWeight": "1000000000" + "validatorWeight": "1000000000" }, { "address": "705b9904dd0aab6c2c7fef0d947838a29843b44f", - "voteWeight": "80000000000" + "validatorWeight": "80000000000" }, { "address": "bfcd989d3d53fdb14c16923e9ad8bebdc4ee8ba9", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "address": "ce25aac51fde4229028a0bf7bb700e82168cf921", - "voteWeight": "118000000000" + "validatorWeight": "118000000000" }, { "address": "f8025970d15978d9c5c49c01df93bb94c0fa712b", - "voteWeight": "95000000000" + "validatorWeight": "95000000000" }, { "address": "e9c29559f1017dc6e260cc9a965b7dbd20913332", - "voteWeight": "181000000000" + "validatorWeight": "181000000000" }, { "address": "ae7f56d112c1f43898b60ae2f63ab23dca585dbe", - "voteWeight": "152000000000" + "validatorWeight": "152000000000" }, { "address": "ee0b841f1b8560fced7e8c9c5a9a4399b368ef3e", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "address": "457d7c47ab28dc7334f3e3215aff6a5d65e55b67", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "75714e5916537ae59c2416eba5a6d2284d8e69be", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "0279d566343cb69fd23829b6bae6a00aca921793", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "9aae40ebe29dd6c38f4ff039ea140b11a68f93e7", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "address": "e92ce7563051f584bdad8aa1c4d8a45a94dc5e5d", - "voteWeight": "29000000000" + "validatorWeight": "29000000000" }, { "address": "7086380537676d000a5e76c97f8f41e034549d7a", - "voteWeight": "118000000000" + "validatorWeight": "118000000000" }, { "address": "5cf2d34cfa252f59d016c31327fb7f10e6127155", - "voteWeight": "87000000000" + "validatorWeight": "87000000000" }, { "address": "3ef82128dc21b0d66c082858f8d9f5c41291dd8b", - "voteWeight": "170000000000" + "validatorWeight": "170000000000" }, { "address": "79d0f9f05e89f4c6617162a2286d240a6be19303", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "address": "a91dc57c279bb3537847135eb66a68875be5419c", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "e243b0de311935974e5859f98b869b3fe0b75bab", - "voteWeight": "99000000000" + "validatorWeight": "99000000000" }, { "address": "0e5f0eb56d6f64ff94b8ac466ec3850960039e66", - "voteWeight": "35000000000" + "validatorWeight": "35000000000" }, { "address": "1aab8ee863b2c26531344b9a9823b61ebd21daed", - "voteWeight": "168000000000" + "validatorWeight": "168000000000" }, { "address": "650e527943e3b3444d2e78801ad36963dbbbe9e6", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "3564f531c8dbe767b90f244a48cf7251cd42496e", - "voteWeight": "172000000000" + "validatorWeight": "172000000000" }, { "address": "7de3e7061e9277a58db798997d8e8f3d60c58ee9", - "voteWeight": "43000000000" + "validatorWeight": "43000000000" }, { "address": "caaa0f31b585ce6780c90048a948cf10b9712dee", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "9443b0971f4d9cbf66ef2b1a1d5ac72bb8aae401", - "voteWeight": "127000000000" + "validatorWeight": "127000000000" }, { "address": "9dc8320fd22e5d69869072acb5315b16a70f9d2c", - "voteWeight": "159000000000" + "validatorWeight": "159000000000" }, { "address": "4e1006dcb1f81c612bf1bf6310990cd5126165c5", - "voteWeight": "125000000000" + "validatorWeight": "125000000000" }, { "address": "339485bbac77ff5328525310c8b92be7cd3a8941", - "voteWeight": "2000000000" + "validatorWeight": "2000000000" }, { "address": "9225ce26792b4b05c09e09816564969b903049df", - "voteWeight": "38000000000" + "validatorWeight": "38000000000" }, { "address": "c0437ae552c2968f22b71810ead9f421303533f3", - "voteWeight": "141000000000" + "validatorWeight": "141000000000" }, { "address": "3e21ed880952531745043c8d6dcd3ebe2e81ba34", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "address": "aa8b58e30c41e2678d49ac140b3c457bd67f9183", - "voteWeight": "147000000000" + "validatorWeight": "147000000000" }, { "address": "f4c3f233d5e28f399ba45cee5186997a851dc821", - "voteWeight": "183000000000" + "validatorWeight": "183000000000" }, { "address": "dfe08bd8f5df08347d791816838973e634e77e22", - "voteWeight": "123000000000" + "validatorWeight": "123000000000" }, { "address": "0b57a0a48f38e313da5a59fbf37367591b7b8951", - "voteWeight": "99000000000" + "validatorWeight": "99000000000" }, { "address": "e129ce4b91d24078d9c414949b8b361f1148c7c0", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "address": "51cc7ea6e3eceeb1ed1a6f37aa992a786b6a55e2", - "voteWeight": "27000000000" + "validatorWeight": "27000000000" }, { "address": "8491b26f247bf9a2ba36008a4b7643db1139d9de", - "voteWeight": "162000000000" + "validatorWeight": "162000000000" }, { "address": "330f04672d2f25b31d56511681a633f3ffa9153e", - "voteWeight": "139000000000" + "validatorWeight": "139000000000" }, { "address": "60bfe5d27d8879b65d136fd4e03bf4730fb02f0e", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "address": "a6b09279590c5e7fee9376a2287c8afa62a3b4c8", - "voteWeight": "138000000000" + "validatorWeight": "138000000000" }, { "address": "89a0d427632e02231ca5aa3a16250e69f476e3c2", - "voteWeight": "116000000000" + "validatorWeight": "116000000000" }, { "address": "343e29ae0f24539c5f526594e3346cfbd83425d4", - "voteWeight": "169000000000" + "validatorWeight": "169000000000" }, { "address": "8b72ec2d25e73390b4e3e6f523969d9f99fc28b9", - "voteWeight": "163000000000" + "validatorWeight": "163000000000" }, { "address": "d4f4a713f7e461bdb868c318462b81d4b4f42d53", - "voteWeight": "20000000000" + "validatorWeight": "20000000000" }, { "address": "1c58d94b2e29d4dafcfe17ca995d9005b9351934", - "voteWeight": "19000000000" + "validatorWeight": "19000000000" }, { "address": "1ca5872a985b4285b2681f669e4332537d1ef3b4", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "5f2cc15a4664c578b7482314f8b60395ab1f13b4", - "voteWeight": "49000000000" + "validatorWeight": "49000000000" }, { "address": "b16a4fabe66cfa4e52cb86dad2c85abb7bbb3f46", - "voteWeight": "79000000000" + "validatorWeight": "79000000000" }, { "address": "8fecd7acee6d40658b917edbfc2ee54011c47316", - "voteWeight": "183000000000" + "validatorWeight": "183000000000" }, { "address": "3a775a50d83c91989fe960c668dc79d23c5323c3", - "voteWeight": "140000000000" + "validatorWeight": "140000000000" } ] } diff --git a/protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_1_eligible_standby.json b/protocol-specs/generators/pos_forger_selection/validator_weight_exactly_1_eligible_standby.json similarity index 64% rename from protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_1_eligible_standby.json rename to protocol-specs/generators/pos_forger_selection/validator_weight_exactly_1_eligible_standby.json index 44dd4e4806b..899126f69ff 100644 --- a/protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_1_eligible_standby.json +++ b/protocol-specs/generators/pos_forger_selection/validator_weight_exactly_1_eligible_standby.json @@ -2,415 +2,415 @@ "list": [ { "address": "628e1b844d2495e5352158a7ef37262a2e8a4674", - "voteWeight": "18360000000000" + "validatorWeight": "18360000000000" }, { "address": "ea681fda4f913242f751344b9e9ca6abed827d6a", - "voteWeight": "2154000000000" + "validatorWeight": "2154000000000" }, { "address": "2aa91f3da5a1d91be402b73de3e1f5b5afa4e901", - "voteWeight": "4533000000000" + "validatorWeight": "4533000000000" }, { "address": "f527765b548e45cc8d9bde604dd559ed9137aa7c", - "voteWeight": "13837000000000" + "validatorWeight": "13837000000000" }, { "address": "2d168b5415598bee85475e584fdbd12469aec2fa", - "voteWeight": "1321000000000" + "validatorWeight": "1321000000000" }, { "address": "87cd1638359e4e89258d94496d9519576029ae07", - "voteWeight": "16210000000000" + "validatorWeight": "16210000000000" }, { "address": "4a170dd0c888be0d3c1ca667cf07f4f64b5f03ce", - "voteWeight": "45000000000" + "validatorWeight": "45000000000" }, { "address": "7ef294535c678618448d46fff06fabba49fddb27", - "voteWeight": "3547000000000" + "validatorWeight": "3547000000000" }, { "address": "5a105b4aff51a880ed1bf6216b78fda13153e0a2", - "voteWeight": "6084000000000" + "validatorWeight": "6084000000000" }, { "address": "df2501fa30915040fdb046848daf7da3b2c1fbe8", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "address": "90dfd2ce750a28d9e4aaad80767ccf002111bdc5", - "voteWeight": "5685000000000" + "validatorWeight": "5685000000000" }, { "address": "1ecd355500a300bb6af7d8fe30d3a50ccff3a60a", - "voteWeight": "8810000000000" + "validatorWeight": "8810000000000" }, { "address": "20b7e14d595170e61778b463e650f1e7dc9f7c53", - "voteWeight": "2625000000000" + "validatorWeight": "2625000000000" }, { "address": "ae5580f3b800d9ec1068d23d5ea7febfa6d48869", - "voteWeight": "4225000000000" + "validatorWeight": "4225000000000" }, { "address": "e77918452dfd65e116ab804fef7519702da83719", - "voteWeight": "17433000000000" + "validatorWeight": "17433000000000" }, { "address": "d9a085dc90c82331da0075f43a4ead8e8d852a0d", - "voteWeight": "5178000000000" + "validatorWeight": "5178000000000" }, { "address": "288b0d5ace9144be2b4d6b5134f32103aedc6a39", - "voteWeight": "16956000000000" + "validatorWeight": "16956000000000" }, { "address": "f536eabad6a097691bfe9b336c4fd4d9df552294", - "voteWeight": "16452000000000" + "validatorWeight": "16452000000000" }, { "address": "04508e3c1011ade4ccd814794d14ffd27f5ee3ba", - "voteWeight": "11841000000000" + "validatorWeight": "11841000000000" }, { "address": "974d81bed0bba20e0cf70c53adcfb3031f51b36b", - "voteWeight": "11242000000000" + "validatorWeight": "11242000000000" }, { "address": "2035b0dd0ea511e67cd086c84632b2657f6c477a", - "voteWeight": "1011000000000" + "validatorWeight": "1011000000000" }, { "address": "d14718c0e1219d3292663b58e67d1f9fab1c16f1", - "voteWeight": "14098000000000" + "validatorWeight": "14098000000000" }, { "address": "2237a7c978363abf85a1aed92298e0f8485ad910", - "voteWeight": "4152000000000" + "validatorWeight": "4152000000000" }, { "address": "ac66584d2063c15ebc7fe6ca4404ae4123682a7e", - "voteWeight": "2811000000000" + "validatorWeight": "2811000000000" }, { "address": "de32cfb703c129d6cb40b27cab9999958a5b36e3", - "voteWeight": "5920000000000" + "validatorWeight": "5920000000000" }, { "address": "fe47ed87e279d327322cba143bcfb0ec48aca3ee", - "voteWeight": "8547000000000" + "validatorWeight": "8547000000000" }, { "address": "317317c4b62c5d92943807f1cfdd8a54b947c6f7", - "voteWeight": "815000000000" + "validatorWeight": "815000000000" }, { "address": "b4760d02e627b12ce23984118511f6b5e0195941", - "voteWeight": "15709000000000" + "validatorWeight": "15709000000000" }, { "address": "367f9c9b716dfc89492c1294b6eb37fcce998588", - "voteWeight": "1822000000000" + "validatorWeight": "1822000000000" }, { "address": "e65049556a7570e79e9ebcc1f15500c81c033086", - "voteWeight": "13268000000000" + "validatorWeight": "13268000000000" }, { "address": "e0dbd00f1140c8883318484445c6b4c9d98d23b1", - "voteWeight": "5167000000000" + "validatorWeight": "5167000000000" }, { "address": "bc2eb6f094e2ed1d026d81c46bc3c6e64db683ce", - "voteWeight": "108000000000" + "validatorWeight": "108000000000" }, { "address": "adce62617ffa92b6b401aa467f08b728115efa32", - "voteWeight": "16467000000000" + "validatorWeight": "16467000000000" }, { "address": "b728b046c1661dde24e3f86e5d76f6767d44e80f", - "voteWeight": "4827000000000" + "validatorWeight": "4827000000000" }, { "address": "e91022974563c973d35d193c6ab7ccddd777b19c", - "voteWeight": "6640000000000" + "validatorWeight": "6640000000000" }, { "address": "9b86f87ca47e19f4494cac5355f23ad30a10b119", - "voteWeight": "3187000000000" + "validatorWeight": "3187000000000" }, { "address": "e4ca8cd3fa2d5d9d0555c3ad4f0eaa5936b4f4f8", - "voteWeight": "9736000000000" + "validatorWeight": "9736000000000" }, { "address": "766e3f5693a7448c49924de84c1c27402ffb91d6", - "voteWeight": "2068000000000" + "validatorWeight": "2068000000000" }, { "address": "f01ef62446fb1b4e830824c4b7efff323c96724d", - "voteWeight": "6104000000000" + "validatorWeight": "6104000000000" }, { "address": "e1b8a2d2c76f7643e9d5e0afd0c15a4bbe3d5082", - "voteWeight": "3211000000000" + "validatorWeight": "3211000000000" }, { "address": "e0447a74685573bc95ed2504f4905dfc572973a8", - "voteWeight": "15498000000000" + "validatorWeight": "15498000000000" }, { "address": "8f1a9213dd629e8143f92ec25dfee4b944cf00cc", - "voteWeight": "2891000000000" + "validatorWeight": "2891000000000" }, { "address": "530e6c9e40e41cfe7f5a2da7837fcb220614e045", - "voteWeight": "14812000000000" + "validatorWeight": "14812000000000" }, { "address": "d92e54965b194c2d8189800e98442b6278395358", - "voteWeight": "9433000000000" + "validatorWeight": "9433000000000" }, { "address": "befa592a7e556b5b108ce603c2181d0f848f8620", - "voteWeight": "8948000000000" + "validatorWeight": "8948000000000" }, { "address": "eb754b16af8aa3535479264b690385eb74905dd0", - "voteWeight": "10874000000000" + "validatorWeight": "10874000000000" }, { "address": "c6551d505c18b000ecec80d5bde57e53b582528f", - "voteWeight": "7822000000000" + "validatorWeight": "7822000000000" }, { "address": "145c6f5e000f95745752a080b02b91533231c4d7", - "voteWeight": "13525000000000" + "validatorWeight": "13525000000000" }, { "address": "3aa364517e3bfdd7c3ffa629228c78e1d4392cc9", - "voteWeight": "10566000000000" + "validatorWeight": "10566000000000" }, { "address": "4bdda03ae27ff959f8f80951713948073abd1e6f", - "voteWeight": "11307000000000" + "validatorWeight": "11307000000000" }, { "address": "24cf7a5700c41dba9d80d7082462b7fb6cde2153", - "voteWeight": "10581000000000" + "validatorWeight": "10581000000000" }, { "address": "399364ed48ba8ea71b1fa4b3d4d3b223f21e01a1", - "voteWeight": "7728000000000" + "validatorWeight": "7728000000000" }, { "address": "5dc38e3e86bb4b74326fe80844033b856d0b9fc5", - "voteWeight": "5679000000000" + "validatorWeight": "5679000000000" }, { "address": "a979385ce7ffefe4dbbb418d2ef4b7a45462f4a1", - "voteWeight": "16477000000000" + "validatorWeight": "16477000000000" }, { "address": "2d9ba66e0392654e2d87b0026d9429595c129425", - "voteWeight": "2369000000000" + "validatorWeight": "2369000000000" }, { "address": "8fe3f40503d7acb823aa920e34746b73d8eb175d", - "voteWeight": "1498000000000" + "validatorWeight": "1498000000000" }, { "address": "4d9b93a33dd302013dd2907df1699dbfdabf9311", - "voteWeight": "12638000000000" + "validatorWeight": "12638000000000" }, { "address": "d42fe7ad479f42196061e37ee882ec13c13fc117", - "voteWeight": "13391000000000" + "validatorWeight": "13391000000000" }, { "address": "e0722012190fe4b0be3592241631c619cd479632", - "voteWeight": "11713000000000" + "validatorWeight": "11713000000000" }, { "address": "4cb8a27d3dcb7d731c3824d3ea60181e2a4083cf", - "voteWeight": "375000000000" + "validatorWeight": "375000000000" }, { "address": "d6636eef1ad9d16f0e36b40b217693d9593a87b2", - "voteWeight": "6659000000000" + "validatorWeight": "6659000000000" }, { "address": "62f1f8c958c29efddffeb1fa52bd283c7e47369a", - "voteWeight": "12633000000000" + "validatorWeight": "12633000000000" }, { "address": "ee613ea1006893066b6f97697124b15d92cbad53", - "voteWeight": "16160000000000" + "validatorWeight": "16160000000000" }, { "address": "97b7dfddb781d062d47b37cbf4ef89a294a434a8", - "voteWeight": "5025000000000" + "validatorWeight": "5025000000000" }, { "address": "7c70bcd6267a11b559c58af621f23af7cc78447c", - "voteWeight": "11065000000000" + "validatorWeight": "11065000000000" }, { "address": "e08bbaf945dcbd00a96b01e489e0d938c52a0244", - "voteWeight": "1809000000000" + "validatorWeight": "1809000000000" }, { "address": "3f77daa4185853ebfdd2bd1d10bd88a25ea1a574", - "voteWeight": "10201000000000" + "validatorWeight": "10201000000000" }, { "address": "b131a599e743538492b008d003cad5c94e415c55", - "voteWeight": "1057000000000" + "validatorWeight": "1057000000000" }, { "address": "68368620ecb3f324ef6d38686656e3c2fe24cef6", - "voteWeight": "4243000000000" + "validatorWeight": "4243000000000" }, { "address": "304d6cd294e599028408b773ac8fa2dd0ad3ea7b", - "voteWeight": "17646000000000" + "validatorWeight": "17646000000000" }, { "address": "a5bd8083c0e727410e3695b872e539732b0be7a4", - "voteWeight": "56000000000" + "validatorWeight": "56000000000" }, { "address": "e0e8d3c869eb70ef6a802591b3eda97ed5578160", - "voteWeight": "11314000000000" + "validatorWeight": "11314000000000" }, { "address": "7eba9c3b967f45897d4a36dc0a84f377e25cf4c9", - "voteWeight": "13915000000000" + "validatorWeight": "13915000000000" }, { "address": "fe03b404fbee471aef839f025a73793f5a27e032", - "voteWeight": "8776000000000" + "validatorWeight": "8776000000000" }, { "address": "5c0ed59671441e00ce5b411a585eb927c7c69a75", - "voteWeight": "11621000000000" + "validatorWeight": "11621000000000" }, { "address": "8ad7b7462c66da4d4f35f800480bcf643bbf34e7", - "voteWeight": "3933000000000" + "validatorWeight": "3933000000000" }, { "address": "61a4d0d93308d01e4b31df1ca54ffb6b37295cf8", - "voteWeight": "3097000000000" + "validatorWeight": "3097000000000" }, { "address": "abdc8f6bbda5591c3b9737c177b77d2a2a2d325e", - "voteWeight": "11477000000000" + "validatorWeight": "11477000000000" }, { "address": "faf2d8a822360844888f8213206fd8d9e8b221b8", - "voteWeight": "2997000000000" + "validatorWeight": "2997000000000" }, { "address": "3e677ca70338e5c0aa2b6d9a9d7dc9650bd8c44b", - "voteWeight": "9270000000000" + "validatorWeight": "9270000000000" }, { "address": "b51285831e2135818b06fd62fe82d18a11669dd7", - "voteWeight": "4955000000000" + "validatorWeight": "4955000000000" }, { "address": "b7a1902577f6c164decad22b085ba590e23aaf04", - "voteWeight": "4100000000000" + "validatorWeight": "4100000000000" }, { "address": "dbd9c2a72f2bfdc3e18ddd50aa2bed4b38345c6b", - "voteWeight": "3738000000000" + "validatorWeight": "3738000000000" }, { "address": "77d14cb16ff98eb043e2a92a0f9ad91052759c52", - "voteWeight": "12405000000000" + "validatorWeight": "12405000000000" }, { "address": "d5c0efd0cb4e306f4a37235e5464fc3a6307e016", - "voteWeight": "10956000000000" + "validatorWeight": "10956000000000" }, { "address": "4e6b2f6476cae1fc92b0a261d8a635676d3f678b", - "voteWeight": "1634000000000" + "validatorWeight": "1634000000000" }, { "address": "24b45ef2d6593117868e37e6e4f011de8c75e5c4", - "voteWeight": "1055000000000" + "validatorWeight": "1055000000000" }, { "address": "c1676ffd296e4c6ab5c903312897876aca143763", - "voteWeight": "11759000000000" + "validatorWeight": "11759000000000" }, { "address": "99b61fb373c35bbc6a05b50e30b9a3653a3cc019", - "voteWeight": "16087000000000" + "validatorWeight": "16087000000000" }, { "address": "ee715889a8f057fe1a74e7c54f253aeea393d9ab", - "voteWeight": "7520000000000" + "validatorWeight": "7520000000000" }, { "address": "f66424613759e8901d0997080eec173c979fc37c", - "voteWeight": "2271000000000" + "validatorWeight": "2271000000000" }, { "address": "74139d6d04842dae14c8b01c4b78667a6481973b", - "voteWeight": "14132000000000" + "validatorWeight": "14132000000000" }, { "address": "33904bda543f397cf396d3456ad9d17e657c2ad6", - "voteWeight": "17087000000000" + "validatorWeight": "17087000000000" }, { "address": "2cd7ce77e8d7e9ae3c04ee6ddca8a72b4eb7ecf9", - "voteWeight": "15547000000000" + "validatorWeight": "15547000000000" }, { "address": "f985a1b879b1316ced651046ed9381da2afb4431", - "voteWeight": "8656000000000" + "validatorWeight": "8656000000000" }, { "address": "a1cecc24e324b290f0f7a722a8b117cb20a63821", - "voteWeight": "162000000000" + "validatorWeight": "162000000000" }, { "address": "06eb1d23ed916d948d177355ad6628e0a75d3291", - "voteWeight": "13094000000000" + "validatorWeight": "13094000000000" }, { "address": "ad46109e73ce971c450f77f86bfd7a992292766a", - "voteWeight": "13523000000000" + "validatorWeight": "13523000000000" }, { "address": "85086013da8b6bb2449d7d35e362d849ad1b41ca", - "voteWeight": "1375000000000" + "validatorWeight": "1375000000000" }, { "address": "8a9d6c833f2539efb56e883c456de51c50289d80", - "voteWeight": "1066000000000" + "validatorWeight": "1066000000000" }, { "address": "0633c034d5e5e160fb464722b0a3c26974649336", - "voteWeight": "1006000000000" + "validatorWeight": "1006000000000" }, { "address": "94bb28a30888425965a664972ec90b7460b13029", - "voteWeight": "3887000000000" + "validatorWeight": "3887000000000" }, { "address": "72189094dffeb994cae9eee06d71638f96c381fd", - "voteWeight": "2000000000" + "validatorWeight": "2000000000" } ] } diff --git a/protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_2_eligible_standby.json b/protocol-specs/generators/pos_forger_selection/validator_weight_exactly_2_eligible_standby.json similarity index 63% rename from protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_2_eligible_standby.json rename to protocol-specs/generators/pos_forger_selection/validator_weight_exactly_2_eligible_standby.json index c4589e45239..63484b08273 100644 --- a/protocol-specs/generators/dpos_forger_selection/delegate_weight_exactly_2_eligible_standby.json +++ b/protocol-specs/generators/pos_forger_selection/validator_weight_exactly_2_eligible_standby.json @@ -2,415 +2,415 @@ "list": [ { "address": "974220530fbc7fe9a7ae264291d100ccb0f31995", - "voteWeight": "4417000000000" + "validatorWeight": "4417000000000" }, { "address": "ce2f23f3a64f98d047b0ebf95abc494e756862da", - "voteWeight": "3193000000000" + "validatorWeight": "3193000000000" }, { "address": "8219a1280139782dca3e0a23276bbcf1fc51e3d7", - "voteWeight": "3488000000000" + "validatorWeight": "3488000000000" }, { "address": "9cefd80238c85da98d2b6223b01d081df9a44220", - "voteWeight": "10435000000000" + "validatorWeight": "10435000000000" }, { "address": "d0bb81d6d7dd2ebf7d552de2442ab2b63e721c77", - "voteWeight": "15295000000000" + "validatorWeight": "15295000000000" }, { "address": "86c9ae659019ce0bf03e930ef63c841c3497b8be", - "voteWeight": "13083000000000" + "validatorWeight": "13083000000000" }, { "address": "8014de0219a3a7daba0e39cb86abf4f0bef41890", - "voteWeight": "7638000000000" + "validatorWeight": "7638000000000" }, { "address": "495abf615560748860623ae79c9d363ce2cdd350", - "voteWeight": "13569000000000" + "validatorWeight": "13569000000000" }, { "address": "a4b641f30212148d7f8b01d712df26693fb3a3b1", - "voteWeight": "10160000000000" + "validatorWeight": "10160000000000" }, { "address": "ccc37a8265016dc99fa4c9ecaca5c1ffd0f96d2e", - "voteWeight": "2886000000000" + "validatorWeight": "2886000000000" }, { "address": "8965ce2863a1e0bb05a31dafea51943eb88c3738", - "voteWeight": "6211000000000" + "validatorWeight": "6211000000000" }, { "address": "5fe743fbf6693fcbfcac621fb5eb31b5ced441e9", - "voteWeight": "14093000000000" + "validatorWeight": "14093000000000" }, { "address": "f19958a6aa1a0ada54d2cbb89791d0976d26a874", - "voteWeight": "12805000000000" + "validatorWeight": "12805000000000" }, { "address": "04be24cdb49d27ce6f570ee17524f2ccd308950f", - "voteWeight": "12199000000000" + "validatorWeight": "12199000000000" }, { "address": "b36e8e489476997f96f723b99e488a498a4675d7", - "voteWeight": "2334000000000" + "validatorWeight": "2334000000000" }, { "address": "1927feb0515fcfb9c739eb081e8c1df94ff0e1e2", - "voteWeight": "7683000000000" + "validatorWeight": "7683000000000" }, { "address": "620bc0927ac8ac4f58e89cdef6d2df44ae0b7a04", - "voteWeight": "8793000000000" + "validatorWeight": "8793000000000" }, { "address": "8f111ef7a4ed4332b20d4ac13770a475e63c20e0", - "voteWeight": "9205000000000" + "validatorWeight": "9205000000000" }, { "address": "90fde7da68aca929f2c2373fbc891198c8f46869", - "voteWeight": "5918000000000" + "validatorWeight": "5918000000000" }, { "address": "a177d9508061c67a502cda20afd5e1019b8e0320", - "voteWeight": "3162000000000" + "validatorWeight": "3162000000000" }, { "address": "739439fa9ca7f03194683babfb72dc6856fe55be", - "voteWeight": "16242000000000" + "validatorWeight": "16242000000000" }, { "address": "671a35f220419f9b778abbc59763396a096a6b7f", - "voteWeight": "12985000000000" + "validatorWeight": "12985000000000" }, { "address": "deacb26855aefd6c7c590132a5a6b833761f170b", - "voteWeight": "4894000000000" + "validatorWeight": "4894000000000" }, { "address": "c956d6b3a39ea9adab2aeac2c9572c2d34270c3c", - "voteWeight": "18295000000000" + "validatorWeight": "18295000000000" }, { "address": "24041fdbe29ddd1a8f5e0c6df83a4a0d16d7cfd8", - "voteWeight": "9109000000000" + "validatorWeight": "9109000000000" }, { "address": "0090c75fd90fe7ff9010320b1d636d779a6d8080", - "voteWeight": "18265000000000" + "validatorWeight": "18265000000000" }, { "address": "0f3d47eef61a934021447234e63b2f47f982d065", - "voteWeight": "1056000000000" + "validatorWeight": "1056000000000" }, { "address": "0f862ce596471f880b87368b2423437b66a5b14f", - "voteWeight": "11570000000000" + "validatorWeight": "11570000000000" }, { "address": "df5d69d3621841d539a967800ed2e640538d32af", - "voteWeight": "3053000000000" + "validatorWeight": "3053000000000" }, { "address": "1663aa8edaa4945101475d7c1266b3ecaefd25c7", - "voteWeight": "8028000000000" + "validatorWeight": "8028000000000" }, { "address": "1c0a9695190d6acc5cd3f9de5bc9e6d4efd0b2c8", - "voteWeight": "11847000000000" + "validatorWeight": "11847000000000" }, { "address": "ecf35e39bf5d519f62ecce5d8eab2cb90b01443c", - "voteWeight": "9661000000000" + "validatorWeight": "9661000000000" }, { "address": "d31543f307b8122b19e331440d5914422fd639aa", - "voteWeight": "1835000000000" + "validatorWeight": "1835000000000" }, { "address": "35223a42f4129a26e4e167d057bb03a248222a06", - "voteWeight": "14602000000000" + "validatorWeight": "14602000000000" }, { "address": "0b9fa3509216032958fddcf27ba4d96db9774144", - "voteWeight": "15394000000000" + "validatorWeight": "15394000000000" }, { "address": "724ef2b4357cd1e5c9990339db68e589d74f8743", - "voteWeight": "7636000000000" + "validatorWeight": "7636000000000" }, { "address": "322b2129fa0572383a24fa6b7c0b92f7f731a201", - "voteWeight": "14607000000000" + "validatorWeight": "14607000000000" }, { "address": "2e129a40ff1ceb05c3661b5393bc2349ae66712f", - "voteWeight": "4851000000000" + "validatorWeight": "4851000000000" }, { "address": "b02c6e5c0495673d972ddfa091b8880f500a7d03", - "voteWeight": "17437000000000" + "validatorWeight": "17437000000000" }, { "address": "51663c65345019ad678e199636a1ca4f42a166da", - "voteWeight": "6108000000000" + "validatorWeight": "6108000000000" }, { "address": "df1e39039d11104dcdc868817965d28658e5e7f1", - "voteWeight": "4442000000000" + "validatorWeight": "4442000000000" }, { "address": "ac0bc374f43ffc437fe0295672186f0fa71eca14", - "voteWeight": "13565000000000" + "validatorWeight": "13565000000000" }, { "address": "c7f36f6f33c63eb4b18791eecaf045c27beddb0d", - "voteWeight": "695000000000" + "validatorWeight": "695000000000" }, { "address": "f3b0144d1b062c808ef1ca7e10fa5902688c1515", - "voteWeight": "16183000000000" + "validatorWeight": "16183000000000" }, { "address": "fad140a0eb35908a7931ca3935911a3cea21d817", - "voteWeight": "12652000000000" + "validatorWeight": "12652000000000" }, { "address": "355b5b39a85eda7097f704de3d2fdd59dca3fbb5", - "voteWeight": "12619000000000" + "validatorWeight": "12619000000000" }, { "address": "7a0d6bc8d4ab70312dc47e737fc1fb26d8eb6ab4", - "voteWeight": "5970000000000" + "validatorWeight": "5970000000000" }, { "address": "80677764c610369f08189ac643f4f3a0ab6dbd8a", - "voteWeight": "17766000000000" + "validatorWeight": "17766000000000" }, { "address": "95a419546a925b8ca10b3c21a88150a149d521c1", - "voteWeight": "17106000000000" + "validatorWeight": "17106000000000" }, { "address": "288afbad7ded1b83b9f736b5946a670e38d4a9bc", - "voteWeight": "1662000000000" + "validatorWeight": "1662000000000" }, { "address": "9998ea6a60bf3f68871c4add8242a62cb08b6eeb", - "voteWeight": "9707000000000" + "validatorWeight": "9707000000000" }, { "address": "9166ef6615054219a4691362bdd215e06810d35d", - "voteWeight": "16887000000000" + "validatorWeight": "16887000000000" }, { "address": "0c54702ecec15b9a59d842b4385bec7c43695376", - "voteWeight": "306700000000" + "validatorWeight": "306700000000" }, { "address": "9fc348ae95a35796be2424a50ea77fc3e2c357ba", - "voteWeight": "14996000000000" + "validatorWeight": "14996000000000" }, { "address": "1be67cd8fc624e63767e7074e0145d16e07a571c", - "voteWeight": "2749000000000" + "validatorWeight": "2749000000000" }, { "address": "5d694b5246a565cdeebc8bd9e09c916657f6a5dc", - "voteWeight": "133400000000" + "validatorWeight": "133400000000" }, { "address": "c7523d8f8540442bfdf6e1a1127d9e71eda4bec5", - "voteWeight": "6899000000000" + "validatorWeight": "6899000000000" }, { "address": "0cdec38828e14d6aa1badb069c9619ce741def53", - "voteWeight": "5904000000000" + "validatorWeight": "5904000000000" }, { "address": "573f50430032f249759a3e6f0aa6bfcee00e68f4", - "voteWeight": "5684000000000" + "validatorWeight": "5684000000000" }, { "address": "c0c2cfebe0f5692fe27614e63314a1f5173bac90", - "voteWeight": "8035000000000" + "validatorWeight": "8035000000000" }, { "address": "d6796acc8e859fc5125b347d0d8f8ff26e00757e", - "voteWeight": "8367000000000" + "validatorWeight": "8367000000000" }, { "address": "10911ed28ac81dd8a378d380f79f37486cf59956", - "voteWeight": "6260000000000" + "validatorWeight": "6260000000000" }, { "address": "5daacd2f506f5a3611fd9548e7b24326d95a92dd", - "voteWeight": "15317000000000" + "validatorWeight": "15317000000000" }, { "address": "47b5b2b5036084a98df339c4b7985ee3fa86517b", - "voteWeight": "741000000000" + "validatorWeight": "741000000000" }, { "address": "ded706b137d7a9db82050c0a7a615e5a38341253", - "voteWeight": "4521000000000" + "validatorWeight": "4521000000000" }, { "address": "4aab9f8e831f5e7f8362e8cadb225088d4f80f91", - "voteWeight": "15277000000000" + "validatorWeight": "15277000000000" }, { "address": "bd687e0c559ae6906c88640591cfe9f93e135218", - "voteWeight": "11917000000000" + "validatorWeight": "11917000000000" }, { "address": "836405486dca3b2694686a01249f2144cb94a13b", - "voteWeight": "11086000000000" + "validatorWeight": "11086000000000" }, { "address": "a1d55de4e27db7e8bdf60daf394f7233d0477c5a", - "voteWeight": "7444000000000" + "validatorWeight": "7444000000000" }, { "address": "cefdcfc2bdac5884e4d35cbd58c83535c01997b0", - "voteWeight": "16271000000000" + "validatorWeight": "16271000000000" }, { "address": "b8cf37d1f7300aa5a24bf159e4ab8c47648fb1fa", - "voteWeight": "10163000000000" + "validatorWeight": "10163000000000" }, { "address": "c23a3f47418d8d29440b243c5a5110ab00d60169", - "voteWeight": "446000000000" + "validatorWeight": "446000000000" }, { "address": "5ea3e0b205c766e5dda0228dad8a87da7b4bfb06", - "voteWeight": "7353000000000" + "validatorWeight": "7353000000000" }, { "address": "bc05e3ac94a0cbdcdbd96d5a822e5d1fa5773a77", - "voteWeight": "4016000000000" + "validatorWeight": "4016000000000" }, { "address": "e54f55ef2b34fcddedea1e441e8990f3e30578fa", - "voteWeight": "8082000000000" + "validatorWeight": "8082000000000" }, { "address": "3ab2d19af2bc57ea9444a0aecc69ab22afbebd42", - "voteWeight": "8758000000000" + "validatorWeight": "8758000000000" }, { "address": "69dc1f4a5e56039294cd0e6bae96fd42e30cac02", - "voteWeight": "1978000000000" + "validatorWeight": "1978000000000" }, { "address": "f615adade9f0ac313e06c2455b3fcd999ed499ca", - "voteWeight": "9645000000000" + "validatorWeight": "9645000000000" }, { "address": "3d829d2c2c71668d5902ca24478b635da7f15a4a", - "voteWeight": "13466000000000" + "validatorWeight": "13466000000000" }, { "address": "1d4f568f1c871cbade7c1926fb7e838b9984eaa2", - "voteWeight": "6586000000000" + "validatorWeight": "6586000000000" }, { "address": "928719b9b1ba2642f3577d2c57123fc8f45d9309", - "voteWeight": "231000000000" + "validatorWeight": "231000000000" }, { "address": "333899e5ed7cd5741e82e71b0b6b418a2d26fdc5", - "voteWeight": "871000000000" + "validatorWeight": "871000000000" }, { "address": "fafbea758f17d2e6912f51b0b10690abd5e9627e", - "voteWeight": "6091000000000" + "validatorWeight": "6091000000000" }, { "address": "d73b77dfc710f5ec0ca5710af1a1c15336aa04f1", - "voteWeight": "8901000000000" + "validatorWeight": "8901000000000" }, { "address": "eac9942e59efb18cdd7298fc10e29b58356b3c02", - "voteWeight": "17059000000000" + "validatorWeight": "17059000000000" }, { "address": "7b2459ff0c1e7a80efb2ae6b69f4b5f6b1e8a5d4", - "voteWeight": "2190000000000" + "validatorWeight": "2190000000000" }, { "address": "a85204d9a4d689b042b54a12b1e8725586e113c3", - "voteWeight": "4709000000000" + "validatorWeight": "4709000000000" }, { "address": "56a95065ffc927f7ff581a68efa145c5ad8b240e", - "voteWeight": "17590000000000" + "validatorWeight": "17590000000000" }, { "address": "344225995799ec5a9974782a0f4eb15e2d3aa355", - "voteWeight": "7245000000000" + "validatorWeight": "7245000000000" }, { "address": "a57c955b95224adf1f54521d625a0ec6658122a8", - "voteWeight": "14475000000000" + "validatorWeight": "14475000000000" }, { "address": "de5a59881eb5e288d8d0c6913e9091ea378b6877", - "voteWeight": "8959000000000" + "validatorWeight": "8959000000000" }, { "address": "b0131ed02d6bf4fe1addb6f880ed48115b34b23b", - "voteWeight": "2060000000000" + "validatorWeight": "2060000000000" }, { "address": "ab3dc0112ed7f31f7eabba658f5d9b847038ccca", - "voteWeight": "6748000000000" + "validatorWeight": "6748000000000" }, { "address": "d274f89a763e1cd79ac09a2d8b370a9e3fc5a46e", - "voteWeight": "13781000000000" + "validatorWeight": "13781000000000" }, { "address": "2b2f222ebb9fb8550b05a5d12325cda08035441a", - "voteWeight": "4832000000000" + "validatorWeight": "4832000000000" }, { "address": "3549354f43d94fe8135b06e24935d3ff490a6dac", - "voteWeight": "6353000000000" + "validatorWeight": "6353000000000" }, { "address": "66e0838ecb69da082687c852f32db32602541bf3", - "voteWeight": "8393000000000" + "validatorWeight": "8393000000000" }, { "address": "8e7d24a52160ad7a65c76d5268785553707c6666", - "voteWeight": "1170000000000" + "validatorWeight": "1170000000000" }, { "address": "bb0b67c015f4e9624444d8428f6b3a4def11d9a4", - "voteWeight": "852000000000" + "validatorWeight": "852000000000" }, { "address": "f4deb58061c4e5ea1e9167083c9c6d0f73df630a", - "voteWeight": "13785000000000" + "validatorWeight": "13785000000000" }, { "address": "0c7d4406be25bd608ea244180a494214a7630c55", - "voteWeight": "10409000000000" + "validatorWeight": "10409000000000" }, { "address": "fbdd3475d0a8fc0e79b12d0b3ee79ad795c29925", - "voteWeight": "110000000000" + "validatorWeight": "110000000000" }, { "address": "854e0ef4c5474884f45bddc71c46eccc63d93989", - "voteWeight": "13823000000000" + "validatorWeight": "13823000000000" } ] } diff --git a/protocol-specs/generators/dpos_forger_selection/delegate_weight_less_than_103.json b/protocol-specs/generators/pos_forger_selection/validator_weight_less_than_103.json similarity index 64% rename from protocol-specs/generators/dpos_forger_selection/delegate_weight_less_than_103.json rename to protocol-specs/generators/pos_forger_selection/validator_weight_less_than_103.json index e15b56e3beb..252fb3a309a 100644 --- a/protocol-specs/generators/dpos_forger_selection/delegate_weight_less_than_103.json +++ b/protocol-specs/generators/pos_forger_selection/validator_weight_less_than_103.json @@ -2,203 +2,203 @@ "list": [ { "address": "bf2e956611a4bd24e7dabc6c66d243327a87028f", - "voteWeight": "179000000000" + "validatorWeight": "179000000000" }, { "address": "e6746edf586bb2a64d977add677afaebed7730e3", - "voteWeight": "138000000000" + "validatorWeight": "138000000000" }, { "address": "ea50b241deee288208800f1ab0ae9940fbde54db", - "voteWeight": "31000000000" + "validatorWeight": "31000000000" }, { "address": "dbe5a42f398594fda7c44a9d2e27d00ad9a18452", - "voteWeight": "95000000000" + "validatorWeight": "95000000000" }, { "address": "37a5bbc6c5015109030177184dbe51c2ce4d420b", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "address": "626d9f43c10c2013533efc7ad4f694394f5dc376", - "voteWeight": "44000000000" + "validatorWeight": "44000000000" }, { "address": "7b381c99a14f747760275eee062ab14bdc280614", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "d6b3b4cb1019ad8c72f99aedda97a2c17d1fa7d3", - "voteWeight": "119000000000" + "validatorWeight": "119000000000" }, { "address": "44bdbe5c8061b667c6bd576570df691a009e6a52", - "voteWeight": "27000000000" + "validatorWeight": "27000000000" }, { "address": "fa861e99086b7d76f3bdc7a3ba841d6c856b9aad", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "17f7b895dad086016bad9c39c4e13735cd283984", - "voteWeight": "155000000000" + "validatorWeight": "155000000000" }, { "address": "8e9f358beff811cd268be0549e369b5fcc779c0d", - "voteWeight": "61000000000" + "validatorWeight": "61000000000" }, { "address": "3be0308d4d16dc304196089a5b6709ce0d054ba3", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "address": "a4661b14a4da0ac2544438f54084ea8af7d98242", - "voteWeight": "57000000000" + "validatorWeight": "57000000000" }, { "address": "00c7ae5c0aab5c3eb2d9854e033fba31e369818a", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "77b01ed6147966a6dd065ca1b4f61b4467db26e0", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "e9b60b7e4b4dc39bc08afaac67b5cf9d2c1fdd15", - "voteWeight": "65000000000" + "validatorWeight": "65000000000" }, { "address": "7221cbc43718ab0785533b3e272e972f66311e1a", - "voteWeight": "54000000000" + "validatorWeight": "54000000000" }, { "address": "f2b3e5c9f8490a25d8fa4247f3cdefd3e1a0f38b", - "voteWeight": "163000000000" + "validatorWeight": "163000000000" }, { "address": "83b29499fe12a928b18e945d74bfbc5d1325c480", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "address": "1ec754b81be4ec39a488a493358273c0772960ee", - "voteWeight": "60000000000" + "validatorWeight": "60000000000" }, { "address": "2a58066b75bafc98964cef5d355b87f75860103e", - "voteWeight": "180000000000" + "validatorWeight": "180000000000" }, { "address": "b1d67d379afdd4a3c96db5dac19436b795da3fed", - "voteWeight": "4000000000" + "validatorWeight": "4000000000" }, { "address": "f85c5f7b404e0a1a19a11cc4d17a56829b5ada64", - "voteWeight": "7000000000" + "validatorWeight": "7000000000" }, { "address": "72cfbf0931284ea351814ce9ee986dd38b4e235f", - "voteWeight": "115000000000" + "validatorWeight": "115000000000" }, { "address": "10d55530ff1ad18004aae226f15e166b5a2b3cda", - "voteWeight": "16000000000" + "validatorWeight": "16000000000" }, { "address": "e0ccccc3a4d47eb570397059c61d2524184a3e66", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "address": "8f21e33bd4b41b6d5c6c43fed305ebd22f4a3b32", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "a223e0ef9022e57630db6c81b08b10e03e9d46f6", - "voteWeight": "17000000000" + "validatorWeight": "17000000000" }, { "address": "deb79e414ec4206de74366df5aa296b639723793", - "voteWeight": "148000000000" + "validatorWeight": "148000000000" }, { "address": "6cbb6ee8151ad26f09469b449714a202f0fe061a", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "address": "8ccb390c0c6351e5f73bc23fe9fcfa81a1935b19", - "voteWeight": "123000000000" + "validatorWeight": "123000000000" }, { "address": "83827bfefdacbe00d78371c610ea37c20883f9d3", - "voteWeight": "48000000000" + "validatorWeight": "48000000000" }, { "address": "2051c041d5474754d90e3577577c1dd06f832cd0", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "2d6a13814cbca1b482be23c4dbd937491b5dd9da", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "address": "be995e03cbf2569bea858ee3ed418142884b0bb7", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "address": "176554635df1533c9c8232bf1db56c7875438afb", - "voteWeight": "136000000000" + "validatorWeight": "136000000000" }, { "address": "fa322aa8a86ae7c753434f6a2a4e6e8aefe86846", - "voteWeight": "64000000000" + "validatorWeight": "64000000000" }, { "address": "46dcc595281858061189097fe9685fc693a65fb9", - "voteWeight": "62000000000" + "validatorWeight": "62000000000" }, { "address": "f4e60b57dcf2a578d19d4d8cc972ce77d170d5fa", - "voteWeight": "164000000000" + "validatorWeight": "164000000000" }, { "address": "2421ad6e3dd3156dbfd03c2b55c302a9e726a751", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "address": "492ce85d0f9bab0a1a7cfd22075ca4ed2db1dc42", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "address": "51e345f7b430ae930699ee1637b9f3adecb93915", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "address": "462897799043bbd7d545cd19ff17085bd3f2540f", - "voteWeight": "166000000000" + "validatorWeight": "166000000000" }, { "address": "d01bc3db7dfac7bbcb7a88a2adc915dc985bd935", - "voteWeight": "73000000000" + "validatorWeight": "73000000000" }, { "address": "19d76c9f32d05d6f406b4fc0c6241102609e8f48", - "voteWeight": "156000000000" + "validatorWeight": "156000000000" }, { "address": "308c56b6847b6c8d6132da412cfe1e1d89ffcb32", - "voteWeight": "124000000000" + "validatorWeight": "124000000000" }, { "address": "24b2a6b0a1fb01d9bccf5bb667d3a147fbd7de20", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "address": "02f4ecc46c2fdf70cfb37d519d968a20217b90ce", - "voteWeight": "5000000000" + "validatorWeight": "5000000000" }, { "address": "96bb07ae3b8114d26e58be82aa31b15a1eb6db09", - "voteWeight": "178000000000" + "validatorWeight": "178000000000" } ] } diff --git a/protocol-specs/generators/dpos_forger_selection/delegate_weight_more_than_2_eligible_standby.json b/protocol-specs/generators/pos_forger_selection/validator_weight_more_than_2_eligible_standby.json similarity index 63% rename from protocol-specs/generators/dpos_forger_selection/delegate_weight_more_than_2_eligible_standby.json rename to protocol-specs/generators/pos_forger_selection/validator_weight_more_than_2_eligible_standby.json index d136b6b403f..f7764a95cd7 100644 --- a/protocol-specs/generators/dpos_forger_selection/delegate_weight_more_than_2_eligible_standby.json +++ b/protocol-specs/generators/pos_forger_selection/validator_weight_more_than_2_eligible_standby.json @@ -2,603 +2,603 @@ "list": [ { "address": "b8982f66903a6bfa5d6994c08ddf97707200d316", - "voteWeight": "2130000000000" + "validatorWeight": "2130000000000" }, { "address": "f1b5b0c9d35957ca463b817467782ffa5d2e6945", - "voteWeight": "5304000000000" + "validatorWeight": "5304000000000" }, { "address": "a47e822534cc01a960b0c61407a02b5a55b84cd9", - "voteWeight": "7295000000000" + "validatorWeight": "7295000000000" }, { "address": "40b482f0e92773cf718bb0e9526b3fb2a35f86a4", - "voteWeight": "4140000000000" + "validatorWeight": "4140000000000" }, { "address": "f5022fb85925d1303c0071d1a8c42ec8e70e2552", - "voteWeight": "10556000000000" + "validatorWeight": "10556000000000" }, { "address": "68ae286f34ed63063cc8d640cf02d4351673cea0", - "voteWeight": "4467000000000" + "validatorWeight": "4467000000000" }, { "address": "457d22cdab02c32829f034364488b943edda602b", - "voteWeight": "11790000000000" + "validatorWeight": "11790000000000" }, { "address": "b2eba1f6ae9bc5f117d5e468568fc5a659d02c44", - "voteWeight": "14837000000000" + "validatorWeight": "14837000000000" }, { "address": "012252a13c9fb7117dc0adefa8c908a95a967598", - "voteWeight": "17861000000000" + "validatorWeight": "17861000000000" }, { "address": "68034297eb7b832c7b17f528d813c3213d670d23", - "voteWeight": "17967000000000" + "validatorWeight": "17967000000000" }, { "address": "3e2214ac94000e7c516838872827c7bc168237e2", - "voteWeight": "14571000000000" + "validatorWeight": "14571000000000" }, { "address": "4c67218a8afcf02e9e8b73d61b6259eab3f615ed", - "voteWeight": "13057000000000" + "validatorWeight": "13057000000000" }, { "address": "e8a04f6b9ca288e13c75cefc28d9d3843bfdb30c", - "voteWeight": "9619000000000" + "validatorWeight": "9619000000000" }, { "address": "c6cc69c2495231daf3fc3e71fe1416b3502a3717", - "voteWeight": "3510000000000" + "validatorWeight": "3510000000000" }, { "address": "bd5e5423daf7d947f263721b5c04e3fb0efea832", - "voteWeight": "8213000000000" + "validatorWeight": "8213000000000" }, { "address": "54bc83371d60f5a573ef623d654bedb2625208c1", - "voteWeight": "10353000000000" + "validatorWeight": "10353000000000" }, { "address": "6370d5921c876c1cd01b97344b3516e1b97614d1", - "voteWeight": "2087000000000" + "validatorWeight": "2087000000000" }, { "address": "d1afd2c87d15d0ed83a55fab3443e21272ac17a9", - "voteWeight": "14269000000000" + "validatorWeight": "14269000000000" }, { "address": "fa8969a94c6ba2842a8ef6371ab35637d1330539", - "voteWeight": "12138000000000" + "validatorWeight": "12138000000000" }, { "address": "3e89fe8b155c4128ee943b368d4374cfa7658722", - "voteWeight": "10879000000000" + "validatorWeight": "10879000000000" }, { "address": "0622e8fde13558fe526a51b2850e15b969518fa0", - "voteWeight": "1509000000000" + "validatorWeight": "1509000000000" }, { "address": "eac74c72ad9c5450903095e2eaf0837a327e931a", - "voteWeight": "16638000000000" + "validatorWeight": "16638000000000" }, { "address": "4d11d0774ec4f3bfe5f59f868a2e4bdd04bd6619", - "voteWeight": "13919000000000" + "validatorWeight": "13919000000000" }, { "address": "d0bd2f894b93ad053c3b3d2daffd342f9e7ec4f8", - "voteWeight": "14703000000000" + "validatorWeight": "14703000000000" }, { "address": "cdaf5ba88dcf81fcc00598b16c13a9d54775614b", - "voteWeight": "2252000000000" + "validatorWeight": "2252000000000" }, { "address": "15576ebac2097988ecdfdfd755697b44e1e8540d", - "voteWeight": "10464000000000" + "validatorWeight": "10464000000000" }, { "address": "b33b01ee876b248f22af6173f198d1d06a8b4e0b", - "voteWeight": "16748000000000" + "validatorWeight": "16748000000000" }, { "address": "15a1a4cf3bc75aeeb50614814d2b812627dd58f1", - "voteWeight": "1982000000000" + "validatorWeight": "1982000000000" }, { "address": "0fa290a0ea4dbc697ca93cb3d27f9ccf5e602a0b", - "voteWeight": "1264000000000" + "validatorWeight": "1264000000000" }, { "address": "bc98f22d583a341e6681278e8dc64cb57188cafb", - "voteWeight": "14571000000000" + "validatorWeight": "14571000000000" }, { "address": "e2b37b80ccda065d10777eef5f825ccc9bf95c53", - "voteWeight": "6422000000000" + "validatorWeight": "6422000000000" }, { "address": "b5c96c3a90c3bb99de174172b1f234928cdb6591", - "voteWeight": "8188000000000" + "validatorWeight": "8188000000000" }, { "address": "513900715c34c9c6cd3e430b1a71cd06e16700c3", - "voteWeight": "325000000000" + "validatorWeight": "325000000000" }, { "address": "95ac7fe1e86eca80d97826a1a5a3e7641b90cde9", - "voteWeight": "11800000000000" + "validatorWeight": "11800000000000" }, { "address": "18863071de0a7433a36f02c99e125163f19d17e2", - "voteWeight": "13791000000000" + "validatorWeight": "13791000000000" }, { "address": "d152405521972e71abed81e4d5815667baea1abb", - "voteWeight": "11369000000000" + "validatorWeight": "11369000000000" }, { "address": "5c1166bbc53856648c87580b49644bbab9e8ce4b", - "voteWeight": "7515000000000" + "validatorWeight": "7515000000000" }, { "address": "e080daeb01e6fd76e76497a9a109d0dcb693356e", - "voteWeight": "11882000000000" + "validatorWeight": "11882000000000" }, { "address": "d2904952a51e21a8cb2592eda94e581ed4540385", - "voteWeight": "10332000000000" + "validatorWeight": "10332000000000" }, { "address": "67013324918faf245cf455d0858ba4e293116d7b", - "voteWeight": "3402000000000" + "validatorWeight": "3402000000000" }, { "address": "f84b4aead893576f4ff584b33a86eb72b806e9c7", - "voteWeight": "3398000000000" + "validatorWeight": "3398000000000" }, { "address": "a2b416fc81dd4d36265402500c5d757db29023c2", - "voteWeight": "5374000000000" + "validatorWeight": "5374000000000" }, { "address": "4569135da2bb49090f1882ab6fc87e9c1408531b", - "voteWeight": "17927000000000" + "validatorWeight": "17927000000000" }, { "address": "730a8a554d21f79e7bb04d635ea42ecc7058d181", - "voteWeight": "15968000000000" + "validatorWeight": "15968000000000" }, { "address": "5b73e146f561878f3e86265a959b570e722f9222", - "voteWeight": "3991000000000" + "validatorWeight": "3991000000000" }, { "address": "19a14533349d5897eb4c47bf3c13ff04a348ee1e", - "voteWeight": "2313000000000" + "validatorWeight": "2313000000000" }, { "address": "2265e86e17ca9a0a5604431a3bcd081762962117", - "voteWeight": "5553000000000" + "validatorWeight": "5553000000000" }, { "address": "82a21fa6c4caf2239862cf06e7eca3e9e49a1961", - "voteWeight": "14225000000000" + "validatorWeight": "14225000000000" }, { "address": "32ce9689c521004717fe6536fe6d2ce5d01786b8", - "voteWeight": "1638000000000" + "validatorWeight": "1638000000000" }, { "address": "b4ab38b036c225b67d0a1db14bb0b76068a64492", - "voteWeight": "6264000000000" + "validatorWeight": "6264000000000" }, { "address": "7c89f68da3d1ebb42ce080c3ed1c2b12c528018f", - "voteWeight": "6501000000000" + "validatorWeight": "6501000000000" }, { "address": "9812d641947608596addd69812f7846512ff78f3", - "voteWeight": "15004000000000" + "validatorWeight": "15004000000000" }, { "address": "d988173e59083e98297c37b97ea01761e30bc316", - "voteWeight": "8151000000000" + "validatorWeight": "8151000000000" }, { "address": "95b3716727c551c1c738ae67555f72014ada49c9", - "voteWeight": "5968000000000" + "validatorWeight": "5968000000000" }, { "address": "a96861260057ba3d42ccb1a651adedc776282ded", - "voteWeight": "892000000000" + "validatorWeight": "892000000000" }, { "address": "f6b77ce2f67f1a6a69acefead3d83fde1ab5df81", - "voteWeight": "2292000000000" + "validatorWeight": "2292000000000" }, { "address": "2d26d2f049bef04fd61bce3a741f14e70cce1a9a", - "voteWeight": "17564000000000" + "validatorWeight": "17564000000000" }, { "address": "7069394299436565ce18a30e26fa4acc355e32ba", - "voteWeight": "15460000000000" + "validatorWeight": "15460000000000" }, { "address": "d4f541b1df80486c7f5da5c33e4b5a8c62bac011", - "voteWeight": "7064000000000" + "validatorWeight": "7064000000000" }, { "address": "5389fcf6c1dfcf84c44ec967f0752ef75dbbc083", - "voteWeight": "7774000000000" + "validatorWeight": "7774000000000" }, { "address": "5a98184a71d2b173ec14b00ade42fe1c16d1b833", - "voteWeight": "6488000000000" + "validatorWeight": "6488000000000" }, { "address": "7abb4de258ed5b69e9a62c01ebfb85a46df26f87", - "voteWeight": "14555000000000" + "validatorWeight": "14555000000000" }, { "address": "daba3e94ee10b72fcd801ea8d37d79d94aed7c41", - "voteWeight": "8762000000000" + "validatorWeight": "8762000000000" }, { "address": "a85b0fd020bc74ffdb154916f14810bb96d6302c", - "voteWeight": "16687000000000" + "validatorWeight": "16687000000000" }, { "address": "8ddba3b07d4cb99626a1b6de41f7ea0f5dfcc974", - "voteWeight": "14113000000000" + "validatorWeight": "14113000000000" }, { "address": "81e967a5c16469656763acb7ad7c1a4152cbea17", - "voteWeight": "10045000000000" + "validatorWeight": "10045000000000" }, { "address": "6bf9ad2d5bcf504ea9bfc48632260dab1ba99813", - "voteWeight": "3562000000000" + "validatorWeight": "3562000000000" }, { "address": "802d3bbd00dd9f65e6be3c1209c9328811547789", - "voteWeight": "15300000000000" + "validatorWeight": "15300000000000" }, { "address": "b2103e07c353a2e6bba0106b8cbe62e6926c06f2", - "voteWeight": "16832000000000" + "validatorWeight": "16832000000000" }, { "address": "fb8b2282d18d510220ebb1a51cb482903c7d0354", - "voteWeight": "5723000000000" + "validatorWeight": "5723000000000" }, { "address": "99e5a8cd768fcec38f8d8d8d24f794faa5057199", - "voteWeight": "2353000000000" + "validatorWeight": "2353000000000" }, { "address": "cac6357e3fc988b1edce922e8ab03bb89e5bf145", - "voteWeight": "18059000000000" + "validatorWeight": "18059000000000" }, { "address": "a699825136f2733aa4331ce69d9ab16c61156899", - "voteWeight": "11768000000000" + "validatorWeight": "11768000000000" }, { "address": "6ef5c311e7c64ef986a254c084dd22dbaea1247c", - "voteWeight": "13852000000000" + "validatorWeight": "13852000000000" }, { "address": "3a9c0d3ed54cc6c7cc16715ca0ade9852fe963fa", - "voteWeight": "1816000000000" + "validatorWeight": "1816000000000" }, { "address": "9668cf5d39de0c2cbadda29a1a62018b7de85c6c", - "voteWeight": "1767000000000" + "validatorWeight": "1767000000000" }, { "address": "1fdb1c6b31a9241f336cfc4cc0fc3099fe9ab5f5", - "voteWeight": "14574000000000" + "validatorWeight": "14574000000000" }, { "address": "11788879cc1940e69e5c376994f9defd339df01c", - "voteWeight": "15340000000000" + "validatorWeight": "15340000000000" }, { "address": "74acc43f4fb7dcfd045963e1a0d471c510d808d3", - "voteWeight": "15142000000000" + "validatorWeight": "15142000000000" }, { "address": "d1252a9b64b8e49c0c4215d5fd8108996898c57a", - "voteWeight": "11365000000000" + "validatorWeight": "11365000000000" }, { "address": "568bd94bc9e82cd5dc433330d52938e6b38f1b94", - "voteWeight": "1185000000000" + "validatorWeight": "1185000000000" }, { "address": "de560593fea4b8cb99b012a2439ad2807d562399", - "voteWeight": "8904000000000" + "validatorWeight": "8904000000000" }, { "address": "30e2dfdcb965cf25a165fecfe816f0583ecba530", - "voteWeight": "11422000000000" + "validatorWeight": "11422000000000" }, { "address": "e2c759ac984fd45704f3dc92f810da720f385971", - "voteWeight": "8146000000000" + "validatorWeight": "8146000000000" }, { "address": "64d8dd654d48ff709d5f76307671ee2289f79470", - "voteWeight": "10807000000000" + "validatorWeight": "10807000000000" }, { "address": "9d4751ccd0091515fabd0569d26e8515305768ce", - "voteWeight": "12149000000000" + "validatorWeight": "12149000000000" }, { "address": "bc5dbf6f7005864c231a1273d6b1039624075860", - "voteWeight": "12736000000000" + "validatorWeight": "12736000000000" }, { "address": "99dbb19dcb2e79dc0ce2647751c1b3fc54ee1e7f", - "voteWeight": "5642000000000" + "validatorWeight": "5642000000000" }, { "address": "14264ae633c077108f6cb49dd2659a219dcd1c6b", - "voteWeight": "3903000000000" + "validatorWeight": "3903000000000" }, { "address": "95d3f7ec72cd5477b569cd60698637dbcd924a87", - "voteWeight": "11235000000000" + "validatorWeight": "11235000000000" }, { "address": "491f8ccb0ef0c4f27a7c164eee955aaf9f4b720d", - "voteWeight": "14476000000000" + "validatorWeight": "14476000000000" }, { "address": "feb0a9cdd91785e4be3f8b4a14b7bf6a2e916da2", - "voteWeight": "5261000000000" + "validatorWeight": "5261000000000" }, { "address": "ea5988ce932ae90e6b6aedfa3f218ae5b3ef8eef", - "voteWeight": "9735000000000" + "validatorWeight": "9735000000000" }, { "address": "63a0aff1b108afd9b47089935520069c5a07366f", - "voteWeight": "6667000000000" + "validatorWeight": "6667000000000" }, { "address": "ed032078679cb233c6012d4a424bef2fc411e9fd", - "voteWeight": "17542000000000" + "validatorWeight": "17542000000000" }, { "address": "3ae234d361047b036e9d7fd8d2f275e0f0535445", - "voteWeight": "2757000000000" + "validatorWeight": "2757000000000" }, { "address": "4baa01973c436f33d023f45edb92e01e5d317994", - "voteWeight": "8003000000000" + "validatorWeight": "8003000000000" }, { "address": "ea5805a2ff7d71de35bbfb010ed635d361ede5c5", - "voteWeight": "17392000000000" + "validatorWeight": "17392000000000" }, { "address": "0d98cd8688dc5c64fd7722f36975193ac8a2b22b", - "voteWeight": "9919000000000" + "validatorWeight": "9919000000000" }, { "address": "599b3f04c823a82c6fa8f788d0ed8c02f0a2a33f", - "voteWeight": "14051000000000" + "validatorWeight": "14051000000000" }, { "address": "edde05aee2aa06171b7ee0acbc0342e72fb0c6dc", - "voteWeight": "6029000000000" + "validatorWeight": "6029000000000" }, { "address": "bb3c65abc378f9f25685e0ce0964a1196677bb57", - "voteWeight": "9998000000000" + "validatorWeight": "9998000000000" }, { "address": "727029f2d7aadfd2a00d928f442f2eac550fd5a0", - "voteWeight": "8376000000000" + "validatorWeight": "8376000000000" }, { "address": "12151328eccf982eb0c0f61b20f5b6cfa30e96e7", - "voteWeight": "7198000000000" + "validatorWeight": "7198000000000" }, { "address": "af3ceeaffa31dd88df5018f375a924333d00bf76", - "voteWeight": "14164000000000" + "validatorWeight": "14164000000000" }, { "address": "67a6cb487d741779e254f21ca9857419f2245371", - "voteWeight": "15401000000000" + "validatorWeight": "15401000000000" }, { "address": "a682d2abad902f269af7522e0f7a07e912d77ebe", - "voteWeight": "10118000000000" + "validatorWeight": "10118000000000" }, { "address": "057a0c2ba98c239c23f75d53ea893f9420066654", - "voteWeight": "6734000000000" + "validatorWeight": "6734000000000" }, { "address": "723e5725f350ac67921f98b88a94f1d2eefdec71", - "voteWeight": "6078000000000" + "validatorWeight": "6078000000000" }, { "address": "3d90d26438005deb02fad8a2569e483c0d939262", - "voteWeight": "17345000000000" + "validatorWeight": "17345000000000" }, { "address": "61dfdf80a2dde506b2c4bae53c23077eac77e459", - "voteWeight": "10251000000000" + "validatorWeight": "10251000000000" }, { "address": "0e8817d6207844598a9d9f867377e8e2d545e728", - "voteWeight": "14558000000000" + "validatorWeight": "14558000000000" }, { "address": "a50a1ea5491e3bb903562c30bb69451f022506c3", - "voteWeight": "5289000000000" + "validatorWeight": "5289000000000" }, { "address": "4849b8be378b8dec4541cb36382a4600e32a44e8", - "voteWeight": "3405000000000" + "validatorWeight": "3405000000000" }, { "address": "a410cf967ca1bef4a610be3b258f59949c86ffa8", - "voteWeight": "13233000000000" + "validatorWeight": "13233000000000" }, { "address": "bc457d99d6723e64bb0ffeb488c627c6e525a2a2", - "voteWeight": "10144000000000" + "validatorWeight": "10144000000000" }, { "address": "52c418d5e4c62f2599fb42a5c9fd1c88efdd1feb", - "voteWeight": "11148000000000" + "validatorWeight": "11148000000000" }, { "address": "2a3c956c07e82e0f9f21b635a9a3aef439a73305", - "voteWeight": "10934000000000" + "validatorWeight": "10934000000000" }, { "address": "272f126a5db1dc156f077f727ea5393b1ae86583", - "voteWeight": "463000000000" + "validatorWeight": "463000000000" }, { "address": "3130c94ac88871c80cba63f343c7efd39fe0c683", - "voteWeight": "9323000000000" + "validatorWeight": "9323000000000" }, { "address": "bbee7dde0e267750473b2941e485d491a1924685", - "voteWeight": "14944000000000" + "validatorWeight": "14944000000000" }, { "address": "80cbaf52a74a0fb1317429a04ed346d9fa5929d8", - "voteWeight": "15186000000000" + "validatorWeight": "15186000000000" }, { "address": "56915854c032bc16c204e573c70fc2bba62efc86", - "voteWeight": "1655000000000" + "validatorWeight": "1655000000000" }, { "address": "acb5152efe903aa2af7aaea5a2c516b44aceef70", - "voteWeight": "12075000000000" + "validatorWeight": "12075000000000" }, { "address": "bcca1186883ffea43adda6a96335e68b6a1e5423", - "voteWeight": "1275000000000" + "validatorWeight": "1275000000000" }, { "address": "3ea9743a62f37d47782bb5f2802d3e0787e70a8c", - "voteWeight": "16855000000000" + "validatorWeight": "16855000000000" }, { "address": "7271fccec796570a20aeaf43701e7ba5feca8555", - "voteWeight": "17897000000000" + "validatorWeight": "17897000000000" }, { "address": "574ef04a8587b794330b41607344fe696465d2b1", - "voteWeight": "8776000000000" + "validatorWeight": "8776000000000" }, { "address": "1bb86721d76b3a0fd336c7881a0a3ba3b53baded", - "voteWeight": "17001000000000" + "validatorWeight": "17001000000000" }, { "address": "619a684d3c96e7637da09253392c160bd7597c0e", - "voteWeight": "10657000000000" + "validatorWeight": "10657000000000" }, { "address": "170c93c5d5316a991e3cf38f75af60b2055f5c93", - "voteWeight": "11206000000000" + "validatorWeight": "11206000000000" }, { "address": "631d6eaa3aae6199c983d7dbfb2846e8d5f84956", - "voteWeight": "15427000000000" + "validatorWeight": "15427000000000" }, { "address": "91f84b4bae768a6ec26870e8904162b1b0fd3138", - "voteWeight": "10966000000000" + "validatorWeight": "10966000000000" }, { "address": "7653e0c81ce84fb8c8136811d4f4fb760948c168", - "voteWeight": "12567000000000" + "validatorWeight": "12567000000000" }, { "address": "e5dfefdf55b7cb29ac1561eb8fa65d4d15208806", - "voteWeight": "3197000000000" + "validatorWeight": "3197000000000" }, { "address": "de3703da8d1de29b609bf17d882f82581d84eea2", - "voteWeight": "13577000000000" + "validatorWeight": "13577000000000" }, { "address": "9dac147d34b48cdf72875d3b2f66931baf11e1e8", - "voteWeight": "5858000000000" + "validatorWeight": "5858000000000" }, { "address": "b5c9968fe4ddcc252ca96fde91a97b6a6b8f6395", - "voteWeight": "4103000000000" + "validatorWeight": "4103000000000" }, { "address": "1987ca1117960e0a6565d9e9291799810e97fd6f", - "voteWeight": "10621000000000" + "validatorWeight": "10621000000000" }, { "address": "8e4f78d9e7a68cacb7ea9d8c42284f56c373b64a", - "voteWeight": "14773000000000" + "validatorWeight": "14773000000000" }, { "address": "134496789490787deaf7a2e81ea7c0966afdee85", - "voteWeight": "787000000000" + "validatorWeight": "787000000000" }, { "address": "dc8cfaaf0be804a838bb1fa4b492b53efd8e3193", - "voteWeight": "15207000000000" + "validatorWeight": "15207000000000" }, { "address": "b607f69e8fab921137e582bbe928488ab3f73d69", - "voteWeight": "9412000000000" + "validatorWeight": "9412000000000" }, { "address": "ab3cf360ed7151faafeb24cda064c21e17987ad9", - "voteWeight": "14341000000000" + "validatorWeight": "14341000000000" }, { "address": "fe59fb6ecd21640c7d66654f64d88cade1bc4da4", - "voteWeight": "15513000000000" + "validatorWeight": "15513000000000" }, { "address": "a75d245452e15a6ce78b503cf4c33d0be1cf0e44", - "voteWeight": "3855000000000" + "validatorWeight": "3855000000000" }, { "address": "c6faed3348ed0d73424b7bef853cb7027ff23470", - "voteWeight": "15798000000000" + "validatorWeight": "15798000000000" }, { "address": "cf455b8e443ea22344cc8fe11d635c2fc1ed7bc3", - "voteWeight": "9454000000000" + "validatorWeight": "9454000000000" }, { "address": "2f06a14a7e4284606cc93ba399d268647c9b8d0b", - "voteWeight": "10397000000000" + "validatorWeight": "10397000000000" }, { "address": "0a448ef7167774b807b1e92ee532ba073425b2e0", - "voteWeight": "3021000000000" + "validatorWeight": "3021000000000" } ] } diff --git a/protocol-specs/generators/dpos_random_seed_generation/README.md b/protocol-specs/generators/pos_random_seed_generation/README.md similarity index 100% rename from protocol-specs/generators/dpos_random_seed_generation/README.md rename to protocol-specs/generators/pos_random_seed_generation/README.md diff --git a/protocol-specs/generators/dpos_random_seed_generation/forger_list.json b/protocol-specs/generators/pos_random_seed_generation/forger_list.json similarity index 71% rename from protocol-specs/generators/dpos_random_seed_generation/forger_list.json rename to protocol-specs/generators/pos_random_seed_generation/forger_list.json index c36ccf34142..5079a6ab949 100644 --- a/protocol-specs/generators/dpos_random_seed_generation/forger_list.json +++ b/protocol-specs/generators/pos_random_seed_generation/forger_list.json @@ -2,603 +2,603 @@ "list": [ { "publicKey": "b4f98dacb1609ad11b63ea20b61a5721a9b502af948c96522260e3d89910a8d9", - "voteWeight": "160000000000" + "validatorWeight": "160000000000" }, { "publicKey": "842dcd768bf0311100781e6caa7141b62303a20274fa0b83357d7c920b8854c1", - "voteWeight": "96000000000" + "validatorWeight": "96000000000" }, { "publicKey": "0fd794d5949f1b5a89b3d6ee96c2ff8f927e3c0afbb2273db514787738df319b", - "voteWeight": "63000000000" + "validatorWeight": "63000000000" }, { "publicKey": "9c47ddd53f9b5dd467f5d43f56a75248193ec660f150d141025f0781210a1ad5", - "voteWeight": "180000000000" + "validatorWeight": "180000000000" }, { "publicKey": "5972e8f60c5b4e7f14abbe238e1afb5639b93c4d7fddde4d994f4711133073e6", - "voteWeight": "166000000000" + "validatorWeight": "166000000000" }, { "publicKey": "0c911feadff1cc494b08dba1b351da55efc640036909d1567cdedff9e1fba715", - "voteWeight": "141000000000" + "validatorWeight": "141000000000" }, { "publicKey": "977d0f44714b0ef1a715c1d883095704f7211b4f7d249a7732ec162331771042", - "voteWeight": "21000000000" + "validatorWeight": "21000000000" }, { "publicKey": "d45199abb012dc33be0af062472f91027ad555cdd07f9959b0f1282bd90c7f2b", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "publicKey": "eb45b32066facbcf1a5f45a8981e6ddf127aa0eff5d1959d508fc881787c1f21", - "voteWeight": "97000000000" + "validatorWeight": "97000000000" }, { "publicKey": "5f784c3821a293977cda333625fe44e692c1c43c6bcf6bdeee77040c0cb9fb59", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "publicKey": "4001d4b535a2dae6ec543f376eb7c9fff4082c99f8274bf236d2eb543b965101", - "voteWeight": "90000000000" + "validatorWeight": "90000000000" }, { "publicKey": "54435e76a85376617f4d61a251fd14664bd1842a33edca5a39bb01606de4965c", - "voteWeight": "58000000000" + "validatorWeight": "58000000000" }, { "publicKey": "b87cb682636f6ad9bea38435736ff5e2d14c877b7886004f3c57878c0cda16f7", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "publicKey": "6a616e68b0b841066a9ef39f1bfcec61c3f0bc1ed4bcc1ded7fb02c9e7fd967f", - "voteWeight": "3000000000" + "validatorWeight": "3000000000" }, { "publicKey": "16e2542b30c94719fb5d59b9ef4bcd5c236b94074afc6d0d5b98dc29efb950f5", - "voteWeight": "124000000000" + "validatorWeight": "124000000000" }, { "publicKey": "5514e77982e28e410e29e4c7111754137520a5023ecd81a28cc8bd6146d254dd", - "voteWeight": "52000000000" + "validatorWeight": "52000000000" }, { "publicKey": "8272e341349df2647ba6ced1bd4bb9ab8b00ae881efc61e43b5e7c9023594516", - "voteWeight": "167000000000" + "validatorWeight": "167000000000" }, { "publicKey": "df6601c47c61de84e699e12c05943e4bbdedc31d658f075a4c6e4ce521d7d349", - "voteWeight": "172000000000" + "validatorWeight": "172000000000" }, { "publicKey": "c4e7e2f404529b2e479c0558ecadafaef9898dd0e2afee25f8318e31936c8f21", - "voteWeight": "30000000000" + "validatorWeight": "30000000000" }, { "publicKey": "1953e0296153f7d01bff9aa80252759d006fc897e9a462ed2000bca03bb7d457", - "voteWeight": "129000000000" + "validatorWeight": "129000000000" }, { "publicKey": "6c9b834531d485b9a55b4080182841ab25f8318e6ba094d88d4a64ae6d3426fc", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "publicKey": "f127d5c8fb3691138f8bfb7ec4b4c09500f5b082085028299e63095171389f4a", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "publicKey": "8a105753d8aa69befeba70c5a1f07a19ab5dd0a2eb73c3535f249d5fa96a82ca", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "publicKey": "4475b936898ea7397d8013c2e0ba7e5feef82401f8b8b6a2f50482ca5f174357", - "voteWeight": "177000000000" + "validatorWeight": "177000000000" }, { "publicKey": "fe70f5dd9a4b1fea80f5e7499a4d7a9340fe4dea61c271499442b520d0bb3dbc", - "voteWeight": "59000000000" + "validatorWeight": "59000000000" }, { "publicKey": "266f3f8731865098b3f82282c11ef9ccd0043c63a6fb9d20f7aa46c6fcab35a8", - "voteWeight": "60000000000" + "validatorWeight": "60000000000" }, { "publicKey": "d823065a79b8ef13899b696d6350d828e081ea483f3549e6d1a57e3ec0631e3b", - "voteWeight": "104000000000" + "validatorWeight": "104000000000" }, { "publicKey": "4f0d6a961db13a035ca6a84c330b303b9950bfd08d140ba60cab9b65bef944ab", - "voteWeight": "157000000000" + "validatorWeight": "157000000000" }, { "publicKey": "e50a1d76d3990518f817a0504813897ce3b3c58ca92a9448c963566d3f33d707", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "publicKey": "83e6c92d5a8cf96a94f75196d9fa882e1e4c7ba35232d629dcdb56c9b23d6eeb", - "voteWeight": "130000000000" + "validatorWeight": "130000000000" }, { "publicKey": "e89e3321099d6e413f205eb4063bb131a0592c5716e4ffe2c4d8a5fa44785307", - "voteWeight": "176000000000" + "validatorWeight": "176000000000" }, { "publicKey": "c26c21a3aff990e9e34155d75f15fac35a43119133ad15a2349de1b78f162f93", - "voteWeight": "45000000000" + "validatorWeight": "45000000000" }, { "publicKey": "47603aaaa6bf0944af978ee4aca61c6d68aa184d58bdd2409b544664ce5127b1", - "voteWeight": "146000000000" + "validatorWeight": "146000000000" }, { "publicKey": "21f027453e69adae0b271f33df6897f309d7324c1d635097cbfced4228c23726", - "voteWeight": "43000000000" + "validatorWeight": "43000000000" }, { "publicKey": "95176306bca4670327a69dbed04f65c69c77f46e2e7a4ea830a40aaee28f6632", - "voteWeight": "105000000000" + "validatorWeight": "105000000000" }, { "publicKey": "0508416e994d30c1a92948bd3936fa3fecba6932edd859fd5735f841b3f75e96", - "voteWeight": "39000000000" + "validatorWeight": "39000000000" }, { "publicKey": "b28d5e413921d219a4c62abd69640bc459339f00125593539189304dde4b3db9", - "voteWeight": "46000000000" + "validatorWeight": "46000000000" }, { "publicKey": "6d9f346a3d2cd29b350076610644d3485d9f49cba62b85d49dac062733a7731e", - "voteWeight": "144000000000" + "validatorWeight": "144000000000" }, { "publicKey": "bbbe6f7f8f2b75c82ee14f4ee6c13c4a2242713a4df158294ea9dde664e53a90", - "voteWeight": "23000000000" + "validatorWeight": "23000000000" }, { "publicKey": "e092d5ac37e6f4cb7f92eecbfedff60be5d73fd33accd1c652bd1eb0227c0137", - "voteWeight": "147000000000" + "validatorWeight": "147000000000" }, { "publicKey": "dd10f589c25d4c1dbce87371ec05be8ea9a4f7d9772cc0739ef2f1bc83bb8856", - "voteWeight": "161000000000" + "validatorWeight": "161000000000" }, { "publicKey": "070d317c709e12e199f47316cee56a108f097357b8f8f0278fe179e58d8c2c02", - "voteWeight": "78000000000" + "validatorWeight": "78000000000" }, { "publicKey": "2d62bc4e726f9151a7a773e7ca7c22cd5748f6991371653c4359282e70d4593e", - "voteWeight": "112000000000" + "validatorWeight": "112000000000" }, { "publicKey": "a4cd42bc2867dadc39206a9b511f9f70a3a4bb80eead223307f7c56b73f4549e", - "voteWeight": "42000000000" + "validatorWeight": "42000000000" }, { "publicKey": "2d1e3b2ed6e5f908f67e42c1caecda2a64882b339fcec18372bb3ce4e03b1176", - "voteWeight": "177000000000" + "validatorWeight": "177000000000" }, { "publicKey": "e867c96fe3818c457c72ba12894b83e5aaf5e995dcebd56d1b22d0f63a0a4e97", - "voteWeight": "13000000000" + "validatorWeight": "13000000000" }, { "publicKey": "399c7b332786a15742380b27e2807259d45e115ca926cfcc81f4c6d99dd5dcef", - "voteWeight": "15000000000" + "validatorWeight": "15000000000" }, { "publicKey": "b1d09697cf898a3f3f0e71c30af3ff09f9e784dfcee34abfaaf80cdf63e6df70", - "voteWeight": "12000000000" + "validatorWeight": "12000000000" }, { "publicKey": "ba698f8c2836f9597514e55cdca59ccac82ba75259f94da5130f1158043d6b03", - "voteWeight": "148000000000" + "validatorWeight": "148000000000" }, { "publicKey": "33c8c34395a71b9052b702f2f165a824241b6af5c13ce961eef6d16684b4119d", - "voteWeight": "20000000000" + "validatorWeight": "20000000000" }, { "publicKey": "c2f69b9db94ee1dcfabdc742a8ae9804ea2ac727c8ee0b2f1dd85de5db42423f", - "voteWeight": "141000000000" + "validatorWeight": "141000000000" }, { "publicKey": "0ed77b95c171ee9dd0781abaccdc1b63dd0d84a7c108a9e1ce8647e3a72da321", - "voteWeight": "139000000000" + "validatorWeight": "139000000000" }, { "publicKey": "87980f8740cb615a948576b8ca152e6e89aa0e63c08ed2d44d03fe8d0e04f6ca", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "publicKey": "66d8634d9c2cbff3ddc5be8856f1d582a20a6127a5875757a46b63f41d1d3fc7", - "voteWeight": "81000000000" + "validatorWeight": "81000000000" }, { "publicKey": "b54d973bc5978a6f5d56710ba944529ad5c6f7d1c5048304dd982e2c4a378caf", - "voteWeight": "48000000000" + "validatorWeight": "48000000000" }, { "publicKey": "e927389e5ba0b2ab9cc5862302829931b5925c5a1eb579323ab4b34389cf8db1", - "voteWeight": "117000000000" + "validatorWeight": "117000000000" }, { "publicKey": "0f969918f98c71d37267c554c10e0dd913d9518e32e2de6516226ea47a67b023", - "voteWeight": "134000000000" + "validatorWeight": "134000000000" }, { "publicKey": "9094583d4d097cef625d7bc82083eac3522c25d45bbc9dc4bf21210c16879680", - "voteWeight": "101000000000" + "validatorWeight": "101000000000" }, { "publicKey": "3bf78d6544c1adefa663de1f74543d72224d41d4a11531a7841c9e5cbc12f1f5", - "voteWeight": "74000000000" + "validatorWeight": "74000000000" }, { "publicKey": "bb7083b0babbaaa327be9699699ea7ca5fa40f425482139687a79603a416fde6", - "voteWeight": "6000000000" + "validatorWeight": "6000000000" }, { "publicKey": "cfdfcacd90a02dbaa60a9de040acae434b0b9c2f861ce9328819fdaa9090be6e", - "voteWeight": "154000000000" + "validatorWeight": "154000000000" }, { "publicKey": "93d3b024b802c03ee2225fc0a279d456b96188b1f4c6ce987e28b5dc4c641030", - "voteWeight": "10000000000" + "validatorWeight": "10000000000" }, { "publicKey": "74413215d6c3c3230858bf8cd04f1ef68a2a935d08548e86fab48af6d2bc3fcb", - "voteWeight": "139000000000" + "validatorWeight": "139000000000" }, { "publicKey": "122a9b80e4b48aae984aae6bf2e01c31bc7d7cbcb1768b2893b2878a437f8507", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "publicKey": "aae2851afeb6907ecfb8baa03e02e63137e697ce0b28f84323397bfbf5276229", - "voteWeight": "51000000000" + "validatorWeight": "51000000000" }, { "publicKey": "4eb50ec0d38a1d14abd7de2a1868ecb30483f9f1960100c7b2a865d114159525", - "voteWeight": "77000000000" + "validatorWeight": "77000000000" }, { "publicKey": "902a4441ae905a38ab7153d7f83d504d91a9311fa7ad6545bfca901c9dfca8ff", - "voteWeight": "162000000000" + "validatorWeight": "162000000000" }, { "publicKey": "e479164a31490c2d62df6c8c044365338a67f9cedd8ef8255357369a222f316f", - "voteWeight": "4000000000" + "validatorWeight": "4000000000" }, { "publicKey": "7c4017932998a5c2210a9f6bb8655382f97ed37ecf079f160fdfb7e6e927fdca", - "voteWeight": "51000000000" + "validatorWeight": "51000000000" }, { "publicKey": "a2a8eae9e0570d772df7ce38c2d0bcf385bc19a3cf546ea8bfeaf311e5cd1a04", - "voteWeight": "61000000000" + "validatorWeight": "61000000000" }, { "publicKey": "6dddb2c1137c600283bab0f0b118f77b6e4cf08c2539d1716b90837e21e3504c", - "voteWeight": "112000000000" + "validatorWeight": "112000000000" }, { "publicKey": "30b1fcea3198d8c48ca5be65a3a2db1b7c088bfd921371c3981d9d2d1015d31a", - "voteWeight": "69000000000" + "validatorWeight": "69000000000" }, { "publicKey": "752fc5fc9db4eb28d9dbef1bedbc5c709c2e5e028cd3f9c3cc31c61b3c684efb", - "voteWeight": "165000000000" + "validatorWeight": "165000000000" }, { "publicKey": "508eca3b93cf0c9e25b4b0e671303a911e39185135a7a90a587f03ea99258f38", - "voteWeight": "177000000000" + "validatorWeight": "177000000000" }, { "publicKey": "1c67d56de7c940a628c9120cbe0f67a7992bb9dd5ad5e990e4201a1ff3b86256", - "voteWeight": "76000000000" + "validatorWeight": "76000000000" }, { "publicKey": "58be0769be3396ea445ad05914373ab465d568652b39fe73ab46149d13d08024", - "voteWeight": "19000000000" + "validatorWeight": "19000000000" }, { "publicKey": "a81b2fe2cb8770d8a4bf69ba2792f0c965bec84c1370954d8a5878d6f39a0d22", - "voteWeight": "46000000000" + "validatorWeight": "46000000000" }, { "publicKey": "c322571143875b44362821c3eaceb2568ca12f9bd471325e0172be3e6a468f5e", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "publicKey": "635188690d7de1e39d6c03fe09f72091518618971a3d5c990fa85840936d537b", - "voteWeight": "20000000000" + "validatorWeight": "20000000000" }, { "publicKey": "ede4418538bbdcdd0b6755556748294cabdd32893945a01891b447d6162f713f", - "voteWeight": "174000000000" + "validatorWeight": "174000000000" }, { "publicKey": "9123a06c42bb6a4e284815af0d38d6ad8a7802c8d187cdefcfce74488a3de6d6", - "voteWeight": "92000000000" + "validatorWeight": "92000000000" }, { "publicKey": "450faf313a2acbe3c8bd601685c12e2de810369f6c760bbf1dcc7983c93ee95d", - "voteWeight": "141000000000" + "validatorWeight": "141000000000" }, { "publicKey": "5611c82138404f753fdf7a8f6fb2d965082df316c868986a8a5bcb36437a6a9a", - "voteWeight": "72000000000" + "validatorWeight": "72000000000" }, { "publicKey": "1e9b9e26806bdcaa052612279071d53004bce9437ce44954ed9478530c11d0a7", - "voteWeight": "35000000000" + "validatorWeight": "35000000000" }, { "publicKey": "2deae67226e1430ad1dcf677614424a470e473f2cbfa24641edf10124141bb73", - "voteWeight": "46000000000" + "validatorWeight": "46000000000" }, { "publicKey": "39bbb1c5ece423d6291e4c4ce490d45747cae3026b4317f5e4163f72fbbffec8", - "voteWeight": "78000000000" + "validatorWeight": "78000000000" }, { "publicKey": "ff427146210a65ef7185fc3bdd3ba3f7e3a69ab0334eeab38733928166e0f3c7", - "voteWeight": "178000000000" + "validatorWeight": "178000000000" }, { "publicKey": "6e7e168c2740ca3c85e501742a3538d320cc2ec0971e216bd319fc710638d6bc", - "voteWeight": "26000000000" + "validatorWeight": "26000000000" }, { "publicKey": "2f59f6c81e1cd5ad416bc5eac4431efaec182605d080565ddfc3a94fdaf34ad0", - "voteWeight": "86000000000" + "validatorWeight": "86000000000" }, { "publicKey": "f94042dfa329046380d7f36174400a14088024ba2a397ff4d894e7698b1d46e0", - "voteWeight": "34000000000" + "validatorWeight": "34000000000" }, { "publicKey": "6121910a23a9fed7e7ab38e498763d124881f139cc9473b6cd9fb65d04eb12f0", - "voteWeight": "41000000000" + "validatorWeight": "41000000000" }, { "publicKey": "174e68aeaa04e77323bd416d57fea97986f52d706c8d99f6c1e7c2dfe51dfe14", - "voteWeight": "167000000000" + "validatorWeight": "167000000000" }, { "publicKey": "78fd16a43909729749f38ee7b2ef9e5258caffd7055b99468e7786ac0116b415", - "voteWeight": "167000000000" + "validatorWeight": "167000000000" }, { "publicKey": "4b935b6b19cfbd2c446ce037566908e677a806f757ef018efac84471bf48538e", - "voteWeight": "37000000000" + "validatorWeight": "37000000000" }, { "publicKey": "7a0fcce77bd4d8035458f07e15ce7034cdb308b62fb99640f584a43623fab8a7", - "voteWeight": "60000000000" + "validatorWeight": "60000000000" }, { "publicKey": "bf6ebd7d49278e9d428402e15a0b9974b5983f39433ed257a280a69fbd3b6d77", - "voteWeight": "43000000000" + "validatorWeight": "43000000000" }, { "publicKey": "252365f614830cb173d407506250461063b69a2abb22e7f9ebb688e24d8cabad", - "voteWeight": "42000000000" + "validatorWeight": "42000000000" }, { "publicKey": "9574324bddddd57e3d075efeb80944f67b3fd6f9bfb2759dbdfa1558a00855c6", - "voteWeight": "49000000000" + "validatorWeight": "49000000000" }, { "publicKey": "e7e026623f187b536991baceaf4e026401fc1ccf36201214560d94dd17319c9f", - "voteWeight": "71000000000" + "validatorWeight": "71000000000" }, { "publicKey": "70342b7c85e4e150e0b5a7cd5207e92a7346c3400f9725020d173212cec4720d", - "voteWeight": "179000000000" + "validatorWeight": "179000000000" }, { "publicKey": "2f75504e01db48becdb6376bae6f12c6ff685496dd162dc7b3a01324fc2cdb21", - "voteWeight": "171000000000" + "validatorWeight": "171000000000" }, { "publicKey": "3e0f75205dcd924d48bee93747e6e20e2a601fd98a296e94e545d196a7ff3063", - "voteWeight": "8000000000" + "validatorWeight": "8000000000" }, { "publicKey": "71f5b7909040c3e09bc97da8bec8444e0ec4e5201d0f29054daa416d30c8a86a", - "voteWeight": "183000000000" + "validatorWeight": "183000000000" }, { "publicKey": "107806d2020ac69d31b85755bb8b7c470940543638fe66406f5a862a5158aea6", - "voteWeight": "19000000000" + "validatorWeight": "19000000000" }, { "publicKey": "a2e42f39cbff69103b8bb25aa9ead5ea4640782e767dc49c412a0a647b35a337", - "voteWeight": "168000000000" + "validatorWeight": "168000000000" }, { "publicKey": "ec8aef976f6ee9de6374e40e9da85a4405b6e6211c846d6cfe7d8b41fa74bf08", - "voteWeight": "33000000000" + "validatorWeight": "33000000000" }, { "publicKey": "a2b09c34d270faca731c22b405de42aa422dbb60d86b127fbe4f656c4305cee4", - "voteWeight": "157000000000" + "validatorWeight": "157000000000" }, { "publicKey": "c136f09f5d1432b0654bc850e6129879ab04a5a6acd1db5a73b917ae75aba670", - "voteWeight": "59000000000" + "validatorWeight": "59000000000" }, { "publicKey": "a1a2cabfe938ff138c16ec3678c29b26e95e4d45ae5d414e200efab0e95848dc", - "voteWeight": "13000000000" + "validatorWeight": "13000000000" }, { "publicKey": "42c026597eb1e9744663c292535b034a0a3aa3fe23dfca39027e0c0cc2065311", - "voteWeight": "112000000000" + "validatorWeight": "112000000000" }, { "publicKey": "3757339449a085ad393dc0ee6924ab616a322be5ad61177f85943b189d17cc78", - "voteWeight": "40000000000" + "validatorWeight": "40000000000" }, { "publicKey": "071cc3a1e7bdd3680a5687b4ff08e3176f69b939d3486d4bf68125d70d51c19e", - "voteWeight": "65000000000" + "validatorWeight": "65000000000" }, { "publicKey": "c54f5a82ec5a0e0c4b997c9979b92ff95b5943d5482199df99b0346c1b10a942", - "voteWeight": "32000000000" + "validatorWeight": "32000000000" }, { "publicKey": "a25e0a3243b657d1b6a1d7b147d6dde6c4abc084cf2730015b615392791bfa41", - "voteWeight": "117000000000" + "validatorWeight": "117000000000" }, { "publicKey": "9efdbb7d6584c899e7fd208a3bccdb8607d0f337909f98f0c2d9d01a38b4907d", - "voteWeight": "135000000000" + "validatorWeight": "135000000000" }, { "publicKey": "f85de3aaeb2f3f4e73f21680a71d4636f39826719f17fcaaee033de8edf9c1d5", - "voteWeight": "68000000000" + "validatorWeight": "68000000000" }, { "publicKey": "a5d6c894b19e54ce7ab3ddad69b95d177339ef40cff55e5439a287f044fac2a0", - "voteWeight": "20000000000" + "validatorWeight": "20000000000" }, { "publicKey": "d6e19d2d4973fc64802558011a62c0f0df6da4cee3b50dc602bc8276c47a946b", - "voteWeight": "42000000000" + "validatorWeight": "42000000000" }, { "publicKey": "c33d91884932ed249f2f5726583894e7ac1e5080465bdd823b3e86e13e250d27", - "voteWeight": "7000000000" + "validatorWeight": "7000000000" }, { "publicKey": "29b3191ea5ca3be7924cabf283e9ee8b82b2ee3c34bee5c7bfbf4ef70ae0c769", - "voteWeight": "47000000000" + "validatorWeight": "47000000000" }, { "publicKey": "df0d80fbe105602b207faeef0a1d6c340f0a68292e6cb71007b73c6d2525a16a", - "voteWeight": "98000000000" + "validatorWeight": "98000000000" }, { "publicKey": "ffa641a1364ac94455cef8f88817c7e663553e8d3870f05cb00d9381c9f4e141", - "voteWeight": "103000000000" + "validatorWeight": "103000000000" }, { "publicKey": "1b112a58461b555a65cec6a0863207cf7e808efcb832fb06c05a6c6be05c06e7", - "voteWeight": "114000000000" + "validatorWeight": "114000000000" }, { "publicKey": "6c0bcc53e50e30872c58e2beb49def2af21644a0a5580b71410949808cfbc11a", - "voteWeight": "168000000000" + "validatorWeight": "168000000000" }, { "publicKey": "a44ae0c4e532791215aa52e0771b3fd29b39a9c4d1caaa261c96b86c34367ebf", - "voteWeight": "151000000000" + "validatorWeight": "151000000000" }, { "publicKey": "da96d8d6d2e61d976de9ab485dc81841836547bbad4167d4fdf885167afb4e2e", - "voteWeight": "146000000000" + "validatorWeight": "146000000000" }, { "publicKey": "279e6cec1e669d56ac0157c8e571d154a8107e22db6473091afe1fd77e17b162", - "voteWeight": "64000000000" + "validatorWeight": "64000000000" }, { "publicKey": "883ab682abb5841d1ad9e2f6f760bdfeede2635efdd7f0485f5854f092afa06c", - "voteWeight": "99000000000" + "validatorWeight": "99000000000" }, { "publicKey": "9b56e57fa08c3f87aa701dbea7f3ac81cdc10e4eba534e2e597c2e0b3a0ae9d2", - "voteWeight": "100000000000" + "validatorWeight": "100000000000" }, { "publicKey": "1798fecf33a559394b790cf5590990ce6f0735ac5190c731ac8db33241a65651", - "voteWeight": "89000000000" + "validatorWeight": "89000000000" }, { "publicKey": "981851559accbaf845bb003fc5492314532011c6b29ec51d2a033c7d2ec57dec", - "voteWeight": "14000000000" + "validatorWeight": "14000000000" }, { "publicKey": "024500568d3def1589554a41612d0d7d12a378dad8185059db2462a480ac7286", - "voteWeight": "125000000000" + "validatorWeight": "125000000000" }, { "publicKey": "00cff321bb299df14f47b046f0eb7281753d2431a3b5f343e0749a61a5189a93", - "voteWeight": "24000000000" + "validatorWeight": "24000000000" }, { "publicKey": "9c997c419178085a26be31db384a4f3a78c71ddbcf11472f3a871c2534558f6d", - "voteWeight": "7000000000" + "validatorWeight": "7000000000" }, { "publicKey": "795dd780b2950573dce2125fe4bb30dbd86e62e47baf94c83f6031364f776e68", - "voteWeight": "118000000000" + "validatorWeight": "118000000000" }, { "publicKey": "ab402f25c601f511783e0391851775fb9bf1ae812cf3c10b57405222c4fda5b9", - "voteWeight": "83000000000" + "validatorWeight": "83000000000" }, { "publicKey": "88a4683b0307faaada6efa6b5f9084e330f7646b9669fc167c9e54ce199d6e02", - "voteWeight": "11000000000" + "validatorWeight": "11000000000" }, { "publicKey": "271d396aed51e842b61e84a5f70c2e3642e5d887e02fee9abeeb151054e4963d", - "voteWeight": "148000000000" + "validatorWeight": "148000000000" }, { "publicKey": "f53e2670d9374610812ce9bf71a571a3987737b109436bdb65f586f3882a6ed2", - "voteWeight": "66000000000" + "validatorWeight": "66000000000" }, { "publicKey": "075fbb8d0c0733b4f2599961c42f5dc893e17c65221fdfb436d8bd7a87b04bd6", - "voteWeight": "63000000000" + "validatorWeight": "63000000000" }, { "publicKey": "a4a88830dfac0a706bb5cc23033d35402cf8808d5ed69d47fb5dba457cac5c2d", - "voteWeight": "43000000000" + "validatorWeight": "43000000000" }, { "publicKey": "5878c00606ea6ef6479ad572365a90445d5cc74592006370018c1bce53b6ece4", - "voteWeight": "143000000000" + "validatorWeight": "143000000000" }, { "publicKey": "3300657605ee35377e844d53e0ede4dab3dfa19bd6396f2cce64a6cb1081acad", - "voteWeight": "93000000000" + "validatorWeight": "93000000000" }, { "publicKey": "4180a5473c7c95d38e3ab2b664fd2ac45503ba235b5a4f0e30fb852a2bf0ac8b", - "voteWeight": "165000000000" + "validatorWeight": "165000000000" }, { "publicKey": "dedae68211f36a11d55c301623d63bdfcd380e05ead34241087d8dc827f964a2", - "voteWeight": "9000000000" + "validatorWeight": "9000000000" }, { "publicKey": "4ae291a5c8fd5f70556c80483d50294670ee532c95711ec32a49d5c88a383faa", - "voteWeight": "112000000000" + "validatorWeight": "112000000000" }, { "publicKey": "031c78884967546e306994b3ad75ada0cf1edd3fbc4e5bb928f7a8a09454d618", - "voteWeight": "167000000000" + "validatorWeight": "167000000000" }, { "publicKey": "d2197b18f6b06856082fc43c69d603e1c6aef304509c4d9a45bbd58e0917f1f8", - "voteWeight": "135000000000" + "validatorWeight": "135000000000" }, { "publicKey": "854f5f67a3400a5a0e0c3d798071f6e1db7e6b56dd95d163e9fd4b76edae7244", - "voteWeight": "54000000000" + "validatorWeight": "54000000000" }, { "publicKey": "035bd506b619172053001185f4e292d6c41f72830d730a961ab5daabb2a8c912", - "voteWeight": "102000000000" + "validatorWeight": "102000000000" } ] } diff --git a/protocol-specs/generators/dpos_random_seed_generation/index.js b/protocol-specs/generators/pos_random_seed_generation/index.js similarity index 75% rename from protocol-specs/generators/dpos_random_seed_generation/index.js rename to protocol-specs/generators/pos_random_seed_generation/index.js index 49035037eda..6c0c19b7f9b 100644 --- a/protocol-specs/generators/dpos_random_seed_generation/index.js +++ b/protocol-specs/generators/pos_random_seed_generation/index.js @@ -17,10 +17,10 @@ const { utils } = require('@liskhq/lisk-cryptography'); const BaseGenerator = require('../base_generator'); -const { list: sampleDelegateList } = require('./forger_list'); +const { list: sampleValidatorList } = require('./forger_list'); -const activeDelegates = 101; -const standByDelegates = 2; +const activeValidators = 101; +const standByValidators = 2; const numberToBuffer = data => { const buffer = Buffer.alloc(4); @@ -69,35 +69,35 @@ const generateSeedOnion = (initialSeed, size) => { return seeds.reverse(); }; -const generateSeedReveals = ({ delegateList, numberOfBlocks }) => { +const generateSeedReveals = ({ validatorList, numberOfBlocks }) => { const seeds = {}; - for (const delegate of delegateList) { - const seedsForDelegate = generateSeedOnion(delegate.publicKey, numberOfBlocks); + for (const validator of validatorList) { + const seedsForValidator = generateSeedOnion(validator.publicKey, numberOfBlocks); const counter = 0; - seeds[delegate.publicKey] = { + seeds[validator.publicKey] = { counter, - seeds: seedsForDelegate, + seeds: seedsForValidator, }; } return seeds; }; -const generateBlocks = ({ startHeight, numberOfBlocks, delegateList }) => { - const seedReveals = generateSeedReveals({ delegateList, numberOfBlocks }); - const numberOfDelegates = delegateList.length; +const generateBlocks = ({ startHeight, numberOfBlocks, validatorList }) => { + const seedReveals = generateSeedReveals({ validatorList, numberOfBlocks }); + const numberOfValidators = validatorList.length; return new Array(numberOfBlocks).fill(0).map((_v, index) => { const height = startHeight + index; - const { publicKey } = delegateList[index % numberOfDelegates]; + const { publicKey } = validatorList[index % numberOfValidators]; const seedReveal = seedReveals[publicKey].seeds[seedReveals[publicKey].counter]; seedReveals[publicKey].counter += 1; return { - generatorPublicKey: delegateList[index % numberOfDelegates].publicKey, + generatorPublicKey: validatorList[index % numberOfValidators].publicKey, height, asset: { seedReveal: seedReveal.toString('hex'), @@ -112,7 +112,7 @@ const endOfRound = (round, blocksPerRound) => round * blocksPerRound; const middleOfRound = (round, blocksPerRound) => Math.floor((startOfRound(round, blocksPerRound) + endOfRound(round, blocksPerRound)) / 2); -const findPreviousBlockOfDelegate = (block, searchTillHeight, blocksMap) => { +const findPreviousBlockOfValidator = (block, searchTillHeight, blocksMap) => { const { height, generatorPublicKey } = block; const searchTill = Math.max(searchTillHeight, 1); @@ -135,13 +135,13 @@ const selectSeedReveal = ({ fromHeight, toHeight, blocksMap, blocksPerRound }) = const block = blocksMap[i]; const blockRound = calcRound(block.height, blocksPerRound); - const lastForgedBlock = findPreviousBlockOfDelegate( + const lastForgedBlock = findPreviousBlockOfValidator( block, startOfRound(blockRound - 1, blocksPerRound), blocksMap, ); - // If delegate not forged any other block earlier in current and last round + // If validator not forged any other block earlier in current and last round if (!lastForgedBlock) { continue; } @@ -228,14 +228,14 @@ const randomSeedFirstRound = () => ({ title: 'Random seed for first round', summary: 'Random seeds generation for first round', config: { network: 'devnet' }, - runner: 'dpos_random_seed_generation', - handler: 'dpos_random_seed_generation_first_round', + runner: 'pos_random_seed_generation', + handler: 'pos_random_seed_generation_first_round', testCases: (() => { - const blocksPerRound = activeDelegates + standByDelegates; + const blocksPerRound = activeValidators + standByValidators; const blocks = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound, - delegateList: sampleDelegateList.slice(0, blocksPerRound), + validatorList: sampleValidatorList.slice(0, blocksPerRound), }); const { randomSeed1, randomSeed2 } = generateRandomSeed(blocks, blocksPerRound); @@ -259,26 +259,26 @@ const randomSeedForMoreRounds = () => ({ title: 'Random seed for more than one rounds', summary: 'Random seeds generation more than one rounds', config: { network: 'devnet' }, - runner: 'dpos_random_seed_generation', - handler: 'dpos_random_seed_generation_other_rounds', + runner: 'pos_random_seed_generation', + handler: 'pos_random_seed_generation_other_rounds', testCases: (() => { - const blocksPerRound = activeDelegates + standByDelegates; + const blocksPerRound = activeValidators + standByValidators; const blocksForTwoRounds = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound * 2, - delegateList: sampleDelegateList.slice(0, blocksPerRound), + validatorList: sampleValidatorList.slice(0, blocksPerRound), }); const blocksForThreeRounds = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound * 3, - delegateList: sampleDelegateList.slice(0, blocksPerRound), + validatorList: sampleValidatorList.slice(0, blocksPerRound), }); const blocksForFiveRounds = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound * 5, - delegateList: sampleDelegateList.slice(0, blocksPerRound), + validatorList: sampleValidatorList.slice(0, blocksPerRound), }); return [ @@ -314,14 +314,14 @@ const randomSeedIfNotPassedMiddleOfRound = () => ({ title: 'Random seed for round not passed the middle of the round', summary: 'Random seed for round not passed the middle of the round', config: { network: 'devnet' }, - runner: 'dpos_random_seed_generation', - handler: 'dpos_random_seed_generation_not_passed_middle_of_round', + runner: 'pos_random_seed_generation', + handler: 'pos_random_seed_generation_not_passed_middle_of_round', testCases: (() => { - const blocksPerRound = activeDelegates + standByDelegates; + const blocksPerRound = activeValidators + standByValidators; const blocks = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound + 2, - delegateList: sampleDelegateList.slice(0, blocksPerRound), + validatorList: sampleValidatorList.slice(0, blocksPerRound), }); const randomSeed1 = null; @@ -346,24 +346,24 @@ const randomSeedIfNotPassedMiddleOfRound = () => ({ const randomSeedForInvalidPreImageOfSeedReveal = () => ({ title: 'Random seed for invalid pre image', summary: - 'Random seeds generation for the case when a delegate have invalid pre-image for seed reveal', + 'Random seeds generation for the case when a validator have invalid pre-image for seed reveal', config: { network: 'devnet' }, - runner: 'dpos_random_seed_generation', - handler: 'dpos_random_seed_generation_invalid_seed_reveal', + runner: 'pos_random_seed_generation', + handler: 'pos_random_seed_generation_invalid_seed_reveal', testCases: (() => { - const blocksPerRound = activeDelegates + standByDelegates; - const delegateList = sampleDelegateList.slice(0, blocksPerRound); + const blocksPerRound = activeValidators + standByValidators; + const validatorList = sampleValidatorList.slice(0, blocksPerRound); const blocks = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound * 2, - delegateList, + validatorList, }); - // Change seed reveal values for a delegate for first round - const suspiciousDelegate = delegateList[1]; + // Change seed reveal values for a validator for first round + const suspiciousValidator = validatorList[1]; for (const block of blocks) { if ( - block.generatorPublicKey === suspiciousDelegate.publicKey && + block.generatorPublicKey === suspiciousValidator.publicKey && block.height <= blocksPerRound ) { block.asset.seedReveal = strippedHash(numberToBuffer(block.height)).toString('hex'); @@ -375,7 +375,7 @@ const randomSeedForInvalidPreImageOfSeedReveal = () => ({ return [ { description: - 'Random seeds generation for the case when a delegate have invalid pre-image for seed reveal', + 'Random seeds generation for the case when a validator have invalid pre-image for seed reveal', config: { blocksPerRound }, input: { blocks, @@ -391,25 +391,25 @@ const randomSeedForInvalidPreImageOfSeedReveal = () => ({ const randomSeedIfForgerNotForgedEarlier = () => ({ title: 'Random seed for not forged earlier', - summary: 'Random seeds generation for the case when delegate did not forged earlier', + summary: 'Random seeds generation for the case when validator did not forged earlier', config: { network: 'devnet' }, - runner: 'dpos_random_seed_generation', - handler: 'dpos_random_seed_generation_not_forged_earlier', + runner: 'pos_random_seed_generation', + handler: 'pos_random_seed_generation_not_forged_earlier', testCases: (() => { - const blocksPerRound = activeDelegates + standByDelegates; - const delegateList = sampleDelegateList.slice(0, blocksPerRound); + const blocksPerRound = activeValidators + standByValidators; + const validatorList = sampleValidatorList.slice(0, blocksPerRound); const blocks = generateBlocks({ startHeight: 1, numberOfBlocks: blocksPerRound * 2, - delegateList, + validatorList, }); - // Change seed reveal values for a delegate for first round - const oldDelegate = delegateList[0]; - const newDelegate = sampleDelegateList[blocksPerRound]; + // Change seed reveal values for a validator for first round + const oldValidator = validatorList[0]; + const newValidator = sampleValidatorList[blocksPerRound]; for (const block of blocks) { - if (block.generatorPublicKey === oldDelegate.publicKey && block.height <= blocksPerRound) { - block.generatorPublicKey = newDelegate.publicKey; + if (block.generatorPublicKey === oldValidator.publicKey && block.height <= blocksPerRound) { + block.generatorPublicKey = newValidator.publicKey; } } @@ -417,7 +417,7 @@ const randomSeedIfForgerNotForgedEarlier = () => ({ return [ { - description: 'Random seeds generation for the case when delegate did not forged earlier', + description: 'Random seeds generation for the case when validator did not forged earlier', config: { blocksPerRound, }, @@ -433,7 +433,7 @@ const randomSeedIfForgerNotForgedEarlier = () => ({ })(), }); -module.exports = BaseGenerator.runGenerator('dpos_random_seed_generation', [ +module.exports = BaseGenerator.runGenerator('pos_random_seed_generation', [ randomSeedFirstRound, randomSeedForMoreRounds, randomSeedIfNotPassedMiddleOfRound, diff --git a/protocol-specs/generators/dpos_random_seed_generation/sample_generator.js b/protocol-specs/generators/pos_random_seed_generation/sample_generator.js similarity index 72% rename from protocol-specs/generators/dpos_random_seed_generation/sample_generator.js rename to protocol-specs/generators/pos_random_seed_generation/sample_generator.js index 9618e3295bb..e18a89fbd99 100644 --- a/protocol-specs/generators/dpos_random_seed_generation/sample_generator.js +++ b/protocol-specs/generators/pos_random_seed_generation/sample_generator.js @@ -21,31 +21,31 @@ const fs = require('fs'); const [amount = 150, filePath, fixedValue] = process.argv.slice(2); -const generateDelegates = (num, fixedNum) => { - const delegateList = []; +const generateValidators = (num, fixedNum) => { + const validatorList = []; for (let i = 0; i < num; i += 1) { const passphrase = Mnemonic.generateMnemonic(); const { publicKey } = getPrivateAndPublicKeyFromPassphrase(passphrase); const buf = crypto.randomBytes(8); const randomNumber = buf.readBigUInt64BE() / BigInt(10) ** BigInt(8); - const voteWeight = fixedValue + const validatorWeight = fixedValue ? BigInt(fixedNum) : randomNumber - (randomNumber % BigInt(10) ** BigInt(9)); - delegateList.push({ + validatorList.push({ publicKey, - voteWeight: voteWeight.toString(), - // lsk: (voteWeight / (BigInt(10) ** BigInt(8))).toString(), + validatorWeight: validatorWeight.toString(), + // lsk: (validatorWeight / (BigInt(10) ** BigInt(8))).toString(), }); } - return { list: delegateList }; + return { list: validatorList }; }; -const delegates = generateDelegates(amount, fixedValue); +const validators = generateValidators(amount, fixedValue); if (!filePath) { - console.info(delegates); + console.info(validators); process.exit(0); } -fs.writeFileSync(filePath, JSON.stringify(delegates, undefined, '\t')); +fs.writeFileSync(filePath, JSON.stringify(validators, undefined, '\t')); diff --git a/protocol-specs/generators/pos_validator_shuffling/README.md b/protocol-specs/generators/pos_validator_shuffling/README.md new file mode 100644 index 00000000000..0f9b17b70dd --- /dev/null +++ b/protocol-specs/generators/pos_validator_shuffling/README.md @@ -0,0 +1,17 @@ +# Uniform shuffling of validators + +A set of test generators for Uniform ordering of validators list by LIP-0003 + +### Format + +#### Input + +- random seed: Random seed from the (round - 1). + +#### Output + +- Shuffled validators list: list of addresses that is different in order from the previous validator list. + +## Resources + +- [LIP-0003](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0003.md) diff --git a/protocol-specs/generators/pos_validator_shuffling/index.js b/protocol-specs/generators/pos_validator_shuffling/index.js new file mode 100644 index 00000000000..9ff0e3616d7 --- /dev/null +++ b/protocol-specs/generators/pos_validator_shuffling/index.js @@ -0,0 +1,61 @@ +/* + * Copyright © 2020 Lisk Foundation + * + * See the LICENSE file at the top-level directory of this distribution + * for licensing information. + * + * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, + * no part of this software, including this file, may be copied, modified, + * propagated, or distributed except according to the terms contained in the + * LICENSE file. + * + * Removal or modification of this copyright notice is prohibited. + */ + +'use strict'; + +const { utils } = require('@liskhq/lisk-cryptography'); +const BaseGenerator = require('../base_generator'); +const previousValidatorList = require('./validator_address_list.json').validatorList; + +const generateShuffledValidatorList = () => { + const previousRoundSeed1 = 'b9acc2f1fda3666bfb34107f1c6dccc4'; + const validatorList = [...previousValidatorList].map(validator => ({ + address: Buffer.from(validator.address, 'hex'), + })); + for (const validator of validatorList) { + const seedSource = Buffer.concat([Buffer.from(previousRoundSeed1, 'hex'), validator.address]); + validator.roundHash = utils.hash(seedSource); + } + + validatorList.sort((validator1, validator2) => { + const diff = validator1.roundHash.compare(validator2.roundHash); + if (diff !== 0) { + return diff; + } + return validator1.address.compare(validator2.address); + }); + + return { + input: { + previousRoundSeed1, + validatorList: previousValidatorList.map(validator => validator.address), + }, + output: { + validatorList: validatorList.map(validator => validator.address), + }, + }; +}; + +const uniformlyShuffledValidatorList = () => ({ + title: 'Uniform shuffling of validator list in each round', + summary: 'A uniformly shuffled validator list is generated', + config: 'devnet', + runner: 'pos_validator_shuffling', + handler: 'uniformly_shuffled_validator_list', + testCases: generateShuffledValidatorList(), +}); + +module.exports = BaseGenerator.runGenerator('pos_validator_shuffling', [ + uniformlyShuffledValidatorList, +]); diff --git a/protocol-specs/generators/dpos_delegate_shuffling/sample_generator.js b/protocol-specs/generators/pos_validator_shuffling/sample_generator.js similarity index 72% rename from protocol-specs/generators/dpos_delegate_shuffling/sample_generator.js rename to protocol-specs/generators/pos_validator_shuffling/sample_generator.js index 34c7868ad3b..788276feb9d 100644 --- a/protocol-specs/generators/dpos_delegate_shuffling/sample_generator.js +++ b/protocol-specs/generators/pos_validator_shuffling/sample_generator.js @@ -18,28 +18,28 @@ const { utils, ed } = require('@liskhq/lisk-cryptography'); const { Mnemonic } = require('@liskhq/lisk-passphrase'); const fs = require('fs'); -const [numberOfDelegates = 103, filePath] = process.argv.slice(2); +const [numberOfValidators = 103, filePath] = process.argv.slice(2); -const generateDelegates = num => { - const delegateList = []; +const generateValidators = num => { + const validatorList = []; for (let i = 0; i < num; i += 1) { const passphrase = Mnemonic.generateMnemonic(); const { publicKey } = ed.getKeys(passphrase); const address = utils.hash(Buffer.from(publicKey, 'hex')).slice(0, 20); - delegateList.push({ + validatorList.push({ address, }); } - return { delegateList }; + return { validatorList }; }; -const delegates = generateDelegates(numberOfDelegates); +const validators = generateValidators(numberOfValidators); if (!filePath) { - console.info(delegates); + console.info(validators); process.exit(0); } -fs.writeFileSync(filePath, JSON.stringify(delegates, undefined, '\t')); +fs.writeFileSync(filePath, JSON.stringify(validators, undefined, '\t')); diff --git a/protocol-specs/generators/dpos_delegate_shuffling/delegate_address_list.json b/protocol-specs/generators/pos_validator_shuffling/validator_address_list.json similarity index 99% rename from protocol-specs/generators/dpos_delegate_shuffling/delegate_address_list.json rename to protocol-specs/generators/pos_validator_shuffling/validator_address_list.json index e7fcd32ed9a..a2aa7a88f97 100644 --- a/protocol-specs/generators/dpos_delegate_shuffling/delegate_address_list.json +++ b/protocol-specs/generators/pos_validator_shuffling/validator_address_list.json @@ -1,5 +1,5 @@ { - "delegateList": [ + "validatorList": [ { "address": "fa1c00809ff1b10cd269a711eef40a465ba4a9cb" }, diff --git a/protocol-specs/generators/proof_of_misbehavior_transaction/index.js b/protocol-specs/generators/proof_of_misbehavior_transaction/index.js index 8349c1827f5..3195e80ec1c 100644 --- a/protocol-specs/generators/proof_of_misbehavior_transaction/index.js +++ b/protocol-specs/generators/proof_of_misbehavior_transaction/index.js @@ -161,7 +161,7 @@ const accounts = { passphrase: 'actress route auction pudding shiver crater forum liquid blouse imitate seven front', balance: BigInt('10000000000000000'), - delegateName: 'genesis_100', + validatorName: 'genesis_100', }, }; diff --git a/protocol-specs/generators/transaction_network_id_and_change_order/index.js b/protocol-specs/generators/transaction_network_id_and_change_order/index.js index 0d9ac09b55e..406fcda8aea 100644 --- a/protocol-specs/generators/transaction_network_id_and_change_order/index.js +++ b/protocol-specs/generators/transaction_network_id_and_change_order/index.js @@ -89,8 +89,8 @@ const balanceTransferAsset = { required: ['amount', 'recipientAddress', 'data'], }; -const delegateRegAsset = { - $id: 'delegateRegAsset', +const validatorRegAsset = { + $id: 'validatorRegAsset', type: 'object', properties: { username: { dataType: 'string', fieldNumber: 1 } }, required: ['username'], @@ -149,7 +149,7 @@ const generateValidTransferTransaction = () => { }; }; -const generateValidDelegateTransaction = () => { +const generateValidValidatorTransaction = () => { const tx = { moduleID: 5, assetID: 0, @@ -157,11 +157,11 @@ const generateValidDelegateTransaction = () => { nonce: BigInt('2'), fee: BigInt('100000000'), asset: { - username: 'new_delegate', + username: 'new_validator', }, }; - const assetBytes = codec.encode(delegateRegAsset, tx.asset); + const assetBytes = codec.encode(validatorRegAsset, tx.asset); const signingTx = { ...tx, asset: assetBytes, @@ -183,7 +183,7 @@ const generateValidDelegateTransaction = () => { }); return { - description: 'A valid delegate transaction', + description: 'A valid validator transaction', input: { account: { ...accounts[0], @@ -209,16 +209,16 @@ const validTransferSuite = () => ({ testCases: [generateValidTransferTransaction()], }); -const validDelegateSuite = () => ({ - title: 'Valid delegate transaction', - summary: 'A valid delegate transaction', +const validValidatorSuite = () => ({ + title: 'Valid validator transaction', + summary: 'A valid validator transaction', config: { network: 'devnet' }, runner: 'transaction_network_id_and_change_order', - handler: 'delegate_transaction_validate', - testCases: [generateValidDelegateTransaction()], + handler: 'validator_transaction_validate', + testCases: [generateValidValidatorTransaction()], }); module.exports = BaseGenerator.runGenerator('transaction_network_id_and_change_order', [ validTransferSuite, - validDelegateSuite, + validValidatorSuite, ]); diff --git a/protocol-specs/generators/unlocking_transaction/README.md b/protocol-specs/generators/unlocking_transaction/README.md index 8029c4bc8f5..212025b7694 100644 --- a/protocol-specs/generators/unlocking_transaction/README.md +++ b/protocol-specs/generators/unlocking_transaction/README.md @@ -9,7 +9,7 @@ A set of test generators for unlocking transaction transactions by LIP-0023 and - account: sender account - transaction: raw transaction - network identifier: network identifier used -- delegates: accounts which are registered as delegate +- validators: accounts which are registered as validator #### Output diff --git a/protocol-specs/generators/unlocking_transaction/index.js b/protocol-specs/generators/unlocking_transaction/index.js index d8bd66f8bf4..13a7d30f04a 100644 --- a/protocol-specs/generators/unlocking_transaction/index.js +++ b/protocol-specs/generators/unlocking_transaction/index.js @@ -28,7 +28,7 @@ const senderAccount = { publicKey: Buffer.from('8c3d81b1555fbe4692adfa1026ee21c043633b9369924cf2790e2e0fc6b47a66', 'hex'), address: Buffer.from('67aeac2f0dcaae0b7790777a3b4ba296c427dbeb', 'hex'), }; -const delegateAccounts = [ +const validatorAccounts = [ { publicKey: Buffer.from( '5430e775505b3145c124d15dc7c84ca7c751ecb69faf653bfb1e0c91e6e22f8a', @@ -180,11 +180,11 @@ const assetSchema = { items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'uint64', fieldNumber: 2 }, - unvoteHeight: { dataType: 'uint32', fieldNumber: 3 }, + unstakeHeight: { dataType: 'uint32', fieldNumber: 3 }, }, - required: ['delegateAddress', 'amount', 'unvoteHeight'], + required: ['validatorAddress', 'amount', 'unstakeHeight'], }, fieldNumber: 1, }, @@ -213,7 +213,7 @@ const encode = tx => { return codec.encode(baseTransactionSchema, txWithAssetBytes); }; -const generateValidUpvoteTransaction = () => { +const generateValidUpstakeTransaction = () => { const unsignedTransaction = { moduleID: 5, assetID: 2, @@ -223,104 +223,104 @@ const generateValidUpvoteTransaction = () => { asset: { unlockObjects: [ { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('1000000000'), - unvoteHeight: 32, + unstakeHeight: 32, }, { - delegateAddress: delegateAccounts[1].address, + validatorAddress: validatorAccounts[1].address, amount: BigInt('50000000000'), - unvoteHeight: 12, + unstakeHeight: 12, }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('320000000000'), - unvoteHeight: 14, + unstakeHeight: 14, }, { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('420000000000'), - unvoteHeight: 19, + unstakeHeight: 19, }, { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('520000000000'), - unvoteHeight: 50, + unstakeHeight: 50, }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('620000000000'), - unvoteHeight: 14, + unstakeHeight: 14, }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('620000000000'), - unvoteHeight: 14, + unstakeHeight: 14, }, { - delegateAddress: delegateAccounts[3].address, + validatorAddress: validatorAccounts[3].address, amount: BigInt('920000000000'), - unvoteHeight: 33, + unstakeHeight: 33, }, { - delegateAddress: delegateAccounts[4].address, + validatorAddress: validatorAccounts[4].address, amount: BigInt('140000000000'), - unvoteHeight: 19, + unstakeHeight: 19, }, { - delegateAddress: delegateAccounts[5].address, + validatorAddress: validatorAccounts[5].address, amount: BigInt('130000000000'), - unvoteHeight: 53, + unstakeHeight: 53, }, { - delegateAddress: delegateAccounts[6].address, + validatorAddress: validatorAccounts[6].address, amount: BigInt('1000000000'), - unvoteHeight: 32, + unstakeHeight: 32, }, { - delegateAddress: delegateAccounts[7].address, + validatorAddress: validatorAccounts[7].address, amount: BigInt('50000000000'), - unvoteHeight: 18, + unstakeHeight: 18, }, { - delegateAddress: delegateAccounts[8].address, + validatorAddress: validatorAccounts[8].address, amount: BigInt('320000000000'), - unvoteHeight: 29, + unstakeHeight: 29, }, { - delegateAddress: delegateAccounts[9].address, + validatorAddress: validatorAccounts[9].address, amount: BigInt('420000000000'), - unvoteHeight: 6, + unstakeHeight: 6, }, { - delegateAddress: senderAccount.address, + validatorAddress: senderAccount.address, amount: BigInt('520000000000'), - unvoteHeight: 44, + unstakeHeight: 44, }, { - delegateAddress: delegateAccounts[11].address, + validatorAddress: validatorAccounts[11].address, amount: BigInt('620000000000'), - unvoteHeight: 41, + unstakeHeight: 41, }, { - delegateAddress: delegateAccounts[12].address, + validatorAddress: validatorAccounts[12].address, amount: BigInt('820000000000'), - unvoteHeight: 13, + unstakeHeight: 13, }, { - delegateAddress: delegateAccounts[13].address, + validatorAddress: validatorAccounts[13].address, amount: BigInt('920000000000'), - unvoteHeight: 25, + unstakeHeight: 25, }, { - delegateAddress: delegateAccounts[14].address, + validatorAddress: validatorAccounts[14].address, amount: BigInt('140000000000'), - unvoteHeight: 31, + unstakeHeight: 31, }, { - delegateAddress: delegateAccounts[15].address, + validatorAddress: validatorAccounts[15].address, amount: BigInt('130000000000'), - unvoteHeight: 21, + unstakeHeight: 21, }, ], }, @@ -346,7 +346,7 @@ const generateValidUpvoteTransaction = () => { publicKey: senderAccount.publicKey, }, chainID, - delegates: delegateAccounts.map(d => ({ + validators: validatorAccounts.map(d => ({ ...d, address: d.address, publicKey: d.publicKey, @@ -366,7 +366,7 @@ const validUnlockingSuite = () => ({ }, runner: 'unlock_transaction', handler: 'unlock_transaction', - testCases: [generateValidUpvoteTransaction()], + testCases: [generateValidUpstakeTransaction()], }); module.exports = BaseGenerator.runGenerator('unlock_transaction', [validUnlockingSuite]); diff --git a/protocol-specs/generators/vote_transaction/README.md b/protocol-specs/generators/vote_transaction/README.md index 9539d8a58e3..9a8575f9e27 100644 --- a/protocol-specs/generators/vote_transaction/README.md +++ b/protocol-specs/generators/vote_transaction/README.md @@ -1,6 +1,6 @@ # Multisignature Transaction Signing and Serialisation -A set of test generators for updated vote transaction transactions by LIP-0023 +A set of test generators for updated stake transaction transactions by LIP-0023 ### Format @@ -9,7 +9,7 @@ A set of test generators for updated vote transaction transactions by LIP-0023 - account: sender account - transaction: raw transaction - network identifier: network identifier used -- delegates: accounts which are registered as delegate +- validators: accounts which are registered as validator #### Output diff --git a/protocol-specs/generators/vote_transaction/index.js b/protocol-specs/generators/vote_transaction/index.js index cace164e25e..16d8ed73f56 100644 --- a/protocol-specs/generators/vote_transaction/index.js +++ b/protocol-specs/generators/vote_transaction/index.js @@ -28,7 +28,7 @@ const senderAccount = { publicKey: Buffer.from('8c3d81b1555fbe4692adfa1026ee21c043633b9369924cf2790e2e0fc6b47a66', 'hex'), address: Buffer.from('67aeac2f0dcaae0b7790777a3b4ba296c427dbeb', 'hex'), }; -const delegateAccounts = [ +const validatorAccounts = [ { passphrase: 'vivid phrase noble marble puzzle result pony dream loud deliver catch liquid', publicKey: Buffer.from( @@ -194,23 +194,23 @@ const delegateAccounts = [ ]; const assetSchema = { - $id: '/protocolSpec/assets/vote', + $id: '/protocolSpec/assets/stake', type: 'object', properties: { - votes: { + stakes: { type: 'array', items: { type: 'object', properties: { - delegateAddress: { dataType: 'bytes', fieldNumber: 1 }, + validatorAddress: { dataType: 'bytes', fieldNumber: 1 }, amount: { dataType: 'sint64', fieldNumber: 2 }, }, - required: ['delegateAddress', 'amount'], + required: ['validatorAddress', 'amount'], }, fieldNumber: 1, }, }, - required: ['votes'], + required: ['stakes'], }; const getAssetBytes = asset => codec.encode(assetSchema, asset); @@ -234,7 +234,7 @@ const encode = tx => { return codec.encode(baseTransactionSchema, txWithAssetBytes); }; -const generateValidUpvoteTransaction = () => { +const generateValidUpstakeTransaction = () => { const unsignedTransaction = { moduleID: 5, assetID: 1, @@ -242,45 +242,45 @@ const generateValidUpvoteTransaction = () => { nonce: BigInt('1'), senderPublicKey: senderAccount.publicKey, asset: { - votes: [ + stakes: [ { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('1000000000'), }, { - delegateAddress: delegateAccounts[1].address, + validatorAddress: validatorAccounts[1].address, amount: BigInt('50000000000'), }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('320000000000'), }, { - delegateAddress: delegateAccounts[3].address, + validatorAddress: validatorAccounts[3].address, amount: BigInt('420000000000'), }, { - delegateAddress: delegateAccounts[4].address, + validatorAddress: validatorAccounts[4].address, amount: BigInt('520000000000'), }, { - delegateAddress: delegateAccounts[5].address, + validatorAddress: validatorAccounts[5].address, amount: BigInt('620000000000'), }, { - delegateAddress: delegateAccounts[6].address, + validatorAddress: validatorAccounts[6].address, amount: BigInt('820000000000'), }, { - delegateAddress: delegateAccounts[7].address, + validatorAddress: validatorAccounts[7].address, amount: BigInt('920000000000'), }, { - delegateAddress: delegateAccounts[8].address, + validatorAddress: validatorAccounts[8].address, amount: BigInt('140000000000'), }, { - delegateAddress: delegateAccounts[9].address, + validatorAddress: validatorAccounts[9].address, amount: BigInt('130000000000'), }, ], @@ -304,7 +304,7 @@ const generateValidUpvoteTransaction = () => { publicKey: senderAccount.publicKey, }, chainID, - delegates: delegateAccounts.map(d => ({ + validators: validatorAccounts.map(d => ({ ...d, address: d.address, publicKey: d.publicKey, @@ -316,52 +316,52 @@ const generateValidUpvoteTransaction = () => { }; }; -const generateValidDownvoteTransaction = () => { +const generateValidDownstakeTransaction = () => { const unsignedTransaction = { type: 13, fee: BigInt('1500000000'), nonce: BigInt('2'), senderPublicKey: senderAccount.publicKey, asset: { - votes: [ + stakes: [ { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('-10000000000000'), }, { - delegateAddress: delegateAccounts[1].address, + validatorAddress: validatorAccounts[1].address, amount: BigInt('-20030000000000'), }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('-30030000000000'), }, { - delegateAddress: delegateAccounts[3].address, + validatorAddress: validatorAccounts[3].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[4].address, + validatorAddress: validatorAccounts[4].address, amount: BigInt('-50200000000000'), }, { - delegateAddress: delegateAccounts[5].address, + validatorAddress: validatorAccounts[5].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[6].address, + validatorAddress: validatorAccounts[6].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[7].address, + validatorAddress: validatorAccounts[7].address, amount: BigInt('-50000000000000'), }, { - delegateAddress: delegateAccounts[8].address, + validatorAddress: validatorAccounts[8].address, amount: BigInt('-50000000000000'), }, { - delegateAddress: delegateAccounts[9].address, + validatorAddress: validatorAccounts[9].address, amount: BigInt('-10000000000000'), }, ], @@ -386,7 +386,7 @@ const generateValidDownvoteTransaction = () => { publicKey: senderAccount.publicKey, }, chainID, - delegates: delegateAccounts.map(d => ({ + validators: validatorAccounts.map(d => ({ ...d, address: d.address, publicKey: d.publicKey, @@ -398,92 +398,92 @@ const generateValidDownvoteTransaction = () => { }; }; -const generateValidUpvoteAndDownvoteVoteTransaction = () => { +const generateValidUpstakeAndDownstakeVoteTransaction = () => { const unsignedTransaction = { type: 13, fee: BigInt('1500000000'), nonce: BigInt('2'), senderPublicKey: senderAccount.publicKey, asset: { - votes: [ + stakes: [ { - delegateAddress: delegateAccounts[0].address, + validatorAddress: validatorAccounts[0].address, amount: BigInt('-10000000000000'), }, { - delegateAddress: delegateAccounts[1].address, + validatorAddress: validatorAccounts[1].address, amount: BigInt('1000000000'), }, { - delegateAddress: delegateAccounts[2].address, + validatorAddress: validatorAccounts[2].address, amount: BigInt('140000000000'), }, { - delegateAddress: delegateAccounts[3].address, + validatorAddress: validatorAccounts[3].address, amount: BigInt('-20030000000000'), }, { - delegateAddress: delegateAccounts[4].address, + validatorAddress: validatorAccounts[4].address, amount: BigInt('-30030000000000'), }, { - delegateAddress: delegateAccounts[5].address, + validatorAddress: validatorAccounts[5].address, amount: BigInt('50000000000'), }, { - delegateAddress: delegateAccounts[6].address, + validatorAddress: validatorAccounts[6].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[7].address, + validatorAddress: validatorAccounts[7].address, amount: BigInt('-50200000000000'), }, { - delegateAddress: delegateAccounts[8].address, + validatorAddress: validatorAccounts[8].address, amount: BigInt('520000000000'), }, { - delegateAddress: delegateAccounts[9].address, + validatorAddress: validatorAccounts[9].address, amount: BigInt('420000000000'), }, { - delegateAddress: delegateAccounts[10].address, + validatorAddress: validatorAccounts[10].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[11].address, + validatorAddress: validatorAccounts[11].address, amount: BigInt('-40030000000000'), }, { - delegateAddress: delegateAccounts[12].address, + validatorAddress: validatorAccounts[12].address, amount: BigInt('920000000000'), }, { - delegateAddress: delegateAccounts[13].address, + validatorAddress: validatorAccounts[13].address, amount: BigInt('-50000000000000'), }, { - delegateAddress: delegateAccounts[14].address, + validatorAddress: validatorAccounts[14].address, amount: BigInt('620000000000'), }, { - delegateAddress: delegateAccounts[15].address, + validatorAddress: validatorAccounts[15].address, amount: BigInt('-50000000000000'), }, { - delegateAddress: delegateAccounts[16].address, + validatorAddress: validatorAccounts[16].address, amount: BigInt('320000000000'), }, { - delegateAddress: delegateAccounts[17].address, + validatorAddress: validatorAccounts[17].address, amount: BigInt('820000000000'), }, { - delegateAddress: delegateAccounts[18].address, + validatorAddress: validatorAccounts[18].address, amount: BigInt('130000000000'), }, { - delegateAddress: delegateAccounts[19].address, + validatorAddress: validatorAccounts[19].address, amount: BigInt('-50000000000000'), }, ], @@ -508,7 +508,7 @@ const generateValidUpvoteAndDownvoteVoteTransaction = () => { publicKey: senderAccount.publicKey, }, chainID, - delegates: delegateAccounts.map(d => ({ + validators: validatorAccounts.map(d => ({ ...d, address: d.address, publicKey: d.publicKey, @@ -520,19 +520,19 @@ const generateValidUpvoteAndDownvoteVoteTransaction = () => { }; }; -const validUpvoteSuite = () => ({ - title: 'Valid vote transaction', - summary: 'Cases of valid vote transaction with upvote, downvote and mixture of both', +const validUpstakeSuite = () => ({ + title: 'Valid stake transaction', + summary: 'Cases of valid stake transaction with upvote, downvote and mixture of both', config: { network: 'devnet', }, runner: 'vote_transaction', handler: 'vote_transaction_10_upvotes', testCases: [ - generateValidUpvoteTransaction(), - generateValidDownvoteTransaction(), - generateValidUpvoteAndDownvoteVoteTransaction(), + generateValidUpstakeTransaction(), + generateValidDownstakeTransaction(), + generateValidUpstakeAndDownstakeVoteTransaction(), ], }); -module.exports = BaseGenerator.runGenerator('vote_transaction', [validUpvoteSuite]); +module.exports = BaseGenerator.runGenerator('vote_transaction', [validUpstakeSuite]); diff --git a/protocol-specs/schema/README.md b/protocol-specs/schema/README.md index 41e58e7cff7..9bcafd077f2 100644 --- a/protocol-specs/schema/README.md +++ b/protocol-specs/schema/README.md @@ -55,7 +55,7 @@ A string type value explaining in detail purpose and value of the spec ## runner -A string identifier to point to a protocol spec name e.g. dpos, bft +A string identifier to point to a protocol spec name e.g. pos, bft `runner` diff --git a/protocol-specs/schema/lisk_protocol_specs.schema.json b/protocol-specs/schema/lisk_protocol_specs.schema.json index 06becba7213..8085dcc3008 100644 --- a/protocol-specs/schema/lisk_protocol_specs.schema.json +++ b/protocol-specs/schema/lisk_protocol_specs.schema.json @@ -21,7 +21,7 @@ }, "runner": { "type": "string", - "description": "A string identifier to point to a protocol spec name e.g. dpos, bft", + "description": "A string identifier to point to a protocol spec name e.g. pos, bft", "minLength": 3, "maxLength": 100, "pattern": "[a-z0-9_]*" diff --git a/protocol-specs/utils/README.md b/protocol-specs/utils/README.md index d66e8c5fa02..9eb7024fb82 100644 --- a/protocol-specs/utils/README.md +++ b/protocol-specs/utils/README.md @@ -9,8 +9,8 @@ It's a library that abstracts transaction and block generation by usage of a flu Available methods: - `transfer()`: creates a transfer transaction to be included in a block -- `registerDelegate()`: creates a delegate registration -- `castVotesFrom()`: creates vote transactions +- `registerValidator()`: creates a validator registration +- `castVotesFrom()`: creates stake transactions - `registerMultisignature()`: creates multi signature registration transaction - `signTransaction()`: sign a transaction from a multisignature account (needs to be called immediately after creating the transaction) - `forge()`: creates a block including all the previously created transactions and it will update account balances and states based on the included transactions. @@ -26,10 +26,10 @@ Transfer Lisk: chainStateBuilder.transfer('50').from('16313739661670634666L').to('10881167371402274308L').forge(); ``` -Register Delegate: +Register Validator: ```javascript -chainStateBuilder.registerDelegate('ADelegateName').for('2222471382442610527L').forge(); +chainStateBuilder.registerValidator('AValidatorName').for('2222471382442610527L').forge(); ``` Cast Votes @@ -37,11 +37,11 @@ Cast Votes ```javascript chainStateBuilder .castVotesFrom('2222471382442610527L') - .voteDelegates([ + .stakes([ 'eeeb0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9', 'aaab0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9', ]) - .unvoteDelegates([ + .unstakes([ 'ooob0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9' 'uuub0e15a44b0fdc6ff291be28d8c98f5551d0cd9218d749e30ddb87c6e31ca9', ]); diff --git a/protocol-specs/utils/bft/index.js b/protocol-specs/utils/bft/index.js index f6e058ff0d3..5337628f4d9 100644 --- a/protocol-specs/utils/bft/index.js +++ b/protocol-specs/utils/bft/index.js @@ -26,13 +26,13 @@ const loadCSVFile = filePath => .map(line => line.toString().split(',')); const generateBlockHeader = ({ - delegateName, + validatorName, height, maxHeightPreviouslyForged, maxHeightPrevoted, - delegateMinHeightActive, + validatorMinHeightActive, }) => { - const generatorPublicKey = getKeys(delegateName).publicKey; + const generatorPublicKey = getKeys(validatorName).publicKey; // Generate a deterministic block id from a block height const id = BigNum.fromBuffer(hash(height.toString(), 'utf8').slice(0, 8)).toString(); @@ -42,25 +42,25 @@ const generateBlockHeader = ({ height, maxHeightPreviouslyForged, generatorPublicKey, - delegateMinHeightActive, + validatorMinHeightActive, maxHeightPrevoted, }; }; -const generateBlockHeadersSeries = ({ activeDelegates, count }) => { - const threshold = Math.ceil((activeDelegates * 2) / 3); +const generateBlockHeadersSeries = ({ activeValidators, count }) => { + const threshold = Math.ceil((activeValidators * 2) / 3); return new Array(count).fill(0).map((_v, index) => { const height = index + 1; const maxHeightPrevoted = height - threshold; - const maxHeightPreviouslyForged = height - activeDelegates; + const maxHeightPreviouslyForged = height - activeValidators; return generateBlockHeader({ - delegateName: `D${height % activeDelegates}`, + validatorName: `D${height % activeValidators}`, height, maxHeightPreviouslyForged: maxHeightPreviouslyForged < 0 ? 0 : maxHeightPreviouslyForged, maxHeightPrevoted: maxHeightPrevoted < 0 ? 0 : maxHeightPrevoted, - delegateMinHeightActive: 1, + validatorMinHeightActive: 1, }); }); }; diff --git a/sdk/README.md b/sdk/README.md index fe851b2239f..b9251f33f12 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -14,7 +14,7 @@ ## Sapphire phase [](https://lisk.com/roadmap) -We have completed [Emerald phase](https://lisk.com/roadmap)[](https://lisk.com/roadmap) that encapsulates improvement in the key areas of network security and reliability, economics, consensus and longevity. Specifically a new address system, new fee system and and an upgraded consensus algorithm for an improved version of DPoS were successfully completed. During the Emerald phase all protocol improvements in the form of 36 Lisk Improvement Proposals (LIPs) were researched, published and implemented in Lisk SDK. +We have completed [Emerald phase](https://lisk.com/roadmap)[](https://lisk.com/roadmap) that encapsulates improvement in the key areas of network security and reliability, economics, consensus and longevity. Specifically a new address system, new fee system and and an upgraded consensus algorithm for an improved version of PoS were successfully completed. During the Emerald phase all protocol improvements in the form of 36 Lisk Improvement Proposals (LIPs) were researched, published and implemented in Lisk SDK. We are currently working on [Sapphire phase](https://lisk.com/roadmap)[](https://lisk.com/roadmap) that brings the [Lisk interoperability solution](https://lisk.com/blog/research/lisk-interoperability-solution-published). All related Lisk Improvement Proposals (LIPs) are published and implementation is currently being actively developed. It consists of 8 roadmap objectives, @@ -110,9 +110,9 @@ const { app } = Application.defaultApplication(genesisBlockDevnet, { blockTime: 5, maxTransactionsSize: 100 * 1024, minRemainingBalance: "5000000", - activeDelegates: 101, - standbyDelegates: 2, - delegateListRoundOffset: 2 + activeValidators: 101, + standbyValidators: 2, + validatorListRoundOffset: 2 }, ... }); diff --git a/sdk/src/samples/config_devnet.json b/sdk/src/samples/config_devnet.json index 2e8de4c3e9a..29d57bf6eb3 100644 --- a/sdk/src/samples/config_devnet.json +++ b/sdk/src/samples/config_devnet.json @@ -23,9 +23,9 @@ "distance": 3000000 }, "minRemainingBalance": "5000000", - "activeDelegates": 101, - "standbyDelegates": 2, - "delegateListRoundOffset": 2 + "activeValidators": 101, + "standbyValidators": 2, + "validatorListRoundOffset": 2 }, "logger": { "fileLogLevel": "debug", @@ -43,7 +43,7 @@ "forging": { "force": true, "waitThreshold": 2, - "delegates": [ + "validators": [ { "encryptedPassphrase": "iterations=10&cipherText=0dbd21ac5c154dbb72ce90a4e252a64b692203a4f8e25f8bfa1b1993e2ba7a9bd9e1ef1896d8d584a62daf17a8ccf12b99f29521b92cc98b74434ff501374f7e1c6d8371a6ce4e2d083489&iv=98a89678d1ccd054b85e3b3c&salt=c9cb4e7783cacca6c0e1c210cb9252e1&tag=5c66c5e75a6241538695fb16d8f0cdc9&version=1", "hashOnion": { diff --git a/sdk/src/samples/genesis_block_devnet.json b/sdk/src/samples/genesis_block_devnet.json index 2d430cd0676..ef91d4ca7d6 100644 --- a/sdk/src/samples/genesis_block_devnet.json +++ b/sdk/src/samples/genesis_block_devnet.json @@ -11,7 +11,7 @@ "version": 0, "asset": { "initRounds": 3, - "initDelegates": [ + "initValidators": [ "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "0903f4c5cb599a7928aef27e314e98291d1e3888", "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", @@ -130,18 +130,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_34", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", + "validatorAddress": "03f6d90b7dbd0497dc3a52d1c27e23bb8c75897f", "amount": "1000000000000" } ], @@ -161,18 +161,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_74", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0903f4c5cb599a7928aef27e314e98291d1e3888", + "validatorAddress": "0903f4c5cb599a7928aef27e314e98291d1e3888", "amount": "1000000000000" } ], @@ -192,18 +192,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_98", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", + "validatorAddress": "0ada6a2f6c8f891769366fc9aa6fd9f1facb36cf", "amount": "1000000000000" } ], @@ -223,18 +223,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_83", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0bc3bec2fdb565996fd316e368e66e5d8e830808", + "validatorAddress": "0bc3bec2fdb565996fd316e368e66e5d8e830808", "amount": "1000000000000" } ], @@ -254,18 +254,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_54", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0d2c377e936b68c70066613b10c0fdad537f90da", + "validatorAddress": "0d2c377e936b68c70066613b10c0fdad537f90da", "amount": "1000000000000" } ], @@ -285,18 +285,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_50", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "0f33a5033b750e6c4dca47e38ba020e912df143e", + "validatorAddress": "0f33a5033b750e6c4dca47e38ba020e912df143e", "amount": "1000000000000" } ], @@ -316,18 +316,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_15", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "1ac73bff74924ad9b74236c4962be27174ae87d0", + "validatorAddress": "1ac73bff74924ad9b74236c4962be27174ae87d0", "amount": "1000000000000" } ], @@ -347,18 +347,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_46", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "1c194c2be1cc53f663a93c64899cbaa34016f415", + "validatorAddress": "1c194c2be1cc53f663a93c64899cbaa34016f415", "amount": "1000000000000" } ], @@ -378,18 +378,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_49", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "2159f75e5440c36431aedbc7dc29a65a327778b8", + "validatorAddress": "2159f75e5440c36431aedbc7dc29a65a327778b8", "amount": "1000000000000" } ], @@ -409,18 +409,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_77", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "246fba5c519576d93c5fac899c44b29b72f526ae", + "validatorAddress": "246fba5c519576d93c5fac899c44b29b72f526ae", "amount": "1000000000000" } ], @@ -440,18 +440,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_12", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "24c130eb6cc0d8f663a8f6d16ffc61f935a2e02e", + "validatorAddress": "24c130eb6cc0d8f663a8f6d16ffc61f935a2e02e", "amount": "1000000000000" } ], @@ -471,18 +471,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_88", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "27843a60a1e044c1e6e3cf119fdf64eb2b3e0d94", + "validatorAddress": "27843a60a1e044c1e6e3cf119fdf64eb2b3e0d94", "amount": "1000000000000" } ], @@ -502,18 +502,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_44", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "290abc4a2244bf0ecf5aa1ccee8ac8f60f8bce48", + "validatorAddress": "290abc4a2244bf0ecf5aa1ccee8ac8f60f8bce48", "amount": "1000000000000" } ], @@ -533,18 +533,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_56", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "2cf52c08cc76091d884e800c1c697b13f69907d4", + "validatorAddress": "2cf52c08cc76091d884e800c1c697b13f69907d4", "amount": "1000000000000" } ], @@ -564,18 +564,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_39", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "308a95d1d3f7bb556f48da4f4344566e59f6f1cb", + "validatorAddress": "308a95d1d3f7bb556f48da4f4344566e59f6f1cb", "amount": "1000000000000" } ], @@ -595,18 +595,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_75", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "31204ad5b95dd922c2899aa5bf8e7ee5b7546af3", + "validatorAddress": "31204ad5b95dd922c2899aa5bf8e7ee5b7546af3", "amount": "1000000000000" } ], @@ -626,18 +626,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_16", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "31fe789b43277e35ab410f2afcfb574280af2dd8", + "validatorAddress": "31fe789b43277e35ab410f2afcfb574280af2dd8", "amount": "1000000000000" } ], @@ -657,18 +657,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_3", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "328d0f546695c5fa02105deb055cf2801d9b8ba1", + "validatorAddress": "328d0f546695c5fa02105deb055cf2801d9b8ba1", "amount": "1000000000000" } ], @@ -688,18 +688,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_68", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "3b3e137b1bec6f20c9a8b2ad4f5784661fb0fa79", + "validatorAddress": "3b3e137b1bec6f20c9a8b2ad4f5784661fb0fa79", "amount": "1000000000000" } ], @@ -719,18 +719,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_94", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "3b96d8565569421f43684b2c4eaa0639cbb5e011", + "validatorAddress": "3b96d8565569421f43684b2c4eaa0639cbb5e011", "amount": "1000000000000" } ], @@ -750,18 +750,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_92", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "3c80e7d9964a1c83a6dd5dc64e105e0e634bd58a", + "validatorAddress": "3c80e7d9964a1c83a6dd5dc64e105e0e634bd58a", "amount": "1000000000000" } ], @@ -781,18 +781,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_25", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "3de95e18f18a54e2269bbf8f1a38ea70762c73fa", + "validatorAddress": "3de95e18f18a54e2269bbf8f1a38ea70762c73fa", "amount": "1000000000000" } ], @@ -812,18 +812,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_31", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "3deeb0a7426a028b435b4ddd8d35ac85cf567237", + "validatorAddress": "3deeb0a7426a028b435b4ddd8d35ac85cf567237", "amount": "1000000000000" } ], @@ -843,18 +843,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_22", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "436b40f58c0c27ed133f6001a019ff25561efad4", + "validatorAddress": "436b40f58c0c27ed133f6001a019ff25561efad4", "amount": "1000000000000" } ], @@ -874,18 +874,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_2", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "463e7e879b7bdc6a97ec02a2a603aa1a46a04c80", + "validatorAddress": "463e7e879b7bdc6a97ec02a2a603aa1a46a04c80", "amount": "1000000000000" } ], @@ -905,18 +905,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_28", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "4b6126597881cb6ba1a45c1f6286769e7a094fb4", + "validatorAddress": "4b6126597881cb6ba1a45c1f6286769e7a094fb4", "amount": "1000000000000" } ], @@ -936,18 +936,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_23", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "4e874bcfb6f5896fe9e5dab3b26f59b2e2a9c09b", + "validatorAddress": "4e874bcfb6f5896fe9e5dab3b26f59b2e2a9c09b", "amount": "1000000000000" } ], @@ -967,18 +967,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_73", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "4f4422eb61c45edb4d76f10cd871c9f983f2ebaa", + "validatorAddress": "4f4422eb61c45edb4d76f10cd871c9f983f2ebaa", "amount": "1000000000000" } ], @@ -998,18 +998,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_11", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "4fd52f67f151fbbdda9dd92a714884a399830eca", + "validatorAddress": "4fd52f67f151fbbdda9dd92a714884a399830eca", "amount": "1000000000000" } ], @@ -1029,18 +1029,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_101", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "4fd8cc4e27a3489b57ed986efe3d327d3de40d92", + "validatorAddress": "4fd8cc4e27a3489b57ed986efe3d327d3de40d92", "amount": "1000000000000" } ], @@ -1060,18 +1060,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_9", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "52f9cdcff0605241c78278690ae36eb0136a30ff", + "validatorAddress": "52f9cdcff0605241c78278690ae36eb0136a30ff", "amount": "1000000000000" } ], @@ -1091,18 +1091,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_71", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "5853a3f24990deecced49d6bc15990102ec0c33a", + "validatorAddress": "5853a3f24990deecced49d6bc15990102ec0c33a", "amount": "1000000000000" } ], @@ -1122,18 +1122,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_8", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "58d907d26508603e838423daa2061c29c7a84950", + "validatorAddress": "58d907d26508603e838423daa2061c29c7a84950", "amount": "1000000000000" } ], @@ -1153,18 +1153,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_103", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "5ade564399e670bd1d429583059067f3a6ca2b7f", + "validatorAddress": "5ade564399e670bd1d429583059067f3a6ca2b7f", "amount": "1000000000000" } ], @@ -1184,18 +1184,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_47", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "5cd1d0ccf98f2bd5a4bfaa770d55f16498af0bcc", + "validatorAddress": "5cd1d0ccf98f2bd5a4bfaa770d55f16498af0bcc", "amount": "1000000000000" } ], @@ -1215,18 +1215,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_32", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "5fbd442a4647b079cda1229ecf6d8f44f361c8ca", + "validatorAddress": "5fbd442a4647b079cda1229ecf6d8f44f361c8ca", "amount": "1000000000000" } ], @@ -1246,18 +1246,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_4", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "6174515fa66c91bff1128913edd4e0f1de37cee0", + "validatorAddress": "6174515fa66c91bff1128913edd4e0f1de37cee0", "amount": "1000000000000" } ], @@ -1277,18 +1277,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_36", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "61f396d2a4a13ab7a39ba791fac4b921b54a208e", + "validatorAddress": "61f396d2a4a13ab7a39ba791fac4b921b54a208e", "amount": "1000000000000" } ], @@ -1308,18 +1308,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_42", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "6330fd8ae91df4a5d7fbc2390c182ec6676dc5a6", + "validatorAddress": "6330fd8ae91df4a5d7fbc2390c182ec6676dc5a6", "amount": "1000000000000" } ], @@ -1339,18 +1339,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_48", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "657f610728eef97d55e50212871f0993bb7cc700", + "validatorAddress": "657f610728eef97d55e50212871f0993bb7cc700", "amount": "1000000000000" } ], @@ -1370,18 +1370,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_58", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "65f927187bf96aac5d968fcc9351e5492b5f9356", + "validatorAddress": "65f927187bf96aac5d968fcc9351e5492b5f9356", "amount": "1000000000000" } ], @@ -1401,18 +1401,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_14", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "6b9895c31bcdb2d9c929b9da7e389ed91de672a0", + "validatorAddress": "6b9895c31bcdb2d9c929b9da7e389ed91de672a0", "amount": "1000000000000" } ], @@ -1432,18 +1432,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_60", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "6e12e4498ae69fb07ff2d8aab036a911229d6c62", + "validatorAddress": "6e12e4498ae69fb07ff2d8aab036a911229d6c62", "amount": "1000000000000" } ], @@ -1463,18 +1463,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_69", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "6ffcd8ad547d8a549a31b25236e322c781a52d85", + "validatorAddress": "6ffcd8ad547d8a549a31b25236e322c781a52d85", "amount": "1000000000000" } ], @@ -1494,18 +1494,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_29", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "70abf056bd92e8f77cfc551748fa54a4e3018d5f", + "validatorAddress": "70abf056bd92e8f77cfc551748fa54a4e3018d5f", "amount": "1000000000000" } ], @@ -1525,18 +1525,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_20", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "79f30c1cbc1b9c4949c8b85acc24a7578e01558b", + "validatorAddress": "79f30c1cbc1b9c4949c8b85acc24a7578e01558b", "amount": "1000000000000" } ], @@ -1556,18 +1556,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_67", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "7d2c6781d873ed2ba7a87f46f735f5e15a41a6f1", + "validatorAddress": "7d2c6781d873ed2ba7a87f46f735f5e15a41a6f1", "amount": "1000000000000" } ], @@ -1587,18 +1587,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_79", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "7d60db187337cbd881140d69d84c9246eda8382e", + "validatorAddress": "7d60db187337cbd881140d69d84c9246eda8382e", "amount": "1000000000000" } ], @@ -1618,18 +1618,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_38", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8074f0d02f748fc55448a4bf200f1dade8517059", + "validatorAddress": "8074f0d02f748fc55448a4bf200f1dade8517059", "amount": "1000000000000" } ], @@ -1649,18 +1649,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_53", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "82cbc7b39d35af358f9e2513af13b2f77b647a00", + "validatorAddress": "82cbc7b39d35af358f9e2513af13b2f77b647a00", "amount": "1000000000000" } ], @@ -1680,18 +1680,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_76", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8459b8870fcefff59f172d716b7bfe9fcc28d408", + "validatorAddress": "8459b8870fcefff59f172d716b7bfe9fcc28d408", "amount": "1000000000000" } ], @@ -1711,18 +1711,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_62", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8506f3c10f75044946f1a23a7caf578253649471", + "validatorAddress": "8506f3c10f75044946f1a23a7caf578253649471", "amount": "1000000000000" } ], @@ -1742,18 +1742,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_37", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8722453383f781d5427a4ee211020e49bf34a2b9", + "validatorAddress": "8722453383f781d5427a4ee211020e49bf34a2b9", "amount": "1000000000000" } ], @@ -1773,18 +1773,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_55", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "89b144ecfdd5ea352083bf624d3cf842ec06a5e3", + "validatorAddress": "89b144ecfdd5ea352083bf624d3cf842ec06a5e3", "amount": "1000000000000" } ], @@ -1804,18 +1804,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_89", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8ac800124d5b16afd57b5cf7245edfcd5885ea3b", + "validatorAddress": "8ac800124d5b16afd57b5cf7245edfcd5885ea3b", "amount": "1000000000000" } ], @@ -1835,18 +1835,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_41", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8b1c221a030cf720736d9fb7d0499dd7276fc1b3", + "validatorAddress": "8b1c221a030cf720736d9fb7d0499dd7276fc1b3", "amount": "1000000000000" } ], @@ -1866,18 +1866,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_81", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "8eceffd5a41e678b6467c9bc80ce35d2e8543d98", + "validatorAddress": "8eceffd5a41e678b6467c9bc80ce35d2e8543d98", "amount": "1000000000000" } ], @@ -1897,18 +1897,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_35", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "9139c91f8a0aa1fb385770feaf299b99883aec2d", + "validatorAddress": "9139c91f8a0aa1fb385770feaf299b99883aec2d", "amount": "1000000000000" } ], @@ -1928,18 +1928,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_102", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "936f3a0f4d776b6a7722ed126e8ff17b44d7e7b8", + "validatorAddress": "936f3a0f4d776b6a7722ed126e8ff17b44d7e7b8", "amount": "1000000000000" } ], @@ -1959,18 +1959,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_43", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "94146c9889748c7b727eb3ac8c20e53c52effd32", + "validatorAddress": "94146c9889748c7b727eb3ac8c20e53c52effd32", "amount": "1000000000000" } ], @@ -1990,18 +1990,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_51", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "9b42e4264020f3c3dcaaed806578ccd469205060", + "validatorAddress": "9b42e4264020f3c3dcaaed806578ccd469205060", "amount": "1000000000000" } ], @@ -2021,18 +2021,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_1", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "9cabee3d27426676b852ce6b804cb2fdff7cd0b5", + "validatorAddress": "9cabee3d27426676b852ce6b804cb2fdff7cd0b5", "amount": "1000000000000" } ], @@ -2052,18 +2052,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_5", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "9d0149b0962d44bfc08a9f64d5afceb6281d7fb5", + "validatorAddress": "9d0149b0962d44bfc08a9f64d5afceb6281d7fb5", "amount": "1000000000000" } ], @@ -2083,18 +2083,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_17", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "a0620472cde03e77caece701ab7bc5928a5d367c", + "validatorAddress": "a0620472cde03e77caece701ab7bc5928a5d367c", "amount": "1000000000000" } ], @@ -2114,18 +2114,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_65", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "a0bc50b27e7ac39060ed015a55f2f4508c84f0c2", + "validatorAddress": "a0bc50b27e7ac39060ed015a55f2f4508c84f0c2", "amount": "1000000000000" } ], @@ -2145,18 +2145,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_90", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "a28d5e34007fd8fe6d7903044eb23a60fdad3c00", + "validatorAddress": "a28d5e34007fd8fe6d7903044eb23a60fdad3c00", "amount": "1000000000000" } ], @@ -2176,18 +2176,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_19", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "a6f6a0543ae470c6b056021cb2ac153368eafeec", + "validatorAddress": "a6f6a0543ae470c6b056021cb2ac153368eafeec", "amount": "1000000000000" } ], @@ -2207,18 +2207,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_97", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "a9c66694dd65b2fdf40cdf45a0c308cbd38004fc", + "validatorAddress": "a9c66694dd65b2fdf40cdf45a0c308cbd38004fc", "amount": "1000000000000" } ], @@ -2238,18 +2238,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_84", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "ab0041a7d3f7b2c290b5b834d46bdc7b7eb85815", + "validatorAddress": "ab0041a7d3f7b2c290b5b834d46bdc7b7eb85815", "amount": "1000000000000" } ], @@ -2269,18 +2269,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_45", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "abd2ed5ad35b3a0870aadae6dceacc988ba63895", + "validatorAddress": "abd2ed5ad35b3a0870aadae6dceacc988ba63895", "amount": "1000000000000" } ], @@ -2300,18 +2300,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_95", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "acfbdbaeb93d587170c7cd9c0b5ffdeb7ff9daec", + "validatorAddress": "acfbdbaeb93d587170c7cd9c0b5ffdeb7ff9daec", "amount": "1000000000000" } ], @@ -2331,18 +2331,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_33", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "ad42f8e867d618171bf4982e64269442148f6e11", + "validatorAddress": "ad42f8e867d618171bf4982e64269442148f6e11", "amount": "1000000000000" } ], @@ -2362,18 +2362,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_52", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "aebd99f07218109162a905d0e0c91e58bedc83c5", + "validatorAddress": "aebd99f07218109162a905d0e0c91e58bedc83c5", "amount": "1000000000000" } ], @@ -2393,18 +2393,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_80", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b11c5811ea074a30142d824b6e8cfd3df14b2688", + "validatorAddress": "b11c5811ea074a30142d824b6e8cfd3df14b2688", "amount": "1000000000000" } ], @@ -2424,18 +2424,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_10", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b485becd88db1ab3d556d405204451ba00adaa7d", + "validatorAddress": "b485becd88db1ab3d556d405204451ba00adaa7d", "amount": "1000000000000" } ], @@ -2455,18 +2455,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_100", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b543e2e592200beb38235f6e48f8abe1d87ad872", + "validatorAddress": "b543e2e592200beb38235f6e48f8abe1d87ad872", "amount": "1000000000000" } ], @@ -2486,18 +2486,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_6", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b56c55b9a70c8e2f07979b862374aed0e92a6dda", + "validatorAddress": "b56c55b9a70c8e2f07979b862374aed0e92a6dda", "amount": "1000000000000" } ], @@ -2517,18 +2517,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_7", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b7580969dd56151f608931f126f793bbf45d8fa0", + "validatorAddress": "b7580969dd56151f608931f126f793bbf45d8fa0", "amount": "1000000000000" } ], @@ -2548,18 +2548,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_99", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "b76a0f1819c4be0a1482567ca9b9fbed3eda444c", + "validatorAddress": "b76a0f1819c4be0a1482567ca9b9fbed3eda444c", "amount": "1000000000000" } ], @@ -2579,18 +2579,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_70", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "bd175729d4177259c71cf13fd4ecfb5d01542706", + "validatorAddress": "bd175729d4177259c71cf13fd4ecfb5d01542706", "amount": "1000000000000" } ], @@ -2610,18 +2610,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_27", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "be89f4e983dfb04e2b58a12eb9ed18149e108b07", + "validatorAddress": "be89f4e983dfb04e2b58a12eb9ed18149e108b07", "amount": "1000000000000" } ], @@ -2641,18 +2641,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_86", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "c3ab2ac23512d9bf62b02775e22cf80df814eb1b", + "validatorAddress": "c3ab2ac23512d9bf62b02775e22cf80df814eb1b", "amount": "1000000000000" } ], @@ -2672,18 +2672,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_85", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "c697b620c7c4015e32dd7bdd7d0430b33404e107", + "validatorAddress": "c697b620c7c4015e32dd7bdd7d0430b33404e107", "amount": "1000000000000" } ], @@ -2703,18 +2703,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_64", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "c98554123062ac5795a3ee905b081e863db5a818", + "validatorAddress": "c98554123062ac5795a3ee905b081e863db5a818", "amount": "1000000000000" } ], @@ -2734,18 +2734,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_87", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "ca309a5f4bbf11ca86592febb6d2ccc78309f69e", + "validatorAddress": "ca309a5f4bbf11ca86592febb6d2ccc78309f69e", "amount": "1000000000000" } ], @@ -2765,18 +2765,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_82", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "ca5f6d76eab6e4f5aacee2864c79034d7111b986", + "validatorAddress": "ca5f6d76eab6e4f5aacee2864c79034d7111b986", "amount": "1000000000000" } ], @@ -2796,18 +2796,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_21", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "cb579ee537b34926d47129a0b54c0e6d00ef3004", + "validatorAddress": "cb579ee537b34926d47129a0b54c0e6d00ef3004", "amount": "1000000000000" } ], @@ -2827,16 +2827,16 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "0" + "totalStakeReceived": "0" }, - "sentVotes": [], + "sentStakes": [], "unlocking": [] } }, @@ -2853,18 +2853,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_59", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d06fe6d3e5f7facb5855eca839422fe3824a5d6e", + "validatorAddress": "d06fe6d3e5f7facb5855eca839422fe3824a5d6e", "amount": "1000000000000" } ], @@ -2884,18 +2884,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_30", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d0a0e45b950e3871d8783b973409042b4ab382d4", + "validatorAddress": "d0a0e45b950e3871d8783b973409042b4ab382d4", "amount": "1000000000000" } ], @@ -2915,18 +2915,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_24", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d2c9a93755aed20c4d8f55c1e92b812d2c7d49d2", + "validatorAddress": "d2c9a93755aed20c4d8f55c1e92b812d2c7d49d2", "amount": "1000000000000" } ], @@ -2946,18 +2946,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_63", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d3c8064d011ef853e3be506b95a045f41f78e72a", + "validatorAddress": "d3c8064d011ef853e3be506b95a045f41f78e72a", "amount": "1000000000000" } ], @@ -2977,18 +2977,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_40", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d5bd2050b74b309d54819ca17add173c6fca1e16", + "validatorAddress": "d5bd2050b74b309d54819ca17add173c6fca1e16", "amount": "1000000000000" } ], @@ -3008,18 +3008,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_66", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d5c4e380b1ec2f7f2068cfba9a90cb3ae7816110", + "validatorAddress": "d5c4e380b1ec2f7f2068cfba9a90cb3ae7816110", "amount": "1000000000000" } ], @@ -3039,18 +3039,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_91", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d5e1f52cbe4a11a3730b98f52109b57602a9c4a1", + "validatorAddress": "d5e1f52cbe4a11a3730b98f52109b57602a9c4a1", "amount": "1000000000000" } ], @@ -3070,18 +3070,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_78", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "d8e611bafd70a549f035cf61ab0d6ed9e7f25c4e", + "validatorAddress": "d8e611bafd70a549f035cf61ab0d6ed9e7f25c4e", "amount": "1000000000000" } ], @@ -3101,18 +3101,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_61", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "dcb5bf35b6d521195e613c42483f520139e2331d", + "validatorAddress": "dcb5bf35b6d521195e613c42483f520139e2331d", "amount": "1000000000000" } ], @@ -3132,18 +3132,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_26", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "df0e187bb3895806261c87cf66e1772566ee8e58", + "validatorAddress": "df0e187bb3895806261c87cf66e1772566ee8e58", "amount": "1000000000000" } ], @@ -3163,18 +3163,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_57", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "e2950a9f07b44e724df2129360cc140293c08308", + "validatorAddress": "e2950a9f07b44e724df2129360cc140293c08308", "amount": "1000000000000" } ], @@ -3194,18 +3194,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_13", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "e39316cc020089ea7a5614bcf69a8931c10630a7", + "validatorAddress": "e39316cc020089ea7a5614bcf69a8931c10630a7", "amount": "1000000000000" } ], @@ -3225,18 +3225,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_72", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "e9355152c117c9e1fad8be86e9abea961cef4a36", + "validatorAddress": "e9355152c117c9e1fad8be86e9abea961cef4a36", "amount": "1000000000000" } ], @@ -3256,18 +3256,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_18", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "f730cb929a1c45032387c345e10d2427bea55a5e", + "validatorAddress": "f730cb929a1c45032387c345e10d2427bea55a5e", "amount": "1000000000000" } ], @@ -3287,18 +3287,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_93", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "fa526a1611ccc66dec815cb963174118074b736e", + "validatorAddress": "fa526a1611ccc66dec815cb963174118074b736e", "amount": "1000000000000" } ], @@ -3318,18 +3318,18 @@ "optionalKeys": [], "numberOfSignatures": 0 }, - "dpos": { - "delegate": { + "pos": { + "validator": { "username": "genesis_96", "pomHeights": [], "consecutiveMissedBlocks": 0, "lastForgedHeight": 0, "isBanned": false, - "totalVotesReceived": "1000000000000" + "totalStakeReceived": "1000000000000" }, - "sentVotes": [ + "sentStakes": [ { - "delegateAddress": "ffce8ce225c5d80098f50e877125b655aef6d101", + "validatorAddress": "ffce8ce225c5d80098f50e877125b655aef6d101", "amount": "1000000000000" } ], diff --git a/test/src/main.spec.ts b/test/src/main.spec.ts index 6a22e802a48..a48e91b68eb 100644 --- a/test/src/main.spec.ts +++ b/test/src/main.spec.ts @@ -18,8 +18,8 @@ import * as os from 'os'; import { apiClient } from 'lisk-sdk'; import * as debug from 'debug'; import { specs as tokenSpecs } from './scenarios/modules/token'; -import * as passphrase from '../../examples/dpos-mainchain/config/default/passphrase.json'; -import * as validators from '../../examples/dpos-mainchain/config/default/dev-validators.json'; +import * as passphrase from '../../examples/pos-mainchain/config/default/passphrase.json'; +import * as validators from '../../examples/pos-mainchain/config/default/dev-validators.json'; import { block } from './utils'; // dataPath is defined globally to be able to access from all the tests @@ -37,7 +37,7 @@ describe('Lisk SDK functional test', () => { beforeAll(async () => { const parameters = ['start', '-d', dataPath, '--api-ws', '--api-ipc', '--log', 'debug']; appProcess = childProcess.spawn('./bin/run', parameters, { - cwd: path.join(__dirname, '../../examples/dpos-mainchain'), + cwd: path.join(__dirname, '../../examples/pos-mainchain'), env: { ...process.env, // setting production will run the command with node.js version diff --git a/test/src/types.ts b/test/src/types.ts index ab49e9b51db..1c5eca2c78b 100644 --- a/test/src/types.ts +++ b/test/src/types.ts @@ -13,8 +13,8 @@ * */ -import * as passphrase from '../../examples/dpos-mainchain/config/default/passphrase.json'; -import * as validators from '../../examples/dpos-mainchain/config/default/dev-validators.json'; +import * as passphrase from '../../examples/pos-mainchain/config/default/passphrase.json'; +import * as validators from '../../examples/pos-mainchain/config/default/dev-validators.json'; export type PassphraseFixture = typeof passphrase; export type ValidatorsFixture = typeof validators;