Skip to content

Commit

Permalink
Update Relayer.Dockerfile and abis.
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Nov 12, 2023
1 parent abbe02b commit 3d148b5
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 1,296 deletions.
96 changes: 59 additions & 37 deletions Relayer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,75 @@
# ------------------ Chef stage -------------------
# Use cargo chef to cache dependencies
FROM rustlang/rust:nightly AS chef
FROM rustlang/rust:nightly

# Install cargo chef
RUN cargo install cargo-chef
RUN apt-get update && apt-get upgrade -y
RUN apt-get update && \
apt install -y cmake build-essential pkg-config libssl-dev libgmp-dev libsodium-dev nasm git awscli gcc nodejs npm

# Work in app
WORKDIR /app
# Node install
RUN npm install -g n
RUN n 18
RUN npm install -g yarn

# ------------------ Planner stage -------------------
FROM chef as planner
RUN git clone https://github.com/zkemail/email-wallet.git
WORKDIR /email-wallet
RUN yarn

# Copy files into container
COPY Cargo.toml Cargo.lock ./
COPY packages/relayer ./packages/relayer
COPY packages/utils ./packages/utils
COPY packages/scripts ./packages/scripts
WORKDIR /email-wallet/packages/relayer
COPY packages/relayer/.env ./.env
CMD [ "cargo run --release -- setup && cargo run --release >> output.log" ]

# Create a lockfile for cargo chef
RUN cargo +nightly chef prepare --recipe-path recipe.json

# ------------------ Builder stage -------------------
FROM chef AS builder
WORKDIR /relayer
# # ------------------ Chef stage -------------------
# # Use cargo chef to cache dependencies
# FROM rustlang/rust:nightly AS chef

# Copy over our lock file
COPY --from=planner /app /relayer
# # Install cargo chef
# # RUN cargo install cargo-chef

# Build for any AWS machine. Same as cargo build but caches dependencies with the chef to make builds faster.
RUN cargo chef cook --release --recipe-path recipe.json
# # Work in app
# WORKDIR /app

### Above this all dependencies should be cached as long as our lock file stays the same
# # ------------------ Planner stage -------------------
# FROM chef as planner

# Build binary
RUN cargo build --release
# # Copy files into container
# COPY Cargo.toml Cargo.lock ./
# COPY packages/relayer ./packages/relayer
# COPY packages/utils ./packages/utils
# COPY packages/circuits ./packages/circuits
# COPY packages/frontend ./packages/frontend
# COPY packages/scripts ./packages/scripts

# ------------------ Runtime stage -------------------
# # Create a lockfile for cargo chef
# RUN cargo +nightly chef prepare --recipe-path recipe.json

# Using super lightweight debian image to reduce overhead
FROM ubuntu:latest AS runtime
# # ------------------ Builder stage -------------------
# FROM chef AS builder
# WORKDIR /relayer

# Copy prebuild bin from the Builder stage
COPY --from=builder /relayer/target/release/relayer /relayer/target/release/relayer
COPY --from=builder /relayer/Cargo.toml /relayer/Cargo.toml
COPY --from=builder /relayer/Cargo.lock /relayer/Cargo.lock
# # Copy over our lock file
# COPY --from=planner /app /relayer

EXPOSE 4500
# # Build for any AWS machine. Same as cargo build but caches dependencies with the chef to make builds faster.
# RUN cargo chef cook --release --recipe-path recipe.json

CMD ["relayer/target/release/relayer"]
# ### Above this all dependencies should be cached as long as our lock file stays the same

# This cargo chef logic comes from https://github.com/LukeMathWalker/cargo-chef
# Inspired by Huff: https://github.com/huff-language/huff-rs/blob/main/Dockerfile
# # Build binary
# RUN cargo build --release

# # ------------------ Runtime stage -------------------

# # Using super lightweight debian image to reduce overhead
# FROM ubuntu:latest AS runtime

# # Copy prebuild bin from the Builder stage
# COPY --from=builder /relayer/target/release/relayer /relayer/target/release/relayer
# COPY --from=builder /relayer/Cargo.toml /relayer/Cargo.toml
# COPY --from=builder /relayer/Cargo.lock /relayer/Cargo.lock

# EXPOSE 4500

# CMD ["relayer/target/release/relayer"]

# # This cargo chef logic comes from https://github.com/LukeMathWalker/cargo-chef
# # Inspired by Huff: https://github.com/huff-language/huff-rs/blob/main/Dockerfile
274 changes: 3 additions & 271 deletions packages/relayer/src/abis/account_handler.rs

Large diffs are not rendered by default.

107 changes: 1 addition & 106 deletions packages/relayer/src/abis/email_wallet_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,66 +684,7 @@ pub mod email_wallet_core {
],
),
]),
events: ::core::convert::From::from([
(
::std::borrow::ToOwned::to_owned("EmailOpHandled"),
::std::vec![
::ethers::core::abi::ethabi::Event {
name: ::std::borrow::ToOwned::to_owned("EmailOpHandled"),
inputs: ::std::vec![
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("success"),
kind: ::ethers::core::abi::ethabi::ParamType::Bool,
indexed: true,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned(
"registeredUnclaimId",
),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(
256usize,
),
indexed: true,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("emailNullifier"),
kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes(
32usize,
),
indexed: true,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("emailAddrPointer"),
kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes(
32usize,
),
indexed: false,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned(
"recipientEmailAddrCommit",
),
kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes(
32usize,
),
indexed: false,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("recipientETHAddr"),
kind: ::ethers::core::abi::ethabi::ParamType::Address,
indexed: false,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("err"),
kind: ::ethers::core::abi::ethabi::ParamType::Bytes,
indexed: false,
},
],
anonymous: false,
},
],
),
]),
events: ::std::collections::BTreeMap::new(),
errors: ::std::collections::BTreeMap::new(),
receive: true,
fallback: true,
Expand Down Expand Up @@ -996,59 +937,13 @@ pub mod email_wallet_core {
.method_hash([71, 128, 234, 193], ())
.expect("method not found (this should never happen)")
}
///Gets the contract's `EmailOpHandled` event
pub fn email_op_handled_filter(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
EmailOpHandledFilter,
> {
self.0.event()
}
/// Returns an `Event` builder for all the events of this contract.
pub fn events(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
EmailOpHandledFilter,
> {
self.0.event_with_filter(::core::default::Default::default())
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for EmailWalletCore<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
#[derive(
Clone,
::ethers::contract::EthEvent,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(
name = "EmailOpHandled",
abi = "EmailOpHandled(bool,uint256,bytes32,bytes32,bytes32,address,bytes)"
)]
pub struct EmailOpHandledFilter {
#[ethevent(indexed)]
pub success: bool,
#[ethevent(indexed)]
pub registered_unclaim_id: ::ethers::core::types::U256,
#[ethevent(indexed)]
pub email_nullifier: [u8; 32],
pub email_addr_pointer: [u8; 32],
pub recipient_email_addr_commit: [u8; 32],
pub recipient_eth_addr: ::ethers::core::types::Address,
pub err: ::ethers::core::types::Bytes,
}
///Container type for all input parameters for the `accountHandler` function with signature `accountHandler()` and selector `0x33ddfb9a`
#[derive(
Clone,
Expand Down
Loading

0 comments on commit 3d148b5

Please sign in to comment.