Skip to content

feat: add starstream-runtime-next#150

Merged
rvolosatovs merged 5 commits into
LFDT-Nightstream:mainfrom
rvolosatovs:feat/runtime-next
Jun 23, 2026
Merged

feat: add starstream-runtime-next#150
rvolosatovs merged 5 commits into
LFDT-Nightstream:mainfrom
rvolosatovs:feat/runtime-next

Conversation

@rvolosatovs

@rvolosatovs rvolosatovs commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Migrate the runtime crate from https://github.com/rvolosatovs/starstream-run/

This requires a git rev of Wasmtime and will continue to do so until Wasmtime 47 release, i.e. ~1 month, so for now introduce a custom Wasmtime version (and related tooling) only for this crate

This will be used by the website sandbox (#142 ) as well as the mock-ledger.

This PR also adds an examples dir with the score example I've been using for testing. That example is now compiled to Wasm and available via test-contracts crate.

Blocked on #149

@rvolosatovs rvolosatovs force-pushed the feat/runtime-next branch 5 times, most recently from d59fed7 to cff5d85 Compare June 17, 2026 11:54
@rvolosatovs rvolosatovs force-pushed the feat/runtime-next branch 3 times, most recently from 9f53d22 to 9f9babf Compare June 17, 2026 13:02
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs marked this pull request as ready for review June 17, 2026 16:40
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

@ecioppettini ecioppettini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm fine merging this as it is. I left some comments, but they are not super important and I may be wrong, so feel free to ignore them.

Comment thread starstream-runtime-next/tests/score.rs Outdated
Comment on lines +91 to +96
let mut constructor_exports = contract.utxo_constructors(&utxo);
let new = match (constructor_exports.next(), constructor_exports.next()) {
(Some(("[static]utxo.new", Ok(new))), None) => new,
exports => bail!("unexpected UTXO constructor exports: {exports:?}"),
};
drop(constructor_exports);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe use a block instead of drop? but this is fine anyway, just nitpicking

Comment thread starstream-runtime-next/tests/score.rs Outdated
Comment on lines +45 to +70
const METHODS: [(u64, u64, u64, u64); 4] = [
(
9984741223472054651,
3777191895585416912,
11414430493733454782,
17853027721887758589,
),
(
10031671596645923877,
5859691412821126436,
14636224297006305312,
18400238348769808647,
),
(
10486967187806387020,
13073113330981563051,
14419176846782403470,
15804774841702521566,
),
(
5384737671178596162,
7822374597054249491,
11449494298339117153,
15762863519083182186,
),
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess hard-coding these is fine for now? These could be computed though, although in the future the hash function will probably change (and the thing that we hash), so maybe not worth it here.

Comment thread test-contracts/Cargo.toml Outdated
@@ -0,0 +1,27 @@
# Compiles the example Starstream contracts under `examples/` (via the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not entirely convinced this crate is necessary, over just calling the compiler directly in the test (maybe as a dev-dependency). Especially because on the sandbox that's what needs to happen anyway, right?

And I would imagine compiling a small contract is quite fast anyway.

But I also don't feel that strongly about this.

Comment thread starstream-runtime-next/src/lib.rs Outdated
if set_resource_ty != resource_ty {
bail!("`set-storage` resource type does not match UTXO resource type");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I find this block slightly hard to read, but also I don't know how to improve it, so maybe that's just me. Maybe making it a named function? or something that tells you what is it doing? I don't know

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs requested a review from ecioppettini June 23, 2026 16:51
[features]
async = ["wasmtime/async", "wasmtime/debug"]
trace = ["async"]
#wasmtime-custom-fiber = ["wasmtime/custom-fiber"] # TODO: Update wasmtime and uncomment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this intentional, btw?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rvolosatovs rvolosatovs merged commit 56e445a into LFDT-Nightstream:main Jun 23, 2026
3 checks passed
@rvolosatovs rvolosatovs deleted the feat/runtime-next branch June 23, 2026 17:17
rvolosatovs added a commit to rvolosatovs/Starstream that referenced this pull request Jun 23, 2026
Add a Run tab to the website sandbox: a long-lived run worker drives the
compiled contract through deploy → construct UTXOs → call methods, with
storage and event views.

Built on `starstream-runtime-next` (LFDT-Nightstream#150); the sandbox is pinned to the
exact Wasmtime rev that crate uses so their `Utxo`/`bindings`/`Val` types
unify into one `wasmtime` instance.

Assisted-by: anthropic:claude-opus-4-8
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
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.

2 participants