Skip to content

Commit

Permalink
Merge branch 'develop' into develop-tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
uprendis committed Oct 14, 2023
2 parents d05a7ec + ace95a8 commit c8590b9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Golang files:
*.go @andrecronje @integraloleg @devintegral @devintegral2 @SamuelMarks @Maxime2
*.go @andrecronje
6 changes: 5 additions & 1 deletion cmd/opera/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/console/prompt"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
gmetrics "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/discover/discfilter"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -301,7 +302,10 @@ func makeNode(ctx *cli.Context, cfg *config, genesisStore *genesisstore.Store) (
if genesisStore != nil {
_ = genesisStore.Close()
}
metrics.SetDataDir(cfg.Node.DataDir)

if gmetrics.Enabled {
metrics.SetDataDir(cfg.Node.DataDir)
}
memorizeDBPreset(cfg)

// substitute default bootnodes if requested
Expand Down
12 changes: 8 additions & 4 deletions cmd/opera/launcher/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func measureDbDir(name, datadir string) {
rescan = (len(datadir) > 0 && datadir != "inmemory")
)
for {
time.Sleep(time.Second)
time.Sleep(10 * time.Second)

if rescan {
size := sizeOfDir(datadir)
size := sizeOfDir(datadir, new(int))
atomic.StoreInt64(&dbSize, size)
}

Expand All @@ -45,8 +45,12 @@ func measureDbDir(name, datadir string) {
}
}

func sizeOfDir(dir string) (size int64) {
func sizeOfDir(dir string, counter *int) (size int64) {
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
*counter++
if *counter % 100 == 0 {
time.Sleep(100 * time.Millisecond)
}
if err != nil {
log.Debug("datadir walk", "path", path, "err", err)
return filepath.SkipDir
Expand All @@ -58,7 +62,7 @@ func sizeOfDir(dir string) (size int64) {

dst, err := filepath.EvalSymlinks(path)
if err == nil && dst != path {
size += sizeOfDir(dst)
size += sizeOfDir(dst, counter)
} else {
size += info.Size()
}
Expand Down
22 changes: 11 additions & 11 deletions cmd/opera/launcher/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,30 +182,30 @@ var (

{
Name: "Testnet-16200 without history",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(0): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
},
},
{
Name: "Testnet-16200 without MPT",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
},
},
{
Name: "Testnet-16200 with pruned MPT",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.EvmSection(0): hash.HexToHash("0xbd66dcbbe77881d5aae5091ee9c455d213cebef2cc53c0d4bb356840c7020f7b"),
},
},
Expand All @@ -215,8 +215,8 @@ var (
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.EvmSection(0): hash.HexToHash("0x9227c80bf56e4af08dc32cb6043cc43672f2be8177d550ab34a7a9f57f4f104b"),
genesisstore.EvmSection(1): hash.HexToHash("0x2376016f7ba13123244c6b56088a76e2e8bd5d5795fa92bad65f61488d12c236"),
},
Expand Down
17 changes: 17 additions & 0 deletions opera/genesis/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package genesis

import (
"fmt"
"sort"
"strings"

"github.com/Fantom-foundation/lachesis-base/hash"

"github.com/Fantom-foundation/go-opera/inter/ibr"
Expand Down Expand Up @@ -45,6 +49,19 @@ func (hh Hashes) Equal(hh2 Hashes) bool {
return hh.Includes(hh2) && hh2.Includes(hh)
}

func (hh Hashes) String() string {
bb := make([]string, 0, len(hh))
for n, h := range hh {
bb = append(bb, fmt.Sprintf("%s: %s", n, h.String()))
}
sort.Strings(bb)
return "{" + strings.Join(bb, ", ") + "}"
}

func (h Header) Equal(h2 Header) bool {
return h == h2
}

func (h Header) String() string {
return fmt.Sprintf("{%d, net:%s, id:%s}", h.NetworkID, h.NetworkName, h.GenesisID.String())
}
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func init() {
params.VersionMajor = 1 // Major version component of the current release
params.VersionMinor = 1 // Minor version component of the current release
params.VersionPatch = 3 // Patch version component of the current release
params.VersionMeta = "txtracing-rc.4" // Version metadata to append to the version string
params.VersionMeta = "txtracing-rc.5" // Version metadata to append to the version string
}

func BigToString(b *big.Int) string {
Expand Down

0 comments on commit c8590b9

Please sign in to comment.