Skip to content

Commit

Permalink
Add blockGasLimit to the state stream (erigontech#3321)
Browse files Browse the repository at this point in the history
* Add blockGasLimit to the state stream

* Send block gas limit

* Switch to new erigon-lib

* Update

* Update txpool - safe operations

* Update erigon-lib

* Txpool working

* Update

* Update

* Update

* Fix lint

* fix lint

Co-authored-by: Alex Sharp <[email protected]>
Co-authored-by: Alexey Sharp <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2022
1 parent 4742e58 commit 0bb6478
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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-20220125082059-82667bf609b6
github.com/ledgerwatch/erigon-lib v0.0.0-20220125102011-df95313a3132
github.com/ledgerwatch/log/v3 v3.4.0
github.com/ledgerwatch/secp256k1 v1.0.0
github.com/logrusorgru/aurora/v3 v3.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,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-20220125082059-82667bf609b6 h1:LFZmsFsSIWr00+QFkuopE/3XB6jS3tuGOfL/p4v1RlI=
github.com/ledgerwatch/erigon-lib v0.0.0-20220125082059-82667bf609b6/go.mod h1:BQNYmN6i8RdHqedsztAj3XDnswYebacmFAnsznlisTc=
github.com/ledgerwatch/erigon-lib v0.0.0-20220125102011-df95313a3132 h1:Cp45DGaH+6lvy33G4wCdtHAa/1FeA3WLxhW649pcbLk=
github.com/ledgerwatch/erigon-lib v0.0.0-20220125102011-df95313a3132/go.mod h1:BQNYmN6i8RdHqedsztAj3XDnswYebacmFAnsznlisTc=
github.com/ledgerwatch/log/v3 v3.4.0 h1:SEIOcv5a2zkG3PmoT5jeTU9m/0nEUv0BJS5bzsjwKCI=
github.com/ledgerwatch/log/v3 v3.4.0/go.mod h1:VXcz6Ssn6XEeU92dCMc39/g1F0OYAjw1Mt+dGP5DjXY=
github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ=
Expand Down
4 changes: 2 additions & 2 deletions turbo/shards/state_change_accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func (a *Accumulator) Reset(viewID uint64) {
a.viewID = viewID
}
func (a *Accumulator) ChainConfig() *params.ChainConfig { return a.chainConfig }
func (a *Accumulator) SendAndReset(ctx context.Context, c StateChangeConsumer, pendingBaseFee uint64) {
func (a *Accumulator) SendAndReset(ctx context.Context, c StateChangeConsumer, pendingBaseFee uint64, blockGasLimit uint64) {
if a == nil || c == nil || len(a.changes) == 0 {
return
}
sc := &remote.StateChangeBatch{DatabaseViewID: a.viewID, ChangeBatch: a.changes, PendingBlockBaseFee: pendingBaseFee}
sc := &remote.StateChangeBatch{DatabaseViewID: a.viewID, ChangeBatch: a.changes, PendingBlockBaseFee: pendingBaseFee, BlockGasLimit: blockGasLimit}
c.SendStateChanges(ctx, sc)
a.Reset(0) // reset here for GC, but there will be another Reset with correct viewID
}
Expand Down
2 changes: 1 addition & 1 deletion turbo/stages/stageloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func StageLoopStep(
if header.Number.Uint64() == 0 {
notifications.Accumulator.StartChange(0, header.Hash(), nil, false)
}
notifications.Accumulator.SendAndReset(ctx, notifications.StateChangesConsumer, pendingBaseFee.Uint64())
notifications.Accumulator.SendAndReset(ctx, notifications.StateChangesConsumer, pendingBaseFee.Uint64(), header.GasLimit)

return stagedsync.NotifyNewHeaders(ctx, finishProgressBefore, head, sync.PrevUnwindPoint(), notifications.Events, tx)

Expand Down

0 comments on commit 0bb6478

Please sign in to comment.