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

Ethereum pos #95

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 7 additions & 15 deletions examples/C04-ethereum-pos/beacon-setup-node.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,13 @@ def do_GET(self):
'''

DEPLOY_CONTRACT = '''\
let count=0
ok=true
until curl -sHf http://{geth_node_ip}:8545 > /dev/null; do {{
echo "eth: geth not ready, waiting..."
sleep 3
let count++
[ $count -gt 60 ] && {{
echo "eth: geth connection failed too many times, skipping."
ok=false
break
}}
}}; done
($ok) && {{
lcli deploy-deposit-contract --eth1-http http://{geth_node_ip}:8545 --confirmations 1 --validator-count {validator_count} > contract_address.txt
}}
while true; do {{
lcli deploy-deposit-contract --eth1-http http://{geth_node_ip}:8545 --confirmations 1 --validator-count {validator_count} > contract_address.txt
CONTRACT_ADDRESS=`head -1 contract_address.txt | cut -d '"' -f 2`
if [[ $CONTRACT_ADDRESS = 0x* ]]; then
break
fi
}} done;
'''

beacon_setup_node.addBuildCommand('apt-get update && apt-get install -y --no-install-recommends software-properties-common')
Expand Down
6 changes: 5 additions & 1 deletion examples/C04-ethereum-pos/blockchain-pos.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def makeStubAs(emu: Emulator, base: Base, asn: int, exchange: int, hosts_total:
# exit(0)
#hosts_total = int(sys.argv[1])

hosts_total = int(1)
hosts_total = int(4)

###############################################################################
emu = Emulator()
Expand Down Expand Up @@ -129,6 +129,7 @@ def makeStubAs(emu: Emulator, base: Base, asn: int, exchange: int, hosts_total:

TERMINAL_TOTAL_DIFFICULTY=50
LIGHTHOUSE_BIN_PATH="/home/won/.cargo/bin/lighthouse"

i = 1
for asn in asns:
for id in range(hosts_total):
Expand Down Expand Up @@ -178,6 +179,9 @@ def makeStubAs(emu: Emulator, base: Base, asn: int, exchange: int, hosts_total:

BEACON_SETUP_NODE_COMMAND_SH = """\
#!/bin/bash

rm -rf beacon-node/
rm -rf hnode_150_beacon-setup-node/
./beacon-setup-node.py {} '{}' {}
"""
f = open("beacon-setup-node.sh", "w")
Expand Down