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: cast overflow in 32-bits OS #978

Merged
merged 8 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- run: |
cd crates/revm
cargo check --no-default-features

check-serde:
name: check serde
runs-on: ubuntu-latest
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
pull_request:
branches: [main, "release/**"]


jobs:
tests-stable:
name: Ethereum Tests (Stable)
Expand All @@ -19,6 +18,7 @@ jobs:
strategy:
matrix:
profile: [ethtests, release]
target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -37,11 +37,13 @@ jobs:
with:
cache-on-failure: true

- name: Install cross
run: cargo install cross

- name: Run Ethereum tests
run: |
cargo run --profile ${{ matrix.profile }} -p revme -- statetest \
cross run --target ${{matrix.target}} --profile ${{ matrix.profile }} -p revme -- statetest \
ethtests/GeneralStateTests/ \
ethtests/LegacyTests/Constantinople/GeneralStateTests/ \
ethtests/EIPTests/StateTests/stEIP1153-transientStorage/ \
ethtests/EIPTests/StateTests/stEIP4844-blobtransactions/ \
ethtests/EIPTests/StateTests/stEIP5656-MCOPY/
10 changes: 10 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build]
pre-build = [
"apt-get update && apt-get install --assume-yes --no-install-recommends llvm-dev clang libclang-dev",
]

[target.i686-unknown-linux-gnu]
image = "ghcr.io/cross-rs/i686-unknown-linux-gnu:main"

[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main"
8 changes: 6 additions & 2 deletions crates/interpreter/src/instructions/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ macro_rules! as_u64_saturated {

macro_rules! as_usize_saturated {
($v:expr) => {
as_u64_saturated!($v) as usize
::core::convert::TryInto::<usize>::try_into(as_u64_saturated!($v)).unwrap_or(usize::MAX)
};
}

Expand All @@ -205,6 +205,10 @@ macro_rules! as_usize_or_fail {
$interp.instruction_result = $reason;
return;
}
x[0] as usize
let Ok(val) = ::core::convert::TryInto::<usize>::try_into(x[0]) else {
$interp.instruction_result = $reason;
return;
};
val
}};
}
Loading