diff --git a/arbitrator/langs/rust b/arbitrator/langs/rust index 228834db0..1398a1b4a 160000 --- a/arbitrator/langs/rust +++ b/arbitrator/langs/rust @@ -1 +1 @@ -Subproject commit 228834db02f498b3c2f671b1859552275e647d05 +Subproject commit 1398a1b4a636801347876cf222cdc1d69c529556 diff --git a/arbitrator/stylus/tests/create/Cargo.lock b/arbitrator/stylus/tests/create/Cargo.lock index 924fd6a28..3eb008301 100644 --- a/arbitrator/stylus/tests/create/Cargo.lock +++ b/arbitrator/stylus/tests/create/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/erc20/Cargo.lock b/arbitrator/stylus/tests/erc20/Cargo.lock index f3a316a45..86708b5a4 100644 --- a/arbitrator/stylus/tests/erc20/Cargo.lock +++ b/arbitrator/stylus/tests/erc20/Cargo.lock @@ -646,9 +646,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -664,7 +662,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/evm-data/Cargo.lock b/arbitrator/stylus/tests/evm-data/Cargo.lock index 8191751e5..2ad8082a7 100644 --- a/arbitrator/stylus/tests/evm-data/Cargo.lock +++ b/arbitrator/stylus/tests/evm-data/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/fallible/Cargo.lock b/arbitrator/stylus/tests/fallible/Cargo.lock index 94e121d48..0390292af 100644 --- a/arbitrator/stylus/tests/fallible/Cargo.lock +++ b/arbitrator/stylus/tests/fallible/Cargo.lock @@ -435,9 +435,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -453,7 +451,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/keccak-100/Cargo.lock b/arbitrator/stylus/tests/keccak-100/Cargo.lock index 0b6090627..d6cb6e6e6 100644 --- a/arbitrator/stylus/tests/keccak-100/Cargo.lock +++ b/arbitrator/stylus/tests/keccak-100/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/keccak/Cargo.lock b/arbitrator/stylus/tests/keccak/Cargo.lock index c4e01bb8d..34a5fc54e 100644 --- a/arbitrator/stylus/tests/keccak/Cargo.lock +++ b/arbitrator/stylus/tests/keccak/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/log/Cargo.lock b/arbitrator/stylus/tests/log/Cargo.lock index ec0f38791..bbf34c89b 100644 --- a/arbitrator/stylus/tests/log/Cargo.lock +++ b/arbitrator/stylus/tests/log/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/multicall/Cargo.lock b/arbitrator/stylus/tests/multicall/Cargo.lock index f9c9e9a79..ca860e123 100644 --- a/arbitrator/stylus/tests/multicall/Cargo.lock +++ b/arbitrator/stylus/tests/multicall/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/read-return-data/Cargo.lock b/arbitrator/stylus/tests/read-return-data/Cargo.lock index 6714df776..f08f053af 100644 --- a/arbitrator/stylus/tests/read-return-data/Cargo.lock +++ b/arbitrator/stylus/tests/read-return-data/Cargo.lock @@ -436,9 +436,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/sdk-storage/Cargo.lock b/arbitrator/stylus/tests/sdk-storage/Cargo.lock index 596e64381..f2710a29b 100644 --- a/arbitrator/stylus/tests/sdk-storage/Cargo.lock +++ b/arbitrator/stylus/tests/sdk-storage/Cargo.lock @@ -449,9 +449,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -467,7 +465,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/arbitrator/stylus/tests/sdk-storage/src/main.rs b/arbitrator/stylus/tests/sdk-storage/src/main.rs index 7b131b953..15ec72816 100644 --- a/arbitrator/stylus/tests/sdk-storage/src/main.rs +++ b/arbitrator/stylus/tests/sdk-storage/src/main.rs @@ -4,7 +4,7 @@ #![no_main] use stylus_sdk::{ - alloy_primitives::{Address, Uint, B256, I32, U16, U256, U64, U8}, + alloy_primitives::{Address, Signed, Uint, B256, I32, U16, U256, U64, U8}, prelude::*, }; @@ -24,6 +24,7 @@ sol_storage! { bytes bytes_long; string chars; Maps maps; + Arrays arrays; } #[derive(Erase)] @@ -40,6 +41,20 @@ sol_storage! { mapping(bytes1 => mapping(bool => uint256)) nested; mapping(string => Struct) structs; } + + pub struct Arrays { + string[4] strings; + + uint8 spacer; + uint24[5] packed; + uint8 trail; + + address[2] spill; + uint8[2][4] matrix; + int96[4][] vector; + int96[][4] vectors; + Struct[3] structs; + } } #[entrypoint] @@ -186,6 +201,61 @@ fn populate(mut contract: Contract) { entry.other.set(contract.sub.other.get()); entry.word.set(contract.sub.word.get()); } + + // test fixed arrays + let mut arrays = contract.arrays; + let mut slot = arrays.strings.setter(2).unwrap(); + slot.set_str("L2 is for you!"); + + // test packed arrays + for i in 0..5 { + let mut slot = arrays.packed.get_mut(i).unwrap(); + slot.set(Uint::from(i)); + } + + // test arrays that don't fit into a single word + for i in 0..2 { + let mut slot = arrays.spill.get_mut(i).unwrap(); + slot.set(Address::with_last_byte(i as u8)); + } + + // test 2d arrays + let mut matrix = arrays.matrix; + for i in 0..4 { + let mut inner = matrix.get_mut(i).unwrap(); + let mut slot = inner.get_mut(0).unwrap(); + slot.set(U8::from(i)); + + let value = slot.get(); + let mut slot = inner.get_mut(1).unwrap(); + slot.set(value + U8::from(1)); + } + + // test vector of arrays + for _ in 0..3 { + let mut fixed = arrays.vector.grow(); + for i in 0..4 { + let mut slot = fixed.get_mut(i).unwrap(); + slot.set(Signed::from_raw(Uint::from(i))); + } + } + + // test array of vectors + for w in 0..4 { + let mut vector = arrays.vectors.setter(w).unwrap(); + for i in 0..4 { + vector.push(Signed::from_raw(Uint::from(i))); + } + } + + // test array of structs + for i in 0..3 { + let mut entry = arrays.structs.get_mut(i).unwrap(); + + entry.num.set(contract.sub.num.get()); + entry.other.set(contract.sub.other.get()); + entry.word.set(contract.sub.word.get()); + } } fn remove(mut contract: Contract) { @@ -243,4 +313,10 @@ fn remove(mut contract: Contract) { // erase a struct contract.structs.erase_last(); + + // erase fixed arrays + contract.arrays.matrix.erase(); + contract.arrays.vector.erase(); + contract.arrays.vectors.erase(); + contract.arrays.structs.erase(); } diff --git a/arbitrator/stylus/tests/storage/Cargo.lock b/arbitrator/stylus/tests/storage/Cargo.lock index 7a967b751..72e4cc16e 100644 --- a/arbitrator/stylus/tests/storage/Cargo.lock +++ b/arbitrator/stylus/tests/storage/Cargo.lock @@ -435,9 +435,7 @@ dependencies = [ [[package]] name = "stylus-proc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ed6e3a897eea8ef2e19836b622fde7a9b114009f7eeca00d26a232e70603d0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -453,7 +451,7 @@ dependencies = [ [[package]] name = "stylus-sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "alloy-primitives", "alloy-sol-types", diff --git a/contracts b/contracts index 41f739236..94a3baa99 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 41f73923612e5d508ce5e417650d45626c288487 +Subproject commit 94a3baa997a2200190a6552b9486890419f9922e