Skip to content

Standalone rofl-appd#2419

Open
njelich wants to merge 1 commit intomainfrom
noah/rofl-appd-standalone
Open

Standalone rofl-appd#2419
njelich wants to merge 1 commit intomainfrom
noah/rofl-appd-standalone

Conversation

@njelich
Copy link
Contributor

@njelich njelich commented Dec 12, 2025

Resolves #2142

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 0% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.40%. Comparing base (394da33) to head (20c127d).

Files with missing lines Patch % Lines
rofl-appd/src/lib.rs 0.00% 19 Missing ⚠️
rofl-appd/src/state.rs 0.00% 13 Missing ⚠️
rofl-appd/src/main.rs 0.00% 10 Missing ⚠️
rofl-appd/src/services/metadata.rs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2419      +/-   ##
==========================================
- Coverage   48.54%   48.40%   -0.15%     
==========================================
  Files         224      225       +1     
  Lines       16079    16130      +51     
==========================================
+ Hits         7806     7807       +1     
- Misses       8213     8263      +50     
  Partials       60       60              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify
Copy link

netlify bot commented Dec 12, 2025

Deploy Preview for oasisprotocol-oasis-sdk canceled.

Name Link
🔨 Latest commit 20c127d
🔍 Latest deploy log https://app.netlify.com/projects/oasisprotocol-oasis-sdk/deploys/69552dafd83c3c000844a7c2

@njelich njelich changed the title wip Standalone rofl-appd Dec 15, 2025
@ptrus
Copy link
Member

ptrus commented Dec 15, 2025

Nice, I think we should also provide a docker image that runs the mock rofl-appd, so that rofl app developers can easily use it for testing. Could include it in the existing rofl-dev or a separate image only with the mock rofl-appd.

@njelich njelich self-assigned this Dec 16, 2025
@njelich njelich force-pushed the noah/rofl-appd-standalone branch 3 times, most recently from 0232a11 to 71d4284 Compare December 20, 2025 14:55
@njelich
Copy link
Contributor Author

njelich commented Dec 20, 2025

@ptrus Can you clarify how the runtime queries should work in the local mode? I saw that the actual method and args for the queries are underdocumented.

In standalone mode rofl-appd would work with the sapphire localnet, so the transport channel logic would be completely different, simply using the RPC of the localnet. Please check the current query code and suggest how best to make it work.

@ptrus
Copy link
Member

ptrus commented Dec 20, 2025

Please check the current query code and suggest how best to make it work.

If we're connected to localnet, then we should be able to just propagate the queries to the localnet node. So in Go for example, you would just create a rpc client, and propagate the method name and the args to the RuntimeClient.Query method:

if err := a.rtc.Query(ctx, round, methodStorage, q, &res); err != nil {
return nil, err
}

Query(ctx context.Context, round uint64, method types.MethodName, args, rsp any) error

Implemented here:

func (rc *runtimeClient) Query(ctx context.Context, round uint64, method types.MethodName, args, rsp any) error {
raw, err := rc.cc.Query(ctx, &coreClient.QueryRequest{
RuntimeID: rc.runtimeID,
Round: round,
Method: string(method),
Args: cbor.Marshal(args),
})
if err != nil {
return err
}
if rsp != nil {
if err = cbor.UnmarshalRPC(raw.Data, rsp); err != nil {
return fmt.Errorf("failed to unmarshal response: %w", err)
}
}
return nil
}

(using oasis-core Go RPC client, which is implemented in https://github.com/oasisprotocol/oasis-core/blob/a94dc79ff188f55fa63b463175cd606facd0e944/go/runtime/client/api/grpc.go#L419-L442)

The only issue is that we likely don't have a Rust RPC client implemented yet anywhere.

I think it's fine for the initial version to return an error with unsupported/not implemented, and we only implement this if and when this is needed in practice.

If we need this quickly, the most pragmatic approach might be to build a small Go binary that accepts a command name and arguments, and invoke it from within the standalone mock appd client. This avoids having to build the missing Rust clients for this specific use case

@njelich njelich force-pushed the noah/rofl-appd-standalone branch from 71d4284 to 20c127d Compare December 31, 2025 14:05
.unwrap_or_else(|| "unix:/run/rofl-appd.sock".to_string());
let seed = env::args()
.nth(2)
.unwrap_or_else(|| "24b41929dc5bc3ec792f8792c7b7c32f".to_string());
Copy link
Member

Choose a reason for hiding this comment

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

Did you extract this seed from the existing mock SGX version of sapphire-localnet running a ROFL app?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is just a random seed for now, but it could be replaced.

Ok(())
}

/// Start the REST API server in mock mode
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we should add another /rofl-appd-mock package that wraps /rofl-appd so it's clear what code is used in production ROFLs and what is there for the Localnet testing?

@matevz
Copy link
Member

matevz commented Jan 7, 2026

Nice, I think we should also provide a docker image that runs the mock rofl-appd, so that rofl app developers can easily use it for testing. Could include it in the existing rofl-dev or a separate image only with the mock rofl-appd.

We could ship this as part of sapphre-localnet and enable it on port 8549, if there is ROFL detected (TDX-configured ROFL in the mounted rofls/rofl.yaml). I'm not sure if you can bind-mount unix sockets from docker to a host .

Related: https://docs.oasis.io/build/rofl/workflow/test#sgx-rofl

@matevz matevz self-assigned this Jan 27, 2026
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.

Make rofl-appd standalone executable

3 participants