Skip to content

Conversation

@klkvr
Copy link
Member

@klkvr klkvr commented Oct 21, 2025

Extends ChainStorage capabilities to allow it defining custom tables and adds more hooks for writing state to those tables

Introduces custom-index example for speeding up eth_transactionBySenderAndNonce with a custom index

@github-actions
Copy link
Contributor

Your PR title doesn't follow the Conventional Commit guidelines.

Example of valid titles:

  • feat: add new user login
  • fix: correct button size
  • docs: update README

Usage:

  • feat: Introduces a new feature
  • fix: Patches a bug
  • chore: General maintenance tasks or updates
  • test: Adding new tests or modifying existing tests
  • bench: Adding new benchmarks or modifying existing benchmarks
  • perf: Performance improvements
  • refactor: Changes to improve code structure
  • docs: Documentation updates
  • ci: Changes to CI/CD configurations
  • revert: Reverts a previously merged PR
  • deps: Updates dependencies

Breaking Changes

Breaking changes are noted by using an exclamation mark. For example:

  • feat!: changed the API
  • chore(node)!: Removed unused public function

Help

For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/

Types: NodeTypesForProvider<Primitives = Primitives>;
Types: NodeTypesForProvider<Primitives = N>;

/// Optionally specifies extra database tables required for node operation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we document here how this is used?

_provider: &Provider,
_state: &ExecutionOutcome<N::Receipt>,
) -> ProviderResult<()> {
Ok(())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah noop like this is easier than adding some optional logic, so this makes sense

pub type ReadBodyInput<'a, B> =
(&'a <B as Block>::Header, Vec<<<B as Block>::Body as BlockBody>::Transaction>);
/// Hook to revert any [`ChainStorageWriter::write_custom_state`] changes.
fn remove_custom_state_above(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two traits make a ton of sense and should unblock a lot of functionality

the core limitation then is that implementations must still handle the in memory sections, which I think is fine because we also do this for all of our impls

sender: Address,
tx_index: TxNumber,
) -> ProviderResult<Option<Self::Transaction>> {
let database = self.database_provider_ro()?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what this currently doesn't do is respect the in memory section

maybe not worth adding this for this example but should be useful for users that use this as a template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants