Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osiris/ext ethapi #73

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion devnet/fixtures.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
set -e
MNEMONIC="test test test test test test test test test test test junk"
# This needs to be configured to the enclave (public rpc ports are non-deterministic)
export IDENTITY=11ff11
export INCLUSION_PROOF_URL="https://signup-orb-ethereum.stage-crypto.worldcoin.dev/inclusionProof"
kurtosis_port=$(kurtosis port print world-chain wc-admin-world-chain-builder rpc)
Expand Down
60 changes: 30 additions & 30 deletions devnet/fixtures/fixture.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion devnet/src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def deploy_l2_contracts(
'jq \'. + {"fundDevAccounts": true, "useInterop": true}\' $DEPLOY_CONFIG_PATH > tmp.$$.json && mv tmp.$$.json $DEPLOY_CONFIG_PATH',
"forge script scripts/deploy/Deploy.s.sol:Deploy --private-key $GS_ADMIN_PRIVATE_KEY --broadcast --rpc-url $L1_RPC_URL",
"CONTRACT_ADDRESSES_PATH=$DEPLOYMENT_OUTFILE forge script scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithStateDump()' --chain-id $L2_CHAIN_ID",
'cat $STATE_DUMP_PATH | jq \'. |= . + {"0x4e59b44847b379578588920ca78fbf26c0b4956c": {"nonce": "0x0","balance": "0x0","code": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3","storage": {}},"0x047eE5313F98E26Cc8177fA38877cB36292D2364": {"nonce": "0x2","balance": "0x0","code": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063b242e53411610081578063f1c621ee1161005b578063f1c621ee146101c9578063f2fde38b1461021c578063fbde929b1461022f57600080fd5b8063b242e5341461019b578063c70aa727146101ae578063d7b0fef1146101c157600080fd5b80638da5cb5b116100b25780638da5cb5b146101305780638e5cdd5014610158578063b0d690791461018957600080fd5b80630ee04629146100d9578063354ca12014610113578063715018a614610128575b600080fd5b6004546100fe9074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b610126610121366004610afe565b610242565b005b6101266102f9565b60045460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010a565b60405160ff7f000000000000000000000000000000000000000000000000000000000000001e16815260200161010a565b6000545b60405190815260200161010a565b6101266101a9366004610b73565b61030d565b6101266101bc366004610bb1565b61048c565b61018d6104a0565b6101fb6101d7366004610bb1565b6002602052600090815260409020546fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff909116815260200161010a565b61012661022a366004610bca565b6104e5565b61012661023d366004610bb1565b610599565b61024b856105d1565b60035460408051608081018252878152602081018690528082018790526060810185905290517f2357251100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216916323572511916102c291859190600401610bee565b60006040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050505050505050565b610301610693565b61030b6000610964565b565b610315610693565b73ffffffffffffffffffffffffffffffffffffffff82166103bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f43726f7373446f6d61696e4f776e61626c65333a206e6577206f776e6572206960448201527f7320746865207a65726f2061646472657373000000000000000000000000000060648201526084015b60405180910390fd5b60006103de60045473ffffffffffffffffffffffffffffffffffffffff1690565b90506103e983610964565b6004805483151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff90911617905560405173ffffffffffffffffffffffffffffffffffffffff80851691908316907f7fdc2a4b6eb39ec3363d710d188620bd1e97b3c434161f187b4d0dc0544faa589061047f90861515815260200190565b60405180910390a3505050565b610494610693565b61049d816109db565b50565b60006001546000036104de576040517f5b8dabb700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060015490565b6104ed610693565b73ffffffffffffffffffffffffffffffffffffffff8116610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103b4565b61049d81610964565b6105a1610693565b61049d81610a16565b60006010602060ff841682118015906105c957508060ff168460ff1611155b949350505050565b60015481036105dd5750565b6000818152600260205260408120546fffffffffffffffffffffffffffffffff1690819003610638576040517fddae3b7100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546106576fffffffffffffffffffffffffffffffff831642610c2e565b111561068f576040517f3ae7359e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b60045474010000000000000000000000000000000000000000900460ff161561077957336106d660045473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461030b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206f776e6572000000000000000000000000000000000000000060648201526084016103b4565b73420000000000000000000000000000000000000733811461081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206d657373656e6765720000000000000000000000000000000060648201526084016103b4565b8073ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190610c6c565b73ffffffffffffffffffffffffffffffffffffffff166108c160045473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461049d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206f776e6572000000000000000000000000000000000000000060648201526084016103b4565b6004805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008190556040518181527f147b815b6a3a8dd5d49310410e089f6b5e9f3782e944772edc938c8bb48ef1219060200160405180910390a150565b6000818152600260205260409020546fffffffffffffffffffffffffffffffff168015610a6f576040517f6650c4d100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600182905560008281526002602090815260409182902080547fffffffffffffffffffffffffffffffff0000000000000000000000000000000016426fffffffffffffffffffffffffffffffff8116918217909255835186815292830152917fe97c89cbb137505b36f55ebfc9732fd6c4c73ff43d49db239fc25f6e7a534145910160405180910390a1505050565b6000806000806000610180808789031215610b1857600080fd5b86359550602087013594506040870135935060608701359250878188011115610b4057600080fd5b506080860190509295509295909350565b73ffffffffffffffffffffffffffffffffffffffff8116811461049d57600080fd5b60008060408385031215610b8657600080fd5b8235610b9181610b51565b915060208301358015158114610ba657600080fd5b809150509250929050565b600060208284031215610bc357600080fd5b5035919050565b600060208284031215610bdc57600080fd5b8135610be781610b51565b9392505050565b610180810161010080858437600090830181815284915b6004811015610c24578251825260209283019290910190600101610c05565b5050509392505050565b600082821015610c67577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600060208284031215610c7e57600080fd5b8151610be781610b5156fea164736f6c634300080f000a","storage": {"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000093a80","0x0000000000000000000000000000000000000000000000000000000000000002": "0x1EA570C7FAA4C051BC7625539D1E215F2B9D699110139BCE6B10C4B6E9A012A3","0x0000000000000000000000000000000000000000000000000000000000000003": "0x000000000000000000000000a16e02e87b7454126e5e10d957a927a7f5b5d2be","0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000001f39fd6e51aad88f6f4ce6ab8827279cfffb92266"}}}\' > tmp.$$.json && mv tmp.$$.json $STATE_DUMP_PATH',
'cat $STATE_DUMP_PATH | jq \'. |= . + {"0x4e59b44847b379578588920ca78fbf26c0b4956c": {"nonce": "0x0","balance": "0x0","code": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3","storage": {}},"0x047eE5313F98E26Cc8177fA38877cB36292D2364": {"nonce": "0x2","balance": "0x0","code": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063b242e53411610081578063f1c621ee1161005b578063f1c621ee146101c9578063f2fde38b1461021c578063fbde929b1461022f57600080fd5b8063b242e5341461019b578063c70aa727146101ae578063d7b0fef1146101c157600080fd5b80638da5cb5b116100b25780638da5cb5b146101305780638e5cdd5014610158578063b0d690791461018957600080fd5b80630ee04629146100d9578063354ca12014610113578063715018a614610128575b600080fd5b6004546100fe9074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b610126610121366004610afe565b610242565b005b6101266102f9565b60045460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010a565b60405160ff7f000000000000000000000000000000000000000000000000000000000000001e16815260200161010a565b6000545b60405190815260200161010a565b6101266101a9366004610b73565b61030d565b6101266101bc366004610bb1565b61048c565b61018d6104a0565b6101fb6101d7366004610bb1565b6002602052600090815260409020546fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff909116815260200161010a565b61012661022a366004610bca565b6104e5565b61012661023d366004610bb1565b610599565b61024b856105d1565b60035460408051608081018252878152602081018690528082018790526060810185905290517f2357251100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216916323572511916102c291859190600401610bee565b60006040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050505050505050565b610301610693565b61030b6000610964565b565b610315610693565b73ffffffffffffffffffffffffffffffffffffffff82166103bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f43726f7373446f6d61696e4f776e61626c65333a206e6577206f776e6572206960448201527f7320746865207a65726f2061646472657373000000000000000000000000000060648201526084015b60405180910390fd5b60006103de60045473ffffffffffffffffffffffffffffffffffffffff1690565b90506103e983610964565b6004805483151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff90911617905560405173ffffffffffffffffffffffffffffffffffffffff80851691908316907f7fdc2a4b6eb39ec3363d710d188620bd1e97b3c434161f187b4d0dc0544faa589061047f90861515815260200190565b60405180910390a3505050565b610494610693565b61049d816109db565b50565b60006001546000036104de576040517f5b8dabb700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060015490565b6104ed610693565b73ffffffffffffffffffffffffffffffffffffffff8116610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103b4565b61049d81610964565b6105a1610693565b61049d81610a16565b60006010602060ff841682118015906105c957508060ff168460ff1611155b949350505050565b60015481036105dd5750565b6000818152600260205260408120546fffffffffffffffffffffffffffffffff1690819003610638576040517fddae3b7100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546106576fffffffffffffffffffffffffffffffff831642610c2e565b111561068f576040517f3ae7359e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b60045474010000000000000000000000000000000000000000900460ff161561077957336106d660045473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461030b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206f776e6572000000000000000000000000000000000000000060648201526084016103b4565b73420000000000000000000000000000000000000733811461081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206d657373656e6765720000000000000000000000000000000060648201526084016103b4565b8073ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190610c6c565b73ffffffffffffffffffffffffffffffffffffffff166108c160045473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461049d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f43726f7373446f6d61696e4f776e61626c65333a2063616c6c6572206973206e60448201527f6f7420746865206f776e6572000000000000000000000000000000000000000060648201526084016103b4565b6004805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008190556040518181527f147b815b6a3a8dd5d49310410e089f6b5e9f3782e944772edc938c8bb48ef1219060200160405180910390a150565b6000818152600260205260409020546fffffffffffffffffffffffffffffffff168015610a6f576040517f6650c4d100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600182905560008281526002602090815260409182902080547fffffffffffffffffffffffffffffffff0000000000000000000000000000000016426fffffffffffffffffffffffffffffffff8116918217909255835186815292830152917fe97c89cbb137505b36f55ebfc9732fd6c4c73ff43d49db239fc25f6e7a534145910160405180910390a1505050565b6000806000806000610180808789031215610b1857600080fd5b86359550602087013594506040870135935060608701359250878188011115610b4057600080fd5b506080860190509295509295909350565b73ffffffffffffffffffffffffffffffffffffffff8116811461049d57600080fd5b60008060408385031215610b8657600080fd5b8235610b9181610b51565b915060208301358015158114610ba657600080fd5b809150509250929050565b600060208284031215610bc357600080fd5b5035919050565b600060208284031215610bdc57600080fd5b8135610be781610b51565b9392505050565b610180810161010080858437600090830181815284915b6004811015610c24578251825260209283019290910190600101610c05565b5050509392505050565b600082821015610c67577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600060208284031215610c7e57600080fd5b8151610be781610b5156fea164736f6c634300080f000a","storage": {"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000093a80","0x0000000000000000000000000000000000000000000000000000000000000002": "0x0AC9D5995841E9D09387685C7155E6F08B2A92D984A8A2F282C48D6CC08DB3CE","0x0000000000000000000000000000000000000000000000000000000000000003": "0x000000000000000000000000a16e02e87b7454126e5e10d957a927a7f5b5d2be","0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000001f39fd6e51aad88f6f4ce6ab8827279cfffb92266"}}}\' > tmp.$$.json && mv tmp.$$.json $STATE_DUMP_PATH',
"cd /workspace/optimism/op-node/bin",
"./op-node genesis l2 \
--l1-rpc $L1_RPC_URL \
Expand Down
1 change: 1 addition & 0 deletions world-chain-builder/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion world-chain-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ alloy-rlp = "0.3.4"
alloy-eips = { version = "0.5.4", default-features = false }
alloy-genesis = { version = "0.5.4", default-features = false }

# revm
# revm
revm = { version = "17.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.10.0"
Expand All @@ -74,6 +73,7 @@ revm-precompile = "11"


# 3rd party
jsonrpsee = { version = "0.24", features = ["server", "macros"] }
tokio = { version = "1", features = ["full"] }
futures = "0.3"
chrono = "0.4"
Expand Down
10 changes: 9 additions & 1 deletion world-chain-builder/bin/world-chain-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use reth_optimism_cli::chainspec::OpChainSpecParser;
use reth_optimism_cli::Cli;
use world_chain_builder::node::args::ExtArgs;
use world_chain_builder::node::builder::WorldChainBuilder;
use world_chain_builder::rpc::bundle::EthTransactionsExtServer;
use world_chain_builder::rpc::bundle::WorldChainEthApiExt;

#[cfg(all(feature = "jemalloc", unix))]
#[global_allocator]
Expand All @@ -23,7 +25,6 @@ fn main() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "info,reth=info");
}

if let Err(err) =
Cli::<OpChainSpecParser, ExtArgs>::parse().run(|builder, builder_args| async move {
let data_dir = builder.config().datadir();
Expand All @@ -32,6 +33,13 @@ fn main() {
builder_args.clone(),
data_dir.data_dir(),
)?)
.extend_rpc_modules(move |ctx| {
let provider = ctx.provider().clone();
let pool = ctx.pool().clone();
let eth_api_ext = WorldChainEthApiExt::new(pool, provider);
ctx.modules.merge_configured(eth_api_ext.into_rpc())?;
Ok(())
})
.launch()
.await?;

Expand Down
25 changes: 21 additions & 4 deletions world-chain-builder/crates/assertor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use std::{
time::{Duration, Instant},
};

use alloy_primitives::Bytes;
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_types_eth::BlockNumberOrTag;
use alloy_primitives::{hex, Bytes};
use alloy_provider::{PendingTransactionBuilder, Provider, ProviderBuilder};
use alloy_rpc_types_eth::{erc4337::ConditionalOptions, BlockNumberOrTag};
use alloy_transport::Transport;
use clap::Parser;
use eyre::eyre::{eyre, Result};
Expand Down Expand Up @@ -128,11 +128,28 @@ where
{
let fixture = serde_json::from_str::<PbhFixture>(PBH_FIXTURE)?;
let mut queue = vec![];
for transaction in fixture.fixture.iter() {

// Send half with `eth_sendRawTransaction` and the other half with `eth_sendRawTransactionConditional`
for transaction in fixture.fixture.iter().take(fixture.fixture.len() / 2) {
let tx = builder_provider.send_raw_transaction(transaction).await?;
queue.push(tx);
}

for transaction in fixture.fixture.iter().skip(fixture.fixture.len() / 2) {
let rlp_hex = hex::encode_prefixed(transaction);
let tx_hash = builder_provider
.client()
.request(
"eth_sendRawTransactionConditional",
(rlp_hex, ConditionalOptions::default(),),
)
.await?;
queue.push(PendingTransactionBuilder::new(
builder_provider.root(),
tx_hash,
));
}

let futs = queue.into_iter().map(|builder| async {
let hash = builder.tx_hash().clone();
let receipt = builder.get_receipt().await;
0xOsiris marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading
Loading