Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for currently ongoing code audit #145

Merged
merged 34 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a78decd
C-02 Fail to build on duplicate selectors
rory-ocl Aug 14, 2024
a474666
H-01 Deny unsupported func attrs in sol_interface!
rory-ocl Aug 14, 2024
bf01d65
H-02 Deny u32 in selector id override
rory-ocl Aug 14, 2024
a64c058
M-03 Prevent interfaces gathering previous funcs
rory-ocl Aug 14, 2024
31995da
M-04 Fix export-abi with no return types
rory-ocl Aug 14, 2024
821b7f6
M-10 Fail unimplemented features in sol_interface!
rory-ocl Aug 15, 2024
d44d94f
M-11 Pass all unused attrs through in #[external]
rory-ocl Aug 15, 2024
3f511fa
M-05 Remove broken storage types and update docs
rory-ocl Aug 15, 2024
d57458d
N-09 Update copyright year
rory-ocl Aug 16, 2024
5052d30
N-07 Fix typos in comments
rory-ocl Aug 16, 2024
9b221c8
N-06 Remove outdated reference to EagerStorage
rory-ocl Aug 16, 2024
0a0ace1
N-03 Use main branch for license links
rory-ocl Aug 16, 2024
dc1e9c5
L-03 Fix some documentation
rory-ocl Aug 16, 2024
2354799
L-05 Default to mini-alloc in sdk
rory-ocl Aug 18, 2024
1984d8a
M-01 Enforce mutability rules in func definitions
rory-ocl Aug 16, 2024
8d1699f
N-01 Renames for clarity
rory-ocl Aug 18, 2024
80bfcba
N-02 Remove unmaintained wee-alloc crate
rory-ocl Aug 18, 2024
8ab7650
N-05 Add len() to StorageArray
rory-ocl Aug 18, 2024
ba3472f
L-01 Clarify usage of Call::new_in
rory-ocl Aug 20, 2024
6e21166
L-07 Remove unimplemented RawDeploy methods
rory-ocl Aug 20, 2024
a99d8c5
C-01 Clarify inheritance storage difference
rory-ocl Aug 20, 2024
e173182
L-09 Don't allow constant keyword in interfaces
rory-ocl Aug 20, 2024
2330ac7
L-10 Only allow external in sol_interface
rory-ocl Aug 20, 2024
73dbc1c
N-10 Move TODOs to issue tracker
rory-ocl Aug 21, 2024
b67de6b
Fix off-by-one error when string len is 32
rory-ocl Aug 22, 2024
748744b
Fix Bytes type for export-abi
rory-ocl Aug 2, 2024
ee3ef05
Fix return encoding for sequence types
rory-ocl Aug 22, 2024
74593a0
Merge branch 'hotfix-0.5.3' of github.com:OffchainLabs/stylus-sdk-rs …
rory-ocl Aug 22, 2024
0d50c1d
C-2 Clarify docs around override functions
rory-ocl Aug 28, 2024
795d376
H-2 Remove #[selector(id = ...)] completely
rory-ocl Aug 28, 2024
be6306c
M-10 Error on inheritance in sol_interface!
rory-ocl Aug 28, 2024
a1267bf
N-08 Disallow attribute tokens in #[public]
rory-ocl Aug 28, 2024
e7cce63
Merge branch 'main' of github.com:OffchainLabs/stylus-sdk-rs into audit
rory-ocl Aug 30, 2024
e972f32
Merge branch 'audit' of github.com:OffchainLabs/stylus-sdk-rs into audit
rory-ocl Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 9 additions & 55 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ syn-solidity = "0.7.6"
convert_case = "0.6.0"

# members
mini-alloc = { path = "mini-alloc" }
stylus-sdk = { path = "stylus-sdk" }
stylus-proc = { path = "stylus-proc", version = "0.5.2" }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sol_storage! {
}
}

#[external]
#[public]
impl Counter {
// Gets the number value from storage.
pub fn number(&self) -> Result<U256, Vec<u8>> {
Expand Down Expand Up @@ -98,7 +98,7 @@ The Stylus SDK is just one of the building blocks in creating and deploying WebA

## License

&copy; 2022-2023 Offchain Labs, Inc.
&copy; 2022-2024 Offchain Labs, Inc.

This project is licensed under either of

Expand Down
81 changes: 12 additions & 69 deletions examples/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 examples/erc20/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.80.0"
channel = "1.80.0"
4 changes: 2 additions & 2 deletions examples/erc20/src/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum Erc20Error {
// Note: modifying storage will become much prettier soon
impl<T: Erc20Params> Erc20<T> {
/// Movement of funds between 2 accounts
/// (invoked by the external transfer() and transfer_from() functions )
/// (invoked by the public transfer() and transfer_from() functions )
pub fn _transfer(&mut self, from: Address, to: Address, value: U256) -> Result<(), Erc20Error> {
// Decreasing sender balance
let mut sender_balance = self.balances.setter(from);
Expand Down Expand Up @@ -132,7 +132,7 @@ impl<T: Erc20Params> Erc20<T> {
}
}

// These methods are external to other contracts
// These methods are public to other contracts
// Note: modifying storage will become much prettier soon
#[public]
impl<T: Erc20Params> Erc20<T> {
Expand Down
10 changes: 4 additions & 6 deletions examples/erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ extern crate alloc;
// Modules and imports
mod erc20;

use crate::erc20::{Erc20, Erc20Error, Erc20Params};
use alloy_primitives::{Address, U256};
use stylus_sdk::{
msg,
prelude::*
};
use crate::erc20::{Erc20, Erc20Params, Erc20Error};
use stylus_sdk::{msg, prelude::*};

/// Immutable definitions
struct StylusTestTokenParams;
Expand Down Expand Up @@ -52,4 +49,5 @@ impl StylusTestToken {
self.erc20.burn(msg::sender(), value)?;
Ok(())
}
}
}

Loading
Loading