Skip to content

feat(rs-drive-abci)!: direct communication between Tenderdash and rs-drive-abci#842

Merged
lklimek merged 20 commits into
phoenixfrom
feat-abci-server
Mar 24, 2023
Merged

feat(rs-drive-abci)!: direct communication between Tenderdash and rs-drive-abci#842
lklimek merged 20 commits into
phoenixfrom
feat-abci-server

Conversation

@lklimek

@lklimek lklimek commented Mar 22, 2023

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Communication between Tenderdash and Drive is passed through deprecated js-drive, using javascript bindings in rs-drive-nodejs. The control flow between these modules look as follows: tenderdash -> js-drive -> rs-drive-nodejs -> rs-drive-abci.

This adds unnecessary complexity, and introduces additional maintenance effort.
In order to simplify this, we plan to deprecate js-drive and rs-drive-nodejs and replace it with an ABCI server, built into rs-drive-abci.

What was done?

  1. Implemented crate with rust bindings for Tenderdash: https://github.com/dashpay/rs-tenderdash-abci
  2. Implemented main() function in rs-drive-abci that starts the ABCI server and accepts connections from Tenderdash
  3. Implemented configuration mechanism, using .env files and environment variables
  4. Implemented Dockerfile, to build docker images
  5. Implemented proof-of-concept support of Info, InitChain and PrepareProposal ABCI methods

Note: abci/handlers.ts and abci/messages.rs are deprecated, but not removed yet. Main logic is in abci/server.rs and abci/proposal.rs.

How Has This Been Tested?

  1. Double-check that IP of your Docker interface is 172.17.0.1. If not, adjust examples below accordingly.
  2. Build rs-drive-abci docker container and start both rs-drive-abci and tenderdash:
cd platform
docker buildx build --tag drive-abci:local --load -f "./packages/rs-drive-abci/Dockerfile" .
docker run --rm -d -t --name drive-abci -p 172.17.0.1:26658:26658 drive-abci:local -vvv start
docker run --name tenderdash -e PROXY_APP=172.17.0.1:26658 dashpay/tenderdash:0.12.0-dev.1 
  1. Inspect Tenderdash logs with docker logs tenderdash 2>&1 | less; note that:
  • info was executed correctly, and software version was received by Tenderdash: INFO ABCI Handshake App Info hash= height=0 module=handshaker protocol-version=1 software-version=0.1.0
  • connection was terminated by rs-drive-abci: INFO Stopping abci.socketClient reason="read message: EOF
  1. Inspect rs-drive-abci logs with docker logs drive-abci 2>&1 | less; note that:
  • info was executed correctly: INFO drive_abci::abci::server: info received method="info" method="info" request=RequestInfo { version: "0.12.0-dev.1", block_version: 12, p2p_version: 8, abci_version: "0.20.0" } response=ResponseInfo { data: "", version: "0.1.0", app_version: 1, last_block_height: 0, last_block_app_hash: [] }
  • init chain was executed correctly: INFO drive_abci::abci::server: init chain executed method="init_chain"
  • prepare proposal failed: ERROR drive_abci: panic panic=panicked at 'failed to prepare proposal: Execution(CorruptedCodeExecution("could not get block by height"))', packages/rs-drive-abci/src/abci/server.rs:134:14
  1. Clean up:
docker rm -f tenderdash drive-abci

Note: you need to delete drive-abci and recreate it in order to retry the test. Otherwise init chain will fail.

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek requested a review from QuantumExplorer March 22, 2023 10:20
@lklimek lklimek marked this pull request as ready for review March 23, 2023 13:09
@lklimek lklimek removed request for antouhou and shumkov March 23, 2023 13:09
Comment thread packages/rs-drive-abci/src/abci/config.rs Outdated
Comment thread packages/rs-drive-abci/src/abci/error.rs Outdated
Comment thread packages/rs-drive-abci/src/abci/proposal.rs Outdated
Comment thread packages/rs-drive-abci/src/abci/proposal.rs Outdated
Comment thread packages/rs-drive-abci/src/abci/proposal.rs Outdated
Comment thread packages/rs-drive-abci/src/abci/server.rs Outdated
Comment thread packages/rs-drive-abci/src/config.rs Outdated
Comment thread packages/rs-drive-abci/src/main.rs Outdated
Comment thread packages/rs-drive-abci/src/main.rs Outdated
Comment thread packages/rs-drive-nodejs/src/lib.rs Outdated
@lklimek lklimek merged commit 86d5192 into phoenix Mar 24, 2023
@lklimek lklimek deleted the feat-abci-server branch March 24, 2023 12:41
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.

3 participants