mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-03 14:52:55 +00:00
eth/tracers: use slices.Contains (#29461)
This commit is contained in:
parent
74995bf8a1
commit
ccb76c01d7
2 changed files with 4 additions and 13 deletions
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"slices"
|
||||||
|
|
||||||
"github.com/dop251/goja"
|
"github.com/dop251/goja"
|
||||||
"github.com/ethereum/go-ethereum/core/tracing"
|
"github.com/ethereum/go-ethereum/core/tracing"
|
||||||
|
|
@ -529,13 +530,7 @@ func (t *jsTracer) setBuiltinFunctions() {
|
||||||
vm.Interrupt(err)
|
vm.Interrupt(err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
addr := common.BytesToAddress(a)
|
return slices.Contains(t.activePrecompiles, common.BytesToAddress(a))
|
||||||
for _, p := range t.activePrecompiles {
|
|
||||||
if p == addr {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
})
|
})
|
||||||
vm.Set("slice", func(slice goja.Value, start, end int64) goja.Value {
|
vm.Set("slice", func(slice goja.Value, start, end int64) goja.Value {
|
||||||
b, err := t.fromBuf(vm, slice, false)
|
b, err := t.fromBuf(vm, slice, false)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -228,12 +229,7 @@ func (t *flatCallTracer) Stop(err error) {
|
||||||
|
|
||||||
// isPrecompiled returns whether the addr is a precompile.
|
// isPrecompiled returns whether the addr is a precompile.
|
||||||
func (t *flatCallTracer) isPrecompiled(addr common.Address) bool {
|
func (t *flatCallTracer) isPrecompiled(addr common.Address) bool {
|
||||||
for _, p := range t.activePrecompiles {
|
return slices.Contains(t.activePrecompiles, addr)
|
||||||
if p == addr {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func flatFromNested(input *callFrame, traceAddress []int, convertErrs bool, ctx *tracers.Context) (output []flatCallFrame, err error) {
|
func flatFromNested(input *callFrame, traceAddress []int, convertErrs bool, ctx *tracers.Context) (output []flatCallFrame, err error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue