diff --git a/contracts/lib/solady b/contracts/lib/solady new file mode 160000 index 00000000..717c0a86 --- /dev/null +++ b/contracts/lib/solady @@ -0,0 +1 @@ +Subproject commit 717c0a860a83dc9a1520d32384577aec51cecd84 diff --git a/contracts/scripts/DeployDevnet.s.sol b/contracts/scripts/DeployDevnet.s.sol index 9ffe9e6e..46164273 100644 --- a/contracts/scripts/DeployDevnet.s.sol +++ b/contracts/scripts/DeployDevnet.s.sol @@ -259,7 +259,7 @@ contract DeployDevnet is Script { } function beginBroadcast() internal { - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + uint256 deployerPrivateKey = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80; vm.startBroadcast(deployerPrivateKey); } } diff --git a/devnet/src/el/world-chain/world_chain_launcher.star b/devnet/src/el/world-chain/world_chain_launcher.star index 09653bc4..3f57258f 100644 --- a/devnet/src/el/world-chain/world_chain_launcher.star +++ b/devnet/src/el/world-chain/world_chain_launcher.star @@ -167,6 +167,8 @@ def get_config( "--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM), "--discovery.port={0}".format(discovery_port), "--port={0}".format(discovery_port), + "--builder.pbh_validator=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F", # Deterministic Deployment Address on re-runs + "--builder.signature_aggregator=0x09635F643e140090A9A8Dcd712eD6285858ceBef" # Deterministic Deployment Address on re-runs ] if len(existing_el_clients) > 0: diff --git a/world-chain-builder/Dockerfile b/world-chain-builder/Dockerfile index 35e3f878..6b3936ed 100644 --- a/world-chain-builder/Dockerfile +++ b/world-chain-builder/Dockerfile @@ -9,6 +9,6 @@ RUN apt-get update && apt-get install -y libclang-dev gcc RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/world-chain-builder/target \ - cargo install --path . --locked + cargo install --path crates/world/bin --locked ENTRYPOINT [ "world-chain-builder" ] diff --git a/world-chain-builder/crates/tests/src/cases.rs b/world-chain-builder/crates/tests/src/cases.rs index 3e3b8916..9f287c8f 100644 --- a/world-chain-builder/crates/tests/src/cases.rs +++ b/world-chain-builder/crates/tests/src/cases.rs @@ -79,7 +79,7 @@ where "world-chain", "wc-admin-world-chain-builder", ], - ".", + env!("CARGO_MANIFEST_DIR"), ) .await?; sleep(Duration::from_secs(5)).await; diff --git a/world-chain-builder/crates/tests/src/fixtures.rs b/world-chain-builder/crates/tests/src/fixtures.rs index 2e581e3a..1cd04167 100644 --- a/world-chain-builder/crates/tests/src/fixtures.rs +++ b/world-chain-builder/crates/tests/src/fixtures.rs @@ -25,4 +25,4 @@ pub async fn generate_test_fixture() -> Result<()> { serde_json::to_writer(File::create(FIXTURES_DIR)?, &test_fixture)?; Ok(()) -} \ No newline at end of file +} diff --git a/world-chain-builder/crates/tests/src/main.rs b/world-chain-builder/crates/tests/src/main.rs index 54784d8f..7dac9786 100644 --- a/world-chain-builder/crates/tests/src/main.rs +++ b/world-chain-builder/crates/tests/src/main.rs @@ -5,6 +5,7 @@ //! NOTE: This binary assumes that the Kurtosis Devnet is not running, and the `world-chain` enclave has been cleaned. use std::{ + env, path::Path, sync::Arc, time::{self, Duration, Instant}, @@ -34,9 +35,6 @@ async fn main() -> Result<()> { .init(); let (builder_rpc, sequencer_rpc) = start_devnet().await?; - deploy_contracts(builder_rpc.clone()).await?; - - generate_test_fixture().await?; let sequencer_provider = Arc::new(ProviderBuilder::default().on_http(sequencer_rpc.parse().unwrap())); @@ -45,6 +43,8 @@ async fn main() -> Result<()> { let timeout = std::time::Duration::from_secs(30); + info!("Waiting for the devnet to be ready"); + let f = async { let wait_0 = wait(sequencer_provider.clone(), timeout); let wait_1 = wait(builder_provider.clone(), timeout); @@ -52,8 +52,13 @@ async fn main() -> Result<()> { }; f.await; - info!("Devnet is ready"); + info!("Deploying contracts"); + deploy_contracts(builder_rpc.clone()).await?; + + info!("Generating test fixtures"); + generate_test_fixture().await?; + info!("Running test cases"); cases::assert_build(builder_provider.clone()).await?; cases::assert_fallback(sequencer_provider.clone()).await?; @@ -61,18 +66,13 @@ async fn main() -> Result<()> { } async fn start_devnet() -> Result<(String, String)> { - run_command( - &"kurtosis run", - &[ - ".", - "--args-file", - "network_params.yaml", - "--enclave", - "world-chain", - ], - "../../../../devnet/", - ) - .await?; + let path = Path::new(env!("CARGO_MANIFEST_DIR")) + .ancestors() + .nth(3) + .unwrap() + .canonicalize()?; + + run_command(&"just", &["devnet-up"], path).await?; print!("Devnet is running"); let builder_socket = run_command( "kurtosis", @@ -83,7 +83,7 @@ async fn start_devnet() -> Result<(String, String)> { "wc-admin-world-chain-builder", "rpc", ], - "../../../../devnet/", + env!("CARGO_MANIFEST_DIR"), ) .await?; @@ -95,7 +95,7 @@ async fn start_devnet() -> Result<(String, String)> { let sequencer_socket = run_command( "kurtosis", &["port", "print", "world-chain", "wc-admin-op-geth", "rpc"], - "../../../../devnet/", + env!("CARGO_MANIFEST_DIR"), ) .await?; @@ -117,6 +117,15 @@ async fn deploy_contracts(builder_rpc: String) -> Result<()> { if std::env::var("PRIVATE_KEY").is_err() { std::env::set_var("PRIVATE_KEY", DEPLOYER_DEV); } + let path = Path::new(env!("CARGO_MANIFEST_DIR")) + .ancestors() + .nth(3) + .unwrap() + .join("contracts/") + .canonicalize()?; + + info!("Deploying PBH 4337 contracts at {:?}", builder_rpc); + run_command( "forge", &[ @@ -126,7 +135,7 @@ async fn deploy_contracts(builder_rpc: String) -> Result<()> { &builder_rpc, "--broadcast", ], - "../../../../devnet/", + path, ) .await?; Ok(()) @@ -154,7 +163,7 @@ where } pub async fn run_command(cmd: &str, args: &[&str], ctx: impl AsRef) -> Result { - let output = Command::new(cmd).args(args).current_dir(ctx).output()?; + let output = Command::new(cmd).current_dir(ctx).args(args).output()?; if output.status.success() { Ok(String::from_utf8(output.stdout)?) } else { diff --git a/world-chain-builder/crates/world/pool/src/test_utils.rs b/world-chain-builder/crates/world/pool/src/test_utils.rs index e49146a8..5a510323 100644 --- a/world-chain-builder/crates/world/pool/src/test_utils.rs +++ b/world-chain-builder/crates/world/pool/src/test_utils.rs @@ -183,9 +183,9 @@ pub fn pbh_bundle( } pub const PBH_TEST_SIGNATURE_AGGREGATOR: Address = - address!("dEAD000000000000000042069420694206942069"); + address!("09635F643e140090A9A8Dcd712eD6285858ceBef"); -pub const PBH_TEST_VALIDATOR: Address = address!("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); +pub const PBH_TEST_VALIDATOR: Address = address!("7a2088a1bFc9d81c55368AE168C2C02570cB814F"); pub fn world_chain_validator( ) -> WorldChainTransactionValidator {