mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
flag --txpool.v2 to enable --state.stream flag (#2718)
This commit is contained in:
parent
787ec652a0
commit
0b776eead4
@ -180,7 +180,7 @@ Erigon uses a rearchitected full sync algorithm from
|
||||
It uses the same network primitives and is compatible with regular go-ethereum nodes that are using full sync, you do
|
||||
not need any special sync capabilities for Erigon to sync.
|
||||
|
||||
When reimagining the full sync, we focused on batching data together and minimize DB overwrites. That makes it possible
|
||||
When reimagining the full sync, with focus on batching data together and minimize DB overwrites. That makes it possible
|
||||
to sync Ethereum mainnet in under 2 days if you have a fast enough network connection and an SSD drive.
|
||||
|
||||
Examples of stages are:
|
||||
|
@ -6,7 +6,7 @@ Has 2 modes: internal and external
|
||||
|
||||
## Internal mode
|
||||
|
||||
Works inside Erigon: add `--state.stream --txpool.v2` flags to Erigon, and `--txpool.v2` flag to RPCDaemon
|
||||
Works inside Erigon: add `--txpool.v2` flags to Erigon, and `--txpool.v2` flag to RPCDaemon
|
||||
|
||||
## External mode
|
||||
|
||||
@ -45,10 +45,10 @@ Will add this part soon [tbd]
|
||||
[] Add cli options to manage pool limits
|
||||
[] Add way for simple introspection - where is tx and why
|
||||
[x] DiscardReasons - user must understand clearly why tx were rejected
|
||||
[] Notify about new pending transactions - we sending more than need
|
||||
[x] Notify about new pending transactions - we sending more than need
|
||||
[] Hard-forks support (now rules are parsed ones on txPool start)
|
||||
[] Add pool to docker-compose
|
||||
[] Add pool (db table) - where store recently mined txs - for faster unwind/reorg.
|
||||
[] Save history of local transactions - with 1 day expiration
|
||||
[] Miner - recheck if miner has all EIP-1559 patches
|
||||
[] Miner - to work on state cache
|
||||
[] Remote Miner - to work on state cache
|
||||
|
@ -479,36 +479,38 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
|
||||
|
||||
// start pool on non-mainnet immediately
|
||||
if backend.chainConfig.ChainID.Uint64() != params.MainnetChainConfig.ChainID.Uint64() && !backend.config.TxPool.Disable {
|
||||
var execution uint64
|
||||
var hh *types.Header
|
||||
if err := chainKv.View(ctx, func(tx kv.Tx) error {
|
||||
execution, _ := stages.GetStageProgress(tx, stages.Execution)
|
||||
hh := rawdb.ReadCurrentHeader(tx)
|
||||
tx.Rollback()
|
||||
if hh == nil {
|
||||
return nil
|
||||
}
|
||||
if backend.config.TxPool.V2 {
|
||||
if err := backend.txPool2DB.View(context.Background(), func(tx kv.Tx) error {
|
||||
var baseFee uint64
|
||||
if hh.BaseFee != nil {
|
||||
baseFee = hh.BaseFee.Uint64()
|
||||
}
|
||||
return backend.txPool2.OnNewBlock(context.Background(), &remote.StateChangeBatch{
|
||||
DatabaseViewID: tx.ViewID(), ChangeBatch: []*remote.StateChange{
|
||||
{BlockHeight: hh.Number.Uint64(), BlockHash: gointerfaces.ConvertHashToH256(hh.Hash()), ProtocolBaseFee: baseFee},
|
||||
},
|
||||
}, txpool2.TxSlots{}, txpool2.TxSlots{}, tx)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := backend.txPool.Start(hh.GasLimit, execution); err != nil {
|
||||
return err
|
||||
}
|
||||
execution, err = stages.GetStageProgress(tx, stages.Execution)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hh = rawdb.ReadCurrentHeader(tx)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if backend.config.TxPool.V2 {
|
||||
if err := backend.txPool2DB.View(context.Background(), func(tx kv.Tx) error {
|
||||
var baseFee uint64
|
||||
if hh.BaseFee != nil {
|
||||
baseFee = hh.BaseFee.Uint64()
|
||||
}
|
||||
return backend.txPool2.OnNewBlock(context.Background(), &remote.StateChangeBatch{
|
||||
DatabaseViewID: tx.ViewID(), ChangeBatch: []*remote.StateChange{
|
||||
{BlockHeight: hh.Number.Uint64(), BlockHash: gointerfaces.ConvertHashToH256(hh.Hash()), ProtocolBaseFee: baseFee},
|
||||
},
|
||||
}, txpool2.TxSlots{}, txpool2.TxSlots{}, tx)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
if err := backend.txPool.Start(hh.GasLimit, execution); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
go func() {
|
||||
|
2
go.mod
2
go.mod
@ -36,7 +36,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.11
|
||||
github.com/julienschmidt/httprouter v1.3.0
|
||||
github.com/kevinburke/go-bindata v3.21.0+incompatible
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210921092930-bf7f69fb0cbb
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210922080429-58ed1c72e16e
|
||||
github.com/ledgerwatch/log/v3 v3.3.1
|
||||
github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d
|
||||
github.com/logrusorgru/aurora/v3 v3.0.0
|
||||
|
4
go.sum
4
go.sum
@ -493,8 +493,8 @@ github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3P
|
||||
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
|
||||
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210921092930-bf7f69fb0cbb h1:AYB/WGNTkMvY3YNZCV7U0pqIeI65AS7XHXxR6eMRZuo=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210921092930-bf7f69fb0cbb/go.mod h1:WgyjBACSDhgfepaaDJIbzd2TV868EjOrp2ILnEMKspY=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210922080429-58ed1c72e16e h1:szu+TNE3OxZazhRA+LC/naHQ8xeeAh0ISymx1deoWd8=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20210922080429-58ed1c72e16e/go.mod h1:WgyjBACSDhgfepaaDJIbzd2TV868EjOrp2ILnEMKspY=
|
||||
github.com/ledgerwatch/log/v3 v3.3.1 h1:HmvLeTEvtCtqSvtu4t/a5MAdcLfeBcbIeowXbLYuzLc=
|
||||
github.com/ledgerwatch/log/v3 v3.3.1/go.mod h1:S3VJqhhVX32rbp1JyyvhJou12twtFwNEPESBgpbNkRk=
|
||||
github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d h1:/IKMrJdfRsoYNc36PXqP4xMH3vhW/8IQyBKGQbKZUno=
|
||||
|
@ -199,7 +199,7 @@ func ApplyFlagsForEthConfig(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||
}
|
||||
|
||||
cfg.ExternalSnapshotDownloaderAddr = ctx.GlobalString(ExternalSnapshotDownloaderAddrFlag.Name)
|
||||
cfg.StateStream = ctx.GlobalBool(StateStreamFlag.Name)
|
||||
cfg.StateStream = cfg.TxPool.V2 || ctx.GlobalBool(StateStreamFlag.Name)
|
||||
cfg.BlockDownloaderWindow = ctx.GlobalInt(BlockDownloaderWindowFlag.Name)
|
||||
|
||||
if ctx.GlobalString(SyncLoopThrottleFlag.Name) != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user