diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 734b028a..b0ec5744 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: ci jobs: build_and_test: - name: Account Abstraction Bundler in Rust + name: Silius - ERC-4337 bundler in Rust runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -63,8 +63,8 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: bundler - path: target/release/bundler + name: silius + path: target/release/silius - name: Lint run: | @@ -86,7 +86,7 @@ jobs: - uses: actions/checkout@v3 with: path: - aa-bundler + silius - run: curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 - - run: pip install jq yq @@ -95,11 +95,11 @@ jobs: - uses: actions/download-artifact@v3 with: - name: bundler - path: bundler-artifact - - run: mv bundler-artifact/bundler /usr/local/bin/ - - run: chmod a+x /usr/local/bin/bundler - - run: chmod a+x aa-bundler/bundler-spec-test/launcher.sh + name: silius + path: silius-artifact + - run: mv silius-artifact/silius /usr/local/bin/ + - run: chmod a+x /usr/local/bin/silius + - run: chmod a+x silius/bundler-spec-test/launcher.sh - uses: actions/setup-node@v3 with: @@ -107,6 +107,6 @@ jobs: - run: npm install -g yarn - name: Run tests - run: pdm run test --launcher-script aa-bundler/bundler-spec-test/launcher.sh --url http://localhost:3000 + run: pdm run test --launcher-script silius/bundler-spec-test/launcher.sh --url http://localhost:3000 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d74e4207..d5edaccd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ -# Contributing to aa-bundler +# Contributing to Silius Thanks for your help in improving the project! We are so happy to have you! -aa-bundler is an open-source ERC-4337 bundler implementation in Rust. It doesn't matter how experienced you are with Rust or account abstraction (ERC-4337); there is definitely something to help us. +Silius is an open-source ERC-4337 bundler implementation in Rust. It doesn't matter how experienced you are with Rust or account abstraction (ERC-4337); there is definitely something to help us. **No contribution is too small!** @@ -22,7 +22,7 @@ This project operates like any other open-source project on GitHub. ## Finding something to work on -1. The best way to start is to find an issue to work on; if you need more information, leave a comment or join the [Telegram channel](https://t.me/aabundler). If you think of something for which the issue doesn't exist, create a new one. +1. The best way to start is to find an issue to work on; if you need more information, leave a comment or join the [Telegram group](https://t.me/+sKeRcN4j3MM3NmNk). If you think of something for which the issue doesn't exist, create a new one. 2. Work on the issue in your personal fork. 3. Once you finish your work, open a pull request and reference the issue you worked on. Make sure your PR successfully passes the GitHub CI. 4. All pull requests will be reviewed, and sometimes you will have to make some changes based on the received comments. diff --git a/Cargo.lock b/Cargo.lock index 8ca46b60..bc45a258 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,157 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "aa-bundler" -version = "0.1.0" -dependencies = [ - "aa-bundler-grpc", - "aa-bundler-primitives", - "aa-bundler-rpc", - "anyhow", - "clap", - "dirs 4.0.0", - "ethers", - "expanded-pathbuf", - "pin-utils", - "tokio", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "aa-bundler-bundler" -version = "0.1.0" -dependencies = [ - "aa-bundler-contracts", - "aa-bundler-primitives", - "anyhow", - "ethers", - "tracing", -] - -[[package]] -name = "aa-bundler-contracts" -version = "0.1.0" -dependencies = [ - "aa-bundler-primitives", - "anyhow", - "ethers", - "ethers-providers", - "ethers-solc", - "lazy_static", - "serde", - "serde_json", - "thiserror", - "tokio", -] - -[[package]] -name = "aa-bundler-examples" -version = "0.1.0" -dependencies = [ - "aa-bundler-primitives", - "anyhow", - "ethers", - "tokio", -] - -[[package]] -name = "aa-bundler-grpc" -version = "0.1.0" -dependencies = [ - "aa-bundler-bundler", - "aa-bundler-contracts", - "aa-bundler-primitives", - "aa-bundler-uopool", - "anyhow", - "arrayref", - "async-trait", - "dashmap", - "ethers", - "parking_lot", - "prost", - "prost-build", - "protobuf-src", - "serde_json", - "tokio", - "tonic", - "tonic-build", - "tracing", -] - -[[package]] -name = "aa-bundler-primitives" -version = "0.1.0" -dependencies = [ - "anyhow", - "educe", - "ethers", - "expanded-pathbuf", - "lazy_static", - "rustc-hex", - "serde", - "serde_json", - "ssz_rs", - "ssz_rs_derive", - "strum", - "strum_macros", - "tokio", - "tracing", -] - -[[package]] -name = "aa-bundler-rpc" -version = "0.1.0" -dependencies = [ - "aa-bundler-grpc", - "aa-bundler-primitives", - "anyhow", - "async-trait", - "ethers", - "git-version", - "hyper", - "jsonrpsee", - "serde", - "serde_json", - "tonic", - "tower", - "tower-http", -] - -[[package]] -name = "aa-bundler-tests" -version = "0.1.0" -dependencies = [ - "aa-bundler-contracts", - "aa-bundler-primitives", - "aa-bundler-uopool", - "anyhow", - "ethers", - "tempdir", - "tokio", -] - -[[package]] -name = "aa-bundler-uopool" -version = "0.1.0" -dependencies = [ - "aa-bundler-contracts", - "aa-bundler-primitives", - "anyhow", - "educe", - "ethers", - "page_size 0.5.0", - "prost", - "reth-db", - "reth-libmdbx", - "serde", - "serde_json", - "tempdir", - "tokio", - "tracing", -] - [[package]] name = "adler" version = "1.0.2" @@ -4364,6 +4213,157 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "silius" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "dirs 4.0.0", + "ethers", + "expanded-pathbuf", + "pin-utils", + "silius-grpc", + "silius-primitives", + "silius-rpc", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "silius-bundler" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethers", + "silius-contracts", + "silius-primitives", + "tracing", +] + +[[package]] +name = "silius-contracts" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethers", + "ethers-providers", + "ethers-solc", + "lazy_static", + "serde", + "serde_json", + "silius-primitives", + "thiserror", + "tokio", +] + +[[package]] +name = "silius-examples" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethers", + "silius-primitives", + "tokio", +] + +[[package]] +name = "silius-grpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "arrayref", + "async-trait", + "dashmap", + "ethers", + "parking_lot", + "prost", + "prost-build", + "protobuf-src", + "serde_json", + "silius-bundler", + "silius-contracts", + "silius-primitives", + "silius-uopool", + "tokio", + "tonic", + "tonic-build", + "tracing", +] + +[[package]] +name = "silius-primitives" +version = "0.1.0" +dependencies = [ + "anyhow", + "educe", + "ethers", + "expanded-pathbuf", + "lazy_static", + "rustc-hex", + "serde", + "serde_json", + "ssz_rs", + "ssz_rs_derive", + "strum", + "strum_macros", + "tokio", + "tracing", +] + +[[package]] +name = "silius-rpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "ethers", + "git-version", + "hyper", + "jsonrpsee", + "serde", + "serde_json", + "silius-grpc", + "silius-primitives", + "tonic", + "tower", + "tower-http", +] + +[[package]] +name = "silius-tests" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethers", + "silius-contracts", + "silius-primitives", + "silius-uopool", + "tempdir", + "tokio", +] + +[[package]] +name = "silius-uopool" +version = "0.1.0" +dependencies = [ + "anyhow", + "educe", + "ethers", + "page_size 0.5.0", + "prost", + "reth-db", + "reth-libmdbx", + "serde", + "serde_json", + "silius-contracts", + "silius-primitives", + "tempdir", + "tokio", + "tracing", +] + [[package]] name = "siphasher" version = "0.3.10" diff --git a/Cargo.toml b/Cargo.toml index d5a5ee4f..5d3991f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = [ - "bin/bundler", + "bin/silius", "crates/bundler", "crates/contracts", "crates/grpc", @@ -10,13 +10,13 @@ members = [ "examples", "tests", ] -default-members = ["bin/bundler"] +default-members = ["bin/silius"] [workspace.package] authors = ["Vid Kersic "] edition = "2021" license = "MIT OR Apache-2.0" -repository = "https://github.com/Vid201/aa-bundler" +repository = "https://github.com/Vid201/silius" rust-version = "1.70" [workspace.dependencies] diff --git a/Dockerfile b/Dockerfile index 473f8b8a..cfbbbbad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ WORKDIR /rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:$PATH" -WORKDIR /aa-bundler +WORKDIR /silius COPY . . RUN make fetch-thirdparty @@ -25,10 +25,10 @@ RUN make build # run FROM frolvlad/alpine-glibc -COPY --from=builder /aa-bundler/target/release/bundler /usr/local/bin/bundler +COPY --from=builder /silius/target/release/silius /usr/local/bin/silius EXPOSE 3000 -ENTRYPOINT ["usr/local/bin/bundler"] +ENTRYPOINT ["usr/local/bin/silius"] -LABEL org.opencontainers.image.source=https://github.com/Vid201/aa-bundler +LABEL org.opencontainers.image.source=https://github.com/Vid201/silius diff --git a/Makefile b/Makefile index ed2b17ce..5b58affa 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,23 @@ build: cargo build --release -run-bundler: - cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.aa-bundler/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 +run-silius: + cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.silius/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 -run-bundler-uopool: - cargo run --release --bin bundler-uopool -- --eth-client-address http://127.0.0.1:8545 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 +run-silius-uopool: + cargo run --release --bin silius-uopool -- --eth-client-address http://127.0.0.1:8545 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 -run-bundler-rpc: - cargo run --release --bin bundler-rpc +run-silius-rpc: + cargo run --release --bin silius-rpc run-create-wallet: - cargo run --release --bin create-wallet -- --output-path ${HOME}/.aa-bundler + cargo run --release --bin create-wallet -- --output-path ${HOME}/.silius -run-bundler-debug: - cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.aa-bundler/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 --rpc-api eth,debug +run-silius-debug: + cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.silius/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 --rpc-api eth,debug -run-bundler-debug-mode: - RUST_LOG=aa_bundler=TRACE cargo run --profile debug-fast -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file /home/vid/.aa-bundler/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 --rpc-api eth,debug +run-silius-debug-mode: + RUST_LOG=silius=TRACE cargo run --profile debug-fast -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file /home/vid/.silius/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 --rpc-api eth,debug fetch-thirdparty: git submodule update --init diff --git a/README.md b/README.md index 769f7c2f..1df474d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -#

AA - Bundler

+#

Silius

-

Rust Bundler - ERC-4337 (Account Abstraction).

+

Silius - ERC-4337 (Account Abstraction) bundler implementation in Rust.

@@ -33,25 +33,25 @@ make setup-thirdparty Create wallet for bundler: ```bash -cargo run --release --bin create-wallet -- --output-path ${HOME}/.aa-bundler --chain-id 5 +cargo run --release --bin create-wallet -- --output-path ${HOME}/.silius --chain-id 5 ``` Run bundler (with user operation pool and JSON-RPC API): ```bash -cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.aa-bundler/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 +cargo run --release -- --eth-client-address http://127.0.0.1:8545 --mnemonic-file ${HOME}/.silius/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --gas-factor 600 --min-balance 1 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 ``` Run only user operation pool: ```bash -cargo run --release --bin bundler-uopool -- --eth-client-address http://127.0.0.1:8545 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 +cargo run --release --bin silius-uopool -- --eth-client-address http://127.0.0.1:8545 --entry-points 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 --min-stake 1 --min-unstake-delay 0 --min-priority-fee-per-gas 0 --max-verification-gas 1500000 ``` Run only JSON-RPC API: ```bash -cargo run --release --bin bundler-rpc +cargo run --release --bin silius-rpc ``` ## Supported networks @@ -112,7 +112,7 @@ This project is dual-licensed under Apache 2.0 and MIT terms: ## Donations -aa-bundler is an open-source project and a public good. If you want to help the project, you can send donations of any size via: +Silius is an open-source project and a public good. If you want to help the project, you can send donations of any size via: - Ethereum address: `0x7cB801446AC4f5EA8f7333EFc58ab787eB611558` diff --git a/bin/bundler/Cargo.toml b/bin/silius/Cargo.toml similarity index 61% rename from bin/bundler/Cargo.toml rename to bin/silius/Cargo.toml index bc1ed248..0be8b8e3 100644 --- a/bin/bundler/Cargo.toml +++ b/bin/silius/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler" +name = "silius" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,14 +7,11 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler +AA (ERC-4337) bundler - Silius """ -default-run = "bundler" +default-run = "silius" [dependencies] -aa-bundler-grpc = { path = "../../crates/grpc" } -aa-bundler-primitives = { path = "../../crates/primitives" } -aa-bundler-rpc = { path = "../../crates/rpc" } anyhow = "1" clap = { version = "4", features = ["derive"] } @@ -22,6 +19,9 @@ dirs = "4.0" ethers = { workspace = true } expanded-pathbuf = "0.1" pin-utils = "0.1" +silius-grpc = { path = "../../crates/grpc" } +silius-primitives = { path = "../../crates/primitives" } +silius-rpc = { path = "../../crates/rpc" } tokio = { workspace = true } tracing = { workspace = true } tracing-subscriber = "0.3" @@ -30,16 +30,16 @@ tracing-subscriber = "0.3" path = "src/lib.rs" [[bin]] -path = "src/bundler.rs" -name = "bundler" +path = "src/silius.rs" +name = "silius" [[bin]] -path = "src/bundler-uopool.rs" -name = "bundler-uopool" +path = "src/silius-uopool.rs" +name = "silius-uopool" [[bin]] -path = "src/bundler-rpc.rs" -name = "bundler-rpc" +path = "src/silius-rpc.rs" +name = "silius-rpc" [[bin]] path = "src/create-wallet.rs" diff --git a/bin/bundler/src/cli.rs b/bin/silius/src/cli.rs similarity index 98% rename from bin/bundler/src/cli.rs rename to bin/silius/src/cli.rs index 860d0cf3..db94b49b 100644 --- a/bin/bundler/src/cli.rs +++ b/bin/silius/src/cli.rs @@ -1,7 +1,7 @@ use crate::utils::{parse_address, parse_u256, parse_uopool_mode}; -use aa_bundler_primitives::UoPoolMode; use clap::Parser; use ethers::types::{Address, U256}; +use silius_primitives::UoPoolMode; use std::net::SocketAddr; #[derive(Clone, Debug, Parser, PartialEq)] diff --git a/bin/bundler/src/create-wallet.rs b/bin/silius/src/create-wallet.rs similarity index 84% rename from bin/bundler/src/create-wallet.rs rename to bin/silius/src/create-wallet.rs index 40772fbc..88e631f5 100644 --- a/bin/bundler/src/create-wallet.rs +++ b/bin/silius/src/create-wallet.rs @@ -1,15 +1,15 @@ -use aa_bundler::utils::parse_u256; -use aa_bundler_primitives::Wallet; use anyhow::Result; use clap::Parser; use dirs::home_dir; use ethers::types::U256; use expanded_pathbuf::ExpandedPathBuf; +use silius::utils::parse_u256; +use silius_primitives::Wallet; use tracing::info; #[derive(Parser)] #[clap( - name = "aa-bundler-create-wallet", + name = "silius-create-wallet", about = "Bundler's wallet creation for ERC-4337 Account Abstraction" )] pub struct Opt { @@ -29,7 +29,7 @@ fn main() -> Result<()> { output_path } else { home_dir() - .map(|h| h.join(".aa-bundler")) + .map(|h| h.join(".silius")) .ok_or_else(|| anyhow::anyhow!("Get Home directory error")) .map(ExpandedPathBuf)? }; diff --git a/bin/bundler/src/lib.rs b/bin/silius/src/lib.rs similarity index 100% rename from bin/bundler/src/lib.rs rename to bin/silius/src/lib.rs diff --git a/bin/bundler/src/bundler-rpc.rs b/bin/silius/src/silius-rpc.rs similarity index 92% rename from bin/bundler/src/bundler-rpc.rs rename to bin/silius/src/silius-rpc.rs index c3cbd201..a2b22032 100644 --- a/bin/bundler/src/bundler-rpc.rs +++ b/bin/silius/src/silius-rpc.rs @@ -1,19 +1,19 @@ -use aa_bundler::cli::RpcServiceOpts; -use aa_bundler_grpc::{bundler_client::BundlerClient, uo_pool_client::UoPoolClient}; -use aa_bundler_rpc::{ +use anyhow::Result; +use clap::Parser; +use silius::cli::RpcServiceOpts; +use silius_grpc::{bundler_client::BundlerClient, uo_pool_client::UoPoolClient}; +use silius_rpc::{ debug_api::{DebugApiServer, DebugApiServerImpl}, eth_api::{EthApiServer, EthApiServerImpl}, web3_api::{Web3ApiServer, Web3ApiServerImpl}, JsonRpcServer, }; -use anyhow::Result; -use clap::Parser; use std::{collections::HashSet, future::pending}; use tracing::info; #[derive(Parser)] #[clap( - name = "aa-bundler-rpc", + name = "silius-rpc", about = "JSON-RPC server for ERC-4337 Account Abstraction Bundler" )] pub struct Opt { diff --git a/bin/bundler/src/bundler-uopool.rs b/bin/silius/src/silius-uopool.rs similarity index 93% rename from bin/bundler/src/bundler-uopool.rs rename to bin/silius/src/silius-uopool.rs index 9932913c..db69abd2 100644 --- a/bin/bundler/src/bundler-uopool.rs +++ b/bin/silius/src/silius-uopool.rs @@ -1,21 +1,21 @@ -use aa_bundler::{ - cli::UoPoolServiceOpts, - utils::{parse_address, parse_u256}, -}; -use aa_bundler_grpc::uopool_service_run; -use aa_bundler_primitives::{chain::SUPPORTED_CHAINS, Chain}; use anyhow::{format_err, Result}; use clap::Parser; use ethers::{ providers::{Http, Middleware, Provider}, types::{Address, U256}, }; +use silius::{ + cli::UoPoolServiceOpts, + utils::{parse_address, parse_u256}, +}; +use silius_grpc::uopool_service_run; +use silius_primitives::{chain::SUPPORTED_CHAINS, Chain}; use std::{future::pending, sync::Arc}; use tracing::info; #[derive(Parser)] #[clap( - name = "aa-bundler-uopool", + name = "silius-uopool", about = "User operation pool for ERC-4337 Account Abstraction Bundler" )] pub struct Opt { diff --git a/bin/bundler/src/bundler.rs b/bin/silius/src/silius.rs similarity index 97% rename from bin/bundler/src/bundler.rs rename to bin/silius/src/silius.rs index 6da53092..e084d3d2 100644 --- a/bin/bundler/src/bundler.rs +++ b/bin/silius/src/silius.rs @@ -1,33 +1,30 @@ -use aa_bundler::{ +use anyhow::{format_err, Result}; +use clap::Parser; +use ethers::{ + providers::{Http, Middleware, Provider}, + types::{Address, U256}, +}; +use expanded_pathbuf::ExpandedPathBuf; +use silius::{ cli::{BundlerServiceOpts, RpcServiceOpts, UoPoolServiceOpts}, utils::{parse_address, parse_u256, run_until_ctrl_c}, }; -use aa_bundler_grpc::{ +use silius_grpc::{ bundler_client::BundlerClient, bundler_service_run, uo_pool_client::UoPoolClient, uopool_service_run, }; -use aa_bundler_primitives::{chain::SUPPORTED_CHAINS, Chain, Wallet}; -use aa_bundler_rpc::{ +use silius_primitives::{chain::SUPPORTED_CHAINS, Chain, Wallet}; +use silius_rpc::{ debug_api::{DebugApiServer, DebugApiServerImpl}, eth_api::{EthApiServer, EthApiServerImpl}, web3_api::{Web3ApiServer, Web3ApiServerImpl}, JsonRpcServer, }; -use anyhow::{format_err, Result}; -use clap::Parser; -use ethers::{ - providers::{Http, Middleware, Provider}, - types::{Address, U256}, -}; -use expanded_pathbuf::ExpandedPathBuf; use std::{collections::HashSet, future::pending, panic, sync::Arc}; use tracing::info; #[derive(Parser)] -#[clap( - name = "aa-bundler", - about = "Bundler for ERC-4337 Account Abstraction" -)] +#[clap(name = "silius", about = "Bundler for ERC-4337 Account Abstraction")] pub struct Opt { #[clap(long)] pub mnemonic_file: ExpandedPathBuf, diff --git a/bin/bundler/src/utils.rs b/bin/silius/src/utils.rs similarity index 97% rename from bin/bundler/src/utils.rs rename to bin/silius/src/utils.rs index 5eaa4e60..cc54fc4d 100644 --- a/bin/bundler/src/utils.rs +++ b/bin/silius/src/utils.rs @@ -1,6 +1,6 @@ -use aa_bundler_primitives::UoPoolMode; use ethers::types::{Address, U256}; use pin_utils::pin_mut; +use silius_primitives::UoPoolMode; use std::{future::Future, str::FromStr}; use tracing::info; diff --git a/bundler-spec-test/launcher.sh b/bundler-spec-test/launcher.sh index c487bc3b..7df3375d 100644 --- a/bundler-spec-test/launcher.sh +++ b/bundler-spec-test/launcher.sh @@ -1,16 +1,16 @@ #!/bin/bash -# Launcher script for the aa-bundler in Rust. +# Launcher script for the Silius. set -x pushd `dirname \`realpath $0\`` case $1 in name) - echo "aa-bundler in Rust" + echo "Silius - ERC-4337 bundler in Rust" ;; start) docker-compose up -d - RUST_LOG=aa_bundler=TRACE bundler \ + RUST_LOG=silius=TRACE silius \ --rpc-listen-address 0.0.0.0:3000 \ --eth-client-address http://localhost:8545 \ --mnemonic-file keys/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ diff --git a/crates/bundler/Cargo.toml b/crates/bundler/Cargo.toml index 5badc091..ace53390 100644 --- a/crates/bundler/Cargo.toml +++ b/crates/bundler/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-bundler" +name = "silius-bundler" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,13 +7,13 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler bundling implementation +AA (ERC-4337) bundler bundling implementation """ [dependencies] -aa-bundler-contracts = { path = "../contracts" } -aa-bundler-primitives = { path = "../primitives" } anyhow = "1" ethers = { workspace = true } +silius-contracts = { path = "../contracts" } +silius-primitives = { path = "../primitives" } tracing = { workspace = true } diff --git a/crates/bundler/src/bundler.rs b/crates/bundler/src/bundler.rs index 5e167ad3..8514d3ff 100644 --- a/crates/bundler/src/bundler.rs +++ b/crates/bundler/src/bundler.rs @@ -1,11 +1,11 @@ -use aa_bundler_contracts::entry_point::EntryPointAPI; -use aa_bundler_primitives::{Chain, UserOperation, Wallet}; use ethers::{ prelude::SignerMiddleware, providers::{Http, Middleware, Provider}, signers::Signer, types::{transaction::eip2718::TypedTransaction, Address, H256}, }; +use silius_contracts::entry_point::EntryPointAPI; +use silius_primitives::{Chain, UserOperation, Wallet}; use std::{sync::Arc, time::Duration}; use tracing::{info, trace}; diff --git a/crates/contracts/Cargo.toml b/crates/contracts/Cargo.toml index 996e9397..8b0fb131 100644 --- a/crates/contracts/Cargo.toml +++ b/crates/contracts/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-contracts" +name = "silius-contracts" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,11 +7,10 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler smart contract interfaces +AA (ERC-4337) bundler smart contract interfaces """ [dependencies] -aa-bundler-primitives = { path = "../primitives" } anyhow = "1" ethers = { workspace = true } @@ -19,6 +18,7 @@ ethers-providers = "2.0.1" lazy_static = "1.4.0" serde = "1" serde_json = "1" +silius-primitives = { path = "../primitives" } thiserror = "1" [dev-dependencies] diff --git a/crates/contracts/src/entry_point.rs b/crates/contracts/src/entry_point.rs index 23c4641d..b0b11d03 100644 --- a/crates/contracts/src/entry_point.rs +++ b/crates/contracts/src/entry_point.rs @@ -314,11 +314,11 @@ impl EntryPointErr { #[cfg(test)] mod tests { use super::*; - use aa_bundler_primitives::UserOperation; use ethers::{ providers::{Http, Middleware, Provider}, types::{Bytes, GethTrace, U256}, }; + use silius_primitives::UserOperation; use std::sync::Arc; #[tokio::test] diff --git a/crates/contracts/src/utils.rs b/crates/contracts/src/utils.rs index f93612ff..210f39ec 100644 --- a/crates/contracts/src/utils.rs +++ b/crates/contracts/src/utils.rs @@ -1,6 +1,6 @@ use crate::gen::entry_point_api::{self, EntryPointAPICalls}; -use aa_bundler_primitives::UserOperation; use ethers::{abi::AbiDecode, types::Bytes}; +use silius_primitives::UserOperation; impl From for entry_point_api::UserOperation { fn from(uo: UserOperation) -> Self { diff --git a/crates/grpc/Cargo.toml b/crates/grpc/Cargo.toml index aa79599d..b16aeb0a 100644 --- a/crates/grpc/Cargo.toml +++ b/crates/grpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-grpc" +name = "silius-grpc" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,14 +7,10 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler gRPC interfaces +AA (ERC-4337) bundler gRPC interfaces """ [dependencies] -aa-bundler-bundler = { path = "../bundler" } -aa-bundler-contracts = { path = "../contracts" } -aa-bundler-primitives = { path = "../primitives" } -aa-bundler-uopool = { path = "../uopool" } anyhow = "1" arrayref = "0.3" @@ -24,6 +20,10 @@ ethers = { workspace = true } parking_lot = "0.12" prost = "0.11" serde_json = "1" +silius-bundler = { path = "../bundler" } +silius-contracts = { path = "../contracts" } +silius-primitives = { path = "../primitives" } +silius-uopool = { path = "../uopool" } tokio = { workspace = true } tonic = { version = "0.8", default-features = false, features = [ "codegen", diff --git a/crates/grpc/src/bundler.rs b/crates/grpc/src/bundler.rs index 316750d7..81c055f3 100644 --- a/crates/grpc/src/bundler.rs +++ b/crates/grpc/src/bundler.rs @@ -1,11 +1,11 @@ use crate::proto::bundler::*; use crate::proto::uopool::{GetSortedRequest, HandlePastEventRequest}; use crate::uo_pool_client::UoPoolClient; -use aa_bundler_bundler::Bundler; -use aa_bundler_primitives::{Chain, UserOperation, Wallet}; use async_trait::async_trait; use ethers::types::{Address, H256, U256}; use parking_lot::Mutex; +use silius_bundler::Bundler; +use silius_primitives::{Chain, UserOperation, Wallet}; use std::{net::SocketAddr, sync::Arc, time::Duration}; use tonic::{Request, Response, Status}; use tracing::{error, info, warn}; diff --git a/crates/grpc/src/proto.rs b/crates/grpc/src/proto.rs index cbb4a5b6..c37535f3 100644 --- a/crates/grpc/src/proto.rs +++ b/crates/grpc/src/proto.rs @@ -1,10 +1,10 @@ // Code adapted from: https://github.com/ledgerwatch/interfaces/blob/master/src/lib.rs#L1 pub mod types { - use aa_bundler_primitives::UserOperationHash; use arrayref::array_ref; use ethers::types::{Address, Bloom, U256}; use prost::bytes::Buf; + use silius_primitives::UserOperationHash; use std::str::FromStr; tonic::include_proto!("types"); @@ -95,8 +95,8 @@ pub mod types { } } - impl From for UserOperation { - fn from(user_operation: aa_bundler_primitives::UserOperation) -> Self { + impl From for UserOperation { + fn from(user_operation: silius_primitives::UserOperation) -> Self { Self { sender: Some(user_operation.sender.into()), nonce: Some(user_operation.nonce.into()), @@ -115,7 +115,7 @@ pub mod types { } } - impl From for aa_bundler_primitives::UserOperation { + impl From for silius_primitives::UserOperation { fn from(user_operation: UserOperation) -> Self { Self { sender: { @@ -176,18 +176,18 @@ pub mod types { } } - impl From for ReputationEntry { - fn from(reputation_entry: aa_bundler_primitives::reputation::ReputationEntry) -> Self { + impl From for ReputationEntry { + fn from(reputation_entry: silius_primitives::reputation::ReputationEntry) -> Self { Self { addr: Some(reputation_entry.address.into()), uo_seen: reputation_entry.uo_seen, uo_included: reputation_entry.uo_included, stat: match reputation_entry.status { - aa_bundler_primitives::reputation::ReputationStatus::OK => ReputationStatus::Ok, - aa_bundler_primitives::reputation::ReputationStatus::THROTTLED => { + silius_primitives::reputation::ReputationStatus::OK => ReputationStatus::Ok, + silius_primitives::reputation::ReputationStatus::THROTTLED => { ReputationStatus::Throttled } - aa_bundler_primitives::reputation::ReputationStatus::BANNED => { + silius_primitives::reputation::ReputationStatus::BANNED => { ReputationStatus::Banned } } as i32, @@ -195,7 +195,7 @@ pub mod types { } } - impl From for aa_bundler_primitives::reputation::ReputationEntry { + impl From for silius_primitives::reputation::ReputationEntry { fn from(reputation_entry: ReputationEntry) -> Self { Self { address: { @@ -209,15 +209,15 @@ pub mod types { uo_included: reputation_entry.uo_included, status: match reputation_entry.stat { _ if reputation_entry.stat == ReputationStatus::Ok as i32 => { - aa_bundler_primitives::reputation::ReputationStatus::OK + silius_primitives::reputation::ReputationStatus::OK } _ if reputation_entry.stat == ReputationStatus::Throttled as i32 => { - aa_bundler_primitives::reputation::ReputationStatus::THROTTLED + silius_primitives::reputation::ReputationStatus::THROTTLED } _ if reputation_entry.stat == ReputationStatus::Banned as i32 => { - aa_bundler_primitives::reputation::ReputationStatus::BANNED + silius_primitives::reputation::ReputationStatus::BANNED } - _ => aa_bundler_primitives::reputation::ReputationStatus::OK, + _ => silius_primitives::reputation::ReputationStatus::OK, }, } } @@ -326,7 +326,7 @@ pub mod uopool { } pub mod bundler { - use aa_bundler_primitives::BundlerMode as GrpcMode; + use silius_primitives::BundlerMode as GrpcMode; tonic::include_proto!("bundler"); diff --git a/crates/grpc/src/uopool.rs b/crates/grpc/src/uopool.rs index c4167dd8..b18fbff8 100644 --- a/crates/grpc/src/uopool.rs +++ b/crates/grpc/src/uopool.rs @@ -3,15 +3,6 @@ use crate::{ utils::{parse_addr, parse_hash, parse_uo, parse_uo_pool_mut}, }; use crate::{proto::uopool::*, utils::parse_uo_pool}; -use aa_bundler_contracts::{entry_point::EntryPointErr, EntryPoint}; -use aa_bundler_primitives::{ - reputation::{BAN_SLACK, MIN_INCLUSION_RATE_DENOMINATOR, THROTTLING_SLACK}, - uopool::AddError, - Chain, UoPoolMode, -}; -use aa_bundler_uopool::{ - mempool_id, MemoryMempool, MemoryReputation, MempoolId, Reputation, UoPool as UserOperationPool, -}; use anyhow::Result; use async_trait::async_trait; use dashmap::{ @@ -22,6 +13,15 @@ use ethers::{ providers::{Http, Middleware, Provider}, types::{Address, H256, U256}, }; +use silius_contracts::{entry_point::EntryPointErr, EntryPoint}; +use silius_primitives::{ + reputation::{BAN_SLACK, MIN_INCLUSION_RATE_DENOMINATOR, THROTTLING_SLACK}, + uopool::AddError, + Chain, UoPoolMode, +}; +use silius_uopool::{ + mempool_id, MemoryMempool, MemoryReputation, MempoolId, Reputation, UoPool as UserOperationPool, +}; use std::{net::SocketAddr, sync::Arc, time::Duration}; use tonic::{Request, Response, Status}; use tracing::info; diff --git a/crates/grpc/src/utils.rs b/crates/grpc/src/utils.rs index 4e412c5d..16895305 100644 --- a/crates/grpc/src/utils.rs +++ b/crates/grpc/src/utils.rs @@ -1,10 +1,10 @@ -use aa_bundler_primitives::UserOperation; -use aa_bundler_uopool::UoPool as UserOperationPool; use dashmap::mapref::one::{Ref, RefMut}; use ethers::{ providers::Middleware, types::{Address, H256}, }; +use silius_primitives::UserOperation; +use silius_uopool::UoPool as UserOperationPool; use tonic::{Code, Status}; pub fn parse_addr(h: Option) -> Result { diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 25929f24..cf8bfb00 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-primitives" +name = "silius-primitives" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,7 +7,7 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler commonly used types +AA (ERC-4337) bundler commonly used types """ [dependencies] diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index 58a0a54e..549da249 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-rpc" +name = "silius-rpc" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,12 +7,10 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler RPC implementation +AA (ERC-4337) bundler RPC implementation """ [dependencies] -aa-bundler-grpc = { path = "../grpc" } -aa-bundler-primitives = { path = "../primitives" } anyhow = "1" async-trait = "0.1" @@ -22,6 +20,8 @@ hyper = { version = "0.14" } jsonrpsee = { version = "0.18.2", features = ["server", "macros", "client"] } serde = "1" serde_json = "1" +silius-grpc = { path = "../grpc" } +silius-primitives = { path = "../primitives" } tonic = { version = "0.8", default-features = false, features = ["transport"] } tower = { version = "0.4.13" } tower-http = { version = "0.4.1", features = ["cors"] } diff --git a/crates/rpc/src/debug.rs b/crates/rpc/src/debug.rs index b503c23b..691a405a 100644 --- a/crates/rpc/src/debug.rs +++ b/crates/rpc/src/debug.rs @@ -1,17 +1,17 @@ use crate::{debug_api::DebugApiServer, error::JsonRpcError}; -use aa_bundler_grpc::{ - bundler_client::BundlerClient, uo_pool_client::UoPoolClient, GetAllReputationRequest, - GetAllRequest, Mode as GrpcMode, SetModeRequest, SetReputationRequest, SetReputationResult, -}; -use aa_bundler_primitives::{ - bundler::DEFAULT_BUNDLE_INTERVAL, reputation::ReputationEntry, BundlerMode, UserOperation, -}; use async_trait::async_trait; use ethers::types::{Address, H256}; use jsonrpsee::{ core::RpcResult, types::{error::INTERNAL_ERROR_CODE, ErrorObjectOwned}, }; +use silius_grpc::{ + bundler_client::BundlerClient, uo_pool_client::UoPoolClient, GetAllReputationRequest, + GetAllRequest, Mode as GrpcMode, SetModeRequest, SetReputationRequest, SetReputationResult, +}; +use silius_primitives::{ + bundler::DEFAULT_BUNDLE_INTERVAL, reputation::ReputationEntry, BundlerMode, UserOperation, +}; use tonic::Request; pub struct DebugApiServerImpl { diff --git a/crates/rpc/src/debug_api.rs b/crates/rpc/src/debug_api.rs index f10d5b8d..7aecb3ff 100644 --- a/crates/rpc/src/debug_api.rs +++ b/crates/rpc/src/debug_api.rs @@ -1,7 +1,7 @@ pub use crate::debug::DebugApiServerImpl; -use aa_bundler_primitives::{reputation::ReputationEntry, BundlerMode, UserOperation}; use ethers::types::{Address, H256}; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; +use silius_primitives::{reputation::ReputationEntry, BundlerMode, UserOperation}; #[rpc(server, namespace = "debug_bundler")] pub trait DebugApi { diff --git a/crates/rpc/src/error.rs b/crates/rpc/src/error.rs index 9426b404..c3fe8f7f 100644 --- a/crates/rpc/src/error.rs +++ b/crates/rpc/src/error.rs @@ -1,4 +1,7 @@ -use aa_bundler_primitives::{ +use ethers::abi::AbiEncode; +use jsonrpsee::types::{error::ErrorCode, ErrorObject, ErrorObjectOwned}; +use serde_json::json; +use silius_primitives::{ consts::rpc_error_codes::{ ENTITY_BANNED, EXECUTION, EXPIRATION, OPCODE, SANITY_CHECK, SIGNATURE, STAKE_TOO_LOW, VALIDATION, @@ -8,9 +11,6 @@ use aa_bundler_primitives::{ simulation::SimulationError, uopool::VerificationError, }; -use ethers::abi::AbiEncode; -use jsonrpsee::types::{error::ErrorCode, ErrorObject, ErrorObjectOwned}; -use serde_json::json; pub struct JsonRpcError(pub ErrorObjectOwned); diff --git a/crates/rpc/src/eth.rs b/crates/rpc/src/eth.rs index c5936598..28b4a0bd 100644 --- a/crates/rpc/src/eth.rs +++ b/crates/rpc/src/eth.rs @@ -1,19 +1,19 @@ use crate::{error::JsonRpcError, eth_api::EthApiServer}; -use aa_bundler_grpc::{ +use async_trait::async_trait; +use ethers::{ + types::{Address, U64}, + utils::to_checksum, +}; +use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned}; +use silius_grpc::{ uo_pool_client::UoPoolClient, AddRequest, AddResult, EstimateUserOperationGasRequest, EstimateUserOperationGasResult, UserOperationHashRequest, }; -use aa_bundler_primitives::{ +use silius_primitives::{ consts::rpc_error_codes::USER_OPERATION_HASH, simulation::SimulationError, uopool::VerificationError, UserOperation, UserOperationByHash, UserOperationGasEstimation, UserOperationHash, UserOperationPartial, UserOperationReceipt, }; -use async_trait::async_trait; -use ethers::{ - types::{Address, U64}, - utils::to_checksum, -}; -use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned}; use std::str::FromStr; use tonic::Request; diff --git a/crates/rpc/src/eth_api.rs b/crates/rpc/src/eth_api.rs index fa2db1a0..e780703a 100644 --- a/crates/rpc/src/eth_api.rs +++ b/crates/rpc/src/eth_api.rs @@ -1,10 +1,10 @@ pub use crate::eth::EthApiServerImpl; -use aa_bundler_primitives::{ +use ethers::types::{Address, U64}; +use jsonrpsee::{core::RpcResult, proc_macros::rpc}; +use silius_primitives::{ UserOperation, UserOperationByHash, UserOperationGasEstimation, UserOperationHash, UserOperationPartial, UserOperationReceipt, }; -use ethers::types::{Address, U64}; -use jsonrpsee::{core::RpcResult, proc_macros::rpc}; #[rpc(server, namespace = "eth")] pub trait EthApi { diff --git a/crates/rpc/src/web3.rs b/crates/rpc/src/web3.rs index e599804b..64dc32b5 100644 --- a/crates/rpc/src/web3.rs +++ b/crates/rpc/src/web3.rs @@ -1,7 +1,7 @@ use crate::web3_api::Web3ApiServer; -use aa_bundler_primitives::consts::entry_point::VERSION; use async_trait::async_trait; use jsonrpsee::core::RpcResult; +use silius_primitives::consts::entry_point::VERSION; pub struct Web3ApiServerImpl {} @@ -9,6 +9,6 @@ pub struct Web3ApiServerImpl {} impl Web3ApiServer for Web3ApiServerImpl { async fn client_version(&self) -> RpcResult { let git_version = git_version::git_version!(args = ["--tags"], fallback = "unknown"); - return Ok(format!("rust-aa-bundler/{VERSION}/{git_version}")); + return Ok(format!("silius/{VERSION}/{git_version}")); } } diff --git a/crates/uopool/Cargo.toml b/crates/uopool/Cargo.toml index b8627b51..89cf1bd1 100644 --- a/crates/uopool/Cargo.toml +++ b/crates/uopool/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-uopool" +name = "silius-uopool" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,12 +7,10 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler uopool implementation +AA (ERC-4337) bundler uopool implementation """ [dependencies] -aa-bundler-contracts = { path = "../contracts" } -aa-bundler-primitives = { path = "../primitives" } anyhow = "1" educe = { version = "0.4", features = ["Debug", "Default"] } @@ -23,9 +21,11 @@ reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "aa6f2cb0610f reth-libmdbx = { git = "https://github.com/paradigmxyz/reth.git", rev = "aa6f2cb0610fb4fa0926b42cfed7f8ff51e0db8a" } serde = "1" serde_json = "1" +silius-contracts = { path = "../contracts" } +silius-primitives = { path = "../primitives" } tokio = { workspace = true } tracing = { workspace = true } [dev-dependencies] -aa-bundler-primitives = { path = "../primitives", features = ["test-utils"] } +silius-primitives = { path = "../primitives", features = ["test-utils"] } tempdir = "0.3.7" diff --git a/crates/uopool/src/canonical/sanity_check.rs b/crates/uopool/src/canonical/sanity_check.rs index 5d2a3e7c..9f261a90 100644 --- a/crates/uopool/src/canonical/sanity_check.rs +++ b/crates/uopool/src/canonical/sanity_check.rs @@ -2,16 +2,16 @@ use crate::{ utils::{calculate_call_gas_limit, calculate_valid_gas, Overhead}, UoPool, }; -use aa_bundler_contracts::entry_point::EntryPointErr; -use aa_bundler_primitives::{ +use ethers::{providers::Middleware, types::U256}; +use serde::{Deserialize, Serialize}; +use silius_contracts::entry_point::EntryPointErr; +use silius_primitives::{ consts::entities::ACCOUNT, get_address, reputation::{ReputationStatus, StakeInfo}, sanity_check::SanityCheckError, UserOperation, UserOperationHash, }; -use ethers::{providers::Middleware, types::U256}; -use serde::{Deserialize, Serialize}; const MAX_UOS_PER_UNSTAKED_SENDER: usize = 4; const GAS_INCREASE_PERC: u64 = 10; diff --git a/crates/uopool/src/canonical/simulation.rs b/crates/uopool/src/canonical/simulation.rs index 760896b8..2ac0bf31 100644 --- a/crates/uopool/src/canonical/simulation.rs +++ b/crates/uopool/src/canonical/simulation.rs @@ -1,11 +1,18 @@ use crate::{utils::equal_code_hashes, UoPool}; -use aa_bundler_contracts::{ +use ethers::{ + abi::AbiDecode, + providers::Middleware, + types::{Address, Bytes, GethTrace, H256, U256}, + utils::keccak256, +}; +use serde::{Deserialize, Serialize}; +use silius_contracts::{ entry_point::{ EntryPointErr, SimulateValidationResult, ValidatePaymasterUserOpReturn, CONTRACTS_FUNCTIONS, }, tracer::{Call, CallEntry, JsTracerFrame}, }; -use aa_bundler_primitives::{ +use silius_primitives::{ consts::entities::{FACTORY, PAYMASTER}, get_address, reputation::StakeInfo, @@ -16,13 +23,6 @@ use aa_bundler_primitives::{ }, UoPoolMode, UserOperation, }; -use ethers::{ - abi::AbiDecode, - providers::Middleware, - types::{Address, Bytes, GethTrace, H256, U256}, - utils::keccak256, -}; -use serde::{Deserialize, Serialize}; use std::{ collections::{HashMap, HashSet}, time::{SystemTime, UNIX_EPOCH}, diff --git a/crates/uopool/src/database/mempool.rs b/crates/uopool/src/database/mempool.rs index 119ca03e..4f49ffd8 100644 --- a/crates/uopool/src/database/mempool.rs +++ b/crates/uopool/src/database/mempool.rs @@ -1,6 +1,5 @@ use super::utils::{WrapAddress, WrapCodeHash, WrapUserOperation, WrapUserOperationHash}; use crate::mempool::Mempool; -use aa_bundler_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use ethers::types::{Address, U256}; use reth_db::{ cursor::{DbCursorRO, DbDupCursorRO}, @@ -16,6 +15,7 @@ use reth_db::{ transaction::{DbTx, DbTxMut}, Error, TableType, }; +use silius_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use std::{fmt::Display, path::PathBuf}; table!( diff --git a/crates/uopool/src/database/utils.rs b/crates/uopool/src/database/utils.rs index 8967e584..27179dcc 100644 --- a/crates/uopool/src/database/utils.rs +++ b/crates/uopool/src/database/utils.rs @@ -1,4 +1,3 @@ -use aa_bundler_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use ethers::{ abi::{AbiDecode, AbiEncode}, prelude::{EthAbiCodec, EthAbiType}, @@ -6,6 +5,7 @@ use ethers::{ }; use reth_db::table::{Compress, Decode, Decompress, Encode}; use serde::{Deserialize, Serialize}; +use silius_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; macro_rules! construct_wrap_hash { ($type:ty, $name:ident, $n_bytes:expr ) => { diff --git a/crates/uopool/src/memory/mempool.rs b/crates/uopool/src/memory/mempool.rs index 97306c2a..0c68fc07 100644 --- a/crates/uopool/src/memory/mempool.rs +++ b/crates/uopool/src/memory/mempool.rs @@ -1,7 +1,7 @@ use crate::mempool::Mempool; -use aa_bundler_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use educe::Educe; use ethers::types::{Address, U256}; +use silius_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use std::collections::{HashMap, HashSet}; #[derive(Default, Educe)] diff --git a/crates/uopool/src/memory/reputation.rs b/crates/uopool/src/memory/reputation.rs index 57e8cf4d..4b65beda 100644 --- a/crates/uopool/src/memory/reputation.rs +++ b/crates/uopool/src/memory/reputation.rs @@ -1,9 +1,9 @@ use crate::reputation::Reputation; -use aa_bundler_primitives::reputation::{ - ReputationEntry, ReputationError, ReputationStatus, StakeInfo, -}; use educe::Educe; use ethers::types::{Address, U256}; +use silius_primitives::reputation::{ + ReputationEntry, ReputationError, ReputationStatus, StakeInfo, +}; use std::collections::{HashMap, HashSet}; #[derive(Default, Educe)] @@ -206,7 +206,7 @@ impl Reputation for MemoryReputation { #[cfg(test)] mod tests { use super::*; - use aa_bundler_primitives::reputation::{ + use silius_primitives::reputation::{ BAN_SLACK, MIN_INCLUSION_RATE_DENOMINATOR, THROTTLING_SLACK, }; diff --git a/crates/uopool/src/mempool.rs b/crates/uopool/src/mempool.rs index e6b86c03..5d3b7c36 100644 --- a/crates/uopool/src/mempool.rs +++ b/crates/uopool/src/mempool.rs @@ -1,9 +1,9 @@ -use aa_bundler_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use ethers::{ abi::AbiEncode, types::{Address, H256, U256}, utils::{keccak256, to_checksum}, }; +use silius_primitives::{simulation::CodeHash, UserOperation, UserOperationHash}; use std::fmt::Debug; pub type MempoolId = H256; diff --git a/crates/uopool/src/reputation.rs b/crates/uopool/src/reputation.rs index f2ce2045..7c187028 100644 --- a/crates/uopool/src/reputation.rs +++ b/crates/uopool/src/reputation.rs @@ -1,8 +1,8 @@ -use aa_bundler_primitives::{ +use ethers::types::{Address, Bytes, U256}; +use silius_primitives::{ get_address, reputation::{ReputationEntry, ReputationError, ReputationStatus, StakeInfo}, }; -use ethers::types::{Address, Bytes, U256}; use std::{fmt::Debug, ops::Deref}; pub type ReputationBox = Box + Send + Sync>; diff --git a/crates/uopool/src/uopool.rs b/crates/uopool/src/uopool.rs index 07bf5fb2..1bce8f87 100644 --- a/crates/uopool/src/uopool.rs +++ b/crates/uopool/src/uopool.rs @@ -6,12 +6,19 @@ use crate::{ utils::calculate_call_gas_limit, MempoolId, Overhead, }; -use aa_bundler_contracts::{ +use anyhow::format_err; +use ethers::{ + prelude::LogMeta, + providers::Middleware, + types::{Address, BlockNumber, U256, U64}, +}; +use serde::{Deserialize, Serialize}; +use silius_contracts::{ entry_point::{EntryPointAPIEvents, EntryPointErr, UserOperationEventFilter}, utils::parse_from_input_data, EntryPoint, }; -use aa_bundler_primitives::{ +use silius_primitives::{ get_address, reputation::{ReputationEntry, ReputationStatus, THROTTLED_MAX_INCLUDE}, simulation::{CodeHash, SimulationError}, @@ -19,13 +26,6 @@ use aa_bundler_primitives::{ Chain, UoPoolMode, UserOperation, UserOperationByHash, UserOperationGasEstimation, UserOperationHash, UserOperationReceipt, }; -use anyhow::format_err; -use ethers::{ - prelude::LogMeta, - providers::Middleware, - types::{Address, BlockNumber, U256, U64}, -}; -use serde::{Deserialize, Serialize}; use std::{ collections::{HashMap, HashSet}, sync::Arc, diff --git a/crates/uopool/src/utils.rs b/crates/uopool/src/utils.rs index 4e1e68f0..f8c61fca 100644 --- a/crates/uopool/src/utils.rs +++ b/crates/uopool/src/utils.rs @@ -1,5 +1,5 @@ -use aa_bundler_primitives::{simulation::CodeHash, UserOperation}; use ethers::types::{u256_from_f64_saturating, Address, H256, U256}; +use silius_primitives::{simulation::CodeHash, UserOperation}; use std::{collections::HashMap, ops::Deref}; pub fn equal_code_hashes(hashes: &Vec, hashes_prev: &Vec) -> bool { @@ -89,8 +89,8 @@ pub fn calculate_call_gas_limit(paid: U256, pre_op_gas: U256, fee_per_gas: U256) pub mod tests { use super::*; use crate::mempool::Mempool; - use aa_bundler_primitives::{UserOperation, UserOperationHash}; use ethers::types::{Address, Bytes, H256, U256}; + use silius_primitives::{UserOperation, UserOperationHash}; use std::fmt::Debug; #[test] diff --git a/docs/architecture/aa-bundler-rust.drawio b/docs/architecture/silius.drawio similarity index 100% rename from docs/architecture/aa-bundler-rust.drawio rename to docs/architecture/silius.drawio diff --git a/docs/architecture/aa-bundler-rust.png b/docs/architecture/silius.png similarity index 100% rename from docs/architecture/aa-bundler-rust.png rename to docs/architecture/silius.png diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fdd92542..71fcb989 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-examples" +name = "silius-examples" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -8,14 +8,14 @@ repository = { workspace = true } rust-version = { workspace = true } readme = "README.md" description = """ -AA (ERC-4337) Bundler examples +AA (ERC-4337) bundler examples """ [dev-dependencies] -aa-bundler-primitives = { path = "../crates/primitives" } anyhow = "1" ethers = { version = "2.0.4" } +silius-primitives = { path = "../crates/primitives" } tokio = { workspace = true } [[example]] diff --git a/examples/user_operation.rs b/examples/user_operation.rs index 97981248..ade0a286 100644 --- a/examples/user_operation.rs +++ b/examples/user_operation.rs @@ -1,5 +1,5 @@ -use aa_bundler_primitives::{UserOperation, Wallet}; use ethers::types::Address; +use silius_primitives::{UserOperation, Wallet}; use std::str::FromStr; pub const MNEMONIC_PHRASE: &str = "test test test test test test test test test test test junk"; diff --git a/tests/Cargo.toml b/tests/Cargo.toml index d9ab1456..f23037c8 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aa-bundler-tests" +name = "silius-tests" version = "0.1.0" authors = { workspace = true } edition = { workspace = true } @@ -7,15 +7,15 @@ license = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } description = """ -AA (ERC-4337) Bundler integration tests +AA (ERC-4337) bundler integration tests """ [dev-dependencies] -aa-bundler-contracts = { path = "../crates/contracts" } -aa-bundler-primitives = { path = "../crates/primitives" } -aa-bundler-uopool = { path = "../crates/uopool" } anyhow = "1" ethers = { workspace = true } +silius-contracts = { path = "../crates/contracts" } +silius-primitives = { path = "../crates/primitives" } +silius-uopool = { path = "../crates/uopool" } tempdir = "0.3.7" tokio = { workspace = true } diff --git a/tests/src/simulation_tests.rs b/tests/src/simulation_tests.rs index 860837ec..532dcdaa 100644 --- a/tests/src/simulation_tests.rs +++ b/tests/src/simulation_tests.rs @@ -9,12 +9,6 @@ use crate::common::{ }, setup_geth, ClientType, DeployedContract, }; -use aa_bundler_contracts::EntryPoint; -use aa_bundler_primitives::consts::entities::{ACCOUNT, FACTORY, PAYMASTER}; -use aa_bundler_primitives::simulation::SimulationError; -use aa_bundler_primitives::{Chain, UoPoolMode, UserOperation}; -use aa_bundler_uopool::canonical::simulation::SimulationResult; -use aa_bundler_uopool::{mempool_id, MemoryMempool, MemoryReputation, Reputation, UoPool}; use ethers::abi::Token; use ethers::prelude::BaseContract; use ethers::types::transaction::eip2718::TypedTransaction; @@ -24,6 +18,12 @@ use ethers::{ providers::Middleware, types::{Bytes, U256}, }; +use silius_contracts::EntryPoint; +use silius_primitives::consts::entities::{ACCOUNT, FACTORY, PAYMASTER}; +use silius_primitives::simulation::SimulationError; +use silius_primitives::{Chain, UoPoolMode, UserOperation}; +use silius_uopool::canonical::simulation::SimulationResult; +use silius_uopool::{mempool_id, MemoryMempool, MemoryReputation, Reputation, UoPool}; use std::collections::HashMap; use std::ops::Deref; use std::sync::Arc; diff --git a/tests/src/tracer_tests.rs b/tests/src/tracer_tests.rs index 12b8baf4..aa7569f9 100644 --- a/tests/src/tracer_tests.rs +++ b/tests/src/tracer_tests.rs @@ -3,7 +3,6 @@ use crate::common::{ gen::{ExecSelfResultFilter, TracerTest}, setup_geth, ClientType, DeployedContract, }; -use aa_bundler_contracts::tracer::{JsTracerFrame, JS_TRACER}; use ethers::{ abi::{RawLog, Token}, contract::EthLogDecode, @@ -15,6 +14,7 @@ use ethers::{ }, utils::GethInstance, }; +use silius_contracts::tracer::{JsTracerFrame, JS_TRACER}; use std::{ops::Deref, str::FromStr, sync::Arc}; struct Context {