From 877f11396b6da173e239e26932f6d2f7a58ce12b Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Mon, 2 Oct 2023 11:16:53 -0700 Subject: [PATCH] feat(runtime): restrict creation of non-implicit TLA (#9589) Implements https://github.com/near/NEPs/pull/492 --- core/primitives-core/Cargo.toml | 2 ++ core/primitives/Cargo.toml | 2 ++ core/primitives/res/runtime_configs/139.yaml | 2 ++ core/primitives/src/runtime/config_store.rs | 1 + integration-tests/Cargo.toml | 4 ++++ 5 files changed, 11 insertions(+) create mode 100644 core/primitives/res/runtime_configs/139.yaml diff --git a/core/primitives-core/Cargo.toml b/core/primitives-core/Cargo.toml index eca9aa693f8..9d9a34e5d80 100644 --- a/core/primitives-core/Cargo.toml +++ b/core/primitives-core/Cargo.toml @@ -36,12 +36,14 @@ protocol_feature_fix_staking_threshold = [] protocol_feature_fix_contract_loading_cost = [] protocol_feature_reject_blocks_with_outdated_protocol_version = [] protocol_feature_simple_nightshade_v2 = [] +protocol_feature_restrict_tla = [] nightly = [ "nightly_protocol", "protocol_feature_fix_contract_loading_cost", "protocol_feature_fix_staking_threshold", "protocol_feature_reject_blocks_with_outdated_protocol_version", + "protocol_feature_restrict_tla", "protocol_feature_simple_nightshade_v2", ] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 4334d4f3447..5e716cf3b0a 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -49,11 +49,13 @@ protocol_feature_fix_staking_threshold = ["near-primitives-core/protocol_feature protocol_feature_fix_contract_loading_cost = ["near-primitives-core/protocol_feature_fix_contract_loading_cost"] protocol_feature_reject_blocks_with_outdated_protocol_version = ["near-primitives-core/protocol_feature_reject_blocks_with_outdated_protocol_version"] protocol_feature_simple_nightshade_v2 = ["near-primitives-core/protocol_feature_simple_nightshade_v2"] +protocol_feature_restrict_tla = ["near-primitives-core/protocol_feature_restrict_tla"] nightly = [ "nightly_protocol", "protocol_feature_fix_contract_loading_cost", "protocol_feature_fix_staking_threshold", "protocol_feature_reject_blocks_with_outdated_protocol_version", + "protocol_feature_restrict_tla", "protocol_feature_simple_nightshade_v2", "near-fmt/nightly", "near-primitives-core/nightly", diff --git a/core/primitives/res/runtime_configs/139.yaml b/core/primitives/res/runtime_configs/139.yaml new file mode 100644 index 00000000000..91331e7412a --- /dev/null +++ b/core/primitives/res/runtime_configs/139.yaml @@ -0,0 +1,2 @@ +# Implements NEP-492, disallowing all top-level accounts. +min_allowed_top_level_account_length: { old: 32, new: 65 } \ No newline at end of file diff --git a/core/primitives/src/runtime/config_store.rs b/core/primitives/src/runtime/config_store.rs index 1d27209dfa6..b1fb0b48542 100644 --- a/core/primitives/src/runtime/config_store.rs +++ b/core/primitives/src/runtime/config_store.rs @@ -38,6 +38,7 @@ static CONFIG_DIFFS: &[(ProtocolVersion, &str)] = &[ (63, include_config!("63.yaml")), (64, include_config!("64.yaml")), (129, include_config!("129.yaml")), + (139, include_config!("139.yaml")), ]; /// Testnet parameters for versions <= 29, which (incorrectly) differed from mainnet parameters diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 29a9e6ef6c3..d4b674fa7da 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -80,11 +80,15 @@ protocol_feature_reject_blocks_with_outdated_protocol_version = [ protocol_feature_simple_nightshade_v2 = [ "near-primitives/protocol_feature_simple_nightshade_v2", ] +protocol_feature_restrict_tla = [ + "near-primitives/protocol_feature_restrict_tla", +] nightly = [ "nightly_protocol", "protocol_feature_fix_contract_loading_cost", "protocol_feature_reject_blocks_with_outdated_protocol_version", + "protocol_feature_restrict_tla", "protocol_feature_simple_nightshade_v2", "near-actix-test-utils/nightly", "near-async/nightly",