Skip to content

Commit 9cf38c1

Browse files
Make sure all fields in the GraphQL schema are documented (#4358)
## Motivation The GraphQL definitions are a little bit inconsistent. Here we correct them. Fixes #1308 ## Proposal The following changes are made: * Precising the role of the `ChainId`. For example, for `openChain`, a naive user may think that the input `chainId` is going to be the chain ID. * Removing the fact that chains are subscribed to epoch changes from the admin chain. I think this is not useful as it is an implementation detail. * Removing notes like "system API", which are not useful. * Remove "(or activates)" which is unclear to me and probably obsolete. * I added the EVM-relevant notes that occurred in a few places. ## Test Plan The CI should take care of the schema update. ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links None
1 parent 5351e36 commit 9cf38c1

File tree

4 files changed

+297
-68
lines changed

4 files changed

+297
-68
lines changed

linera-base/src/data_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,11 +943,11 @@ pub struct ApplicationPermissions {
943943
#[graphql(default)]
944944
#[debug(skip_if = Vec::is_empty)]
945945
pub mandatory_applications: Vec<ApplicationId>,
946-
/// These applications are allowed to close the current chain using the system API.
946+
/// These applications are allowed to close the current chain.
947947
#[graphql(default)]
948948
#[debug(skip_if = Vec::is_empty)]
949949
pub close_chain: Vec<ApplicationId>,
950-
/// These applications are allowed to change the application permissions using the system API.
950+
/// These applications are allowed to change the application permissions.
951951
#[graphql(default)]
952952
#[debug(skip_if = Vec::is_empty)]
953953
pub change_application_permissions: Vec<ApplicationId>,
@@ -1162,7 +1162,7 @@ pub enum DecompressionError {
11621162
InvalidCompressedBytecode(#[from] io::Error),
11631163
}
11641164

1165-
/// A compressed WebAssembly module's bytecode.
1165+
/// A compressed module bytecode (WebAssembly or EVM).
11661166
#[derive(Clone, Debug, Deserialize, Hash, Serialize, WitType, WitStore)]
11671167
#[cfg_attr(with_testing, derive(Eq, PartialEq))]
11681168
pub struct CompressedBytecode {
@@ -1533,7 +1533,7 @@ impl StreamUpdate {
15331533

15341534
impl BcsHashable<'_> for Event {}
15351535

1536-
doc_scalar!(Bytecode, "A WebAssembly module's bytecode");
1536+
doc_scalar!(Bytecode, "A module bytecode (WebAssembly or EVM)");
15371537
doc_scalar!(Amount, "A non-negative amount of tokens.");
15381538
doc_scalar!(
15391539
Epoch,

linera-base/src/identifiers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl From<CryptoHash> for AccountOwner {
9797
pub struct Account {
9898
/// The chain of the account.
9999
pub chain_id: ChainId,
100-
/// The owner of the account, or `None` for the chain balance.
100+
/// The owner of the account.
101101
pub owner: AccountOwner,
102102
}
103103

linera-service-graphql-client/gql/service_schema.graphql

Lines changed: 220 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ input Account {
77
"""
88
chainId: ChainId!
99
"""
10-
The owner of the account, or `None` for the chain balance.
10+
The owner of the account.
1111
"""
1212
owner: AccountOwner!
1313
}
@@ -21,7 +21,7 @@ type AccountOutput {
2121
"""
2222
chainId: ChainId!
2323
"""
24-
The owner of the account, or `None` for the chain balance.
24+
The owner of the account.
2525
"""
2626
owner: AccountOwner!
2727
}
@@ -68,11 +68,11 @@ input ApplicationPermissions {
6868
"""
6969
mandatoryApplications: [ApplicationId!]! = []
7070
"""
71-
These applications are allowed to close the current chain using the system API.
71+
These applications are allowed to close the current chain.
7272
"""
7373
closeChain: [ApplicationId!]! = []
7474
"""
75-
These applications are allowed to change the application permissions using the system API.
75+
These applications are allowed to change the application permissions.
7676
"""
7777
changeApplicationPermissions: [ApplicationId!]! = []
7878
"""
@@ -251,7 +251,7 @@ type BundleInInbox {
251251
}
252252

253253
"""
254-
A WebAssembly module's bytecode
254+
A module bytecode (WebAssembly or EVM)
255255
"""
256256
scalar Bytecode
257257

@@ -778,36 +778,119 @@ type MutationRoot {
778778
"""
779779
Processes the inbox and returns the lists of certificate hashes that were created, if any.
780780
"""
781-
processInbox(chainId: ChainId!): [CryptoHash!]!
781+
processInbox(
782+
"""
783+
The chain whose inbox is being processed.
784+
"""
785+
chainId: ChainId!
786+
): [CryptoHash!]!
782787
"""
783788
Retries the pending block that was unsuccessfully proposed earlier.
784789
"""
785-
retryPendingBlock(chainId: ChainId!): CryptoHash
790+
retryPendingBlock(
791+
"""
792+
The chain on whose block is being retried.
793+
"""
794+
chainId: ChainId!
795+
): CryptoHash
786796
"""
787797
Transfers `amount` units of value from the given owner's account to the recipient.
788798
If no owner is given, try to take the units out of the chain account.
789799
"""
790-
transfer(chainId: ChainId!, owner: AccountOwner!, recipient: Account!, amount: Amount!): CryptoHash!
800+
transfer(
801+
"""
802+
The chain which native tokens are being transferred from.
803+
"""
804+
chainId: ChainId!,
805+
"""
806+
The account being debited on the chain.
807+
"""
808+
owner: AccountOwner!,
809+
"""
810+
The recipient of the transfer.
811+
"""
812+
recipient: Account!,
813+
"""
814+
The amount being transferred.
815+
"""
816+
amount: Amount!
817+
): CryptoHash!
791818
"""
792819
Claims `amount` units of value from the given owner's account in the remote
793820
`target` chain. Depending on its configuration, the `target` chain may refuse to
794821
process the message.
795822
"""
796-
claim(chainId: ChainId!, owner: AccountOwner!, targetId: ChainId!, recipient: Account!, amount: Amount!): CryptoHash!
823+
claim(
824+
"""
825+
The chain for whom owner is one of the owner.
826+
"""
827+
chainId: ChainId!,
828+
"""
829+
The owner of chain targetId being debited.
830+
"""
831+
owner: AccountOwner!,
832+
"""
833+
The chain whose owner is being debited.
834+
"""
835+
targetId: ChainId!,
836+
"""
837+
The recipient of the transfer.
838+
"""
839+
recipient: Account!,
840+
"""
841+
The amount being transferred.
842+
"""
843+
amount: Amount!
844+
): CryptoHash!
797845
"""
798846
Test if a data blob is readable from a transaction in the current chain.
799847
"""
800848
readDataBlob(chainId: ChainId!, hash: CryptoHash!): CryptoHash!
801849
"""
802-
Creates (or activates) a new chain with the given owner.
803-
This will automatically subscribe to the future committees created by `admin_id`.
850+
Creates a new single-owner chain.
804851
"""
805-
openChain(chainId: ChainId!, owner: AccountOwner!, balance: Amount): ChainId!
852+
openChain(
853+
"""
854+
The chain paying for the creation of the new chain.
855+
"""
856+
chainId: ChainId!,
857+
"""
858+
The owner of the new chain.
859+
"""
860+
owner: AccountOwner!,
861+
"""
862+
The balance of the chain being created. Zero if `None`.
863+
"""
864+
balance: Amount
865+
): ChainId!
806866
"""
807-
Creates (or activates) a new chain by installing the given authentication keys.
808-
This will automatically subscribe to the future committees created by `admin_id`.
867+
Creates a new multi-owner chain.
809868
"""
810-
openMultiOwnerChain( chainId: ChainId!, applicationPermissions: ApplicationPermissions, owners: [AccountOwner!]!, weights: [Int!], multiLeaderRounds: Int, balance: Amount,
869+
openMultiOwnerChain(
870+
"""
871+
The chain paying for the creation of the new chain.
872+
"""
873+
chainId: ChainId!,
874+
"""
875+
Permissions for applications on the new chain
876+
"""
877+
applicationPermissions: ApplicationPermissions,
878+
"""
879+
The owners of the chain
880+
"""
881+
owners: [AccountOwner!]!,
882+
"""
883+
The weights of the owners
884+
"""
885+
weights: [Int!],
886+
"""
887+
The number of multi-leader rounds
888+
"""
889+
multiLeaderRounds: Int,
890+
"""
891+
The balance of the chain. Zero if `None`
892+
"""
893+
balance: Amount,
811894
"""
812895
The duration of the fast round, in milliseconds; default: no timeout
813896
"""
@@ -826,17 +909,51 @@ type MutationRoot {
826909
fallbackDurationMs: Int! = 86400000
827910
): ChainId!
828911
"""
829-
Closes the chain. Returns `None` if it was already closed.
912+
Closes the chain. Returns the new block hash if successful or `None` if it was already closed.
830913
"""
831-
closeChain(chainId: ChainId!): CryptoHash
914+
closeChain(
915+
"""
916+
The chain being closed.
917+
"""
918+
chainId: ChainId!
919+
): CryptoHash
832920
"""
833-
Changes the authentication key of the chain.
921+
Changes the chain to a single-owner chain
834922
"""
835-
changeOwner(chainId: ChainId!, newOwner: AccountOwner!): CryptoHash!
923+
changeOwner(
924+
"""
925+
The chain whose ownership changes
926+
"""
927+
chainId: ChainId!,
928+
"""
929+
The new single owner of the chain
930+
"""
931+
newOwner: AccountOwner!
932+
): CryptoHash!
836933
"""
837-
Changes the authentication key of the chain.
934+
Changes the ownership of the chain
838935
"""
839-
changeMultipleOwners( chainId: ChainId!, newOwners: [AccountOwner!]!, newWeights: [Int!]!, multiLeaderRounds: Int!, openMultiLeaderRounds: Boolean!,
936+
changeMultipleOwners(
937+
"""
938+
The chain whose ownership changes
939+
"""
940+
chainId: ChainId!,
941+
"""
942+
The new list of owners of the chain
943+
"""
944+
newOwners: [AccountOwner!]!,
945+
"""
946+
The new list of weights of the owners
947+
"""
948+
newWeights: [Int!]!,
949+
"""
950+
The multi-leader round of the chain
951+
"""
952+
multiLeaderRounds: Int!,
953+
"""
954+
Whether multi-leader rounds are unrestricted, that is not limited to chain owners.
955+
"""
956+
openMultiLeaderRounds: Boolean!,
840957
"""
841958
The duration of the fast round, in milliseconds; default: no timeout
842959
"""
@@ -857,7 +974,38 @@ type MutationRoot {
857974
"""
858975
Changes the application permissions configuration on this chain.
859976
"""
860-
changeApplicationPermissions(chainId: ChainId!, closeChain: [ApplicationId!]!, executeOperations: [ApplicationId!], mandatoryApplications: [ApplicationId!]!, changeApplicationPermissions: [ApplicationId!]!, callServiceAsOracle: [ApplicationId!], makeHttpRequests: [ApplicationId!]): CryptoHash!
977+
changeApplicationPermissions(
978+
"""
979+
The chain whose permissions are being changed
980+
"""
981+
chainId: ChainId!,
982+
"""
983+
These applications are allowed to close the current chain.
984+
"""
985+
closeChain: [ApplicationId!]!,
986+
"""
987+
If this is `None`, all system operations and application operations are allowed.
988+
If it is `Some`, only operations from the specified applications are allowed,
989+
and no system operations.
990+
"""
991+
executeOperations: [ApplicationId!],
992+
"""
993+
At least one operation or incoming message from each of these applications must occur in every block.
994+
"""
995+
mandatoryApplications: [ApplicationId!]!,
996+
"""
997+
These applications are allowed to change the application permissions.
998+
"""
999+
changeApplicationPermissions: [ApplicationId!]!,
1000+
"""
1001+
These applications are allowed to perform calls to services as oracles.
1002+
"""
1003+
callServiceAsOracle: [ApplicationId!],
1004+
"""
1005+
These applications are allowed to perform HTTP requests.
1006+
"""
1007+
makeHttpRequests: [ApplicationId!]
1008+
): CryptoHash!
8611009
"""
8621010
(admin chain only) Registers a new committee. This will notify the subscribers of
8631011
the admin chain so that they can migrate to the new epoch (by accepting the
@@ -873,15 +1021,62 @@ type MutationRoot {
8731021
"""
8741022
Publishes a new application module.
8751023
"""
876-
publishModule(chainId: ChainId!, contract: Bytecode!, service: Bytecode!, vmRuntime: VmRuntime!): ModuleId!
1024+
publishModule(
1025+
"""
1026+
The chain publishing the module
1027+
"""
1028+
chainId: ChainId!,
1029+
"""
1030+
The bytecode of the contract code
1031+
"""
1032+
contract: Bytecode!,
1033+
"""
1034+
The bytecode of the service code (only relevant for WebAssembly)
1035+
"""
1036+
service: Bytecode!,
1037+
"""
1038+
The virtual machine being used (either Wasm or Evm)
1039+
"""
1040+
vmRuntime: VmRuntime!
1041+
): ModuleId!
8771042
"""
8781043
Publishes a new data blob.
8791044
"""
880-
publishDataBlob(chainId: ChainId!, bytes: [Int!]!): CryptoHash!
1045+
publishDataBlob(
1046+
"""
1047+
The chain paying for the blob publication
1048+
"""
1049+
chainId: ChainId!,
1050+
"""
1051+
The content of the data blob being created
1052+
"""
1053+
bytes: [Int!]!
1054+
): CryptoHash!
8811055
"""
8821056
Creates a new application.
8831057
"""
884-
createApplication(chainId: ChainId!, moduleId: ModuleId!, parameters: String!, instantiationArgument: String!, requiredApplicationIds: [ApplicationId!]!): ApplicationId!
1058+
createApplication(
1059+
"""
1060+
The chain paying for the creation of the application
1061+
"""
1062+
chainId: ChainId!,
1063+
"""
1064+
The module ID of the application being created
1065+
"""
1066+
moduleId: ModuleId!,
1067+
"""
1068+
The JSON serialization of the parameters of the application
1069+
"""
1070+
parameters: String!,
1071+
"""
1072+
The JSON serialization of the instantiation argument of the application
1073+
"""
1074+
instantiationArgument: String!,
1075+
"""
1076+
The dependencies of the application being created
1077+
"""
1078+
requiredApplicationIds: [ApplicationId!]!
1079+
): ApplicationId!
8851080
}
8861081

8871082
"""

0 commit comments

Comments
 (0)