Skip to content

Commit

Permalink
Bump Libraries to forc v0.50 and rust v0.75.0 (#212)
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 libraries to forc v0.50
- Updates CI to Rust v1.75.0

## Notes

- This new version of forc makes struct fields private by default. These
have left public and will be made private in a future PR.
  • Loading branch information
bitzoic authored Feb 13, 2024
1 parent 8d196e9 commit afedd58
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.73.0
FORC_VERSION: 0.49.1
RUST_VERSION: 1.75.0
FORC_VERSION: 0.50.0
CORE_VERSION: 0.22.0
PATH_TO_SCRIPTS: .github/scripts

Expand Down
8 changes: 2 additions & 6 deletions libs/fixed_point/src/ifp128.sw
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use ::ufp64::UFP64;
/// Represented by an underlying `UFP64` number and a boolean.
pub struct IFP128 {
/// The underlying value representing the `IFP128` type.
underlying: UFP64,
pub underlying: UFP64,
/// The underlying boolean representing a negative value for the `IFP128` type.
non_negative: bool,
pub non_negative: bool,
}

impl From<UFP64> for IFP128 {
Expand All @@ -23,10 +23,6 @@ impl From<UFP64> for IFP128 {
non_negative: true,
}
}

fn into(self) -> UFP64 {
self.underlying
}
}

impl IFP128 {
Expand Down
8 changes: 2 additions & 6 deletions libs/fixed_point/src/ifp256.sw
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use ::ufp128::UFP128;
/// Represented by an underlying `UFP128` number and a boolean.
pub struct IFP256 {
/// The underlying value representing the `IFP256` type.
underlying: UFP128,
pub underlying: UFP128,
/// The underlying boolean representing a negative value for the `IFP256` type.
non_negative: bool,
pub non_negative: bool,
}

impl From<UFP128> for IFP256 {
Expand All @@ -23,10 +23,6 @@ impl From<UFP128> for IFP256 {
non_negative: true,
}
}

fn into(self) -> UFP128 {
self.underlying
}
}

impl IFP256 {
Expand Down
8 changes: 2 additions & 6 deletions libs/fixed_point/src/ifp64.sw
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use ::ufp32::UFP32;
/// Represented by an underlying `UFP32` number and a boolean.
pub struct IFP64 {
/// The underlying value representing the `IFP64` type.
underlying: UFP32,
pub underlying: UFP32,
/// The underlying boolean representing a negative value for the `IFP64` type.
non_negative: bool,
pub non_negative: bool,
}

impl From<UFP32> for IFP64 {
Expand All @@ -23,10 +23,6 @@ impl From<UFP32> for IFP64 {
non_negative: true,
}
}

fn into(self) -> UFP32 {
self.underlying
}
}

impl IFP64 {
Expand Down
6 changes: 1 addition & 5 deletions libs/fixed_point/src/ufp128.sw
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{math::{Exponent, Power, Root}, u128::U128, u256::U256};
/// Represented by an underlying `U128` number.
pub struct UFP128 {
/// The underlying value representing the `UFP128` type.
value: U128,
pub value: U128,
}

impl From<(u64, u64)> for UFP128 {
Expand All @@ -18,10 +18,6 @@ impl From<(u64, u64)> for UFP128 {
value: U128::from(int_fract_tuple),
}
}

fn into(self) -> (u64, u64) {
self.value.into()
}
}

impl UFP128 {
Expand Down
6 changes: 1 addition & 5 deletions libs/fixed_point/src/ufp32.sw
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ use std::math::*;
/// Represented by an underlying `u32` number.
pub struct UFP32 {
/// The underlying value representing the `UFP32` type.
value: u32,
pub value: u32,
}

impl From<u32> for UFP32 {
/// Creates UFP32 from u32. Note that UFP32::from(1) is 1 / 2^32 and not 1.
fn from(value: u32) -> Self {
Self { value }
}

fn into(self) -> u32 {
self.value
}
}

impl UFP32 {
Expand Down
6 changes: 1 addition & 5 deletions libs/fixed_point/src/ufp64.sw
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ use std::{math::{Exponent, Power, Root}, u128::U128};
/// Represented by an underlying `u64` number.
pub struct UFP64 {
/// The underlying value representing the `UFP64` type.
value: u64,
pub value: u64,
}

impl From<u64> for UFP64 {
/// Creates UFP64 from u64. Note that UFP64::from(1) is 1 / 2^32 and not 1.
fn from(value: u64) -> Self {
Self { value }
}

fn into(self) -> u64 {
self.value
}
}

impl UFP64 {
Expand Down
8 changes: 4 additions & 4 deletions libs/ownership/src/events.sw
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ library;
/// Logged when ownership is renounced.
pub struct OwnershipRenounced {
/// The user which revoked the ownership.
previous_owner: Identity,
pub previous_owner: Identity,
}

/// Logged when ownership is given to a user.
pub struct OwnershipSet {
/// The user which is now the owner.
new_owner: Identity,
pub new_owner: Identity,
}

/// Logged when ownership is given from one user to another.
pub struct OwnershipTransferred {
/// The user which is now the owner.
new_owner: Identity,
pub new_owner: Identity,
/// The user which has given up their ownership.
previous_owner: Identity,
pub previous_owner: Identity,
}
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i128.sw
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ::errors::Error;
/// Max value is 2 ^ 127 - 1, min value is - 2 ^ 127
pub struct I128 {
/// The underlying unsigned number representing the `I128` type.
underlying: U128,
pub underlying: U128,
}

impl I128 {
Expand Down Expand Up @@ -49,10 +49,6 @@ impl From<U128> for I128 {
let underlying: U128 = value + Self::indent();
Self { underlying }
}

fn into(self) -> U128 {
self.underlying - Self::indent()
}
}

impl core::ops::Eq for I128 {
Expand Down
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i16.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::common::TwosComplement;
/// Max value is 2 ^ 15 - 1, min value is - 2 ^ 15
pub struct I16 {
/// The underlying value representing the signed integer.
underlying: u16,
pub underlying: u16,
}

impl I16 {
Expand Down Expand Up @@ -44,10 +44,6 @@ impl From<u16> for I16 {
let underlying: u16 = value + Self::indent();
Self { underlying }
}

fn into(self) -> u16 {
self.underlying - Self::indent()
}
}

impl core::ops::Eq for I16 {
Expand Down
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i256.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::errors::Error;
/// Actual value is underlying value minus 2 ^ 255
/// Max value is 2 ^ 255 - 1, min value is - 2 ^ 255
pub struct I256 {
underlying: U256,
pub underlying: U256,
}

impl I256 {
Expand Down Expand Up @@ -49,10 +49,6 @@ impl From<U256> for I256 {
let underlying = value + Self::indent();
Self { underlying }
}

fn into(self) -> U256 {
self.underlying - Self::indent()
}
}

impl core::ops::Eq for I256 {
Expand Down
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i32.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::errors::Error;
/// Max value is 2 ^ 31 - 1, min value is - 2 ^ 31
pub struct I32 {
/// The underlying u32 type that represent a I32.
underlying: u32,
pub underlying: u32,
}

impl I32 {
Expand Down Expand Up @@ -43,10 +43,6 @@ impl From<u32> for I32 {
let underlying = value + Self::indent();
Self { underlying }
}

fn into(self) -> u32 {
self.underlying - Self::indent()
}
}

impl core::ops::Eq for I32 {
Expand Down
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i64.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::errors::Error;
/// Max value is 2 ^ 63 - 1, min value is - 2 ^ 63
pub struct I64 {
/// The underlying unsigned number representing the `I64` type.
underlying: u64,
pub underlying: u64,
}

impl I64 {
Expand Down Expand Up @@ -43,10 +43,6 @@ impl From<u64> for I64 {
let underlying = value + Self::indent();
Self { underlying }
}

fn into(self) -> u64 {
self.underlying - Self::indent()
}
}

impl core::ops::Eq for I64 {
Expand Down
6 changes: 1 addition & 5 deletions libs/signed_integers/src/i8.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::common::TwosComplement;
/// Max value is 2 ^ 7 - 1, min value is - 2 ^ 7
pub struct I8 {
/// The underlying unsigned `u8` type that makes up the signed `I8` type.
underlying: u8,
pub underlying: u8,
}

impl I8 {
Expand Down Expand Up @@ -43,10 +43,6 @@ impl From<u8> for I8 {
let underlying: u8 = value + Self::indent();
Self { underlying }
}

fn into(self) -> u8 {
self.underlying
}
}

impl core::ops::Eq for I8 {
Expand Down
2 changes: 1 addition & 1 deletion tests/src/native_asset/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "Apache-2.0"
name = "asset_test"

[dependencies]
asset = { path = "../../../libs/native_asset" }
src20 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" }
src3 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" }
src7 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" }
asset = { path = "../../../libs/native_asset" }

0 comments on commit afedd58

Please sign in to comment.