Skip to content

Commit

Permalink
Remove invalid todos
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Aug 28, 2024
1 parent 5cdc5dd commit 4d3a88f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
10 changes: 2 additions & 8 deletions system-contracts/contracts/EvmInterpreterLoop.template.yul
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ for { } true { } {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

checkMultipleOverflow(offset,size,MEM_OFFSET_INNER(), evmGasLeft)
checkMultipleOverflow(destOffset,size,MEM_OFFSET_INNER(), evmGasLeft)

// TODO invalid?
if or(gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM()), gt(add(add(destOffset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM())) {
$llvm_AlwaysInline_llvm$_memsetToZero(add(destOffset, MEM_OFFSET_INNER()), size)
}
Expand Down Expand Up @@ -812,7 +808,6 @@ for { } true { } {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO overflow checks
checkMemOverflowByOffset(add(offset, size), evmGasLeft)
checkMemOverflowByOffset(add(destOffset, size), evmGasLeft)

Expand Down Expand Up @@ -1444,11 +1439,10 @@ for { } true { } {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO invalid?
ensureAcceptableMemLocation(offset)
ensureAcceptableMemLocation(size)
checkOverflow(offset,size, evmGasLeft)
evmGasLeft := chargeGas(evmGasLeft,expandMemory(add(offset,size)))

checkOverflow(offset,MEM_OFFSET_INNER(), evmGasLeft)
offset := add(offset, MEM_OFFSET_INNER())
offset,size := addGasIfEvmRevert(isCallerEVM,offset,size,evmGasLeft)

Expand Down
20 changes: 4 additions & 16 deletions system-contracts/contracts/EvmInterpreterPreprocessed.yul
Original file line number Diff line number Diff line change
Expand Up @@ -1947,10 +1947,6 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

checkMultipleOverflow(offset,size,MEM_OFFSET_INNER(), evmGasLeft)
checkMultipleOverflow(destOffset,size,MEM_OFFSET_INNER(), evmGasLeft)

// TODO invalid?
if or(gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM()), gt(add(add(destOffset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM())) {
$llvm_AlwaysInline_llvm$_memsetToZero(add(destOffset, MEM_OFFSET_INNER()), size)
}
Expand Down Expand Up @@ -2349,7 +2345,6 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO overflow checks
checkMemOverflowByOffset(add(offset, size), evmGasLeft)
checkMemOverflowByOffset(add(destOffset, size), evmGasLeft)

Expand Down Expand Up @@ -2981,11 +2976,10 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO invalid?
ensureAcceptableMemLocation(offset)
ensureAcceptableMemLocation(size)
checkOverflow(offset,size, evmGasLeft)
evmGasLeft := chargeGas(evmGasLeft,expandMemory(add(offset,size)))

checkOverflow(offset,MEM_OFFSET_INNER(), evmGasLeft)
offset := add(offset, MEM_OFFSET_INNER())
offset,size := addGasIfEvmRevert(isCallerEVM,offset,size,evmGasLeft)

Expand Down Expand Up @@ -4913,10 +4907,6 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

checkMultipleOverflow(offset,size,MEM_OFFSET_INNER(), evmGasLeft)
checkMultipleOverflow(destOffset,size,MEM_OFFSET_INNER(), evmGasLeft)

// TODO invalid?
if or(gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM()), gt(add(add(destOffset, size), MEM_OFFSET_INNER()), MAX_POSSIBLE_MEM())) {
$llvm_AlwaysInline_llvm$_memsetToZero(add(destOffset, MEM_OFFSET_INNER()), size)
}
Expand Down Expand Up @@ -5315,7 +5305,6 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO overflow checks
checkMemOverflowByOffset(add(offset, size), evmGasLeft)
checkMemOverflowByOffset(add(destOffset, size), evmGasLeft)

Expand Down Expand Up @@ -5947,11 +5936,10 @@ object "EVMInterpreter" {
offset, sp := popStackItemWithoutCheck(sp)
size, sp := popStackItemWithoutCheck(sp)

// TODO invalid?
ensureAcceptableMemLocation(offset)
ensureAcceptableMemLocation(size)
checkOverflow(offset,size, evmGasLeft)
evmGasLeft := chargeGas(evmGasLeft,expandMemory(add(offset,size)))

checkOverflow(offset,MEM_OFFSET_INNER(), evmGasLeft)
offset := add(offset, MEM_OFFSET_INNER())
offset,size := addGasIfEvmRevert(isCallerEVM,offset,size,evmGasLeft)

Expand Down

0 comments on commit 4d3a88f

Please sign in to comment.