From 0263c0d638183f243dc2528bac0e5195b7492255 Mon Sep 17 00:00:00 2001 From: Anton Trunov Date: Thu, 29 Jun 2023 06:49:25 +0400 Subject: [PATCH 1/6] Handle integer overflow/underflow for non-64-bit integers (#4707) fixes #4646 ## Description This PR fixes the linked issue by introducing overflow/underflow checks in the `Add`, `Mul`, `Sub` stdlib traits implementations for the `u8`, `u16` and `u32` types. ## 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] 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. --- docs/book/src/basics/built_in_types.md | 7 ++ docs/book/src/basics/constants.md | 21 ++++ sway-core/src/ir_generation/const_eval.rs | 113 +++++++++++++----- sway-lib-core/src/ops.sw | 66 ++++++++-- .../u16_add_const_eval_overflow/Forc.lock | 13 ++ .../u16_add_const_eval_overflow/Forc.toml | 8 ++ .../u16_add_const_eval_overflow/src/main.sw | 9 ++ .../u16_add_const_eval_overflow/test.toml | 3 + .../arith_overflow/u16_add_overflow/Forc.lock | 13 ++ .../arith_overflow/u16_add_overflow/Forc.toml | 8 ++ .../u16_add_overflow/src/main.sw | 11 ++ .../arith_overflow/u16_add_overflow/test.toml | 3 + .../u16_mul_const_eval_overflow/Forc.lock | 13 ++ .../u16_mul_const_eval_overflow/Forc.toml | 8 ++ .../u16_mul_const_eval_overflow/src/main.sw | 9 ++ .../u16_mul_const_eval_overflow/test.toml | 3 + .../arith_overflow/u16_mul_overflow/Forc.lock | 13 ++ .../arith_overflow/u16_mul_overflow/Forc.toml | 8 ++ .../u16_mul_overflow/src/main.sw | 11 ++ .../arith_overflow/u16_mul_overflow/test.toml | 3 + .../u16_sub_const_eval_underflow/Forc.lock | 13 ++ .../u16_sub_const_eval_underflow/Forc.toml | 8 ++ .../u16_sub_const_eval_underflow/src/main.sw | 9 ++ .../u16_sub_const_eval_underflow/test.toml | 3 + .../u16_sub_underflow/Forc.lock | 13 ++ .../u16_sub_underflow/Forc.toml | 8 ++ .../u16_sub_underflow/src/main.sw | 11 ++ .../u16_sub_underflow/test.toml | 3 + .../u32_add_const_eval_overflow/Forc.lock | 13 ++ .../u32_add_const_eval_overflow/Forc.toml | 8 ++ .../u32_add_const_eval_overflow/src/main.sw | 9 ++ .../u32_add_const_eval_overflow/test.toml | 3 + .../arith_overflow/u32_add_overflow/Forc.lock | 13 ++ .../arith_overflow/u32_add_overflow/Forc.toml | 8 ++ .../u32_add_overflow/src/main.sw | 9 ++ .../arith_overflow/u32_add_overflow/test.toml | 3 + .../u32_mul_const_eval_overflow/Forc.lock | 13 ++ .../u32_mul_const_eval_overflow/Forc.toml | 8 ++ .../u32_mul_const_eval_overflow/src/main.sw | 9 ++ .../u32_mul_const_eval_overflow/test.toml | 3 + .../arith_overflow/u32_mul_overflow/Forc.lock | 13 ++ .../arith_overflow/u32_mul_overflow/Forc.toml | 8 ++ .../u32_mul_overflow/src/main.sw | 11 ++ .../arith_overflow/u32_mul_overflow/test.toml | 3 + .../u32_sub_const_eval_underflow/Forc.lock | 13 ++ .../u32_sub_const_eval_underflow/Forc.toml | 8 ++ .../u32_sub_const_eval_underflow/src/main.sw | 9 ++ .../u32_sub_const_eval_underflow/test.toml | 3 + .../u32_sub_underflow/Forc.lock | 13 ++ .../u32_sub_underflow/Forc.toml | 8 ++ .../u32_sub_underflow/src/main.sw | 11 ++ .../u32_sub_underflow/test.toml | 3 + .../u64_add_const_eval_overflow/Forc.lock | 13 ++ .../u64_add_const_eval_overflow/Forc.toml | 8 ++ .../u64_add_const_eval_overflow/src/main.sw | 9 ++ .../u64_add_const_eval_overflow/test.toml | 3 + .../arith_overflow/u64_add_overflow/Forc.lock | 13 ++ .../arith_overflow/u64_add_overflow/Forc.toml | 8 ++ .../u64_add_overflow/src/main.sw | 11 ++ .../arith_overflow/u64_add_overflow/test.toml | 3 + .../u64_mul_const_eval_overflow/Forc.lock | 13 ++ .../u64_mul_const_eval_overflow/Forc.toml | 8 ++ .../u64_mul_const_eval_overflow/src/main.sw | 9 ++ .../u64_mul_const_eval_overflow/test.toml | 3 + .../arith_overflow/u64_mul_overflow/Forc.lock | 13 ++ .../arith_overflow/u64_mul_overflow/Forc.toml | 8 ++ .../u64_mul_overflow/src/main.sw | 11 ++ .../arith_overflow/u64_mul_overflow/test.toml | 3 + .../u64_sub_const_eval_underflow/Forc.lock | 13 ++ .../u64_sub_const_eval_underflow/Forc.toml | 8 ++ .../u64_sub_const_eval_underflow/src/main.sw | 9 ++ .../u64_sub_const_eval_underflow/test.toml | 3 + .../u64_sub_underflow/Forc.lock | 13 ++ .../u64_sub_underflow/Forc.toml | 8 ++ .../u64_sub_underflow/src/main.sw | 11 ++ .../u64_sub_underflow/test.toml | 3 + .../u8_add_const_eval_overflow/Forc.lock | 13 ++ .../u8_add_const_eval_overflow/Forc.toml | 8 ++ .../u8_add_const_eval_overflow/src/main.sw | 9 ++ .../u8_add_const_eval_overflow/test.toml | 3 + .../arith_overflow/u8_add_overflow/Forc.lock | 13 ++ .../arith_overflow/u8_add_overflow/Forc.toml | 8 ++ .../u8_add_overflow/src/main.sw | 11 ++ .../arith_overflow/u8_add_overflow/test.toml | 3 + .../u8_mul_const_eval_overflow/Forc.lock | 13 ++ .../u8_mul_const_eval_overflow/Forc.toml | 8 ++ .../u8_mul_const_eval_overflow/src/main.sw | 9 ++ .../u8_mul_const_eval_overflow/test.toml | 3 + .../arith_overflow/u8_mul_overflow/Forc.lock | 13 ++ .../arith_overflow/u8_mul_overflow/Forc.toml | 8 ++ .../u8_mul_overflow/src/main.sw | 11 ++ .../arith_overflow/u8_mul_overflow/test.toml | 3 + .../u8_sub_const_eval_underflow/Forc.lock | 13 ++ .../u8_sub_const_eval_underflow/Forc.toml | 8 ++ .../u8_sub_const_eval_underflow/src/main.sw | 9 ++ .../u8_sub_const_eval_underflow/test.toml | 3 + .../arith_overflow/u8_sub_underflow/Forc.lock | 13 ++ .../arith_overflow/u8_sub_underflow/Forc.toml | 8 ++ .../u8_sub_underflow/src/main.sw | 11 ++ .../arith_overflow/u8_sub_underflow/test.toml | 3 + .../language/const_inits/src/main.sw | 38 +++++- .../language/const_inits/test.toml | 2 +- .../should_pass/language/ops/src/main.sw | 42 +++---- 103 files changed, 1039 insertions(+), 64 deletions(-) create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/test.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/test.toml diff --git a/docs/book/src/basics/built_in_types.md b/docs/book/src/basics/built_in_types.md index 545ee343b7b..13d180d8666 100644 --- a/docs/book/src/basics/built_in_types.md +++ b/docs/book/src/basics/built_in_types.md @@ -42,6 +42,13 @@ Numbers can be declared with binary syntax, hexadecimal syntax, base-10 syntax, The default numeric type is `u64`. The FuelVM's word size is 64 bits, and the cases where using a smaller numeric type saves space are minimal. + +If a 64-bit arithmetic operation produces an overflow or an underflow, +computation gets reverted automatically by FuelVM. + +8/16/32-bit arithmetic operations are emulated using their 64-bit analogues with +additional overflow/underflow checks inserted, which generally results in +somewhat higher gas consumption. ## Boolean Type diff --git a/docs/book/src/basics/constants.md b/docs/book/src/basics/constants.md index 84622f13f0f..46d3f3a936f 100644 --- a/docs/book/src/basics/constants.md +++ b/docs/book/src/basics/constants.md @@ -13,6 +13,27 @@ Constants are similar to variables; however, there are a few differences: const ID: u32 = 0; ``` +Constant initializer expressions can be quite complex, but they cannot use, for +instance, assembly instructions, storage access, mutable variables, loops and +`return` statements. Although, function calls, primitive types and compound data +structures are perfectly fine to use: + +```sway +fn bool_to_num(b: bool) -> u64 { + if b { + 1 + } else { + 0 + } +} + +fn arr_wrapper(a: u64, b: u64, c: u64) -> [u64; 3] { + [a, b, c] +} + +const ARR2 = arr_wrapper(bool_to_num(1) + 42, 2, 3); +``` + ## Associated Constants diff --git a/sway-core/src/ir_generation/const_eval.rs b/sway-core/src/ir_generation/const_eval.rs index 04386f280b1..32adfcb113e 100644 --- a/sway-core/src/ir_generation/const_eval.rs +++ b/sway-core/src/ir_generation/const_eval.rs @@ -266,17 +266,8 @@ fn const_eval_typed_expr( known_consts.push(name.clone(), cval); } - // TODO: Handle more than one statement in the block. let function_decl = lookup.engines.de().get_function(fn_ref); - if function_decl.body.contents.len() > 1 { - return Ok(None); - } - let body_contents_opt = function_decl.body.contents.last(); - let res = if let Some(first_expr) = body_contents_opt { - const_eval_typed_ast_node(lookup, known_consts, first_expr)? - } else { - None - }; + let res = const_eval_codeblock(lookup, known_consts, &function_decl.body)?; for (name, _) in arguments { known_consts.pop(name); } @@ -484,18 +475,47 @@ fn const_eval_typed_expr( }) => fields.get(*elem_to_access_num).cloned(), _ => None, }, - ty::TyExpressionVariant::Return(exp) => const_eval_typed_expr(lookup, known_consts, exp)?, + // we could allow non-local control flow in pure functions, but it would + // require some more work and at this point it's not clear if it is too useful + // for constant initializers -- the user can always refactor their pure functions + // to not use the return statement + ty::TyExpressionVariant::Return(_exp) => None, ty::TyExpressionVariant::MatchExp { desugared, .. } => { const_eval_typed_expr(lookup, known_consts, desugared)? } ty::TyExpressionVariant::IntrinsicFunction(kind) => { const_eval_intrinsic(lookup, known_consts, kind)? } + ty::TyExpressionVariant::IfExp { + condition, + then, + r#else, + } => { + match const_eval_typed_expr(lookup, known_consts, condition)? { + Some(Constant { + value: ConstantValue::Bool(cond), + .. + }) => { + if cond { + const_eval_typed_expr(lookup, known_consts, then)? + } else if let Some(r#else) = r#else { + const_eval_typed_expr(lookup, known_consts, r#else)? + } else { + // missing 'else' branch: + // we probably don't really care about evaluating + // const expressions of the unit type + None + } + } + _ => None, + } + } + ty::TyExpressionVariant::CodeBlock(codeblock) => { + const_eval_codeblock(lookup, known_consts, codeblock)? + } ty::TyExpressionVariant::ArrayIndex { .. } - | ty::TyExpressionVariant::CodeBlock(_) | ty::TyExpressionVariant::Reassignment(_) | ty::TyExpressionVariant::FunctionParameter - | ty::TyExpressionVariant::IfExp { .. } | ty::TyExpressionVariant::AsmExpression { .. } | ty::TyExpressionVariant::LazyOperator { .. } | ty::TyExpressionVariant::AbiCast { .. } @@ -509,6 +529,56 @@ fn const_eval_typed_expr( }) } +// the (constant) value of a codeblock is essentially it's last expression if there is one +// or if it makes sense as the last expression, e.g. a dangling let-expression in a codeblock +// would be an evaluation error +fn const_eval_codeblock( + lookup: &mut LookupEnv, + known_consts: &mut MappedStack, + codeblock: &ty::TyCodeBlock, +) -> Result, CompileError> { + // the current result + let mut res_const = None; + // keep track of new bindings for this codeblock + let mut bindings: Vec<_> = vec![]; + + for ast_node in &codeblock.contents { + match &ast_node.content { + ty::TyAstNodeContent::Declaration(ty::TyDecl::VariableDecl(var_decl)) => { + let rhs_opt = const_eval_typed_expr(lookup, known_consts, &var_decl.body)?; + if let Some(rhs) = rhs_opt { + known_consts.push(var_decl.name.clone(), rhs); + bindings.push(var_decl.name.clone()); + } + res_const = None + } + ty::TyAstNodeContent::Declaration(ty::TyDecl::ConstantDecl(const_decl)) => { + let ty_const_decl = lookup.engines.de().get_constant(&const_decl.decl_id); + if let Some(const_expr) = ty_const_decl.value { + if let Some(constant) = + const_eval_typed_expr(lookup, known_consts, &const_expr)? + { + known_consts.push(const_decl.name.clone(), constant); + bindings.push(const_decl.name.clone()); + } + } + res_const = None + } + ty::TyAstNodeContent::Declaration(_) => res_const = None, + ty::TyAstNodeContent::Expression(e) + | ty::TyAstNodeContent::ImplicitReturnExpression(e) => { + res_const = const_eval_typed_expr(lookup, known_consts, e)? + } + ty::TyAstNodeContent::SideEffect(_) => res_const = None, + } + } + // remove introduced vars/consts from scope at the end of the codeblock + for name in bindings { + known_consts.pop(&name) + } + Ok(res_const) +} + fn const_eval_intrinsic( lookup: &mut LookupEnv, known_consts: &mut MappedStack, @@ -675,20 +745,3 @@ fn const_eval_intrinsic( | sway_ast::Intrinsic::Smo => Ok(None), } } - -fn const_eval_typed_ast_node( - lookup: &mut LookupEnv, - known_consts: &mut MappedStack, - expr: &ty::TyAstNode, -) -> Result, CompileError> { - match &expr.content { - ty::TyAstNodeContent::Declaration(_) => { - // TODO: add the binding to known_consts (if it's a const) and proceed. - Ok(None) - } - ty::TyAstNodeContent::Expression(e) | ty::TyAstNodeContent::ImplicitReturnExpression(e) => { - const_eval_typed_expr(lookup, known_consts, e) - } - ty::TyAstNodeContent::SideEffect(_) => Ok(None), - } -} diff --git a/sway-lib-core/src/ops.sw b/sway-lib-core/src/ops.sw index d0677643d95..e91e79b2c14 100644 --- a/sway-lib-core/src/ops.sw +++ b/sway-lib-core/src/ops.sw @@ -12,21 +12,41 @@ impl Add for u64 { } } +// Emulate overflowing arithmetic for non-64-bit integer types impl Add for u32 { fn add(self, other: Self) -> Self { - __add(self, other) + // any non-64-bit value is compiled to a u64 value under-the-hood + // constants (like Self::max() below) are also automatically promoted to u64 + let res = __add(self, other); + if __gt(res, Self::max()) { + // integer overflow + __revert(0) + } else { + // no overflow + res + } } } impl Add for u16 { fn add(self, other: Self) -> Self { - __add(self, other) + let res = __add(self, other); + if __gt(res, Self::max()) { + __revert(0) + } else { + res + } } } impl Add for u8 { fn add(self, other: Self) -> Self { - __add(self, other) + let res = __add(self, other); + if __gt(res, Self::max()) { + __revert(0) + } else { + res + } } } @@ -40,6 +60,8 @@ impl Subtract for u64 { } } +// unlike addition, underflowing subtraction does not need special treatment +// because VM handles underflow impl Subtract for u32 { fn subtract(self, other: Self) -> Self { __sub(self, other) @@ -68,21 +90,41 @@ impl Multiply for u64 { } } +// Emulate overflowing arithmetic for non-64-bit integer types impl Multiply for u32 { fn multiply(self, other: Self) -> Self { - __mul(self, other) + // any non-64-bit value is compiled to a u64 value under-the-hood + // constants (like Self::max() below) are also automatically promoted to u64 + let res = __mul(self, other); + if __gt(res, Self::max()) { + // integer overflow + __revert(0) + } else { + // no overflow + res + } } } impl Multiply for u16 { fn multiply(self, other: Self) -> Self { - __mul(self, other) + let res = __mul(self, other); + if __gt(res, Self::max()) { + __revert(0) + } else { + res + } } } impl Multiply for u8 { fn multiply(self, other: Self) -> Self { - __mul(self, other) + let res = __mul(self, other); + if __gt(res, Self::max()) { + __revert(0) + } else { + res + } } } @@ -96,6 +138,10 @@ impl Divide for u64 { } } +// division for unsigned integers cannot overflow, +// but if signed integers are ever introduced, +// overflow needs to be handled, since +// Self::max() / -1 overflows impl Divide for u32 { fn divide(self, other: Self) -> Self { __div(self, other) @@ -482,7 +528,9 @@ impl Shift for u64 { impl Shift for u32 { fn lsh(self, other: u64) -> Self { - __lsh(self, other) + // any non-64-bit value is compiled to a u64 value under-the-hood + // so we need to clear upper bits here + __and(__lsh(self, other), Self::max()) } fn rsh(self, other: u64) -> Self { __rsh(self, other) @@ -491,7 +539,7 @@ impl Shift for u32 { impl Shift for u16 { fn lsh(self, other: u64) -> Self { - __lsh(self, other) + __and(__lsh(self, other), Self::max()) } fn rsh(self, other: u64) -> Self { __rsh(self, other) @@ -500,7 +548,7 @@ impl Shift for u16 { impl Shift for u8 { fn lsh(self, other: u64) -> Self { - __lsh(self, other) + __and(__lsh(self, other), Self::max()) } fn rsh(self, other: u64) -> Self { __rsh(self, other) diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..a8dce24783d --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-0EAD15BE42537FD3' + +[[package]] +name = 'std' +source = 'path+from-root-0EAD15BE42537FD3' +dependencies = ['core'] + +[[package]] +name = 'u16_add_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..193ec049b13 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_add_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..a8d6f8af735 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u16 = u16::max() + 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.lock new file mode 100644 index 00000000000..ffcdd87fb01 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-DD034BDFC1AFC889' + +[[package]] +name = 'std' +source = 'path+from-root-DD034BDFC1AFC889' +dependencies = ['core'] + +[[package]] +name = 'u16_add_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.toml new file mode 100644 index 00000000000..35d095e4d19 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_add_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/src/main.sw new file mode 100644 index 00000000000..34125faa79f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u16 = u16::max(); + let b: u16 = 1; + + let result: u16 = a + b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_add_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..320e9d59efb --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-035E1AC835A9A958' + +[[package]] +name = 'std' +source = 'path+from-root-035E1AC835A9A958' +dependencies = ['core'] + +[[package]] +name = 'u16_mul_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..c9225ed4722 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_mul_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..a972309d7c8 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u16 = u16::max() * 2; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.lock new file mode 100644 index 00000000000..f86ba5ded06 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-EFC151B1487B0E88' + +[[package]] +name = 'std' +source = 'path+from-root-EFC151B1487B0E88' +dependencies = ['core'] + +[[package]] +name = 'u16_mul_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.toml new file mode 100644 index 00000000000..6afd4f31da0 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_mul_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/src/main.sw new file mode 100644 index 00000000000..3e330dbf84f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u16 = u16::max(); + let b: u16 = 2; + + let result: u16 = a * b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_mul_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.lock new file mode 100644 index 00000000000..05367b57edd --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-FF708CA3420F9A17' + +[[package]] +name = 'std' +source = 'path+from-root-FF708CA3420F9A17' +dependencies = ['core'] + +[[package]] +name = 'u16_sub_const_eval_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.toml new file mode 100644 index 00000000000..9a7ffe23915 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_sub_const_eval_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/src/main.sw new file mode 100644 index 00000000000..edfdbd78fe9 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u16 = u16::min() - 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_const_eval_underflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.lock new file mode 100644 index 00000000000..a2558d806c8 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-DDD16884D4F7CFAB' + +[[package]] +name = 'std' +source = 'path+from-root-DDD16884D4F7CFAB' +dependencies = ['core'] + +[[package]] +name = 'u16_sub_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.toml new file mode 100644 index 00000000000..8ef9856cbec --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u16_sub_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/src/main.sw new file mode 100644 index 00000000000..44c635b6955 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u16 = u16::min(); + let b: u16 = 1; + + let result: u16 = a - b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u16_sub_underflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..e5bbd62b930 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-A1E0DED8BFC6F271' + +[[package]] +name = 'std' +source = 'path+from-root-A1E0DED8BFC6F271' +dependencies = ['core'] + +[[package]] +name = 'u32_add_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..2096f2f61f7 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_add_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..ba7d61ac0ba --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u32 = u32::max() + 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.lock new file mode 100644 index 00000000000..316329bcbd7 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-17020687432C56B1' + +[[package]] +name = 'std' +source = 'path+from-root-17020687432C56B1' +dependencies = ['core'] + +[[package]] +name = 'u32_add_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.toml new file mode 100644 index 00000000000..7991bab8590 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_add_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/src/main.sw new file mode 100644 index 00000000000..a774aaf6a6f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +fn main() -> u32 { + let a: u32 = u32::max(); + let b: u32 = 1u32; + + let result: u32 = a + b; + result +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_add_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..a648d30d41c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-6BD6A91180934A67' + +[[package]] +name = 'std' +source = 'path+from-root-6BD6A91180934A67' +dependencies = ['core'] + +[[package]] +name = 'u32_mul_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..028d6d8fe4c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_mul_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..599243a67d2 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u32 = u32::max() * 2; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.lock new file mode 100644 index 00000000000..5d2a1677b3d --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-AB517F9AE0FD4751' + +[[package]] +name = 'std' +source = 'path+from-root-AB517F9AE0FD4751' +dependencies = ['core'] + +[[package]] +name = 'u32_mul_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.toml new file mode 100644 index 00000000000..6ae340a0a07 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_mul_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/src/main.sw new file mode 100644 index 00000000000..0c15464b5ef --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u32 = u32::max(); + let b: u32 = 2; + + let result: u32 = a * b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_mul_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.lock new file mode 100644 index 00000000000..a3199d854fb --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-16573F11625D3117' + +[[package]] +name = 'std' +source = 'path+from-root-16573F11625D3117' +dependencies = ['core'] + +[[package]] +name = 'u32_sub_const_eval_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.toml new file mode 100644 index 00000000000..835471af6e9 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_sub_const_eval_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/src/main.sw new file mode 100644 index 00000000000..8771a1a4f87 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u32 = u32::min() - 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_const_eval_underflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.lock new file mode 100644 index 00000000000..8d2bd6120fe --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-5A0E88DB9F5ED146' + +[[package]] +name = 'std' +source = 'path+from-root-5A0E88DB9F5ED146' +dependencies = ['core'] + +[[package]] +name = 'u32_sub_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.toml new file mode 100644 index 00000000000..f99f5bbafb1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u32_sub_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/src/main.sw new file mode 100644 index 00000000000..2a3eef4ecf5 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u32 = u32::min(); + let b: u32 = 1; + + let result: u32 = a - b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u32_sub_underflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..0c64b46fa75 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-0E1504C05220483B' + +[[package]] +name = 'std' +source = 'path+from-root-0E1504C05220483B' +dependencies = ['core'] + +[[package]] +name = 'u64_add_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..eaeebb0c394 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_add_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..af63bdac05b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u64 = u64::max() + 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.lock new file mode 100644 index 00000000000..d327bb00474 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-E7EF2FDC0B057C10' + +[[package]] +name = 'std' +source = 'path+from-root-E7EF2FDC0B057C10' +dependencies = ['core'] + +[[package]] +name = 'u64_add_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.toml new file mode 100644 index 00000000000..b7a5f9e5ad5 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_add_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/src/main.sw new file mode 100644 index 00000000000..66c820e1948 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u64 = u64::max(); + let b: u64 = 1; + + let result: u64 = a + b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_add_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..132e8aa3c3d --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-DE1E6791086C4731' + +[[package]] +name = 'std' +source = 'path+from-root-DE1E6791086C4731' +dependencies = ['core'] + +[[package]] +name = 'u64_mul_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..bbd69cec808 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_mul_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..6678c2b55f3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u64 = u64::max() * 2; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.lock new file mode 100644 index 00000000000..a8bb2016ade --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-B55D1092CCC6CF95' + +[[package]] +name = 'std' +source = 'path+from-root-B55D1092CCC6CF95' +dependencies = ['core'] + +[[package]] +name = 'u64_mul_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.toml new file mode 100644 index 00000000000..0b7eeb20fb1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_mul_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/src/main.sw new file mode 100644 index 00000000000..b4648677bf0 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u64 = u64::max(); + let b: u64 = 2; + + let result: u64 = a * b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_mul_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.lock new file mode 100644 index 00000000000..84288f6912f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-4DC90293EA7B6056' + +[[package]] +name = 'std' +source = 'path+from-root-4DC90293EA7B6056' +dependencies = ['core'] + +[[package]] +name = 'u64_sub_const_eval_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.toml new file mode 100644 index 00000000000..89a9ed69c75 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_sub_const_eval_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/src/main.sw new file mode 100644 index 00000000000..42191f5d344 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u64 = u64::min() - 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_const_eval_underflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.lock new file mode 100644 index 00000000000..188fbf82194 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-D434508E66F5B3EA' + +[[package]] +name = 'std' +source = 'path+from-root-D434508E66F5B3EA' +dependencies = ['core'] + +[[package]] +name = 'u64_sub_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.toml new file mode 100644 index 00000000000..111cd2b5ab1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u64_sub_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/src/main.sw new file mode 100644 index 00000000000..c47069e969d --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u64 = u64::min(); + let b: u64 = 1; + + let result: u64 = a - b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u64_sub_underflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..6e99bfa47f0 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-AE9ADFE237B0A38F' + +[[package]] +name = 'std' +source = 'path+from-root-AE9ADFE237B0A38F' +dependencies = ['core'] + +[[package]] +name = 'u8_add_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..8e7e355ed13 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_add_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..e99f3bcc915 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u8 = u8::max() + 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.lock new file mode 100644 index 00000000000..500f71d3d3c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-6A0B0BB6D9599A3B' + +[[package]] +name = 'std' +source = 'path+from-root-6A0B0BB6D9599A3B' +dependencies = ['core'] + +[[package]] +name = 'u8_add_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.toml new file mode 100644 index 00000000000..7bf01089a3f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_add_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/src/main.sw new file mode 100644 index 00000000000..accdec79c43 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u8 = u8::max(); + let b: u8 = 1; + + let result: u8 = a + b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_add_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.lock new file mode 100644 index 00000000000..8f671a6eed2 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-A18BA26192A1D371' + +[[package]] +name = 'std' +source = 'path+from-root-A18BA26192A1D371' +dependencies = ['core'] + +[[package]] +name = 'u8_mul_const_eval_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.toml new file mode 100644 index 00000000000..09ac080e36e --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_mul_const_eval_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/src/main.sw new file mode 100644 index 00000000000..6ef71d26aff --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u8 = u8::max() * 2; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_const_eval_overflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.lock new file mode 100644 index 00000000000..a76c3bfb191 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-266A49018292505D' + +[[package]] +name = 'std' +source = 'path+from-root-266A49018292505D' +dependencies = ['core'] + +[[package]] +name = 'u8_mul_overflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.toml new file mode 100644 index 00000000000..20e4d00987b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_mul_overflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/src/main.sw new file mode 100644 index 00000000000..4fb39c694f1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u8 = u8::max(); + let b: u8 = 2; + + let result: u8 = a * b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_mul_overflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.lock new file mode 100644 index 00000000000..2b82ea68df1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-F069F51B6DE417DE' + +[[package]] +name = 'std' +source = 'path+from-root-F069F51B6DE417DE' +dependencies = ['core'] + +[[package]] +name = 'u8_sub_const_eval_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.toml new file mode 100644 index 00000000000..dbcd3da13d6 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_sub_const_eval_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/src/main.sw new file mode 100644 index 00000000000..b17b5c45c5b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/src/main.sw @@ -0,0 +1,9 @@ +script; + +const RESULT: u8 = u8::min() - 1; + +fn main() -> bool { + log(RESULT); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/test.toml new file mode 100644 index 00000000000..e21881c50df --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_const_eval_underflow/test.toml @@ -0,0 +1,3 @@ +category = "fail" + +# check: $()Could not evaluate initializer to a const declaration. \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.lock new file mode 100644 index 00000000000..555d80c15bc --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-7FEE5C5203242351' + +[[package]] +name = 'std' +source = 'path+from-root-7FEE5C5203242351' +dependencies = ['core'] + +[[package]] +name = 'u8_sub_underflow' +source = 'member' +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.toml new file mode 100644 index 00000000000..7c2ee75cd1e --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "u8_sub_underflow" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/src/main.sw new file mode 100644 index 00000000000..beae78fab48 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/src/main.sw @@ -0,0 +1,11 @@ +script; + +fn main() -> bool { + let a: u8 = u8::min(); + let b: u8 = 1; + + let result: u8 = a - b; + log(result); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/test.toml new file mode 100644 index 00000000000..2f3b260911b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/arith_overflow/u8_sub_underflow/test.toml @@ -0,0 +1,3 @@ +category = "run" +expected_result = { action = "revert", value = 0 } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/src/main.sw index d1040dc219e..94e63c5a1f8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/src/main.sw @@ -6,6 +6,34 @@ fn contract_id_wrapper(b: b256) -> ContractId { } const ETH_ID1 = contract_id_wrapper(0x0000000000000000000000000000000000000000000000000000000000000001); +// test if-expressions +fn bool_to_num(b: bool) -> u64 { + if b { + 1 + } else { + 0 + } +} + +// test variable shadowing and local const +fn const_42(x: u64) -> u64 { + const forty_two = 42; + let x: u64 = forty_two; + x +} + +// test variable scopes and local const +fn id(x: u64) -> u64 { + const forty_two = 42; + { + let x: u64 = forty_two; + }; + x +} + +const QUUX: u64 = id(0); +const BAZ: u64 = const_42(123456); + const TUP1 = (2, 1, 21); const ARR1 = [1, 2, 3]; @@ -15,8 +43,9 @@ fn tup_wrapper(a: u64, b: u64, c: u64) -> (u64, u64, u64) { const TUP2 = tup_wrapper(2, 1, 21); fn arr_wrapper(a: u64, b: u64, c: u64) -> [u64; 3] { - return [a, b, c]; + [a, b, c] } + const ARR2 = arr_wrapper(1, 2, 3); enum En1 { @@ -50,12 +79,12 @@ const ZERO_B256 = 0x000000000000000000000000000000000000000000000000000000000000 const KEY = ZERO_B256; const BAR: u32 = 6; -const FOO: u32 = 5; +const FOO: u32 = ((u32::min() + 1) * 12 / 2 - 1) % 6; const MASK: u32 = 11; const MASK2: u32 = 8; const MASK3: u32 = 15; const FOO_MIDDLE: u32 = ((FOO & MASK) | MASK2) ^ MASK3; -const OPS: u64 = 10 + 9 - 8 * 7 / 6 << 5 >> 4 ^ 3 | 2 & 1; +const OPS: u64 = 10 + 9 - 8 * 7 / 6 << 5 >> 4 ^ 3 | 2 & bool_to_num(true); const CARR1 = [X_SIZE - Y_SIZE + 1; 4]; // This doesn't work because const-eval happens after type-checking, @@ -70,6 +99,8 @@ fn main() -> u64 { const eth_id0 = ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000000); const eth_id1 = ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001); assert(eth_id0 == ETH_ID0 && eth_id1 == ETH_ID1); + assert(BAZ == 42); + assert(QUUX == 0); // tuples and arrays. const t1 = (2, 1, 21); @@ -117,6 +148,7 @@ fn main() -> u64 { assert(SOV == __size_of_val("hello")); assert(TRUEB != FALSEB); assert(TRUEB1 != FALSEB1); + assert(FOO == 5); assert(FOO_MIDDLE == BAR); assert(OPS == 23); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/test.toml index bbe43614420..0384b8a131a 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/test.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_inits/test.toml @@ -1,4 +1,4 @@ category = "run" expected_result = { action = "return", value = 1 } validate_abi = true -expected_warnings = 9 +expected_warnings = 19 diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/src/main.sw index 8cfc185af35..c0acc663133 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/src/main.sw @@ -134,11 +134,11 @@ fn u32_ops() -> bool { assert(1_u32 << 1 == 2_u32); assert(2_u32 << 1 == 4_u32); assert(255_u32 << 21 == 534773760_u32); - assert(max << 1 & max == 4294967294_u32); - assert(max << 2 & max == 4294967292_u32); - assert(A << 1 & max == C); - assert(max << 31 & max == E); - assert(max << 32 & max == 0_u32); + assert(max << 1 == 4294967294_u32); + assert(max << 2 == 4294967292_u32); + assert(A << 1 == C); + assert(max << 31 == E); + assert(max << 32 == 0_u32); assert(0_u32 >> 0 == 0_u32); assert(0_u32 >> 1 == 0_u32); @@ -152,8 +152,8 @@ fn u32_ops() -> bool { assert(A >> 1 == D); assert(A >> 21 == 1036_u32); assert(max >> 1 == 2147483647_u32); - assert(max >> 31 & max == 1_u32); - assert(max >> 32 & max == 0_u32); + assert(max >> 31 == 1_u32); + assert(max >> 32 == 0_u32); true } @@ -209,11 +209,11 @@ fn u16_ops() -> bool { assert(1_u16 << 1 == 2_u16); assert(2_u16 << 1 == 4_u16); assert(255_u16 << 4 == 4080_u16); - assert(max << 1 & max == 65534_u16); - assert(max << 2 & max == 65532_u16); - assert(A << 1 & max == C); - assert(max << 15 & max == E); - assert(max << 16 & max == 0_u16); + assert(max << 1 == 65534_u16); + assert(max << 2 == 65532_u16); + assert(A << 1 == C); + assert(max << 15 == E); + assert(max << 16 == 0_u16); assert(0_u16 >> 0 == 0_u16); assert(0_u16 >> 1 == 0_u16); @@ -227,8 +227,8 @@ fn u16_ops() -> bool { assert(A >> 1 == D); assert(A >> 4 == 2072_u16); assert(max >> 1 == 32767_u16); - assert(max >> 15 & max == 1_u16); - assert(max >> 16 & max == 0_u16); + assert(max >> 15 == 1_u16); + assert(max >> 16 == 0_u16); true } @@ -284,11 +284,11 @@ fn u8_ops() -> bool { assert(1_u8 << 1 == 2_u8); assert(2_u8 << 1 == 4_u8); assert(31_u8 << 2 == 124_u8); - assert(max << 1 & max == 254_u8); - assert(max << 2 & max == 252_u8); - assert(A << 1 & max == C); - assert(max << 7 & max == E); - assert(max << 8 & max == 0_u8); + assert(max << 1 == 254_u8); + assert(max << 2 == 252_u8); + assert(A << 1 == C); + assert(max << 7 == E); + assert(max << 8 == 0_u8); assert(0_u8 >> 0 == 0_u8); assert(0_u8 >> 1 == 0_u8); @@ -302,8 +302,8 @@ fn u8_ops() -> bool { assert(A >> 1 == D); assert(A >> 4 == 8_u8); assert(max >> 1 == 127_u8); - assert(max >> 7 & max == 1_u8); - assert(max >> 8 & max == 0_u8); + assert(max >> 7 == 1_u8); + assert(max >> 8 == 0_u8); true } From 1544bb0917093a7c3f1c3a18c99335ff82fdeefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ara=C3=BAjo?= Date: Thu, 29 Jun 2023 09:31:00 +0100 Subject: [PATCH 2/6] Fix documentation typo (#4712) --- docs/book/src/common-collections/storage_map.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book/src/common-collections/storage_map.md b/docs/book/src/common-collections/storage_map.md index 3a20f029735..80f2e8d0cc6 100644 --- a/docs/book/src/common-collections/storage_map.md +++ b/docs/book/src/common-collections/storage_map.md @@ -73,7 +73,7 @@ Maps with multiple keys can be implemented using tuples as keys. For example: {{#include ../../../../examples/storage_map/src/main.sw:storage_map_tuple_key}} ``` -## Nested Storage Naps +## Nested Storage Maps It is possible to nest storage maps as follows: From 8aabcd312471acb6923a5d2b04f924271c60c99f Mon Sep 17 00:00:00 2001 From: Cameron Carstens <54727135+bitzoic@users.noreply.github.com> Date: Thu, 29 Jun 2023 15:10:34 +0100 Subject: [PATCH 3/6] Refactor `Bytes` type to use `From` trait (#4714) ## Description The current use of converting `Bytes` to and from `raw_slice` and `Vec` use a special define function. This should use the `From` trait. > Note: This is a breaking change. ## 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] 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. --------- Co-authored-by: bitzoic --- sway-lib-std/src/bytes.sw | 220 +++++++++++------- sway-lib-std/src/low_level_call.sw | 2 +- sway-lib-std/src/storage/storage_bytes.sw | 2 +- .../test_projects/storage_bytes/src/main.sw | 4 +- 4 files changed, 139 insertions(+), 89 deletions(-) diff --git a/sway-lib-std/src/bytes.sw b/sway-lib-std/src/bytes.sw index 58bafb70a0f..b816b3754e8 100644 --- a/sway-lib-std/src/bytes.sw +++ b/sway-lib-std/src/bytes.sw @@ -485,75 +485,6 @@ impl Bytes { // Need to use seperate impl blocks for now: https://github.com/FuelLabs/sway/issues/1548 impl Bytes { - /// Creates a `Bytes` from a `Vec`. - /// - /// ### Examples - /// - /// ```sway - /// use std:bytes::Bytes; - /// - /// let mut vec = Vec::new(); - /// let a = 5u8; - /// let b = 7u8; - /// let c = 9u8 - /// - /// vec.push(a); - /// vec.push(b); - /// vec.push(c); - /// - /// let bytes = Bytes::from_vec_u8(vec); - /// - /// assert(bytes.len == 3); - /// assert(bytes.get(0).unwrap() == a); - /// assert(bytes.get(1).unwrap() == b); - /// assert(bytes.get(2).unwrap() == c); - /// ``` - pub fn from_vec_u8(ref mut vec: Vec) -> Self { - let mut bytes = Bytes::new(); - let mut i = 0; - let length = vec.len(); - while i < length { - bytes.push(vec.get(i).unwrap()); - i += 1; - }; - bytes - } - - /// Creates a `Vec` from a `Bytes`. - /// - /// ### Examples - /// - /// ```sway - /// use std:bytes::Bytes; - /// - /// let mut bytes = Bytes::new(); - /// let a = 5u8; - /// let b = 7u8; - /// let c = 9u8 - /// bytes.push(a); - /// bytes.push(b); - /// bytes.push(c); - /// - /// assert(bytes.len() == 3); - /// - /// let vec = bytes.into_vec_u8(); - /// - /// assert(vec.len() == 3); - /// assert(vec.get(0).unwrap() == a); - /// assert(vec.get(1).unwrap() == b); - /// assert(vec.get(2).unwrap() == c); - /// ``` - pub fn into_vec_u8(self) -> Vec { - let mut vec = Vec::new(); - let mut i = 0; - let length = self.len; - while i < length { - vec.push(self.get(i).unwrap()); - i += 1; - }; - vec - } - /// Divides one Bytes into two at an index. /// /// The first will contain all indices from `[0, mid)` (excluding the index @@ -669,18 +600,6 @@ impl Bytes { // clear `other` other.clear(); } - - // Should be remove and replace when https://github.com/FuelLabs/sway/pull/3882 is resovled - pub fn from_raw_slice(slice: raw_slice) -> Self { - let number_of_bytes = slice.number_of_bytes(); - Self { - buf: RawBytes { - ptr: slice.ptr(), - cap: number_of_bytes, - }, - len: number_of_bytes, - } - } } impl core::ops::Eq for Bytes { @@ -728,6 +647,137 @@ impl From for Bytes { } } +impl From for Bytes { + /// Creates a `Bytes` from a `raw_slice`. + /// + /// ### Examples + /// + /// ```sway + /// use std:bytes::Bytes; + /// + /// let mut vec = Vec::new(); + /// let a = 5u8; + /// let b = 7u8; + /// let c = 9u8 + /// + /// vec.push(a); + /// vec.push(b); + /// vec.push(c); + /// + /// let vec_as_raw_slice = vec.as_raw_slice(); + /// let bytes = Bytes::from(vec_as_raw_slice); + /// + /// assert(bytes.len == 3); + /// assert(bytes.get(0).unwrap() == a); + /// assert(bytes.get(1).unwrap() == b); + /// assert(bytes.get(2).unwrap() == c); + /// ``` + fn from(slice: raw_slice) -> Self { + let number_of_bytes = slice.number_of_bytes(); + Self { + buf: RawBytes { + ptr: slice.ptr(), + cap: number_of_bytes, + }, + len: number_of_bytes, + } + } + + /// Creates a `raw_slice` from a `Bytes`. + /// + /// ### Examples + /// + /// ```sway + /// use std:bytes::Bytes; + /// + /// let mut bytes = Bytes::new(); + /// let a = 5u8; + /// let b = 7u8; + /// let c = 9u8 + /// bytes.push(a); + /// bytes.push(b); + /// bytes.push(c); + /// + /// assert(bytes.len() == 3); + /// + /// let slice: raw_slice = bytes.into(); + /// + /// assert(slice.number_of_bytes() == 3); + /// ``` + fn into(self) -> raw_slice { + asm(ptr: (self.buf.ptr(), self.len)) { ptr: raw_slice } + } +} + +impl From> for Bytes { + /// Creates a `Bytes` from a `Vec`. + /// + /// ### Examples + /// + /// ```sway + /// use std:bytes::Bytes; + /// + /// let mut vec = Vec::new(); + /// let a = 5u8; + /// let b = 7u8; + /// let c = 9u8 + /// + /// vec.push(a); + /// vec.push(b); + /// vec.push(c); + /// + /// let bytes = Bytes::from(vec); + /// + /// assert(bytes.len == 3); + /// assert(bytes.get(0).unwrap() == a); + /// assert(bytes.get(1).unwrap() == b); + /// assert(bytes.get(2).unwrap() == c); + /// ``` + fn from(vec: Vec) -> Self { + let mut bytes = Bytes::with_capacity(vec.len()); + let mut i = 0; + while i < vec.len() { + bytes.push(vec.get(i).unwrap()); + i += 1; + }; + bytes + } + + /// Creates a `Vec` from a `Bytes`. + /// + /// ### Examples + /// + /// ```sway + /// use std:bytes::Bytes; + /// + /// let mut bytes = Bytes::new(); + /// let a = 5u8; + /// let b = 7u8; + /// let c = 9u8 + /// bytes.push(a); + /// bytes.push(b); + /// bytes.push(c); + /// + /// assert(bytes.len() == 3); + /// + /// let vec: Vec = bytes.into(); + /// + /// assert(vec.len() == 3); + /// assert(vec.get(0).unwrap() == a); + /// assert(vec.get(1).unwrap() == b); + /// assert(vec.get(2).unwrap() == c); + /// ``` + fn into(self) -> Vec { + let mut vec = Vec::with_capacity(self.len); + let mut i = 0; + while i < self.len { + vec.push(self.get(i).unwrap()); + i += 1; + }; + vec + } +} + // Tests // fn setup() -> (Bytes, u8, u8, u8) { @@ -925,7 +975,7 @@ fn test_from_vec_u8() { vec.push(b); vec.push(c); - let bytes = Bytes::from_vec_u8(vec); + let bytes = Bytes::from(vec); assert(bytes.len == 3); assert(bytes.get(0).unwrap() == a); @@ -938,7 +988,7 @@ fn test_into_vec_u8() { let (mut bytes, a, b, c) = setup(); assert(bytes.len() == 3); - let vec = bytes.into_vec_u8(); + let vec: Vec = bytes.into(); assert(vec.len() == 3); assert(vec.get(0).unwrap() == a); @@ -1140,7 +1190,7 @@ fn test_keccak256() { fn test_as_raw_slice() { let val = 0x3497297632836282349729763283628234972976328362823497297632836282; let slice_1 = asm(ptr: (__addr_of(val), 32)) { ptr: raw_slice }; - let mut bytes = Bytes::from_raw_slice(slice_1); + let mut bytes = Bytes::from(slice_1); let slice_2 = bytes.as_raw_slice(); assert(slice_1.ptr() == slice_2.ptr()); assert(slice_1.number_of_bytes() == slice_2.number_of_bytes()); @@ -1151,7 +1201,7 @@ fn test_as_raw_slice() { fn test_from_raw_slice() { let val = 0x3497297632836282349729763283628234972976328362823497297632836282; let slice_1 = asm(ptr: (__addr_of(val), 32)) { ptr: raw_slice }; - let mut bytes = Bytes::from_raw_slice(slice_1); + let mut bytes = Bytes::from(slice_1); let slice_2 = bytes.as_raw_slice(); assert(slice_1.ptr() == slice_2.ptr()); assert(slice_1.number_of_bytes() == slice_2.number_of_bytes()); diff --git a/sway-lib-std/src/low_level_call.sw b/sway-lib-std/src/low_level_call.sw index 5dc71df894f..dfe2b3ce000 100644 --- a/sway-lib-std/src/low_level_call.sw +++ b/sway-lib-std/src/low_level_call.sw @@ -107,5 +107,5 @@ pub fn call_with_function_selector_vec( let mut function_selector = function_selector; let mut calldata = calldata; - call_with_function_selector(target, Bytes::from_vec_u8(function_selector), Bytes::from_vec_u8(calldata), single_value_type_arg, call_params); + call_with_function_selector(target, Bytes::from(function_selector), Bytes::from(calldata), single_value_type_arg, call_params); } diff --git a/sway-lib-std/src/storage/storage_bytes.sw b/sway-lib-std/src/storage/storage_bytes.sw index 241d6a56e6d..bc09d630b34 100644 --- a/sway-lib-std/src/storage/storage_bytes.sw +++ b/sway-lib-std/src/storage/storage_bytes.sw @@ -69,7 +69,7 @@ impl StorableSlice for StorageKey { fn read_slice(self) -> Option { match read_slice(self.field_id) { Some(slice) => { - Some(Bytes::from_raw_slice(slice)) + Some(Bytes::from(slice)) }, None => None, } diff --git a/test/src/sdk-harness/test_projects/storage_bytes/src/main.sw b/test/src/sdk-harness/test_projects/storage_bytes/src/main.sw index 202876edc32..af83c00c003 100644 --- a/test/src/sdk-harness/test_projects/storage_bytes/src/main.sw +++ b/test/src/sdk-harness/test_projects/storage_bytes/src/main.sw @@ -22,7 +22,7 @@ impl StorageBytesTest for Contract { #[storage(read, write)] fn store_bytes(vec: Vec) { let mut vec = vec; - let bytes = Bytes::from_vec_u8(vec); + let bytes = Bytes::from(vec); storage.bytes.write_slice(bytes); } @@ -30,7 +30,7 @@ impl StorageBytesTest for Contract { #[storage(read)] fn assert_stored_bytes(vec: Vec) { let mut vec = vec; - let bytes = Bytes::from_vec_u8(vec); + let bytes = Bytes::from(vec); let stored_bytes = storage.bytes.read_slice().unwrap(); assert(bytes.len() == stored_bytes.len()); From 5d8d8ed6456f47c6e0a890987c0c8ef1baab30d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaya=20G=C3=B6kalp?= Date: Thu, 29 Jun 2023 09:29:55 -0700 Subject: [PATCH 4/6] chore: bump git2-rs version to 0.17.2 and required libgit2 to v1.6.4 (#4717) ## Description Bumps git2-rs to 0.17.2, so that forc requires libgit2 v1.6.4 to compile. This is needed as fuel.nix flake is in a deadlock some dependencies requires us to bump macos sdk versions while libgit2 v0.1.5.1 fails to compile with the bumped SDK version. --- Cargo.lock | 12 ++++++------ forc-pkg/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4fc2d2c70d..f34695ca224 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2406,9 +2406,9 @@ checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "git2" -version = "0.16.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" +checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ "bitflags", "libc", @@ -3138,9 +3138,9 @@ checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libgit2-sys" -version = "0.14.2+1.5.1" +version = "0.15.2+1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4" +checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", @@ -3152,9 +3152,9 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.2.23" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" dependencies = [ "cc", "libc", diff --git a/forc-pkg/Cargo.toml b/forc-pkg/Cargo.toml index 5d22b621336..dfbd3608e8f 100644 --- a/forc-pkg/Cargo.toml +++ b/forc-pkg/Cargo.toml @@ -17,7 +17,7 @@ forc-tracing = { version = "0.40.1", path = "../forc-tracing" } forc-util = { version = "0.40.1", path = "../forc-util" } fuel-abi-types = "0.1" futures = "0.3" -git2 = { version = "0.16.1", features = ["vendored-libgit2", "vendored-openssl"] } +git2 = { version = "0.17.2", features = ["vendored-libgit2", "vendored-openssl"] } gix-url = { version = "0.16.0", features = ["serde1"] } hex = "0.4.3" ipfs-api-backend-hyper = { version = "0.6", features = ["with-builder"] } From e08fab18528ddd10911e685372a1e6d1dcf31c50 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Thu, 29 Jun 2023 20:26:23 +0200 Subject: [PATCH 5/6] Bump to v0.41.0 (#4720) --- Cargo.lock | 459 ++++++++++++++-------------- forc-pkg/Cargo.toml | 14 +- forc-plugins/forc-client/Cargo.toml | 18 +- forc-plugins/forc-doc/Cargo.toml | 16 +- forc-plugins/forc-fmt/Cargo.toml | 14 +- forc-plugins/forc-lsp/Cargo.toml | 4 +- forc-plugins/forc-tx/Cargo.toml | 4 +- forc-test/Cargo.toml | 8 +- forc-tracing/Cargo.toml | 2 +- forc-util/Cargo.toml | 12 +- forc/Cargo.toml | 16 +- sway-ast/Cargo.toml | 4 +- sway-core/Cargo.toml | 14 +- sway-error/Cargo.toml | 6 +- sway-ir/Cargo.toml | 8 +- sway-ir/sway-ir-macros/Cargo.toml | 2 +- sway-lsp/Cargo.toml | 20 +- sway-parse/Cargo.toml | 8 +- sway-types/Cargo.toml | 2 +- sway-utils/Cargo.toml | 2 +- swayfmt/Cargo.toml | 16 +- 21 files changed, 332 insertions(+), 317 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f34695ca224..ec52537a79b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,9 +29,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -135,15 +135,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -187,9 +187,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ascii" @@ -221,7 +221,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -404,8 +404,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] @@ -415,21 +415,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.2.5", + "constant_time_eq 0.2.6", "digest 0.10.7", ] @@ -604,7 +604,7 @@ dependencies = [ "bitflags", "clap_derive 3.2.25", "clap_lex 0.2.4", - "indexmap", + "indexmap 1.9.3", "once_cell", "strsim 0.10.0", "termcolor", @@ -613,9 +613,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.2" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" +checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" dependencies = [ "clap_builder", "clap_derive 4.3.2", @@ -624,9 +624,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.1" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" dependencies = [ "anstream", "anstyle", @@ -652,7 +652,7 @@ version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6b5c519bab3ea61843a7923d074b04245624bb84a64a8c150f5deb014e388b" dependencies = [ - "clap 4.3.2", + "clap 4.3.9", ] [[package]] @@ -677,7 +677,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -716,7 +716,7 @@ dependencies = [ "k256", "lazy_static", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -733,7 +733,7 @@ dependencies = [ "once_cell", "pbkdf2 0.12.1", "rand", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -752,7 +752,7 @@ dependencies = [ "ripemd", "serde", "serde_derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "thiserror", ] @@ -809,7 +809,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784836d0812dade01579cc0cc9b1684847044e716fd7aa6bffbc172e42199500" dependencies = [ - "clap 4.3.2", + "clap 4.3.9", "entities", "memchr", "once_cell", @@ -850,9 +850,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -867,23 +867,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.21", + "time 0.3.22", "version_check", ] [[package]] name = "cookie_store" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e4b6aa369f41f5faa04bb80c9b1f4216ea81646ed6124d76ba5c49a7aafd9cd" +checksum = "d606d0fba62e13cf04db20536c05cb7f13673c161cb47a47a82b9b9e7d3f1daa" dependencies = [ "cookie", "idna 0.2.3", "log", "publicsuffix", "serde", + "serde_derive", "serde_json", - "time 0.3.21", + "time 0.3.22", "url", ] @@ -929,9 +930,9 @@ checksum = "328b822bdcba4d4e402be8d9adb6eebf269f969f8eadef977a553ff3c4fbcb58" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -974,22 +975,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1177,9 +1178,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "zeroize", @@ -1408,7 +1409,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -1424,6 +1425,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.3.1" @@ -1461,7 +1468,7 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "thiserror", "uuid", @@ -1517,7 +1524,7 @@ checksum = "dd65f1b59dd22d680c7a626cc4a000c1e03d241c51c3e034d2bc9f1e90734f9b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -1629,7 +1636,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "forc" -version = "0.40.1" +version = "0.41.0" dependencies = [ "annotate-snippets", "ansi_term", @@ -1661,7 +1668,7 @@ dependencies = [ [[package]] name = "forc-client" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "async-trait", @@ -1693,10 +1700,10 @@ dependencies = [ [[package]] name = "forc-doc" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", - "clap 4.3.2", + "clap 4.3.9", "colored", "comrak", "forc-pkg", @@ -1713,7 +1720,7 @@ dependencies = [ [[package]] name = "forc-fmt" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "clap 3.2.25", @@ -1730,7 +1737,7 @@ dependencies = [ [[package]] name = "forc-lsp" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "clap 3.2.25", @@ -1740,7 +1747,7 @@ dependencies = [ [[package]] name = "forc-pkg" -version = "0.40.1" +version = "0.41.0" dependencies = [ "ansi_term", "anyhow", @@ -1775,7 +1782,7 @@ dependencies = [ [[package]] name = "forc-test" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "forc-pkg", @@ -1790,7 +1797,7 @@ dependencies = [ [[package]] name = "forc-tracing" -version = "0.40.1" +version = "0.41.0" dependencies = [ "ansi_term", "tracing", @@ -1799,7 +1806,7 @@ dependencies = [ [[package]] name = "forc-tx" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "clap 3.2.25", @@ -1814,7 +1821,7 @@ dependencies = [ [[package]] name = "forc-util" -version = "0.40.1" +version = "0.41.0" dependencies = [ "annotate-snippets", "ansi_term", @@ -1911,7 +1918,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.18", + "syn 2.0.22", "thiserror", ] @@ -2012,7 +2019,7 @@ dependencies = [ "rand", "secp256k1 0.26.0", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "zeroize", ] @@ -2080,7 +2087,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7eed51e8869a40529c44dc6d971f3509f2a3aa55dc9b213d6f88ee2da38a3d44" dependencies = [ "educe", - "indexmap", + "indexmap 1.9.3", "quote", "serde", "snafu", @@ -2097,7 +2104,7 @@ dependencies = [ "fuel-storage", "hashbrown 0.13.2", "hex", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -2181,7 +2188,7 @@ dependencies = [ "itertools", "rand", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "tai64", "thiserror", "tokio", @@ -2200,7 +2207,7 @@ dependencies = [ "quote", "regex", "serde_json", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -2225,7 +2232,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "strum", "strum_macros 0.24.3", "thiserror", @@ -2246,7 +2253,7 @@ dependencies = [ "rand", "regex", "serde_json", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -2311,7 +2318,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -2400,9 +2407,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "git2" @@ -2493,9 +2500,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -2503,7 +2510,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -2557,6 +2564,12 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "heapless" version = "0.7.16" @@ -2595,15 +2608,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.1" @@ -2685,9 +2689,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -2746,10 +2750,10 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.1", - "rustls-native-certs 0.6.2", + "rustls 0.21.2", + "rustls-native-certs 0.6.3", "tokio", - "tokio-rustls 0.24.0", + "tokio-rustls 0.24.1", "webpki-roots 0.23.1", ] @@ -2780,9 +2784,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2920,6 +2924,16 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "inotify" version = "0.9.6" @@ -2951,9 +2965,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.29.0" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a28d25139df397cbca21408bb742cf6837e04cdbebf1b07b760caf971d6a972" +checksum = "28491f7753051e5704d4d0ae7860d45fae3238d7d235bc4289dcd45c48d3cec3" dependencies = [ "console", "lazy_static", @@ -3029,9 +3043,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" @@ -3071,9 +3085,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -3088,7 +3102,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.6", + "sha2 0.10.7", "signature", ] @@ -3132,9 +3146,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libgit2-sys" @@ -3209,9 +3223,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "logos" @@ -3272,7 +3286,7 @@ checksum = "a6cad67198fd7312508a9e9d8d90bd2808447b2905a75f8364c182f4b8868b74" dependencies = [ "anyhow", "chrono", - "clap 4.3.2", + "clap 4.3.9", "clap_complete 4.3.1", "env_logger", "handlebars", @@ -3320,9 +3334,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -3520,7 +3534,7 @@ dependencies = [ "core2", "digest 0.10.7", "multihash-derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "unsigned-varint", ] @@ -3683,11 +3697,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "libc", ] @@ -3767,9 +3781,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.54" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags", "cfg-if", @@ -3788,7 +3802,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -3808,9 +3822,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.88" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -3821,9 +3835,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "overload" @@ -3848,11 +3862,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.5.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec 1.0.1", "byte-slice-cast", "impl-trait-for-tuples", @@ -3862,9 +3876,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3917,7 +3931,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -3980,9 +3994,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -3990,9 +4004,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -4000,26 +4014,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -4029,7 +4043,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", "serde", "serde_derive", ] @@ -4095,7 +4109,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -4133,11 +4147,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ "base64 0.21.2", - "indexmap", + "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -4263,9 +4277,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -4308,9 +4322,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -4493,14 +4507,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.1", + "rustls 0.21.2", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-rustls 0.24.0", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", @@ -4540,7 +4554,7 @@ dependencies = [ "primitive-types", "ripemd", "secp256k1 0.24.3", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "substrate-bn", ] @@ -4664,9 +4678,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -4691,9 +4705,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" +checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" dependencies = [ "log", "ring", @@ -4715,9 +4729,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -4727,9 +4741,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64 0.21.2", ] @@ -4804,7 +4818,7 @@ dependencies = [ "hmac", "pbkdf2 0.11.0", "salsa20", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -4921,22 +4935,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -4950,9 +4964,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ "itoa", "ryu", @@ -4967,7 +4981,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -5019,9 +5033,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -5297,7 +5311,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "sway-ast" -version = "0.40.1" +version = "0.41.0" dependencies = [ "extension-trait", "num-bigint", @@ -5308,7 +5322,7 @@ dependencies = [ [[package]] name = "sway-core" -version = "0.40.1" +version = "0.41.0" dependencies = [ "clap 3.2.25", "derivative", @@ -5350,7 +5364,7 @@ dependencies = [ [[package]] name = "sway-error" -version = "0.40.1" +version = "0.41.0" dependencies = [ "extension-trait", "num-bigint", @@ -5362,7 +5376,7 @@ dependencies = [ [[package]] name = "sway-ir" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "downcast-rs", @@ -5377,7 +5391,7 @@ dependencies = [ [[package]] name = "sway-ir-macros" -version = "0.40.1" +version = "0.41.0" dependencies = [ "itertools", "proc-macro2", @@ -5387,7 +5401,7 @@ dependencies = [ [[package]] name = "sway-lsp" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "assert-json-diff", @@ -5439,7 +5453,7 @@ dependencies = [ [[package]] name = "sway-parse" -version = "0.40.1" +version = "0.41.0" dependencies = [ "assert_matches", "extension-trait", @@ -5456,7 +5470,7 @@ dependencies = [ [[package]] name = "sway-types" -version = "0.40.1" +version = "0.41.0" dependencies = [ "fuel-asm", "fuel-crypto", @@ -5467,14 +5481,14 @@ dependencies = [ [[package]] name = "sway-utils" -version = "0.40.1" +version = "0.41.0" dependencies = [ "serde", ] [[package]] name = "swayfmt" -version = "0.40.1" +version = "0.41.0" dependencies = [ "anyhow", "forc-tracing", @@ -5507,9 +5521,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" dependencies = [ "proc-macro2", "quote", @@ -5554,9 +5568,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.0" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f1dc6930a439cc5d154221b5387d153f8183529b07c19aca24ea31e0a167e1" +checksum = "9557d0845b86eea8182f7b10dff120214fb6cd9fd937b6f4917714e546a38695" dependencies = [ "cfg-if", "core-foundation-sys", @@ -5589,7 +5603,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5d17cb5ff4095af064048f25a0a8df815384f63ce21c7410e96b93016757259" dependencies = [ "glob", - "indexmap", + "indexmap 1.9.3", "logos", "regex", "rowan", @@ -5612,15 +5626,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -5682,7 +5697,7 @@ dependencies = [ "anyhow", "assert_matches", "bytes", - "clap 4.3.2", + "clap 4.3.9", "colored", "filecheck", "forc", @@ -5760,7 +5775,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -5786,9 +5801,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "serde", @@ -5837,11 +5852,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "374442f06ee49c3a28a8fc9f01a2596fed7559c6b99b31279c3261778e77d84f" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -5872,7 +5888,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -5898,11 +5914,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.1", + "rustls 0.21.2", "tokio", ] @@ -5931,17 +5947,17 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" dependencies = [ - "indexmap", + "indexmap 2.0.0", "toml_datetime", "winnow", ] @@ -6026,13 +6042,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] [[package]] @@ -6313,11 +6329,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -6341,9 +6356,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "serde", @@ -6353,24 +6368,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -6380,9 +6395,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6390,28 +6405,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -6457,9 +6472,9 @@ dependencies = [ [[package]] name = "whoami" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c70234412ca409cc04e864e89523cb0fc37f5e1344ebed5a3ebf4192b6b9f68" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" dependencies = [ "wasm-bindgen", "web-sys", @@ -6502,7 +6517,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -6535,7 +6550,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -6555,9 +6570,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -6654,9 +6669,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] @@ -6809,5 +6824,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.22", ] diff --git a/forc-pkg/Cargo.toml b/forc-pkg/Cargo.toml index dfbd3608e8f..4d9ffee8fda 100644 --- a/forc-pkg/Cargo.toml +++ b/forc-pkg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-pkg" -version = "0.40.1" +version = "0.41.0" description = "Building, locking, fetching and updating Sway projects as Forc packages." authors.workspace = true edition.workspace = true @@ -13,8 +13,8 @@ ansi_term = "0.12" anyhow = "1" cid = "0.10" fd-lock = "3.0" -forc-tracing = { version = "0.40.1", path = "../forc-tracing" } -forc-util = { version = "0.40.1", path = "../forc-util" } +forc-tracing = { version = "0.41.0", path = "../forc-tracing" } +forc-util = { version = "0.41.0", path = "../forc-util" } fuel-abi-types = "0.1" futures = "0.3" git2 = { version = "0.17.2", features = ["vendored-libgit2", "vendored-openssl"] } @@ -27,10 +27,10 @@ semver = { version = "1.0", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } serde_ignored = "0.1" serde_json = "1.0" -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } sysinfo = "0.29.0" tar = "0.4.38" toml = "0.5" diff --git a/forc-plugins/forc-client/Cargo.toml b/forc-plugins/forc-client/Cargo.toml index bf4aec90e20..78eea098f0c 100644 --- a/forc-plugins/forc-client/Cargo.toml +++ b/forc-plugins/forc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-client" -version = "0.40.1" +version = "0.41.0" description = "A `forc` plugin for interacting with a Fuel node." authors.workspace = true edition.workspace = true @@ -14,11 +14,11 @@ async-trait = "0.1.58" chrono = { version = "0.4", default-features = false, features = ["std"] } clap = { version = "3", features = ["derive", "env"] } devault = "0.1" -forc = { version = "0.40.1", path = "../../forc" } -forc-pkg = { version = "0.40.1", path = "../../forc-pkg" } -forc-tracing = { version = "0.40.1", path = "../../forc-tracing" } -forc-tx = { version = "0.40.1", path = "../forc-tx" } -forc-util = { version = "0.40.1", path = "../../forc-util" } +forc = { version = "0.41.0", path = "../../forc" } +forc-pkg = { version = "0.41.0", path = "../../forc-pkg" } +forc-tracing = { version = "0.41.0", path = "../../forc-tracing" } +forc-tx = { version = "0.41.0", path = "../forc-tx" } +forc-util = { version = "0.41.0", path = "../../forc-util" } fuel-core-client = { workspace = true } fuel-crypto = { workspace = true } fuel-tx = { workspace = true, features = ["builder"] } @@ -30,9 +30,9 @@ hex = "0.4.3" rand = "0.8" serde = "1.0" serde_json = "1" -sway-core = { version = "0.40.1", path = "../../sway-core" } -sway-types = { version = "0.40.1", path = "../../sway-types" } -sway-utils = { version = "0.40.1", path = "../../sway-utils" } +sway-core = { version = "0.41.0", path = "../../sway-core" } +sway-types = { version = "0.41.0", path = "../../sway-types" } +sway-utils = { version = "0.41.0", path = "../../sway-utils" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread", "process"] } tracing = "0.1" diff --git a/forc-plugins/forc-doc/Cargo.toml b/forc-plugins/forc-doc/Cargo.toml index 90e9a53742d..08595e16b8f 100644 --- a/forc-plugins/forc-doc/Cargo.toml +++ b/forc-plugins/forc-doc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-doc" -version = "0.40.1" +version = "0.41.0" description = "Build the documentation for the local package and all dependencies. The output is placed in `out/doc` in the same format as the project." authors.workspace = true edition.workspace = true @@ -13,13 +13,13 @@ anyhow = "1.0.65" clap = { version = "4.0.18", features = ["derive"] } colored = "2.0.0" comrak = "0.16" -forc-pkg = { version = "0.40.1", path = "../../forc-pkg" } -forc-util = { version = "0.40.1", path = "../../forc-util" } +forc-pkg = { version = "0.41.0", path = "../../forc-pkg" } +forc-util = { version = "0.41.0", path = "../../forc-util" } horrorshow = "0.8.4" include_dir = "0.7.3" opener = "0.5.0" -sway-ast = { version = "0.40.1", path = "../../sway-ast" } -sway-core = { version = "0.40.1", path = "../../sway-core" } -sway-lsp = { version = "0.40.1", path = "../../sway-lsp" } -sway-types = { version = "0.40.1", path = "../../sway-types" } -swayfmt = { version = "0.40.1", path = "../../swayfmt" } +sway-ast = { version = "0.41.0", path = "../../sway-ast" } +sway-core = { version = "0.41.0", path = "../../sway-core" } +sway-lsp = { version = "0.41.0", path = "../../sway-lsp" } +sway-types = { version = "0.41.0", path = "../../sway-types" } +swayfmt = { version = "0.41.0", path = "../../swayfmt" } diff --git a/forc-plugins/forc-fmt/Cargo.toml b/forc-plugins/forc-fmt/Cargo.toml index a86b0b69f58..672e3f1bddb 100644 --- a/forc-plugins/forc-fmt/Cargo.toml +++ b/forc-plugins/forc-fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-fmt" -version = "0.40.1" +version = "0.41.0" description = "A `forc` plugin for running the Sway code formatter." authors.workspace = true edition.workspace = true @@ -11,12 +11,12 @@ repository.workspace = true [dependencies] anyhow = "1" clap = { version = "3", features = ["derive"] } -forc-pkg = { version = "0.40.1", path = "../../forc-pkg" } -forc-tracing = { version = "0.40.1", path = "../../forc-tracing" } -forc-util = { version = "0.40.1", path = "../../forc-util" } +forc-pkg = { version = "0.41.0", path = "../../forc-pkg" } +forc-tracing = { version = "0.41.0", path = "../../forc-tracing" } +forc-util = { version = "0.41.0", path = "../../forc-util" } prettydiff = "0.5" -sway-core = { version = "0.40.1", path = "../../sway-core" } -sway-utils = { version = "0.40.1", path = "../../sway-utils" } -swayfmt = { version = "0.40.1", path = "../../swayfmt" } +sway-core = { version = "0.41.0", path = "../../sway-core" } +sway-utils = { version = "0.41.0", path = "../../sway-utils" } +swayfmt = { version = "0.41.0", path = "../../swayfmt" } taplo = "0.7" tracing = "0.1" diff --git a/forc-plugins/forc-lsp/Cargo.toml b/forc-plugins/forc-lsp/Cargo.toml index 501b71be44d..7822502365c 100644 --- a/forc-plugins/forc-lsp/Cargo.toml +++ b/forc-plugins/forc-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-lsp" -version = "0.40.1" +version = "0.41.0" description = "A simple `forc` plugin for starting the sway language server." authors.workspace = true edition.workspace = true @@ -11,5 +11,5 @@ repository.workspace = true [dependencies] anyhow = "1" clap = { version = "3", features = ["derive"] } -sway-lsp = { version = "0.40.1", path = "../../sway-lsp" } +sway-lsp = { version = "0.41.0", path = "../../sway-lsp" } tokio = { version = "1.8" } diff --git a/forc-plugins/forc-tx/Cargo.toml b/forc-plugins/forc-tx/Cargo.toml index b8da319ac5d..b456830c926 100644 --- a/forc-plugins/forc-tx/Cargo.toml +++ b/forc-plugins/forc-tx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-tx" -version = "0.40.1" +version = "0.41.0" description = "A `forc` plugin for constructing transactions." authors.workspace = true edition.workspace = true @@ -19,7 +19,7 @@ path = "src/main.rs" anyhow = "1" clap = { version = "3", features = ["derive", "env"] } devault = "0.1" -forc-util = { version = "0.40.1", path = "../../forc-util" } +forc-util = { version = "0.41.0", path = "../../forc-util" } fuel-tx = { workspace = true, features = ["serde"] } fuel-types = { workspace = true, features = ["serde"] } serde = "1.0" diff --git a/forc-test/Cargo.toml b/forc-test/Cargo.toml index 152de308eee..b0e1f9cbe32 100644 --- a/forc-test/Cargo.toml +++ b/forc-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-test" -version = "0.40.1" +version = "0.41.0" description = "A library for building and running Sway unit tests within Forc packages." authors.workspace = true edition.workspace = true @@ -10,11 +10,11 @@ repository.workspace = true [dependencies] anyhow = "1" -forc-pkg = { version = "0.40.1", path = "../forc-pkg" } +forc-pkg = { version = "0.41.0", path = "../forc-pkg" } fuel-abi-types = "0.2" fuel-tx = { workspace = true, features = ["builder"] } fuel-vm = { workspace = true, features = ["random"] } rand = "0.8" rayon = "1.7.0" -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-types = { version = "0.40.1", path = "../sway-types" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-types = { version = "0.41.0", path = "../sway-types" } diff --git a/forc-tracing/Cargo.toml b/forc-tracing/Cargo.toml index 8f2702532c6..e18dfc67745 100644 --- a/forc-tracing/Cargo.toml +++ b/forc-tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-tracing" -version = "0.40.1" +version = "0.41.0" description = "Tracing utility shared between forc crates." authors.workspace = true edition.workspace = true diff --git a/forc-util/Cargo.toml b/forc-util/Cargo.toml index 4ba90abf08f..01dec9b7439 100644 --- a/forc-util/Cargo.toml +++ b/forc-util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-util" -version = "0.40.1" +version = "0.41.0" description = "Utility items shared between forc crates." authors.workspace = true edition.workspace = true @@ -14,15 +14,15 @@ ansi_term = "0.12" anyhow = "1" clap = { version = "3.1", features = ["cargo", "derive", "env"] } dirs = "3.0.2" -forc-tracing = { version = "0.40.1", path = "../forc-tracing" } +forc-tracing = { version = "0.41.0", path = "../forc-tracing" } fuel-tx = { workspace = true, features = ["serde"], optional = true } hex = "0.4.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.73" -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "json"] } unicode-xid = "0.2.2" diff --git a/forc/Cargo.toml b/forc/Cargo.toml index 6db7b328538..a49074c374c 100644 --- a/forc/Cargo.toml +++ b/forc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc" -version = "0.40.1" +version = "0.41.0" description = "Fuel Orchestrator." authors.workspace = true edition.workspace = true @@ -22,18 +22,18 @@ ansi_term = "0.12" anyhow = "1.0.41" clap = { version = "3.1", features = ["cargo", "derive", "env"] } clap_complete = "3.1" -forc-pkg = { version = "0.40.1", path = "../forc-pkg" } -forc-test = { version = "0.40.1", path = "../forc-test" } -forc-tracing = { version = "0.40.1", path = "../forc-tracing" } -forc-util = { version = "0.40.1", path = "../forc-util" } +forc-pkg = { version = "0.41.0", path = "../forc-pkg" } +forc-test = { version = "0.41.0", path = "../forc-test" } +forc-tracing = { version = "0.41.0", path = "../forc-tracing" } +forc-util = { version = "0.41.0", path = "../forc-util" } fs_extra = "1.2" fuel-asm = { workspace = true } hex = "0.4.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.73" -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } term-table = "1.3" tokio = { version = "1.8.0", features = ["macros", "rt-multi-thread"] } toml = "0.5" diff --git a/sway-ast/Cargo.toml b/sway-ast/Cargo.toml index 2a61a574c83..d51b587dc8a 100644 --- a/sway-ast/Cargo.toml +++ b/sway-ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ast" -version = "0.40.1" +version = "0.41.0" description = "Sway's AST" authors.workspace = true edition.workspace = true @@ -13,4 +13,4 @@ extension-trait = "1.0.1" num-bigint = { version = "0.4.3", features = ["serde"] } num-traits = "0.2.14" serde = { version = "1.0", features = ["derive"] } -sway-types = { version = "0.40.1", path = "../sway-types" } +sway-types = { version = "0.41.0", path = "../sway-types" } diff --git a/sway-core/Cargo.toml b/sway-core/Cargo.toml index 2cf14418df7..d03bab94c39 100644 --- a/sway-core/Cargo.toml +++ b/sway-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-core" -version = "0.40.1" +version = "0.41.0" description = "Sway core language." authors.workspace = true edition.workspace = true @@ -34,12 +34,12 @@ serde_json = "1.0.91" sha2 = "0.9" smallvec = "1.7" strum = { version = "0.24.1", features = ["derive"] } -sway-ast = { version = "0.40.1", path = "../sway-ast" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-ir = { version = "0.40.1", path = "../sway-ir" } -sway-parse = { version = "0.40.1", path = "../sway-parse" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } +sway-ast = { version = "0.41.0", path = "../sway-ast" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-ir = { version = "0.41.0", path = "../sway-ir" } +sway-parse = { version = "0.41.0", path = "../sway-parse" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } sysinfo = "0.29.0" thiserror = "1.0" tracing = "0.1" diff --git a/sway-error/Cargo.toml b/sway-error/Cargo.toml index a9764f501ab..7cb78dffec7 100644 --- a/sway-error/Cargo.toml +++ b/sway-error/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-error" -version = "0.40.1" +version = "0.41.0" description = "Sway's error handling" authors.workspace = true edition.workspace = true @@ -12,6 +12,6 @@ repository.workspace = true extension-trait = "1.0.1" num-bigint = "0.4.3" num-traits = "0.2.14" -sway-ast = { version = "0.40.1", path = "../sway-ast" } -sway-types = { version = "0.40.1", path = "../sway-types" } +sway-ast = { version = "0.41.0", path = "../sway-ast" } +sway-types = { version = "0.41.0", path = "../sway-types" } thiserror = "1.0" diff --git a/sway-ir/Cargo.toml b/sway-ir/Cargo.toml index 520553b7124..877f467a819 100644 --- a/sway-ir/Cargo.toml +++ b/sway-ir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ir" -version = "0.40.1" +version = "0.41.0" description = "Sway intermediate representation." authors.workspace = true edition.workspace = true @@ -15,6 +15,6 @@ filecheck = "0.5" generational-arena = "0.2" peg = "0.7" rustc-hash = "1.1.0" -sway-ir-macros = { version = "0.40.1", path = "sway-ir-macros" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } +sway-ir-macros = { version = "0.41.0", path = "sway-ir-macros" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } diff --git a/sway-ir/sway-ir-macros/Cargo.toml b/sway-ir/sway-ir-macros/Cargo.toml index 8c91322fb27..308facabe3a 100644 --- a/sway-ir/sway-ir-macros/Cargo.toml +++ b/sway-ir/sway-ir-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ir-macros" -version = "0.40.1" +version = "0.41.0" description = "Macros for sway's intermediate representation." authors.workspace = true edition.workspace = true diff --git a/sway-lsp/Cargo.toml b/sway-lsp/Cargo.toml index 04c9b473623..ae084596ff9 100644 --- a/sway-lsp/Cargo.toml +++ b/sway-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-lsp" -version = "0.40.1" +version = "0.41.0" description = "LSP server for Sway." authors.workspace = true edition.workspace = true @@ -11,8 +11,8 @@ repository.workspace = true [dependencies] anyhow = "1.0.41" dashmap = "5.4" -forc-pkg = { version = "0.40.1", path = "../forc-pkg" } -forc-tracing = { version = "0.40.1", path = "../forc-tracing" } +forc-pkg = { version = "0.41.0", path = "../forc-pkg" } +forc-tracing = { version = "0.41.0", path = "../forc-tracing" } lsp-types = { version = "0.94", features = ["proposed"] } notify = "5.0.0" notify-debouncer-mini = { version = "0.2.0" } @@ -22,13 +22,13 @@ quote = "1.0.9" ropey = "1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.60" -sway-ast = { version = "0.40.1", path = "../sway-ast" } -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-parse = { version = "0.40.1", path = "../sway-parse" } -sway-types = { version = "0.40.1", path = "../sway-types" } -sway-utils = { version = "0.40.1", path = "../sway-utils" } -swayfmt = { version = "0.40.1", path = "../swayfmt" } +sway-ast = { version = "0.41.0", path = "../sway-ast" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-parse = { version = "0.41.0", path = "../sway-parse" } +sway-types = { version = "0.41.0", path = "../sway-types" } +sway-utils = { version = "0.41.0", path = "../sway-utils" } +swayfmt = { version = "0.41.0", path = "../swayfmt" } syn = { version = "1.0.73", features = ["full"] } tempfile = "3" thiserror = "1.0.30" diff --git a/sway-parse/Cargo.toml b/sway-parse/Cargo.toml index b75132a653b..7fc562a769b 100644 --- a/sway-parse/Cargo.toml +++ b/sway-parse/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-parse" -version = "0.40.1" +version = "0.41.0" description = "Sway's parser" authors.workspace = true edition.workspace = true @@ -13,9 +13,9 @@ extension-trait = "1.0.1" num-bigint = "0.4.3" num-traits = "0.2.14" phf = { version = "0.10.1", features = ["macros"] } -sway-ast = { version = "0.40.1", path = "../sway-ast" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-types = { version = "0.40.1", path = "../sway-types" } +sway-ast = { version = "0.41.0", path = "../sway-ast" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-types = { version = "0.41.0", path = "../sway-types" } thiserror = "1.0" unicode-xid = "0.2.2" diff --git a/sway-types/Cargo.toml b/sway-types/Cargo.toml index 90020955803..8fb9ead03da 100644 --- a/sway-types/Cargo.toml +++ b/sway-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-types" -version = "0.40.1" +version = "0.41.0" description = "Sway core types." authors.workspace = true edition.workspace = true diff --git a/sway-utils/Cargo.toml b/sway-utils/Cargo.toml index f51c8fd6b75..00b38097902 100644 --- a/sway-utils/Cargo.toml +++ b/sway-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-utils" -version = "0.40.1" +version = "0.41.0" description = "Sway common utils." authors.workspace = true edition.workspace = true diff --git a/swayfmt/Cargo.toml b/swayfmt/Cargo.toml index 35b5761db99..b5eb06e9470 100644 --- a/swayfmt/Cargo.toml +++ b/swayfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "swayfmt" -version = "0.40.1" +version = "0.41.0" description = "Sway language formatter." authors.workspace = true edition.workspace = true @@ -10,16 +10,16 @@ repository.workspace = true [dependencies] anyhow = "1" -forc-tracing = { version = "0.40.1", path = "../forc-tracing" } -forc-util = { version = "0.40.1", path = "../forc-util" } +forc-tracing = { version = "0.41.0", path = "../forc-tracing" } +forc-util = { version = "0.41.0", path = "../forc-util" } ropey = "1.5" serde = { version = "1.0", features = ["derive"] } serde_ignored = "0.1" -sway-ast = { version = "0.40.1", path = "../sway-ast" } -sway-core = { version = "0.40.1", path = "../sway-core" } -sway-error = { version = "0.40.1", path = "../sway-error" } -sway-parse = { version = "0.40.1", path = "../sway-parse" } -sway-types = { version = "0.40.1", path = "../sway-types" } +sway-ast = { version = "0.41.0", path = "../sway-ast" } +sway-core = { version = "0.41.0", path = "../sway-core" } +sway-error = { version = "0.41.0", path = "../sway-error" } +sway-parse = { version = "0.41.0", path = "../sway-parse" } +sway-types = { version = "0.41.0", path = "../sway-types" } thiserror = "1.0.30" toml = "0.5" From 0d45b890c9eaa75b88093a9a4cbecbf5ca8c0731 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Fri, 30 Jun 2023 05:27:22 +0200 Subject: [PATCH 6/6] Fix style guide example not using local std (#4721) ## Description Style guide example is blocking new releases because it tries to use an unpublished version of std ## 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] 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. --- docs/reference/src/code/Forc.lock | 101 ++++++++---------- .../style-guide/pattern_matching/Forc.toml | 1 + 2 files changed, 47 insertions(+), 55 deletions(-) diff --git a/docs/reference/src/code/Forc.lock b/docs/reference/src/code/Forc.lock index d241c934504..a5c81291d34 100644 --- a/docs/reference/src/code/Forc.lock +++ b/docs/reference/src/code/Forc.lock @@ -1,27 +1,27 @@ [[package]] name = 'annotation_style' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'annotations' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'arrays' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'assertions' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'asset_operations' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'associated-consts' @@ -30,30 +30,30 @@ source = 'member' [[package]] name = 'booleans' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'bytes' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'call' source = 'member' dependencies = [ 'contract_interface', - 'std path+from-root-0F28276288D2432C', + 'std', ] [[package]] name = 'call_data' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'comments' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'constants' @@ -62,198 +62,189 @@ source = 'member' [[package]] name = 'contract_interface' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'control_flow' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'core' source = 'path+from-root-0F28276288D2432C' -[[package]] -name = 'core' -source = 'path+from-root-D62A8C57DD8D2801' - [[package]] name = 'counter' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'empty_storage_init' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'enum-advanced' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'enum_style' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'enums' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'fizzbuzz' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'functions' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'hashing' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'interface' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'letter_casing' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'logging' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'my_lib' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'my_library' source = 'member' dependencies = [ 'my_other_library', - 'std path+from-root-0F28276288D2432C', + 'std', ] [[package]] name = 'my_other_library' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'namespace' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'numerics' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'ownership' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'pattern_matching' source = 'member' -dependencies = ['std git+https://github.com/fuellabs/sway?tag=v0.40.1#48104d0bde0d343154a5bc39a310092532883235'] +dependencies = ['std'] [[package]] name = 'reading_writing_to_storage' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'simple_predicate' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'simple_script' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] - -[[package]] -name = 'std' -source = 'git+https://github.com/fuellabs/sway?tag=v0.40.1#48104d0bde0d343154a5bc39a310092532883235' -dependencies = ['core path+from-root-D62A8C57DD8D2801'] +dependencies = ['std'] [[package]] name = 'std' source = 'path+from-root-0F28276288D2432C' -dependencies = ['core path+from-root-0F28276288D2432C'] +dependencies = ['core'] [[package]] name = 'storage_init' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'storage_map' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'storage_vec' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'store_get' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'string_issue' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'strings' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'struct_shorthand' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'structs' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'tuples' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'variables' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] [[package]] name = 'wallet' source = 'member' dependencies = [ 'interface', - 'std path+from-root-0F28276288D2432C', + 'std', ] [[package]] name = 'wallet_example' source = 'member' -dependencies = ['std path+from-root-0F28276288D2432C'] +dependencies = ['std'] diff --git a/docs/reference/src/code/language/style-guide/pattern_matching/Forc.toml b/docs/reference/src/code/language/style-guide/pattern_matching/Forc.toml index f26b09aaece..3660a4257db 100644 --- a/docs/reference/src/code/language/style-guide/pattern_matching/Forc.toml +++ b/docs/reference/src/code/language/style-guide/pattern_matching/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "pattern_matching" [dependencies] +std = { path = "../../../../../../../sway-lib-std" }