Skip to content

Commit

Permalink
Perf: Skip CacheDB and load data directly (#131)
Browse files Browse the repository at this point in the history
* enable lto in guest builds

* update guest build config

* refactor core db mod

* refactor: replace db drop with flag

* direct trie db strategy

* rev up r0 and add bonsai feature (#132)

Co-authored-by: root <[email protected]>

* patch all crate definitions

---------

Co-authored-by: Richard Howard <[email protected]>
Co-authored-by: root <[email protected]>
Co-authored-by: Wolfgang Welz <[email protected]>
  • Loading branch information
4 people authored Dec 18, 2024
1 parent 392b34c commit cda34a2
Show file tree
Hide file tree
Showing 27 changed files with 633 additions and 304 deletions.
33 changes: 17 additions & 16 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ opt-level = 3
# RISC Zero
[workspace.dependencies.bonsai-sdk]
git = "https://github.com/risc0/risc0"
rev = "e98cdad96cfecb3d959cb62abf566e5b17a0d649"
rev = "f74920596c745a8bb7e8a6f1dfdefb44d03ed06f"
features = ["non_blocking"]

[workspace.dependencies.risc0-build]
git = "https://github.com/risc0/risc0"
rev = "e98cdad96cfecb3d959cb62abf566e5b17a0d649"
rev = "f74920596c745a8bb7e8a6f1dfdefb44d03ed06f"
features = ["unstable"]

[workspace.dependencies.risc0-zkvm]
git = "https://github.com/risc0/risc0"
rev = "e98cdad96cfecb3d959cb62abf566e5b17a0d649"
rev = "f74920596c745a8bb7e8a6f1dfdefb44d03ed06f"
default-features = false
features = ["bonsai"]

# External
[workspace.dependencies]
Expand Down
20 changes: 15 additions & 5 deletions crates/core-ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,31 @@ use reth_storage_errors::provider::ProviderError;
use std::fmt::Display;
use std::mem::take;
use std::sync::Arc;
use zeth_core::db::MemoryDB;
use zeth_core::db::memory::MemoryDB;
use zeth_core::db::trie::TrieDB;
use zeth_core::driver::CoreDriver;
use zeth_core::stateless::client::StatelessClient;
use zeth_core::stateless::execute::ExecutionStrategy;
use zeth_core::stateless::finalize::RethFinalizationStrategy;
use zeth_core::stateless::initialize::MemoryDbStrategy;
use zeth_core::stateless::finalize::{MemoryDbFinalizationStrategy, TrieDbFinalizationStrategy};
use zeth_core::stateless::initialize::{
MemoryDbInitializationStrategy, TrieDbInitializationStrategy,
};
use zeth_core::stateless::validate::ValidationStrategy;

pub struct RethStatelessClient;

impl StatelessClient<RethCoreDriver, MemoryDB> for RethStatelessClient {
type Initialization = MemoryDbStrategy;
type Initialization = MemoryDbInitializationStrategy;
type Validation = RethValidationStrategy;
type Execution = RethExecutionStrategy;
type Finalization = MemoryDbFinalizationStrategy;
}

impl StatelessClient<RethCoreDriver, TrieDB> for RethStatelessClient {
type Initialization = TrieDbInitializationStrategy;
type Validation = RethValidationStrategy;
type Execution = RethExecutionStrategy;
type Finalization = RethFinalizationStrategy;
type Finalization = TrieDbFinalizationStrategy;
}

pub struct RethValidationStrategy;
Expand Down
20 changes: 15 additions & 5 deletions crates/core-optimism/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,31 @@ use reth_storage_errors::provider::ProviderError;
use std::fmt::Display;
use std::mem::take;
use std::sync::Arc;
use zeth_core::db::MemoryDB;
use zeth_core::db::memory::MemoryDB;
use zeth_core::db::trie::TrieDB;
use zeth_core::driver::CoreDriver;
use zeth_core::stateless::client::StatelessClient;
use zeth_core::stateless::execute::ExecutionStrategy;
use zeth_core::stateless::finalize::RethFinalizationStrategy;
use zeth_core::stateless::initialize::MemoryDbStrategy;
use zeth_core::stateless::finalize::{MemoryDbFinalizationStrategy, TrieDbFinalizationStrategy};
use zeth_core::stateless::initialize::{
MemoryDbInitializationStrategy, TrieDbInitializationStrategy,
};
use zeth_core::stateless::validate::ValidationStrategy;

pub struct OpRethStatelessClient;

impl StatelessClient<OpRethCoreDriver, MemoryDB> for OpRethStatelessClient {
type Initialization = MemoryDbStrategy;
type Initialization = MemoryDbInitializationStrategy;
type Validation = OpRethValidationStrategy;
type Execution = OpRethExecutionStrategy;
type Finalization = MemoryDbFinalizationStrategy;
}

impl StatelessClient<OpRethCoreDriver, TrieDB> for OpRethStatelessClient {
type Initialization = TrieDbInitializationStrategy;
type Validation = OpRethValidationStrategy;
type Execution = OpRethExecutionStrategy;
type Finalization = RethFinalizationStrategy;
type Finalization = TrieDbFinalizationStrategy;
}

pub struct OpRethValidationStrategy;
Expand Down
Loading

0 comments on commit cda34a2

Please sign in to comment.