Skip to content

Commit

Permalink
merge 0.67.0-dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e committed Nov 11, 2024
2 parents e93885c + d7273e3 commit 51b259a
Show file tree
Hide file tree
Showing 54 changed files with 2,160 additions and 304 deletions.
77 changes: 57 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ env:
CARGO_TERM_COLOR: always
DASEL_VERSION: https://github.com/TomWright/dasel/releases/download/v2.3.6/dasel_linux_amd64
RUSTFLAGS: "-D warnings"
FUEL_CORE_VERSION: 0.36.0
FUEL_CORE_VERSION: 0.40.0
FUEL_CORE_PATCH_BRANCH: ""
FUEL_CORE_PATCH_REVISION: ""
RUST_VERSION: 1.79.0
FORC_VERSION: 0.63.3
FORC_VERSION: 0.65.2
FORC_PATCH_BRANCH: ""
FORC_PATCH_REVISION: ""
NEXTEST_HIDE_PROGRESS_BAR: "true"
NEXTEST_STATUS_LEVEL: "fail"

jobs:
setup-test-projects:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install toolchain
Expand All @@ -36,7 +37,7 @@ jobs:
toolchain: ${{ env.RUST_VERSION }}
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2.7.3
- uses: buildjet/cache@v3
with:
prefix-key: "v1-rust"

Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:
e2e/sway/**/out/*
get-workspace-members:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
outputs:
members: ${{ steps.set-members.outputs.members }}
steps:
Expand All @@ -87,7 +88,7 @@ jobs:
echo "members=$members" >> $GITHUB_OUTPUT
verify-rust-version:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
# Ensure CI is using the same minimum toolchain specified in fuels Cargo.toml
Expand All @@ -99,9 +100,45 @@ jobs:
echo "Comparing minimum supported toolchain ($MIN_VERSION) with ci toolchain (RUST_VERSION)"
test "$MIN_VERSION" == "$RUST_VERSION"
# Fetch Fuel Core and upload as artifact, useful when we build the core from a
# revision so that we can repeat flaky tests without rebuilding the core.
fetch-fuel-core:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown

# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: buildjet/cache@v3
continue-on-error: true
with:
key: "fuel-core-build"
- name: Install Fuel Core
run: |
if [[ -n $FUEL_CORE_PATCH_BRANCH ]]; then
cargo install --locked fuel-core-bin --git https://github.com/FuelLabs/fuel-core --branch "$FUEL_CORE_PATCH_BRANCH" --root fuel-core-install
elif [[ -n $FUEL_CORE_PATCH_REVISION ]]; then
cargo install --locked fuel-core-bin --git https://github.com/FuelLabs/fuel-core --rev "$FUEL_CORE_PATCH_REVISION" --root fuel-core-install
else
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ env.FUEL_CORE_VERSION }}/fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu.tar.gz -L -o fuel-core.tar.gz
tar -xvf fuel-core.tar.gz
chmod +x fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core
mkdir -p fuel-core-install/bin
mv fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core fuel-core-install/bin/fuel-core
fi
- uses: actions/upload-artifact@v4
with:
name: fuel-core
path: fuel-core-install/bin/fuel-core

# Ensure workspace is publishable
publish-crates-check:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -123,7 +160,8 @@ jobs:
- verify-rust-version
- get-workspace-members
- publish-crates-check
runs-on: ubuntu-latest
- fetch-fuel-core
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
matrix:
cargo_command: [check]
Expand All @@ -136,11 +174,11 @@ jobs:
args: --all-targets
download_sway_artifacts: sway-examples
- cargo_command: nextest
args: run --all-targets --features "default fuel-core-lib coin-cache" --workspace --cargo-quiet
args: run --all-targets --features "default fuel-core-lib coin-cache" --workspace --cargo-quiet --no-fail-fast
download_sway_artifacts: sway-examples
install_fuel_core: true
- cargo_command: nextest
args: run --all-targets --workspace --cargo-quiet
args: run --all-targets --workspace --cargo-quiet --no-fail-fast
download_sway_artifacts: sway-examples
install_fuel_core: true
- cargo_command: test
Expand Down Expand Up @@ -170,22 +208,21 @@ jobs:

# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2.7.3
- uses: buildjet/cache@v3
continue-on-error: true
with:
key: "${{ matrix.cargo_command }} ${{ matrix.args }} ${{ matrix.package }}"

- name: Download Fuel Core
if: ${{ matrix.install_fuel_core }}
uses: actions/download-artifact@v4
with:
name: fuel-core
- name: Install Fuel Core
if: ${{ matrix.install_fuel_core }}
run: |
if [[ -n $FUEL_CORE_PATCH_BRANCH ]]; then
cargo install --locked fuel-core-bin --git https://github.com/FuelLabs/fuel-core --branch "$FUEL_CORE_PATCH_BRANCH"
else
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ env.FUEL_CORE_VERSION }}/fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu.tar.gz -L -o fuel-core.tar.gz
tar -xvf fuel-core.tar.gz
chmod +x fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core
mv fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core /usr/local/bin/fuel-core
fi
chmod +x fuel-core
mv fuel-core /usr/local/bin/fuel-core
- name: Download sway example artifacts
if: ${{ matrix.download_sway_artifacts }}
Expand Down Expand Up @@ -247,7 +284,7 @@ jobs:
- publish-crates-check
# Only do this job if publishing a release
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204

steps:
- name: Checkout repository
Expand Down
45 changes: 23 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ readme = "README.md"
license = "Apache-2.0"
repository = "https://github.com/FuelLabs/fuels-rs"
rust-version = "1.79.0"
version = "0.66.4"
version = "0.66.9"

[workspace.dependencies]
Inflector = "0.11.4"
Expand All @@ -48,6 +48,7 @@ async-trait = { version = "0.1.74", default-features = false }
bech32 = "0.9.1"
bytes = { version = "1.5.0", default-features = false }
chrono = "0.4.31"
cynic = { version = "3.1.0", default-features = false }
elliptic-curve = { version = "0.13.8", default-features = false }
eth-keystore = "0.5.0"
flate2 = { version = "1.0", default-features = false }
Expand Down Expand Up @@ -85,33 +86,33 @@ octocrab = { version = "0.39", default-features = false }
dotenv = { version = "0.15", default-features = false }

# Dependencies from the `fuel-core` repository:
fuel-core = { version = "0.36.0", default-features = false, features = [
fuel-core = { version = "0.40.0", default-features = false, features = [
"wasm-executor",
] }
fuel-core-chain-config = { version = "0.36.0", default-features = false }
fuel-core-client = { version = "0.36.0", default-features = false }
fuel-core-poa = { version = "0.36.0", default-features = false }
fuel-core-services = { version = "0.36.0", default-features = false }
fuel-core-types = { version = "0.36.0", default-features = false }
fuel-core-chain-config = { version = "0.40.0", default-features = false }
fuel-core-client = { version = "0.40.0", default-features = false }
fuel-core-poa = { version = "0.40.0", default-features = false }
fuel-core-services = { version = "0.40.0", default-features = false }
fuel-core-types = { version = "0.40.0", default-features = false }

# Dependencies from the `fuel-vm` repository:
fuel-asm = { version = "0.57.0" }
fuel-crypto = { version = "0.57.0" }
fuel-merkle = { version = "0.57.0" }
fuel-storage = { version = "0.57.0" }
fuel-tx = { version = "0.57.0" }
fuel-types = { version = "0.57.0" }
fuel-vm = { version = "0.57.0" }
fuel-asm = { version = "0.58.0" }
fuel-crypto = { version = "0.58.0" }
fuel-merkle = { version = "0.58.0" }
fuel-storage = { version = "0.58.0" }
fuel-tx = { version = "0.58.0" }
fuel-types = { version = "0.58.0" }
fuel-vm = { version = "0.58.0" }

# Workspace projects
fuels = { version = "0.66.4", path = "./packages/fuels", default-features = false }
fuels-accounts = { version = "0.66.4", path = "./packages/fuels-accounts", default-features = false }
fuels-code-gen = { version = "0.66.4", path = "./packages/fuels-code-gen", default-features = false }
fuels-core = { version = "0.66.4", path = "./packages/fuels-core", default-features = false }
fuels-macros = { version = "0.66.4", path = "./packages/fuels-macros", default-features = false }
fuels-programs = { version = "0.66.4", path = "./packages/fuels-programs", default-features = false }
fuels-test-helpers = { version = "0.66.4", path = "./packages/fuels-test-helpers", default-features = false }
versions-replacer = { version = "0.66.4", path = "./scripts/versions-replacer", default-features = false }
fuels = { version = "0.66.9", path = "./packages/fuels", default-features = false }
fuels-accounts = { version = "0.66.9", path = "./packages/fuels-accounts", default-features = false }
fuels-code-gen = { version = "0.66.9", path = "./packages/fuels-code-gen", default-features = false }
fuels-core = { version = "0.66.9", path = "./packages/fuels-core", default-features = false }
fuels-macros = { version = "0.66.9", path = "./packages/fuels-macros", default-features = false }
fuels-programs = { version = "0.66.9", path = "./packages/fuels-programs", default-features = false }
fuels-test-helpers = { version = "0.66.9", path = "./packages/fuels-test-helpers", default-features = false }
versions-replacer = { version = "0.66.9", path = "./scripts/versions-replacer", default-features = false }

[patch.crates-io]
fuel-core = { git = "https://github.com/FuelLabs/fuel-core", branch = "hal3e/unknown-variants", package = "fuel-core"}
Expand Down
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- [Running scripts](./running-scripts.md)
- [Predicates](./predicates/index.md)
- [Signatures example](./predicates/send-spend-predicate.md)
- [Pre-uploading code](./preuploading-code.md)
- [Custom transactions](./custom-transactions/index.md)
- [Transaction builders](./custom-transactions/transaction-builders.md)
- [Custom contract and script calls](./custom-transactions/custom-calls.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/connecting/short-lived.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ let wallet = launch_provider_and_get_wallet().await?;
The `fuel-core-lib` feature allows us to run a `fuel-core` node without installing the `fuel-core` binary on the local machine. Using the `fuel-core-lib` feature flag entails downloading all the dependencies needed to run the fuel-core node.

```rust,ignore
fuels = { version = "0.66.4", features = ["fuel-core-lib"] }
fuels = { version = "0.66.9", features = ["fuel-core-lib"] }
```

### RocksDB

The `rocksdb` is an additional feature that, when combined with `fuel-core-lib`, provides persistent storage capabilities while using `fuel-core` as a library.

```rust,ignore
fuels = { version = "0.66.4", features = ["rocksdb"] }
fuels = { version = "0.66.9", features = ["rocksdb"] }
```
42 changes: 42 additions & 0 deletions docs/src/preuploading-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Pre-uploading code

If you have a script or predicate that is larger than normal or which you plan
on calling often, you can pre-upload its code as a blob to the network and run a
loader script/predicate instead. The loader can be configured with the
script/predicate configurables, so you can change how the script/predicate is
configured on each run without having large transactions due to the code
duplication.

## Scripts

A high level pre-upload:

```rust,ignore
{{#include ../../e2e/tests/scripts.rs:preload_high_level}}
```

The upload of the blob is handled inside of the `convert_into_loader` method. If you
want more fine-grained control over it, you can create the script transaction
manually:

```rust,ignore
{{#include ../../e2e/tests/scripts.rs:preload_low_level}}
```

## Predicates

You can prepare a predicate for pre-uploading without doing network requests:

```rust,ignore
{{#include ../../e2e/tests/predicates.rs:preparing_the_predicate}}
```

Once you want to execute the predicate, you must beforehand upload the blob
containing its code:

```rust,ignore
{{#include ../../e2e/tests/predicates.rs:uploading_the_blob}}
```

By pre-uploading the predicate code, you allow for cheaper calls to the predicate
from subsequent callers.
4 changes: 4 additions & 0 deletions e2e/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ members = [
'sway/logs/script_needs_custom_decoder_logging',
'sway/logs/script_with_contract_logs',
'sway/predicates/basic_predicate',
'sway/predicates/predicate_blobs',
'sway/predicates/predicate_configurables',
'sway/predicates/predicate_witnesses',
'sway/predicates/signatures',
'sway/predicates/swap',
'sway/scripts/arguments',
'sway/scripts/basic_script',
'sway/scripts/empty',
'sway/scripts/require_from_contract',
'sway/scripts/reverting',
'sway/scripts/script_array',
'sway/scripts/script_asserts',
'sway/scripts/script_blobs',
'sway/scripts/script_configurables',
'sway/scripts/script_enum',
'sway/scripts/script_needs_custom_decoder',
'sway/scripts/script_proxy',
'sway/scripts/script_require',
'sway/scripts/script_struct',
'sway/scripts/transfer_script',
Expand Down
18 changes: 18 additions & 0 deletions e2e/sway/contracts/huge_contract/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ contract;

abi MyContract {
fn something() -> u64;
#[storage(write)]
fn write_some_u64(some: u64);
#[storage(read)]
fn read_some_u64() -> u64;
}

storage {
some_u64: u64 = 42,
}

impl MyContract for Contract {
Expand All @@ -11,4 +19,14 @@ impl MyContract for Contract {
}
1001
}

#[storage(write)]
fn write_some_u64(some: u64) {
storage.some_u64.write(some);
}

#[storage(read)]
fn read_some_u64() -> u64 {
storage.some_u64.read()
}
}
20 changes: 19 additions & 1 deletion e2e/sway/contracts/proxy/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ abi Proxy {
#[storage(write)]
fn set_target_contract(id: ContractId);

// this targets the method of the `huge_contract` in our e2e sway contracts
// methods of the `huge_contract` in our e2e sway contracts
#[storage(read)]
fn something() -> u64;

#[storage(read)]
fn write_some_u64(some: u64);

#[storage(read)]
fn read_some_u64() -> u64;
}

storage {
Expand All @@ -26,4 +32,16 @@ impl Proxy for Contract {
let target = storage.target_contract.read().unwrap();
run_external(target)
}

#[storage(read)]
fn write_some_u64(_some: u64) {
let target = storage.target_contract.read().unwrap();
run_external(target)
}

#[storage(read)]
fn read_some_u64() -> u64 {
let target = storage.target_contract.read().unwrap();
run_external(target)
}
}
5 changes: 5 additions & 0 deletions e2e/sway/predicates/predicate_blobs/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "predicate_blobs"
Loading

0 comments on commit 51b259a

Please sign in to comment.