Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[typo] fix typo in stdlib v12 relate with GasSchedule.move (#3936)
* fix typo in stdlib v12 relate with GasSchedule.move

* fix typo in gas_schedule
  • Loading branch information
nkysg committed Aug 18, 2023
1 parent 52795b0 commit dd5f1b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions vm/types/src/on_chain_config/gas_schedule.rs
Expand Up @@ -15,8 +15,6 @@ use std::collections::BTreeMap;
const GAS_SCHEDULE_MODULE_NAME: &str = "GasSchedule";
pub static G_GAS_SCHEDULE_IDENTIFIER: Lazy<Identifier> =
Lazy::new(|| Identifier::new(GAS_SCHEDULE_MODULE_NAME).unwrap());
pub static G_GAS_SCHEDULE_INITIALIZE: Lazy<Identifier> =
Lazy::new(|| Identifier::new("initialize").unwrap());
pub static G_GAS_SCHEDULE_GAS_SCHEDULE: Lazy<Identifier> =
Lazy::new(|| Identifier::new("gas_schedule").unwrap());

Expand Down
1 change: 0 additions & 1 deletion vm/types/src/on_chain_config/mod.rs
Expand Up @@ -32,7 +32,6 @@ pub use self::{
native_gas_schedule_v2, native_gas_schedule_v3, native_gas_schedule_v4,
txn_gas_schedule_test, txn_gas_schedule_v1, txn_gas_schedule_v2, txn_gas_schedule_v3,
GasSchedule, G_GAS_SCHEDULE_GAS_SCHEDULE, G_GAS_SCHEDULE_IDENTIFIER,
G_GAS_SCHEDULE_INITIALIZE,
},
genesis_gas_schedule::{
instruction_table_v1, instruction_table_v2, native_table_v1, native_table_v2,
Expand Down
14 changes: 7 additions & 7 deletions vm/vm-runtime/src/starcoin_vm.rs
Expand Up @@ -179,21 +179,21 @@ impl StarcoinVM {
< StdlibVersion::Version(VMCONFIG_UPGRADE_VERSION_MARK)
{
debug!(
"stdlib version: {}, fetch vmconfig from onchain resource",
"stdlib version: {}, fetch VMConfig from onchain resource",
stdlib_version
);
let gas_cost_table = VMConfig::fetch_config(&remote_storage)?
.ok_or_else(|| format_err!("Load VMConfig fail, VMConfig resource not exist."))?
.gas_schedule;
(
Some(GasSchedule::from(&gas_cost_table)),
"gas schedule from gensis",
"gas schedule from VMConfig",
)
} else if stdlib_version >= StdlibVersion::Version(VMCONFIG_UPGRADE_VERSION_MARK)
&& stdlib_version < StdlibVersion::Version(GAS_SCHEDULE_UPGRADE_VERSION_MARK)
{
debug!(
"stdlib version: {}, fetch vmconfig from onchain module",
"stdlib version: {}, fetch VMConfig from onchain module",
stdlib_version
);
let instruction_schedule = {
Expand Down Expand Up @@ -253,11 +253,11 @@ impl StarcoinVM {
};
(
Some(GasSchedule::from(&cost_table)),
"gas schedule from vm config",
"gas schedule from VMConfig",
)
} else {
debug!(
"stdlib version: {}, fetch gas schedule from onchain module",
"stdlib version: {}, fetch schedule from onchain module GasSchedule",
stdlib_version
);
let gas_schedule = {
Expand All @@ -275,11 +275,11 @@ impl StarcoinVM {
)?
.pop()
.ok_or_else(|| {
anyhow::anyhow!("Expect 0x1::GasSchedule::initialize() return value")
anyhow::anyhow!("Expect 0x1::GasSchedule::gas_schedule() return value")
})?;
bcs_ext::from_bytes::<GasSchedule>(&data)?
};
(Some(gas_schedule), "gas schedule from gas schedule in move")
(Some(gas_schedule), "gas schedule from GasSchedule")
};
#[cfg(feature = "print_gas_info")]
match self.gas_schedule.as_ref() {
Expand Down

0 comments on commit dd5f1b8

Please sign in to comment.