Commit bff776db authored by Mark Tyneway's avatar Mark Tyneway

Revert "lint: fix"

This reverts commit ecdb5b78ce943071c357a93da53e2d5739fb8f42.
parent 36e32e38
...@@ -6,4 +6,6 @@ lib ...@@ -6,4 +6,6 @@ lib
artifacts artifacts
forge-artifacts forge-artifacts
cache cache
typechain
coverage*
deployments deployments
...@@ -88,7 +88,8 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -88,7 +88,8 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/** /**
* @dev Creates a new EAS instance. * @dev Creates a new EAS instance.
*/ */
constructor() Semver(1, 0, 0) EIP712Verifier("EAS", "1.0.0") {} constructor() Semver(1, 0, 0) EIP712Verifier("EAS", "1.0.0") {
}
/** /**
* @inheritdoc IEAS * @inheritdoc IEAS
...@@ -110,30 +111,21 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -110,30 +111,21 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/** /**
* @inheritdoc IEAS * @inheritdoc IEAS
*/ */
function attestByDelegation(DelegatedAttestationRequest calldata delegatedRequest) function attestByDelegation(
external DelegatedAttestationRequest calldata delegatedRequest
payable ) external payable returns (bytes32) {
returns (bytes32)
{
_verifyAttest(delegatedRequest); _verifyAttest(delegatedRequest);
AttestationRequestData[] memory data = new AttestationRequestData[](1); AttestationRequestData[] memory data = new AttestationRequestData[](1);
data[0] = delegatedRequest.data; data[0] = delegatedRequest.data;
return return _attest(delegatedRequest.schema, data, delegatedRequest.attester, msg.value, true).uids[0];
_attest(delegatedRequest.schema, data, delegatedRequest.attester, msg.value, true).uids[
0
];
} }
/** /**
* @inheritdoc IEAS * @inheritdoc IEAS
*/ */
function multiAttest(MultiAttestationRequest[] calldata multiRequests) function multiAttest(MultiAttestationRequest[] calldata multiRequests) external payable returns (bytes32[] memory) {
external
payable
returns (bytes32[] memory)
{
// Since a multi-attest call is going to make multiple attestations for multiple schemas, we'd need to collect // Since a multi-attest call is going to make multiple attestations for multiple schemas, we'd need to collect
// all the returned UIDs into a single list. // all the returned UIDs into a single list.
bytes32[][] memory totalUids = new bytes32[][](multiRequests.length); bytes32[][] memory totalUids = new bytes32[][](multiRequests.length);
...@@ -143,7 +135,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -143,7 +135,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
// from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless // from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless
// some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be // some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be
// possible to send too much ETH anyway. // possible to send too much ETH anyway.
uint256 availableValue = msg.value; uint availableValue = msg.value;
for (uint256 i = 0; i < multiRequests.length; i = uncheckedInc(i)) { for (uint256 i = 0; i < multiRequests.length; i = uncheckedInc(i)) {
// The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there // The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there
...@@ -193,7 +185,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -193,7 +185,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
// from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless // from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless
// some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be // some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be
// possible to send too much ETH anyway. // possible to send too much ETH anyway.
uint256 availableValue = msg.value; uint availableValue = msg.value;
for (uint256 i = 0; i < multiDelegatedRequests.length; i = uncheckedInc(i)) { for (uint256 i = 0; i < multiDelegatedRequests.length; i = uncheckedInc(i)) {
// The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there // The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there
...@@ -204,8 +196,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -204,8 +196,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
last = i == multiDelegatedRequests.length - 1; last = i == multiDelegatedRequests.length - 1;
} }
MultiDelegatedAttestationRequest MultiDelegatedAttestationRequest calldata multiDelegatedRequest = multiDelegatedRequests[i];
calldata multiDelegatedRequest = multiDelegatedRequests[i];
AttestationRequestData[] calldata data = multiDelegatedRequest.data; AttestationRequestData[] calldata data = multiDelegatedRequest.data;
// Ensure that no inputs are missing. // Ensure that no inputs are missing.
...@@ -261,10 +252,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -261,10 +252,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/** /**
* @inheritdoc IEAS * @inheritdoc IEAS
*/ */
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) external payable {
external
payable
{
_verifyRevoke(delegatedRequest); _verifyRevoke(delegatedRequest);
RevocationRequestData[] memory data = new RevocationRequestData[](1); RevocationRequestData[] memory data = new RevocationRequestData[](1);
...@@ -281,7 +269,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -281,7 +269,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
// from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless // from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless
// some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be // some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be
// possible to send too much ETH anyway. // possible to send too much ETH anyway.
uint256 availableValue = msg.value; uint availableValue = msg.value;
for (uint256 i = 0; i < multiRequests.length; i = uncheckedInc(i)) { for (uint256 i = 0; i < multiRequests.length; i = uncheckedInc(i)) {
// The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there // The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there
...@@ -295,13 +283,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -295,13 +283,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
MultiRevocationRequest calldata multiRequest = multiRequests[i]; MultiRevocationRequest calldata multiRequest = multiRequests[i];
// Ensure to deduct the ETH that was forwarded to the resolver during the processing of this batch. // Ensure to deduct the ETH that was forwarded to the resolver during the processing of this batch.
availableValue -= _revoke( availableValue -= _revoke(multiRequest.schema, multiRequest.data, msg.sender, availableValue, last);
multiRequest.schema,
multiRequest.data,
msg.sender,
availableValue,
last
);
} }
} }
...@@ -315,7 +297,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -315,7 +297,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
// from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless // from it to verify that there isn't any attempt to send too much ETH to resolvers. Please note that unless
// some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be // some ETH was stuck in the contract by accident (which shouldn't happen in normal conditions), it won't be
// possible to send too much ETH anyway. // possible to send too much ETH anyway.
uint256 availableValue = msg.value; uint availableValue = msg.value;
for (uint256 i = 0; i < multiDelegatedRequests.length; i = uncheckedInc(i)) { for (uint256 i = 0; i < multiDelegatedRequests.length; i = uncheckedInc(i)) {
// The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there // The last batch is handled slightly differently: if the total available ETH wasn't spent in full and there
...@@ -326,9 +308,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -326,9 +308,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
last = i == multiDelegatedRequests.length - 1; last = i == multiDelegatedRequests.length - 1;
} }
MultiDelegatedRevocationRequest memory multiDelegatedRequest = multiDelegatedRequests[ MultiDelegatedRevocationRequest memory multiDelegatedRequest = multiDelegatedRequests[i];
i
];
RevocationRequestData[] memory data = multiDelegatedRequest.data; RevocationRequestData[] memory data = multiDelegatedRequest.data;
// Ensure that no inputs are missing. // Ensure that no inputs are missing.
...@@ -527,14 +507,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -527,14 +507,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
emit Attested(request.recipient, attester, uid, schema); emit Attested(request.recipient, attester, uid, schema);
} }
res.usedValue = _resolveAttestations( res.usedValue = _resolveAttestations(schemaRecord, attestations, values, false, availableValue, last);
schemaRecord,
attestations,
values,
false,
availableValue,
last
);
return res; return res;
} }
...@@ -690,15 +663,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -690,15 +663,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
) private returns (uint256) { ) private returns (uint256) {
uint256 length = attestations.length; uint256 length = attestations.length;
if (length == 1) { if (length == 1) {
return return _resolveAttestation(schemaRecord, attestations[0], values[0], isRevocation, availableValue, last);
_resolveAttestation(
schemaRecord,
attestations[0],
values[0],
isRevocation,
availableValue,
last
);
} }
ISchemaResolver resolver = schemaRecord.resolver; ISchemaResolver resolver = schemaRecord.resolver;
...@@ -811,12 +776,8 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -811,12 +776,8 @@ contract EAS is IEAS, Semver, EIP712Verifier {
* @param data The data to timestamp. * @param data The data to timestamp.
* @param time The timestamp. * @param time The timestamp.
*/ */
function _revokeOffchain( function _revokeOffchain(address revoker, bytes32 data, uint64 time) private {
address revoker, mapping(bytes32 => uint64) storage revocations = _revocationsOffchain[revoker];
bytes32 data,
uint64 time
) private {
mapping(bytes32 data => uint64 timestamp) storage revocations = _revocationsOffchain[revoker];
if (revocations[data] != 0) { if (revocations[data] != 0) {
revert AlreadyRevokedOffchain(); revert AlreadyRevokedOffchain();
...@@ -843,11 +804,7 @@ contract EAS is IEAS, Semver, EIP712Verifier { ...@@ -843,11 +804,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
* *
* @return A merged and flatten list of all the UIDs. * @return A merged and flatten list of all the UIDs.
*/ */
function _mergeUIDs(bytes32[][] memory uidLists, uint256 uidsCount) function _mergeUIDs(bytes32[][] memory uidLists, uint256 uidsCount) private pure returns (bytes32[] memory) {
private
pure
returns (bytes32[] memory)
{
bytes32[] memory uids = new bytes32[](uidsCount); bytes32[] memory uids = new bytes32[](uidsCount);
uint256 currentIndex = 0; uint256 currentIndex = 0;
......
...@@ -108,12 +108,7 @@ interface IEAS { ...@@ -108,12 +108,7 @@ interface IEAS {
* @param uid The UID the revoked attestation. * @param uid The UID the revoked attestation.
* @param schema The UID of the schema. * @param schema The UID of the schema.
*/ */
event Attested( event Attested(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schema);
address indexed recipient,
address indexed attester,
bytes32 uid,
bytes32 indexed schema
);
/** /**
* @dev Emitted when an attestation has been revoked. * @dev Emitted when an attestation has been revoked.
...@@ -123,12 +118,7 @@ interface IEAS { ...@@ -123,12 +118,7 @@ interface IEAS {
* @param schema The UID of the schema. * @param schema The UID of the schema.
* @param uid The UID the revoked attestation. * @param uid The UID the revoked attestation.
*/ */
event Revoked( event Revoked(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schema);
address indexed recipient,
address indexed attester,
bytes32 uid,
bytes32 indexed schema
);
/** /**
* @dev Emitted when a data has been timestamped. * @dev Emitted when a data has been timestamped.
...@@ -204,10 +194,9 @@ interface IEAS { ...@@ -204,10 +194,9 @@ interface IEAS {
* *
* @return The UID of the new attestation. * @return The UID of the new attestation.
*/ */
function attestByDelegation(DelegatedAttestationRequest calldata delegatedRequest) function attestByDelegation(
external DelegatedAttestationRequest calldata delegatedRequest
payable ) external payable returns (bytes32);
returns (bytes32);
/** /**
* @dev Attests to multiple schemas. * @dev Attests to multiple schemas.
...@@ -250,10 +239,7 @@ interface IEAS { ...@@ -250,10 +239,7 @@ interface IEAS {
* *
* @return The UIDs of the new attestations. * @return The UIDs of the new attestations.
*/ */
function multiAttest(MultiAttestationRequest[] calldata multiRequests) function multiAttest(MultiAttestationRequest[] calldata multiRequests) external payable returns (bytes32[] memory);
external
payable
returns (bytes32[] memory);
/** /**
* @dev Attests to multiple schemas using via provided EIP712 signatures. * @dev Attests to multiple schemas using via provided EIP712 signatures.
...@@ -338,9 +324,7 @@ interface IEAS { ...@@ -338,9 +324,7 @@ interface IEAS {
* *
* @param delegatedRequest The arguments of the delegated revocation request. * @param delegatedRequest The arguments of the delegated revocation request.
*/ */
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) external payable;
external
payable;
/** /**
* @dev Revokes existing attestations to multiple schemas. * @dev Revokes existing attestations to multiple schemas.
......
...@@ -34,11 +34,7 @@ interface ISchemaRegistry { ...@@ -34,11 +34,7 @@ interface ISchemaRegistry {
* *
* @return The UID of the new schema. * @return The UID of the new schema.
*/ */
function register( function register(string calldata schema, ISchemaResolver resolver, bool revocable) external returns (bytes32);
string calldata schema,
ISchemaResolver resolver,
bool revocable
) external returns (bytes32);
/** /**
* @dev Returns an existing schema by UID * @dev Returns an existing schema by UID
......
...@@ -30,11 +30,7 @@ contract SchemaRegistry is ISchemaRegistry, Semver { ...@@ -30,11 +30,7 @@ contract SchemaRegistry is ISchemaRegistry, Semver {
/** /**
* @inheritdoc ISchemaRegistry * @inheritdoc ISchemaRegistry
*/ */
function register( function register(string calldata schema, ISchemaResolver resolver, bool revocable) external returns (bytes32) {
string calldata schema,
ISchemaResolver resolver,
bool revocable
) external returns (bytes32) {
SchemaRecord memory schemaRecord = SchemaRecord({ SchemaRecord memory schemaRecord = SchemaRecord({
uid: EMPTY_UID, uid: EMPTY_UID,
schema: schema, schema: schema,
...@@ -70,9 +66,6 @@ contract SchemaRegistry is ISchemaRegistry, Semver { ...@@ -70,9 +66,6 @@ contract SchemaRegistry is ISchemaRegistry, Semver {
* @return schema UID. * @return schema UID.
*/ */
function _getUID(SchemaRecord memory schemaRecord) private pure returns (bytes32) { function _getUID(SchemaRecord memory schemaRecord) private pure returns (bytes32) {
return return keccak256(abi.encodePacked(schemaRecord.schema, schemaRecord.resolver, schemaRecord.revocable));
keccak256(
abi.encodePacked(schemaRecord.schema, schemaRecord.resolver, schemaRecord.revocable)
);
} }
} }
...@@ -14,26 +14,18 @@ import { ...@@ -14,26 +14,18 @@ import {
RevocationRequestData RevocationRequestData
} from "../IEAS.sol"; } from "../IEAS.sol";
import { import { EIP712Signature, InvalidSignature, MAX_GAP, stringToBytes32, bytes32ToString } from "../Common.sol";
EIP712Signature,
InvalidSignature,
MAX_GAP,
stringToBytes32,
bytes32ToString
} from "../Common.sol";
/// @title EIP712 /// @title EIP712
/// @notice The EIP712 typed signatures verifier for EAS delegated attestations. /// @notice The EIP712 typed signatures verifier for EAS delegated attestations.
abstract contract EIP712Verifier is EIP712 { abstract contract EIP712Verifier is EIP712 {
// The hash of the data type used to relay calls to the attest function. It's the value of // The hash of the data type used to relay calls to the attest function. It's the value of
// keccak256("Attest(bytes32 schema,address recipient,uint64 expirationTime,bool revocable,bytes32 refUID,bytes data,uint256 nonce)"). // keccak256("Attest(bytes32 schema,address recipient,uint64 expirationTime,bool revocable,bytes32 refUID,bytes data,uint256 nonce)").
bytes32 private constant ATTEST_TYPEHASH = bytes32 private constant ATTEST_TYPEHASH = 0xdbfdf8dc2b135c26253e00d5b6cbe6f20457e003fd526d97cea183883570de61;
0xdbfdf8dc2b135c26253e00d5b6cbe6f20457e003fd526d97cea183883570de61;
// The hash of the data type used to relay calls to the revoke function. It's the value of // The hash of the data type used to relay calls to the revoke function. It's the value of
// keccak256("Revoke(bytes32 schema,bytes32 uid,uint256 nonce)"). // keccak256("Revoke(bytes32 schema,bytes32 uid,uint256 nonce)").
bytes32 private constant REVOKE_TYPEHASH = bytes32 private constant REVOKE_TYPEHASH = 0xa98d02348410c9c76735e0d0bb1396f4015ac2bb9615f9c2611d19d7a8a99650;
0xa98d02348410c9c76735e0d0bb1396f4015ac2bb9615f9c2611d19d7a8a99650;
// The user readable name of the signing domain. // The user readable name of the signing domain.
bytes32 private immutable _name; bytes32 private immutable _name;
...@@ -140,9 +132,7 @@ abstract contract EIP712Verifier is EIP712 { ...@@ -140,9 +132,7 @@ abstract contract EIP712Verifier is EIP712 {
nonce = _nonces[request.revoker]++; nonce = _nonces[request.revoker]++;
} }
bytes32 digest = _hashTypedDataV4( bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(REVOKE_TYPEHASH, request.schema, data.uid, nonce)));
keccak256(abi.encode(REVOKE_TYPEHASH, request.schema, data.uid, nonce))
);
if (ECDSA.recover(digest, signature.v, signature.r, signature.s) != request.revoker) { if (ECDSA.recover(digest, signature.v, signature.r, signature.s) != request.revoker) {
revert InvalidSignature(); revert InvalidSignature();
......
...@@ -29,10 +29,10 @@ interface ISchemaResolver { ...@@ -29,10 +29,10 @@ interface ISchemaResolver {
* *
* @return Whether all the attestations are valid. * @return Whether all the attestations are valid.
*/ */
function multiAttest(Attestation[] calldata attestations, uint256[] calldata values) function multiAttest(
external Attestation[] calldata attestations,
payable uint256[] calldata values
returns (bool); ) external payable returns (bool);
/** /**
* @dev Processes an attestation revocation and verifies if it can be revoked. * @dev Processes an attestation revocation and verifies if it can be revoked.
...@@ -51,8 +51,8 @@ interface ISchemaResolver { ...@@ -51,8 +51,8 @@ interface ISchemaResolver {
* *
* @return Whether the attestations can be revoked. * @return Whether the attestations can be revoked.
*/ */
function multiRevoke(Attestation[] calldata attestations, uint256[] calldata values) function multiRevoke(
external Attestation[] calldata attestations,
payable uint256[] calldata values
returns (bool); ) external payable returns (bool);
} }
...@@ -67,12 +67,10 @@ abstract contract SchemaResolver is ISchemaResolver, Semver { ...@@ -67,12 +67,10 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
/** /**
* @inheritdoc ISchemaResolver * @inheritdoc ISchemaResolver
*/ */
function multiAttest(Attestation[] calldata attestations, uint256[] calldata values) function multiAttest(
external Attestation[] calldata attestations,
payable uint256[] calldata values
onlyEAS ) external payable onlyEAS returns (bool) {
returns (bool)
{
uint256 length = attestations.length; uint256 length = attestations.length;
// We are keeping track of the remaining ETH amount that can be sent to resolvers and will keep deducting // We are keeping track of the remaining ETH amount that can be sent to resolvers and will keep deducting
...@@ -112,12 +110,10 @@ abstract contract SchemaResolver is ISchemaResolver, Semver { ...@@ -112,12 +110,10 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
/** /**
* @inheritdoc ISchemaResolver * @inheritdoc ISchemaResolver
*/ */
function multiRevoke(Attestation[] calldata attestations, uint256[] calldata values) function multiRevoke(
external Attestation[] calldata attestations,
payable uint256[] calldata values
onlyEAS ) external payable onlyEAS returns (bool) {
returns (bool)
{
uint256 length = attestations.length; uint256 length = attestations.length;
// We are keeping track of the remaining ETH amount that can be sent to resolvers and will keep deducting // We are keeping track of the remaining ETH amount that can be sent to resolvers and will keep deducting
...@@ -158,10 +154,7 @@ abstract contract SchemaResolver is ISchemaResolver, Semver { ...@@ -158,10 +154,7 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
* *
* @return Whether the attestation is valid. * @return Whether the attestation is valid.
*/ */
function onAttest(Attestation calldata attestation, uint256 value) function onAttest(Attestation calldata attestation, uint256 value) internal virtual returns (bool);
internal
virtual
returns (bool);
/** /**
* @dev Processes an attestation revocation and verifies if it can be revoked. * @dev Processes an attestation revocation and verifies if it can be revoked.
...@@ -174,10 +167,7 @@ abstract contract SchemaResolver is ISchemaResolver, Semver { ...@@ -174,10 +167,7 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
* *
* @return Whether the attestation can be revoked. * @return Whether the attestation can be revoked.
*/ */
function onRevoke(Attestation calldata attestation, uint256 value) function onRevoke(Attestation calldata attestation, uint256 value) internal virtual returns (bool);
internal
virtual
returns (bool);
/** /**
* @dev Ensures that only the EAS contract can make this call. * @dev Ensures that only the EAS contract can make this call.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment