mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Fix EXTCALL Order
For EXTCALL, value trails offset and length.
This commit is contained in:
parent
1a9855486f
commit
e61f11a7a3
3 changed files with 3 additions and 21 deletions
|
|
@ -736,7 +736,7 @@ func enableEOF(jt *JumpTable) {
|
||||||
constantGas: params.WarmStorageReadCostEIP2929,
|
constantGas: params.WarmStorageReadCostEIP2929,
|
||||||
minStack: minStack(3, 1),
|
minStack: minStack(3, 1),
|
||||||
maxStack: maxStack(3, 1),
|
maxStack: maxStack(3, 1),
|
||||||
memorySize: memoryExtDelegateCall,
|
memorySize: memoryExtCall,
|
||||||
}
|
}
|
||||||
jt[EXTSTATICCALL] = &operation{
|
jt[EXTSTATICCALL] = &operation{
|
||||||
execute: opExtStaticCall,
|
execute: opExtStaticCall,
|
||||||
|
|
@ -744,7 +744,7 @@ func enableEOF(jt *JumpTable) {
|
||||||
dynamicGas: makeCallVariantGasCallEIP2929(gasExtStaticCall, 0),
|
dynamicGas: makeCallVariantGasCallEIP2929(gasExtStaticCall, 0),
|
||||||
minStack: minStack(3, 1),
|
minStack: minStack(3, 1),
|
||||||
maxStack: maxStack(3, 1),
|
maxStack: maxStack(3, 1),
|
||||||
memorySize: memoryExtStaticCall,
|
memorySize: memoryExtCall,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1119,7 +1119,7 @@ func opExtCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
|
||||||
// Use all available gas
|
// Use all available gas
|
||||||
gas := interpreter.evm.callGasTemp
|
gas := interpreter.evm.callGasTemp
|
||||||
// Pop other call parameters.
|
// Pop other call parameters.
|
||||||
addr, value, inOffset, inSize := stack.pop(), stack.pop(), stack.pop(), stack.pop()
|
addr, inOffset, inSize, value := stack.pop(), stack.pop(), stack.pop(), stack.pop()
|
||||||
toAddr := common.Address(addr.Bytes20())
|
toAddr := common.Address(addr.Bytes20())
|
||||||
if addr.ByteLen() > 20 {
|
if addr.ByteLen() > 20 {
|
||||||
return nil, errors.New("address space extension")
|
return nil, errors.New("address space extension")
|
||||||
|
|
@ -1146,7 +1146,6 @@ func opExtCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
|
||||||
temp.Clear()
|
temp.Clear()
|
||||||
}
|
}
|
||||||
stack.push(&temp)
|
stack.push(&temp)
|
||||||
fmt.Println(returnGas)
|
|
||||||
scope.Contract.RefundGas(returnGas, interpreter.evm.Config.Tracer, tracing.GasChangeCallLeftOverRefunded)
|
scope.Contract.RefundGas(returnGas, interpreter.evm.Config.Tracer, tracing.GasChangeCallLeftOverRefunded)
|
||||||
|
|
||||||
interpreter.returnData = ret
|
interpreter.returnData = ret
|
||||||
|
|
|
||||||
|
|
@ -122,22 +122,6 @@ func memoryStaticCall(stack *Stack) (uint64, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func memoryExtCall(stack *Stack) (uint64, bool) {
|
func memoryExtCall(stack *Stack) (uint64, bool) {
|
||||||
x, overflow := calcMemSize64(stack.Back(2), stack.Back(3))
|
|
||||||
if overflow {
|
|
||||||
return 0, true
|
|
||||||
}
|
|
||||||
return x, false
|
|
||||||
}
|
|
||||||
|
|
||||||
func memoryExtDelegateCall(stack *Stack) (uint64, bool) {
|
|
||||||
x, overflow := calcMemSize64(stack.Back(1), stack.Back(2))
|
|
||||||
if overflow {
|
|
||||||
return 0, true
|
|
||||||
}
|
|
||||||
return x, false
|
|
||||||
}
|
|
||||||
|
|
||||||
func memoryExtStaticCall(stack *Stack) (uint64, bool) {
|
|
||||||
x, overflow := calcMemSize64(stack.Back(1), stack.Back(2))
|
x, overflow := calcMemSize64(stack.Back(1), stack.Back(2))
|
||||||
if overflow {
|
if overflow {
|
||||||
return 0, true
|
return 0, true
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ func validateControlFlow2(code []byte, section int, metadata []*FunctionMetadata
|
||||||
}
|
}
|
||||||
change := int(params.StackLimit) - jt[nextOP].maxStack + jt[nextOP].minStack
|
change := int(params.StackLimit) - jt[nextOP].maxStack + jt[nextOP].minStack
|
||||||
if have, want := nextBounds.max+change, currentBounds.max; have != want {
|
if have, want := nextBounds.max+change, currentBounds.max; have != want {
|
||||||
fmt.Println(nextPC, have, want, change)
|
|
||||||
return 0, fmt.Errorf("%w want %d as max got %d at pos %d,", ErrInvalidBackwardJump, want, have, pos)
|
return 0, fmt.Errorf("%w want %d as max got %d at pos %d,", ErrInvalidBackwardJump, want, have, pos)
|
||||||
}
|
}
|
||||||
if have, want := nextBounds.min+change, currentBounds.min; have != want {
|
if have, want := nextBounds.min+change, currentBounds.min; have != want {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue