mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-04 12:11:17 +00:00
parent
44bd05a732
commit
ba2d72e8d8
3 changed files with 24 additions and 444 deletions
File diff suppressed because one or more lines are too long
|
|
@ -14,8 +14,10 @@
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//go:generate go run github.com/kevinburke/go-bindata/go-bindata -nometadata -o assets.go -pkg tracers -ignore tracers.go -ignore assets.go ./...
|
|
||||||
//go:generate gofmt -s -w assets.go
|
|
||||||
|
|
||||||
// Package tracers contains the actual JavaScript tracer assets.
|
// Package tracers contains the actual JavaScript tracer assets.
|
||||||
package tracers
|
package tracers
|
||||||
|
|
||||||
|
import "embed"
|
||||||
|
|
||||||
|
//go:embed *.js
|
||||||
|
var FS embed.FS
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -51,9 +52,23 @@ var assetTracers = make(map[string]string)
|
||||||
|
|
||||||
// init retrieves the JavaScript transaction tracers included in go-ethereum.
|
// init retrieves the JavaScript transaction tracers included in go-ethereum.
|
||||||
func init() {
|
func init() {
|
||||||
for _, file := range tracers.AssetNames() {
|
err := fs.WalkDir(tracers.FS, ".", func(path string, d fs.DirEntry, err error) error {
|
||||||
name := camel(strings.TrimSuffix(file, ".js"))
|
if err != nil {
|
||||||
assetTracers[name] = string(tracers.MustAsset(file))
|
return err
|
||||||
|
}
|
||||||
|
if d.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
b, err := fs.ReadFile(tracers.FS, path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
name := camel(strings.TrimSuffix(path, ".js"))
|
||||||
|
assetTracers[name] = string(b)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
tracers2.RegisterLookup(true, newJsTracer)
|
tracers2.RegisterLookup(true, newJsTracer)
|
||||||
}
|
}
|
||||||
|
|
@ -685,7 +700,7 @@ func (jst *jsTracer) CaptureTxStart(gasLimit uint64) {
|
||||||
jst.gasLimit = gasLimit
|
jst.gasLimit = gasLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
// CaptureTxStart implements the Tracer interface and is invoked at the end of
|
// CaptureTxEnd implements the Tracer interface and is invoked at the end of
|
||||||
// transaction processing.
|
// transaction processing.
|
||||||
func (*jsTracer) CaptureTxEnd(restGas uint64) {}
|
func (*jsTracer) CaptureTxEnd(restGas uint64) {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue