[erigon2] Separate handover timing (#3736)

* Separate handover timing

* Update

* Corrected handover time calculation

* Not use compression when aggregate

* Update to latest erigon-lib

* Update to erigon-lib main

* Update

* Disable reproducible builds

* Restore github actions

* Restore github actions

* Revert "linter to support go 1.18 (#3739)"

This reverts commit 1fd434d3d1.

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2022-03-19 16:15:12 +00:00 committed by GitHub
parent 1fd434d3d1
commit d5fb8f7d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 54 deletions

View File

@ -20,7 +20,7 @@ jobs:
- run: git submodule update --init --recursive --force
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.17.x
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
@ -44,7 +44,7 @@ jobs:
if: matrix.os == 'ubuntu-20.04'
uses: golangci/golangci-lint-action@v3
with:
version: v1.45
version: v1.44
skip-pkg-cache: true
skip-build-cache: true
- run: make test
@ -60,7 +60,7 @@ jobs:
- run: git submodule update --init --recursive --force
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.17.x
- run: choco upgrade mingw cmake -y --no-progress
- name: Build
run: |

View File

@ -97,7 +97,7 @@ lintci:
lintci-deps:
rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.45.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.44.2
clean:
go clean -cache

View File

@ -290,53 +290,55 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
}
log.Info("if you run RPCDaemon on same machine with Erigon add --datadir option")
}
var cc *params.ChainConfig
if err := db.View(context.Background(), func(tx kv.Tx) error {
genesisBlock, err := rawdb.ReadBlockByNumber(tx, 0)
if err != nil {
return err
}
cc, err = rawdb.ReadChainConfig(tx, genesisBlock.Hash())
if err != nil {
return err
}
return nil
}); err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, ff, err
}
if cc == nil {
return nil, nil, nil, nil, nil, nil, nil, nil, ff, fmt.Errorf("chain config not found in db. Need start erigon at least once on this db")
}
// if chain config has terminal total difficulty then rpc has to have these API's to function
if cc.TerminalTotalDifficulty != nil {
hasEthApiEnabled := false
hasEngineApiEnabled := false
hasNetApiEnabled := false
for _, api := range cfg.API {
switch api {
case "eth":
hasEthApiEnabled = true
case "engine":
hasEngineApiEnabled = true
case "net":
hasNetApiEnabled = true
if db != nil {
var cc *params.ChainConfig
if err := db.View(context.Background(), func(tx kv.Tx) error {
genesisBlock, err := rawdb.ReadBlockByNumber(tx, 0)
if err != nil {
return err
}
cc, err = rawdb.ReadChainConfig(tx, genesisBlock.Hash())
if err != nil {
return err
}
return nil
}); err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, ff, err
}
if cc == nil {
return nil, nil, nil, nil, nil, nil, nil, nil, ff, fmt.Errorf("chain config not found in db. Need start erigon at least once on this db")
}
if !hasEthApiEnabled {
cfg.API = append(cfg.API, "eth")
}
// if chain config has terminal total difficulty then rpc has to have these API's to function
if cc.TerminalTotalDifficulty != nil {
hasEthApiEnabled := false
hasEngineApiEnabled := false
hasNetApiEnabled := false
if !hasEngineApiEnabled {
cfg.API = append(cfg.API, "engine")
}
for _, api := range cfg.API {
switch api {
case "eth":
hasEthApiEnabled = true
case "engine":
hasEngineApiEnabled = true
case "net":
hasNetApiEnabled = true
}
}
if !hasNetApiEnabled {
cfg.API = append(cfg.API, "net")
}
if !hasEthApiEnabled {
cfg.API = append(cfg.API, "eth")
}
if !hasEngineApiEnabled {
cfg.API = append(cfg.API, "engine")
}
if !hasNetApiEnabled {
cfg.API = append(cfg.API, "net")
}
}
}
var onNewSnapshot func()

4
go.mod
View File

@ -40,7 +40,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/julienschmidt/httprouter v1.3.0
github.com/kevinburke/go-bindata v3.21.0+incompatible
github.com/ledgerwatch/erigon-lib v0.0.0-20220318160957-ff3e07454922
github.com/ledgerwatch/erigon-lib v0.0.0-20220319123703-71751426bcd5
github.com/ledgerwatch/log/v3 v3.4.1
github.com/ledgerwatch/secp256k1 v1.0.0
github.com/magiconair/properties v1.8.6 // indirect
@ -57,7 +57,7 @@ require (
github.com/tendermint/go-amino v0.14.1
github.com/tendermint/iavl v0.12.0
github.com/tendermint/tendermint v0.31.11
github.com/torquem-ch/mdbx-go v0.22.16
github.com/torquem-ch/mdbx-go v0.22.18
github.com/ugorji/go/codec v1.1.13
github.com/ugorji/go/codec/codecgen v1.1.13
github.com/urfave/cli v1.22.5

8
go.sum
View File

@ -615,8 +615,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-20220318160957-ff3e07454922 h1:/WBa+VtOWt8pfc0jTD2LpV65PM6X4/oBi0d+hnkDCTI=
github.com/ledgerwatch/erigon-lib v0.0.0-20220318160957-ff3e07454922/go.mod h1:DOOU7AueOIleumnEzs21bwDaOMu5lJAzZtuxBoTrgm4=
github.com/ledgerwatch/erigon-lib v0.0.0-20220319123703-71751426bcd5 h1:KGM2yXLg6LvGMw/gkr99o8Xkw7zRN9AhiQRe978h9hY=
github.com/ledgerwatch/erigon-lib v0.0.0-20220319123703-71751426bcd5/go.mod h1:1Ao0yXNx7956h1fm/3A8AOB2pzckvlpBvxdYvJNfgl8=
github.com/ledgerwatch/log/v3 v3.4.1 h1:/xGwlVulXnsO9Uq+tzaExc8OWmXXHU0dnLalpbnY5Bc=
github.com/ledgerwatch/log/v3 v3.4.1/go.mod h1:VXcz6Ssn6XEeU92dCMc39/g1F0OYAjw1Mt+dGP5DjXY=
github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ=
@ -991,8 +991,8 @@ github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ
github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/torquem-ch/mdbx-go v0.22.16 h1:uSuQOAKSZC7TvV4N4km+6kyER2YxaOuL/0qybsQtlUY=
github.com/torquem-ch/mdbx-go v0.22.16/go.mod h1:T2fsoJDVppxfAPTLd1svUgH1kpPmeXdPESmroSHcL1E=
github.com/torquem-ch/mdbx-go v0.22.18 h1:n6iNeKMtLBiEYPaKO4Ok/L7uwftExz7xOcmIZsLqQnM=
github.com/torquem-ch/mdbx-go v0.22.18/go.mod h1:T2fsoJDVppxfAPTLd1svUgH1kpPmeXdPESmroSHcL1E=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
github.com/ugorji/go v1.1.13 h1:nB3O5kBSQGjEQAcfe1aLUYuxmXdFKmYgBZhY32rQb6Q=

View File

@ -1077,7 +1077,7 @@ func DumpTxs(ctx context.Context, db kv.RoDB, segmentFile, tmpDir string, blockF
}
valueBuf = valueBuf[:0]
valueBuf = append(valueBuf, slot.IdHash[:1]...)
valueBuf = append(valueBuf, slot.IDHash[:1]...)
valueBuf = append(valueBuf, sender[:]...)
valueBuf = append(valueBuf, v...)
return valueBuf, nil
@ -1411,8 +1411,8 @@ RETRY:
txsCh2 <- txHashWithOffet{err: it.err}
return
}
txsCh <- txHashWithOffet{txnHash: slot.IdHash, i: it.i, offset: it.offset}
txsCh2 <- txHashWithOffet{txnHash: slot.IdHash, i: it.i, offset: it.offset}
txsCh <- txHashWithOffet{txnHash: slot.IDHash, i: it.i, offset: it.offset}
txsCh2 <- txHashWithOffet{txnHash: slot.IDHash, i: it.i, offset: it.offset}
}
}()