Skip to content

Commit

Permalink
chore(docker): remove need for foundry in cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfourzerofour committed Oct 25, 2023
1 parent 6d94c06 commit ab6ecb6
Show file tree
Hide file tree
Showing 18 changed files with 10,241 additions and 27 deletions.
7 changes: 1 addition & 6 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ pre-build = [
"mkdir -p /etc/apt/keyrings",
"curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg",
"echo 'deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main' | tee /etc/apt/sources.list.d/nodesource.list",
"apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config protobuf-compiler nodejs yarn",
"curl -L https://foundry.paradigm.xyz | bash",
". /root/.bashrc",
"foundryup --version nightly"
# "chmod 755 /usr/bin/protoc",
# "chmod 755 /root/.foundry/bin/forge"
"apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config protobuf-compiler nodejs yarn"
]
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg -
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config protobuf-compiler nodejs yarn rsync

SHELL ["/bin/bash", "-c"]
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
RUN foundryup

RUN cargo install cargo-chef --locked

WORKDIR /app
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ build-%:
docker-build-latest: ## Build and push a cross-arch Docker image tagged with the latest git tag and `latest`.
$(call build_docker_image,$(GIT_TAG),latest)


.PHONY: generate-contracts
generate-contracts:
forge build --root ./crates/types/contracts

# Create a cross-arch Docker image with the given tags and push it
define build_docker_image
$(MAKE) build-aarch64-unknown-linux-gnu
Expand Down
2 changes: 0 additions & 2 deletions crates/types/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions crates/types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ fn main() -> Result<(), Box<dyn error::Error>> {
}

fn generate_contract_bindings() -> Result<(), Box<dyn error::Error>> {
generate_abis()?;
MultiAbigen::from_abigens([
abigen_of("IEntryPoint")?,
abigen_of("EntryPoint")?,
Expand All @@ -51,17 +50,6 @@ fn abigen_of(contract: &str) -> Result<Abigen, Box<dyn error::Error>> {
)?)
}

fn generate_abis() -> Result<(), Box<dyn error::Error>> {
run_command(
Command::new("forge")
.arg("build")
.arg("--root")
.arg("./contracts"),
"https://getfoundry.sh/",
"generate ABIs",
)
}

fn update_submodules() -> Result<(), Box<dyn error::Error>> {
run_command(
Command::new("git").arg("submodule").arg("update"),
Expand All @@ -78,7 +66,6 @@ fn run_command(
let output = match command.output() {
Ok(o) => o,
Err(e) => {
println!("{:?}", e);
if let ErrorKind::NotFound = e.kind() {
let program = command.get_program().to_str().unwrap();
Err(format!(
Expand All @@ -89,7 +76,6 @@ fn run_command(
}
};
if !output.status.success() {
println!("{:?}", output);
if let Ok(error_output) = String::from_utf8(output.stderr) {
eprintln!("{error_output}");
}
Expand Down
577 changes: 577 additions & 0 deletions crates/types/src/contracts/call_gas_estimation_proxy.rs

Large diffs are not rendered by default.

2,354 changes: 2,354 additions & 0 deletions crates/types/src/contracts/entry_point.rs

Large diffs are not rendered by default.

716 changes: 716 additions & 0 deletions crates/types/src/contracts/gas_price_oracle.rs

Large diffs are not rendered by default.

219 changes: 219 additions & 0 deletions crates/types/src/contracts/get_code_hashes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
pub use get_code_hashes::*;
/// This module was auto-generated with ethers-rs Abigen.
/// More information at: <https://github.com/gakonst/ethers-rs>
#[allow(
clippy::enum_variant_names,
clippy::too_many_arguments,
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types,
)]
pub mod get_code_hashes {
#[allow(deprecated)]
fn __abi() -> ::ethers::core::abi::Abi {
::ethers::core::abi::ethabi::Contract {
constructor: ::core::option::Option::Some(::ethers::core::abi::ethabi::Constructor {
inputs: ::std::vec![
::ethers::core::abi::ethabi::Param { name :
::std::borrow::ToOwned::to_owned("addresses"), kind :
::ethers::core::abi::ethabi::ParamType::Array(::std::boxed::Box::new(::ethers::core::abi::ethabi::ParamType::Address)),
internal_type :
::core::option::Option::Some(::std::borrow::ToOwned::to_owned("address[]")),
}
],
}),
functions: ::core::convert::From::from([
(
::std::borrow::ToOwned::to_owned("getCodeHashes"),
::std::vec![
::ethers::core::abi::ethabi::Function { name :
::std::borrow::ToOwned::to_owned("getCodeHashes"), inputs :
::std::vec![::ethers::core::abi::ethabi::Param { name :
::std::borrow::ToOwned::to_owned("addresses"), kind :
::ethers::core::abi::ethabi::ParamType::Array(::std::boxed::Box::new(::ethers::core::abi::ethabi::ParamType::Address)),
internal_type :
::core::option::Option::Some(::std::borrow::ToOwned::to_owned("address[]")),
}], outputs : ::std::vec![::ethers::core::abi::ethabi::Param {
name : ::std::string::String::new(), kind :
::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize),
internal_type :
::core::option::Option::Some(::std::borrow::ToOwned::to_owned("bytes32")),
}], constant : ::core::option::Option::None, state_mutability :
::ethers::core::abi::ethabi::StateMutability::View, }
],
),
]),
events: ::std::collections::BTreeMap::new(),
errors: ::core::convert::From::from([
(
::std::borrow::ToOwned::to_owned("CodeHashesResult"),
::std::vec![
::ethers::core::abi::ethabi::AbiError { name :
::std::borrow::ToOwned::to_owned("CodeHashesResult"), inputs :
::std::vec![::ethers::core::abi::ethabi::Param { name :
::std::borrow::ToOwned::to_owned("hash"), kind :
::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize),
internal_type :
::core::option::Option::Some(::std::borrow::ToOwned::to_owned("bytes32")),
}], }
],
),
]),
receive: false,
fallback: false,
}
}
///The parsed JSON ABI of the contract.
pub static GETCODEHASHES_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(
__abi,
);
#[rustfmt::skip]
const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x02\xB08\x03\x80a\x02\xB0\x839\x81\x01`@\x81\x90Ra\0/\x91a\x01jV[a\08\x81a\0]V[`@Qc\t\x1C\xD0\x05`\xE0\x1B\x81R`\x04\x01a\0T\x91\x81R` \x01\x90V[`@Q\x80\x91\x03\x90\xFD[`\0\x80\x82Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\0yWa\0ya\x018V[`@Q\x90\x80\x82R\x80` \x02` \x01\x82\x01`@R\x80\x15a\0\xA2W\x81` \x01` \x82\x02\x806\x837\x01\x90P[P\x90P`\0[\x83Q\x81\x10\x15a\x01\x04W\x83\x81\x81Q\x81\x10a\0\xC3Wa\0\xC3a\x02.V[` \x02` \x01\x01Q`\x01`\x01`\xA0\x1B\x03\x16?\x82\x82\x81Q\x81\x10a\0\xE7Wa\0\xE7a\x02.V[` \x90\x81\x02\x91\x90\x91\x01\x01R\x80a\0\xFC\x81a\x02DV[\x91PPa\0\xA8V[P`\0\x81`@Q` \x01a\x01\x18\x91\x90a\x02kV[`@\x80Q`\x1F\x19\x81\x84\x03\x01\x81R\x91\x90R\x80Q` \x90\x91\x01 \x94\x93PPPPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[\x80Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x01eW`\0\x80\xFD[\x91\x90PV[`\0` \x80\x83\x85\x03\x12\x15a\x01}W`\0\x80\xFD[\x82Q`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x01\x94W`\0\x80\xFD[\x81\x85\x01\x91P\x85`\x1F\x83\x01\x12a\x01\xA8W`\0\x80\xFD[\x81Q\x81\x81\x11\x15a\x01\xBAWa\x01\xBAa\x018V[\x80`\x05\x1B`@Q`\x1F\x19`?\x83\x01\x16\x81\x01\x81\x81\x10\x85\x82\x11\x17\x15a\x01\xDFWa\x01\xDFa\x018V[`@R\x91\x82R\x84\x82\x01\x92P\x83\x81\x01\x85\x01\x91\x88\x83\x11\x15a\x01\xFDW`\0\x80\xFD[\x93\x85\x01\x93[\x82\x85\x10\x15a\x02\"Wa\x02\x13\x85a\x01NV[\x84R\x93\x85\x01\x93\x92\x85\x01\x92a\x02\x02V[\x98\x97PPPPPPPPV[cNH{q`\xE0\x1B`\0R`2`\x04R`$`\0\xFD[`\0`\x01\x82\x01a\x02dWcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD[P`\x01\x01\x90V[` \x80\x82R\x82Q\x82\x82\x01\x81\x90R`\0\x91\x90\x84\x82\x01\x90`@\x85\x01\x90\x84[\x81\x81\x10\x15a\x02\xA3W\x83Q\x83R\x92\x84\x01\x92\x91\x84\x01\x91`\x01\x01a\x02\x87V[P\x90\x96\x95PPPPPPV\xFE";
/// The bytecode of the contract.
pub static GETCODEHASHES_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0+W`\x005`\xE0\x1C\x80c{4\xB6!\x14a\x000W[`\0\x80\xFD[a\0Ca\0>6`\x04a\x01cV[a\0UV[`@Q\x90\x81R` \x01`@Q\x80\x91\x03\x90\xF3[`\0\x80\x82Qg\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\0rWa\0ra\x011V[`@Q\x90\x80\x82R\x80` \x02` \x01\x82\x01`@R\x80\x15a\0\x9BW\x81` \x01` \x82\x02\x806\x837\x01\x90P[P\x90P`\0[\x83Q\x81\x10\x15a\0\xFDW\x83\x81\x81Q\x81\x10a\0\xBCWa\0\xBCa\x02(V[` \x02` \x01\x01Q`\x01`\x01`\xA0\x1B\x03\x16?\x82\x82\x81Q\x81\x10a\0\xE0Wa\0\xE0a\x02(V[` \x90\x81\x02\x91\x90\x91\x01\x01R\x80a\0\xF5\x81a\x02>V[\x91PPa\0\xA1V[P`\0\x81`@Q` \x01a\x01\x11\x91\x90a\x02eV[`@\x80Q`\x1F\x19\x81\x84\x03\x01\x81R\x91\x90R\x80Q` \x90\x91\x01 \x94\x93PPPPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x01^W`\0\x80\xFD[\x91\x90PV[`\0` \x80\x83\x85\x03\x12\x15a\x01vW`\0\x80\xFD[\x825g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\x01\x8EW`\0\x80\xFD[\x81\x85\x01\x91P\x85`\x1F\x83\x01\x12a\x01\xA2W`\0\x80\xFD[\x815\x81\x81\x11\x15a\x01\xB4Wa\x01\xB4a\x011V[\x80`\x05\x1B`@Q`\x1F\x19`?\x83\x01\x16\x81\x01\x81\x81\x10\x85\x82\x11\x17\x15a\x01\xD9Wa\x01\xD9a\x011V[`@R\x91\x82R\x84\x82\x01\x92P\x83\x81\x01\x85\x01\x91\x88\x83\x11\x15a\x01\xF7W`\0\x80\xFD[\x93\x85\x01\x93[\x82\x85\x10\x15a\x02\x1CWa\x02\r\x85a\x01GV[\x84R\x93\x85\x01\x93\x92\x85\x01\x92a\x01\xFCV[\x98\x97PPPPPPPPV[cNH{q`\xE0\x1B`\0R`2`\x04R`$`\0\xFD[`\0`\x01\x82\x01a\x02^WcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD[P`\x01\x01\x90V[` \x80\x82R\x82Q\x82\x82\x01\x81\x90R`\0\x91\x90\x84\x82\x01\x90`@\x85\x01\x90\x84[\x81\x81\x10\x15a\x02\x9DW\x83Q\x83R\x92\x84\x01\x92\x91\x84\x01\x91`\x01\x01a\x02\x81V[P\x90\x96\x95PPPPPPV\xFE\xA2dipfsX\"\x12 *\xD8\xA0$2\xFER\x19\0L\xEA e*(\x04t\x9E\\\xD3\x0EQ8\xB7\xF0\x85]\xF2\xD6Z\x05YdsolcC\0\x08\x15\x003";
/// The deployed bytecode of the contract.
pub static GETCODEHASHES_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct GetCodeHashes<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for GetCodeHashes<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for GetCodeHashes<M> {
type Target = ::ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for GetCodeHashes<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for GetCodeHashes<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(::core::stringify!(GetCodeHashes))
.field(&self.address())
.finish()
}
}
impl<M: ::ethers::providers::Middleware> GetCodeHashes<M> {
/// Creates a new contract instance with the specified `ethers` client at
/// `address`. The contract derefs to a `ethers::Contract` object.
pub fn new<T: Into<::ethers::core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(
::ethers::contract::Contract::new(
address.into(),
GETCODEHASHES_ABI.clone(),
client,
),
)
}
/// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it.
/// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction
///
/// Notes:
/// - If there are no constructor arguments, you should pass `()` as the argument.
/// - The default poll duration is 7 seconds.
/// - The default number of confirmations is 1 block.
///
///
/// # Example
///
/// Generate contract bindings with `abigen!` and deploy a new contract instance.
///
/// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact.
///
/// ```ignore
/// # async fn deploy<M: ethers::providers::Middleware>(client: ::std::sync::Arc<M>) {
/// abigen!(Greeter, "../greeter.json");
///
/// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap();
/// let msg = greeter_contract.greet().call().await.unwrap();
/// # }
/// ```
pub fn deploy<T: ::ethers::core::abi::Tokenize>(
client: ::std::sync::Arc<M>,
constructor_args: T,
) -> ::core::result::Result<
::ethers::contract::builders::ContractDeployer<M, Self>,
::ethers::contract::ContractError<M>,
> {
let factory = ::ethers::contract::ContractFactory::new(
GETCODEHASHES_ABI.clone(),
GETCODEHASHES_BYTECODE.clone().into(),
client,
);
let deployer = factory.deploy(constructor_args)?;
let deployer = ::ethers::contract::ContractDeployer::new(deployer);
Ok(deployer)
}
///Calls the contract's `getCodeHashes` (0x7b34b621) function
pub fn get_code_hashes(
&self,
addresses: ::std::vec::Vec<::ethers::core::types::Address>,
) -> ::ethers::contract::builders::ContractCall<M, [u8; 32]> {
self.0
.method_hash([123, 52, 182, 33], addresses)
.expect("method not found (this should never happen)")
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for GetCodeHashes<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
///Custom Error type `CodeHashesResult` with signature `CodeHashesResult(bytes32)` and selector `0x091cd005`
#[derive(
Clone,
::ethers::contract::EthError,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[etherror(name = "CodeHashesResult", abi = "CodeHashesResult(bytes32)")]
pub struct CodeHashesResult {
pub hash: [u8; 32],
}
///Container type for all input parameters for the `getCodeHashes` function with signature `getCodeHashes(address[])` and selector `0x7b34b621`
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "getCodeHashes", abi = "getCodeHashes(address[])")]
pub struct GetCodeHashesCall {
pub addresses: ::std::vec::Vec<::ethers::core::types::Address>,
}
///Container type for all return fields from the `getCodeHashes` function with signature `getCodeHashes(address[])` and selector `0x7b34b621`
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct GetCodeHashesReturn(pub [u8; 32]);
}
Loading

0 comments on commit ab6ecb6

Please sign in to comment.