Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(internal/client): Implement read only BlockState for ClientAdapter #4549

Merged
merged 11 commits into from
Feb 27, 2025

Conversation

dimartiro
Copy link
Contributor

@dimartiro dimartiro commented Feb 18, 2025

Changes

Implement read only methods from BlockState in ClientAdapter

  • Implements all read only methods from BlockState
    • BestBlock() (*types.Block, error)
    • BestBlockHash() common.Hash
    • BestBlockHeader() (*types.Header, error)
    • BestBlockNumber() (number uint, err error)
    • GenesisHash() common.Hash
    • GetBlockBody(hash common.Hash) (*types.Body, error)
    • GetBlockStateRoot(bhash common.Hash) (common.Hash, error)
    • GetBlockByHash(common.Hash) (*types.Block, error)
    • GetBlockByNumber(blockNumber uint) (*types.Block, error)
    • GetFinalisedHeader(round, setID uint64) (*types.Header, error)
    • GetFinalisedHash(round, setID uint64) (common.Hash, error)
    • GetHashesByNumber(blockNumber uint) ([]common.Hash, error)
    • GetHashByNumber(blockNumber uint) (common.Hash, error)
    • GetHeader(bhash common.Hash) (*types.Header, error)
    • GetHeaderByNumber(num uint) (*types.Header, error)
    • GetHighestFinalisedHeader() (*types.Header, error)
    • GetHighestFinalisedHash() (common.Hash, error)
    • GetHighestRoundAndSetID() (uint64, uint64, error)
    • GetJustification(common.Hash) ([]byte, error)
    • GetNonFinalisedBlocks() []common.Hash
    • GetSlotForBlock(common.Hash) (uint64, error)
    • HasFinalisedBlock(round, setID uint64) (bool, error)
    • HasHeader(hash common.Hash) (bool, error)
    • HasJustification(hash common.Hash) (bool, error)
    • HasHeaderInDatabase(hash common.Hash) (bool, error)
    • NumberIsFinalised(blockNumber uint) (bool, error)
  • Tests

Tests

make test

Issues

Closes: #4461

@dimartiro dimartiro self-assigned this Feb 18, 2025
@dimartiro dimartiro force-pushed the diego/client_translation_shim branch 2 times, most recently from 17e4e54 to 3c55321 Compare February 19, 2025 01:52
Base automatically changed from diego/client_translation_shim to development February 19, 2025 13:06
@dimartiro dimartiro force-pushed the diego/client-read_only-blockstate branch from 8f7d740 to fd604e9 Compare February 20, 2025 16:20
@dimartiro dimartiro marked this pull request as ready for review February 24, 2025 01:04
@dimartiro dimartiro force-pushed the diego/client-read_only-blockstate branch 2 times, most recently from 7f2700e to 01a0257 Compare February 25, 2025 14:57
Copy link
Contributor

@timwu20 timwu20 left a comment

Choose a reason for hiding this comment

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

Great stuff!

@dimartiro dimartiro force-pushed the diego/client-read_only-blockstate branch from 01a0257 to 56f528e Compare February 27, 2025 00:56
@dimartiro dimartiro merged commit 6ab8bad into development Feb 27, 2025
24 checks passed
@dimartiro dimartiro deleted the diego/client-read_only-blockstate branch February 27, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement read only BlockState functionality to translation shim type
3 participants