-
Notifications
You must be signed in to change notification settings - Fork 131
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
Questions on instruction gas cost #154
Comments
Can comment on (4), but the others do indeed seem suspicious to me. Move does charge more for global storage accesses than for local ones, but
|
I couldn't find the code for this. Do you happen to know where in code we charge for this? |
(3) The gas costs are not prescriptive in this way. They (at least originally) are supposed to be inline with the actual computational load |
I don't know offhand, but @vgao1996 might know. If not, I can dig. But there is a section of the VM that computes the right set, and my guess is it would be there |
As regards the global write charges this logic can be found here: https://github.com/diem/diem/blob/main/diem-move/diem-vm/src/diem_vm_impl.rs#L609 and here https://github.com/diem/diem/blob/main/diem-move/diem-vm/src/diem_vm.rs#L267. Note that this logic is largely based on the way Diem writes back to storage and the average size of a Diem Account blob at that time. Regarding the other questions:
|
Thanks @tnowacki and @tzakian ! Regarding 5, why do we multiply |
If I understand this correctly, it assumes |
Another question: assuming we share VM storage cache across execution sessions (or does it?), and we charge it when we try to read global resource but had a cache miss, does it make the gas cost of a transaction non-deterministic and dependent on the current cache state? |
A few questions around how we chose the gas cost for some of the instructions.
In this table:
move/language/move-vm/types/src/gas_schedule.rs
Line 293 in 0747a72
MoveTo
writes new data into the storage, whileMoveFrom
removes data from storage. However,MoveFrom
(459) is significantly more expensive thanMoveTo
(13). Why isMoveTo
so cheap? What's the rationale behind this choice? Isn'tMoveFrom
considered as data deletion and should be encouraged instead of punished?MoveFromGeneric
(13) significantly cheaper thanMoveFrom
(459)?ImmBorrowGlobal
(23) more expensive thanMutBorrowGlobal
(21)? Should mutable borrows be more expensive since we expect mutations?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?move/language/move-vm/types/src/natives/function.rs
Lines 114 to 117 in b4162e1
cc @tzakian
The text was updated successfully, but these errors were encountered: