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

Add proto definitions for Native DMC RPC client #19

Closed
wants to merge 7 commits into from

Conversation

DieHard073055
Copy link

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

Add proto definitions for the parameters involved with the RPC calls to the substrate DMC.

Which issue(s) does this PR fixes?:

Fixes #

Additional comments?:

}

message GetBlockHashParam {
option uint64 at = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's optional and it's not supported by proto3.

Copy link
Author

Choose a reason for hiding this comment

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

How would I deal with rust option values in proto?

Copy link
Contributor

Choose a reason for hiding this comment

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

Proto only supports a default value and default value for uint64 is zero, which is what will be assumed to be empty. If zero has special meaning in this context and integer size is not a problem, then we could use int64 and -1 to represent empty value.

string signature = 4;
}

message MintBlockParam {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use Input instead of Param and Result instead of Return

Copy link
Author

Choose a reason for hiding this comment

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

Ok

Comment on lines 3 to 15
message DNCTx {
string from = 1;
string to = 2;
uint64 amount = 3;
string signature = 4;
}

message DMCTx {
string from = 1;
string to = 2;
uint64 amount = 3;
string signature = 4;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Will these two messages have the same set of fields? If so, we can combine them?

Copy link
Author

Choose a reason for hiding this comment

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

Yea, they probably would. But need an identifier to distinguish between DMC side tx and Native side tx.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to distinguish them if they have the same structure? Can't we just have Transaction?

Copy link
Author

Choose a reason for hiding this comment

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

Because the address format from both sides will be different.

@wafflespeanut wafflespeanut deleted the es/rpc_client_proto_definitions branch October 17, 2022 00:01
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

2 participants