core/vm: fix opDataCopy

This commit is contained in:
Marius van der Wijden 2024-06-28 14:22:05 +02:00
parent 218c887878
commit 80da4fd2bb
3 changed files with 7 additions and 3 deletions

View file

@ -693,7 +693,7 @@ func enableEOF(jt *JumpTable) {
dynamicGas: memoryCopierGas(2), dynamicGas: memoryCopierGas(2),
minStack: minStack(3, 0), minStack: minStack(3, 0),
maxStack: maxStack(3, 0), maxStack: maxStack(3, 0),
memorySize: memoryMcopy, memorySize: memoryDataCopy,
} }
jt[DUPN] = &operation{ jt[DUPN] = &operation{
execute: opDupN, execute: opDupN,

View file

@ -586,7 +586,7 @@ func gasEOFCreate(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memor
if err != nil { if err != nil {
return 0, err return 0, err
} }
size, overflow := stack.Back(2).Uint64WithOverflow() size, overflow := stack.Back(3).Uint64WithOverflow()
if overflow { if overflow {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }

View file

@ -56,6 +56,10 @@ func memoryMcopy(stack *Stack) (uint64, bool) {
return calcMemSize64(mStart, stack.Back(2)) // stack[2]: length return calcMemSize64(mStart, stack.Back(2)) // stack[2]: length
} }
func memoryDataCopy(stack *Stack) (uint64, bool) {
return calcMemSize64(stack.Back(0), stack.Back(2))
}
func memoryCreate(stack *Stack) (uint64, bool) { func memoryCreate(stack *Stack) (uint64, bool) {
return calcMemSize64(stack.Back(1), stack.Back(2)) return calcMemSize64(stack.Back(1), stack.Back(2))
} }
@ -65,7 +69,7 @@ func memoryCreate2(stack *Stack) (uint64, bool) {
} }
func memoryEOFCreate(stack *Stack) (uint64, bool) { func memoryEOFCreate(stack *Stack) (uint64, bool) {
return calcMemSize64(stack.Back(1), stack.Back(2)) return calcMemSize64(stack.Back(2), stack.Back(3))
} }
func memoryReturnContract(stack *Stack) (uint64, bool) { func memoryReturnContract(stack *Stack) (uint64, bool) {