Skip to content

Commit

Permalink
Update to forc v0.66.6 (#323)
Browse files Browse the repository at this point in the history
## Type of change

<!--Delete points that do not apply-->

- Improvement (refactoring, restructuring repository, cleaning tech
debt, ...)

## Changes

The following changes have been made:

- Updates the repository to forc `v0.66.6`

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
- [ ] I have updated the changelog to reflect the changes on this PR.
  • Loading branch information
bitzoic authored Jan 31, 2025
1 parent df5112e commit 4cd9e12
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.83.0
FORC_VERSION: 0.66.2
FORC_VERSION: 0.66.6
CORE_VERSION: 0.40.0

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
RUST_VERSION: 1.83.0
FORC_VERSION: 0.66.2
FORC_VERSION: 0.66.6
CORE_VERSION: 0.40.0

jobs:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a href="https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml" alt="CI">
<img src="https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml/badge.svg" />
</a>
<a href="https://crates.io/crates/forc/0.63.3" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.63.3-orange" />
<a href="https://crates.io/crates/forc/0.66.6" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.66.6-orange" />
</a>
<a href="./LICENSE" alt="forc">
<img src="https://img.shields.io/github/license/FuelLabs/sway-libs" />
Expand Down Expand Up @@ -97,7 +97,7 @@ For more information about implementation please refer to the [Sway Libs Docs Hu

## Running Tests

There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.66.2` and `fuel-core v0.40.0`. You can check what version you are using by running the `fuelup show` command.
There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.66.6` and `fuel-core v0.40.0`. You can check what version you are using by running the `fuelup show` command.

Make sure you are in the source directory of this repository `sway-libs/<you are here>`.

Expand All @@ -119,7 +119,7 @@ forc test --path tests --release --locked && cargo test --manifest-path tests/Ca
Any instructions related to using a specific library should be found within the README.md of that library.

> **NOTE:**
> All projects currently use `forc v0.66.2`, `fuels-rs v0.66.9` and `fuel-core v0.40.0`.
> All projects currently use `forc v0.66.6`, `fuels-rs v0.66.9` and `fuel-core v0.40.0`.
## Contributing

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use sway_libs::ownership::only_owner;
```

> **NOTE:**
> All projects currently use `forc 0.63.3`, `fuels-rs v0.66.2` and `fuel-core 0.34.0`.
> All projects currently use `forc 0.66.6`, `fuels-rs v0.66.6` and `fuel-core 0.40.0`.
## Using Sway Libs

Expand Down
23 changes: 23 additions & 0 deletions docs/contributing-book/src/code/Forc.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[[package]]
name = "bad_documentation"
source = "member"
dependencies = ["std"]

[[package]]
name = "connect_four"
source = "member"
dependencies = ["std"]

[[package]]
name = "core"
source = "path+from-root-2E654A91A5A21ADE"

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.6#986aee2c1e34c9cd958c81e7fd6b84638b26619b"
dependencies = ["core"]

[[package]]
name = "style_guide"
source = "member"
dependencies = ["std"]
4 changes: 2 additions & 2 deletions docs/contributing-book/src/code/connect_four/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
contract;

mod data_structures;
mod interface;
pub mod data_structures;
pub mod interface;

use data_structures::{Game, Player};
use interface::ConnectFour;
Expand Down
4 changes: 2 additions & 2 deletions examples/Forc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies = [

[[package]]
name = "core"
source = "path+from-root-7053AAA90CC5E690"
source = "path+from-root-2E654A91A5A21ADE"

[[package]]
name = "merkle_examples"
Expand Down Expand Up @@ -146,7 +146,7 @@ dependencies = ["std"]

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.2#31486c0b47669612acb7c64d66ecb50aea281282"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.6#986aee2c1e34c9cd958c81e7fd6b84638b26619b"
dependencies = ["core"]

[[package]]
Expand Down
4 changes: 2 additions & 2 deletions libs/Forc.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[package]]
name = "core"
source = "path+from-root-7053AAA90CC5E690"
source = "path+from-root-2E654A91A5A21ADE"

[[package]]
name = "standards"
Expand All @@ -9,7 +9,7 @@ dependencies = ["std"]

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.2#31486c0b47669612acb7c64d66ecb50aea281282"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.6#986aee2c1e34c9cd958c81e7fd6b84638b26619b"
dependencies = ["core"]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion libs/src/admin.sw
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub mod errors;
use ::admin::errors::AdminError;
use ::ownership::{_owner, only_owner};
use standards::src5::State;
use std::{auth::msg_sender, hash::{Hash, sha256}, storage::storage_api::clear,};
use std::{auth::msg_sender, hash::{Hash, sha256}, storage::storage_api::clear};

// Sets a new administrator.
///
Expand Down
2 changes: 1 addition & 1 deletion libs/src/bytecode/utils.sw
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library;

use std::{alloc::{alloc, alloc_bytes, realloc_bytes}, bytes::Bytes,};
use std::{alloc::{alloc, alloc_bytes, realloc_bytes}, bytes::Bytes};

/// Pre-defined number of bytes of a leaf in a bytecode merkle tree.
const LEAF_SIZE = 16 * 1024;
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i128.sw
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ impl core::ops::Subtract for I128 {

impl WrappingNeg for I128 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(U128::from((0, 1))).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i16.sw
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ impl core::ops::Subtract for I16 {

impl WrappingNeg for I16 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(1u16).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i256.sw
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ impl core::ops::Subtract for I256 {

impl WrappingNeg for I256 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(0x0000000000000000000000000000000000000000000000000000000000000001u256).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i32.sw
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ impl core::ops::Divide for I32 {

impl WrappingNeg for I32 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(1u32).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i64.sw
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ impl core::ops::Divide for I64 {

impl WrappingNeg for I64 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(1).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/src/signed_integers/i8.sw
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ impl core::ops::Subtract for I8 {

impl WrappingNeg for I8 {
fn wrapping_neg(self) -> Self {
if self == self::min() {
return self::min()
if self == Self::min() {
return Self::min()
}
self * Self::neg_try_from(1u8).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Forc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = ["std"]

[[package]]
name = "core"
source = "path+from-root-7053AAA90CC5E690"
source = "path+from-root-2E654A91A5A21ADE"

[[package]]
name = "i128_test"
Expand Down Expand Up @@ -244,7 +244,7 @@ dependencies = ["std"]

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.2#31486c0b47669612acb7c64d66ecb50aea281282"
source = "git+https://github.com/fuellabs/sway?tag=v0.66.6#986aee2c1e34c9cd958c81e7fd6b84638b26619b"
dependencies = ["core"]

[[package]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract;

use std::{hash::*, math::*, storage::storage_vec::*,};
use std::{hash::*, math::*, storage::storage_vec::*};

struct SimpleStruct {
x: u32,
Expand Down
31 changes: 26 additions & 5 deletions tests/src/bytecode/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,32 @@ const DEFAULT_PREDICATE_BALANCE: u64 = 512;
const HEX_STR_1: &str = "0xb4ca495f61ac3433e9a78cbf3adfb0e4486913bb548029cef99d1de2cf606d52";
const HEX_STR_2: &str = "0x5d617010b482b54332741fab0dfd1b15dfad07e8895360af0fb9f3e3a04b0c74";
const HEX_STR_3: &str = "0xfebf0fdda20de46a0f2261a69556b0f9fdeea85759af1edb322831cf7d0dc8d5";
const SIMPLE_PREDICATE_OFFSET: u64 = 376;
const SIMPLE_CONTRACT_OFFSET: u64 = 1384;
const COMPLEX_CONTRACT_OFFSET_1: u64 = 22584;
const COMPLEX_CONTRACT_OFFSET_2: u64 = 22544;
const COMPLEX_CONTRACT_OFFSET_3: u64 = 22472;
// For bytecode test failures, these offsets need to be updated with the new configurable values
// in the .json files in `bytecode/test_artifacts/*/out/*-abi.json`.
// For example: in `bytecode/test_artifacts/complex_contract/out/contract_contract-abi.json` we have the following:
// "configurables": [
// {
// "name": "VALUE",
// "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0",
// "offset": 20800
// },
// {
// "name": "STRUCT",
// "concreteTypeId": "75f7f7a06026cab5d7a70984d1fde56001e83505e3a091ff9722b92d7f56d8be",
// "offset": 20760
// },
// {
// "name": "ENUM",
// "concreteTypeId": "8dfea60c80d5eb43188e38922a715225450c499b19fd0dacc673c13ff708cdb2",
// "offset": 20688
// }
// ]
// You would use 20800, 20760, and 20688 for 1, 2, 3 respectively
const SIMPLE_PREDICATE_OFFSET: u64 = 384;
const SIMPLE_CONTRACT_OFFSET: u64 = 1280;
const COMPLEX_CONTRACT_OFFSET_1: u64 = 20800;
const COMPLEX_CONTRACT_OFFSET_2: u64 = 20760;
const COMPLEX_CONTRACT_OFFSET_3: u64 = 20688;

pub mod abi_calls {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract;

use std::{auth::*, call_frames::*,};
use std::{auth::*, call_frames::*};

use reentrancy_target_abi::Target;
use reentrancy_attacker_abi::Attacker;
Expand Down

0 comments on commit 4cd9e12

Please sign in to comment.