Implement native-fungible natively.#6256
Open
MathieuDutSik wants to merge 17 commits into
Open
Conversation
c47f5cc to
79a6d65
Compare
b1ba5e4 to
f83fe17
Compare
ma2bd
reviewed
May 8, 2026
| /// How an application is implemented: either a published module (Wasm/EVM bytecode), or a | ||
| /// runtime-native application that needs no bytecode. | ||
| #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Hash, Serialize, WitType, WitLoad, WitStore)] | ||
| pub enum ApplicationKind { |
Contributor
There was a problem hiding this comment.
I was hoping we wouldn't have to do that given that we already have the VM enum.
Contributor
Author
There was a problem hiding this comment.
Three points:
-
From a logical standpoint I think this is the right design since Native applications are qualitatively different from Wasm/Revm based ones.
-
But yes of course, if we want compatibility with testnet_conway this is a problem.
-
I think we can support all Wasm/Evm/Native at the same level. After all there is little that cannot be solved by some programming.
Contributor
Author
There was a problem hiding this comment.
See #6269 that demonstrates the concept.
Though more care would be needed to make it work. Also, there are some issues of web compatibility that would have to be carefully considered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Issue #4416 that is being considered here is about authentication. We have one authentication going on in
native-fungiblecontract code:This one is done with the
authenticated_caller_idbeing equal to the contract that was calling it.This is followed in the function
fn transferoflinera-execution/src/system.rsby the following:It looks the same, but it is not: The authenticated caller ID in question is this time the one of the native-fungible contract.
This means that we cannot expect the native-fungible to behave in a way identical to the fungible contract, despite them having the same API. As a practical example, we cannot use
crowd-fundingwithnative-fungible.In the killed PR #5649, it was proposed to expose the stack to the caller who would then be able to select the level of authentication. The problem with this approach is that it exposes us to all kind of possible scenario and complexifies the work of the programmer.
Fixes #4416
Proposal
Implement the
native-fungibleas an application native tolinera. So, now we have applications that areWasm, applications that areEvm, and native ones.This is simply a continuation of existing software trends:
native-fungibleis anyway having its state in the entriesbalancesandallowancesof theChainStateView.Note that we are still forced to expose some of the stack. But this is done in
linera-executionand the functionality are not exposed to thelinera-sdk.Test Plan
CI and add a few tests.
Release Plan
It cannot be backported to
testnet_conway.Links
None