verify delayed_node plugin #395

Closed
opened 2022-06-23 04:42:57 +00:00 by bobinson · 13 comments
bobinson commented 2022-06-23 04:42:57 +00:00 (Migrated from gitlab.com)

The delayed_node is plugin is an important utility to get confirmed blocks. We need ensure its functionality.

Plugin code https://gitlab.com/PBSA/peerplays/-/tree/master/libraries/plugins

Documentation https://github.com/bitshares/bitshares-core/wiki/Delayed-Node

(Note that our feature set could be different from the documentation)

The delayed_node is plugin is an important utility to get confirmed blocks. We need ensure its functionality. Plugin code https://gitlab.com/PBSA/peerplays/-/tree/master/libraries/plugins Documentation https://github.com/bitshares/bitshares-core/wiki/Delayed-Node (Note that our feature set could be different from the documentation)
bobinson commented 2022-08-15 07:06:53 +00:00 (Migrated from gitlab.com)

assigned to @taverjanov

assigned to @taverjanov
bobinson commented 2022-08-15 07:09:22 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
bobinson commented 2022-08-15 07:11:10 +00:00 (Migrated from gitlab.com)

mentioned in issue PBSA/documentation/Technical-Documents#144

mentioned in issue PBSA/documentation/Technical-Documents#144
bobinson commented 2022-08-15 07:11:34 +00:00 (Migrated from gitlab.com)

marked this issue as related to PBSA/documentation/Technical-Documents#144

marked this issue as related to PBSA/documentation/Technical-Documents#144
timur.5 commented 2022-09-08 21:57:22 +00:00 (Migrated from gitlab.com)

Testcase:

  1. Have QA environment running.

  2. Go to an empty directory, say 'mydir'.

  3. Copy 'witness_node', 'cli_wallet' executables and 'genesis.json' from container to 'mydir':

docker cp -L peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/witness_node ./
docker cp -L peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/cli_wallet   ./
docker cp    peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/genesis.json ./
  1. Run your copy of witness_node to have witness_node_data_dir and default configuration created:
./witness_node

Wait a few seconds until red complaints, then Ctrl-C.

  1. Edit mydir/witness_node_data_dir/config.ini,
    uncomment
    '# genesis-json ='
    and set it to point to your genesis file:
genesis-json = mydir/genesis.json
  1. Delete blockchain data in mydir:
rm -rf mydir/witness_node_data_dir/blockchain
  1. Now, in mydir, start your copy of witness_node in 'delayed node' mode:
./witness_node --p2p-endpoint=0.0.0.0:0 --rpc-endpoint=127.0.0.1:8091 --plugins=delayed_node --trusted-node=127.0.0.1:8090

Non-standard p2p-endpoint address is specified to avoid port conflict with the witness_node running inside the QA env.
Non-standard rpc-endpoint is, again, to avoid port conflict, but the explicit port number is used to be able to connect cli_wallet later.
'delayed_node' plugin turns on the delayed mode.
--trusted-node is required and connects this delayed node via RPC to the normal witness_node within the QA env.

There'll be many

"Pushing block #n"

lines.

Wait until they stop to be generated rapidly
and start appearing only once in a couple of seconds.
How long you will have to wait
depends on how long QA env. was running before the test.

  1. Go to peerplays container and start cli_wallet:
docker exec -it peerplays-qa-environment_peerplays-all-in-one_1 /bin/bash
./cli_wallet
  1. Open a new terminal, go to mydir
    and start your copy of the wallet,
    explicitly connecting it to delayed node's RPC:
./cli_wallet -s ws://127.0.0.1:8091
  1. In QA's cli_wallet, make a transfer:
unlocked >>> transfer nathan account01 100 TEST "" true
unlocked >>> list_account_balances nathan
  1. Quickly switch to your copy of cli_wallet in mydir
    and check the balance:
locked >>> list_account_balances nathan

It should be greater than in QA's wallet.

Wait 1 minute and check the balance again:

locked >>> list_account_balances nathan

Now it must be the same as in QA's wallet.

Testcase: 1) Have QA environment running. 2) Go to an empty directory, say 'mydir'. 3) Copy 'witness_node', 'cli_wallet' executables and 'genesis.json' from container to 'mydir': ``` docker cp -L peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/witness_node ./ docker cp -L peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/cli_wallet ./ docker cp peerplays-qa-environment_peerplays-all-in-one_1:/home/peerplays/peerplays-network/genesis.json ./ ``` 4) Run your copy of witness_node to have witness_node_data_dir and default configuration created: ``` ./witness_node ``` Wait a few seconds until red complaints, then Ctrl-C. 5) Edit mydir/witness_node_data_dir/config.ini, uncomment '# genesis-json =' and set it to point to your genesis file: ``` genesis-json = mydir/genesis.json ``` 6) Delete blockchain data in mydir: ``` rm -rf mydir/witness_node_data_dir/blockchain ``` 7) Now, in mydir, start your copy of witness_node in 'delayed node' mode: ``` ./witness_node --p2p-endpoint=0.0.0.0:0 --rpc-endpoint=127.0.0.1:8091 --plugins=delayed_node --trusted-node=127.0.0.1:8090 ``` Non-standard p2p-endpoint address is specified to avoid port conflict with the witness_node running inside the QA env. Non-standard rpc-endpoint is, again, to avoid port conflict, but the explicit port number is used to be able to connect cli_wallet later. 'delayed_node' plugin turns on the delayed mode. --trusted-node is required and connects this delayed node via RPC to the normal witness_node within the QA env. There'll be many ``` "Pushing block #n" ``` lines. Wait until they stop to be generated rapidly and start appearing only once in a couple of seconds. How long you will have to wait depends on how long QA env. was running before the test. 8) Go to peerplays container and start cli_wallet: ``` docker exec -it peerplays-qa-environment_peerplays-all-in-one_1 /bin/bash ./cli_wallet ``` 9) Open a new terminal, go to mydir and start your copy of the wallet, explicitly connecting it to delayed node's RPC: ``` ./cli_wallet -s ws://127.0.0.1:8091 ``` 10) In QA's cli_wallet, make a transfer: ``` unlocked >>> transfer nathan account01 100 TEST "" true unlocked >>> list_account_balances nathan ``` 11) Quickly switch to your copy of cli_wallet in mydir and check the balance: ``` locked >>> list_account_balances nathan ``` It should be greater than in QA's wallet. Wait 1 minute and check the balance again: ``` locked >>> list_account_balances nathan ``` Now it must be the same as in QA's wallet.
timur.5 commented 2022-09-08 22:11:27 +00:00 (Migrated from gitlab.com)

assigned to @wsalloum

assigned to @wsalloum
timur.5 commented 2022-09-08 22:12:18 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
timur.5 commented 2022-09-08 22:22:25 +00:00 (Migrated from gitlab.com)

created branch 395-verify-delayed_node-plugin to address this issue

created branch [`395-verify-delayed_node-plugin`](/PBSA/peerplays/-/compare/master...395-verify-delayed_node-plugin) to address this issue
bobinson commented 2022-09-09 08:39:17 +00:00 (Migrated from gitlab.com)

Hi @timur.5

./witness_node --p2p-endpoint=0.0.0.0:0 --rpc-endpoint=127.0.0.1:8091 --plugins=delayed_node --trusted-node=127.0.0.1:8090

Why don't you have all the values into the config.ini file itself ? By that way you can have more plugins too. Say account history plugin.

Hi @timur.5 ``` ./witness_node --p2p-endpoint=0.0.0.0:0 --rpc-endpoint=127.0.0.1:8091 --plugins=delayed_node --trusted-node=127.0.0.1:8090 ``` Why don't you have all the values into the `config.ini` file itself ? By that way you can have more plugins too. Say account history plugin.
timur.5 commented 2022-09-09 11:56:10 +00:00 (Migrated from gitlab.com)

Other plugins can also be specified in the command line, space-separated.

--p2p-endpoint is passed for the sake of testing only,
the rest of the switches are going to be permanent for an actual delayed node.

Well, I can change the testcase, should I?

Other plugins can also be specified in the command line, space-separated. `--p2p-endpoint` is passed for the sake of testing only, the rest of the switches are going to be permanent for an actual delayed node. Well, I can change the testcase, should I?
bobinson commented 2022-09-09 13:30:47 +00:00 (Migrated from gitlab.com)

lets keep the test case as it is. I was documenting it as the documentation team will require steps.

lets keep the test case as it is. I was documenting it as the documentation team will require steps.
prandnum commented 2022-09-12 16:07:29 +00:00 (Migrated from gitlab.com)

the nodes syncs without any issue and the works as mentioned in the test steps. Closing the ticket.

the nodes syncs without any issue and the works as mentioned in the test steps. Closing the ticket.
prandnum (Migrated from gitlab.com) closed this issue 2022-09-12 16:07:29 +00:00
wsalloum commented 2022-09-13 16:01:08 +00:00 (Migrated from gitlab.com)

You may get an error Remote server gave us an unexpected chain_id when you run ./cli_wallet -s ws://127.0.0.1:8091

So for the first time you need to set the chain-id ./cli_wallet --chain-id="7c1c72eb738b3ff1870350f85daca27e2d0f5dd25af27df7475fbd92815e421e" -s ws://127.0.0.1:8091,

then you can import the key to save the wallet.json import_key nathan 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

You may get an error `Remote server gave us an unexpected chain_id` when you run `./cli_wallet -s ws://127.0.0.1:8091` So for the first time you need to set the chain-id `./cli_wallet --chain-id="7c1c72eb738b3ff1870350f85daca27e2d0f5dd25af27df7475fbd92815e421e" -s ws://127.0.0.1:8091`, then you can import the key to save the wallet.json `import_key nathan 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3`
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#395
No description provided.