Skip to content

Commit

Permalink
♻ Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Sep 13, 2023
1 parent cd3ce82 commit e34b2ae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
Expand All @@ -59,3 +59,26 @@ jobs:
id: build
continue-on-error: true
run: cargo build --all
cargo-doc:
runs-on: ubuntu-latest
timeout-minutes: 20
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true
- name: doclint
id: build
continue-on-error: true
run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items
- name: doctest
run: cargo test --doc --all --all-features

3 changes: 2 additions & 1 deletion crates/mipsevm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// #![doc = include_str!("../README.md")]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

mod memory;
mod page;
mod state;
mod traits;
mod utils;
8 changes: 4 additions & 4 deletions crates/mipsevm/src/memory.rs → crates/mipsevm/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl CachedPage {
pub fn merkle_root(&mut self) -> B256 {
// First, hash the bottom layer.
for i in (0..PAGE_SIZE).step_by(64) {
let j = PAGE_SIZE >> 5 + i >> 5;
let j = (PAGE_SIZE >> 6) + (i >> 6);
if self.valid[j] {
continue;
}
Expand All @@ -81,7 +81,7 @@ impl CachedPage {
}

// Then, hash the cache layers.
for i in (1..=PAGE_SIZE >> 5 - 2).rev().step_by(2) {
for i in (1..=(PAGE_SIZE >> 5) - 2).rev().step_by(2) {
let j = i >> 1;
if self.valid[j] {
continue;
Expand All @@ -98,12 +98,12 @@ impl CachedPage {
let _ = self.merkle_root();

if g_index >= PAGE_SIZE >> 5 {
if g_index >= PAGE_SIZE >> 5 * 2 {
if g_index >= (PAGE_SIZE >> 5) * 2 {
panic!("Gindex too deep");
}

let node_index = g_index & (PAGE_ADDRESS_MASK >> 5);
return B256::from_slice(&self.data[(node_index << 5)..(node_index << 5 + 32)]);
return B256::from_slice(&self.data[node_index << 5..(node_index << 5) + 32]);
}

self.cache[g_index].into()
Expand Down

0 comments on commit e34b2ae

Please sign in to comment.