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

Audit develop #152

Merged
merged 27 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bde7e9f
H-01 Deny unsupported func attrs in sol_interface!
rory-ocl Aug 14, 2024
b3cb490
H-02 Deny u32 in selector id override
rory-ocl Aug 14, 2024
fb63d77
M-03 Prevent interfaces gathering previous funcs
rory-ocl Aug 14, 2024
a4f7d52
M-04 Fix export-abi with no return types
rory-ocl Aug 14, 2024
6a53fa3
M-10 Fail unimplemented features in sol_interface!
rory-ocl Aug 15, 2024
ed0b570
M-11 Pass all unused attrs through in #[external]
rory-ocl Aug 15, 2024
7d05e8a
M-05 Remove broken storage types and update docs
rory-ocl Aug 15, 2024
e628162
N-09 Update copyright year
rory-ocl Aug 16, 2024
fc6ba64
N-07 Fix typos in comments
rory-ocl Aug 16, 2024
79293f6
N-06 Remove outdated reference to EagerStorage
rory-ocl Aug 16, 2024
c2f1fcb
N-03 Use main branch for license links
rory-ocl Aug 16, 2024
72d6677
L-03 Fix some documentation
rory-ocl Aug 16, 2024
591f581
L-05 Default to mini-alloc in sdk
rory-ocl Aug 18, 2024
8126ed9
M-01 Enforce mutability rules in func definitions
rory-ocl Aug 16, 2024
b030792
N-01 Renames for clarity
rory-ocl Aug 18, 2024
9107caa
N-02 Remove unmaintained wee-alloc crate
rory-ocl Aug 18, 2024
a97885b
N-05 Add len() to StorageArray
rory-ocl Aug 18, 2024
3d2fd30
L-01 Clarify usage of Call::new_in
rory-ocl Aug 20, 2024
9c56c8b
L-07 Remove unimplemented RawDeploy methods
rory-ocl Aug 20, 2024
e3be4b8
C-01 Clarify inheritance storage difference
rory-ocl Aug 20, 2024
d0a42e7
L-09 Don't allow constant keyword in interfaces
rory-ocl Aug 20, 2024
6948349
L-10 Only allow external in sol_interface
rory-ocl Aug 20, 2024
11cb2ae
N-10 Move TODOs to issue tracker
rory-ocl Aug 21, 2024
edb84f5
C-2 Clarify docs around override functions
rory-ocl Aug 28, 2024
559982c
H-2 Remove #[selector(id = ...)] completely
rory-ocl Aug 28, 2024
3ca6140
M-10 Error on inheritance in sol_interface!
rory-ocl Aug 28, 2024
389f49e
N-08 Disallow attribute tokens in #[public]
rory-ocl Aug 28, 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
74 changes: 14 additions & 60 deletions examples/erc20/Cargo.lock

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

2 changes: 2 additions & 0 deletions examples/erc20/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.80.0"
6 changes: 3 additions & 3 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,9 +132,9 @@ 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
#[external]
#[public]
impl<T: Erc20Params> Erc20<T> {
/// Immutable token name
pub fn name() -> String {
Expand Down
16 changes: 5 additions & 11 deletions examples/erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +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};

/// Initializes a custom, global allocator for Rust programs compiled to WASM.
#[global_allocator]
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;
use stylus_sdk::{msg, prelude::*};

/// Immutable definitions
struct StylusTestTokenParams;
Expand All @@ -36,7 +29,7 @@ sol_storage! {
}
}

#[external]
#[public]
#[inherit(Erc20<StylusTestTokenParams>)]
impl StylusTestToken {
/// Mints tokens
Expand All @@ -56,4 +49,5 @@ impl StylusTestToken {
self.erc20.burn(msg::sender(), value)?;
Ok(())
}
}
}

Loading
Loading