Skip to content

Commit 4468b0a

Browse files
committed
clean api
1 parent a76f88c commit 4468b0a

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

block/retriever_da.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (m *Manager) tryDecodeData(bz []byte, daHeight uint64) *types.Data {
255255
}
256256

257257
// Early validation to reject junk data
258-
if err := m.isValidSignedData(&signedData); err != nil {
258+
if err := m.assertValidSignedData(&signedData); err != nil {
259259
m.logger.Debug().Uint64("daHeight", daHeight).Err(err).Msg("invalid data signature")
260260
return nil
261261
}
@@ -268,8 +268,8 @@ func (m *Manager) tryDecodeData(bz []byte, daHeight uint64) *types.Data {
268268
return &signedData.Data
269269
}
270270

271-
// isValidSignedData returns true if the data signature is valid for the expected sequencer.
272-
func (m *Manager) isValidSignedData(signedData *types.SignedData) error {
271+
// assertValidSignedData returns true if the data signature is valid for the expected sequencer.
272+
func (m *Manager) assertValidSignedData(signedData *types.SignedData) error {
273273
if signedData == nil || signedData.Txs == nil {
274274
return errors.New("empty signed data")
275275
}

block/retriever_da_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ func TestRetrieveLoop_DAHeightIncrementsOnlyOnSuccess(t *testing.T) {
735735
mockDAClient.AssertExpectations(t)
736736
}
737737

738-
// TestIsValidSignedData covers valid, nil, wrong proposer, and invalid signature cases for isValidSignedData.
739-
func TestIsValidSignedData(t *testing.T) {
738+
// TestAssertValidSignedData covers valid, nil, wrong proposer, and invalid signature cases for assertValidSignedData.
739+
func TestAssertValidSignedData(t *testing.T) {
740740
require := require.New(t)
741741
privKey, _, err := crypto.GenerateKeyPair(crypto.Ed25519, 256)
742742
require.NoError(err)
@@ -771,11 +771,11 @@ func TestIsValidSignedData(t *testing.T) {
771771
Address: proposerAddr,
772772
},
773773
}
774-
assert.NoError(t, m.isValidSignedData(signedData))
774+
assert.NoError(t, m.assertValidSignedData(signedData))
775775
})
776776

777777
t.Run("nil signed data", func(t *testing.T) {
778-
assert.Error(t, m.isValidSignedData(nil))
778+
assert.Error(t, m.assertValidSignedData(nil))
779779
})
780780

781781
t.Run("nil Txs", func(t *testing.T) {
@@ -786,7 +786,7 @@ func TestIsValidSignedData(t *testing.T) {
786786
},
787787
}
788788
signedData.Txs = nil
789-
assert.Error(t, m.isValidSignedData(signedData))
789+
assert.Error(t, m.assertValidSignedData(signedData))
790790
})
791791

792792
t.Run("wrong proposer address", func(t *testing.T) {
@@ -808,7 +808,7 @@ func TestIsValidSignedData(t *testing.T) {
808808
Address: wrongAddr,
809809
},
810810
}
811-
assert.Error(t, m.isValidSignedData(signedData))
811+
assert.Error(t, m.assertValidSignedData(signedData))
812812
})
813813

814814
t.Run("invalid signature", func(t *testing.T) {
@@ -831,6 +831,6 @@ func TestIsValidSignedData(t *testing.T) {
831831
Address: proposerAddr,
832832
},
833833
}
834-
assert.Error(t, m.isValidSignedData(signedData))
834+
assert.Error(t, m.assertValidSignedData(signedData))
835835
})
836836
}

docs/learn/specs/block-manager.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ The `DataStoreRetrieveLoop`:
456456
- Operates at `BlockTime` intervals via `dataStoreCh` signals
457457
- Tracks `dataStoreHeight` for the last retrieved data
458458
- Retrieves all data blocks between last height and current store height
459-
- Validates data signatures using `isValidSignedData`
459+
- Validates data signatures using `assertValidSignedData`
460460
- Marks data as "seen" in the data cache
461461
- Sends data to sync goroutine via `dataInCh`
462462

@@ -568,30 +568,30 @@ The communication with DA layer:
568568

569569
## Assumptions and Considerations
570570

571-
* The block manager loads the initial state from the local store and uses genesis if not found in the local store, when the node (re)starts.
572-
* The default mode for sequencer nodes is normal (not lazy).
573-
* The sequencer can produce empty blocks.
574-
* In lazy aggregation mode, the block manager maintains consistency with the DA layer by producing empty blocks at regular intervals, ensuring a 1:1 mapping between DA layer blocks and execution layer blocks.
575-
* The lazy aggregation mechanism uses a dual timer approach:
576-
* A `blockTimer` that triggers block production when transactions are available
577-
* A `lazyTimer` that ensures blocks are produced even during periods of inactivity
578-
* Empty batches are handled differently in lazy mode - instead of discarding them, they are returned with the `ErrNoBatch` error, allowing the caller to create empty blocks with proper timestamps.
579-
* Transaction notifications from the `Reaper` to the `Manager` are handled via a non-blocking notification channel (`txNotifyCh`) to prevent backpressure.
580-
* The block manager enforces `MaxPendingHeadersAndData` limit to prevent unbounded growth of pending queues during DA submission issues.
581-
* Headers and data are submitted separately to the DA layer using different namespaces, supporting the header/data separation architecture.
582-
* The block manager uses persistent caches for headers and data to track seen items and DA inclusion status.
583-
* Namespace migration is handled transparently, with automatic detection and state persistence to optimize future operations.
584-
* The system supports backward compatibility with legacy single-namespace deployments while transitioning to separate namespaces.
585-
* Gas price management includes automatic adjustment with `GasMultiplier` on DA submission retries.
586-
* The block manager uses persistent storage (disk) when the `root_dir` and `db_path` configuration parameters are specified in `config.yaml` file under the app directory. If these configuration parameters are not specified, the in-memory storage is used, which will not be persistent if the node stops.
587-
* The block manager does not re-apply blocks when they transition from soft confirmed to DA included status. The block is only marked DA included in the caches.
588-
* Header and data stores use separate prefixes for isolation in the underlying database.
589-
* The genesis `ChainID` is used to create separate `PubSubTopID`s for headers and data in go-header.
590-
* Block sync over the P2P network works only when a full node is connected to the P2P network by specifying the initial seeds to connect to via `P2PConfig.Seeds` configuration parameter when starting the full node.
591-
* Node's context is passed down to all components to support graceful shutdown and cancellation.
592-
* The block manager supports custom signature payload providers for headers, enabling flexible signing schemes.
593-
* The block manager supports the separation of header and data structures in Evolve. This allows for expanding the sequencing scheme beyond single sequencing and enables the use of a decentralized sequencer mode. For detailed information on this architecture, see the [Header and Data Separation ADR](../../adr/adr-014-header-and-data-separation.md).
594-
* The block manager processes blocks with a minimal header format, which is designed to eliminate dependency on CometBFT's header format and can be used to produce an execution layer tailored header if needed. For details on this header structure, see the [Evolve Minimal Header](../../adr/adr-015-rollkit-minimal-header.md) specification.
571+
- The block manager loads the initial state from the local store and uses genesis if not found in the local store, when the node (re)starts.
572+
- The default mode for sequencer nodes is normal (not lazy).
573+
- The sequencer can produce empty blocks.
574+
- In lazy aggregation mode, the block manager maintains consistency with the DA layer by producing empty blocks at regular intervals, ensuring a 1:1 mapping between DA layer blocks and execution layer blocks.
575+
- The lazy aggregation mechanism uses a dual timer approach:
576+
- A `blockTimer` that triggers block production when transactions are available
577+
- A `lazyTimer` that ensures blocks are produced even during periods of inactivity
578+
- Empty batches are handled differently in lazy mode - instead of discarding them, they are returned with the `ErrNoBatch` error, allowing the caller to create empty blocks with proper timestamps.
579+
- Transaction notifications from the `Reaper` to the `Manager` are handled via a non-blocking notification channel (`txNotifyCh`) to prevent backpressure.
580+
- The block manager enforces `MaxPendingHeadersAndData` limit to prevent unbounded growth of pending queues during DA submission issues.
581+
- Headers and data are submitted separately to the DA layer using different namespaces, supporting the header/data separation architecture.
582+
- The block manager uses persistent caches for headers and data to track seen items and DA inclusion status.
583+
- Namespace migration is handled transparently, with automatic detection and state persistence to optimize future operations.
584+
- The system supports backward compatibility with legacy single-namespace deployments while transitioning to separate namespaces.
585+
- Gas price management includes automatic adjustment with `GasMultiplier` on DA submission retries.
586+
- The block manager uses persistent storage (disk) when the `root_dir` and `db_path` configuration parameters are specified in `config.yaml` file under the app directory. If these configuration parameters are not specified, the in-memory storage is used, which will not be persistent if the node stops.
587+
- The block manager does not re-apply blocks when they transition from soft confirmed to DA included status. The block is only marked DA included in the caches.
588+
- Header and data stores use separate prefixes for isolation in the underlying database.
589+
- The genesis `ChainID` is used to create separate `PubSubTopID`s for headers and data in go-header.
590+
- Block sync over the P2P network works only when a full node is connected to the P2P network by specifying the initial seeds to connect to via `P2PConfig.Seeds` configuration parameter when starting the full node.
591+
- Node's context is passed down to all components to support graceful shutdown and cancellation.
592+
- The block manager supports custom signature payload providers for headers, enabling flexible signing schemes.
593+
- The block manager supports the separation of header and data structures in Evolve. This allows for expanding the sequencing scheme beyond single sequencing and enables the use of a decentralized sequencer mode. For detailed information on this architecture, see the [Header and Data Separation ADR](../../adr/adr-014-header-and-data-separation.md).
594+
- The block manager processes blocks with a minimal header format, which is designed to eliminate dependency on CometBFT's header format and can be used to produce an execution layer tailored header if needed. For details on this header structure, see the [Evolve Minimal Header](../../adr/adr-015-rollkit-minimal-header.md) specification.
595595

596596
## Metrics
597597

0 commit comments

Comments
 (0)