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

Allow validators to specify an attestationKey with which they sign attestations #1313

Merged
merged 7 commits into from
Oct 12, 2019

Conversation

nambrot
Copy link
Contributor

@nambrot nambrot commented Oct 11, 2019

Description

This PR implements #1079. Previously, validators were expected to sign attestations using their consensus key which is much more important for consensus than for attestations. Thus, they can now specify a separate attestation key. If they don't specify a key, their consensus key is used by default.

This PR also implements #1304 to use the LockedGold account address as the canonical address to reference Validators/Issuers

Tested

  • Unit tests

Related issues

@codecov
Copy link

codecov bot commented Oct 11, 2019

Codecov Report

Merging #1313 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1313   +/-   ##
=======================================
  Coverage   66.41%   66.41%           
=======================================
  Files         264      264           
  Lines        7745     7745           
  Branches      513      444   -69     
=======================================
  Hits         5144     5144           
- Misses       2500     2502    +2     
+ Partials      101       99    -2
Flag Coverage Δ
#mobile 66.41% <ø> (ø) ⬆️
Impacted Files Coverage Δ
packages/mobile/src/utils/formatting.ts 89.74% <0%> (ø) ⬆️
packages/mobile/src/identity/reducer.ts 41.66% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 659a11d...d0c7796. Read the comment docs.

@@ -116,6 +133,9 @@ contract Attestations is IAttestations, Ownable, Initializable, UsingRegistry, R
mapping(bytes32 => IdentifierState) identifiers;
mapping(address => Account) accounts;

// Mapping of attestationKey addresses to account addresses
mapping(address => address) keysToAccount;
Copy link
Contributor

Choose a reason for hiding this comment

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

accountFromAttestationKey?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed it to authorizedAttestors in line with your comment below, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

That name makes me think the mapping will be in the other direction. authorizedBy?

@asaj asaj assigned nambrot and unassigned asaj Oct 11, 2019
@@ -51,6 +60,11 @@ contract Attestations is IAttestations, Ownable, Initializable, UsingRegistry, R
uint256 value
);

event AccountAuthorizedAttestorSet(
Copy link
Contributor

Choose a reason for hiding this comment

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

consider AttestorAuthorized for consistency with https://github.com/celo-org/celo-monorepo/pull/1177/files

@@ -116,6 +133,9 @@ contract Attestations is IAttestations, Ownable, Initializable, UsingRegistry, R
mapping(bytes32 => IdentifierState) identifiers;
mapping(address => Account) accounts;

// Mapping of authorizedAttestor addresses to account addresses
mapping(address => address) authorizedAttestors;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider authorizedBy for consistency with https://github.com/celo-org/celo-monorepo/pull/1177/files

bytes32 r,
bytes32 s
)
public
Copy link
Contributor

Choose a reason for hiding this comment

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

external?

* @return The address of the authorized attestor
*/
function getAuthorizedAttestor(address account) external view returns (address) {
return accounts[account].authorizedAttestor;
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if an account hasn't authorized an attestor? Do we require that they do? If we follow the pattern from lockedGold, this would be named getAttestorFromAccount and would return the account in the event that an attestor was not authorized

Copy link
Contributor

@asaj asaj left a comment

Choose a reason for hiding this comment

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

Approved conditioned on moving this and the logic in LockedGold.sol into Accounts.sol after #1177 lands

@asaj asaj assigned nambrot and unassigned asaj Oct 11, 2019
@nambrot nambrot added the automerge Have PR merge automatically when checks pass label Oct 12, 2019
@nambrot
Copy link
Contributor Author

nambrot commented Oct 12, 2019

Approved conditioned on moving this and the logic in LockedGold.sol into Accounts.sol after #1177 lands

Created #1318

@ashishb ashishb merged commit 50cd8cf into master Oct 12, 2019
@ashishb ashishb deleted the nambrot/attestation-key branch October 12, 2019 00:45
aaronmgdr added a commit that referenced this pull request Oct 23, 2019
* master:
  Integration deploy, don't overwrite genesis block if upgrading testnet (#1315)
  Fix broken Discord link (#1317)
  [Wallet] Add check for $ENVFILE to pre-dev script (#1324)
  Add GRADLE_OPTS note to SETUP.md (#1311)
  Allow validators to specify an attestationKey with which they sign attestations (#1313)
  Add step to install typescript and other minor edits (#1256)
  [Wallet] Add script to build sdk for env before running yarn dev (#1312)
  [Wallet] Fix ListView deprecation warning (#1293)
  Set IN_MEMORY_DISCOVERY_TABLE=true for integration (#1296)
  Add ability to generate addresses directly from env file in celotool (#1294)
aaronmgdr added a commit that referenced this pull request Oct 23, 2019
* master:
  Integration deploy, don't overwrite genesis block if upgrading testnet (#1315)
  Fix broken Discord link (#1317)
  [Wallet] Add check for $ENVFILE to pre-dev script (#1324)
  Add GRADLE_OPTS note to SETUP.md (#1311)
  Allow validators to specify an attestationKey with which they sign attestations (#1313)
  Add step to install typescript and other minor edits (#1256)
  [Wallet] Add script to build sdk for env before running yarn dev (#1312)
  [Wallet] Fix ListView deprecation warning (#1293)
  Set IN_MEMORY_DISCOVERY_TABLE=true for integration (#1296)
  Add ability to generate addresses directly from env file in celotool (#1294)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
4 participants