You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some hardforks, the only thing which is changed is the gas cost of some opcodes. See for instance this part of opcodes.ts where default opcodes are overwritten, but the only change is the gas fee.
These should be read from common. I'd say we keep the fee attribute in opcodes.ts, but we set those values in getOpcodesForHF. I'm not entirely sure if we should move all "default" opcodes to Common (i.e. we put them in chainstart), or that we should keep the fee of opcodes which have not changed gas at any fork in opcodes.ts. If it has changed in the future, we remove this from opcodes.ts and for getOpcodesForHF to read the value from Common. If we do this in getOpcodesForHF this means we only call Common once, instead of doing it multiple times every time we invoke a gas cost which is constant if the fork of the VM does not change.
I also think we should do similiar things for things like the expBytegas cost, we should set these values in getOpcodesForHF to get a slight performance boost, since we don't have to keep retrieving these constants from Common.
The text was updated successfully, but these errors were encountered:
I propose we actually move the default gas costs from chainstart to Common and set the "base fee" (and related attributes such as constants like expByte) in getOpcodesForHF. I think it is natural to move these constants to Common; if a gas cost changes in the future we can simply set this constant in Common without having to tinker with the VM.
In some hardforks, the only thing which is changed is the gas cost of some opcodes. See for instance this part of opcodes.ts where default opcodes are overwritten, but the only change is the gas fee.
These should be read from common. I'd say we keep the
fee
attribute inopcodes.ts
, but we set those values ingetOpcodesForHF
. I'm not entirely sure if we should move all "default" opcodes to Common (i.e. we put them in chainstart), or that we should keep thefee
of opcodes which have not changed gas at any fork inopcodes.ts
. If it has changed in the future, we remove this fromopcodes.ts
and forgetOpcodesForHF
to read the value from Common. If we do this ingetOpcodesForHF
this means we only call Common once, instead of doing it multiple times every time we invoke a gas cost which is constant if the fork of the VM does not change.I also think we should do similiar things for things like the
expByte
gas cost, we should set these values ingetOpcodesForHF
to get a slight performance boost, since we don't have to keep retrieving these constants from Common.The text was updated successfully, but these errors were encountered: