Skip to content

Commit cd108db

Browse files
authored
update genesis config (starcoinorg#2960)
- update halley vm config. - add a diff when submit vm config proposal
1 parent f9e72da commit cd108db

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/starcoin/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ starcoin-network-rpc-api = {path = "../../network-rpc/api"}
5454
short-hex-str = { git = "https://github.com/starcoinorg/diem", rev="6ff224f42a408f584acbcd37eebac14de619b16f" }
5555
starcoin-abi-decoder = {path = "../../abi/decoder"}
5656
starcoin-abi-types = {path = "../../abi/types"}
57+
move-command-line-common = {git = "https://github.com/starcoinorg/diem", rev="6ff224f42a408f584acbcd37eebac14de619b16f" }
5758

5859
[dev-dependencies]
5960
test-helper= {path = "../../test-helper"}

cmd/starcoin/src/dev/upgrade_vm_config_proposal_cmd.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ use crate::dev::sign_txn_helper::get_dao_config;
66
use crate::view::{ExecuteResultView, TransactionOptions};
77
use crate::StarcoinOpt;
88
use anyhow::Result;
9+
use move_command_line_common::testing::format_diff;
910
use scmd::{CommandAction, ExecContext};
1011
use starcoin_config::BuiltinNetworkID;
12+
use starcoin_rpc_client::StateRootOption;
1113
use starcoin_transaction_builder::build_vm_config_upgrade_proposal;
14+
use starcoin_vm_types::on_chain_config::{OnChainConfig, VMConfig};
1215
use starcoin_vm_types::transaction::TransactionPayload;
1316
use structopt::StructOpt;
1417

@@ -41,6 +44,18 @@ impl CommandAction for UpgradeVMConfigProposalCommand {
4144
let opt = ctx.opt();
4245

4346
let genesis_config = opt.net.genesis_config().clone();
47+
let onchain_vm_config = {
48+
let client = ctx.state().client();
49+
let reader = client.state_reader(StateRootOption::Latest)?;
50+
VMConfig::fetch_config(&reader)?.unwrap()
51+
};
52+
let diff = {
53+
let current_config = serde_json::to_string_pretty(&onchain_vm_config)?;
54+
let new_config = serde_json::to_string_pretty(&genesis_config.vm_config)?;
55+
format_diff(current_config, new_config)
56+
};
57+
println!("{}", diff);
58+
4459
let min_action_delay = get_dao_config(ctx.state())?.min_action_delay;
4560
let vm_config_upgrade_proposal =
4661
build_vm_config_upgrade_proposal(genesis_config.vm_config, min_action_delay);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"genesis_block_parameter":{"Static":{"parent_hash":"0xc8a9a33364a451f6cfe088c000a2b38626974fc9a242d8633a8b54530dd939d7","timestamp":1616415168000,"difficulty":"0x64"}},"version":{"major":1},"reward_delay":3,"pre_mine_amount":159256800000000000,"time_mint_amount":477770400000000000,"time_mint_period":2678400,"vm_config":{"gas_schedule":{"instruction_table":[{"instruction_gas":1,"memory_gas":1},{"instruction_gas":638,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1132,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":3,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":41,"memory_gas":1},{"instruction_gas":21,"memory_gas":1},{"instruction_gas":23,"memory_gas":1},{"instruction_gas":459,"memory_gas":1},{"instruction_gas":13,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":582,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":34,"memory_gas":1},{"instruction_gas":15,"memory_gas":1},{"instruction_gas":14,"memory_gas":1},{"instruction_gas":13,"memory_gas":1},{"instruction_gas":27,"memory_gas":1}],"native_table":[{"instruction_gas":21,"memory_gas":1},{"instruction_gas":64,"memory_gas":1},{"instruction_gas":61,"memory_gas":1},{"instruction_gas":3351,"memory_gas":1},{"instruction_gas":181,"memory_gas":1},{"instruction_gas":98,"memory_gas":1},{"instruction_gas":84,"memory_gas":1},{"instruction_gas":1334,"memory_gas":1},{"instruction_gas":1902,"memory_gas":1},{"instruction_gas":53,"memory_gas":1},{"instruction_gas":227,"memory_gas":1},{"instruction_gas":572,"memory_gas":1},{"instruction_gas":1436,"memory_gas":1},{"instruction_gas":26,"memory_gas":1},{"instruction_gas":353,"memory_gas":1},{"instruction_gas":24,"memory_gas":1},{"instruction_gas":212,"memory_gas":1},{"instruction_gas":52,"memory_gas":1},{"instruction_gas":26,"memory_gas":1},{"instruction_gas":2002,"memory_gas":1},{"instruction_gas":64,"memory_gas":1}],"gas_constants":{"global_memory_per_byte_cost":4,"global_memory_per_byte_write_cost":9,"min_transaction_gas_units":600,"large_transaction_cutoff":600,"intrinsic_gas_per_byte":8,"maximum_number_of_gas_units":40000000,"min_price_per_gas_unit":1,"max_price_per_gas_unit":10000,"max_transaction_size_in_bytes":60000,"gas_unit_scaling_factor":1,"default_account_size":800}}},"publishing_option":{"script_allowed":true,"module_publishing_allowed":true},"consensus_config":{"uncle_rate_target":240,"base_block_time_target":10000,"base_reward_per_block":10000000000,"base_reward_per_uncle_percent":10,"epoch_block_count":240,"base_block_difficulty_window":24,"min_block_time_target":5000,"max_block_time_target":60000,"base_max_uncles_per_block":2,"base_block_gas_limit":50000000,"strategy":3},"association_key_pair":[null,"0xfde53c76807c8a5ec5855ed6200868be8653c34a0f18c6b01f60040ead5daa87b1157be91c2637b709c09ed5d420976c0d4df79537372d69a272fc4869c1364ce3700a1ed3f00ea87c015028cd4a03a4881f6fe203b02f7059db906b764cd23202"],"genesis_key_pair":null,"stdlib_version":"Latest","dao_config":{"voting_delay":60000,"voting_period":3600000,"voting_quorum_rate":4,"min_action_delay":3600000},"time_service_type":"RealTimeService","transaction_timeout":86400}
1+
{"genesis_block_parameter":{"Static":{"parent_hash":"0xc8a9a33364a451f6cfe088c000a2b38626974fc9a242d8633a8b54530dd939d7","timestamp":1616415168000,"difficulty":"0x64"}},"version":{"major":1},"reward_delay":3,"pre_mine_amount":159256800000000000,"time_mint_amount":477770400000000000,"time_mint_period":2678400,"vm_config":{"gas_schedule":{"instruction_table":[{"instruction_gas":1,"memory_gas":1},{"instruction_gas":638,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1132,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":3,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":41,"memory_gas":1},{"instruction_gas":21,"memory_gas":1},{"instruction_gas":23,"memory_gas":1},{"instruction_gas":459,"memory_gas":1},{"instruction_gas":13,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":1,"memory_gas":1},{"instruction_gas":582,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":2,"memory_gas":1},{"instruction_gas":34,"memory_gas":1},{"instruction_gas":15,"memory_gas":1},{"instruction_gas":14,"memory_gas":1},{"instruction_gas":13,"memory_gas":1},{"instruction_gas":27,"memory_gas":1}],"native_table":[{"instruction_gas":21,"memory_gas":1},{"instruction_gas":64,"memory_gas":1},{"instruction_gas":61,"memory_gas":1},{"instruction_gas":3351,"memory_gas":1},{"instruction_gas":181,"memory_gas":1},{"instruction_gas":98,"memory_gas":1},{"instruction_gas":84,"memory_gas":1},{"instruction_gas":1334,"memory_gas":1},{"instruction_gas":1902,"memory_gas":1},{"instruction_gas":53,"memory_gas":1},{"instruction_gas":227,"memory_gas":1},{"instruction_gas":572,"memory_gas":1},{"instruction_gas":1436,"memory_gas":1},{"instruction_gas":26,"memory_gas":1},{"instruction_gas":353,"memory_gas":1},{"instruction_gas":24,"memory_gas":1},{"instruction_gas":212,"memory_gas":1},{"instruction_gas":52,"memory_gas":1},{"instruction_gas":26,"memory_gas":1},{"instruction_gas":2002,"memory_gas":1},{"instruction_gas":64,"memory_gas":1}],"gas_constants":{"global_memory_per_byte_cost":4,"global_memory_per_byte_write_cost":9,"min_transaction_gas_units":600,"large_transaction_cutoff":600,"intrinsic_gas_per_byte":8,"maximum_number_of_gas_units":40000000,"min_price_per_gas_unit":1,"max_price_per_gas_unit":10000,"max_transaction_size_in_bytes":131072,"gas_unit_scaling_factor":1,"default_account_size":800}}},"publishing_option":{"script_allowed":true,"module_publishing_allowed":true},"consensus_config":{"uncle_rate_target":240,"base_block_time_target":10000,"base_reward_per_block":10000000000,"base_reward_per_uncle_percent":10,"epoch_block_count":240,"base_block_difficulty_window":24,"min_block_time_target":5000,"max_block_time_target":60000,"base_max_uncles_per_block":2,"base_block_gas_limit":50000000,"strategy":3},"association_key_pair":[null,"0xfde53c76807c8a5ec5855ed6200868be8653c34a0f18c6b01f60040ead5daa87b1157be91c2637b709c09ed5d420976c0d4df79537372d69a272fc4869c1364ce3700a1ed3f00ea87c015028cd4a03a4881f6fe203b02f7059db906b764cd23202"],"genesis_key_pair":null,"stdlib_version":"Latest","dao_config":{"voting_delay":60000,"voting_period":3600000,"voting_quorum_rate":4,"min_action_delay":3600000},"time_service_type":"RealTimeService","transaction_timeout":86400}

config/src/genesis_config.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ pub static BASE_BLOCK_GAS_LIMIT: u64 = 50_000_000; //must big than maximum_numbe
699699

700700
pub static MAX_TRANSACTION_SIZE_IN_BYTES: u64 = 4096 * 10;
701701
pub static MAX_TRANSACTION_SIZE_IN_BYTES_V2: u64 = 60000;
702-
pub static MAX_TRANSACTION_SIZE_IN_BYTES_V3: u64 = 4096 * 32; // 128k
703702

704703
/// For V1 all accounts will be ~800 bytes
705704
static DEFAULT_ACCOUNT_SIZE: Lazy<AbstractMemorySize<GasCarrier>> =
@@ -751,7 +750,7 @@ pub static TEST_GAS_CONSTANTS: Lazy<GasConstants> = Lazy::new(|| {
751750
maximum_number_of_gas_units: GasUnits::new(40_000_000), //must less than base_block_gas_limit
752751
min_price_per_gas_unit: GasPrice::new(0),
753752
max_price_per_gas_unit: GasPrice::new(10_000),
754-
max_transaction_size_in_bytes: MAX_TRANSACTION_SIZE_IN_BYTES_V3, // to pass stdlib_upgrade
753+
max_transaction_size_in_bytes: 4096 * 32, // 128k, to pass stdlib_upgrade
755754
gas_unit_scaling_factor: 1,
756755
default_account_size: *DEFAULT_ACCOUNT_SIZE,
757756
}
@@ -891,7 +890,23 @@ pub static HALLEY_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
891890
time_mint_amount: DEFAULT_TIME_LOCKED_AMOUNT.scaling(),
892891
time_mint_period: 3600 * 24 * 31,
893892
vm_config: VMConfig {
894-
gas_schedule: INITIAL_GAS_SCHEDULE.clone(),
893+
gas_schedule: CostTable {
894+
instruction_table: initial_instruction_table(),
895+
native_table: initial_native_table(),
896+
gas_constants: GasConstants {
897+
global_memory_per_byte_cost: InternalGasUnits::new(4),
898+
global_memory_per_byte_write_cost: InternalGasUnits::new(9),
899+
min_transaction_gas_units: InternalGasUnits::new(600),
900+
large_transaction_cutoff: *LARGE_TRANSACTION_CUTOFF,
901+
intrinsic_gas_per_byte: InternalGasUnits::new(8),
902+
maximum_number_of_gas_units: GasUnits::new(40_000_000), //must less than base_block_gas_limit
903+
min_price_per_gas_unit: GasPrice::new(1),
904+
max_price_per_gas_unit: GasPrice::new(10_000),
905+
max_transaction_size_in_bytes: 4096 * 32, // 128k
906+
gas_unit_scaling_factor: 1,
907+
default_account_size: *DEFAULT_ACCOUNT_SIZE,
908+
}
909+
},
895910
},
896911
publishing_option: TransactionPublishOption::open(),
897912
consensus_config: ConsensusConfig {

genesis/generated/halley/genesis

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)