From d5a9744668ce68244d2bbf9da311bb3235eda333 Mon Sep 17 00:00:00 2001 From: Karan Dhareshwar Date: Thu, 19 Dec 2024 08:13:26 -0600 Subject: [PATCH] Initial remove of old chainspecs --- .../src/upgrade_request_builder.rs | 18 -- .../src/test/system_contracts/upgrade.rs | 1 - node/src/components/transaction_buffer.rs | 2 + resources/local/chainspec.toml.in | 22 +- resources/production/chainspec.toml | 23 ++- resources/test/valid/0_9_0/accounts.toml | 39 ---- resources/test/valid/0_9_0/chainspec.toml | 188 ----------------- .../test/valid/0_9_0_unordered/accounts.toml | 40 ---- .../test/valid/0_9_0_unordered/chainspec.toml | 186 ----------------- resources/test/valid/1_0_0/chainspec.toml | 189 ------------------ resources/test/valid/1_0_0/global_state.toml | 11 - storage/src/system/protocol_upgrade.rs | 57 +----- types/src/chainspec.rs | 4 - types/src/chainspec/core_config.rs | 25 --- types/src/chainspec/upgrade_config.rs | 16 -- 15 files changed, 27 insertions(+), 794 deletions(-) delete mode 100644 resources/test/valid/0_9_0/accounts.toml delete mode 100644 resources/test/valid/0_9_0/chainspec.toml delete mode 100644 resources/test/valid/0_9_0_unordered/accounts.toml delete mode 100644 resources/test/valid/0_9_0_unordered/chainspec.toml delete mode 100644 resources/test/valid/1_0_0/chainspec.toml delete mode 100644 resources/test/valid/1_0_0/global_state.toml diff --git a/execution_engine_testing/test_support/src/upgrade_request_builder.rs b/execution_engine_testing/test_support/src/upgrade_request_builder.rs index d495de7d41..556c7c28ec 100644 --- a/execution_engine_testing/test_support/src/upgrade_request_builder.rs +++ b/execution_engine_testing/test_support/src/upgrade_request_builder.rs @@ -23,8 +23,6 @@ pub struct UpgradeRequestBuilder { global_state_update: BTreeMap, chainspec_registry: ChainspecRegistry, fee_handling: FeeHandling, - migrate_legacy_accounts: bool, - migrate_legacy_contracts: bool, maximum_delegation_amount: u64, minimum_delegation_amount: u64, enable_addressable_entity: bool, @@ -126,18 +124,6 @@ impl UpgradeRequestBuilder { self } - /// Sets the migrate legacy accounts. - pub fn with_migrate_legacy_accounts(mut self, migrate_legacy_accounts: bool) -> Self { - self.migrate_legacy_accounts = migrate_legacy_accounts; - self - } - - /// Sets the migrate legacy contracts. - pub fn with_migrate_legacy_contracts(mut self, migrate_legacy_contracts: bool) -> Self { - self.migrate_legacy_contracts = migrate_legacy_contracts; - self - } - /// Sets the maximum delegation for the validators bid during migration. pub fn with_maximum_delegation_amount(mut self, maximum_delegation_amount: u64) -> Self { self.maximum_delegation_amount = maximum_delegation_amount; @@ -173,8 +159,6 @@ impl UpgradeRequestBuilder { self.global_state_update, self.chainspec_registry, self.fee_handling, - self.migrate_legacy_accounts, - self.migrate_legacy_contracts, self.maximum_delegation_amount, self.minimum_delegation_amount, self.enable_addressable_entity, @@ -199,8 +183,6 @@ impl Default for UpgradeRequestBuilder { global_state_update: Default::default(), chainspec_registry: ChainspecRegistry::new_with_optional_global_state(&[], None), fee_handling: FeeHandling::default(), - migrate_legacy_accounts: false, - migrate_legacy_contracts: false, maximum_delegation_amount: u64::MAX, minimum_delegation_amount: 0, enable_addressable_entity: false, diff --git a/execution_engine_testing/tests/src/test/system_contracts/upgrade.rs b/execution_engine_testing/tests/src/test/system_contracts/upgrade.rs index 1d5a22e850..2fc54255ab 100644 --- a/execution_engine_testing/tests/src/test/system_contracts/upgrade.rs +++ b/execution_engine_testing/tests/src/test/system_contracts/upgrade.rs @@ -774,7 +774,6 @@ fn should_upgrade_legacy_accounts() { .with_activation_point(DEFAULT_ACTIVATION_POINT) .with_minimum_delegation_amount(250_000_000_000) .with_maximum_delegation_amount(500_000_000_000) - .with_migrate_legacy_accounts(true) .build() }; diff --git a/node/src/components/transaction_buffer.rs b/node/src/components/transaction_buffer.rs index 6b47ba1450..1e8254f3ac 100644 --- a/node/src/components/transaction_buffer.rs +++ b/node/src/components/transaction_buffer.rs @@ -442,6 +442,7 @@ impl TransactionBuffer { timestamp, ); if Timestamp::now() >= request_expiry { + debug!("TransactionBuffer: request expiry reached, returning empty proposal"); return ret; } @@ -463,6 +464,7 @@ impl TransactionBuffer { while let Some(payload_hash) = payload_hashes_queue.pop_front() { if Timestamp::now() > request_expiry { + debug!("TransactionBuffer: request expiry reached, returning proposal"); break; } #[cfg(test)] diff --git a/resources/local/chainspec.toml.in b/resources/local/chainspec.toml.in index ebc014559b..48591983e9 100644 --- a/resources/local/chainspec.toml.in +++ b/resources/local/chainspec.toml.in @@ -45,16 +45,6 @@ start_protocol_version_with_strict_finality_signatures_required = '1.5.0' # `start_protocol_version_with_strict_finality_signatures_required`. legacy_required_finality = 'Strict' -# If true, the protocol upgrade will migrate ALL userland accounts to addressable entity. -# If false, userland accounts will instead be left as is and will be lazily migrated -# on a per-account basis if / when that account is used during transaction execution. -migrate_legacy_accounts = true - -# If true, the protocol upgrade will migrate ALL userland contracts to addressable entity. -# If false, userland contracts will instead be left as is and will be lazily migrated -# on a per-contract basis if / when that contract is used during transaction execution. -migrate_legacy_contracts = true - # Number of eras before an auction actually defines the set of validators. If you bond with a sufficient bid in era N, # you will be a validator in era N + auction_delay + 1. auction_delay = 1 @@ -164,6 +154,18 @@ gas_hold_interval = '24 hours' # List of public keys of administrator accounts. Setting this option makes only on private chains which require # administrator accounts for regulatory reasons. administrators = [] +# Flag that triggers a migration of all accounts and contracts present in global state to the addressable +# entity in lazy manner. +# If the flag is set to false then no accounts and contracts are migrated during a protocol upgrade; +# i.e all Account records will be present under Key::Account and Contracts and their associated ContractPackage +# will be written underneath Key::Hash. +# If the flag is set to true then accounts and contracts are migrated lazily; i.e on first use of the Account +# and/or Contract as part of the execution of a Transaction. This means the Accounts/Contracts will be migrated +# to their corresponding AddressableEntity and the NamedKeys for previous record and sepeareted and wrriten +# as discrete top level records. For Contracts specifically the entrypoints are also written as discrete top +# level records +# Note: Enabling of the AddressableEntity feature is one-way; i.e once enabled as part of a protocol upgrade +# the flag cannot be disabled in a future protocol upgrade. enable_addressable_entity = false [highway] diff --git a/resources/production/chainspec.toml b/resources/production/chainspec.toml index 91aa8483e9..8681518311 100644 --- a/resources/production/chainspec.toml +++ b/resources/production/chainspec.toml @@ -44,17 +44,6 @@ start_protocol_version_with_strict_finality_signatures_required = '1.5.0' # in a protocol version before # `start_protocol_version_with_strict_finality_signatures_required`. legacy_required_finality = 'Strict' - -# If true, the protocol upgrade will migrate ALL userland accounts to addressable entity. -# If false, userland accounts will instead be left as is and will be lazily migrated -# on a per-account basis if / when that account is used during transaction execution. -migrate_legacy_accounts = true - -# If true, the protocol upgrade will migrate ALL userland contracts to addressable entity. -# If false, userland contracts will instead be left as is and will be lazily migrated -# on a per-contract basis if / when that contract is used during transaction execution. -migrate_legacy_contracts = true - # Number of eras before an auction actually defines the set of validators. If you bond with a sufficient bid in era N, # you will be a validator in era N + auction_delay + 1. auction_delay = 1 @@ -171,6 +160,18 @@ gas_hold_interval = '24 hours' # List of public keys of administrator accounts. Setting this option makes only on private chains which require # administrator accounts for regulatory reasons. administrators = [] +# Flag that triggers a migration of all userland accounts and contracts present in global state to the addressable +# entity in lazy manner. +# If the flag is set to false then no accounts and contracts are migrated during a protocol upgrade; +# i.e all Account records will be present under Key::Account and Contracts and their associated ContractPackage +# will be written underneath Key::Hash. +# If the flag is set to true then accounts and contracts are migrated lazily; i.e on first use of the Account +# and/or Contract as part of the execution of a Transaction. This means the Accounts/Contracts will be migrated +# to their corresponding AddressableEntity and the NamedKeys for previous record and sepeareted and wrriten +# as discrete top level records. For Contracts specifically the entrypoints are also written as discrete top +# level records +# Note: Enabling of the AddressableEntity feature is one-way; i.e once enabled as part of a protocol upgrade +# the flag cannot be disabled in a future protocol upgrade. enable_addressable_entity = false [highway] diff --git a/resources/test/valid/0_9_0/accounts.toml b/resources/test/valid/0_9_0/accounts.toml deleted file mode 100644 index 2e948ac592..0000000000 --- a/resources/test/valid/0_9_0/accounts.toml +++ /dev/null @@ -1,39 +0,0 @@ -[[accounts]] -public_key = "0148bc7fdb0375d480fbd03e77f74ffedc30b9f3954455fe04da15843a0a6af0c7" -balance = "1" - -[accounts.validator] -bonded_amount = "10" - -[[accounts]] -public_key = "011f66ea6321a48a935f66e97d4f7e60ee2d7fc9ccc62dfbe310f33b4839fc62eb" -balance = "2" - -[accounts.validator] -bonded_amount = "20" - -[[accounts]] -public_key = "0189e744783c2d70902a5f2ef78e82e1f44102b5eb08ca6234241d95e50f615a6b" -balance = "3" - -[accounts.validator] -bonded_amount = "30" - -[[accounts]] -public_key = "01569b41d574c46390212d698660b5326269ddb0a761d1294258897ac717b4958b" -balance = "4" - -[accounts.validator] -bonded_amount = "40" - -[[delegators]] -validator_public_key = "01569b41d574c46390212d698660b5326269ddb0a761d1294258897ac717b4958b" -delegator_public_key = "020248509e67db3127f82d5224c5c18eac00f96d1edeadbadc8eb2c8606227b56873" -balance = "0" -delegated_amount = "10" - -[[delegators]] -validator_public_key = "011f66ea6321a48a935f66e97d4f7e60ee2d7fc9ccc62dfbe310f33b4839fc62eb" -delegator_public_key = "020249c3a6d5006cd7634b54647f889265b85d36d837c066179548758b4eedab8186" -balance = "0" -delegated_amount = "20" diff --git a/resources/test/valid/0_9_0/chainspec.toml b/resources/test/valid/0_9_0/chainspec.toml deleted file mode 100644 index 437e434f56..0000000000 --- a/resources/test/valid/0_9_0/chainspec.toml +++ /dev/null @@ -1,188 +0,0 @@ -[protocol] -version = '0.9.0' -hard_reset = false -activation_point = '2020-09-18T18:45:00Z' - -[network] -name = 'test-chain' -maximum_net_message_size = 23_068_672 - -[core] -era_duration = '3minutes' -minimum_era_height = 9 -minimum_block_time = '16seconds' -validator_slots = 5 -finality_threshold_fraction = [2, 25] -auction_delay = 3 -locked_funds_period = '90days' -vesting_schedule_period = '13 weeks' -round_seigniorage_rate = [6_414, 623_437_335_209] -unbonding_delay = 14 -max_associated_keys = 100 -max_runtime_call_stack_height = 12 -minimum_delegation_amount = 500_000_000_000 -prune_batch_size = 1 -strict_argument_checking = false -simultaneous_peer_requests = 5 -consensus_protocol = 'Highway' -refund_handling = { type = 'refund', refund_ratio = [0, 1] } -fee_handling = { type = 'pay_to_proposer' } -allow_unrestricted_transfers = true -allow_auction_bids = true -compute_rewards = true -administrators = [] - -[highway] -maximum_round_length = '525seconds' - -[transactions] -max_ttl = '18hours' -max_transaction_size = 1_048_576 -block_max_deploy_count = 50 -block_max_native_count = 1250 -block_max_approval_count = 2600 -max_block_size = 10_485_760 -block_gas_limit = 10_000_000_000_000 -native_transfer_minimum_motes = 2_500_000_000 -max_timestamp_leeway = '5 seconds' -runtime = "VmCasperV1" - -[transactions.v1] -max_args_length = 1024 - -[transactions.deploy] -max_payment_cost = '9' -max_dependencies = 11 -payment_args_max_length = 1024 -session_args_max_length = 1024 - -[wasm] -max_memory = 17 -max_stack_height = 19 - -[wasm.opcode_costs] -bit = 13 -add = 14 -mul = 15 -div = 16 -load = 17 -store = 18 -const = 19 -local = 20 -global = 21 -integer_comparison = 23 -conversion = 24 -unreachable = 25 -nop = 26 -current_memory = 27 -grow_memory = 28 -regular = 29 - -# Control flow operations multiplier. -[wasm.opcode_costs.control_flow] -block = 1 -loop = 2 -if = 3 -else = 4 -end = 5 -br = 6 -return = 7 -select = 8 -call = 9 -call_indirect = 10 -drop = 11 - -[wasm.opcode_costs.control_flow.br_table] -# Fixed cost per `br_table` opcode -cost = 12 -# Size of target labels in the `br_table` opcode will be multiplied by `size_multiplier` -size_multiplier = 13 - -[wasm.storage_costs] -gas_per_byte = 101 - -[wasm.host_function_costs] -add = { cost = 100, arguments = [0, 1, 2, 3] } -add_associated_key = { cost = 101, arguments = [0, 1, 2] } -add_contract_version = { cost = 102, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] } -blake2b = { cost = 133, arguments = [0, 1, 2, 3] } -call_contract = { cost = 104, arguments = [0, 1, 2, 3, 4, 5, 6] } -call_versioned_contract = { cost = 105, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -create_contract_package_at_hash = { cost = 106, arguments = [0, 1] } -create_contract_user_group = { cost = 107, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -create_purse = { cost = 108, arguments = [0, 1] } -disable_contract_version = { cost = 109, arguments = [0, 1, 2, 3] } -get_balance = { cost = 110, arguments = [0, 1, 2] } -get_blocktime = { cost = 111, arguments = [0] } -get_caller = { cost = 112, arguments = [0] } -get_key = { cost = 113, arguments = [0, 1, 2, 3, 4] } -get_main_purse = { cost = 114, arguments = [0] } -get_named_arg = { cost = 115, arguments = [0, 1, 2, 3] } -get_named_arg_size = { cost = 116, arguments = [0, 1, 2] } -get_phase = { cost = 117, arguments = [0] } -get_system_contract = { cost = 118, arguments = [0, 1, 2] } -has_key = { cost = 119, arguments = [0, 1] } -is_valid_uref = { cost = 120, arguments = [0, 1] } -load_named_keys = { cost = 121, arguments = [0, 1] } -new_uref = { cost = 122, arguments = [0, 1, 2] } -random_bytes = { cost = 123, arguments = [0, 1] } -print = { cost = 123, arguments = [0, 1] } -provision_contract_user_group_uref = { cost = 124, arguments = [0,1,2,3,4] } -put_key = { cost = 125, arguments = [0, 1, 2, 3] } -read_host_buffer = { cost = 126, arguments = [0, 1, 2] } -read_value = { cost = 127, arguments = [0, 1, 0] } -dictionary_get = { cost = 128, arguments = [0, 1, 0] } -remove_associated_key = { cost = 129, arguments = [0, 1] } -remove_contract_user_group = { cost = 130, arguments = [0, 1, 2, 3] } -remove_contract_user_group_urefs = { cost = 131, arguments = [0,1,2,3,4,5] } -remove_key = { cost = 132, arguments = [0, 1] } -ret = { cost = 133, arguments = [0, 1] } -revert = { cost = 134, arguments = [0] } -set_action_threshold = { cost = 135, arguments = [0, 1] } -transfer_from_purse_to_account = { cost = 136, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -transfer_from_purse_to_purse = { cost = 137, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -transfer_to_account = { cost = 138, arguments = [0, 1, 2, 3, 4, 5, 6] } -update_associated_key = { cost = 139, arguments = [0, 1, 2] } -write = { cost = 140, arguments = [0, 1, 0, 2] } -dictionary_put = { cost = 141, arguments = [0, 1, 2, 3] } -enable_contract_version = { cost = 142, arguments = [0, 1, 2, 3] } - -[system_costs] -wasmless_transfer_cost = 100_000_000 - -[system_costs.auction_costs] -get_era_validators = 10_000 -read_seigniorage_recipients = 10_000 -add_bid = 10_000 -withdraw_bid = 10_000 -delegate = 10_000 -undelegate = 10_000 -run_auction = 10_000 -slash = 10_000 -distribute = 10_000 -withdraw_delegator_reward = 10_000 -withdraw_validator_reward = 10_000 -read_era_id = 10_000 -activate_bid = 10_000 -redelegate = 10_000 -change_bid_public_key = 10_000 -add_reservations = 2_500_000_000 -cancel_reservations = 2_500_000_000 - -[system_costs.mint_costs] -mint = 2_500_000_000 -reduce_total_supply = 10_000 -create = 2_500_000_000 -balance = 10_000 -transfer = 10_000 -read_base_round_reward = 10_000 -mint_into_existing_purse = 2_500_000_000 - -[system_costs.handle_payment_costs] -get_payment_purse = 10_000 -set_refund_purse = 10_000 -get_refund_purse = 10_000 -finalize_payment = 10_000 - -[system_costs.standard_payment_costs] -pay = 10_000 diff --git a/resources/test/valid/0_9_0_unordered/accounts.toml b/resources/test/valid/0_9_0_unordered/accounts.toml deleted file mode 100644 index 9da6540e2c..0000000000 --- a/resources/test/valid/0_9_0_unordered/accounts.toml +++ /dev/null @@ -1,40 +0,0 @@ -[[delegators]] -validator_public_key = "011f66ea6321a48a935f66e97d4f7e60ee2d7fc9ccc62dfbe310f33b4839fc62eb" -delegator_public_key = "020249c3a6d5006cd7634b54647f889265b85d36d837c066179548758b4eedab8186" -balance = "0" -delegated_amount = "20" - - -[[accounts]] -public_key = "0189e744783c2d70902a5f2ef78e82e1f44102b5eb08ca6234241d95e50f615a6b" -balance = "3" - -[accounts.validator] -bonded_amount = "30" - -[[accounts]] -public_key = "01569b41d574c46390212d698660b5326269ddb0a761d1294258897ac717b4958b" -balance = "4" - -[accounts.validator] -bonded_amount = "40" - -[[delegators]] -validator_public_key = "01569b41d574c46390212d698660b5326269ddb0a761d1294258897ac717b4958b" -delegator_public_key = "020248509e67db3127f82d5224c5c18eac00f96d1edeadbadc8eb2c8606227b56873" -balance = "0" -delegated_amount = "10" - -[[accounts]] -public_key = "011f66ea6321a48a935f66e97d4f7e60ee2d7fc9ccc62dfbe310f33b4839fc62eb" -balance = "2" - -[accounts.validator] -bonded_amount = "20" - -[[accounts]] -public_key = "0148bc7fdb0375d480fbd03e77f74ffedc30b9f3954455fe04da15843a0a6af0c7" -balance = "1" - -[accounts.validator] -bonded_amount = "10" diff --git a/resources/test/valid/0_9_0_unordered/chainspec.toml b/resources/test/valid/0_9_0_unordered/chainspec.toml deleted file mode 100644 index 6632d1d609..0000000000 --- a/resources/test/valid/0_9_0_unordered/chainspec.toml +++ /dev/null @@ -1,186 +0,0 @@ -[protocol] -version = '0.9.0' -hard_reset = false -activation_point = '2020-09-18T18:45:00Z' - -[network] -name = 'test-chain' -maximum_net_message_size = 23_068_672 - -[core] -era_duration = '3minutes' -refund_handling = { type = 'refund', refund_ratio = [0, 1] } -minimum_era_height = 9 -minimum_block_time = '16seconds' -prune_batch_size = 1 -validator_slots = 5 -finality_threshold_fraction = [2, 25] -auction_delay = 3 -locked_funds_period = '90days' -vesting_schedule_period = '13 weeks' -round_seigniorage_rate = [6_414, 623_437_335_209] -unbonding_delay = 14 -max_associated_keys = 100 -max_runtime_call_stack_height = 12 -minimum_delegation_amount = 500_000_000_000 -strict_argument_checking = false -simultaneous_peer_requests = 5 -consensus_protocol = 'Highway' -fee_handling = { type = 'pay_to_proposer' } -allow_auction_bids = true -compute_rewards = true -allow_unrestricted_transfers = true -administrators = [] - -[highway] -maximum_round_length = '525seconds' - -[transactions] -max_ttl = '18hours' -max_transaction_size = 1_048_576 -block_max_deploy_count = 50 -block_max_native_count = 1250 -block_max_approval_count = 2600 -max_block_size = 10_485_760 -block_gas_limit = 10_000_000_000_000 -native_transfer_minimum_motes = 2_500_000_000 -max_timestamp_leeway = '5 seconds' -runtime = "VmCasperV1" - -[transactions.v1] -max_args_length = 1024 - -[transactions.deploy] -max_payment_cost = '9' -max_dependencies = 11 -payment_args_max_length = 1024 -session_args_max_length = 1024 - -[wasm] -max_memory = 17 -max_stack_height = 19 - -[wasm.opcode_costs] -bit = 13 -add = 14 -mul = 15 -div = 16 -load = 17 -store = 18 -const = 19 -local = 20 -global = 21 -integer_comparison = 23 -conversion = 24 -unreachable = 25 -nop = 26 -current_memory = 27 -grow_memory = 28 -regular = 29 - -[wasm.opcode_costs.control_flow] -loop = 2 -if = 3 -else = 4 -block = 1 -end = 5 -call = 9 -br = 6 -br_if = 7 -return = 8 -call_indirect = 10 -drop = 11 -select = 12 - -[wasm.opcode_costs.control_flow.br_table] -size_multiplier = 100 -cost = 1000 - -[wasm.storage_costs] -gas_per_byte = 101 - -[wasm.host_function_costs] -add = { cost = 100, arguments = [0, 1, 2, 3] } -add_associated_key = { cost = 101, arguments = [0, 1, 2] } -add_contract_version = { cost = 102, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] } -blake2b = { cost = 133, arguments = [0, 1, 2, 3] } -call_contract = { cost = 104, arguments = [0, 1, 2, 3, 4, 5, 6] } -call_versioned_contract = { cost = 105, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -create_contract_package_at_hash = { cost = 106, arguments = [0, 1] } -create_contract_user_group = { cost = 107, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -create_purse = { cost = 108, arguments = [0, 1] } -disable_contract_version = { cost = 109, arguments = [0, 1, 2, 3] } -get_balance = { cost = 110, arguments = [0, 1, 2] } -get_blocktime = { cost = 111, arguments = [0] } -get_caller = { cost = 112, arguments = [0] } -get_key = { cost = 113, arguments = [0, 1, 2, 3, 4] } -get_main_purse = { cost = 114, arguments = [0] } -get_named_arg = { cost = 115, arguments = [0, 1, 2, 3] } -get_named_arg_size = { cost = 116, arguments = [0, 1, 2] } -get_phase = { cost = 117, arguments = [0] } -get_system_contract = { cost = 118, arguments = [0, 1, 2] } -has_key = { cost = 119, arguments = [0, 1] } -is_valid_uref = { cost = 120, arguments = [0, 1] } -load_named_keys = { cost = 121, arguments = [0, 1] } -new_uref = { cost = 122, arguments = [0, 1, 2] } -random_bytes = { cost = 123, arguments = [0, 1] } -print = { cost = 123, arguments = [0, 1] } -provision_contract_user_group_uref = { cost = 124, arguments = [0,1,2,3,4] } -put_key = { cost = 125, arguments = [0, 1, 2, 3] } -read_host_buffer = { cost = 126, arguments = [0, 1, 2] } -read_value = { cost = 127, arguments = [0, 1, 0] } -dictionary_get = { cost = 128, arguments = [0, 1, 0] } -remove_associated_key = { cost = 129, arguments = [0, 1] } -remove_contract_user_group = { cost = 130, arguments = [0, 1, 2, 3] } -remove_contract_user_group_urefs = { cost = 131, arguments = [0,1,2,3,4,5] } -remove_key = { cost = 132, arguments = [0, 1] } -ret = { cost = 133, arguments = [0, 1] } -revert = { cost = 134, arguments = [0] } -set_action_threshold = { cost = 135, arguments = [0, 1] } -transfer_from_purse_to_account = { cost = 136, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -transfer_from_purse_to_purse = { cost = 137, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -transfer_to_account = { cost = 138, arguments = [0, 1, 2, 3, 4, 5, 6] } -update_associated_key = { cost = 139, arguments = [0, 1, 2] } -write = { cost = 140, arguments = [0, 1, 0, 2] } -dictionary_put = { cost = 141, arguments = [0, 1, 2, 3] } -enable_contract_version = { cost = 142, arguments = [0, 1, 2, 3] } - -[system_costs] -wasmless_transfer_cost = 100_000_000 - -[system_costs.auction_costs] -get_era_validators = 10_000 -read_seigniorage_recipients = 10_000 -add_bid = 10_000 -withdraw_bid = 10_000 -delegate = 10_000 -undelegate = 10_000 -run_auction = 10_000 -slash = 10_000 -distribute = 10_000 -withdraw_delegator_reward = 10_000 -withdraw_validator_reward = 10_000 -read_era_id = 10_000 -activate_bid = 10_000 -redelegate = 10_000 -change_bid_public_key = 10_000 -add_reservations = 2_500_000_000 -cancel_reservations = 2_500_000_000 - -[system_costs.mint_costs] -mint = 2_500_000_000 -reduce_total_supply = 10_000 -create = 2_500_000_000 -balance = 10_000 -transfer = 10_000 -read_base_round_reward = 10_000 -mint_into_existing_purse = 2_500_000_000 - -[system_costs.handle_payment_costs] -get_payment_purse = 10_000 -set_refund_purse = 10_000 -get_refund_purse = 10_000 -finalize_payment = 10_000 - -[system_costs.standard_payment_costs] -pay = 10_000 diff --git a/resources/test/valid/1_0_0/chainspec.toml b/resources/test/valid/1_0_0/chainspec.toml deleted file mode 100644 index 9451f4604a..0000000000 --- a/resources/test/valid/1_0_0/chainspec.toml +++ /dev/null @@ -1,189 +0,0 @@ -[protocol] -version = '1.0.0' -hard_reset = false -activation_point = 1 - -[network] -name = 'test-chain' -maximum_net_message_size = 23_068_672 - -[core] -era_duration = '3minutes' -minimum_era_height = 9 -minimum_block_time = '16seconds' -validator_slots = 5 -finality_threshold_fraction = [2, 25] -auction_delay = 3 -locked_funds_period = '90days' -vesting_schedule_period = '13 weeks' -round_seigniorage_rate = [6_414, 623_437_335_209] -unbonding_delay = 14 -max_associated_keys = 100 -max_runtime_call_stack_height = 12 -minimum_delegation_amount = 500_000_000_000 -prune_batch_size = 1 -strict_argument_checking = false -simultaneous_peer_requests = 5 -consensus_protocol = 'Highway' -refund_handling = { type = 'refund', refund_ratio = [0, 1] } -fee_handling = { type = 'pay_to_proposer' } -allow_unrestricted_transfers = true -allow_auction_bids = true -compute_rewards = true -administrators = [] - -[highway] -maximum_round_length = '525seconds' - -[transactions] -max_ttl = '18hours' -max_transaction_size = 1_048_576 -block_max_deploy_count = 50 -block_max_native_count = 1250 -block_max_approval_count = 2600 -max_block_size = 10_485_760 -block_gas_limit = 10_000_000_000_000 -runtime = "VmCasperV1" -native_transfer_minimum_motes = 2_500_000_000 -max_timestamp_leeway = '5 seconds' - -[transactions.v1] -max_args_length = 1024 - -[transactions.deploy] -max_payment_cost = '9' -max_dependencies = 11 -payment_args_max_length = 1024 -session_args_max_length = 1024 - -[wasm] -max_memory = 17 -max_stack_height = 19 - -[wasm.opcode_costs] -bit = 13 -add = 14 -mul = 15 -div = 16 -load = 17 -store = 18 -const = 19 -local = 20 -global = 21 -integer_comparison = 23 -conversion = 24 -unreachable = 25 -nop = 26 -current_memory = 27 -grow_memory = 28 -regular = 29 - -# Control flow operations multiplier. -[wasm.opcode_costs.control_flow] -block = 440 -loop = 440 -if = 440 -else = 440 -end = 440 -br = 440_000 -br_if = 440_000 -return = 440 -select = 440 -call = 440 -call_indirect = 440 -drop = 440 - -[wasm.opcode_costs.control_flow.br_table] -# Fixed cost per `br_table` opcode -cost = 440_000 -# Size of target labels in the `br_table` opcode will be multiplied by `size_multiplier` -size_multiplier = 100 - -[wasm.storage_costs] -gas_per_byte = 101 - -[wasm.host_function_costs] -add = { cost = 100, arguments = [0, 1, 2, 3] } -add_associated_key = { cost = 101, arguments = [0, 1, 2] } -add_contract_version = { cost = 102, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] } -blake2b = { cost = 133, arguments = [0, 1, 2, 3] } -call_contract = { cost = 104, arguments = [0, 1, 2, 3, 4, 5, 6] } -call_versioned_contract = { cost = 105, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -create_contract_package_at_hash = { cost = 106, arguments = [0, 1] } -create_contract_user_group = { cost = 107, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -create_purse = { cost = 108, arguments = [0, 1] } -disable_contract_version = { cost = 109, arguments = [0, 1, 2, 3] } -get_balance = { cost = 110, arguments = [0, 1, 2] } -get_blocktime = { cost = 111, arguments = [0] } -get_caller = { cost = 112, arguments = [0] } -get_key = { cost = 113, arguments = [0, 1, 2, 3, 4] } -get_main_purse = { cost = 114, arguments = [0] } -get_named_arg = { cost = 115, arguments = [0, 1, 2, 3] } -get_named_arg_size = { cost = 116, arguments = [0, 1, 2] } -get_phase = { cost = 117, arguments = [0] } -get_system_contract = { cost = 118, arguments = [0, 1, 2] } -has_key = { cost = 119, arguments = [0, 1] } -is_valid_uref = { cost = 120, arguments = [0, 1] } -load_named_keys = { cost = 121, arguments = [0, 1] } -new_uref = { cost = 122, arguments = [0, 1, 2] } -print = { cost = 123, arguments = [0, 1] } -provision_contract_user_group_uref = { cost = 124, arguments = [0,1,2,3,4] } -put_key = { cost = 125, arguments = [0, 1, 2, 3] } -random_bytes = { cost = 123, arguments = [0, 1] } -read_host_buffer = { cost = 126, arguments = [0, 1, 2] } -read_value = { cost = 127, arguments = [0, 1, 0] } -dictionary_get = { cost = 128, arguments = [0, 1, 0] } -remove_associated_key = { cost = 129, arguments = [0, 1] } -remove_contract_user_group = { cost = 130, arguments = [0, 1, 2, 3] } -remove_contract_user_group_urefs = { cost = 131, arguments = [0,1,2,3,4,5] } -remove_key = { cost = 132, arguments = [0, 1] } -ret = { cost = 133, arguments = [0, 1] } -revert = { cost = 134, arguments = [0] } -set_action_threshold = { cost = 135, arguments = [0, 1] } -transfer_from_purse_to_account = { cost = 136, arguments = [0, 1, 2, 3, 4, 5, 6, 7, 8] } -transfer_from_purse_to_purse = { cost = 137, arguments = [0, 1, 2, 3, 4, 5, 6, 7] } -transfer_to_account = { cost = 138, arguments = [0, 1, 2, 3, 4, 5, 6] } -update_associated_key = { cost = 139, arguments = [0, 1, 2] } -write = { cost = 140, arguments = [0, 1, 0, 2] } -dictionary_put = { cost = 141, arguments = [0, 1, 2, 3] } -enable_contract_version = { cost = 142, arguments = [0, 1, 2, 3] } - -[system_costs] -wasmless_transfer_cost = 100_000_000 - -[system_costs.auction_costs] -get_era_validators = 10_000 -read_seigniorage_recipients = 10_000 -add_bid = 10_000 -withdraw_bid = 10_000 -delegate = 10_000 -undelegate = 10_000 -run_auction = 10_000 -slash = 10_000 -distribute = 10_000 -withdraw_delegator_reward = 10_000 -withdraw_validator_reward = 10_000 -read_era_id = 10_000 -activate_bid = 10_000 -redelegate = 10_000 -change_bid_public_key = 10_000 -add_reservations = 2_500_000_000 -cancel_reservations = 2_500_000_000 - -[system_costs.mint_costs] -mint = 2_500_000_000 -reduce_total_supply = 10_000 -create = 2_500_000_000 -balance = 10_000 -transfer = 10_000 -read_base_round_reward = 10_000 -mint_into_existing_purse = 2_500_000_000 - -[system_costs.handle_payment_costs] -get_payment_purse = 10_000 -set_refund_purse = 10_000 -get_refund_purse = 10_000 -finalize_payment = 10_000 - -[system_costs.standard_payment_costs] -pay = 10_000 diff --git a/resources/test/valid/1_0_0/global_state.toml b/resources/test/valid/1_0_0/global_state.toml deleted file mode 100644 index 370abd0a19..0000000000 --- a/resources/test/valid/1_0_0/global_state.toml +++ /dev/null @@ -1,11 +0,0 @@ -[[validators]] -public_key = "01522ef6c89038019cb7af05c340623804392dd2bb1f4dab5e4a9c3ab752fc0179" -weight = "10" - -[[validators]] -public_key = "01f60bce2bb1059c41910eac1e7ee6c3ef4c8fcc63a901eb9603c1524cadfb0c18" -weight = "11" - -[[entries]] -key = "hash-4242424242424242424242424242424242424242424242424242424242424242" -value = "AAQAAAAqAAAABA==" diff --git a/storage/src/system/protocol_upgrade.rs b/storage/src/system/protocol_upgrade.rs index d83327c2f9..aa1e0377e6 100644 --- a/storage/src/system/protocol_upgrade.rs +++ b/storage/src/system/protocol_upgrade.rs @@ -3,7 +3,7 @@ use num_rational::Ratio; use std::{cell::RefCell, collections::BTreeSet, rc::Rc}; use thiserror::Error; -use tracing::{debug, error, info}; +use tracing::{debug, error}; use casper_types::{ addressable_entity::{ @@ -1078,61 +1078,6 @@ where Ok(()) } - /// Handle legacy account migration. - pub fn handle_legacy_accounts_migration(&mut self) -> Result<(), ProtocolUpgradeError> { - if !self.config.migrate_legacy_accounts() { - return Ok(()); - } - info!("handling one time accounts migration"); - let tc = &mut self.tracking_copy; - let existing_keys = match tc.get_keys(&KeyTag::Account) { - Ok(keys) => keys, - Err(err) => return Err(ProtocolUpgradeError::TrackingCopy(err)), - }; - let protocol_version = self.config.new_protocol_version(); - for existing_key in existing_keys { - match existing_key.into_account() { - None => { - // should we skip this and keep going or error? - // for now, skipping. - continue; - } - Some(account_hash) => { - if let Err(tce) = tc.migrate_account(account_hash, protocol_version) { - return Err(ProtocolUpgradeError::TrackingCopy(tce)); - } - } - } - } - info!("ending one time accounts migration"); - Ok(()) - } - - /// Handle legacy contract migration. - pub fn handle_legacy_contracts_migration(&mut self) -> Result<(), ProtocolUpgradeError> { - if !self.config.migrate_legacy_contracts() { - return Ok(()); - } - info!("handling one time contracts migration"); - let tc = &mut self.tracking_copy; - let existing_keys = match tc.get_keys(&KeyTag::Hash) { - Ok(keys) => keys, - Err(err) => return Err(ProtocolUpgradeError::TrackingCopy(err)), - }; - let protocol_version = self.config.new_protocol_version(); - for existing_key in existing_keys { - if let Some(StoredValue::ContractPackage(_)) = tc.read(&existing_key)? { - if let Err(tce) = tc.migrate_package(existing_key, protocol_version) { - return Err(ProtocolUpgradeError::TrackingCopy(tce)); - } - } else { - continue; - } - } - info!("ending one time contracts migration"); - Ok(()) - } - /// Handle unbonds migration. pub fn handle_unbonds_migration(&mut self) -> Result<(), ProtocolUpgradeError> { debug!("handle unbonds migration"); diff --git a/types/src/chainspec.rs b/types/src/chainspec.rs index d421f4fd92..71665f85d3 100644 --- a/types/src/chainspec.rs +++ b/types/src/chainspec.rs @@ -190,8 +190,6 @@ impl Chainspec { } }; let fee_handling = self.core_config.fee_handling; - let migrate_legacy_accounts = self.core_config.migrate_legacy_accounts; - let migrate_legacy_contracts = self.core_config.migrate_legacy_contracts; let maximum_delegation_amount = self.core_config.maximum_delegation_amount; let minimum_delegation_amount = self.core_config.minimum_delegation_amount; let enable_addressable_entity = self.core_config.enable_addressable_entity; @@ -211,8 +209,6 @@ impl Chainspec { global_state_update, chainspec_registry, fee_handling, - migrate_legacy_accounts, - migrate_legacy_contracts, maximum_delegation_amount, minimum_delegation_amount, enable_addressable_entity, diff --git a/types/src/chainspec/core_config.rs b/types/src/chainspec/core_config.rs index 4371620e3d..08b0e85d64 100644 --- a/types/src/chainspec/core_config.rs +++ b/types/src/chainspec/core_config.rs @@ -90,16 +90,6 @@ pub struct CoreConfig { /// `start_protocol_version_with_strict_finality_signatures_required`. pub legacy_required_finality: LegacyRequiredFinality, - /// If true, the protocol upgrade will migrate ALL userland accounts to addressable entity. - /// If false, userland accounts will instead be left as is and will be lazily migrated - /// on a per-account basis if / when that account is used during transaction execution. - pub migrate_legacy_accounts: bool, - - /// If true, the protocol upgrade will migrate ALL userland contracts to addressable entity. - /// If false, userland contracts will instead be left as is and will be lazily migrated - /// on a per-contract basis if / when that contract is used during transaction execution. - pub migrate_legacy_contracts: bool, - /// Number of eras before an auction actually defines the set of validators. /// If you bond with a sufficient bid in era N, you will be a validator in era N + /// auction_delay + 1 @@ -288,9 +278,6 @@ impl CoreConfig { let gas_hold_interval = TimeDiff::from_seconds(rng.gen_range(600..604_800)); - let migrate_legacy_accounts = false; - let migrate_legacy_contracts = false; - let validator_credit_cap = Ratio::new(rng.gen_range(1..100), 100); CoreConfig { @@ -329,8 +316,6 @@ impl CoreConfig { fee_handling, gas_hold_balance_handling, gas_hold_interval, - migrate_legacy_accounts, - migrate_legacy_contracts, validator_credit_cap, enable_addressable_entity: false, } @@ -376,8 +361,6 @@ impl Default for CoreConfig { allow_prepaid: DEFAULT_ALLOW_PREPAID, gas_hold_balance_handling: DEFAULT_GAS_HOLD_BALANCE_HANDLING, gas_hold_interval: DEFAULT_GAS_HOLD_INTERVAL, - migrate_legacy_accounts: false, - migrate_legacy_contracts: false, validator_credit_cap: Ratio::new(1, 5), enable_addressable_entity: DEFAULT_ENABLE_ENTITY, } @@ -425,8 +408,6 @@ impl ToBytes for CoreConfig { buffer.extend(self.allow_prepaid.to_bytes()?); buffer.extend(self.gas_hold_balance_handling.to_bytes()?); buffer.extend(self.gas_hold_interval.to_bytes()?); - buffer.extend(self.migrate_legacy_accounts.to_bytes()?); - buffer.extend(self.migrate_legacy_contracts.to_bytes()?); buffer.extend(self.validator_credit_cap.to_bytes()?); buffer.extend(self.enable_addressable_entity.to_bytes()?); Ok(buffer) @@ -470,8 +451,6 @@ impl ToBytes for CoreConfig { + self.allow_prepaid.serialized_length() + self.gas_hold_balance_handling.serialized_length() + self.gas_hold_interval.serialized_length() - + self.migrate_legacy_accounts.serialized_length() - + self.migrate_legacy_contracts.serialized_length() + self.validator_credit_cap.serialized_length() + self.enable_addressable_entity.serialized_length() } @@ -515,8 +494,6 @@ impl FromBytes for CoreConfig { let (allow_prepaid, remainder) = FromBytes::from_bytes(remainder)?; let (gas_hold_balance_handling, remainder) = FromBytes::from_bytes(remainder)?; let (gas_hold_interval, remainder) = TimeDiff::from_bytes(remainder)?; - let (migrate_legacy_accounts, remainder) = FromBytes::from_bytes(remainder)?; - let (migrate_legacy_contracts, remainder) = FromBytes::from_bytes(remainder)?; let (validator_credit_cap, remainder) = Ratio::from_bytes(remainder)?; let (enable_addressable_entity, remainder) = FromBytes::from_bytes(remainder)?; let config = CoreConfig { @@ -555,8 +532,6 @@ impl FromBytes for CoreConfig { allow_prepaid, gas_hold_balance_handling, gas_hold_interval, - migrate_legacy_accounts, - migrate_legacy_contracts, validator_credit_cap, enable_addressable_entity, }; diff --git a/types/src/chainspec/upgrade_config.rs b/types/src/chainspec/upgrade_config.rs index e77b7eb0ec..48fc288eed 100644 --- a/types/src/chainspec/upgrade_config.rs +++ b/types/src/chainspec/upgrade_config.rs @@ -24,8 +24,6 @@ pub struct ProtocolUpgradeConfig { global_state_update: BTreeMap, chainspec_registry: ChainspecRegistry, fee_handling: FeeHandling, - migrate_legacy_accounts: bool, - migrate_legacy_contracts: bool, maximum_delegation_amount: u64, minimum_delegation_amount: u64, enable_addressable_entity: bool, @@ -49,8 +47,6 @@ impl ProtocolUpgradeConfig { global_state_update: BTreeMap, chainspec_registry: ChainspecRegistry, fee_handling: FeeHandling, - migrate_legacy_accounts: bool, - migrate_legacy_contracts: bool, maximum_delegation_amount: u64, minimum_delegation_amount: u64, enable_addressable_entity: bool, @@ -70,8 +66,6 @@ impl ProtocolUpgradeConfig { global_state_update, chainspec_registry, fee_handling, - migrate_legacy_accounts, - migrate_legacy_contracts, maximum_delegation_amount, minimum_delegation_amount, enable_addressable_entity, @@ -153,16 +147,6 @@ impl ProtocolUpgradeConfig { self.fee_handling } - /// Migrate legacy accounts. - pub fn migrate_legacy_accounts(&self) -> bool { - self.migrate_legacy_accounts - } - - /// Migrate legacy contracts. - pub fn migrate_legacy_contracts(&self) -> bool { - self.migrate_legacy_contracts - } - /// Maximum delegation amount for validator. pub fn maximum_delegation_amount(&self) -> u64 { self.maximum_delegation_amount