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

Improve the in SDK fork testing experience #1448

Open
leighmcculloch opened this issue Mar 1, 2025 · 1 comment
Open

Improve the in SDK fork testing experience #1448

leighmcculloch opened this issue Mar 1, 2025 · 1 comment
Assignees

Comments

@leighmcculloch
Copy link
Member

leighmcculloch commented Mar 1, 2025

If we are to make the SDKs fork testing a better experience, it needs a fast data source of a stable ledger. The way we have addressed the need for historical state today in the Soroban Rust SDK and stellar-cli's snapshot testing is for the stellar-cli to download a history archive, which takes considerable time and requires significant bandwidth.

This issue is to explore improving the fork testing experience by having the SDK act independently to retrieve ledger entries from data sources as it needs them. That data source is not yet defined, but ideally it would be an RPC, or some RPC-compatible service, or possibly but not preferred continued use of history archives.

The way the SDK fork testing works today is:

sequenceDiagram
    user->>+cli: create snapshot with<br/>accountIDs and contract IDs
    cli->>+historyarchive: req full ledger
    historyarchive->>-cli: full ledger (GBs, slow)
    cli->>cli: filter ledger down to<br/>accountIDs and contract IDs<br/>(painful dev experience)
    cli->>-user: snapshot (KBs)
    
    user->>+sdk: write test importing snapshot for fork testing
    sdk->>sdk: loads snapshot and uses it as storage starting point
    sdk->>-user: 
Loading

The way it would ideally work if the SDK could independently load a stable ledger state from a data-source. RPC is listed as the data source, but imagine it could be any data-source that provides random access of a stable ledger state, via an RPC-compatible API:

sequenceDiagram
    user->>+sdk: write test fork testing ledger N
    loop 
    sdk->>sdk: test running
    alt local snapshot exists (cache)
    sdk->>sdk: load ledger entry for key K from snapshot
    else local snapshot does not exist
    sdk->>+rpc: req ledger entry for key K ledger N
    rpc->>-sdk: entry for K (Bytes)
    end
    end
    opt if new entries were downloaded
    sdk->>sdk: write local snapshot for starting point
    end
    sdk->>-user: 
Loading

This idea was first discussed here:

Dependent on:

Note this work is very much in the exploratory phase.

@leighmcculloch
Copy link
Member Author

leighmcculloch commented Mar 1, 2025

Todo:

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

No branches or pull requests

1 participant