Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
5c35437
new mempool draft
pompon0 May 15, 2026
e4a1280
WIP
pompon0 May 15, 2026
2623868
Merge remote-tracking branch 'origin/main' into gprusak-mempool
pompon0 May 15, 2026
5a91fa6
WIP
pompon0 May 18, 2026
a6feb77
WIP
pompon0 May 18, 2026
df95cde
removed priority queue
pompon0 May 18, 2026
4635fca
clist
pompon0 May 19, 2026
13254e5
before implementing PopTxs
pompon0 May 19, 2026
750c82a
reap marker
pompon0 May 19, 2026
6bf90a7
prod code compiles
pompon0 May 19, 2026
cd616ce
fixing tests WIP
pompon0 May 19, 2026
c860fe9
WIP
pompon0 May 19, 2026
e295382
mempool tests compile
pompon0 May 19, 2026
c2d3f06
wip
pompon0 May 19, 2026
bdcd0a2
codex WIP
pompon0 May 20, 2026
b7f02dc
codex WIP
pompon0 May 20, 2026
9f0f768
codex WIP
pompon0 May 20, 2026
4bff32e
moved cache
pompon0 May 20, 2026
f51ec39
reaped requires a better handling
pompon0 May 20, 2026
17702a9
no reaped again
pompon0 May 20, 2026
2a7bc71
codex WIP
pompon0 May 20, 2026
6ea4f7a
codex WIP
pompon0 May 20, 2026
97717e7
fmt
pompon0 May 20, 2026
41dcf16
Merge remote-tracking branch 'origin/main' into gprusak-mempool
pompon0 May 20, 2026
0b9bf27
some updates and documentation
pompon0 May 20, 2026
d25b16d
some fixes
pompon0 May 20, 2026
f55487d
test fix
pompon0 May 20, 2026
58778ce
Merge remote-tracking branch 'origin/main' into gprusak-mempool
pompon0 May 20, 2026
81c762c
termination fix
pompon0 May 20, 2026
f83f36f
fmt
pompon0 May 20, 2026
5a41d05
lint
pompon0 May 20, 2026
9029187
fixes
pompon0 May 20, 2026
77e8580
fixes
pompon0 May 20, 2026
7297954
codex WIP
pompon0 May 20, 2026
dc9e820
metric fixes
pompon0 May 20, 2026
fc4a26e
test fix
pompon0 May 20, 2026
cfc0541
codex WIP
pompon0 May 20, 2026
917a739
codex WIP
pompon0 May 20, 2026
cf803e1
CList.Clear and replacement test
pompon0 May 20, 2026
b516f94
applied codex comments
pompon0 May 20, 2026
94bbd6c
applied codex comments
pompon0 May 20, 2026
b18320d
syntax
pompon0 May 21, 2026
ce65730
monotone blockHeight check
pompon0 May 21, 2026
41450a9
style
pompon0 May 21, 2026
616ba41
wip
pompon0 May 21, 2026
be86a25
merged helpers
pompon0 May 21, 2026
36b309d
backward compatibility fix
pompon0 May 21, 2026
45e80c3
compatibility fix
pompon0 May 21, 2026
0fd6a2d
updated caching logic
pompon0 May 21, 2026
7208030
cache compatible
pompon0 May 21, 2026
5e67f49
fixes
pompon0 May 21, 2026
7be9604
more fixes
pompon0 May 21, 2026
d9b1814
removed irrelevant test
pompon0 May 21, 2026
b4d042b
test fix
pompon0 May 21, 2026
b072f49
adjusted priorityReservoir usage
pompon0 May 21, 2026
91eb256
eliminated deviation from main
pompon0 May 21, 2026
38e5109
test triggering compaction in insert
pompon0 May 21, 2026
c56c2cc
comments
pompon0 May 21, 2026
7a8da94
changed utilisation to account all transactions, because gossip dampe…
pompon0 May 21, 2026
ca0dc58
autobahn mempool draft
pompon0 May 25, 2026
de2eda1
applied comments
pompon0 May 25, 2026
a68002a
mempool WIP
pompon0 May 25, 2026
41a6a18
applied comments
pompon0 May 26, 2026
6bdb405
WIP
pompon0 May 26, 2026
abd463a
flake fix:
pompon0 May 26, 2026
2465a33
lint
pompon0 May 26, 2026
353af19
before async mutex
pompon0 May 27, 2026
7b1eed5
code complete
pompon0 May 27, 2026
c59c3d8
reverted unrelated changes
pompon0 May 27, 2026
abaf008
WIP separating tm and autobahn mempools
pompon0 May 27, 2026
090509c
WIP
pompon0 May 27, 2026
aac57aa
WIP
pompon0 May 27, 2026
f23fadf
WIP
pompon0 May 27, 2026
9e0f121
WIP
pompon0 May 27, 2026
27b8ee0
terminating pool early
pompon0 May 27, 2026
d130dfd
tests
pompon0 May 27, 2026
f93ee9f
attempt to remove more
pompon0 May 28, 2026
1dc6d72
blocksync pool refactor
pompon0 May 28, 2026
49271a0
regression fix
pompon0 May 28, 2026
93f2ecd
another regression
pompon0 May 28, 2026
244347b
mempool test flake fix
pompon0 May 28, 2026
3206044
IgnoreCancel
pompon0 May 28, 2026
4c1559e
busy loop fix
pompon0 May 28, 2026
d4c162f
Merge remote-tracking branch 'origin/main' into gprusak-mempool
pompon0 May 28, 2026
1f6cba6
Merge branch 'gprusak-mempool' into gprusak-mempool2
pompon0 May 28, 2026
a8d0910
Merge branch 'gprusak-blocksync' into gprusak-mempool2
pompon0 May 28, 2026
ffcdfa6
WIP
pompon0 May 28, 2026
37cf7f7
almost separated
pompon0 May 28, 2026
50ec7fa
WIP
pompon0 May 28, 2026
d76cd8f
autobahn mempool Insert and Nonce plugged in
pompon0 May 28, 2026
b3d6d19
removed metricers, reverted previousMaxPeerHeight
pompon0 May 29, 2026
dbe40d6
test fix
pompon0 May 29, 2026
5891958
adjusted doc
pompon0 May 29, 2026
4f62265
removed deadcode
pompon0 May 29, 2026
f234acb
Merge branch 'gprusak-blocksync' into gprusak-mempool2
pompon0 May 29, 2026
3b4d15e
low effort unconfirmed txs
pompon0 May 29, 2026
97d052e
flush for autobahn is not supported
pompon0 May 29, 2026
6197202
Merge remote-tracking branch 'origin/main' into gprusak-blocksync
pompon0 May 29, 2026
6146d37
Merge branch 'gprusak-blocksync' into gprusak-mempool2
pompon0 May 29, 2026
3200bea
some fixes
pompon0 May 29, 2026
500492f
some codex tests
pompon0 May 29, 2026
6da7426
fmt
pompon0 May 29, 2026
52dde73
lastBlockTime
pompon0 May 29, 2026
2c82f80
codex nonce test
pompon0 May 29, 2026
de00149
some fixes
pompon0 May 29, 2026
35564b9
test fixes
pompon0 May 29, 2026
43c1bc2
fixes
pompon0 May 29, 2026
2161b70
fix
pompon0 May 29, 2026
a081eb7
test fix
pompon0 May 29, 2026
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: 1 addition & 1 deletion sei-tendermint/abci/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ type ResponseCheckTxV2 struct {
*ResponseCheckTx

// helper properties for prioritization in mempool
IsEVM bool
EVMNonce uint64
// EVM and sei addresses are both derived from the sender's public key.
// TODO(gprusak): include just the secp256k1 public key and let the CheckTx caller derive evm/sei address on their own.
EVMSenderAddress common.Address
SeiSenderAddress []byte
IsEVM bool
EVMRequiredBalance *big.Int
}

Expand Down
12 changes: 5 additions & 7 deletions sei-tendermint/cmd/tendermint/commands/gen_autobahn_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ Output is written to the file specified by --output.`,
}

cfg := config.AutobahnFileConfig{
Validators: validators,
MaxTxsPerBlock: 5_000,
MempoolSize: 5_000,
BlockInterval: utils.Duration(400 * time.Millisecond),
AllowEmptyBlocks: true,
ViewTimeout: utils.Duration(1500 * time.Millisecond),
DialInterval: utils.Duration(10 * time.Second),
Validators: validators,
MaxTxsPerBlock: 5_000,
BlockInterval: utils.Duration(400 * time.Millisecond),
ViewTimeout: utils.Duration(1500 * time.Millisecond),
DialInterval: utils.Duration(10 * time.Second),
}
// The flag defaults to "data/autobahn" so persistence is on without
// operator action. node/setup.go rootifies the relative path against
Expand Down
5 changes: 0 additions & 5 deletions sei-tendermint/config/autobahn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ type AutobahnFileConfig struct {
Validators []AutobahnValidator `json:"validators"`
MaxTxsPerBlock uint64 `json:"max_txs_per_block"`
MaxTxsPerSecond utils.Option[uint64] `json:"max_txs_per_second"`
MempoolSize uint64 `json:"mempool_size"`
BlockInterval utils.Duration `json:"block_interval"`
AllowEmptyBlocks bool `json:"allow_empty_blocks"`
ViewTimeout utils.Duration `json:"view_timeout"`
PersistentStateDir utils.Option[string] `json:"persistent_state_dir"`
DialInterval utils.Duration `json:"dial_interval"`
Expand All @@ -61,9 +59,6 @@ func (fc *AutobahnFileConfig) Validate() error {
if fc.MaxTxsPerBlock == 0 {
return errors.New("max_txs_per_block must be > 0")
}
if fc.MempoolSize == 0 {
return errors.New("mempool_size must be > 0")
}
if fc.BlockInterval <= 0 {
return errors.New("block_interval must be > 0")
}
Expand Down
5 changes: 2 additions & 3 deletions sei-tendermint/internal/autobahn/autobahn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ message BlockHeader {
}

message Payload {
reserved "edge_count", "coinbase", "basefee";
reserved 3, 4, 5;
option (hashable.hashable) = true;
optional Timestamp created_at = 1; // required
optional uint64 total_gas = 2; // required
optional int64 edge_count = 3; // required
optional bytes coinbase = 4; // required
optional int64 basefee = 5; // required
repeated bytes txs = 6;
}

Expand Down
25 changes: 15 additions & 10 deletions sei-tendermint/internal/autobahn/avail/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ type State struct {
persisters persisters
}

func (s *State) PublicKey() types.PublicKey {
return s.key.Public()
}

// persisters holds all disk persistence components. Either all are present
// (real I/O) or all are no-op (testing). It is a pure I/O struct — all inner
// state access goes through State methods.
Expand Down Expand Up @@ -521,11 +525,11 @@ func (s *State) fullCommitQC(ctx context.Context, n types.RoadIndex) (*types.Ful
}

// WaitForCapacity waits until the given lane has enough capacity for a new block.
func (s *State) WaitForCapacity(ctx context.Context, lane types.LaneID) error {
func (s *State) WaitForCapacity(ctx context.Context, toProduce types.BlockNumber) error {
lane := s.key.Public()
for inner, ctrl := range s.inner.Lock() {
q := inner.blocks[lane]
if err := ctrl.WaitUntil(ctx, func() bool {
return q.next < inner.persistedBlockStart[lane]+BlocksPerLane
return toProduce < inner.persistedBlockStart[lane]+BlocksPerLane
}); err != nil {
return err
}
Expand Down Expand Up @@ -564,23 +568,24 @@ func (s *State) WaitForLaneQCs(

// ProduceBlock appends a new block to the producers lane.
// Blocks until the lane has enough capacity for the new block.
func (s *State) ProduceBlock(ctx context.Context, payload *types.Payload) (*types.Signed[*types.LaneProposal], error) {
return s.produceBlock(ctx, s.key, payload)
func (s *State) ProduceBlock(n types.BlockNumber, payload *types.Payload) (*types.Signed[*types.LaneProposal], error) {
return s.produceBlock(n, s.key, payload)
}

// TODO: produceBlock is a separate function for testing - consider improving the tests to use ProduceBlock only.
func (s *State) produceBlock(ctx context.Context, key types.SecretKey, payload *types.Payload) (*types.Signed[*types.LaneProposal], error) {
func (s *State) produceBlock(n types.BlockNumber, key types.SecretKey, payload *types.Payload) (*types.Signed[*types.LaneProposal], error) {
lane := key.Public()
var result *types.Signed[*types.LaneProposal]
for inner, ctrl := range s.inner.Lock() {
q, ok := inner.blocks[lane]
if !ok {
return nil, ErrBadLane
}
if err := ctrl.WaitUntil(ctx, func() bool {
return q.next < inner.persistedBlockStart[lane]+BlocksPerLane
}); err != nil {
return nil, err
if n >= inner.persistedBlockStart[lane]+BlocksPerLane {
return nil, fmt.Errorf("lane full")
}
if q.next != n {
return nil, fmt.Errorf("unexpected block number: got %v, want %v", n, q.next)
}
var parent types.BlockHeaderHash
if q.first < q.next {
Expand Down
9 changes: 4 additions & 5 deletions sei-tendermint/internal/autobahn/avail/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func testState(t *testing.T, stateDir utils.Option[string]) {
lane := key.Public()
p := types.GenPayload(rng)
want[lane] = append(want[lane], p.Hash())
b, err := state.produceBlock(ctx, key, p)
b, err := state.produceBlock(state.NextBlock(lane), key, p)
if err != nil {
return fmt.Errorf("state.ProduceBlock(): %w", err)
}
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestStateRestartFromPersisted(t *testing.T) {

for range 5 {
key := keys[rng.Intn(len(keys))]
if _, err := state.produceBlock(ctx, key, types.GenPayload(rng)); err != nil {
if _, err := state.produceBlock(state.NextBlock(key.Public()), key, types.GenPayload(rng)); err != nil {
return fmt.Errorf("produceBlock: %w", err)
}
}
Expand Down Expand Up @@ -340,7 +340,6 @@ func TestStateMismatchedQCs(t *testing.T) {
}, utils.OrPanic1(data.NewDataWAL(utils.None[string](), committee))))
state, err := NewState(keys[0], ds, utils.None[string]())
require.NoError(t, err)
ctx := t.Context()

// Helper to create a CommitQC for a specific index
makeQC := func(prev utils.Option[*types.CommitQC], laneQCs map[types.LaneID]*types.LaneQC) *types.CommitQC {
Expand All @@ -364,7 +363,7 @@ func TestStateMismatchedQCs(t *testing.T) {
// 1. Produce a block so we have a non-empty range
lane := keys[0].Public()
p := types.GenPayload(rng)
b, err := state.ProduceBlock(ctx, p)
b, err := state.ProduceBlock(state.NextBlock(lane), p)
require.NoError(t, err)

// 2. Form a LaneQC for it
Expand Down Expand Up @@ -398,7 +397,7 @@ func TestPushBlockRejectsBadParentHash(t *testing.T) {
state := utils.OrPanic1(NewState(keys[0], ds, utils.None[string]()))

// Produce a valid first block on our lane.
_, err := state.ProduceBlock(ctx, types.GenPayload(rng))
_, err := state.ProduceBlock(state.NextBlock(keys[0].Public()), types.GenPayload(rng))
require.NoError(t, err)

// Create a second block with a fake parentHash.
Expand Down
12 changes: 0 additions & 12 deletions sei-tendermint/internal/autobahn/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,6 @@ func (s *State) commitQC() utils.AtomicRecv[utils.Option[*types.CommitQC]] {
panic("unreachable")
}

// WaitForCapacity waits until a new block can be produced by this node.
func (s *State) WaitForCapacity(ctx context.Context) error {
return s.avail.WaitForCapacity(ctx, s.cfg.Key.Public())
}

// ProduceBlock produces a new block with the given payload.
// Returns ErrNoCapacity if there is currently no capacity for the next block.
// Run WaitForCapacity before calling ProduceBlock.
func (s *State) ProduceBlock(ctx context.Context, payload *types.Payload) (*types.Signed[*types.LaneProposal], error) {
return s.avail.ProduceBlock(ctx, payload)
}

// PushProposal processes an unverified FullProposal message.
func (s *State) PushProposal(ctx context.Context, proposal *types.FullProposal) error {
return s.pushProposal(ctx, proposal)
Expand Down
45 changes: 43 additions & 2 deletions sei-tendermint/internal/autobahn/data/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ type appProposalWithTimestamp struct {
}

type inner struct {
qcs map[types.GlobalBlockNumber]*types.FullCommitQC // [first,nextQC)
blocks map[types.GlobalBlockNumber]*types.Block // [first,nextBlock) + subset of [nextBlock,nextQC)
qcs map[types.GlobalBlockNumber]*types.FullCommitQC // [first,nextQC)
blocks map[types.GlobalBlockNumber]*types.Block // [first,nextBlock) + subset of [nextBlock,nextQC)
// appProposal[n] contains appProposal block >=n.
appProposals map[types.GlobalBlockNumber]appProposalWithTimestamp // [first,nextAppProposal)

// blockHashes is a hash → height index mirroring blocks. Maintained
Expand Down Expand Up @@ -565,6 +566,9 @@ func (s *State) PushAppHash(ctx context.Context, n types.GlobalBlockNumber, hash
proposal: proposal,
timestamp: t,
}
// TODO(gprusak): this will be problematic on restart,
// nextAppProposal should be initiated wrt current application height,
// so that we don't iterate over all blocks in storage on startup.
for inner.nextAppProposal <= n {
b := inner.blocks[inner.nextAppProposal]
latency := t.Sub(b.Payload().CreatedAt()).Seconds()
Expand Down Expand Up @@ -594,6 +598,43 @@ func (s *State) AppProposal(ctx context.Context, n types.GlobalBlockNumber) (*ty
panic("unreachable")
}

func (i *inner) nextToExecute(lane types.LaneID) types.BlockNumber {
// TODO(gprusak): decide whether 0 is a good result in this case in general.
if i.first == i.nextAppProposal {
return 0
}
n := i.nextAppProposal - 1
r := i.qcs[n].QC().LaneRange(lane)
// TODO: this header can be actually extracted from FullCommitQC, so consider moving all this logic there.
h := i.blocks[n].Header()
x := lane.Compare(h.Lane())
// NOTE: here we assume the specific ordering of lane blocks in the CommitQC:
// TODO(gprusak): move this logic closer to CommitQC
switch {
case x < 0:
return r.Next()
case x > 0:
return r.First()
default:
return h.BlockNumber() + 1
}
}

// Waits until lane block n is executed, returns the next block of this lane to be executed (>n)
func (s *State) WaitUntilExecuted(ctx context.Context, lane types.LaneID, n types.BlockNumber) (types.BlockNumber, error) {
for inner, ctrl := range s.inner.Lock() {
for {
if next := inner.nextToExecute(lane); n < next {
return next, nil
}
if err := ctrl.Wait(ctx); err != nil {
return 0, err
}
}
}
panic("unreachable")
}

// PruneBefore removes blocks, QCs, and AppProposals before retainFrom.
// Blocks at retainFrom and above are kept. Per-block pruning may split
// a QC range; this is handled on recovery (NewState skips partial QC prefixes).
Expand Down
43 changes: 6 additions & 37 deletions sei-tendermint/internal/autobahn/pb/autobahn.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading