Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E4 metrics upd #7122

Merged
merged 9 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/integration/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ integration stage_exec --prune.to=N
integration stage_history --prune.to=N
...

# Run tx replay with domains [requires 6th stage to be done before run]
integration state_domains --chain goerli --last-step=4 # stop replay when 4th step is merged
integration read_domains --chain goerli account <addr> <addr> ... # read values for given accounts

# hack which allows to force clear unwind stack of all stages
clear_unwind_stack
```
Expand Down
4 changes: 2 additions & 2 deletions cmd/integration/commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func withWorkers(cmd *cobra.Command) {
}

func withStartTx(cmd *cobra.Command) {
cmd.Flags().Uint64Var(&startTxNum, "startTx", 0, "start processing from tx")
cmd.Flags().Uint64Var(&startTxNum, "tx", 0, "start processing from tx")
}

func withTraceFromTx(cmd *cobra.Command) {
Expand All @@ -165,5 +165,5 @@ func withTraceFromTx(cmd *cobra.Command) {
func withCommitment(cmd *cobra.Command) {
cmd.Flags().StringVar(&commitmentMode, "commitment.mode", "direct", "defines the way to calculate commitments: 'direct' mode reads from state directly, 'update' accumulate updates before commitment, 'off' actually disables commitment calculation")
cmd.Flags().StringVar(&commitmentTrie, "commitment.trie", "hex", "hex - use Hex Patricia Hashed Trie for commitments, bin - use of binary patricia trie")
cmd.Flags().IntVar(&commitmentFreq, "commitment.freq", 25000, "how many blocks to skip between calculating commitment")
cmd.Flags().IntVar(&commitmentFreq, "commitment.freq", 1000000, "how many blocks to skip between calculating commitment")
}
17 changes: 9 additions & 8 deletions cmd/integration/commands/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import (
"time"

"github.com/c2h5oh/datasize"
"github.com/ledgerwatch/log/v3"
"github.com/ledgerwatch/secp256k1"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"

chain2 "github.com/ledgerwatch/erigon-lib/chain"
"github.com/ledgerwatch/erigon-lib/commitment"
common2 "github.com/ledgerwatch/erigon-lib/common"
Expand All @@ -21,10 +26,6 @@ import (
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
"github.com/ledgerwatch/erigon-lib/kv/rawdbv3"
libstate "github.com/ledgerwatch/erigon-lib/state"
"github.com/ledgerwatch/log/v3"
"github.com/ledgerwatch/secp256k1"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"

"github.com/ledgerwatch/erigon/cmd/hack/tool/fromdb"
"github.com/ledgerwatch/erigon/cmd/sentry/sentry"
Expand Down Expand Up @@ -1239,7 +1240,7 @@ func getBlockReader(db kv.RoDB) (blockReader services.FullBlockReader) {
var openDomainsOnce sync.Once
var _aggDomainSingleton *libstate.Aggregator

func allDomains(ctx context.Context, db kv.RoDB, mode libstate.CommitmentMode, trie commitment.TrieVariant) (*snapshotsync.RoSnapshots, *libstate.Aggregator) {
func allDomains(ctx context.Context, db kv.RoDB, stepSize uint64, mode libstate.CommitmentMode, trie commitment.TrieVariant) (*snapshotsync.RoSnapshots, *libstate.Aggregator) {
openDomainsOnce.Do(func() {
var useSnapshots bool
_ = db.View(context.Background(), func(tx kv.Tx) error {
Expand All @@ -1253,7 +1254,7 @@ func allDomains(ctx context.Context, db kv.RoDB, mode libstate.CommitmentMode, t
_allSnapshotsSingleton = snapshotsync.NewRoSnapshots(snapCfg, dirs.Snap)

var err error
_aggDomainSingleton, err = libstate.NewAggregator(filepath.Join(dirs.DataDir, "state"), dirs.Tmp, ethconfig.HistoryV3AggregationStep, mode, trie)
_aggDomainSingleton, err = libstate.NewAggregator(filepath.Join(dirs.DataDir, "state"), dirs.Tmp, stepSize, mode, trie)
if err != nil {
panic(err)
}
Expand All @@ -1278,7 +1279,7 @@ func allDomains(ctx context.Context, db kv.RoDB, mode libstate.CommitmentMode, t
return _allSnapshotsSingleton, _aggDomainSingleton
}

func newDomains(ctx context.Context, db kv.RwDB, mode libstate.CommitmentMode, trie commitment.TrieVariant) (consensus.Engine, ethconfig.Config, *snapshotsync.RoSnapshots, *libstate.Aggregator) {
func newDomains(ctx context.Context, db kv.RwDB, stepSize uint64, mode libstate.CommitmentMode, trie commitment.TrieVariant) (consensus.Engine, ethconfig.Config, *snapshotsync.RoSnapshots, *libstate.Aggregator) {
historyV3, pm := kvcfg.HistoryV3.FromDB(db), fromdb.PruneMode(db)
//events := shards.NewEvents()
genesis := core.DefaultGenesisBlockByChainName(chain)
Expand Down Expand Up @@ -1310,7 +1311,7 @@ func newDomains(ctx context.Context, db kv.RwDB, mode libstate.CommitmentMode, t
//}
cfg.Dirs = datadir.New(datadirCli)

allSn, agg := allDomains(ctx, db, mode, trie)
allSn, agg := allDomains(ctx, db, stepSize, mode, trie)
cfg.Snapshot = allSn.Cfg()

engine := initConsensusEngine(chainConfig, cfg.Dirs.DataDir, db)
Expand Down
Loading