forked from cerc-io/plugeth
Cahnges made in service of pretracer type.
This commit is contained in:
parent
4549968e8e
commit
ec965607cd
@ -185,6 +185,11 @@ func pluginReorg(commonBlock *types.Block, oldChain, newChain types.Blocks) {
|
||||
PluginReorg(plugins.DefaultPluginLoader, commonBlock, oldChain, newChain)
|
||||
}
|
||||
|
||||
type PreTracer interface {
|
||||
CapturePreStart(from common.Address, to *common.Address, input []byte, gas uint64, value *big.Int)
|
||||
|
||||
}
|
||||
|
||||
type metaTracer struct {
|
||||
tracers []core.BlockTracer
|
||||
}
|
||||
|
@ -284,6 +284,9 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
||||
// 6. caller has enough balance to cover asset transfer for **topmost** call
|
||||
|
||||
// Check clauses 1-3, buy gas if everything is correct
|
||||
if v, ok := st.evm.Config.Tracer.(PreTracer); ok {
|
||||
v.CapturePreStart(st.msg.From(), st.msg.To(), st.data, st.gas, st.msg.Value())
|
||||
}
|
||||
if err := st.preCheck(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -74,3 +74,5 @@ require (
|
||||
gotest.tools v2.2.0+incompatible // indirect
|
||||
|
||||
)
|
||||
|
||||
replace github.com/openrelayxyz/plugeth-utils v0.0.14 => ../plugeth-utils
|
||||
|
@ -73,6 +73,10 @@ type WrappedTracer struct {
|
||||
func NewWrappedTracer(r core.TracerResult) *WrappedTracer {
|
||||
return &WrappedTracer{r}
|
||||
}
|
||||
func (w WrappedTracer) CapturePreStart(from common.Address, to *common.Address, input []byte, gas uint64, value *big.Int) {
|
||||
if v, ok := w.r.(core.PreTracer); ok {
|
||||
v.CapturePreStart(core.Address(from), (*core.Address)(to), input, gas, value)}
|
||||
}
|
||||
func (w WrappedTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
|
||||
w.r.CaptureStart(core.Address(from), core.Address(to), create, input, gas, value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user