-
Notifications
You must be signed in to change notification settings - Fork 287
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
demo/run-validator.sh #494
Open
rus-alex
wants to merge
9
commits into
develop
Choose a base branch
from
feature/demo-validator
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e55f9ce
correct evmcore.FakeKey(0) value
rus-alex b013f8a
fix of validatorpk.FakePassword using
rus-alex 031149a
fakenet flag allows run non-validator nodes
rus-alex e21388c
demo: $M env allows run non-validator nodes
rus-alex a063a7c
fakenet flag allows to run wrong validator nodes
rus-alex 647aac7
demo/run-validator.sh
rus-alex 59e3e71
demo: run_opera_node() func
rus-alex 0992a66
readme update
rus-alex ab47769
demo/run-validator.sh: restart is not needed
rus-alex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,44 @@ | ||
#!/usr/bin/env bash | ||
cd $(dirname $0) | ||
. ./_params.sh | ||
|
||
set -e | ||
|
||
TOTAL=$((N+M)) | ||
i=$1 | ||
DATADIR="$(data_dir $i)" | ||
if [ -d ${DATADIR} ]; then | ||
echo "${DATADIR} already exists!" | ||
exit 1 | ||
fi | ||
mkdir -p "${DATADIR}" | ||
|
||
echo -e "\nStart additional node $i:\n" | ||
run_opera_node $i & | ||
echo -e "\tnode$i ok" | ||
|
||
echo -e "\nConnect to existing nodes:\n" | ||
for ((n=0;n<$TOTAL;n+=1)) | ||
do | ||
enode=$(attach_and_exec $n 'admin.nodeInfo.enode') | ||
echo " p2p address = ${enode}" | ||
|
||
echo " connecting node-$i to node-$n:" | ||
res=$(attach_and_exec $i "admin.addPeer(${enode})") | ||
echo " result = ${res}" | ||
done | ||
sleep 5 | ||
|
||
VPKEY=$(grep "Unlocked validator key" opera$i.log | head -n 1 | sed 's/.* pubkey=\(0x.*\)$/\1/') | ||
VADDR=$(grep "Unlocked fake validator account" opera$i.log | head -n 1 | sed 's/.* address=\(0x.*\)$/\1/') | ||
|
||
echo -e "\nFund new validator acc ${VADDR}:\n" | ||
attach_and_exec 0 "ftm.sendTransaction({from: personal.listAccounts[0], to: \"${VADDR}\", value: web3.toWei(\"510000.0\", \"ftm\")})" | ||
sleep 5 | ||
|
||
echo -e "\nCall SFC to create validator ${VPKEY}:\n" | ||
../build/demo_opera attach "${DATADIR}/opera.ipc" << JS | ||
abi = JSON.parse('[{"constant":false,"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"}],"name":"createValidator","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]'); | ||
sfcc = web3.ftm.contract(abi).at("0xfc00face00000000000000000000000000000000"); | ||
sfcc.createValidator("${VPKEY}", {from:"${VADDR}", value: web3.toWei("500000.0", "ftm")}); | ||
JS | ||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that restarting the node in validator mode is still required here, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it works ok without restart. New validator node starts to emit right from the next epoch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rus-alex @hadv @uprendis
is it possible:
export genesis genesisfile.g
--genesis genesisfile.g
(and without--fakenet
flag)?
why doesn't this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xdfdm , it works for me. Share full commands with outputs you did to find a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rus-alex
cd demo
./start.sh
./stop.sh
../build/demo_opera --datadir opera0.datadir export genesis genesis.g
output:
start nodes again
./start.sh
run opera node from genesis with opera0 bootnode
cd ../build
nohup ./opera --port 3100 --nat any --genesis.allowExperimental --genesis ../demo/genesis.g --http --http.addr=127.0.0.1 --http.port=4100 --http.corsdomain=* --http.vhosts=* --http.api=eth,debug,net,admin,web3,personal,txpool,ftm,dag,sfc --bootnodes enode://096519e2fdf150789a39074250b5f0b8250719044bf6a79ff2027e29688271d8a1ddd23266bb44ee8b2d3df85ff59d0b8cddd774fc09e027de2bd34a8efbcd1b@127.0.0.1:3000 --allow-insecure-unlock > opera_node.log &
according this
./opera account new
set password
output :
then
./opera validator new
output:
./opera --datadir ../demo/opera0.datadir attach
./opera attach
ps aux | grep opera
get PID of our new node
kill opera_pid
set password to file
echo password > pass.txt
start opera in validator mode
nohup ./opera --port 3100 --nat any --genesis.allowExperimental --genesis ../demo/genesis.g --http --http.addr=127.0.0.1 --http.port=4100 --http.corsdomain=* --http.vhosts=* --http.api=eth,debug,net,admin,web3,personal,txpool,ftm,dag,sfc --allow-insecure-unlock --validator.id 4 --validator.pubkey 0xPublicKey --validator.password ./pass.txt > validator.log &
output:
if check epoch and block
./opera --datadir ../demo/opera0.datadir --exec admin.nodeInfo.protocols attach
you can see that the blocks are no longer added. Everything is stucked.