Skip to content
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

Handle the avalanche of breaking spec changes in fuel-core #510

Merged
merged 2 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
523 changes: 266 additions & 257 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fuel-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ chrono = { version = "0.4", features = ["serde"] }
clap = { version = "3.1", features = ["derive"] }
cynic = { version = "1.0", features = ["surf"] }
derive_more = { version = "0.99" }
fuel-tx = { version = "0.13", features = ["serde"] }
fuel-tx = { version = "0.16", features = ["serde"] }
fuel-types = { version = "0.5", features = ["serde"] }
fuel-vm = { version = "0.12", features = ["serde"] }
fuel-vm = { version = "0.13", features = ["serde"] }
futures = "0.3"
hex = "0.4"
itertools = "0.10"
Expand Down
72 changes: 55 additions & 17 deletions fuel-client/assets/schema.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ type BalanceConnection {
A list of edges.
"""
edges: [BalanceEdge!]!
"""
A list of nodes.
"""
nodes: [Balance!]!
}

"""
Expand All @@ -28,7 +32,7 @@ type BalanceEdge {
"""
cursor: String!
"""
"The item at the end of the edge
The item at the end of the edge
"""
node: Balance!
}
Expand Down Expand Up @@ -57,6 +61,10 @@ type BlockConnection {
A list of edges.
"""
edges: [BlockEdge!]!
"""
A list of nodes.
"""
nodes: [Block!]!
}

"""
Expand All @@ -68,7 +76,7 @@ type BlockEdge {
"""
cursor: String!
"""
"The item at the end of the edge
The item at the end of the edge
"""
node: Block!
}
Expand Down Expand Up @@ -116,6 +124,10 @@ type CoinConnection {
A list of edges.
"""
edges: [CoinEdge!]!
"""
A list of nodes.
"""
nodes: [Coin!]!
}

"""
Expand All @@ -127,7 +139,7 @@ type CoinEdge {
"""
cursor: String!
"""
"The item at the end of the edge
The item at the end of the edge
"""
node: Coin!
}
Expand Down Expand Up @@ -162,11 +174,12 @@ type ConsensusParameters {
maxGasPerTx: U64!
maxScriptLength: U64!
maxScriptDataLength: U64!
maxStaticContracts: U64!
maxStorageSlots: U64!
maxPredicateLength: U64!
maxPredicateDataLength: U64!
gasPriceFactor: U64!
gasPerByte: U64!
maxMessageDataLength: U64!
}

type Contract {
Expand All @@ -190,6 +203,10 @@ type ContractBalanceConnection {
A list of edges.
"""
edges: [ContractBalanceEdge!]!
"""
A list of nodes.
"""
nodes: [ContractBalance!]!
}

"""
Expand All @@ -201,7 +218,7 @@ type ContractBalanceEdge {
"""
cursor: String!
"""
"The item at the end of the edge
The item at the end of the edge
"""
node: ContractBalance!
}
Expand Down Expand Up @@ -244,7 +261,7 @@ type FailureStatus {
scalar HexString


union Input = | InputCoin | InputContract
union Input = InputCoin | InputContract | InputMessage

type InputCoin {
utxoId: UtxoId!
Expand All @@ -264,6 +281,26 @@ type InputContract {
contract: Contract!
}

type InputMessage {
messageId: MessageId!
sender: Address!
recipient: Address!
amount: U64!
nonce: U64!
owner: Address!
witnessIndex: Int!
data: HexString!
predicate: HexString!
predicateData: HexString!
}


scalar MessageId

type MessageOutput {
recipient: Address!
amount: U64!
}

type Mutation {
startSession: ID!
Expand Down Expand Up @@ -296,7 +333,7 @@ type NodeInfo {
nodeVersion: String!
}

union Output = | CoinOutput | ContractOutput | WithdrawalOutput | ChangeOutput | VariableOutput | ContractCreated
union Output = CoinOutput | ContractOutput | MessageOutput | ChangeOutput | VariableOutput | ContractCreated

"""
A separate `Breakpoint` type to be used as an output, as a single
Expand Down Expand Up @@ -389,6 +426,10 @@ type Receipt {
result: U64
gasUsed: U64
data: HexString
messageId: MessageId
sender: Address
recipient: Address
nonce: Bytes32
}

enum ReceiptType {
Expand All @@ -402,6 +443,7 @@ enum ReceiptType {
TRANSFER
TRANSFER_OUT
SCRIPT_RESULT
MESSAGE_OUT
}

enum ReturnType {
Expand Down Expand Up @@ -451,7 +493,6 @@ type Transaction {
inputContracts: [Contract!]!
gasPrice: U64!
gasLimit: U64!
bytePrice: U64!
maturity: U64!
isScript: Boolean!
inputs: [Input!]!
Expand All @@ -465,7 +506,6 @@ type Transaction {
bytecodeWitnessIndex: Int
bytecodeLength: U64
salt: Salt
staticContracts: [Contract!]
storageSlots: [HexString!]
"""
Return the transaction bytes using canonical encoding
Expand All @@ -482,6 +522,10 @@ type TransactionConnection {
A list of edges.
"""
edges: [TransactionEdge!]!
"""
A list of nodes.
"""
nodes: [Transaction!]!
}

"""
Expand All @@ -493,14 +537,14 @@ type TransactionEdge {
"""
cursor: String!
"""
"The item at the end of the edge
The item at the end of the edge
"""
node: Transaction!
}

scalar TransactionId

union TransactionStatus = | SubmittedStatus | SuccessStatus | FailureStatus
union TransactionStatus = SubmittedStatus | SuccessStatus | FailureStatus

scalar U64

Expand All @@ -512,12 +556,6 @@ type VariableOutput {
assetId: AssetId!
}

type WithdrawalOutput {
to: Address!
amount: U64!
assetId: AssetId!
}

schema {
query: Query
mutation: Mutation
Expand Down
6 changes: 4 additions & 2 deletions fuel-client/src/client/schema/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ pub struct ConsensusParameters {
pub max_gas_per_tx: U64,
pub max_script_length: U64,
pub max_script_data_length: U64,
pub max_static_contracts: U64,
pub max_storage_slots: U64,
pub max_predicate_length: U64,
pub max_predicate_data_length: U64,
pub gas_price_factor: U64,
pub gas_per_byte: U64,
pub max_message_data_length: U64,
}

impl From<ConsensusParameters> for TxConsensusParameters {
Expand All @@ -28,11 +29,12 @@ impl From<ConsensusParameters> for TxConsensusParameters {
max_gas_per_tx: params.max_gas_per_tx.into(),
max_script_length: params.max_script_length.into(),
max_script_data_length: params.max_script_data_length.into(),
max_static_contracts: params.max_static_contracts.into(),
max_storage_slots: params.max_storage_slots.into(),
max_predicate_length: params.max_predicate_length.into(),
max_predicate_data_length: params.max_predicate_data_length.into(),
gas_price_factor: params.gas_price_factor.into(),
gas_per_byte: params.gas_per_byte.into(),
max_message_data_length: params.max_message_data_length.into(),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions fuel-client/src/client/schema/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fuel_type_scalar!(AssetId, AssetId);
fuel_type_scalar!(ContractId, ContractId);
fuel_type_scalar!(Salt, Salt);
fuel_type_scalar!(TransactionId, Bytes32);
fuel_type_scalar!(MessageId, MessageId);

#[derive(cynic::Scalar, Debug, Clone, Default)]
pub struct UtxoId(pub HexFormatted<fuel_tx::UtxoId>);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: fuel-client/src/client/schema/chain.rs
assertion_line: 64
assertion_line: 66
expression: operation.query
---
query Query {
Expand All @@ -25,11 +25,12 @@ query Query {
maxGasPerTx
maxScriptLength
maxScriptDataLength
maxStaticContracts
maxStorageSlots
maxPredicateLength
maxPredicateDataLength
gasPriceFactor
gasPerByte
maxMessageDataLength
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
source: fuel-client/src/client/schema/tx.rs
assertion_line: 273
assertion_line: 275
expression: operation.query

---
query Query($_0: TransactionId!) {
transaction(id: $_0) {
gasLimit
gasPrice
bytePrice
id
inputAssetIds
inputContracts {
Expand All @@ -34,6 +32,18 @@ query Query($_0: TransactionId!) {
id
}
}
... on InputMessage {
messageId
sender
recipient
amount
nonce
owner
witnessIndex
data
predicate
predicateData
}
}
isScript
outputs {
Expand All @@ -48,10 +58,9 @@ query Query($_0: TransactionId!) {
balanceRoot
stateRoot
}
... on WithdrawalOutput {
to
... on MessageOutput {
recipient
amount
assetId
}
... on ChangeOutput {
to
Expand Down Expand Up @@ -128,13 +137,14 @@ query Query($_0: TransactionId!) {
result
gasUsed
data
messageId
sender
recipient
nonce
}
script
scriptData
salt
staticContracts {
id
}
storageSlots
bytecodeWitnessIndex
bytecodeLength
Expand Down
Loading