Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

JSON-RPC communication between Native Chain and Meta Chain #80

Open
DieHard073055 opened this issue Sep 8, 2022 · 10 comments · May be fixed by #167
Open

JSON-RPC communication between Native Chain and Meta Chain #80

DieHard073055 opened this issue Sep 8, 2022 · 10 comments · May be fixed by #167
Assignees
Labels
area/ain issues/pr that requires changes on the DeFiCh/ain codebase. area/meta kind/feature New feature request triage/accepted Triage has been accepted

Comments

@DieHard073055
Copy link
Contributor

DieHard073055 commented Sep 8, 2022

What would you like to be added:

JSON-RPC communication between Native Chain and Meta Chain.

This includes creating *.proto definitions on the NativeChain side that auto-generate client code for DMC to call.

Why is this needed:

For the JSON RPC client generator to generate code for the RPC calls.

related

PR

DeFiCh/libain-rs#19

@DieHard073055 DieHard073055 added triage/accepted Triage has been accepted kind/feature New feature request labels Sep 8, 2022
@DieHard073055 DieHard073055 self-assigned this Sep 8, 2022
@defichain-bot defichain-bot added the needs/area Needs area label(s) label Sep 8, 2022
@defichain-bot
Copy link
Member

@DieHard073055: There are no 'area' labels on this issue. Adding an appropriate label will greatly expedite the process for us. You can add as many area as you see fit. If you are unsure what to do you can ignore this!

You can add area labels by leaving a /area comment.

Details

I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@fuxingloh
Copy link
Contributor

fuxingloh commented Sep 8, 2022

Why protobuf instead of simple JSON-RPC?

@DieHard073055
Copy link
Contributor Author

@wafflespeanut

Why protobuf instead of simple JSON-RPC?

@wafflespeanut
Copy link

Protobuf offers strict typing and aids versioning for various messages used in RPC calls, so we decided to have a protobuf spec which represents the existing JSON RPC implementation and support both gRPC and JSON RPC endpoints (JSON schema is autogenerated from protobuf types and is meant to be backward-compatible). If defid needs to invoke an RPC endpoint, then it's easier to add the protobuf spec and use the generated client code directly (which will provide the necessary types and functions to perform that call). Long-term goal is to segregate the RPC handling (both server and client) out of ain.

@wafflespeanut
Copy link

It should be noted that this doesn't change anything in metachain (the incoming RPC request will still be JSON) - it's only a matter of how we decided to go about RPC implementation in ain.

@fuxingloh
Copy link
Contributor

Protobuf offers strict typing and aids versioning for various messages used in RPC calls, so we decided to have a protobuf spec which represents the existing JSON RPC implementation and support both gRPC and JSON RPC endpoints (JSON schema is autogenerated from protobuf types and is meant to be backward-compatible). If defid needs to invoke an RPC endpoint, then it's easier to add the protobuf spec and use the generated client code directly (which will provide the necessary types and functions to perform that call). Long-term goal is to segregate the RPC handling (both server and client) out of ain.

Sounds good! Do we have an integration timeline for this?

@fuxingloh
Copy link
Contributor

It should be noted that this doesn't change anything in metachain (the incoming RPC request will still be JSON) - it's only a matter of how we decided to go about RPC implementation in ain.

For the avoidance of doubt, is this what you mean?

graph LR

nb --JSON RPC---> ma

subgraph DeFiCh/metachain
ma[RPC Server] --> mb[MetaChain Consensus]
end

subgraph DeFiCh/ain
na[NativeChain Consensus]
nb["NativeChain 'RPC Client'"]
nc["*.proto Defintions"]

na --> nb
nb --> nc
end
Loading

@fuxingloh fuxingloh changed the title Create protobuf representations of Inputs and Results for RPC calls to the DMC JSON-RPC communication between Native Chain and Meta Chain Sep 12, 2022
@fuxingloh fuxingloh added this to the MetaChain Iterative TestNet milestone Sep 14, 2022
@wafflespeanut
Copy link

Sounds good! Do we have an integration timeline for this?

As for the protobuf-based RPC client code, the work is already in place, it's just a matter of fixing library linkage on different platforms. Hopefully will be able to merge it today or tomorrow.

For the avoidance of doubt, is this what you mean?

That's accurate.

@fuxingloh
Copy link
Contributor

Sounds good! Do we have an integration timeline for this?

As for the protobuf-based RPC client code, the work is already in place, it's just a matter of fixing library linkage on different platforms. Hopefully will be able to merge it today or tomorrow.

For the avoidance of doubt, is this what you mean?

That's accurate.

Awesome thanks!

@fuxingloh
Copy link
Contributor

/assign @wafflespeanut let me assign this to you since you're working on #106
/area ain meta

@defichain-bot defichain-bot added area/ain issues/pr that requires changes on the DeFiCh/ain codebase. area/meta and removed needs/area Needs area label(s) labels Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/ain issues/pr that requires changes on the DeFiCh/ain codebase. area/meta kind/feature New feature request triage/accepted Triage has been accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants