mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
clean: VMInterpreter and Fix Linter (#6611)
This commit is contained in:
parent
84089f029c
commit
00c73f0c20
@ -39,6 +39,7 @@ type CallContext interface {
|
|||||||
Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, libcommon.Address, error)
|
Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, libcommon.Address, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VMInterface exposes the EVM interface for external callers.
|
||||||
type VMInterface interface {
|
type VMInterface interface {
|
||||||
Reset(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState)
|
Reset(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState)
|
||||||
Create(caller ContractRef, code []byte, gas uint64, value *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error)
|
Create(caller ContractRef, code []byte, gas uint64, value *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error)
|
||||||
@ -51,3 +52,18 @@ type VMInterface interface {
|
|||||||
IntraBlockState() evmtypes.IntraBlockState
|
IntraBlockState() evmtypes.IntraBlockState
|
||||||
TxContext() evmtypes.TxContext
|
TxContext() evmtypes.TxContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VMInterpreter exposes additional EVM methods for use in the interpreter.
|
||||||
|
type VMInterpreter interface {
|
||||||
|
VMInterface
|
||||||
|
Cancelled() bool
|
||||||
|
IncrementDepth()
|
||||||
|
DecrementDepth()
|
||||||
|
Depth() int
|
||||||
|
SetCallGasTemp(gas uint64)
|
||||||
|
CallGasTemp() uint64
|
||||||
|
StaticCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
|
||||||
|
DelegateCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
|
||||||
|
CallCode(caller ContractRef, addr libcommon.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error)
|
||||||
|
Create2(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, salt *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error)
|
||||||
|
}
|
||||||
|
@ -19,7 +19,6 @@ package vm
|
|||||||
import (
|
import (
|
||||||
"hash"
|
"hash"
|
||||||
|
|
||||||
"github.com/holiman/uint256"
|
|
||||||
"github.com/ledgerwatch/erigon-lib/chain"
|
"github.com/ledgerwatch/erigon-lib/chain"
|
||||||
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
||||||
"github.com/ledgerwatch/log/v3"
|
"github.com/ledgerwatch/log/v3"
|
||||||
@ -85,21 +84,6 @@ type EVMInterpreter struct {
|
|||||||
jt *JumpTable // EVM instruction table
|
jt *JumpTable // EVM instruction table
|
||||||
}
|
}
|
||||||
|
|
||||||
type VMInterpreter interface {
|
|
||||||
VMInterface
|
|
||||||
Cancelled() bool
|
|
||||||
IncrementDepth()
|
|
||||||
DecrementDepth()
|
|
||||||
Depth() int
|
|
||||||
SetCallGasTemp(gas uint64)
|
|
||||||
CallGasTemp() uint64
|
|
||||||
StaticCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
|
|
||||||
DelegateCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
|
|
||||||
CallCode(caller ContractRef, addr libcommon.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error)
|
|
||||||
Create(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error)
|
|
||||||
Create2(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, salt *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// structcheck doesn't see embedding
|
// structcheck doesn't see embedding
|
||||||
//
|
//
|
||||||
//nolint:structcheck
|
//nolint:structcheck
|
||||||
|
@ -99,7 +99,11 @@ func TestGenerateChain(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, _ := m.DB.BeginRo(m.Ctx)
|
tx, err := m.DB.BeginRo(m.Ctx)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("beginro error: %v\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
defer tx.Rollback()
|
defer tx.Rollback()
|
||||||
|
|
||||||
st := state.New(state.NewPlainStateReader(tx))
|
st := state.New(state.NewPlainStateReader(tx))
|
||||||
|
Loading…
Reference in New Issue
Block a user