text stringlengths 19 585k | label stringclasses 2
values | category stringclasses 2
values | language stringclasses 14
values | repo stringclasses 932
values | sha stringlengths 40 40 |
|---|---|---|---|---|---|
@@ -738,6 +738,28 @@ fn type_check_encode_append(
| TypeInfo::StringArray(_)
| TypeInfo::StringSlice
| TypeInfo::RawUntypedSlice => {}
+ TypeInfo::Tuple(items) => {
+ if items.len() != 2 {
+ return Err(
+ handler.... | bad | review | rust | FuelLabs/sway | 2a991efd623ecab749d2a36791ec55e3dfafeb62 |
diff --git a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs
index 012ceb4c038..4666c48f85b 100644
--- a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs
+++ b/sway-core/src/semantic_analysis/a... | good | review_fixed | rust | FuelLabs/sway | 2a991efd623ecab749d2a36791ec55e3dfafeb62 |
@@ -164,7 +164,12 @@ impl raw_slice {
/// }
/// ```
pub fn len<T>(self) -> u64 {
- into_parts(self).1 / __size_of::<T>()
+ let len = __size_of::<T>();
+ if len != 0 {
+ into_parts(self).1 / len
+ } else {
+ __revert(999); | bad | review | FuelLabs/sway | 2a991efd623ecab749d2a36791ec55e3dfafeb62 | |
diff --git a/sway-lib-std/src/raw_slice.sw b/sway-lib-std/src/raw_slice.sw
index bb1f8e265b4..e56d7effda0 100644
--- a/sway-lib-std/src/raw_slice.sw
+++ b/sway-lib-std/src/raw_slice.sw
@@ -2,6 +2,7 @@ library;
use ::ops::*;
use ::raw_ptr::*;
+use ::error_signals::REVERT_WITH_RAW_SLICE_LEN_ZST;
/// Trait to retur... | good | review_fixed | FuelLabs/sway | 2a991efd623ecab749d2a36791ec55e3dfafeb62 | |
@@ -71,12 +71,12 @@ output:
Building test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg
Compiling library std (sway-lib-std)
Compiling script dbg (test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg)
- Finished debug [unoptimized + fuel] target(s) [36.496 KB] in ... | bad | review | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg/stdout.snap b/test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg/stdout.snap
index faafb9f67a3..e9729e9656c 100644
--- a/test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg/stdout.snap
+++ b/tes... | good | review_fixed | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
@@ -162,19 +162,14 @@ impl raw_ptr {
/// assert(ptr.read::<u64>() == 5);
/// }
/// ```
- pub fn write<T>(self, val: T) {
- if __is_reference_type::<T>() {
- asm(dst: self, src: val, count: __size_of_val(val)) {
- mcp dst src count;
- };
- } else i... | bad | review | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
diff --git a/sway-lib-std/src/raw_ptr.sw b/sway-lib-std/src/raw_ptr.sw
index 8fc2d0cecdd..63aa2bfcdd7 100644
--- a/sway-lib-std/src/raw_ptr.sw
+++ b/sway-lib-std/src/raw_ptr.sw
@@ -163,19 +163,19 @@ impl raw_ptr {
/// }
/// ```
pub fn write<T>(self, val: T) {
- if __is_reference_type::<T>() {
- ... | good | review_fixed | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
@@ -162,19 +162,14 @@ impl raw_ptr {
/// assert(ptr.read::<u64>() == 5);
/// }
/// ```
- pub fn write<T>(self, val: T) {
- if __is_reference_type::<T>() {
- asm(dst: self, src: val, count: __size_of_val(val)) {
- mcp dst src count;
- };
- } else i... | bad | review | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
diff --git a/sway-lib-std/src/raw_ptr.sw b/sway-lib-std/src/raw_ptr.sw
index 8fc2d0cecdd..63aa2bfcdd7 100644
--- a/sway-lib-std/src/raw_ptr.sw
+++ b/sway-lib-std/src/raw_ptr.sw
@@ -163,19 +163,19 @@ impl raw_ptr {
/// }
/// ```
pub fn write<T>(self, val: T) {
- if __is_reference_type::<T>() {
- ... | good | review_fixed | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
@@ -2610,3 +2610,14 @@ fn test_vector_iter() {
assert(iter.next() == None);
assert(iter.next() == None);
}
+
+#[test]
+fn test_main() {
+ let _ = main();
+}
+
+#[test]
+fn test_zst() {
+ let mut v = Vec::new();
+ v.push(()); | bad | review | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/vec/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/vec/src/main.sw
index eb80bc51725..3741f482007 100644
--- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/vec/src/main.sw
+++ b/test/src/e2e_vm_tests/test_programs/should... | good | review_fixed | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
@@ -167,15 +167,15 @@ impl raw_ptr {
asm(dst: self, src: val, count: __size_of_val(val)) {
mcp dst src count;
};
- } else if __size_of::<T>() == 1 {
- asm(ptr: self, val: val) {
- sb ptr val i0;
- };
- } else {
- as... | bad | review | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
diff --git a/sway-lib-std/src/raw_ptr.sw b/sway-lib-std/src/raw_ptr.sw
index 8fc2d0cecdd..63aa2bfcdd7 100644
--- a/sway-lib-std/src/raw_ptr.sw
+++ b/sway-lib-std/src/raw_ptr.sw
@@ -163,19 +163,19 @@ impl raw_ptr {
/// }
/// ```
pub fn write<T>(self, val: T) {
- if __is_reference_type::<T>() {
- ... | good | review_fixed | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 | |
@@ -4068,26 +4068,54 @@ impl<'a> FnCompiler<'a> {
// Compile the struct expression.
let compiled_value = return_on_termination_or_extract!(
self.compile_expression_to_memory(context, md_mgr, exp)?
- )
- .expect_memory();
+ );
- // Get the variant type.
- ... | bad | review | rust | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 |
diff --git a/sway-core/src/ir_generation/function.rs b/sway-core/src/ir_generation/function.rs
index b3089c62be5..812d8fe0a82 100644
--- a/sway-core/src/ir_generation/function.rs
+++ b/sway-core/src/ir_generation/function.rs
@@ -4068,26 +4068,88 @@ impl<'a> FnCompiler<'a> {
// Compile the struct expression.
... | good | review_fixed | rust | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 |
@@ -4068,26 +4068,54 @@ impl<'a> FnCompiler<'a> {
// Compile the struct expression.
let compiled_value = return_on_termination_or_extract!(
self.compile_expression_to_memory(context, md_mgr, exp)?
- )
- .expect_memory();
+ );
- // Get the variant type.
- ... | bad | review | rust | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 |
diff --git a/sway-core/src/ir_generation/function.rs b/sway-core/src/ir_generation/function.rs
index b3089c62be5..812d8fe0a82 100644
--- a/sway-core/src/ir_generation/function.rs
+++ b/sway-core/src/ir_generation/function.rs
@@ -4068,26 +4068,88 @@ impl<'a> FnCompiler<'a> {
// Compile the struct expression.
... | good | review_fixed | rust | FuelLabs/sway | 69ac773306a480b5013bc9fe53af650da8b54f04 |
@@ -0,0 +1,172 @@
+// TODO: The initial reason for having several `storage_vec` tests is
+// reaching the limit in the data section size of a single contract
+// that contained all the tests for `StorageVec<T>` methods.
+// See: https://github.com/FuelLabs/sway/issues/7612
+// But even when the ... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/test/src/in_language_tests/test_programs/storage_vec_insert_contract_tests/src/main.sw b/test/src/in_language_tests/test_programs/storage_vec_insert_contract_tests/src/main.sw
new file mode 100644
index 00000000000..d523111a552
--- /dev/null
+++ b/test/src/in_language_tests/test_programs/storage_vec_insert... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+
+# Run `forc test` individually for each project under test_programs/.
+#
+# Usage: ./run_in_language_tests.sh [extra `forc test` args, e.g. --release --experimental ...]
+#
+# Note: --error-on-warnings arg is always passed to `forc test`.
+#
+# The script continues even when ind... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/test/src/in_language_tests/run_in_language_tests.sh b/test/src/in_language_tests/run_in_language_tests.sh
new file mode 100755
index 00000000000..d09239e82e1
--- /dev/null
+++ b/test/src/in_language_tests/run_in_language_tests.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+# Run `forc test` individually for e... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -817,28 +944,29 @@ impl<V> StorageKey<StorageVec<V>> {
///
/// storage.vec.store_vec(vec);
///
- /// assert(5 == storage.vec.get(0).unwrap().read());
- /// assert(10 == storage.vec.get(1).unwrap().read());
- /// assert(15 == storage.vec.get(2).unwrap().read());
+ /// as... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*;
+use ::marker::*;
+
+/// Describes an out-of-bounds `StorageVec` access.
+pub struct OutOfBounds {
+ /// The length of the `StorageVec`.
+ pub length: u64,
+ /// The index that was out-of-bounds.
+ /// `index` i... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -34,33 +109,48 @@ impl<V> StorageKey<StorageVec<V>> {
/// use std::storage::storage_vec::*;
///
/// storage {
- /// vec: StorageVec<u64> = StorageVec {}
+ /// vec: StorageVec<u64> = StorageVec {},
+ /// vec_of_vec: StorageVec<StorageVec<u64>> = StorageVec {},
/// }
///
... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -724,13 +854,17 @@ impl<V> StorageKey<StorageVec<V>> {
/// # Additional Information
///
/// If `new_len` is greater than `len`, `self` is extended by the difference, with each
- /// additional slot being filled with `value`. If the `new_len` is less than `len`, `self` is
+ /// additional element... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -1021,10 +1152,1366 @@ impl<V> Iterator for StorageVecIter<V> {
}
}
-// Add padding to type so it can correctly use the storage api
+/// Calculates the offset of the element at `index`
+/// starting from the beginning of the slot at which
+/// the `StorageVec` content starts.
+///
+/// Adds padding to the ty... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -1021,10 +1152,1366 @@ impl<V> Iterator for StorageVecIter<V> {
}
}
-// Add padding to type so it can correctly use the storage api
+/// Calculates the offset of the element at `index`
+/// starting from the beginning of the slot at which
+/// the `StorageVec` content starts.
+///
+/// Adds padding to the ty... | bad | review | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
diff --git a/sway-lib-std/src/storage/storage_vec.sw b/sway-lib-std/src/storage/storage_vec.sw
index c1c2073fdd9..369b7de24dc 100644
--- a/sway-lib-std/src/storage/storage_vec.sw
+++ b/sway-lib-std/src/storage/storage_vec.sw
@@ -10,14 +10,89 @@ use ::vec::Vec;
use ::iterator::Iterator;
use ::codec::*;
use ::debug::*... | good | review_fixed | FuelLabs/sway | ecc2c92ea28c187e76d47f70d6de0024c884c202 | |
@@ -0,0 +1,6 @@
+category = "compile"
+experimental = { new_encoding = true, dynamic_storage = true }
+expected_warnings = 0
+experimental_new_encoding = true | bad | review | FuelLabs/sway | 78292cb6ebbad0b270ef56a98c718eee0c03d533 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/payable_non_zero_coins/test.dynamic_storage.toml b/test/src/e2e_vm_tests/test_programs/should_pass/payable_non_zero_coins/test.dynamic_storage.toml
new file mode 100644
index 00000000000..d8073b9fa6b
--- /dev/null
+++ b/test/src/e2e_vm_tests/test_programs/sho... | good | review_fixed | FuelLabs/sway | 78292cb6ebbad0b270ef56a98c718eee0c03d533 | |
@@ -0,0 +1,5 @@
+category = "unit_tests_pass"
+experimental = { new_encoding = true, dynamic_storage = true }
+validate_abi = true | bad | review | FuelLabs/sway | 78292cb6ebbad0b270ef56a98c718eee0c03d533 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/test.dynamic_storage.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/test.dynamic_storage.toml
new file mode 100644
index 00000000000..8d611f852b4
--- /dev/null
+++ b/test/src/e2e_vm_tests/test_... | good | review_fixed | FuelLabs/sway | 78292cb6ebbad0b270ef56a98c718eee0c03d533 | |
@@ -0,0 +1,130 @@
+// TODO-IG: Add link to GitHub issue.
+library;
+
+trait CopySelf<D> {
+ fn copy_self(self, default: D) -> Self;
+}
+
+impl<T, const N: u64> CopySelf<T> for [T; N]
+where
+ T: AbiEncode + PartialEq,
+{
+ fn copy_self(self, default: T) -> Self {
+ let mut array = [default; N];
+ ... | bad | review | FuelLabs/sway | 3c8b892282de63c81d6dc24e3a0be2b13176f866 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_generics_array_in_reassignments/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_generics_array_in_reassignments/src/main.sw
new file mode 100644
index 00000000000..3fa52bbd21e
--- /dev/null
+++ b/test/src/e2e_vm_tes... | good | review_fixed | FuelLabs/sway | 3c8b892282de63c81d6dc24e3a0be2b13176f866 | |
@@ -5,15 +5,47 @@ fn literal_index() -> u64 {
ary[4]
}
-const I: u64 = 4;
+// TODO: For reasoning behind not emitting error and possible alternatives see:
+// https://github.com/FuelLabs/sway/issues/7605
+fn literal_index_const_generic<const N: u64>() -> u64 {
+ let ary = [1; N];
+ ary[4] // THIS ... | bad | review | FuelLabs/sway | 3c8b892282de63c81d6dc24e3a0be2b13176f866 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/array_oob_const_index/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/array_oob_const_index/src/main.sw
index a82db990b29..36c45d06f24 100644
--- a/test/src/e2e_vm_tests/test_programs/should_fail/array_oob_const_index/src/main.sw
+++ b/test/src/... | good | review_fixed | FuelLabs/sway | 3c8b892282de63c81d6dc24e3a0be2b13176f866 | |
@@ -124,25 +411,72 @@ pub fn read_slice(key: b256) -> Option<raw_slice> {
/// assert(read_slice(b256::zero()).is_none());
/// }
/// ```
+#[deprecated(note = "Use `clear_slice_quads`, `clear_slice_slot`, or `clear_slice_slot_existed` instead.")]
#[storage(read, write)]
-pub fn clear_slice(key: b256) -> bool {
- ... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/sway-lib-std/src/storage/storable_slice.sw b/sway-lib-std/src/storage/storable_slice.sw
index d611ce08f66..9a6d277c5f1 100644
--- a/sway-lib-std/src/storage/storable_slice.sw
+++ b/sway-lib-std/src/storage/storable_slice.sw
@@ -1,3 +1,14 @@
+//! This module provides:
+//! - a `StorableSlice<T>` trait for s... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -489,6 +583,29 @@ impl Contract {
assert_eq(res, [42u64, 34u64, 44u64, 45u64]);
}
+ #[storage(read, write)]
+ fn state_update_slot_offset_equal_slot_length() {
+ let slots_data = [42u64, 43u64, 44u64, 45u64];
+ __state_store_slot(B256_ZERO, __addr_of(slots_data), 4 * 8);
+
+ ... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/storage_intrinsics/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/storage_intrinsics/src/main.sw
index f72a2c72f16..5bbe0e0d59c 100644
--- a/test/src/e2e_vm_tests/test_programs/should_pass/language/intrin... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -155,18 +517,159 @@ pub fn clear<T>(slot: b256, offset: u64) -> bool {
__state_clear(offset_slot, number_of_slots)
}
-/// Given a slot, offset, and type this function determines where something should be stored.
+/// Clears a value of type `T` from slots of 32 bytes each, starting at `slot` with an `offset` ... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/sway-lib-std/src/storage/storage_api.sw b/sway-lib-std/src/storage/storage_api.sw
index 2a34d01e20a..e49cdc0d766 100644
--- a/sway-lib-std/src/storage/storage_api.sw
+++ b/sway-lib-std/src/storage/storage_api.sw
@@ -5,37 +5,54 @@ use ::option::Option::{self, *};
use ::ops::*;
use ::primitive_conversions:... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -5616,72 +5616,86 @@ impl<'a> FnCompiler<'a> {
&mut self,
context: &mut Context,
md_mgr: &mut MetadataManager,
- storage_field_names: Vec<String>,
+ storage_field_path: Vec<String>,
struct_field_names: Vec<String>,
key: Option<U256>,
indices: &[u64]... | bad | review | rust | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 |
diff --git a/sway-core/src/ir_generation/function.rs b/sway-core/src/ir_generation/function.rs
index f7658966e6f..b3089c62be5 100644
--- a/sway-core/src/ir_generation/function.rs
+++ b/sway-core/src/ir_generation/function.rs
@@ -796,7 +796,7 @@ impl<'a> FnCompiler<'a> {
self.compile_storage_access(
... | good | review_fixed | rust | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 |
@@ -60,23 +77,255 @@ pub fn write<T>(slot: b256, offset: u64, value: T) {
// Copy the value to be stored to `padded_value + offset`.
padded_value.add::<u64>(place_in_slot).write::<T>(value);
- // Now store back the data at `padded_value` which now contains the old data but partially
+ // Now store ba... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/sway-lib-std/src/storage/storage_api.sw b/sway-lib-std/src/storage/storage_api.sw
index 2a34d01e20a..e49cdc0d766 100644
--- a/sway-lib-std/src/storage/storage_api.sw
+++ b/sway-lib-std/src/storage/storage_api.sw
@@ -5,37 +5,54 @@ use ::option::Option::{self, *};
use ::ops::*;
use ::primitive_conversions:... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -1,4 +1,6 @@
category = "compile"
+expected_warnings = 3
-# check: $()Storage write after external contract interaction in function or method "deposit". Consider making all storage writes before calling another contract
-expected_warnings = 2
+#unordered: $()Storage write after external contract interaction in fu... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation/test.toml
index d61220251df..a3faf9ffa87 100644
--- a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_p... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -1,4 +1,4 @@
category = "compile"
# check: $()Storage read after external contract interaction in function or method "deposit". Consider making all storage reads before calling another contract | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_read/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_read/test.toml
index 5541a6ffcdf..82200fd0bd5 100644
--- a/test/src/e2e_vm_tests/test_progra... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -1,4 +1,7 @@
category = "compile"
+expected_warnings = 3
+
+#unordered: $()Storage write after external contract interaction in function or method "deposit_quads". Consider making all storage writes before calling another contract | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_codeblocks_other_than_in_functions/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_codeblocks_other_than_in_functions/test.toml
index d61220251df..c8705e39acc 100644... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -1,4 +1,7 @@
category = "compile"
-
-# check: $()Storage write after external contract interaction in function or method "deposit". Consider making all storage writes before calling another contract
expected_warnings = 3
+
+#unordered: $()Storage read after external contract interaction in function or method "depo... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_func_app-1/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_func_app-1/test.toml
index 7105f663a21..227a04d0fcc 100644
--- a/test/src/e2e_vm_tests/test_programs/shoul... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -1,4 +1,7 @@
category = "compile"
-
-# check: $()Storage write after external contract interaction in function or method "deposit". Consider making all storage writes before calling another contract
expected_warnings = 3
+
+#unordered: $()Storage write after external contract interaction in function or method "dep... | bad | review | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_func_app-2/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_func_app-2/test.toml
index 7105f663a21..c8705e39acc 100644
--- a/test/src/e2e_vm_tests/test_programs/shoul... | good | review_fixed | FuelLabs/sway | 4470322123dad3af6202bfe55d90ea81164eacd1 | |
@@ -479,6 +493,58 @@ async fn fetch(fetch_id: u64, pinned: &Pinned, ipfs_node: &IPFSNode) -> anyhow::
Ok(path)
}
+/// Fetches package from CDN as a fallback when IPFS fails
+async fn fetch_from_s3(pinned: &Pinned, path: &Path) -> anyhow::Result<()> {
+ let client = reqwest::Client::new();
+
+ // Construct... | bad | review | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
diff --git a/forc-pkg/src/source/reg/mod.rs b/forc-pkg/src/source/reg/mod.rs
index 0e271307ea0..10382582a49 100644
--- a/forc-pkg/src/source/reg/mod.rs
+++ b/forc-pkg/src/source/reg/mod.rs
@@ -11,6 +11,7 @@ use crate::{
};
use anyhow::{anyhow, bail, Context};
use file_location::{location_from_root, Namespace};
+use ... | good | review_fixed | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
@@ -479,6 +493,61 @@ async fn fetch(fetch_id: u64, pinned: &Pinned, ipfs_node: &IPFSNode) -> anyhow::
Ok(path)
}
+/// Fetches package from CDN as a fallback when IPFS fails
+async fn fetch_from_s3(pinned: &Pinned, path: &Path) -> anyhow::Result<()> {
+ let client = reqwest::Client::new();
+
+ // Construct... | bad | review | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
diff --git a/forc-pkg/src/source/reg/mod.rs b/forc-pkg/src/source/reg/mod.rs
index 0e271307ea0..10382582a49 100644
--- a/forc-pkg/src/source/reg/mod.rs
+++ b/forc-pkg/src/source/reg/mod.rs
@@ -11,6 +11,7 @@ use crate::{
};
use anyhow::{anyhow, bail, Context};
use file_location::{location_from_root, Namespace};
+use ... | good | review_fixed | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
@@ -479,6 +493,61 @@ async fn fetch(fetch_id: u64, pinned: &Pinned, ipfs_node: &IPFSNode) -> anyhow::
Ok(path)
}
+/// Fetches package from CDN as a fallback when IPFS fails
+async fn fetch_from_s3(pinned: &Pinned, path: &Path) -> anyhow::Result<()> {
+ let client = reqwest::Client::new();
+
+ // Construct... | bad | review | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
diff --git a/forc-pkg/src/source/reg/mod.rs b/forc-pkg/src/source/reg/mod.rs
index 0e271307ea0..10382582a49 100644
--- a/forc-pkg/src/source/reg/mod.rs
+++ b/forc-pkg/src/source/reg/mod.rs
@@ -11,6 +11,7 @@ use crate::{
};
use anyhow::{anyhow, bail, Context};
use file_location::{location_from_root, Namespace};
+use ... | good | review_fixed | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
@@ -479,6 +493,61 @@ async fn fetch(fetch_id: u64, pinned: &Pinned, ipfs_node: &IPFSNode) -> anyhow::
Ok(path)
}
+/// Fetches package from CDN as a fallback when IPFS fails
+async fn fetch_from_s3(pinned: &Pinned, path: &Path) -> anyhow::Result<()> {
+ let client = reqwest::Client::new();
+
+ // Construct... | bad | review | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
diff --git a/forc-pkg/src/source/reg/mod.rs b/forc-pkg/src/source/reg/mod.rs
index 0e271307ea0..10382582a49 100644
--- a/forc-pkg/src/source/reg/mod.rs
+++ b/forc-pkg/src/source/reg/mod.rs
@@ -11,6 +11,7 @@ use crate::{
};
use anyhow::{anyhow, bail, Context};
use file_location::{location_from_root, Namespace};
+use ... | good | review_fixed | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
@@ -479,6 +493,61 @@ async fn fetch(fetch_id: u64, pinned: &Pinned, ipfs_node: &IPFSNode) -> anyhow::
Ok(path)
}
+/// Fetches package from CDN as a fallback when IPFS fails
+async fn fetch_from_s3(pinned: &Pinned, path: &Path) -> anyhow::Result<()> {
+ let client = reqwest::Client::new(); | bad | review | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
diff --git a/forc-pkg/src/source/reg/mod.rs b/forc-pkg/src/source/reg/mod.rs
index 0e271307ea0..10382582a49 100644
--- a/forc-pkg/src/source/reg/mod.rs
+++ b/forc-pkg/src/source/reg/mod.rs
@@ -11,6 +11,7 @@ use crate::{
};
use anyhow::{anyhow, bail, Context};
use file_location::{location_from_root, Namespace};
+use ... | good | review_fixed | rust | FuelLabs/sway | b400478f3f91dc545650a2161aa874b508e70980 |
@@ -526,6 +526,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id(),
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_exte... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +527,56 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -527,6 +528,59 @@ impl TyImplSelfOrTrait {
implementing_for.type_id,
)?;
+ // Disallow inherent implementations for types defined outside the current package
+ let current_pkg = ctx.namespace().current_package_ref();
+ let is_extern... | bad | review | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
index d1e8a611791..bd66481df8c 100644
--- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs
+++ b/sway-core/src/semantic_analysis/ast_node/declaration/i... | good | review_fixed | rust | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 |
@@ -1,4 +1,7 @@
-category = "fail"
+# TODO update this once the inherent impl warning becomes a hard error.
+category = "compile"
+expected_warnings = 2 | bad | review | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 | |
diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/trait_coherence/impl_self_overlap/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/trait_coherence/impl_self_overlap/test.toml
index 29efbacada8..599f06cac9b 100644
--- a/test/src/e2e_vm_tests/test_programs/should_fail/trait_coherence/impl_self_ove... | good | review_fixed | FuelLabs/sway | 770e69e537d177d1d82e7692cca913c5b621d051 | |
@@ -1582,22 +1856,27 @@ fn type_check_arith_binary_op(
return Err(handler.emit_err(CompileError::IntrinsicIncorrectNumArgs {
name: kind.to_string(),
expected: 2,
- span,
+ actual: arguments.len(),
+ span: span_of_arguments(arguments, &span),
}... | bad | review | rust | FuelLabs/sway | b5e6a40b1fdda31e38456a3572b8f626d17539a9 |
diff --git a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs
index 0dab6f365c4..012ceb4c038 100644
--- a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs
+++ b/sway-core/src/semantic_analysis/a... | good | review_fixed | rust | FuelLabs/sway | b5e6a40b1fdda31e38456a3572b8f626d17539a9 |
@@ -637,8 +637,15 @@ fn effects_of_expression(engines: &Engines, expr: &ty::TyExpression) -> HashSet<
fn effects_of_intrinsic(intr: &sway_ast::Intrinsic) -> HashSet<Effect> {
use sway_ast::Intrinsic::*;
match intr {
- StateClear | StateStoreWord | StateStoreQuad => HashSet::from([Effect::StorageWrite]... | bad | review | rust | FuelLabs/sway | b5e6a40b1fdda31e38456a3572b8f626d17539a9 |
diff --git a/sway-core/src/semantic_analysis/cei_pattern_analysis.rs b/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
index a23133fd4d4..e13cf98378a 100644
--- a/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
+++ b/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
@@ -637,8 +637,15 @@ fn effects... | good | review_fixed | rust | FuelLabs/sway | b5e6a40b1fdda31e38456a3572b8f626d17539a9 |
@@ -1151,6 +1173,91 @@ impl InstructionVerifier<'_, '_> {
Ok(())
}
+ fn verify_state_read_slot(
+ &self,
+ load_val: &Value,
+ key: &Value,
+ offset: &Value,
+ len: &Value,
+ ) -> Result<(), IrError> {
+ self.expect_untyped_ptr(
+ load_val,
+ ... | bad | review | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
diff --git a/sway-ir/src/verify.rs b/sway-ir/src/verify.rs
index 98858891dcc..a6629a353f6 100644
--- a/sway-ir/src/verify.rs
+++ b/sway-ir/src/verify.rs
@@ -308,6 +308,10 @@ impl InstructionVerifier<'_, '_> {
FuelVmInstruction::StateClear {
key,
num... | good | review_fixed | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
@@ -685,8 +685,9 @@ fn effects_of_intrinsic(intr: &sway_ast::Intrinsic) -> HashSet<Effect> {
fn effects_of_asm_op(op: &AsmOp) -> HashSet<Effect> {
match op.op_name.as_str().to_lowercase().as_str() {
- "scwq" | "sww" | "swwq" => HashSet::from([Effect::StorageWrite]),
- "srw" | "srwq" => HashSet::fr... | bad | review | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
diff --git a/sway-core/src/semantic_analysis/cei_pattern_analysis.rs b/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
index 0f838ef91c2..a23133fd4d4 100644
--- a/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
+++ b/sway-core/src/semantic_analysis/cei_pattern_analysis.rs
@@ -685,8 +685,19 @@ fn effects... | good | review_fixed | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
@@ -1151,6 +1173,91 @@ impl InstructionVerifier<'_, '_> {
Ok(())
}
+ fn verify_state_read_slot(
+ &self,
+ load_val: &Value,
+ key: &Value,
+ offset: &Value,
+ len: &Value,
+ ) -> Result<(), IrError> {
+ self.expect_untyped_ptr(
+ load_val,
+ ... | bad | review | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
diff --git a/sway-ir/src/verify.rs b/sway-ir/src/verify.rs
index 98858891dcc..a6629a353f6 100644
--- a/sway-ir/src/verify.rs
+++ b/sway-ir/src/verify.rs
@@ -308,6 +308,10 @@ impl InstructionVerifier<'_, '_> {
FuelVmInstruction::StateClear {
key,
num... | good | review_fixed | rust | FuelLabs/sway | a871f09720d69cdb15106a526ac2493cbd687796 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.