-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description: In module ChainId, determining whether the chain is dev, test, halley, proxima, barnard, and main type is not enough. The custom chain may be configured from a dev template with the main id. The wrong logic may cause an incorrect impact to VMConfig for calculating maximum_number_of_gas_units.
Code Location: sources/ChainId.move, line 45
// In ChainId.move
public fun is_dev(): bool acquires ChainId {
get() == DEV_CHAIN_ID
}
public fun is_test(): bool acquires ChainId {
get() == TEST_CHAIN_ID
}
public fun is_halley(): bool acquires ChainId {
get() == HALLEY_CHAIN_ID
}
public fun is_proxima(): bool acquires ChainId {
get() == PROXIMA_CHAIN_ID
}
public fun is_barnard(): bool acquires ChainId {
get() == BARNARD_CHAIN_ID
}
public fun is_main(): bool acquires ChainId {
get() == MAIN_CHAIN_ID
}
// In VMConfig.move
public fun gas_constants(): GasConstants {
let min_price_per_gas_unit: u64 = if (ChainId::is_test()) { 0 } else { 1 };
let maximum_number_of_gas_units: u64 = 40000000;//must less than base_block_gas_limit
if (ChainId::is_test() || ChainId::is_dev() || ChainId::is_halley()) {
maximum_number_of_gas_units = maximum_number_of_gas_units * 10
};
GasConstants {
global_memory_per_byte_cost: 4,
global_memory_per_byte_write_cost: 9,
min_transaction_gas_units: 600,
large_transaction_cutoff: 600,
instrinsic_gas_per_byte: 8,
maximum_number_of_gas_units,
min_price_per_gas_unit,
max_price_per_gas_unit: 10000,
max_transaction_size_in_bytes: 1024 * 128,
gas_unit_scaling_factor: 1,
default_account_size: 800,
}
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working