Skip to content

Commit

Permalink
arbutil: rename Js->Requestor
Browse files Browse the repository at this point in the history
no longer js
  • Loading branch information
tsahee committed Jan 19, 2024
1 parent dcddcba commit a83ffef
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion arbitrator/arbutil/src/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::{Bytes20, Bytes32};

pub mod api;
pub mod js;
pub mod req;
pub mod user;

// params.SstoreSentryGasEIP2200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use eyre::{bail, eyre, Result};

pub struct JsEvmApi<T: RequestHandler> {
pub struct EvmApiRequestor<T: RequestHandler> {
handler: T,
last_call_result: Vec<u8>,
}
Expand All @@ -19,7 +19,7 @@ pub trait RequestHandler: Send + 'static {
fn handle_request(&mut self, _req_type: EvmApiMethod, _req_data: &[u8]) -> (Vec<u8>, u64);
}

impl<T: RequestHandler> JsEvmApi<T> {
impl<T: RequestHandler> EvmApiRequestor<T> {
pub fn new(handler: T) -> Self {
Self {
handler,
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<T: RequestHandler> JsEvmApi<T> {
}
}

impl<T: RequestHandler> EvmApi for JsEvmApi<T> {
impl<T: RequestHandler> EvmApi for EvmApiRequestor<T> {
fn get_bytes32(&mut self, key: Bytes32) -> (Bytes32, u64) {
let (res, cost) = self
.handler
Expand Down
4 changes: 2 additions & 2 deletions arbitrator/jit/src/stylus_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use crate::machine::{Escape, MaybeEscape};
use arbutil::evm::{
api::EvmApiMethod, js::JsEvmApi, js::RequestHandler, user::UserOutcome, EvmData,
api::EvmApiMethod, req::EvmApiRequestor, req::RequestHandler, user::UserOutcome, EvmData,
};
use eyre::{eyre, Result};
use prover::programs::prelude::*;
Expand Down Expand Up @@ -128,7 +128,7 @@ pub fn exec_wasm(
rx: tothread_rx,
};

let evm_api = JsEvmApi::new(cothread);
let evm_api = EvmApiRequestor::new(cothread);

let mut instance =
unsafe { NativeInstance::deserialize(&module, compile.clone(), evm_api, evm_data) }?;
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/stylus/src/evm_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

use crate::{RustBytes, RustSlice};
use arbutil::evm::{api::EvmApiMethod, api::EvmApiStatus, js::RequestHandler};
use arbutil::evm::{api::EvmApiMethod, api::EvmApiStatus, req::RequestHandler};

#[repr(C)]
pub struct NativeRequestHandler {
Expand Down
4 changes: 2 additions & 2 deletions arbitrator/stylus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE
use arbutil::{
evm::{
js::JsEvmApi,
req::EvmApiRequestor,
user::{UserOutcome, UserOutcomeKind},
EvmData,
},
Expand Down Expand Up @@ -168,7 +168,7 @@ pub unsafe extern "C" fn stylus_call(

// Safety: module came from compile_user_wasm and we've paid for memory expansion
let instance = unsafe {
NativeInstance::deserialize(module, compile, JsEvmApi::new(req_handler), evm_data)
NativeInstance::deserialize(module, compile, EvmApiRequestor::new(req_handler), evm_data)
};
let mut instance = match instance {
Ok(instance) => instance,
Expand Down
8 changes: 4 additions & 4 deletions arbitrator/wasm-libraries/user-host/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE
use core::sync::atomic::{compiler_fence, Ordering};
use arbutil::{
evm::{js::JsEvmApi, js::RequestHandler, EvmData, api::EvmApiMethod},
evm::{req::EvmApiRequestor, req::RequestHandler, EvmData, api::EvmApiMethod},
wavm, Bytes20, Bytes32, Color,
};
use eyre::{eyre, Result};
Expand Down Expand Up @@ -66,7 +66,7 @@ pub(crate) struct Program {
/// Output generated by the program.
pub outs: Vec<u8>,
/// Mechanism for calling back into Geth.
pub evm_api: JsEvmApi<UserHostRequester>,
pub evm_api: EvmApiRequestor<UserHostRequester>,
/// EVM Context info.
pub evm_data: EvmData,
/// WAVM module index.
Expand Down Expand Up @@ -139,7 +139,7 @@ impl Program {
let program = Self {
args,
outs: vec![],
evm_api: JsEvmApi::new(UserHostRequester::default()),
evm_api: EvmApiRequestor::new(UserHostRequester::default()),
evm_data,
module,
config,
Expand Down Expand Up @@ -181,7 +181,7 @@ impl Program {
impl UserHost for Program {
type Err = eyre::ErrReport;
type MemoryErr = MemoryBoundsError;
type A = JsEvmApi<UserHostRequester>;
type A = EvmApiRequestor<UserHostRequester>;

fn args(&self) -> &[u8] {
&self.args
Expand Down

0 comments on commit a83ffef

Please sign in to comment.