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

fix: reference-types error on nightly version #375

Open
wants to merge 8 commits into
base: v0.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.wasm32-unknown-unknown]
rustflags = ["-C", "link-arg=-zstack-size=8192"]
rustflags = ["-C", "link-arg=-zstack-size=8192", "-C", "target-cpu=mvp"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
toolchain: nightly-2024-09-05

- uses: Swatinem/rust-cache@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
toolchain: nightly-2024-09-05

- uses: Swatinem/rust-cache@v2

Expand All @@ -34,5 +34,5 @@ jobs:

- name: run wasm check
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
export RUSTUP_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/check-wasm.sh
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
toolchain: nightly-2024-09-05

- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -51,5 +51,5 @@ jobs:
run: ./scripts/nitro-testnode.sh -d -i
- name: run integration tests
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
export RUSTUP_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/e2e-tests.sh
4 changes: 2 additions & 2 deletions .github/workflows/gas-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
toolchain: nightly-2024-09-05

- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -41,5 +41,5 @@ jobs:
run: ./scripts/nitro-testnode.sh -d -i
- name: run benches
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
export RUSTUP_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/bench.sh
5 changes: 3 additions & 2 deletions scripts/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ MYDIR=$(realpath "$(dirname "$0")")
cd "$MYDIR"
cd ..

NIGHTLY_TOOLCHAIN=${NIGHTLY_TOOLCHAIN:-nightly}
cargo +"$NIGHTLY_TOOLCHAIN" build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-nightly}

cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort

export RPC_URL=http://localhost:8547
cargo run --release -p benches
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ get_example_crate_names () {
find ./examples -maxdepth 2 -type f -name "Cargo.toml" | xargs grep 'name = ' | grep -oE '".*"' | tr -d "'\""
}

NIGHTLY_TOOLCHAIN=${NIGHTLY_TOOLCHAIN:-nightly}
RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-nightly}

cargo +"$NIGHTLY_TOOLCHAIN" build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort

for CRATE_NAME in $(get_example_crate_names)
do
Expand Down
12 changes: 7 additions & 5 deletions scripts/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ MYDIR=$(realpath "$(dirname "$0")")
cd "$MYDIR"
cd ..

NIGHTLY_TOOLCHAIN=${NIGHTLY_TOOLCHAIN:-nightly}
cargo +"$NIGHTLY_TOOLCHAIN" build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
# We should use stable here once nitro-testnode is updated and the contracts fit
# the size limit.
RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-nightly}

cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't add this as part of this PR, but why do we need these flags?

Copy link
Member Author

@qalisander qalisander Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are nightly compiler optimization flags. As I remember these flags been recommended for wasm size optimization in stylus docs.
I haven't tried to experiment with nightly flags further, since wasm size is fine for us.


export RPC_URL=http://localhost:8547
# We should use stable here once nitro-testnode is updated and the contracts fit
# the size limit. Work tracked [here](https://github.com/OpenZeppelin/rust-contracts-stylus/issues/87)
cargo +"$NIGHTLY_TOOLCHAIN" test --features std,e2e --test "*"

cargo test --features std,e2e --test "*"
Loading