Conversation
| // overflow, gas limit enforcement no longer works correctly. This preserves the | ||
| // historical behavior for backward compatibility. | ||
| func (txmp *TxMempool) ReapMaxTxsBytesMaxGas(maxTxs int, maxBytes, maxGasWanted, maxGasEstimated int64) (types.Txs, int64) { | ||
| if maxTxs < 0 { |
There was a problem hiding this comment.
it's okay for maxTxs to be equal to 0?
| int(s.cfg.maxTxsPerBlock()), // nolint:gosec // config values fit into int on supported platforms. | ||
| utils.Max[int64](), | ||
| int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range. | ||
| int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range. |
There was a problem hiding this comment.
So we won't have different maxGasWanted and maxGasEstimated in the future?
There was a problem hiding this comment.
I don't know, probably we will
|
|
||
| txs, totalGas := s.txMempool.ReapMaxTxsBytesMaxGas( | ||
| int(s.cfg.maxTxsPerBlock()), // nolint:gosec // config values fit into int on supported platforms. | ||
| utils.Max[int64](), |
There was a problem hiding this comment.
We probably should have maxBytes as well?
| int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range. | ||
| int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range. | ||
| ) | ||
| s.txMempool.RemoveTxs(txs) |
There was a problem hiding this comment.
Just an observation: I think it's okay here to acquire mutex twice, since if the tx disappeared in between RemoveTxs still work.
But maybe some day we should re-think the mutex use in mempool, it looks correct and efficient to me in the current context, but if we add more and more features then it might be harder to reason.
There was a problem hiding this comment.
agreed, Mempool handling is already very fragile imo
| panic("unreachable") | ||
| } | ||
|
|
||
| func (a *testApp) CheckTx(context.Context, *abci.RequestCheckTxV2) (*abci.ResponseCheckTxV2, error) { |
There was a problem hiding this comment.
Do we have a test where a block failed to execute and commit somewhere?
There was a problem hiding this comment.
only happy path tests for now until we get this to work somehow.
| return scope.Run(ctx, func(ctx context.Context, s scope.Scope) error { | ||
| // Spawn outbound connections dialing. | ||
| for _, addr := range r.cfg.ValidatorAddrs { | ||
| s.Spawn(func() error { |
There was a problem hiding this comment.
I was trying this PR on #3234. There was one error and all Giga Router stopped, no retries.
AI explains:
Spawn uses SpawnBg which calls s.Cancel(err) if the task returns an error. This cancels the entire scope — all other goroutines get cancelled.
So if runExecute (spawned with SpawnNamed which uses Spawn) returns an error early, the whole scope is cancelled including the dial retry loops.
Does that make sense?
There was a problem hiding this comment.
execution failure is a valid termination reason, because it means that we are not able to execute a finalized block.
Testing PR #3224 with autobahn integration testsTested this PR using the autobahn docker cluster setup (PR #3220 + integration tests from #3234). Found the following issues: 1. Panic in
|
Follow-up on Bug #1: Missing Commit after InitChainDug deeper into the root cause. The panic in // giga_router.go runExecute()
if last == 0 {
if _, err := app.InitChain(ctx, r.cfg.GenDoc.ToRequestInitChain()); err != nil {
return fmt.Errorf("App.InitChain(): %w", err)
}
// No Commit() here!
}
for n := next; ; n += 1 {
b, err := r.data.GlobalBlock(ctx, n)
// ...
if vals := r.cfg.App.GetValidators(); len(vals) > 0 { // PANIC
In CometBFT's normal flow, the handshaker ( |
Follow-up: Height mismatch after InitChain + Commit fixTested the latest at The issue is in if last == 0 {
if _, err := app.InitChain(ctx, ...); err != nil { ... }
if _, err := app.Commit(ctx); err != nil { ... }
next, ok = utils.SafeCast[atypes.GlobalBlockNumber](r.cfg.GenDoc.InitialHeight) // next = 1
}
for n := next; ; n += 1 {
// executeBlock at height 1, but app already committed height 1 via InitChain+Commit
// app expects height 2
Fix: after |
| return fmt.Errorf("app.InitChain(): %w", err) | ||
| } | ||
| if _, err := app.Commit(ctx); err != nil { | ||
| return fmt.Errorf("app.Commit(): %w", err) |
There was a problem hiding this comment.
Tried again and another panic:
panic: invalid height: 1; expected: 2
BeginBlock at app/abci.go:33 expects height 2 but got height 1. This is because InitChain + Commit already advanced the app state to height 1, so when executeBlock tries to finalize block 1, the app expects block 2.
6453164 to
6a2cd95
Compare
Also