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

chore(rln-relay): make account address optional #1258

Merged
merged 4 commits into from
Oct 12, 2022
Merged

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Oct 11, 2022

Should resolve #1116 and by extension #1221

This PR removes the need to always pass in an account address. While it can be derived from the private
key, we use field temporarily. It will be removed in a subsequent PR.

Now, while restarting chat2/wakunode2 with persisted credentials, you can omit rln-relay-eth-account-address and
rln-relay-eth-private-key.

Additionally, some consistent naming has been introduced.

@rymnc rymnc added the track:rln RLN Track (Secure Messaging/Applied ZK), e.g. relay and applications label Oct 11, 2022
@rymnc rymnc self-assigned this Oct 11, 2022
@status-im-auto
Copy link
Collaborator

status-im-auto commented Oct 11, 2022

Jenkins Builds

Click to see older builds (6)
Commit #️⃣ Finished (UTC) Duration Platform Result
158b4df #1 2022-10-11 09:15:34 ~15 min macos 📄log
✔️ 158b4df #1 2022-10-11 09:17:16 ~17 min linux 📦bin
✔️ 158b4df #2 2022-10-11 09:36:47 ~17 min macos 📦bin
4a5411d #2 2022-10-11 10:32:53 ~15 min linux 📄log
✔️ 4a5411d #3 2022-10-11 10:33:39 ~16 min macos 📦bin
✔️ 4a5411d #3 2022-10-11 10:50:37 ~15 min linux 📦bin
Commit #️⃣ Finished (UTC) Duration Platform Result
8957e07 #4 2022-10-11 13:01:22 ~14 min macos 📄log
8957e07 #4 2022-10-11 13:04:16 ~17 min linux 📄log
✔️ 42d0749 #5 2022-10-11 15:07:36 ~15 min macos 📦bin
✔️ 42d0749 #5 2022-10-11 15:08:15 ~15 min linux 📦bin

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

LGTM.

ethClientAddr = conf.rlnRelayEthClientAddress
ethMemContractAddress = web3.fromHex(web3.Address, conf.rlnRelayEthContractAddress)
var ethAccountPrivKeyOpt = none(keys.PrivateKey)
if conf.rlnRelayEthAccountPrivateKey != "":
var ethAccountAddressOpt = none(Address)
if conf.rlnRelayEthAccountPrivateKey != "" and conf.rlnRelayCredPath != "":
Copy link
Contributor

@s1fr0 s1fr0 Oct 11, 2022

Choose a reason for hiding this comment

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

Why do you require rlnRelayCredPath to be non-empty to populate ethereum private and public keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need to populate those fields if the credential path is passed in. ideally we would do this check after verifying the contents of the credentials file.

Copy link
Contributor

@s1fr0 s1fr0 Oct 11, 2022

Choose a reason for hiding this comment

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

Based on what you said it should then be something like

if  conf.rlnRelayCredPath == "":
    if conf.rlnRelayEthAccountPrivateKey != "":
        load key
    else:
        raise error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 42d0749. If the credential path is non empty, and the credentials are valid we do not make use of the private key.

Copy link
Contributor

@s1fr0 s1fr0 left a comment

Choose a reason for hiding this comment

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

LGTM!

@rymnc rymnc merged commit 04154ab into master Oct 12, 2022
@rymnc rymnc deleted the rymnc-optional-address branch October 12, 2022 02:18
@@ -1052,7 +1053,7 @@ proc mountRlnRelayStatic*(node: WakuNode,

proc mountRlnRelayDynamic*(node: WakuNode,
ethClientAddr: string = "",
ethAccAddr: web3.Address,
ethAccountAddress: Option[web3.Address] = none(web3.Address),
Copy link
Contributor

Choose a reason for hiding this comment

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

When an input is optional, it is good to add the Opt suffix to its name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:rln RLN Track (Secure Messaging/Applied ZK), e.g. relay and applications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore (rln-relay): Make the Eth account address and private key optional
5 participants