Skip to content

Commit

Permalink
Merge pull request #95 from wonkr/ethereum-pos
Browse files Browse the repository at this point in the history
Ethereum pos
  • Loading branch information
wonkr authored Oct 5, 2022
2 parents bf8ea88 + 2a1b66f commit 6b1d6de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
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

0 comments on commit 6b1d6de

Please sign in to comment.