-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from worldcoin/osiris/tests
test: devnet block building
- Loading branch information
Showing
7 changed files
with
286 additions
and
120 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 |
---|---|---|
@@ -1,33 +1,48 @@ | ||
#!/bin/bash | ||
set -e | ||
MNEMONIC="test test test test test test test test test test test junk" | ||
BUILDER_SOCKET="http://localhost:54542" | ||
# This needs to be configured to the enclave (public rpc ports are non-deterministic) | ||
BUILDER_SOCKET="http://localhost:58495" | ||
export IDENTITY=11ff11 | ||
export INCLUSION_PROOF_URL="https://signup-orb-ethereum.stage-crypto.worldcoin.dev/inclusionProof" | ||
|
||
SIGNERS=() | ||
make_txs() { | ||
local fixture_file=$1 | ||
declare -a local_fixture=() | ||
for t in {0..29}; do | ||
tx=$(cast mktx --private-key "$2" 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF --value $3 --rpc-url "$BUILDER_SOCKET" --nonce "$t") | ||
transaction=$(toolkit prove -t "$tx" -N "$t") | ||
local_fixture[$t]="$transaction" | ||
done | ||
|
||
i=({0..5}) | ||
for x in "${i[@]}"; do | ||
SIGNERS+=($(echo $(cast wallet private-key --mnemonic "${MNEMONIC}" --mnemonic-index $x))) | ||
done | ||
# Write local_fixture to a temporary file | ||
printf '%s\n' "${local_fixture[@]}" > "$fixture_file" | ||
echo "Finished Process: $3" | ||
} | ||
|
||
TRANSACTIONS=() | ||
for s in "${SIGNERS[@]}"; do | ||
TRANSACTIONS+=($(echo $(cast mktx --private-key $s 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF --value 1ether --rpc-url $BUILDER_SOCKET))) | ||
# Configure for more signer's | ||
for x in {0..0}; do | ||
echo "Started Process: $x" | ||
signer=($(echo $(cast wallet private-key --mnemonic "${MNEMONIC}" --mnemonic-index $x))) | ||
tmp_file="/tmp/fixture_$x.tmp" | ||
make_txs "$tmp_file" "$signer" "$x" & | ||
done | ||
|
||
FIXTURE=() | ||
wait | ||
|
||
cd "${PWD}/../world-chain-builder" | ||
pbh_nonces=({0..15}) | ||
for t in "${TRANSACTIONS[@]}"; do | ||
for i in "${pbh_nonces[@]}"; do | ||
FIXTURE+=($(echo $("${PWD}/../world-chain-builder/x" prove -t $t -N $i))) | ||
done | ||
# collect all temporary fixture files and combine them into the FIXTURE array | ||
FIXTURE=() | ||
for tmp_file in /tmp/fixture_*.tmp; do | ||
while read -r line; do | ||
FIXTURE+=("$line") | ||
done < "$tmp_file" | ||
done | ||
|
||
cd "${PWD}/../devnet" | ||
# Convert the FIXTURE array into a JSON-friendly format | ||
fixture_json=$(printf '%s\n' "${FIXTURE[@]}" | jq -R . | jq -s .) | ||
|
||
# Write the fixture to a JSON file | ||
echo "{\"fixture\": $fixture_json}" > "${PWD}/fixtures/fixture.json" | ||
|
||
# Write the fixture | ||
jq -nc '{fixture: $ARGS.positional}' --args ${FIXTURE[@]} >> "${PWD}/fixtures/fixture.json" | ||
# Clean up temporary files | ||
rm /tmp/fixture_*.tmp |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
[package] | ||
name = "assertor" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
tracing = "0.1" | ||
tracing-subscriber = {version = "0.3.18", features = ["env-filter"]} | ||
clap = { version = "4", features = ["derive", "env"] } | ||
alloy-primitives = "0.8" | ||
alloy-provider = "0.4" | ||
alloy-transport = "0.4" | ||
alloy-network = "0.4" | ||
alloy-rpc-types-eth = "0.4" | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
futures = "0.3" | ||
tokio = { version = "1", features = ["full"] } | ||
eyre = { version = "0.6", package = "color-eyre" } |
Oops, something went wrong.