Skip to content

feat: add bulk public account reads - #619

Open
3esmit wants to merge 1 commit into
logos-blockchain:devfrom
3esmit:617-bulk-public-account-reads
Open

feat: add bulk public account reads#619
3esmit wants to merge 1 commit into
logos-blockchain:devfrom
3esmit:617-bulk-public-account-reads

Conversation

@3esmit

@3esmit 3esmit commented Jul 14, 2026

Copy link
Copy Markdown

🎯 Purpose

Add bulk public-account reads across the sequencer RPC, wallet core, and wallet FFI.

Wallet consumers can now retrieve multiple full account states in one network request and one sequencer state-lock acquisition, instead of issuing one request per account.

Closes #617.

⚙️ Approach

  • Add ordered getAccounts(Vec<AccountId>) -> Vec<Account> sequencer RPC.
  • Preserve existing account lookup semantics, input order, and duplicate IDs.
  • Support empty, single-account, and multi-account requests.
  • Add WalletCore::get_accounts_public.
  • Add FFI bulk-read and matching memory-release functions.
  • Expose the FFI batch limit and an explicit invalid-argument error.
  • Limit batches to 24 accounts so worst-case JSON responses remain below the default 10 MiB transport limit.
  • Regenerate the C header and add unit and integration coverage.

🧪 How to Test

cargo test -p sequencer_service_rpc --features client,server --lib
cargo test -p wallet-ffi --lib

cargo test -p integration_tests \
  --test account \
  get_public_accounts_returns_states_in_input_order \
  -- --exact

cargo test -p integration_tests \
  --test wallet_ffi \
  test_wallet_ffi_get_accounts_public \
  -- --exact

cargo check -p wallet -p wallet-ffi -p sequencer_service
cargo fmt --all -- --check

The tests cover empty input, ordered multi-account results, duplicate IDs, unknown accounts, oversized requests, null FFI inputs, and nested FFI allocation cleanup.

🔗 Dependencies

None.

🔜 Future Work

Expose the new wallet FFI operation through higher-level execution-zone consumers as needed.

📋 PR Completion Checklist

  • Complete PR description
  • Implement the core functionality
  • Add/update tests
  • Add/update documentation and inline comments

Copilot AI review requested due to automatic review settings July 14, 2026 20:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a bulk public-account read pathway end-to-end (sequencer RPC → wallet core → wallet FFI), enabling consumers to fetch multiple full account states in a single network request while preserving input order and duplicate IDs.

Changes:

  • Introduces sequencer RPC method getAccounts(Vec<AccountId>) -> Vec<Account> with a 24-account batch limit.
  • Adds WalletCore::get_accounts_public and exposes the operation via wallet FFI, including a matching free function and an explicit invalid-argument error.
  • Adds integration and unit coverage for ordering, empty input, duplicate IDs, null/oversized FFI inputs, and nested allocation cleanup.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lez/wallet/src/lib.rs Adds wallet-core bulk public account read method.
lez/wallet-ffi/wallet_ffi.h Regenerates header to expose batch read API, free function, error code, and limit constant.
lez/wallet-ffi/src/types.rs Adds FfiAccountDataList for returning bulk account data over FFI.
lez/wallet-ffi/src/lib.rs Defines FFI batch limit and compile-time asserts it matches sequencer RPC.
lez/wallet-ffi/src/error.rs Adds InvalidArgument error code for unsupported argument ranges.
lez/wallet-ffi/src/account.rs Implements wallet_ffi_get_accounts_public and wallet_ffi_free_accounts_public, plus unit test for nested cleanup.
lez/wallet-ffi/cbindgen.toml Exports the batch limit constant through cbindgen.
lez/sequencer/service/src/service.rs Implements server-side get_accounts RPC handler with max-batch enforcement.
lez/sequencer/service/rpc/src/lib.rs Extends RPC trait with getAccounts and defines MAX_ACCOUNTS_PER_REQUEST (+ size guard test).
lez/sequencer/service/rpc/Cargo.toml Adds serde_json dev-dependency for RPC response sizing test.
integration_tests/tests/wallet_ffi.rs Adds integration test coverage for FFI bulk public account reads and error cases.
integration_tests/tests/account.rs Adds integration test coverage for RPC ordering/duplicates/unknown IDs/oversized batch behavior.
Cargo.lock Records dependency graph update for new dev-dependency usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@3esmit
3esmit force-pushed the 617-bulk-public-account-reads branch 3 times, most recently from b3070df to c351ac1 Compare July 14, 2026 22:34
Add ordered batched account lookup across sequencer RPC, wallet, and C FFI. Bound batch size to keep worst-case responses within transport limits and expose matching FFI ownership and error contracts.

Closes logos-blockchain#617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: add bulk public account reads

3 participants