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

Bump to forc 0.44.1 #185

Merged
merged 8 commits into from
Aug 22, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ concurrency:
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.69.0
FORC_VERSION: 0.40.1
CORE_VERSION: 0.18.1
RUST_VERSION: 1.71.1
FORC_VERSION: 0.44.1
CORE_VERSION: 0.20.3
PATH_TO_SCRIPTS: .github/scripts

jobs:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ These libraries contain helper functions and other tools valuable to blockchain
### Libraries

- [Binary Merkle Proof](./libs/merkle_proof/) is used to verify Binary Merkle Trees computed off-chain.
- [Non-Fungible Token (NFT)](./libs/nft/) is a token library which provides unqiue collectibles, identified and differentiated by token IDs.
- [Ownership](./libs/ownership/) is used to apply restrictions on functions such that only a single user may call them.
- [Reentrancy](./libs/reentrancy) is used to detect and prevent reentrancy attacks.
- [Signed Integers](./libs/signed_integers/) is an interface to implement signed integers.
Expand Down
1 change: 0 additions & 1 deletion libs/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
members = [
"fixed_point",
"merkle_proof",
"nft",
"ownership",
"queue",
"reentrancy",
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions libs/nft/README.md → libs/archive/nft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
</picture>
</p>

> **Warning**
> This library has been deprecated with the introduction of [Sway multi-token standard](https://github.com/FuelLabs/sway-standards/issues/1). Use of this library is *highly* discouraged. The last supported version is forc v0.40.1.

## Overview

A non-fungible token (NFT) is a unique token that has an identifier which distinguishes itself from other tokens within the same token contract. Unlike Fuel's Native Assets, these tokens are not fungible with one another and may contain metadata or other traits giving them distinctive characteristics.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions libs/fixed_point/src/ufp32.sw
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ impl core::ops::Subtract for UFP32 {
impl core::ops::Multiply for UFP32 {
/// Multiply a UFP32 with a UFP32. Panics of overflow.
fn multiply(self, other: Self) -> Self {
let self_u64: u64 = self.value;
let other_u64: u64 = other.value;
let self_u64: u64 = self.value.as_u64();
let other_u64: u64 = other.value.as_u64();

let self_multiply_other = self_u64 * other_u64;
let res_u64 = self_multiply_other >> 16;
if res_u64 > u32::max() {
if res_u64 > u32::max().as_u64() {
// panic on overflow
revert(0);
}
Expand All @@ -191,18 +191,18 @@ impl core::ops::Divide for UFP32 {
let zero = UFP32::zero();
assert(divisor != zero);

let denominator: u64 = Self::denominator();
let denominator: u64 = Self::denominator().as_u64();
// Conversion to U64 done to ensure no overflow happen
// and maximal precision is avaliable
// as it makes possible to multiply by the denominator in
// all cases
let self_u64: u64 = self.value;
let divisor_u64: u64 = divisor.value;
let self_u64: u64 = self.value.as_u64();
let divisor_u64: u64 = divisor.value.as_u64();

// Multiply by denominator to ensure accuracy
let res_u64 = self_u64 * denominator / divisor_u64;

if res_u64 > u32::max() {
if res_u64 > u32::max().as_u64() {
// panic on overflow
revert(0);
}
Expand Down Expand Up @@ -454,7 +454,7 @@ impl Power for UFP32 {
// which means that the denominator is always 2 ^ 16
// we need to divide the nominator by 2 ^ (16 * exponent - 1)
// - 1 is the formula is due to denominator need to stay 2 ^ 16
let nominator = nominator_pow >> 16 * (exponent_int - 1u32);
let nominator = nominator_pow >> 16 * (exponent_int - 1u32).as_u64();

if nominator > u32::max() {
// panic on overflow
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache-2.0"

[dependencies]
fuel-merkle = { version = "0.33.0" }
fuels = { version = "0.42.0", features = ["fuel-core-lib"] }
fuels = { version = "0.46.0", features = ["fuel-core-lib"] }
sha2 = { version = "0.10" }
tokio = { version = "1.12", features = ["rt", "macros"] }

Expand Down
2 changes: 0 additions & 2 deletions tests/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ members = [
"./src/fixed_point/ifp256_div_test",
"./src/fixed_point/ifp256_test",
"./src/merkle_proof",
"./src/nft/nft_core",
"./src/nft/nft_extensions",
"./src/ownership",
"./src/reentrancy/reentrancy_attacker_abi",
"./src/reentrancy/reentrancy_attacker_contract",
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions tests/src/fixed_point/ufp32_test/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn main() -> bool {

// recip
let mut value = UFP32 {
value: 1 << 32 + 3,
value: 3u32,
};
res = UFP32::recip(value);
assert(UFP32 {
Expand All @@ -35,21 +35,21 @@ fn main() -> bool {

// trunc
value = UFP32 {
value: (1 << 32) + 3,
value: 3u32,
};
res = value.trunc();
assert(UFP32::from_uint(1) == res);

// floor
value = UFP32 {
value: (1 << 32) + 3,
value: 3u32,
};
res = value.floor();
assert(UFP32::from_uint(1) == res);

// fract
value = UFP32 {
value: (1 << 32) + 3,
value: 3u32,
};
res = value.fract();
assert(UFP32 { value: 3 } == res);
Expand All @@ -60,7 +60,7 @@ fn main() -> bool {

// ceil
value = UFP32 {
value: (1 << 32) + 3,
value: 3u32,
};
res = value.ceil();
assert(UFP32::from_uint(2) == res);
Expand All @@ -71,13 +71,13 @@ fn main() -> bool {

// round
value = UFP32 {
value: (1 << 32) + 3,
value: 3u32,
};
res = value.round();
assert(UFP32::from_uint(1) == res);

value = UFP32 {
value: (1 << 32) + (1 << 31) + 1,
value: 2147483649u32,
};
res = value.round();
assert(UFP32::from_uint(2) == res);
Expand Down
1 change: 0 additions & 1 deletion tests/src/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

mod fixed_point;
mod merkle_proof;
mod nft;
mod ownership;
mod reentrancy;
mod signed_integers;
Loading