forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from weaveVM/fix-precompiles-test-precompiles
Fix precompiles test precompiles
- Loading branch information
Showing
5 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
use crate::inner::test_precompile::HELLO_WORLD_PC; | ||
use crate::inner::{ | ||
arweave_precompile::ARWEAVE_UPLOAD_PC, arweave_read_precompile::ARWEAVE_READ_PC, | ||
}; | ||
use reth::revm::precompile::PrecompileWithAddress; | ||
|
||
pub mod arweave_precompile; | ||
mod arweave_read_precompile; | ||
mod test_precompile; | ||
|
||
pub fn wvm_precompiles() -> impl Iterator<Item = PrecompileWithAddress> { | ||
[ARWEAVE_UPLOAD_PC, ARWEAVE_READ_PC].into_iter() | ||
[ARWEAVE_UPLOAD_PC, ARWEAVE_READ_PC, HELLO_WORLD_PC].into_iter() | ||
} |
11 changes: 11 additions & 0 deletions
11
wvm-apps/wvm-exexed/crates/precompiles/src/inner/test_precompile.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use reth::primitives::revm_primitives::{Precompile, PrecompileOutput, PrecompileResult}; | ||
use reth::primitives::Bytes; | ||
use reth::revm::precompile::{u64_to_address, PrecompileWithAddress}; | ||
|
||
pub const PC_ADDRESS: u64 = 0x19; | ||
pub const HELLO_WORLD_PC: PrecompileWithAddress = | ||
PrecompileWithAddress(u64_to_address(PC_ADDRESS), Precompile::Standard(hello_world_pc)); | ||
|
||
fn hello_world_pc(_input: &Bytes, _gas_limit: u64) -> PrecompileResult { | ||
Ok(PrecompileOutput::new(0 as u64, "Hello World".into())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters