Skip to content

Commit

Permalink
Merge pull request #150 from OffchainLabs/adopt-sdk-0.3.0
Browse files Browse the repository at this point in the history
Adopt SDK v0.3.0
  • Loading branch information
rachel-bousfield authored Sep 12, 2023
2 parents f47fec1 + 3a9b7be commit a9f2096
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 42 deletions.
2 changes: 1 addition & 1 deletion arbitrator/langs/rust
Submodule rust updated 42 files
+2 −0 .gitignore
+4 −2 Cargo.lock
+5 −3 Cargo.toml
+6 −0 stylus-proc/Cargo.toml
+6 −4 stylus-proc/src/calls/mod.rs
+462 −4 stylus-proc/src/lib.rs
+31 −38 stylus-proc/src/methods/entrypoint.rs
+8 −1 stylus-sdk/Cargo.toml
+5 −1 stylus-sdk/src/abi/bytes.rs
+6 −1 stylus-sdk/src/abi/const_string.rs
+14 −5 stylus-sdk/src/abi/export.rs
+6 −0 stylus-sdk/src/abi/fixed_bytes.rs
+1 −0 stylus-sdk/src/abi/impls.rs
+1 −0 stylus-sdk/src/abi/internal.rs
+16 −1 stylus-sdk/src/abi/mod.rs
+11 −0 stylus-sdk/src/block.rs
+132 −43 stylus-sdk/src/call/context.rs
+4 −1 stylus-sdk/src/call/error.rs
+53 −61 stylus-sdk/src/call/mod.rs
+100 −55 stylus-sdk/src/call/raw.rs
+5 −10 stylus-sdk/src/call/traits.rs
+47 −0 stylus-sdk/src/call/transfer.rs
+14 −2 stylus-sdk/src/contract.rs
+13 −0 stylus-sdk/src/crypto.rs
+10 −0 stylus-sdk/src/debug.rs
+5 −0 stylus-sdk/src/deploy/mod.rs
+3 −2 stylus-sdk/src/deploy/raw.rs
+13 −1 stylus-sdk/src/evm.rs
+56 −37 stylus-sdk/src/hostio.rs
+35 −1 stylus-sdk/src/lib.rs
+11 −0 stylus-sdk/src/msg.rs
+8 −0 stylus-sdk/src/prelude.rs
+1 −1 stylus-sdk/src/storage/array.rs
+6 −2 stylus-sdk/src/storage/bytes.rs
+4 −2 stylus-sdk/src/storage/cache.rs
+2 −0 stylus-sdk/src/storage/eager.rs
+4 −1 stylus-sdk/src/storage/map.rs
+59 −36 stylus-sdk/src/storage/mod.rs
+9 −7 stylus-sdk/src/storage/traits.rs
+6 −2 stylus-sdk/src/storage/vec.rs
+11 −0 stylus-sdk/src/tx.rs
+12 −0 stylus-sdk/src/types.rs
6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/create/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/erc20/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion arbitrator/stylus/tests/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
alloy-primitives = "0.3.1"
alloy-sol-types = "0.3.1"
stylus-sdk = { path = "../../../langs/rust/stylus-sdk" }
stylus-sdk = { path = "../../../langs/rust/stylus-sdk", features = ["reentrant"] }
hex = "0.4.3"
wee_alloc = "0.4.5"

Expand Down
8 changes: 4 additions & 4 deletions arbitrator/stylus/tests/erc20/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sol_storage! {
// Another contract we'd like to call
sol_interface! {
interface IMath {
function sum(uint256[] values) pure returns (string, uint256);
function sumValues(uint256[] values) pure returns (string, uint256);
}
}

Expand All @@ -57,13 +57,13 @@ impl Weth {
}

// sums numbers
pub fn sum(values: Vec<U256>) -> Result<(String, U256), Vec<u8>> {
pub fn sum_values(values: Vec<U256>) -> Result<(String, U256), Vec<u8>> {
Ok(("sum".into(), values.iter().sum()))
}

// calls the sum() method from the interface
// calls the sum_values() method from the interface
pub fn sum_with_helper(&self, helper: IMath, values: Vec<U256>) -> Result<U256, Vec<u8>> {
let (text, sum) = helper.sum(self, values)?;
let (text, sum) = helper.sum_values(self, values)?;
assert_eq!(&text, "sum");
Ok(sum)
}
Expand Down
6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/evm-data/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion arbitrator/stylus/tests/evm-data/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn user_main(input: Vec<u8>) -> Result<Vec<u8>, Vec<u8>> {
// Call burnArbGas
let gas_left_before = evm::gas_left();
let ink_left_before = evm::ink_left();
unsafe { RawCall::new().call(arb_test_addr, burn_call_data)? };
RawCall::new().call(arb_test_addr, burn_call_data)?;
let gas_left_after = evm::gas_left();
let ink_left_after = evm::ink_left();

Expand Down
6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/fallible/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/keccak-100/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/keccak/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/log/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/multicall/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion arbitrator/stylus/tests/multicall/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
stylus-sdk = { path = "../../../langs/rust/stylus-sdk" }
stylus-sdk = { path = "../../../langs/rust/stylus-sdk", features = ["reentrant"] }
hex = "0.4.3"

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/stylus/tests/multicall/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use stylus_sdk::{
prelude::*,
};

#[entrypoint(allow_reentrancy = true)]
#[entrypoint]
fn user_main(input: Vec<u8>) -> Result<Vec<u8>, Vec<u8>> {
let mut input = input.as_slice();
let count = input[0];
Expand Down
6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/read-return-data/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions arbitrator/stylus/tests/read-return-data/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,17 @@ fn user_main(input: Vec<u8>) -> Result<Vec<u8>, Vec<u8>> {
let safe_offset = offset.min(call_data.len());

if call_type == 2 {
unsafe {
RawCall::new()
.limit_return_data(offset, size)
.call(precompile, call_data)?
};
RawCall::new()
.limit_return_data(offset, size)
.call(precompile, call_data)?;
}

for _ in 0..count {
let data = match call_type {
0 => unsafe { RawCall::new().call(precompile, call_data)? },
1 => unsafe {
RawCall::new()
.limit_return_data(offset, size)
.call(precompile, call_data)?
},
0 => RawCall::new().call(precompile, call_data)?,
1 => RawCall::new()
.limit_return_data(offset, size)
.call(precompile, call_data)?,
2 => contract::read_return_data(offset, Some(size)),
_ => error!("unknown call_type {call_type}"),
};
Expand Down
6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/sdk-storage/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions arbitrator/stylus/tests/storage/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9f2096

Please sign in to comment.