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

fix: api itest panic #12238

Merged
merged 2 commits into from
Jul 16, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

- This Lotus release includes some correctness improvements to the events subsystem, impacting RPC APIs including `GetActorEventsRaw`, `SubscribeActorEventsRaw`, `eth_getLogs` and the `eth` filter APIs. Part of these improvements involve an events database migration that may take some time to complete on nodes with extensive event databases. See [filecoin-project/lotus#12080](https://github.com/filecoin-project/lotus/pull/12080) for details.

- Breaking change in public APIs `storage/pipeline.NewPreCommitBatcher` and `storage/pipeline.New`. They now have an additional error return to deal with errors arising from fetching the sealing config.

## New features

- feat: Add trace transaction API supporting RPC method `trace_transaction` ([filecoin-project/lotus#12068](https://github.com/filecoin-project/lotus/pull/12068))
Expand Down
3 changes: 3 additions & 0 deletions itests/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ func (ts *apiSuite) testOutOfGasError(t *testing.T) {
buildconstants.BlockGasLimit = originalLimit
}()

t.Logf("BlockGasLimit changed: %d", buildconstants.BlockGasLimit)

msg := &types.Message{
From: senderAddr,
To: senderAddr,
Expand Down Expand Up @@ -289,6 +291,7 @@ func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
ctx := context.Background()

full, genesisMiner, ens := kit.EnsembleMinimal(t, append(ts.opts, kit.MockProofs())...)

ens.InterconnectAll().BeginMining(4 * time.Millisecond)

time.Sleep(1 * time.Second)
Expand Down
5 changes: 4 additions & 1 deletion node/modules/storageminer.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ func SealingPipeline(fc config.MinerFeeConfig) func(params SealingPipelineParams
provingBuffer := md.WPoStProvingPeriod * 2
pcp := sealing.NewBasicPreCommitPolicy(api, gsd, provingBuffer)

pipeline := sealing.New(ctx, api, fc, evts, maddr, ds, sealer, verif, prover, &pcp, gsd, j, as)
pipeline, err := sealing.New(ctx, api, fc, evts, maddr, ds, sealer, verif, prover, &pcp, gsd, j, as)
if err != nil {
return nil, xerrors.Errorf("creating sealing pipeline: %w", err)
}

lc.Append(fx.Hook{
OnStart: func(context.Context) error {
Expand Down
18 changes: 9 additions & 9 deletions storage/pipeline/precommit_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type PreCommitBatcher struct {
lk sync.Mutex
}

func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCommitBatcherApi, addrSel AddressSelector, feeCfg config.MinerFeeConfig, getConfig dtypes.GetSealingConfigFunc) *PreCommitBatcher {
func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCommitBatcherApi, addrSel AddressSelector, feeCfg config.MinerFeeConfig, getConfig dtypes.GetSealingConfigFunc) (*PreCommitBatcher, error) {
b := &PreCommitBatcher{
api: api,
maddr: maddr,
Expand All @@ -86,20 +86,20 @@ func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCom
stopped: make(chan struct{}),
}

go b.run()
cfg, err := b.getConfig()
if err != nil {
return nil, xerrors.Errorf("failed to get sealer config: %w", err)
}

go b.run(cfg)

return b
return b, nil
}

func (b *PreCommitBatcher) run() {
func (b *PreCommitBatcher) run(cfg sealiface.Config) {
var forceRes chan []sealiface.PreCommitBatchRes
var lastRes []sealiface.PreCommitBatchRes

cfg, err := b.getConfig()
if err != nil {
panic(err)
}

timer := time.NewTimer(b.batchWait(cfg.PreCommitBatchWait, cfg.PreCommitBatchSlack))
for {
if forceRes != nil {
Expand Down
14 changes: 9 additions & 5 deletions storage/pipeline/sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ type pendingPiece struct {
accepted func(abi.SectorNumber, abi.UnpaddedPieceSize, error)
}

func New(mctx context.Context, sapi SealingAPI, fc config.MinerFeeConfig, events Events, maddr address.Address, ds datastore.Batching, sealer sealer.SectorManager, verif storiface.Verifier, prov storiface.Prover, pcp PreCommitPolicy, gc dtypes.GetSealingConfigFunc, journal journal.Journal, addrSel AddressSelector) *Sealing {
func New(mctx context.Context, sapi SealingAPI, fc config.MinerFeeConfig, events Events, maddr address.Address, ds datastore.Batching, sealer sealer.SectorManager, verif storiface.Verifier, prov storiface.Prover, pcp PreCommitPolicy, gc dtypes.GetSealingConfigFunc, journal journal.Journal, addrSel AddressSelector) (*Sealing, error) {
s := &Sealing{
Api: sapi,
DealInfo: &CurrentDealInfoManager{sapi},
Expand All @@ -257,9 +257,8 @@ func New(mctx context.Context, sapi SealingAPI, fc config.MinerFeeConfig, events

addrSel: addrSel,

terminator: NewTerminationBatcher(mctx, maddr, sapi, addrSel, fc, gc),
precommiter: NewPreCommitBatcher(mctx, maddr, sapi, addrSel, fc, gc),
commiter: NewCommitBatcher(mctx, maddr, sapi, addrSel, fc, gc, prov),
terminator: NewTerminationBatcher(mctx, maddr, sapi, addrSel, fc, gc),
commiter: NewCommitBatcher(mctx, maddr, sapi, addrSel, fc, gc, prov),

getConfig: gc,

Expand All @@ -270,6 +269,11 @@ func New(mctx context.Context, sapi SealingAPI, fc config.MinerFeeConfig, events
byState: map[SectorState]int64{},
},
}
pc, err := NewPreCommitBatcher(mctx, maddr, sapi, addrSel, fc, gc)
if err != nil {
return nil, err
}
s.precommiter = pc

s.notifee = func(before, after SectorInfo) {
s.journal.RecordEvent(s.sealingEvtType, func() interface{} {
Expand All @@ -287,7 +291,7 @@ func New(mctx context.Context, sapi SealingAPI, fc config.MinerFeeConfig, events

s.sectors = statemachine.New(namespace.Wrap(ds, datastore.NewKey(SectorStorePrefix)), s, SectorInfo{})

return s
return s, nil
}

func (m *Sealing) Run(ctx context.Context) {
Expand Down