-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AA-226 Support 2-bundler (p2p tests) (#36)
There are now 2 modes for running tests: 1. running for single bundlers - `./runall.sh bundlers/aabundler/aabundler.yml` - (runs all tests in `tests/single` inside `runbundler.yml wrapper`) - `./runall.sh` by itself runs on all `bundlers/*/*.yml` 2. running "test environment", - `./runall.sh tests/skandha-skandha.env` - (runs all tests in `tests/p2p`, with run2bundlers.yml wrapper) When running using `run2bundlers`: launcher script to start 2 bundlers. "bundler" is the boot-node, and "bundler2" is a peer node, so it is delayed until the bootnode is up.
- Loading branch information
1 parent
5fcfc7d
commit c87c24f
Showing
14 changed files
with
316 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#This is be the ENR exposed by they "boot" node, manually copied here to be fed into the peer node. | ||
#TODO: sanity-check that the boot node indeed exposes this one.. | ||
BOOT_ENR="enr:-KS4QKKtZ64yNl2JqCmOAe6owCLe6CFuPZYVR2Na5-ymtoBHc3ce3Np6RU5ObROx73t-O4MiK01Lt6T9zlbFeHstA-AFgmlkgnY0gmlwhMCoZGWPbWVtcG9vbF9zdWJuZXRziAAAAAAAAAAAiXNlY3AyNTZrMaEDXy5_rNLasQOQHoH6ONKx7dt9MX7IV9RlUqiZ7o-vG-yDdGNwghDxg3VkcIIQ8Q" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "16Uiu2HAmK4YCszGhF5eLPfPBBAbULdvWxgiFtqo6cmujLffLjWZR", | ||
"pubKey": "CAISIQNfLn+s0tqxA5Aegfo40rHt230xfshX1GVSqJnuj68b7A==", | ||
"privKey": "CAISINU2K8Ay8Vhz2MQeAvG2KQexFVktCwgrqRewm0VMdeWw" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# start a standlone bundler for testing. | ||
# bring up a the bundler with its own geth instance | ||
|
||
#TODO: we assume that the boot bundler exposes BOOT_ENR | ||
# need to EITHER receive ENR as parameter, or validate we generate exactly the same one. | ||
services: | ||
|
||
bundler: | ||
ports: [ '3000:3000' ] | ||
image: etherspot/skandha | ||
command: node --testingMode --api.port 3000 | ||
--p2p.enrHost $BUNDLER_IP | ||
--redirectRpc --executor.bundlingMode manual | ||
networks: | ||
default: | ||
p2p: | ||
ipv4_address: $BUNDLER_IP | ||
volumes: | ||
- ./bootDataDir/peer-id.json:/root/.skandha/db/peer-id.json | ||
environment: | ||
- SKANDHA_DEV_RPC=$ETH_RPC_URL | ||
- SKANDHA_DEV_ENTRYPOINTS=${ENTRYPOINT} | ||
- SKANDHA_DEV_RELAYER=test test test test test test test test test test test junk | ||
- SKANDHA_DEV_BENEFICIARY=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
|
||
bundler-verify: | ||
image: docker | ||
# volumes: | ||
# - /var/run/docker.sock:/var/run/docker.sock | ||
depends_on: | ||
bundler: | ||
condition: service_started | ||
command: echo docker exec runbundler-bundler-1 cat /root/.skandha/db/enr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# start a standlone bundler for testing. | ||
# bring up a the bundler with its own geth instance | ||
|
||
services: | ||
|
||
bundler: | ||
ports: [ "3001:3000" ] | ||
image: etherspot/skandha | ||
command: node --testingMode --api.port 3000 | ||
--redirectRpc --executor.bundlingMode manual | ||
--p2p.enrHost $BUNDLER2_IP | ||
--p2p.bootEnrs $BOOT_ENR | ||
networks: | ||
default: | ||
p2p: | ||
ipv4_address: $BUNDLER2_IP | ||
environment: | ||
- SKANDHA_DEV_RPC=$ETH_RPC_URL | ||
- SKANDHA_DEV_ENTRYPOINTS=${ENTRYPOINT} | ||
- SKANDHA_DEV_RELAYER=junk junk junk junk junk junk junk junk junk junk junk test | ||
- SKANDHA_DEV_BENEFICIARY=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#first "docker-compose" file referenced by "runbundler" | ||
#Used to make sure all paths are relative to project root, | ||
#regardless from where the "real" docker-compose is loaded. | ||
version: '3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#note: this is the global env, read by the docker-compose.yml file. | ||
# each service in the docker-compose must forward | ||
# needed environment vars to its own environment | ||
|
||
#urls are based on service names (defined in the docker-compose) | ||
ETH_RPC_URL=http://eth-node:8545 | ||
ETH_NODE_YML=runbundler/geth.yml | ||
|
||
#bootnode bundler must expose itself as this url | ||
BUNDLER_URL=http://bundler:3000/rpc | ||
|
||
#2nd bundler (peer) must expose itself as: | ||
BUNDLER2_URL=http://bundler2:3000/rpc | ||
|
||
# subnet to contain the static IPs of bundlers: | ||
P2P_SUBNET=192.168.100.0/24 | ||
|
||
#bootnode bundler must use this IP. | ||
BUNDLER_IP=192.168.100.101 | ||
#peer bundler must use this IP | ||
BUNDLER2_IP=192.168.100.102 | ||
|
||
ENTRYPOINT=0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 | ||
|
||
#extra addresses (or private keys) to fund | ||
FUND="0xc6cbc5ffad570fdad0544d1b5358a36edeb98d163b6567912ac4754e144d4edb | ||
0x43378ff8C70109Ee4Dbe85aF34428ab0615EBd23 | ||
0x49Aa4e8210822CCd50b966944D415e5b4667AE3E | ||
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | ||
|
||
#enable "bash -x" on scripts | ||
VERBOSE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash -e | ||
dir=`dirname $0` | ||
|
||
if [ -z "$2" ] ; then | ||
echo usage: "$0 {bootyml} {start|stop|..}" | ||
exit 1 | ||
fi | ||
|
||
DC="docker-compose --env-file $dir/run2bundlers.env -f $dir/run2bundlers.yml" | ||
|
||
export BUNDLER_YML=`realpath $1` | ||
export BUNDLER2_YML=`realpath $2` | ||
ENVFILE=`dirname $BUNDLER_YML`/.env | ||
if [ -r $ENVFILE ] ; then | ||
export `grep -v '#' $ENVFILE` | ||
fi | ||
#env for bundler2 ? | ||
|
||
cmd=$3 | ||
shift | ||
shift | ||
shift | ||
case "$cmd" in | ||
|
||
start) $DC run --rm wait-all ;; | ||
down) $DC down -t 1 ;; | ||
stop) $DC stop -t 1 ;; | ||
#execute misc docker-compose command | ||
*) $DC $cmd $* ;; | ||
|
||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# docker-compose to bring up a single bundler, with all needed services | ||
version: '3' | ||
|
||
services: | ||
|
||
funder: | ||
build: ./runbundler/funder | ||
environment: | ||
- FUND=$FUND 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
- ETH_RPC_URL=$ETH_RPC_URL | ||
- ENTRYPOINT=$ENTRYPOINT | ||
- VERBOSE=$VERBOSE | ||
restart: on-failure:3 | ||
depends_on: | ||
eth-node: | ||
condition: service_started | ||
|
||
deployer: | ||
image: accountabstraction/deployer:0.6 | ||
# build: ./deployer | ||
environment: | ||
- ETH_RPC_URL=$ETH_RPC_URL | ||
- ENTRYPOINT=$ENTRYPOINT | ||
- VERBOSE=$VERBOSE | ||
depends_on: | ||
funder: | ||
condition: service_completed_successfully | ||
|
||
#launch shared node. | ||
eth-node: | ||
extends: | ||
file: $ETH_NODE_YML | ||
service: eth-node | ||
|
||
bundler: | ||
extends: | ||
file: $BUNDLER_YML | ||
service: bundler | ||
depends_on: | ||
deployer: | ||
condition: service_completed_successfully | ||
|
||
bundler-verify: | ||
extends: | ||
file: $BUNDLER_YML | ||
service: bundler-verify | ||
|
||
bundler2: | ||
extends: | ||
file: $BUNDLER2_YML | ||
service: bundler | ||
depends_on: | ||
bundler-waiter: | ||
condition: service_completed_successfully | ||
|
||
bundler-waiter: | ||
image: ghcr.io/foundry-rs/foundry:latest | ||
command: | ||
- "sleep 1; cast rpc eth_chainId -r $BUNDLER_URL" | ||
depends_on: | ||
bundler: | ||
condition: service_started | ||
restart: on-failure:5 | ||
|
||
bundler-waiter2: | ||
image: ghcr.io/foundry-rs/foundry:latest | ||
command: | ||
- "sleep 1; cast rpc eth_chainId -r $BUNDLER2_URL" | ||
depends_on: | ||
bundler2: | ||
condition: service_started | ||
restart: on-failure:5 | ||
|
||
wait-all: | ||
image: ghcr.io/foundry-rs/foundry:latest | ||
command: echo started | ||
depends_on: | ||
bundler-waiter: | ||
condition: service_completed_successfully | ||
bundler-waiter2: | ||
condition: service_completed_successfully | ||
|
||
networks: | ||
#the network where BUNDLER_IP and BUNDLER2_IP reside | ||
p2p: | ||
ipam: | ||
config: | ||
- subnet: "$P2P_SUBNET" | ||
|
||
#todo: incomplete.. | ||
# runtest: | ||
# build: ./runtest | ||
# # command: $RUNTEST | ||
# environment: | ||
# - TEST=pdm run pytest --tb=short -rA -W ignore::DeprecationWarning --url $BUNDLER_URL --entry-point $ENTRYPOINT --ethereum-node $ETH_RPC_URL | ||
# - ETH_RPC_URL=$ETH_RPC_URL | ||
# - ENTRYPOINT=$ENTRYPOINT | ||
# - BUNDLER_URL=$BUNDLER_URL | ||
# depends_on: | ||
# wait-all: | ||
# condition: service_completed_successfully | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.