-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow applications to hold native tokens #2978
Merged
jvff
merged 58 commits into
linera-io:main
from
jvff:allow-applications-to-hold-native-tokens
Nov 28, 2024
Merged
Allow applications to hold native tokens #2978
jvff
merged 58 commits into
linera-io:main
from
jvff:allow-applications-to-hold-native-tokens
Nov 28, 2024
Conversation
This file contains 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
jvff
force-pushed
the
allow-applications-to-hold-native-tokens
branch
3 times, most recently
from
November 28, 2024 04:07
7b3f1bc
to
c39b71e
Compare
Allow applications to hold native tokens.
Allow requesting the balance of an application's account.
Update `ChainClient` methods to be able to query an application's balance.
Allow the runtime to request the balance of application accounts.
Prepare to update the WIT API to be able to query an application's balance.
Use `AccountOwner` as the parameter instead of `Owner`, in order to support application accounts.
Prepare to use the type in `SystemMessage`, which has `Hash` derived for it.
Prepare to change the runtime interface to use `AccountOwner`.
Prepare to change the runtime interface to use `AccountOwner`.
Update the SDK's runtime API to support querying an application's balance.
Prepare the `ServiceRuntime` to use an updated WIT interface that allows querying the balance of application accounts.
Allow the runtime to get a list the balances of application accounts.
Prepare to update the WIT API to be able to list application balances.
Return `AccountOwner` in order to include application accounts.
Include application balances in the result.
Prepare the `ServiceRuntime` to use an updated WIT interface that allows querying the balance of application accounts.
Allow the runtime to get a list the accounts including application accounts.
Prepare to update the WIT API to be able to list application accounts.
Return `AccountOwner` in order to include application accounts.
Include application accounts in the result.
Prepare to handle more than one colon in the input string.
jvff
force-pushed
the
allow-applications-to-hold-native-tokens
branch
from
November 28, 2024 04:28
c39b71e
to
a8e4d30
Compare
afck
approved these changes
Nov 28, 2024
Update `Account` to also represent application accounts.
Prevent excessive stack usage by nested futures.
Remove normalization of owners, and use `AccountOwner` directly.
Update the `balances` map to support applications.
Prepare to allow the helpers to be used by a new integration test module. Also, rename the test helpers for consistency.
Ensure that applications can transfer from their accounts, from the shared chain account, and from the signer's account.
Ensure that applications can claim from their accounts or from the signer account in remote chains.
Prepare to use it in property tests.
Ensure applications can read the chain balance.
Ensure applications can read the balances of individual accounts.
Ensure applications can read a list of all account balances.
Ensure applications can read a list of all accounts.
The system API should fallback and return zero in that case.
Ensure that execution fails with the appropriate error.
Ensure that execution fails with the appropriate error.
Allow tests to create a dummy context to test queries.
Ensure applications can read the chain balance.
Allow the helper function to be used in other tests.
Ensure applications can read the balances of individual accounts.
Ensure applications can read a list of all account balances.
Ensure applications can read a list of all accounts.
The system API should fallback and return zero in that case.
Simplify the code to generate the error. Co-authored-by: Andreas Fackler <[email protected]> Signed-off-by: Janito Vaqueiro Ferreira Filho <[email protected]>
The runtime API should be deterministic, so the returned lists of accounts must be sorted. Co-authored-by: Andreas Fackler <[email protected]> Signed-off-by: Janito Vaqueiro Ferreira Filho <[email protected]>
jvff
force-pushed
the
allow-applications-to-hold-native-tokens
branch
from
November 28, 2024 13:13
14b0638
to
49c439e
Compare
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
Applications may hold tokens from Fungible Token applications, however, they can't hold native tokens. This creates some incompatibility, and also makes it harder to support some scenarios, like automatic market makers using native tokens.
Proposal
Allow applications to hold native tokens, and to transfer them.
Update the on-chain
balances
to useAccountOwner
as its key, instead ofOwner
. This allows applications to have balances. Also updateAccount
to useAccountOwner
instead ofOwner
.Update the WIT interface so that the system APIs can transfer, claim and query application balances.
Test Plan
Unit tests were added to test the runtime APIs using application accounts.
Release Plan
Links