Skip to content

Introduce provider trait methods for storage changeset lookups #19473

@Rjected

Description

@Rjected

Describe the feature

Right now we use a raw tx to access storage changesets:

self.tx()
.cursor_dup_read::<tables::StorageChangeSets>()?
.seek_by_key_subkey((changeset_block_number, address).into(), storage_key)?
.filter(|entry| entry.key == storage_key)
.ok_or_else(|| ProviderError::StorageChangesetNotFound {
block_number: changeset_block_number,
address,
storage_key: Box::new(storage_key),
})?
.value,

We should create trait methods and use them wherever we fetch storage changesets with a tx, like we did for account changesets:

// Use ChangeSetReader trait method to get the account from changesets
self.provider
.get_account_before_block(changeset_block_number, *address)?
.ok_or(ProviderError::AccountChangesetNotFound {
block_number: changeset_block_number,
address: *address,
})
.map(|account_before| account_before.info)

ref #18983

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dbRelated to the databaseC-enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions