Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2846] Added eea_getPrivacyPrecompileAddress #1650

Merged
merged 7 commits into from
Jul 29, 2019

Conversation

MadelineMurray
Copy link
Contributor

Added eea_getPrivacyPrecompileAddress

@MadelineMurray MadelineMurray changed the title Added eea_getPrivacyPrecompileAddress [PAN-2846] Added eea_getPrivacyPrecompileAddress Jul 6, 2019
{
"jsonrpc": "2.0",
"id": 1,
"result": 126
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be the full ethereum hex encoded address i.e. "0x00000.....7E"

Copy link
Contributor

@Puneetha17 Puneetha17 Jul 15, 2019

Choose a reason for hiding this comment

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

No I don't think.
We had discussed this in a call and decided to keep it int when we pass it as input, such that it's not confusing to the user. And so the output should be consistent with it and return as int.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you specify it as an integer int the command line - but when you want to use it, it is an ethereum address.

If we return the integer, the caller needs to convert the response into an ethereum address to use it. At the very least we should have instructions on how to interpret the output of this call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you say when you want to use it, it is an ethereum address, when and how would you be using it?

I think if using it is going to require converting the response and doc on the fact that conversion is needed, it probably makes more sense to have it return the address rather than the int.

We did discuss it in the call and the reasoning for keeping it as an int was it's a precompile and all the other precompiles are indentified by ints (I think).

Copy link
Contributor

@iikirilov iikirilov Jul 21, 2019

Choose a reason for hiding this comment

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

So from a user story point of view I would say "I want a new precompile and it will be the precompile at position x" where x is a number.

Then once that precompile is put in position x the story becomes "I want to use my new precompile at position x so I will send a transaction to y" where y is the ethereum address representing x.

That is in the general case of precompiles.

The reason we brought in this call is so that dApps can learn where our privacy precompile is so they can filter for private transactions by checking the to address of every public transaction. If a public transaction is privacy marker transaction, the to address will be the ethereum address of the privacy precompile (i.e. the y from the user story above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK - I think we really do need to update eea_getPrivacyPrecompileAddress to return the address in hex then. I was wondering what the 7E address I was seeing in transaction objects was - I can see now it's 126 in hex.

@@ -3738,6 +3738,36 @@ None
The `EEA` API methods are not enabled by default for JSON-RPC. Use the [`--rpc-http-api`](Pantheon-CLI-Syntax.md#rpc-http-api)
or [`--rpc-ws-api`](Pantheon-CLI-Syntax.md#rpc-ws-api) options to enable the `EEA` API methods.

### eea_getPrivacyPrecompileAddress

Returns the address to which the [privacy pre-compiled contract](../Privacy/Private-Transaction-Processing.md) is mapped.
Copy link
Contributor

@bgravenorst bgravenorst Jul 23, 2019

Choose a reason for hiding this comment

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

precompiled or pre-compiled?

Also, maybe "Returns the address of the..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@bgravenorst bgravenorst left a comment

Choose a reason for hiding this comment

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

Minor suggestions

@MadelineMurray MadelineMurray merged commit 3144dff into PegaSysEng:master Jul 29, 2019
@MadelineMurray MadelineMurray deleted the privacyPrecompile branch July 29, 2019 03:14
MadelineMurray added a commit to MadelineMurray/pantheon that referenced this pull request Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants