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

demo/run-validator.sh #494

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open

demo/run-validator.sh #494

wants to merge 9 commits into from

Conversation

rus-alex
Copy link
Contributor

@rus-alex rus-alex commented Aug 1, 2023

Command demo/run-validator.sh $n runs additional opera node and makes it a validator.
This may be useful for testing of go-opera releases.
Some ./cmd/opera/launcher/ refactoring is for starting fakenet validator node which is not a member of genesis validators list.

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
Copy link

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?

Copy link
Contributor Author

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.

Copy link

@xdfdm xdfdm Aug 23, 2023

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:

  • to start several fakenet nodes by start.sh
  • then do export genesis genesisfile.g
  • start a new node with --genesis genesisfile.g (and without --fakenet flag)
  • and make it a validator as in the instructions here (need to send some ftm from one of the fake validator nodes to new account for staking)
    ?

why doesn't this work?

Copy link
Contributor Author

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rus-alex

  1. run 3 fake nodes:
    cd demo
    ./start.sh
  2. stop it. and export genesis
    ./stop.sh
    ../build/demo_opera --datadir opera0.datadir export genesis genesis.g
    output:
WARN [08-22|21:03:12.624] Please add '--cache 3826' flag to allocate more cache for Opera. Total memory is 7653 MB. 
INFO [08-22|21:03:12.624] Maximum peer count                       total=50
INFO [08-22|21:03:12.625] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [08-22|21:03:12.909] Attempting genesis export not in a beginning of an epoch. Genesis file output may contain excessive data. 
INFO [08-22|21:03:12.910] Exporting epochs                         from=1 to=3
WARN [08-22|21:03:12.910] No epoch record                          epoch=1
INFO [08-22|21:03:12.912] Exported epochs 
- Epochs hash: 0xd92a6000dbc3d5848308f76dde52c0f1394f272c68aa10ee618ff8b28036af9e 
INFO [08-22|21:03:12.912] Exporting blocks                         from=1 to=2
INFO [08-22|21:03:12.916] Exported blocks 
- Blocks hash: 0x86ae345365c45d48e7dabe2df2fb28e7dd2f4382eb0dd8fc85d4d3409b915133 
INFO [08-22|21:03:12.916] Exporting EVM data 
INFO [08-22|21:03:12.941] Exported EVM data 
- EVM hash: 0xe22d5fe99ddf119ccff4d185410ba1890c45dce70c4b11ae146617f173d03e80

start nodes again
./start.sh

  1. 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 &

  2. according this
    ./opera account new
    set password
    output :

...
Public address of the key:   0xAccount

then
./opera validator new
output:

...
Public key:                  0xPublicKey
  1. send some tokens from validator to new account
    ./opera --datadir ../demo/opera0.datadir attach
> personal
get account address in 
listAccounts: ["0xOpera0AccAddr"],

> ftm.sendTransaction({from: "0xOpera0AccAddr", to: "0xAccount, value: web3.toWei("100000000", "ftm")})
  1. create validator
    ./opera attach
> personal.unlockAccount("0xAccount", "password", 3600)
true

> abi = ....
large json output

> sfcc = web3.ftm.contract(abi).at("0xfc00face00000000000000000000000000000000")
long output

>sfcc.lastValidatorID()
3

> tx = sfcc.createValidator("0xPublicKey", {from:"0xAccount", value: web3.toWei("90000000", "ftm")}) 
0xtx_hash

> ftm.getTransactionRecepit("0xtx_hash")
...
status: “0x1”
...

> sfcc.getValidatorID("0xAccount")
4
  1. restart node in validator mode
    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:

WARN [08-22|16:49:38.055] Please add '--cache 3826' flag to allocate more cache for Opera. Total memory is 7653 MB.
INFO [08-22|16:49:38.056] Maximum peer count                       total=50
INFO [08-22|16:49:38.056] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [08-22|16:49:38.056] Option nousb is deprecated and USB is deactivated by default. Use --usb to enable
WARN [08-22|16:49:38.056] Genesis file doesn't refer to any trusted preset
INFO [08-22|16:49:38.599] Genesis is already written               name=fake id=4003 genesis=0x24841db8ad0e6d5b66de059536e9bb41d5d285c2b272421cee9b1a66b5de430e
INFO [08-22|16:49:39.627] Unlocked validator key                   pubkey=0xc00480a18d19907cb8c411a475a56c3f3c6389b8bd9e4a1039488c7b04a64abfc8710f99d127fd3f162cfc4ad04f2005>
INFO [08-22|16:49:39.627] Loaded local transaction journal         transactions=0 dropped=0
INFO [08-22|16:49:39.628] Regenerated local transaction journal    transactions=0 accounts=0
INFO [08-22|16:49:39.629] Starting peer-to-peer node               instance=go-opera/v1.1.3-rc.2-71882c85-1692246427/linux-amd64/go1.21.0
INFO [08-22|16:49:39.661] New local node record                    seq=5 id=e136ac220f1e7c32 ip=127.0.0.1 udp=3100 tcp=3100
INFO [08-22|16:49:39.667] IPC endpoint opened                      url=/home/ubuntu/.opera/opera.ipc
INFO [08-22|16:49:39.667] EVM snapshot                             module=gossip-store at=22a3e3..12329d generating=false
INFO [08-22|16:49:39.667] Start/Switch to fullsync mode...         module=PM
INFO [08-22|16:49:39.671] Started P2P networking                   self=enode://146dc366fe93028e2b651583ba4b9bbe5e8126797d2295223bea889f9365a3a9e56fa25f998fbfc98666057443d4>
INFO [08-22|16:49:39.680] Emitting is paused                       reason="waiting additional time" wait=29m45.167544632s
INFO [08-22|16:49:40.689] New DAG summary                          new=1 last_id=5:52:bdc1d3 age=1h38m5.711s t="161.218µs"
INFO [08-22|16:49:46.690] Emitting is paused                       reason="waiting additional time" wait=29m38.158112963s
INFO [08-22|16:49:53.697] Emitting is paused                       reason="waiting additional time" wait=29m31.151045218s
INFO [08-22|16:49:56.317] New LLR summary                          last_epoch=5 last_block=0 new_evs=1 new_ers=0 new_bvs=0 new_brs=0 age=none
INFO [08-22|16:49:56.317] New DAG summary                          new=354 last_id=5:406:4f0b41 age=1.601ms     t=22.980ms
INFO [08-22|16:50:00.707] Emitting is paused                       reason="waiting additional time" wait=29m24.14077659s
INFO [08-22|16:50:06.044] New DAG summary                          new=3   last_id=5:409:e2a8b5 age=1.464ms     t="272.841µs"
INFO [08-22|16:50:07.715] Emitting is paused                       reason="waiting additional time" wait=29m17.133153447s
INFO [08-22|16:50:14.718] Emitting is paused                       reason="waiting additional time" wait=29m10.130237782s


....

INFO [08-22|17:19:06.248] New DAG summary                          new=3   last_id=5:943:cc864b age=1.464ms     t="230.914µs"
INFO [08-22|17:19:12.118] Emitting is paused                       reason="waiting additional time" wait=12.729872806s
INFO [08-22|17:19:16.078] New DAG summary                          new=3   last_id=5:946:66d75e age="961.106µs" t="240.793µs"
INFO [08-22|17:19:19.127] Emitting is paused                       reason="waiting additional time" wait=5.720710269s
INFO [08-22|17:19:24.853] New event emitted                        id=5:949:04d192     parents=1 by=4 frame=1 txs=0 age=4.632ms     t=1.800ms
INFO [08-22|17:19:24.853] New DAG summary                          new=3   last_id=5:949:04d192 age=4.632ms     t=1.991ms
INFO [08-22|17:19:35.733] New DAG summary                          new=4   last_id=5:953:fe13e7 age=1.375ms     t="374.277µs"
INFO [08-22|17:19:45.507] New DAG summary                          new=3   last_id=5:956:131146 age=1.477ms     t="232.664µs"
INFO [08-22|17:19:55.232] New DAG summary                          new=3   last_id=5:959:34517b age="850.859µs" t="227.502µs"
INFO [08-22|17:20:04.954] New DAG summary                          new=3   last_id=5:962:b19e07 age="876.605µs" t="251.701µs"
INFO [08-22|17:20:14.676] New DAG summary                          new=3   last_id=5:965:7534f2 age="907.079µs" t="270.476µs"
INFO [08-22|17:20:24.400] New DAG summary                          new=3   last_id=5:968:a2ebc1 age=1.231ms     t="277.723µs"
INFO [08-22|17:20:34.127] New DAG summary                          new=3   last_id=5:971:cc9005 age=1.435ms     t="305.08µs"
INFO [08-22|17:20:43.857] New DAG summary                          new=3   last_id=5:974:5b3595 age=1.427ms     t="220.279µs"
INFO [08-22|17:20:53.577] New DAG summary                          new=3   last_id=5:977:4ddda8 age=1.153ms     t="390.272µs"
...

INFO [08-22|17:38:23.965] New DAG summary                          new=3   last_id=6:167:9b6be5  age="895.374µs" t="366.482µs"
INFO [08-22|17:38:33.695] New DAG summary                          new=3   last_id=6:170:4bd8ce  age=1.374ms     t="224.364µs"
INFO [08-22|17:38:43.422] New DAG summary                          new=3   last_id=6:173:7bbb65  age=1.295ms     t="253.877µs"
INFO [08-22|17:38:53.145] New DAG summary                          new=3   last_id=6:176:baaac1  age=1.462ms     t="454.296µs"
INFO [08-22|17:39:02.866] New DAG summary                          new=3   last_id=6:179:b50d4f  age=1.490ms     t="287.703µs"
ERROR[08-22|17:39:12.093] Emitted incorrect event                  err="event creator isn't a validator"
INFO [08-22|17:39:12.596] New DAG summary                          new=3   last_id=6:182:6a6fac  age=1.961ms     t="189.836µs"
ERROR[08-22|17:39:13.099] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:14.105] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:15.107] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:16.109] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:17.114] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:18.118] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:19.122] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:20.126] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:21.133] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:22.137] Emitted incorrect event                  err="event creator isn't a validator"
INFO [08-22|17:39:22.318] New DAG summary                          new=3   last_id=6:185:6fcc4c  age=1.390ms     t="333.654µs"
ERROR[08-22|17:39:23.141] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:24.148] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:25.153] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:26.159] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:27.164] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:28.167] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:29.173] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:30.180] Emitted incorrect event                  err="event creator isn't a validator"
ERROR[08-22|17:39:31.185] Emitted incorrect event                  err="event creator isn't a validator"
INFO [08-22|17:39:32.048] New DAG summary                          new=3   last_id=6:188:c50a45  age=1.460ms     t="255.634µs"
ERROR[08-22|17:39:32.192] Emitted incorrect event                  err="event creator isn't a validator"
...

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants