Skip to content

Commit

Permalink
stabilize congestion control and stateless validation (near#11701)
Browse files Browse the repository at this point in the history
# Feature to stabilize
This PR stabilizes the Congestion Control and Stateless Validation
protocol features. They are assigned separate protocol features and the
protocol upgrades should be scheduled separately.

# Context

* near/NEPs#539
* near/NEPs#509

# Testing and QA
Those features are well covered in unit, integration and end to end
tests and were extensively tested in forknet and statelessnet.

# Checklist
- [x] Link to nightly nayduck run (`./scripts/nayduck.py`,
[docs](https://github.com/near/nearcore/blob/master/nightly/README.md#scheduling-a-run)):
https://nayduck.nearone.org/
- [x] Update CHANGELOG.md to include this protocol feature in the
`Unreleased` section.
  • Loading branch information
wacban authored and marcelo-gonzalez committed Jul 3, 2024
1 parent fe6a736 commit 1047343
Show file tree
Hide file tree
Showing 29 changed files with 128 additions and 1,632 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [unreleased]

### Protocol Changes
* Congestion Control [NEP-0539](https://github.com/near/NEPs/pull/539)
* Stateless Validation [NEP-0509](https://github.com/near/NEPs/pull/509)

### Non-protocol Changes

Expand Down
4 changes: 2 additions & 2 deletions chain/chain/src/tests/simple_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn build_chain() {
if cfg!(feature = "nightly") {
insta::assert_snapshot!(hash, @"C3zeKRZubVungxfrSdq379TSCYnuz2YzjEkcJTdm3pU4");
} else {
insta::assert_snapshot!(hash, @"2WHohfYksQnwKwSEoTKpkseu2RWthbGf9kmGetgHgfQQ");
insta::assert_snapshot!(hash, @"EKBbsbiindwuPwbiARE9LevUffurNhprbSaUjgPKCwEq");
}

for i in 1..5 {
Expand All @@ -52,7 +52,7 @@ fn build_chain() {
if cfg!(feature = "nightly") {
insta::assert_snapshot!(hash, @"EjLaoHRiAdRp2NcDqwbMcAYYxGfcv5R7GuYUNfRpaJvB");
} else {
insta::assert_snapshot!(hash, @"HJuuENeSwwikoR9BZA7cSonxAPZgY5mKQWL2pSXwjAwZ");
insta::assert_snapshot!(hash, @"9Ag5sa6bF9knuJKe9XECTKZi7HwtDhCSxCZ8P9AdSvWH");
}
}

Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/jsonrpc-tests/res/genesis_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"protocol_version": 67,
"protocol_version": 69,
"genesis_time": "1970-01-01T00:00:00.000000000Z",
"chain_id": "sample",
"genesis_height": 0,
Expand Down
2 changes: 2 additions & 0 deletions chain/jsonrpc/res/rpc_errors_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@
"props": {
"final_accounts_balance": "",
"final_postponed_receipts_balance": "",
"forwarded_buffered_receipts_balance": "",
"incoming_receipts_balance": "",
"incoming_validator_rewards": "",
"initial_accounts_balance": "",
"initial_postponed_receipts_balance": "",
"new_buffered_receipts_balance": "",
"new_delayed_receipts_balance": "",
"other_burnt_amount": "",
"outgoing_receipts_balance": "",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# State Witness size limits.

max_transaction_size: {old: 4_194_304, new: 1_572_864}

per_receipt_storage_proof_size_limit: {old: 999_999_999_999_999, new: 4_000_000}
main_storage_proof_size_soft_limit: {old: 999_999_999_999_999, new: 3_000_000}

max_receipt_size: {old: 999_999_999_999_999, new: 4_194_304}
new_transactions_validation_state_size_soft_limit: {old: 999_999_999_999_999, new: 572_864}

# 100 kiB
outgoing_receipts_usual_size_limit: {old: 999_999_999_999_999, new: 102_400}

# 4.5 MiB
outgoing_receipts_big_size_limit: {old: 999_999_999_999_999, new: 4_718_592}

combined_transactions_size_limit: {old: 999_999_999_999_999, new: 4_194_304}


# Change the cost of sending receipt to another account to 50 TGas / MiB

action_deploy_contract_per_byte: {
Expand Down
17 changes: 0 additions & 17 deletions core/parameters/res/runtime_configs/81.yaml

This file was deleted.

46 changes: 23 additions & 23 deletions core/parameters/res/runtime_configs/parameters.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ description: THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
---
burnt_gas_reward 3 / 10
pessimistic_gas_price_inflation 103 / 100
main_storage_proof_size_soft_limit 999_999_999_999_999
per_receipt_storage_proof_size_limit 999_999_999_999_999
new_transactions_validation_state_size_soft_limit 999_999_999_999_999
combined_transactions_size_limit 999_999_999_999_999
outgoing_receipts_usual_size_limit 999_999_999_999_999
outgoing_receipts_big_size_limit 999_999_999_999_999
main_storage_proof_size_soft_limit 3_000_000
per_receipt_storage_proof_size_limit 4_000_000
new_transactions_validation_state_size_soft_limit 572_864
combined_transactions_size_limit 4_194_304
outgoing_receipts_usual_size_limit 102_400
outgoing_receipts_big_size_limit 4_718_592
min_allowed_top_level_account_length 65
registrar_account_id registrar
storage_amount_per_byte 10000000000000000000
Expand All @@ -25,7 +25,7 @@ data_receipt_creation_base
- execution: 36_486_732_312
data_receipt_creation_per_byte
- send_sir: 17_212_011
- send_not_sir: 17_212_011
- send_not_sir: 47_683_715
- execution: 17_212_011
action_create_account
- send_sir: 3_850_000_000_000
Expand All @@ -41,15 +41,15 @@ action_deploy_contract
- execution: 184_765_750_000
action_deploy_contract_per_byte
- send_sir: 6_812_999
- send_not_sir: 6_812_999
- send_not_sir: 47_683_715
- execution: 64_572_944
action_function_call
- send_sir: 200_000_000_000
- send_not_sir: 200_000_000_000
- execution: 780_000_000_000
action_function_call_per_byte
- send_sir: 2_235_934
- send_not_sir: 2_235_934
- send_not_sir: 47_683_715
- execution: 2_235_934
action_transfer
- send_sir: 115_123_062_500
Expand All @@ -69,7 +69,7 @@ action_add_function_call_key
- execution: 102_217_625_000
action_add_function_call_key_per_byte
- send_sir: 1_925_331
- send_not_sir: 1_925_331
- send_not_sir: 47_683_715
- execution: 1_925_331
action_delete_key
- send_sir: 94_946_625_000
Expand Down Expand Up @@ -145,7 +145,7 @@ wasm_alt_bn128_g1_sum_element 5_000_000_000
wasm_yield_create_base 153_411_779_276
wasm_yield_create_byte 15_643_988
wasm_yield_resume_base 1_195_627_285_210
wasm_yield_resume_byte 17_212_011
wasm_yield_resume_byte 47_683_715
max_gas_burnt 300_000_000_000_000
max_gas_burnt_view 300_000_000_000_000
max_stack_height 262_144
Expand All @@ -164,8 +164,8 @@ max_length_method_name 256
max_arguments_length 4_194_304
max_length_returned_data 4_194_304
max_contract_size 4_194_304
max_transaction_size 4_194_304
max_receipt_size 999_999_999_999_999
max_transaction_size 1_572_864
max_receipt_size 4_194_304
max_length_storage_key 2_048
max_length_storage_value 4_194_304
max_promises_per_function_call_action 1_024
Expand All @@ -187,13 +187,13 @@ function_call_weight true
vm_kind NearVm
eth_implicit_accounts false
yield_resume true
max_congestion_incoming_gas 9_223_372_036_854_775_807
max_congestion_outgoing_gas 9_223_372_036_854_775_807
max_congestion_memory_consumption 9_223_372_036_854_775_807
max_congestion_missed_chunks 9_223_372_036_854_775_807
max_outgoing_gas 9_223_372_036_854_775_807
min_outgoing_gas 9_223_372_036_854_775_807
allowed_shard_outgoing_gas 9_223_372_036_854_775_807
max_tx_gas 9_223_372_036_854_775_807
min_tx_gas 9_223_372_036_854_775_807
reject_tx_congestion_threshold 1 / 1
max_congestion_incoming_gas 20_000_000_000_000_000
max_congestion_outgoing_gas 10_000_000_000_000_000
max_congestion_memory_consumption 1_000_000_000
max_congestion_missed_chunks 5
max_outgoing_gas 300_000_000_000_000_000
min_outgoing_gas 1_000_000_000_000_000
allowed_shard_outgoing_gas 1_000_000_000_000_000
max_tx_gas 500_000_000_000_000
min_tx_gas 20_000_000_000_000
reject_tx_congestion_threshold 50 / 100
5 changes: 2 additions & 3 deletions core/parameters/src/config_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ static CONFIG_DIFFS: &[(ProtocolVersion, &str)] = &[
(66, include_config!("66.yaml")),
(67, include_config!("67.yaml")),
// Congestion Control.
(80, include_config!("80.yaml")),
(68, include_config!("68.yaml")),
// Stateless Validation.
(81, include_config!("81.yaml")),
(82, include_config!("82.yaml")),
(69, include_config!("69.yaml")),
(129, include_config!("129.yaml")),
// Introduce ETH-implicit accounts.
(138, include_config!("138.yaml")),
Expand Down
Loading

0 comments on commit 1047343

Please sign in to comment.