Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arthurgousset/cad6535d5ba69f749804b89e832c8034 to your computer and use it in GitHub Desktop.
Save arthurgousset/cad6535d5ba69f749804b89e832c8034 to your computer and use it in GitHub Desktop.

TLDR:

  • ⚠️ There is no wrapper in ReleaseGold.sol for the removeAttestationSigner() in Accounts.sol.
  • ASv1 operators using ReleaseGold (mostly cLabs employees) can authorise but not (!) deauthorise their attestation signers

Accounts.sol contract

   /**
   * @notice Authorizes an address to sign attestations on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @param v The recovery id of the incoming ECDSA signature.
   * @param r Output value r of the ECDSA signature.
   * @param s Output value s of the ECDSA signature.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeAttestationSigner(address signer, uint8 v, bytes32 r, bytes32 s) public {
    legacyAuthorizeSignerWithSignature(signer, AttestationSigner, v, r, s);
    setIndexedSigner(signer, AttestationSigner);

    emit AttestationSignerAuthorized(msg.sender, signer);
  }

Source: Accounts.sol

   /**
   * @notice Removes the currently authorized attestation signer for the account
   * Note that the signers cannot be reauthorized after they have been removed.
   */
  function removeAttestationSigner() public {
    address signer = getLegacySigner(msg.sender, AttestationSigner);
    removeSigner(signer, AttestationSigner);
    emit AttestationSignerRemoved(msg.sender, signer);
  }

Source: Accounts.sol

ReleaseGold.sol contract

Wraps the Accounts.sol contracts so it can be called in ReleaseGold.sol. Uses

/**
   * @notice A wrapper function for the authorize attestation signer account method.
   * @param signer The address of the signing key to authorize.
   * @param v The recovery id of the incoming ECDSA signature.
   * @param r Output value r of the ECDSA signature.
   * @param s Output value s of the ECDSA signature.
   * @dev The v,r and s signature should be signed by the authorized signer
   *      key, with the ReleaseGold contract address as the message.
   */
  function authorizeAttestationSigner(address payable signer, uint8 v, bytes32 r, bytes32 s)
    external
    nonReentrant
    onlyCanValidate
    onlyWhenInProperState
  {
    getAccounts().authorizeAttestationSigner(signer, v, r, s);
  }

Source: ReleaseGold.sol

For context: the function above uses the getAccounts() methods inherited from UsingRegistry.sol to fetch the address of the latest version of the Accounts.sol contract.

  function getAccounts() internal view returns (IAccounts) {
    return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment