Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler-v2] fix starcoin config unit test #4322

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,086 changes: 1,736 additions & 350 deletions config/example/barnard/genesis_config.json

Large diffs are not rendered by default.

2,094 changes: 1,740 additions & 354 deletions config/example/main/genesis_config.json

Large diffs are not rendered by default.

2,342 changes: 1,864 additions & 478 deletions config/example/proxima/genesis_config.json

Large diffs are not rendered by default.

2,092 changes: 1,739 additions & 353 deletions config/example/vega/genesis_config.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/src/account_vault_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::{BaseConfig, ConfigModule, StarcoinOpt};
use anyhow::Result;
use clap::{value_parser, Parser};
use clap::Parser;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
Expand All @@ -15,7 +15,7 @@ static G_DEFAULT_DIR: Lazy<PathBuf> = Lazy::new(|| PathBuf::from("account_vaults
#[serde(deny_unknown_fields)]
pub struct AccountVaultConfig {
#[serde(skip_serializing_if = "Option::is_none")]
#[arg(long = "vault-dir", value_parser = value_parser!(std::ffi::OsString))]
#[arg(long = "vault-dir", value_parser)]
/// Account vault dir config.
/// Default: account_vaults in data_dir
dir: Option<PathBuf>,
Expand Down
8 changes: 4 additions & 4 deletions config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ pub static G_DAG_TEST_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
time_mint_period: G_DEFAULT_TIME_LOCKED_PERIOD,
vm_config: VMConfig {
gas_schedule: GasSchedule {
feature_vesion: LATEST_GAS_FEATURE_VERSION,
feature_version: LATEST_GAS_FEATURE_VERSION,
entries: StarcoinGasParameters::initial()
.to_on_chain_gas_schedule(LATEST_GAS_FEATURE_VERSION),
},
Expand Down Expand Up @@ -820,7 +820,7 @@ pub static G_TEST_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
time_mint_period: G_DEFAULT_TIME_LOCKED_PERIOD,
vm_config: VMConfig {
gas_schedule: GasSchedule {
feature_vesion: LATEST_GAS_FEATURE_VERSION,
feature_version: LATEST_GAS_FEATURE_VERSION,
entries: StarcoinGasParameters::initial()
.to_on_chain_gas_schedule(LATEST_GAS_FEATURE_VERSION),
},
Expand Down Expand Up @@ -878,7 +878,7 @@ pub static G_DEV_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
time_mint_period: 3600 * 24,
vm_config: VMConfig {
gas_schedule: GasSchedule {
feature_vesion: LATEST_GAS_FEATURE_VERSION,
feature_version: LATEST_GAS_FEATURE_VERSION,
entries: StarcoinGasParameters::initial()
.to_on_chain_gas_schedule(LATEST_GAS_FEATURE_VERSION),
},
Expand Down Expand Up @@ -940,7 +940,7 @@ pub static G_HALLEY_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
time_mint_period: 3600 * 24 * 31,
vm_config: VMConfig {
gas_schedule: GasSchedule {
feature_vesion: LATEST_GAS_FEATURE_VERSION,
feature_version: LATEST_GAS_FEATURE_VERSION,
entries: StarcoinGasParameters::initial()
.to_on_chain_gas_schedule(LATEST_GAS_FEATURE_VERSION),
},
Expand Down
4 changes: 2 additions & 2 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::account_vault_config::AccountVaultConfig;
use crate::helper::{load_config, save_config};
use crate::sync_config::SyncConfig;
use anyhow::{ensure, format_err, Result};
use clap::{value_parser, Parser};
use clap::Parser;
use git_version::git_version;
use once_cell::sync::Lazy;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
Expand Down Expand Up @@ -182,7 +182,7 @@ pub struct StarcoinOpt {
pub connect: Option<Connect>,

#[serde(skip_serializing_if = "Option::is_none")]
#[arg(long = "data-dir", short = 'd', value_parser = value_parser!(std::ffi::OsString))]
#[arg(long = "data-dir", short = 'd', value_parser)]
/// Path to data dir, this dir is base dir, the final data_dir is base_dir/chain_network_name
pub base_data_dir: Option<PathBuf>,

Expand Down
15 changes: 15 additions & 0 deletions config/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,18 @@ fn test_check_method_in_api_sets() {
assert!(!ApiSet::UnsafeContext.check_rpc_method("unknown"));
assert!(!ApiSet::UnsafeContext.check_rpc_method(""));
}

#[test]
fn print_all_genesis_config() {
for net in BuiltinNetworkID::networks() {
if net.is_dev() || net.is_test() || net.is_dag_test() {
continue;
}
let genesis_config = net.genesis_config();
println!("genesis config for network: {}", net);
println!(
"{}\n\n\n",
serde_json::to_string_pretty(genesis_config).unwrap()
);
}
}
1 change: 1 addition & 0 deletions scripts/nextest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cargo nextest run \
-p starcoin-vm-runtime \
-p starcoin-genesis \
-p starcoin-node \
-p starcoin-config \
--retries 2 --build-jobs 8 --test-threads 12 --no-fail-fast --failure-output immediate-final


Expand Down
2 changes: 1 addition & 1 deletion vm/starcoin-transactional-test-harness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ impl<'a> StarcoinTestAdapter<'a> {
.gas_schedule;
let gas_parameters = StarcoinGasParameters::from_on_chain_gas_schedule(
&gs.clone().to_btree_map(),
gs.feature_vesion,
gs.feature_version,
)
.unwrap();
let max_number_of_gas_units = gas_parameters.vm.txn.maximum_number_of_gas_units;
Expand Down
4 changes: 2 additions & 2 deletions vm/types/src/on_chain_config/gas_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub static G_GAS_SCHEDULE_GAS_SCHEDULE: Lazy<Identifier> =

#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
pub struct GasSchedule {
pub feature_vesion: u64,
pub feature_version: u64,
pub entries: Vec<(String, u64)>,
}

Expand Down Expand Up @@ -690,7 +690,7 @@ impl From<&CostTable> for GasSchedule {
append_extra_gas_cost_framework_upgrade(&mut entries);

Self {
feature_vesion: 13,
feature_version: 13,
entries,
}
}
Expand Down
2 changes: 1 addition & 1 deletion vm/vm-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn discard_error_output(err: StatusCode) -> TransactionOutput {

pub(crate) fn default_gas_schedule() -> GasSchedule {
GasSchedule {
feature_vesion: LATEST_GAS_FEATURE_VERSION,
feature_version: LATEST_GAS_FEATURE_VERSION,
entries: StarcoinGasParameters::initial()
.to_on_chain_gas_schedule(LATEST_GAS_FEATURE_VERSION),
}
Expand Down
2 changes: 1 addition & 1 deletion vm/vm-runtime/src/starcoin_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl StarcoinVM {
bail!("failed to load gas schedule!");
}
Some(gs) => {
let gas_feature_version = gs.feature_vesion;
let gas_feature_version = gs.feature_version;
let gas_schdule_treemap = gs.clone().to_btree_map();
let gas_params = StarcoinGasParameters::from_on_chain_gas_schedule(
&gas_schdule_treemap,
Expand Down
Loading