Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
bff776db
Commit
bff776db
authored
Jul 18, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "lint: fix"
This reverts commit ecdb5b78ce943071c357a93da53e2d5739fb8f42.
parent
36e32e38
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
142 deletions
+54
-142
.eslintignore
packages/contracts-bedrock/.eslintignore
+2
-0
EAS.sol
packages/contracts-bedrock/contracts/EAS/EAS.sol
+20
-63
IEAS.sol
packages/contracts-bedrock/contracts/EAS/IEAS.sol
+7
-23
ISchemaRegistry.sol
packages/contracts-bedrock/contracts/EAS/ISchemaRegistry.sol
+1
-5
SchemaRegistry.sol
packages/contracts-bedrock/contracts/EAS/SchemaRegistry.sol
+2
-9
EIP712Verifier.sol
...contracts-bedrock/contracts/EAS/eip712/EIP712Verifier.sol
+4
-14
ISchemaResolver.sol
...tracts-bedrock/contracts/EAS/resolver/ISchemaResolver.sol
+8
-8
SchemaResolver.sol
...ntracts-bedrock/contracts/EAS/resolver/SchemaResolver.sol
+10
-20
No files found.
packages/contracts-bedrock/.eslintignore
View file @
bff776db
...
...
@@ -6,4 +6,6 @@ lib
artifacts
forge-artifacts
cache
typechain
coverage*
deployments
packages/contracts-bedrock/contracts/EAS/EAS.sol
View file @
bff776db
...
...
@@ -88,7 +88,8 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/**
* @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
...
...
@@ -110,30 +111,21 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/**
* @inheritdoc IEAS
*/
function attestByDelegation(DelegatedAttestationRequest calldata delegatedRequest)
external
payable
returns (bytes32)
{
function attestByDelegation(
DelegatedAttestationRequest calldata delegatedRequest
) external payable returns (bytes32) {
_verifyAttest(delegatedRequest);
AttestationRequestData[] memory data = new AttestationRequestData[](1);
data[0] = delegatedRequest.data;
return
_attest(delegatedRequest.schema, data, delegatedRequest.attester, msg.value, true).uids[
0
];
return _attest(delegatedRequest.schema, data, delegatedRequest.attester, msg.value, true).uids[0];
}
/**
* @inheritdoc IEAS
*/
function multiAttest(MultiAttestationRequest[] calldata multiRequests)
external
payable
returns (bytes32[] memory)
{
function multiAttest(MultiAttestationRequest[] calldata multiRequests) external payable returns (bytes32[] memory) {
// 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.
bytes32[][] memory totalUids = new bytes32[][](multiRequests.length);
...
...
@@ -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
// 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.
uint
256
availableValue = msg.value;
uint availableValue = msg.value;
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
...
...
@@ -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
// 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.
uint
256
availableValue = msg.value;
uint availableValue = msg.value;
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
...
...
@@ -204,8 +196,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
last = i == multiDelegatedRequests.length - 1;
}
MultiDelegatedAttestationRequest
calldata multiDelegatedRequest = multiDelegatedRequests[i];
MultiDelegatedAttestationRequest calldata multiDelegatedRequest = multiDelegatedRequests[i];
AttestationRequestData[] calldata data = multiDelegatedRequest.data;
// Ensure that no inputs are missing.
...
...
@@ -261,10 +252,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
/**
* @inheritdoc IEAS
*/
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest)
external
payable
{
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) external payable {
_verifyRevoke(delegatedRequest);
RevocationRequestData[] memory data = new RevocationRequestData[](1);
...
...
@@ -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
// 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.
uint
256
availableValue = msg.value;
uint availableValue = msg.value;
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
...
...
@@ -295,13 +283,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
MultiRevocationRequest calldata multiRequest = multiRequests[i];
// Ensure to deduct the ETH that was forwarded to the resolver during the processing of this batch.
availableValue -= _revoke(
multiRequest.schema,
multiRequest.data,
msg.sender,
availableValue,
last
);
availableValue -= _revoke(multiRequest.schema, multiRequest.data, msg.sender, availableValue, last);
}
}
...
...
@@ -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
// 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.
uint
256
availableValue = msg.value;
uint availableValue = msg.value;
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
...
...
@@ -326,9 +308,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
last = i == multiDelegatedRequests.length - 1;
}
MultiDelegatedRevocationRequest memory multiDelegatedRequest = multiDelegatedRequests[
i
];
MultiDelegatedRevocationRequest memory multiDelegatedRequest = multiDelegatedRequests[i];
RevocationRequestData[] memory data = multiDelegatedRequest.data;
// Ensure that no inputs are missing.
...
...
@@ -527,14 +507,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
emit Attested(request.recipient, attester, uid, schema);
}
res.usedValue = _resolveAttestations(
schemaRecord,
attestations,
values,
false,
availableValue,
last
);
res.usedValue = _resolveAttestations(schemaRecord, attestations, values, false, availableValue, last);
return res;
}
...
...
@@ -690,15 +663,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
) private returns (uint256) {
uint256 length = attestations.length;
if (length == 1) {
return
_resolveAttestation(
schemaRecord,
attestations[0],
values[0],
isRevocation,
availableValue,
last
);
return _resolveAttestation(schemaRecord, attestations[0], values[0], isRevocation, availableValue, last);
}
ISchemaResolver resolver = schemaRecord.resolver;
...
...
@@ -811,12 +776,8 @@ contract EAS is IEAS, Semver, EIP712Verifier {
* @param data The data to timestamp.
* @param time The timestamp.
*/
function _revokeOffchain(
address revoker,
bytes32 data,
uint64 time
) private {
mapping(bytes32 data => uint64 timestamp) storage revocations = _revocationsOffchain[revoker];
function _revokeOffchain(address revoker, bytes32 data, uint64 time) private {
mapping(bytes32 => uint64) storage revocations = _revocationsOffchain[revoker];
if (revocations[data] != 0) {
revert AlreadyRevokedOffchain();
...
...
@@ -843,11 +804,7 @@ contract EAS is IEAS, Semver, EIP712Verifier {
*
* @return A merged and flatten list of all the UIDs.
*/
function _mergeUIDs(bytes32[][] memory uidLists, uint256 uidsCount)
private
pure
returns (bytes32[] memory)
{
function _mergeUIDs(bytes32[][] memory uidLists, uint256 uidsCount) private pure returns (bytes32[] memory) {
bytes32[] memory uids = new bytes32[](uidsCount);
uint256 currentIndex = 0;
...
...
packages/contracts-bedrock/contracts/EAS/IEAS.sol
View file @
bff776db
...
...
@@ -108,12 +108,7 @@ interface IEAS {
* @param uid The UID the revoked attestation.
* @param schema The UID of the schema.
*/
event Attested(
address indexed recipient,
address indexed attester,
bytes32 uid,
bytes32 indexed schema
);
event Attested(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schema);
/**
* @dev Emitted when an attestation has been revoked.
...
...
@@ -123,12 +118,7 @@ interface IEAS {
* @param schema The UID of the schema.
* @param uid The UID the revoked attestation.
*/
event Revoked(
address indexed recipient,
address indexed attester,
bytes32 uid,
bytes32 indexed schema
);
event Revoked(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schema);
/**
* @dev Emitted when a data has been timestamped.
...
...
@@ -204,10 +194,9 @@ interface IEAS {
*
* @return The UID of the new attestation.
*/
function attestByDelegation(DelegatedAttestationRequest calldata delegatedRequest)
external
payable
returns (bytes32);
function attestByDelegation(
DelegatedAttestationRequest calldata delegatedRequest
) external payable returns (bytes32);
/**
* @dev Attests to multiple schemas.
...
...
@@ -250,10 +239,7 @@ interface IEAS {
*
* @return The UIDs of the new attestations.
*/
function multiAttest(MultiAttestationRequest[] calldata multiRequests)
external
payable
returns (bytes32[] memory);
function multiAttest(MultiAttestationRequest[] calldata multiRequests) external payable returns (bytes32[] memory);
/**
* @dev Attests to multiple schemas using via provided EIP712 signatures.
...
...
@@ -338,9 +324,7 @@ interface IEAS {
*
* @param delegatedRequest The arguments of the delegated revocation request.
*/
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest)
external
payable;
function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) external payable;
/**
* @dev Revokes existing attestations to multiple schemas.
...
...
packages/contracts-bedrock/contracts/EAS/ISchemaRegistry.sol
View file @
bff776db
...
...
@@ -34,11 +34,7 @@ interface ISchemaRegistry {
*
* @return The UID of the new schema.
*/
function register(
string calldata schema,
ISchemaResolver resolver,
bool revocable
) external returns (bytes32);
function register(string calldata schema, ISchemaResolver resolver, bool revocable) external returns (bytes32);
/**
* @dev Returns an existing schema by UID
...
...
packages/contracts-bedrock/contracts/EAS/SchemaRegistry.sol
View file @
bff776db
...
...
@@ -30,11 +30,7 @@ contract SchemaRegistry is ISchemaRegistry, Semver {
/**
* @inheritdoc ISchemaRegistry
*/
function register(
string calldata schema,
ISchemaResolver resolver,
bool revocable
) external returns (bytes32) {
function register(string calldata schema, ISchemaResolver resolver, bool revocable) external returns (bytes32) {
SchemaRecord memory schemaRecord = SchemaRecord({
uid: EMPTY_UID,
schema: schema,
...
...
@@ -70,9 +66,6 @@ contract SchemaRegistry is ISchemaRegistry, Semver {
* @return schema UID.
*/
function _getUID(SchemaRecord memory schemaRecord) private pure returns (bytes32) {
return
keccak256(
abi.encodePacked(schemaRecord.schema, schemaRecord.resolver, schemaRecord.revocable)
);
return keccak256(abi.encodePacked(schemaRecord.schema, schemaRecord.resolver, schemaRecord.revocable));
}
}
packages/contracts-bedrock/contracts/EAS/eip712/EIP712Verifier.sol
View file @
bff776db
...
...
@@ -14,26 +14,18 @@ import {
RevocationRequestData
} from "../IEAS.sol";
import {
EIP712Signature,
InvalidSignature,
MAX_GAP,
stringToBytes32,
bytes32ToString
} from "../Common.sol";
import { EIP712Signature, InvalidSignature, MAX_GAP, stringToBytes32, bytes32ToString } from "../Common.sol";
/// @title EIP712
/// @notice The EIP712 typed signatures verifier for EAS delegated attestations.
abstract contract EIP712Verifier is EIP712 {
// 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)").
bytes32 private constant ATTEST_TYPEHASH =
0xdbfdf8dc2b135c26253e00d5b6cbe6f20457e003fd526d97cea183883570de61;
bytes32 private constant ATTEST_TYPEHASH = 0xdbfdf8dc2b135c26253e00d5b6cbe6f20457e003fd526d97cea183883570de61;
// 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)").
bytes32 private constant REVOKE_TYPEHASH =
0xa98d02348410c9c76735e0d0bb1396f4015ac2bb9615f9c2611d19d7a8a99650;
bytes32 private constant REVOKE_TYPEHASH = 0xa98d02348410c9c76735e0d0bb1396f4015ac2bb9615f9c2611d19d7a8a99650;
// The user readable name of the signing domain.
bytes32 private immutable _name;
...
...
@@ -140,9 +132,7 @@ abstract contract EIP712Verifier is EIP712 {
nonce = _nonces[request.revoker]++;
}
bytes32 digest = _hashTypedDataV4(
keccak256(abi.encode(REVOKE_TYPEHASH, request.schema, data.uid, nonce))
);
bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(REVOKE_TYPEHASH, request.schema, data.uid, nonce)));
if (ECDSA.recover(digest, signature.v, signature.r, signature.s) != request.revoker) {
revert InvalidSignature();
...
...
packages/contracts-bedrock/contracts/EAS/resolver/ISchemaResolver.sol
View file @
bff776db
...
...
@@ -29,10 +29,10 @@ interface ISchemaResolver {
*
* @return Whether all the attestations are valid.
*/
function multiAttest(
Attestation[] calldata attestations, uint256[] calldata values)
external
payable
returns (bool);
function multiAttest(
Attestation[] calldata attestations,
uint256[] calldata values
) external payable
returns (bool);
/**
* @dev Processes an attestation revocation and verifies if it can be revoked.
...
...
@@ -51,8 +51,8 @@ interface ISchemaResolver {
*
* @return Whether the attestations can be revoked.
*/
function multiRevoke(
Attestation[] calldata attestations, uint256[] calldata values)
external
payable
returns (bool);
function multiRevoke(
Attestation[] calldata attestations,
uint256[] calldata values
) external payable
returns (bool);
}
packages/contracts-bedrock/contracts/EAS/resolver/SchemaResolver.sol
View file @
bff776db
...
...
@@ -67,12 +67,10 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
/**
* @inheritdoc ISchemaResolver
*/
function multiAttest(Attestation[] calldata attestations, uint256[] calldata values)
external
payable
onlyEAS
returns (bool)
{
function multiAttest(
Attestation[] calldata attestations,
uint256[] calldata values
) external payable onlyEAS returns (bool) {
uint256 length = attestations.length;
// 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 {
/**
* @inheritdoc ISchemaResolver
*/
function multiRevoke(Attestation[] calldata attestations, uint256[] calldata values)
external
payable
onlyEAS
returns (bool)
{
function multiRevoke(
Attestation[] calldata attestations,
uint256[] calldata values
) external payable onlyEAS returns (bool) {
uint256 length = attestations.length;
// 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 {
*
* @return Whether the attestation is valid.
*/
function onAttest(Attestation calldata attestation, uint256 value)
internal
virtual
returns (bool);
function onAttest(Attestation calldata attestation, uint256 value) internal virtual returns (bool);
/**
* @dev Processes an attestation revocation and verifies if it can be revoked.
...
...
@@ -174,10 +167,7 @@ abstract contract SchemaResolver is ISchemaResolver, Semver {
*
* @return Whether the attestation can be revoked.
*/
function onRevoke(Attestation calldata attestation, uint256 value)
internal
virtual
returns (bool);
function onRevoke(Attestation calldata attestation, uint256 value) internal virtual returns (bool);
/**
* @dev Ensures that only the EAS contract can make this call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment