feat: add starstream-runtime-next#150
Conversation
d59fed7 to
cff5d85
Compare
9f53d22 to
9f9babf
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
9f9babf to
cde1f49
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
cde1f49 to
56e86fc
Compare
ecioppettini
left a comment
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
maybe use a block instead of drop? but this is fine anyway, just nitpicking
| const METHODS: [(u64, u64, u64, u64); 4] = [ | ||
| ( | ||
| 9984741223472054651, | ||
| 3777191895585416912, | ||
| 11414430493733454782, | ||
| 17853027721887758589, | ||
| ), | ||
| ( | ||
| 10031671596645923877, | ||
| 5859691412821126436, | ||
| 14636224297006305312, | ||
| 18400238348769808647, | ||
| ), | ||
| ( | ||
| 10486967187806387020, | ||
| 13073113330981563051, | ||
| 14419176846782403470, | ||
| 15804774841702521566, | ||
| ), | ||
| ( | ||
| 5384737671178596162, | ||
| 7822374597054249491, | ||
| 11449494298339117153, | ||
| 15762863519083182186, | ||
| ), | ||
| ]; |
There was a problem hiding this comment.
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.
| @@ -0,0 +1,27 @@ | |||
| # Compiles the example Starstream contracts under `examples/` (via the | |||
There was a problem hiding this comment.
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.
| if set_resource_ty != resource_ty { | ||
| bail!("`set-storage` resource type does not match UTXO resource type"); | ||
| } | ||
|
|
There was a problem hiding this comment.
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>
| [features] | ||
| async = ["wasmtime/async", "wasmtime/debug"] | ||
| trace = ["async"] | ||
| #wasmtime-custom-fiber = ["wasmtime/custom-fiber"] # TODO: Update wasmtime and uncomment |
There was a problem hiding this comment.
is this intentional, btw?
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>
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
examplesdir with the score example I've been using for testing. That example is now compiled to Wasm and available viatest-contractscrate.Blocked on #149