-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
A few questions around how we chose the gas cost for some of the instructions.
In this table:
| pub fn bytecode_instruction_costs() -> Vec<(Bytecode, GasCost)> { |
MoveTowrites new data into the storage, whileMoveFromremoves data from storage. However,MoveFrom(459) is significantly more expensive thanMoveTo(13). Why isMoveToso cheap? What's the rationale behind this choice? Isn'tMoveFromconsidered as data deletion and should be encouraged instead of punished?- Why is
MoveFromGeneric(13) significantly cheaper thanMoveFrom(459)? - Why is
ImmBorrowGlobal(23) more expensive thanMutBorrowGlobal(21)? Should mutable borrows be more expensive since we expect mutations? - We don't seem to distinguish the cost between global storage accesses and stack memory accesses. For instance, when we compute the cost of
WriteRef, we don't really look at whether the reference is pointing to the stack or to a global storage. This makes the cost of global storage accesses (both reads and writes) way too cheap than it should be. Is this intentional? - When we compute the gas cost for a native function call (), we are first adding the computation cost and memory cost, and then multiply the sum with the memory size. Shouldn't we only multiple the memory cost with memory size? Is this a bug?
move/language/move-vm/types/src/natives/function.rs
Lines 114 to 117 in b4162e1
let gas_amt = table.native_cost(native_table_idx.into()); let memory_size = AbstractMemorySize::new(std::cmp::max(1, size) as GasCarrier); debug_assert!(memory_size.get() > 0); gas_amt.total().mul(memory_size)
cc @tzakian
msmouse
Metadata
Metadata
Assignees
Labels
No labels