core/vm: use uint256 in EVM implementation (#20787)
* core/vm: use fixed uint256 library instead of big * core/vm: remove intpools * core/vm: upgrade uint256, fixes uint256.NewFromBig * core/vm: use uint256.Int by value in Stack * core/vm: upgrade uint256 to v1.0.0 * core/vm: don't preallocate space for 1024 stack items (only 16) Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
// EnableEIP enables the given EIP on the config.
|
||||
@ -63,7 +64,7 @@ func enable1884(jt *JumpTable) {
|
||||
}
|
||||
|
||||
func opSelfBalance(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) {
|
||||
balance := interpreter.intPool.get().Set(interpreter.evm.StateDB.GetBalance(callContext.contract.Address()))
|
||||
balance, _ := uint256.FromBig(interpreter.evm.StateDB.GetBalance(callContext.contract.Address()))
|
||||
callContext.stack.push(balance)
|
||||
return nil, nil
|
||||
}
|
||||
@ -83,7 +84,7 @@ func enable1344(jt *JumpTable) {
|
||||
|
||||
// opChainID implements CHAINID opcode
|
||||
func opChainID(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) {
|
||||
chainId := interpreter.intPool.get().Set(interpreter.evm.chainConfig.ChainID)
|
||||
chainId, _ := uint256.FromBig(interpreter.evm.chainConfig.ChainID)
|
||||
callContext.stack.push(chainId)
|
||||
return nil, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user