diff --git a/core/types/l2trace.go b/core/types/l2trace.go index 35f3f39e0d..236e441fa4 100644 --- a/core/types/l2trace.go +++ b/core/types/l2trace.go @@ -25,6 +25,8 @@ var ( // BlockTrace contains block execution traces and results required for rollers. type BlockTrace struct { + ChainID uint64 `json:"chainID"` + Version string `json:"version"` Coinbase *AccountWrapper `json:"coinbase"` Header *Header `json:"header"` Transactions []*TransactionData `json:"transactions"` diff --git a/eth/tracers/api_blocktrace.go b/eth/tracers/api_blocktrace.go index c01d4acd63..12a443f196 100644 --- a/eth/tracers/api_blocktrace.go +++ b/eth/tracers/api_blocktrace.go @@ -14,6 +14,7 @@ import ( "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/core/vm" "github.com/scroll-tech/go-ethereum/log" + "github.com/scroll-tech/go-ethereum/params" "github.com/scroll-tech/go-ethereum/rollup/rcfg" "github.com/scroll-tech/go-ethereum/rollup/withdrawtrie" "github.com/scroll-tech/go-ethereum/rpc" @@ -357,6 +358,8 @@ func (api *API) fillBlockTrace(env *traceEnv, block *types.Block) (*types.BlockT } blockTrace := &types.BlockTrace{ + ChainID: api.backend.ChainConfig().ChainID.Uint64(), + Version: params.ArchiveVersion(params.CommitHash), Coinbase: &types.AccountWrapper{ Address: env.coinbase, Nonce: statedb.GetNonce(env.coinbase), diff --git a/params/version.go b/params/version.go index 4a5b9835fd..7c620b39fd 100644 --- a/params/version.go +++ b/params/version.go @@ -18,13 +18,14 @@ package params import ( "fmt" + "runtime/debug" ) const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 10 // Minor version component of the current release - VersionPatch = 13 // Patch version component of the current release - VersionMeta = "stable" // Version metadata to append to the version string + VersionMajor = 0 // Major version component of the current release + VersionMinor = 1 // Minor version component of the current release + VersionPatch = 9 // Patch version component of the current release + VersionMeta = "alpha" // Version metadata to append to the version string ) // Version holds the textual version string. @@ -43,7 +44,8 @@ var VersionWithMeta = func() string { // ArchiveVersion holds the textual version string used for Geth archives. // e.g. "1.8.11-dea1ce05" for stable releases, or -// "1.8.13-unstable-21c059b6" for unstable releases +// +// "1.8.13-unstable-21c059b6" for unstable releases func ArchiveVersion(gitCommit string) string { vsn := Version if VersionMeta != "stable" { @@ -65,3 +67,14 @@ func VersionWithCommit(gitCommit, gitDate string) string { } return vsn } + +var CommitHash = func() string { + if info, ok := debug.ReadBuildInfo(); ok { + for _, setting := range info.Settings { + if setting.Key == "vcs.revision" { + return setting.Value + } + } + } + return "" +}()