Skip to content

Commit

Permalink
remove reader/writer builder (erigontech#2386)
Browse files Browse the repository at this point in the history
* remove builder

* remove builder
  • Loading branch information
AskAlexSharov authored Jul 17, 2021
1 parent 8d320ae commit 499b5ce
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
4 changes: 3 additions & 1 deletion cmd/sentry/download/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ func (ss *SentryServerImpl) SendMessageById(_ context.Context, inreq *proto_sent
peerID := string(gointerfaces.ConvertH512ToBytes(inreq.PeerId))
x, ok := ss.GoodPeers.Load(peerID)
if !ok {
return &proto_sentry.SentPeers{}, fmt.Errorf("peer not found: %s", peerID)
//TODO: enable after support peer to sentry mapping
//return &proto_sentry.SentPeers{}, fmt.Errorf("peer not found: %s", peerID)
return &proto_sentry.SentPeers{}, nil
}
peerInfo := x.(*PeerInfo)
msgcode := eth.FromProto[ss.Protocol.Version][inreq.Data.Id]
Expand Down
4 changes: 0 additions & 4 deletions eth/stagedsync/stage_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ type HasChangeSetWriter interface {

type ChangeSetHook func(blockNum uint64, wr *state.ChangeSetWriter)

type StateReaderBuilder func(ethdb.Database) state.StateReader

type StateWriterBuilder func(db ethdb.Database, changeSetsDB ethdb.RwTx, blockNumber uint64) state.WriterWithChangeSets

type ExecuteBlockCfg struct {
db ethdb.RwKV
batchSize datasize.ByteSize
Expand Down
18 changes: 6 additions & 12 deletions eth/stagedsync/stage_tevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,20 @@ import (
var stageTranspileGauge = metrics.NewRegisteredGauge("stage/tevm", nil)

type TranspileCfg struct {
db ethdb.RwKV
batchSize datasize.ByteSize
readerBuilder StateReaderBuilder
writerBuilder StateWriterBuilder
chainConfig *params.ChainConfig
db ethdb.RwKV
batchSize datasize.ByteSize
chainConfig *params.ChainConfig
}

func StageTranspileCfg(
kv ethdb.RwKV,
batchSize datasize.ByteSize,
readerBuilder StateReaderBuilder,
writerBuilder StateWriterBuilder,
chainConfig *params.ChainConfig,
) TranspileCfg {
return TranspileCfg{
db: kv,
batchSize: batchSize,
readerBuilder: readerBuilder,
writerBuilder: writerBuilder,
chainConfig: chainConfig,
db: kv,
batchSize: batchSize,
chainConfig: chainConfig,
}
}

Expand Down
2 changes: 0 additions & 2 deletions turbo/stages/mock_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ func MockWithEverything(t *testing.T, gspec *core.Genesis, key *ecdsa.PrivateKey
stagedsync.StageTranspileCfg(
mock.DB,
cfg.BatchSize,
nil,
nil,
mock.ChainConfig,
),
stagedsync.StageSnapshotStateCfg(
Expand Down
2 changes: 0 additions & 2 deletions turbo/stages/stageloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ func NewStagedSync2(
stagedsync.StageTranspileCfg(
db,
cfg.BatchSize,
nil,
nil,
controlServer.ChainConfig,
),
stagedsync.StageSnapshotStateCfg(db, cfg.Snapshot, tmpdir, client, snapshotMigrator),
Expand Down

0 comments on commit 499b5ce

Please sign in to comment.