@@ -57,8 +57,6 @@ object "EVMInterpreter" {
57
57
58
58
function validateCorrectBytecode (offset, len, gasToReturn) -> returnGas {
59
59
if len {
60
- // let firstByte := shr(mload(offset), 248)
61
- // FIXME: Check this.
62
60
let firstByte := shr (248 , mload (offset))
63
61
if eq (firstByte, 0xEF ) {
64
62
revert (0 , 0 )
@@ -147,7 +145,6 @@ object "EVMInterpreter" {
147
145
148
146
// It is the responsibility of the caller to ensure that ip >= BYTECODE_OFFSET + 32
149
147
function readIP (ip,maxAcceptablePos) -> opcode {
150
- // TODO: Why not do this at the beginning once instead of every time?
151
148
if gt (ip, maxAcceptablePos) {
152
149
revert (0 , 0 )
153
150
}
@@ -300,7 +297,6 @@ object "EVMInterpreter" {
300
297
301
298
function getIsStaticFromCallFlags () -> isStatic {
302
299
isStatic := verbatim_0i_1o ("get_global::call_flags " )
303
- // TODO: make it a constnat
304
300
isStatic := iszero (iszero (and (isStatic, 0x04 )))
305
301
}
306
302
@@ -851,7 +847,6 @@ object "EVMInterpreter" {
851
847
}
852
848
853
849
// Each evm gas is 5 zkEVM one
854
- // FIXME: change this variable to reflect real ergs : gas ratio
855
850
function GAS_DIVISOR () -> gas_div { gas_div := 5 }
856
851
function EVM_GAS_STIPEND () -> gas_stipend { gas_stipend := shl (30 , 1 ) } // 1 << 30
857
852
function OVERHEAD () -> overhead { overhead := 2000 }
@@ -988,8 +983,6 @@ object "EVMInterpreter" {
988
983
}
989
984
default {
990
985
_pushEVMFrame (gasToPass, true )
991
- // TODO Check the following comment from zkSync .sol.
992
- // We can not just pass all gas here to prevert overflow of zkEVM gas counter
993
986
success := staticcall (gasToPass, addr, add (MEM_OFFSET_INNER (), argsOffset), argsSize, 0 , 0 )
994
987
995
988
frameGasLeft := _saveReturndataAfterEVMCall (add (MEM_OFFSET_INNER (), retOffset), retSize)
@@ -1178,13 +1171,6 @@ object "EVMInterpreter" {
1178
1171
}
1179
1172
gasToPass := capGas (evmGasLeft,gasToPass)
1180
1173
1181
- // TODO: Do this
1182
- // if warmAccount(addr) {
1183
- // extraCost = GAS_WARM_ACCESS;
1184
- // } else {
1185
- // extraCost = GAS_COLD_ACCOUNT_ACCESS;
1186
- // }
1187
-
1188
1174
_pushEVMFrame (gasToPass, isStatic)
1189
1175
let success := delegatecall (
1190
1176
// We can not just pass all gas here to prevert overflow of zkEVM gas counter
@@ -1270,8 +1256,6 @@ object "EVMInterpreter" {
1270
1256
}
1271
1257
default {
1272
1258
_pushEVMFrame (_calleeGas, true )
1273
- // TODO Check the following comment from zkSync .sol.
1274
- // We can not just pass all gas here to prevert overflow of zkEVM gas counter
1275
1259
success := staticcall (EVM_GAS_STIPEND (), _callee, _inputOffset, _inputLen, 0 , 0 )
1276
1260
1277
1261
_gasLeft := _saveReturndataAfterEVMCall (_outputOffset, _outputLen)
@@ -2033,11 +2017,6 @@ object "EVMInterpreter" {
2033
2017
evmGasLeft := chargeGas (evmGasLeft, 2500 )
2034
2018
}
2035
2019
2036
- // TODO: check, the .sol uses extcodesize directly, but it doesnt seem to work
2037
- // if a contract is created it works, but if the address is a zkSync's contract
2038
- // what happens?
2039
- // sp := pushStackItem(sp, extcodesize(addr), evmGasLeft)
2040
-
2041
2020
switch _isEVM (addr)
2042
2021
case 0 { sp := pushStackItemWithoutCheck (sp, extcodesize (addr)) }
2043
2022
default { sp := pushStackItemWithoutCheck (sp, _fetchDeployedCodeLen (addr)) }
@@ -2063,9 +2042,6 @@ object "EVMInterpreter" {
2063
2042
offset, sp := popStackItemWithoutCheck (sp)
2064
2043
len, sp := popStackItemWithoutCheck (sp)
2065
2044
2066
- // TODO: check if these conditions are met
2067
- // The addition offset + size overflows.
2068
- // offset + size is larger than RETURNDATASIZE.
2069
2045
checkOverflow (offset,len, evmGasLeft)
2070
2046
if gt (add (offset, len), mload (LAST_RETURNDATA_SIZE_OFFSET ())) {
2071
2047
revertWithGas (evmGasLeft)
@@ -3135,7 +3111,6 @@ object "EVMInterpreter" {
3135
3111
3136
3112
// It is the responsibility of the caller to ensure that ip >= BYTECODE_OFFSET + 32
3137
3113
function readIP (ip,maxAcceptablePos) -> opcode {
3138
- // TODO: Why not do this at the beginning once instead of every time?
3139
3114
if gt (ip, maxAcceptablePos) {
3140
3115
revert (0 , 0 )
3141
3116
}
@@ -3288,7 +3263,6 @@ object "EVMInterpreter" {
3288
3263
3289
3264
function getIsStaticFromCallFlags () -> isStatic {
3290
3265
isStatic := verbatim_0i_1o ("get_global::call_flags " )
3291
- // TODO: make it a constnat
3292
3266
isStatic := iszero (iszero (and (isStatic, 0x04 )))
3293
3267
}
3294
3268
@@ -3839,7 +3813,6 @@ object "EVMInterpreter" {
3839
3813
}
3840
3814
3841
3815
// Each evm gas is 5 zkEVM one
3842
- // FIXME: change this variable to reflect real ergs : gas ratio
3843
3816
function GAS_DIVISOR () -> gas_div { gas_div := 5 }
3844
3817
function EVM_GAS_STIPEND () -> gas_stipend { gas_stipend := shl (30 , 1 ) } // 1 << 30
3845
3818
function OVERHEAD () -> overhead { overhead := 2000 }
@@ -3976,8 +3949,6 @@ object "EVMInterpreter" {
3976
3949
}
3977
3950
default {
3978
3951
_pushEVMFrame (gasToPass, true )
3979
- // TODO Check the following comment from zkSync .sol.
3980
- // We can not just pass all gas here to prevert overflow of zkEVM gas counter
3981
3952
success := staticcall (gasToPass, addr, add (MEM_OFFSET_INNER (), argsOffset), argsSize, 0 , 0 )
3982
3953
3983
3954
frameGasLeft := _saveReturndataAfterEVMCall (add (MEM_OFFSET_INNER (), retOffset), retSize)
@@ -4166,13 +4137,6 @@ object "EVMInterpreter" {
4166
4137
}
4167
4138
gasToPass := capGas (evmGasLeft,gasToPass)
4168
4139
4169
- // TODO: Do this
4170
- // if warmAccount(addr) {
4171
- // extraCost = GAS_WARM_ACCESS;
4172
- // } else {
4173
- // extraCost = GAS_COLD_ACCOUNT_ACCESS;
4174
- // }
4175
-
4176
4140
_pushEVMFrame (gasToPass, isStatic)
4177
4141
let success := delegatecall (
4178
4142
// We can not just pass all gas here to prevert overflow of zkEVM gas counter
@@ -4258,8 +4222,6 @@ object "EVMInterpreter" {
4258
4222
}
4259
4223
default {
4260
4224
_pushEVMFrame (_calleeGas, true )
4261
- // TODO Check the following comment from zkSync .sol.
4262
- // We can not just pass all gas here to prevert overflow of zkEVM gas counter
4263
4225
success := staticcall (EVM_GAS_STIPEND (), _callee, _inputOffset, _inputLen, 0 , 0 )
4264
4226
4265
4227
_gasLeft := _saveReturndataAfterEVMCall (_outputOffset, _outputLen)
@@ -5021,11 +4983,6 @@ object "EVMInterpreter" {
5021
4983
evmGasLeft := chargeGas (evmGasLeft, 2500 )
5022
4984
}
5023
4985
5024
- // TODO: check, the .sol uses extcodesize directly, but it doesnt seem to work
5025
- // if a contract is created it works, but if the address is a zkSync's contract
5026
- // what happens?
5027
- // sp := pushStackItem(sp, extcodesize(addr), evmGasLeft)
5028
-
5029
4986
switch _isEVM (addr)
5030
4987
case 0 { sp := pushStackItemWithoutCheck (sp, extcodesize (addr)) }
5031
4988
default { sp := pushStackItemWithoutCheck (sp, _fetchDeployedCodeLen (addr)) }
@@ -5051,9 +5008,6 @@ object "EVMInterpreter" {
5051
5008
offset, sp := popStackItemWithoutCheck (sp)
5052
5009
len, sp := popStackItemWithoutCheck (sp)
5053
5010
5054
- // TODO: check if these conditions are met
5055
- // The addition offset + size overflows.
5056
- // offset + size is larger than RETURNDATASIZE.
5057
5011
checkOverflow (offset,len, evmGasLeft)
5058
5012
if gt (add (offset, len), mload (LAST_RETURNDATA_SIZE_OFFSET ())) {
5059
5013
revertWithGas (evmGasLeft)
0 commit comments