You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In examples/token/main_native.rs we need to create a call-tape for our cross program calls. As part of that we need to specify sender and receiver of calls via their ProgramIdentifier. That ProgramIdentifier changes when you make any change to the guest programs, but we have hard-coded the identifiers.
To fix this, the native executable needs to get access to the guest executable, so it can determine its hash. We can do that via eg std::include_bytes like we do in circuits/tests/riscv_tests.rs or in examples-builder/build.rs.
The text was updated successfully, but these errors were encountered:
To facilitate this, i propose we eventually standardize our Cargo.toml format for guest programs. Having main_native.rs and main_mozak.rs in guest programs works - then we can (with some level of assurance) provide a functionality in the SDK to read the Cargo.toml, find such a pattern:
[[bin]]
name = "tokenbin"path = "main_mozak.rs"
If we find some main_mozak.rs, we know the accompanying name is the name of the mozakvm executable, which we can then hash to get its ProgramIdentifier.
Stopgap
One downside of the above approach is that this relies on the assumption of some organization of the Cargo.toml (though I suppose this is easily circumvented once we provide some external facing CLI functionality e.g. cargo mozak init, then we can alter the Cargo.toml on init.
We're early enough in development that we should probably not lock ourselves into any one approach. So for now we can have a single function in the sdk to simulate this for now:
In
examples/token/main_native.rs
we need to create a call-tape for our cross program calls. As part of that we need to specify sender and receiver of calls via theirProgramIdentifier
. ThatProgramIdentifier
changes when you make any change to the guest programs, but we have hard-coded the identifiers.To fix this, the native executable needs to get access to the guest executable, so it can determine its hash. We can do that via eg
std::include_bytes
like we do incircuits/tests/riscv_tests.rs
or inexamples-builder/build.rs
.The text was updated successfully, but these errors were encountered: