Skip to content

Commit

Permalink
fuel-core v0.13 upgrade (#3181)
Browse files Browse the repository at this point in the history
- $rB on state opcodes is now used as a flag for whether the storage
slot was previously set
- $rD on quad word state opcodes is reserved for use as accessing a
range of slots (currently hardcoded to 1)


Closes #3159
Closes #2115 (the dependency is
on `sway-core` now)

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: green <xgreenx9999@gmail.com>
  • Loading branch information
3 people authored Nov 2, 2022
1 parent b0f05c4 commit 11496e6
Show file tree
Hide file tree
Showing 43 changed files with 399 additions and 251 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ jobs:
runs-on: ubuntu-latest
services:
fuel-core:
image: ghcr.io/fuellabs/fuel-core:v0.11.2
image: ghcr.io/fuellabs/fuel-core:v0.13.2
ports:
- 4000:4000
steps:
Expand All @@ -260,11 +260,6 @@ jobs:
# TODO: Remove this upon merging std tests with the rest of the E2E tests.
cargo-test-lib-std:
runs-on: ubuntu-latest
services:
fuel-core:
image: ghcr.io/fuellabs/fuel-core:v0.11.2
ports:
- 4000:4000
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand All @@ -278,7 +273,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ./test/src/sdk-harness/Cargo.toml -- --test-threads=1 --nocapture
args: --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture

cargo-test-workspace:
runs-on: ubuntu-latest
Expand Down
110 changes: 77 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions forc-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ description = "Building, locking, fetching and updating Sway projects as Forc pa
anyhow = "1"
forc-tracing = { version = "0.29.0", path = "../forc-tracing" }
forc-util = { version = "0.29.0", path = "../forc-util" }
fuel-crypto = "0.6"
fuel-tx = { version = "0.20", features = ["serde"] }
git2 = { version = "0.14", features = ["vendored-libgit2", "vendored-openssl"] }
hex = "0.4.3"
petgraph = { version = "0.6", features = ["serde-1"] }
Expand Down
5 changes: 4 additions & 1 deletion forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use forc_util::{
default_output_directory, find_file_name, git_checkouts_directory, kebab_to_snake_case,
print_on_failure, print_on_success, print_on_success_library,
};
use fuel_tx::{Contract, ContractId, StorageSlot};
use petgraph::{
self,
visit::{Bfs, Dfs, EdgeRef, Walker},
Expand All @@ -26,6 +25,10 @@ use std::{
path::{Path, PathBuf},
str::FromStr,
};
use sway_core::fuel_prelude::{
fuel_crypto,
fuel_tx::{self, Contract, ContractId, StorageSlot},
};
use sway_core::{
language::{
parsed::{ParseProgram, TreeType},
Expand Down
12 changes: 5 additions & 7 deletions forc-plugins/forc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ clap = { version = "3", features = ["derive", "env"] }
forc-pkg = { version = "0.29.0", path = "../../forc-pkg" }
forc-tracing = { version = "0.29.0", path = "../../forc-tracing" }
forc-util = { version = "0.29.0", path = "../../forc-util" }
fuel-crypto = "0.6"
fuel-gql-client = { version = "0.11", default-features = false }
fuel-tx = { version = "0.20", features = ["builder"] }
fuel-vm = "0.18"
fuels-core = "0.27"
fuels-signers = "0.27"
fuels-types = "0.27"
fuel-gql-client = { version = "0.13", default-features = false }
fuel-tx = { version = "0.23", features = ["builder"] }
fuels-core = "0.28"
fuels-signers = "0.28"
fuels-types = "0.28"
futures = "0.3"
hex = "0.4.3"
serde = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/ops/deploy/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use fuel_crypto::SecretKey;
use fuel_gql_client::fuel_crypto::SecretKey;

#[derive(Debug, Default, Parser)]
#[clap(bin_name = "forc deploy", version)]
Expand Down
54 changes: 43 additions & 11 deletions forc-plugins/forc-client/src/ops/deploy/op.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
use anyhow::{bail, Result};
use anyhow::{bail, Context, Result};
use forc_pkg::{self as pkg, PackageManifestFile};
use fuel_gql_client::client::FuelClient;
use fuel_tx::{Output, Salt, TransactionBuilder};
use fuel_vm::prelude::*;
use fuel_gql_client::client::types::TransactionStatus;
use fuel_gql_client::{
client::FuelClient,
fuel_tx::{Output, Salt, TransactionBuilder},
fuel_vm::prelude::*,
};
use futures::FutureExt;
use std::path::PathBuf;
use std::time::Duration;
use sway_core::language::parsed::TreeType;
use sway_utils::constants::DEFAULT_NODE_URL;
use tracing::info;

use crate::ops::tx_util::{TransactionBuilderExt, TxParameters};
use crate::ops::tx_util::{TransactionBuilderExt, TxParameters, TX_SUBMIT_TIMEOUT_MS};

use super::cmd::DeployCommand;

Expand Down Expand Up @@ -46,13 +51,40 @@ pub async fn deploy(command: DeployCommand) -> Result<fuel_tx::ContractId> {
.finalize_signed(client.clone(), command.unsigned, command.signing_key)
.await?;

match client.submit(&tx).await {
Ok(logs) => {
info!("Logs:\n{:?}", logs);
Ok(contract_id)
}
let tx = Transaction::from(tx);

let deployment_request = client.submit_and_await_commit(&tx).map(|res| match res {
Ok(logs) => match logs {
TransactionStatus::Submitted { .. } => {
bail!("contract {} deployment timed out", &contract_id);
}
TransactionStatus::Success { block_id, .. } => {
info!("contract {} deployed in block {}", &contract_id, &block_id);
Ok(contract_id)
}
TransactionStatus::Failure { reason, .. } => {
bail!(
"contract {} failed to deploy due to an error: {}",
&contract_id,
reason
)
}
},
Err(e) => bail!("{e}"),
}
});

// submit contract deployment with a timeout
tokio::time::timeout(
Duration::from_millis(TX_SUBMIT_TIMEOUT_MS),
deployment_request,
)
.await
.with_context(|| {
format!(
"Timed out waiting for contract {} to deploy. The transaction may have been dropped.",
&contract_id
)
})?
}

fn build_opts_from_cmd(cmd: &DeployCommand) -> pkg::BuildOpts {
Expand Down
Loading

0 comments on commit 11496e6

Please sign in to comment.