From 507a0a031cd53685e89911ac9c154ff74be0286e Mon Sep 17 00:00:00 2001 From: lbeder Date: Sat, 5 Oct 2024 21:44:18 +0100 Subject: [PATCH 1/2] Refactor: Move getUID and getSchemaUID to EAS and SchemaRegistry respectably --- CHANGELOG.md | 4 ++ dist/eas.d.ts | 1 + dist/eas.js | 3 + dist/eas.js.map | 2 +- dist/offchain/offchain.d.ts | 2 +- dist/offchain/offchain.js | 67 +++++++++++++++++++-- dist/offchain/offchain.js.map | 2 +- dist/schema-registry.d.ts | 1 + dist/schema-registry.js | 7 ++- dist/schema-registry.js.map | 2 +- dist/utils.d.ts | 3 - dist/utils.js | 43 +------------- dist/utils.js.map | 2 +- package.json | 2 +- src/eas.ts | 26 +++++++- src/offchain/offchain.ts | 108 +++++++++++++++++++++++++++++----- src/schema-registry.ts | 11 +++- src/utils.ts | 89 +--------------------------- test/test/eas.ts | 90 ++++++++++++++++++++++++++-- test/test/helpers/eas.ts | 4 +- test/test/indexer.ts | 8 +-- test/test/schema-registry.ts | 29 ++++++++- test/test/utils.ts | 103 -------------------------------- 23 files changed, 328 insertions(+), 281 deletions(-) delete mode 100644 test/test/utils.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa5ed4..baf8fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.7.0 + +- Move getUID and getSchemaUID to EAS and SchemaRegistry respectably + ## 2.6.1 - Fix exports diff --git a/dist/eas.d.ts b/dist/eas.d.ts index c23d443..527b4b6 100644 --- a/dist/eas.d.ts +++ b/dist/eas.d.ts @@ -60,6 +60,7 @@ export declare class EAS extends Base { getNonce(address: string): Promise; getAttestTypeHash(): Promise; getRevokeTypeHash(): Promise; + static getAttestationUID: (schema: string, recipient: string, attester: string, time: bigint, expirationTime: bigint, revocable: boolean, refUID: string, data: string, bump: number) => string; private setDelegated; private setOffchain; private isLegacyContract; diff --git a/dist/eas.js b/dist/eas.js index 53fd961..32204d4 100644 --- a/dist/eas.js +++ b/dist/eas.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.EAS = exports.RequireProxy = void 0; const tslib_1 = require("tslib"); const eas_contracts_1 = require("@ethereum-attestation-service/eas-contracts"); +const ethers_1 = require("ethers"); const semver_1 = tslib_1.__importDefault(require("semver")); const typechain_1 = require("./legacy/typechain"); const version_1 = require("./legacy/version"); @@ -376,6 +377,8 @@ class EAS extends transaction_1.Base { getRevokeTypeHash() { return this.contract.getRevokeTypeHash(); } + // Return attestation UID + static getAttestationUID = (schema, recipient, attester, time, expirationTime, revocable, refUID, data, bump) => (0, ethers_1.solidityPackedKeccak256)(['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [(0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), recipient, attester, time, expirationTime, revocable, refUID, data, bump]); // Sets the delegated attestations helper async setDelegated() { this.delegated = new offchain_1.Delegated({ diff --git a/dist/eas.js.map b/dist/eas.js.map index b20f11d..ccec12a 100644 --- a/dist/eas.js.map +++ b/dist/eas.js.map @@ -1 +1 @@ -{"version":3,"file":"eas.js","sourceRoot":"","sources":["../src/eas.ts"],"names":[],"mappings":";;;;AAAA,+EAA6G;AAE7G,4DAA4B;AAE5B,kDAAgG;AAChG,8CAAiD;AACjD,yCAA6E;AAC7E,uCAcmB;AACnB,+CAAyG;AACzG,mCAMiB;AAEjB,MAAM,cAAc,GAAG,OAAO,CAAC;AAG/B,oDAA0B;AAoBnB,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAE,EAAE;IACrG,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;IAExC,8DAA8D;IAC9D,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;QACzC,8DAA8D;QAC9D,IAAI,CAAE,IAAY,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC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AAa;;;;kDAiEb;AAIY;IADZ,2BAAa;;;;iCAUb;AAIY;IADZ,2BAAa;;;;6CAqCb;AAIY;IADZ,2BAAa;;;;sCAuBb;AAIY;IADZ,2BAAa;;;;kDAmDb;AAKM;IAFN,2BAAa;IACb,oBAAY;;;;kDAMZ;AAKM;IAFN,2BAAa;IACb,oBAAY;;;;uDAMZ;AAKM;IAFN,2BAAa;IACb,oBAAY;;;;kDAMZ;AAKM;IAFN,2BAAa;IACb,oBAAY;;;;uDAMZ;AAIY;IADZ,2BAAa;;;;oCAQb;AAIY;IADZ,2BAAa;;;;yCAQb;AAIY;IADZ,2BAAa;;;;yCAQb;AAIY;IADZ,2BAAa;;;;8CAQb"} \ No newline at end of file diff --git a/dist/offchain/offchain.d.ts b/dist/offchain/offchain.d.ts index f9ea917..3896ff5 100644 --- a/dist/offchain/offchain.d.ts +++ b/dist/offchain/offchain.d.ts @@ -48,5 +48,5 @@ export declare class Offchain extends TypedDataHandler { signOffchainAttestation(params: OffchainAttestationParams, signer: TypeDataSigner, options?: OffchainAttestationOptions): Promise; verifyOffchainAttestationSignature(attester: string, attestation: SignedOffchainAttestation): boolean; private getOffchainUID; - static getOffchainUID(version: OffchainAttestationVersion, attestation: SignedOffchainAttestation): string; + static getOffchainUID(version: number, schema: string, recipient: string, time: bigint, expirationTime: bigint, revocable: boolean, refUID: string, data: string, salt?: string): string; } diff --git a/dist/offchain/offchain.js b/dist/offchain/offchain.js index 06bc337..b7bc6a2 100644 --- a/dist/offchain/offchain.js +++ b/dist/offchain/offchain.js @@ -166,7 +166,9 @@ class Offchain extends typed_data_handler_1.TypedDataHandler { }; } verifyOffchainAttestationSignature(attester, attestation) { - if (attestation.uid !== Offchain.getOffchainUID(this.version, attestation)) { + const { message: { schema, recipient, time, expirationTime, revocable, refUID, data, salt } } = attestation; + if (attestation.uid !== + Offchain.getOffchainUID(this.version, schema, recipient, time, expirationTime, revocable, refUID, data, salt)) { return false; } const typeCount = this.verificationTypes.length; @@ -186,10 +188,67 @@ class Offchain extends typed_data_handler_1.TypedDataHandler { }); } getOffchainUID(params) { - return (0, utils_1.getOffchainUID)(this.version, params.schema, params.recipient, params.time, params.expirationTime, params.revocable, params.refUID, params.data, params.salt); + return Offchain.getOffchainUID(this.version, params.schema, params.recipient, params.time, params.expirationTime, params.revocable, params.refUID, params.data, params.salt); } - static getOffchainUID(version, attestation) { - return (0, utils_1.getOffchainUID)(version, attestation.message.schema, attestation.message.recipient, attestation.message.time, attestation.message.expirationTime, attestation.message.revocable, attestation.message.refUID, attestation.message.data, attestation.message.salt); + // public static getOffchainAttestationUID(version: OffchainAttestationVersion, attestation: SignedOffchainAttestation): string { + // return Offchain.getOffchainUID( + // version, + // attestation.message.schema, + // attestation.message.recipient, + // attestation.message.time, + // attestation.message.expirationTime, + // attestation.message.revocable, + // attestation.message.refUID, + // attestation.message.data, + // attestation.message.salt + // ); + // } + static getOffchainUID(version, schema, recipient, time, expirationTime, revocable, refUID, data, salt) { + switch (version) { + case OffchainAttestationVersion.Legacy: + return (0, ethers_1.solidityPackedKeccak256)(['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [(0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), recipient, utils_1.ZERO_ADDRESS, time, expirationTime, revocable, refUID, data, 0]); + case OffchainAttestationVersion.Version1: + return (0, ethers_1.solidityPackedKeccak256)(['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [ + version, + (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), + recipient, + utils_1.ZERO_ADDRESS, + time, + expirationTime, + revocable, + refUID, + data, + 0 + ]); + case OffchainAttestationVersion.Version2: + return (0, ethers_1.solidityPackedKeccak256)([ + 'uint16', + 'bytes', + 'address', + 'address', + 'uint64', + 'uint64', + 'bool', + 'bytes32', + 'bytes', + 'bytes32', + 'uint32' + ], [ + version, + (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), + recipient, + utils_1.ZERO_ADDRESS, + time, + expirationTime, + revocable, + refUID, + data, + salt, + 0 + ]); + default: + throw new Error('Unsupported version'); + } } } exports.Offchain = Offchain; diff --git a/dist/offchain/offchain.js.map b/dist/offchain/offchain.js.map index bf3e864..d1075ea 100644 --- a/dist/offchain/offchain.js.map +++ b/dist/offchain/offchain.js.map @@ -1 +1 @@ -{"version":3,"file":"offchain.js","sourceRoot":"","sources":["../../src/offchain/offchain.ts"],"names":[],"mappings":";;;AAAA,mCAAgF;AAEhF,oCAAwD;AACxD,6DAU8B;AAC9B,yCAAyC;AAQzC,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,+EAAU,CAAA;IACV,mFAAY,CAAA;IACZ,mFAAY,CAAA;AACd,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAEY,QAAA,0BAA0B,GAAkE;IACvG,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE;QACnC;YACE,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,aAAa;YAC1B,KAAK,EAAE;gBACL,WAAW,EAAE;oBACX,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;oBACtC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAChC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC1C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;oBACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;iBAChC;aACF;SACF;QACD;YACE,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,aAAa;YAC1B,KAAK,EAAE;gBACL,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,SAAS,EAChB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,IAAI,CACZ,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,OAAmC,EAAE,WAAsC;QACtG,OAAO,IAAA,sBAAc,EACnB,OAAO,EACP,WAAW,CAAC,OAAO,CAAC,MAAM,EAC1B,WAAW,CAAC,OAAO,CAAC,SAAS,EAC7B,WAAW,CAAC,OAAO,CAAC,IAAI,EACxB,WAAW,CAAC,OAAO,CAAC,cAAc,EAClC,WAAW,CAAC,OAAO,CAAC,SAAS,EAC7B,WAAW,CAAC,OAAO,CAAC,MAAM,EAC1B,WAAW,CAAC,OAAO,CAAC,IAAI,EACxB,WAAW,CAAC,OAAO,CAAC,IAAI,CACzB,CAAC;IACJ,CAAC;CACF;AAlJD,4BAkJC"} \ No newline at end of file +{"version":3,"file":"offchain.js","sourceRoot":"","sources":["../../src/offchain/offchain.ts"],"names":[],"mappings":";;;AAAA,mCAAyG;AAEzG,oCAAsD;AACtD,6DAU8B;AAC9B,yCAAyC;AAQzC,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,+EAAU,CAAA;IACV,mFAAY,CAAA;IACZ,mFAAY,CAAA;AACd,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAEY,QAAA,0BAA0B,GAAkE;IACvG,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE;QACnC;YACE,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,aAAa;YAC1B,KAAK,EAAE;gBACL,WAAW,EAAE;oBACX,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;oBACtC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,E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ts index 2fd6faf..fa9bebb 100644 --- a/dist/schema-registry.d.ts +++ b/dist/schema-registry.d.ts @@ -21,6 +21,7 @@ export interface SchemaRegistryOptions { export declare class SchemaRegistry extends Base { constructor(address: string, options?: SchemaRegistryOptions); getVersion(): Promise; + static getSchemaUID(schema: string, resolverAddress: string, revocable: boolean): string; register({ schema, resolverAddress, revocable }: RegisterSchemaParams, overrides?: Overrides): Promise>; getSchema({ uid }: GetSchemaParams): Promise; } diff --git a/dist/schema-registry.js b/dist/schema-registry.js index 018891b..4cb82c3 100644 --- a/dist/schema-registry.js +++ b/dist/schema-registry.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.SchemaRegistry = void 0; const tslib_1 = require("tslib"); const eas_contracts_1 = require("@ethereum-attestation-service/eas-contracts"); +const ethers_1 = require("ethers"); const version_1 = require("./legacy/version"); const transaction_1 = require("./transaction"); const utils_1 = require("./utils"); @@ -15,11 +16,15 @@ class SchemaRegistry extends transaction_1.Base { async getVersion() { return (await (0, version_1.legacyVersion)(this.contract)) ?? this.contract.version(); } + // Returns a schema UID + static getSchemaUID(schema, resolverAddress, revocable) { + return (0, ethers_1.solidityPackedKeccak256)(['string', 'address', 'bool'], [schema, resolverAddress, revocable]); + } // Registers a new schema and returns its UID async register({ schema, resolverAddress = utils_1.ZERO_ADDRESS, revocable = true }, overrides) { return new transaction_1.Transaction(await this.contract.register.populateTransaction(schema, resolverAddress, revocable, overrides ?? {}), this.signer, // eslint-disable-next-line require-await - async (_receipt) => (0, utils_1.getSchemaUID)(schema, resolverAddress, revocable)); + async (_receipt) => SchemaRegistry.getSchemaUID(schema, resolverAddress, revocable)); } // Returns an existing schema by a schema UID async getSchema({ uid }) { diff --git a/dist/schema-registry.js.map b/dist/schema-registry.js.map index 0aa6290..01051ff 100644 --- a/dist/schema-registry.js.map +++ b/dist/schema-registry.js.map @@ -1 +1 @@ -{"version":3,"file":"schema-registry.js","sourceRoot":"","sources":["../src/schema-registry.ts"],"names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,CAAC;IACJ,CAAC;IAED,6CAA6C;IACtC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAmB;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,GAAG,KAAK,oBAAY,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxCD,wCAwCC;AArBc;IADZ,2BAAa;;;;8CAWb"} \ No newline at end of file diff --git a/dist/utils.d.ts b/dist/utils.d.ts index 105cebc..2899ee2 100644 --- a/dist/utils.d.ts +++ b/dist/utils.d.ts @@ -2,9 +2,6 @@ import { TransactionReceipt, TransactionResponse } from 'ethers'; export declare const ZERO_ADDRESS: string; export declare const ZERO_BYTES = "0x"; export declare const ZERO_BYTES32 = "0x0000000000000000000000000000000000000000000000000000000000000000"; -export declare const getSchemaUID: (schema: string, resolverAddress: string, revocable: boolean) => string; -export declare const getUID: (schema: string, recipient: string, attester: string, time: bigint, expirationTime: bigint, revocable: boolean, refUID: string, data: string, bump: number) => string; -export declare const getOffchainUID: (version: number, schema: string, recipient: string, time: bigint, expirationTime: bigint, revocable: boolean, refUID: string, data: string, salt?: string) => string; export declare const getUIDFromAttestTx: (res: Promise | TransactionResponse) => Promise; export declare const getUIDsFromMultiAttestTx: (res: Promise | TransactionResponse) => Promise; export declare const getUIDsFromAttestReceipt: (receipt: TransactionReceipt) => string[]; diff --git a/dist/utils.js b/dist/utils.js index fdec2d4..cc99cb9 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,9 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTimestampFromOffchainRevocationReceipt = exports.getTimestampFromTimestampReceipt = exports.getUIDsFromAttestReceipt = exports.getUIDsFromMultiAttestTx = exports.getUIDFromAttestTx = exports.getOffchainUID = exports.getUID = exports.getSchemaUID = exports.ZERO_BYTES32 = exports.ZERO_BYTES = exports.ZERO_ADDRESS = void 0; +exports.getTimestampFromOffchainRevocationReceipt = exports.getTimestampFromTimestampReceipt = exports.getUIDsFromAttestReceipt = exports.getUIDsFromMultiAttestTx = exports.getUIDFromAttestTx = exports.ZERO_BYTES32 = exports.ZERO_BYTES = exports.ZERO_ADDRESS = void 0; const eas_contracts_1 = require("@ethereum-attestation-service/eas-contracts"); const ethers_1 = require("ethers"); -const offchain_1 = require("./offchain"); exports.ZERO_ADDRESS = ethers_1.ZeroAddress; exports.ZERO_BYTES = '0x'; exports.ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000'; @@ -18,46 +17,6 @@ const TOPICS = { [Event.Timestamped]: (0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)('Timestamped(bytes32,uint64)')), [Event.RevokedOffchain]: (0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)('RevokedOffchain(address,bytes32,uint64)')) }; -const getSchemaUID = (schema, resolverAddress, revocable) => (0, ethers_1.solidityPackedKeccak256)(['string', 'address', 'bool'], [schema, resolverAddress, revocable]); -exports.getSchemaUID = getSchemaUID; -const getUID = (schema, recipient, attester, time, expirationTime, revocable, refUID, data, bump) => (0, ethers_1.solidityPackedKeccak256)(['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [(0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), recipient, attester, time, expirationTime, revocable, refUID, data, bump]); -exports.getUID = getUID; -const getOffchainUID = (version, schema, recipient, time, expirationTime, revocable, refUID, data, salt) => { - switch (version) { - case offchain_1.OffchainAttestationVersion.Legacy: - return (0, ethers_1.solidityPackedKeccak256)(['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [(0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), recipient, exports.ZERO_ADDRESS, time, expirationTime, revocable, refUID, data, 0]); - case offchain_1.OffchainAttestationVersion.Version1: - return (0, ethers_1.solidityPackedKeccak256)(['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], [ - version, - (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), - recipient, - exports.ZERO_ADDRESS, - time, - expirationTime, - revocable, - refUID, - data, - 0 - ]); - case offchain_1.OffchainAttestationVersion.Version2: - return (0, ethers_1.solidityPackedKeccak256)(['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'bytes32', 'uint32'], [ - version, - (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(schema)), - recipient, - exports.ZERO_ADDRESS, - time, - expirationTime, - revocable, - refUID, - data, - salt, - 0 - ]); - default: - throw new Error('Unsupported version'); - } -}; -exports.getOffchainUID = getOffchainUID; const getDataFromReceipt = (receipt, event, attribute) => { // eslint-disable-next-line camelcase const eas = new ethers_1.Interface(eas_contracts_1.EAS__factory.abi); diff --git a/dist/utils.js.map b/dist/utils.js.map index 729189d..fbabdb5 100644 --- a/dist/utils.js.map +++ b/dist/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,+EAA2E;AAC3E,mCASgB;AAChB,yCAAwD;AAE3C,QAAA,YAAY,GAAG,oBAAW,CAAC;AAC3B,QAAA,UAAU,GAAG,IAAI,CAAC;AAClB,QAAA,YAAY,GAAG,oEAAoE,CAAC;AAEjG,IAAK,KAIJ;AAJD,WAAK,KAAK;IACR,8BAAqB,CAAA;IACrB,oCAA2B,CAAA;IAC3B,4CAAmC,CAAA;AACrC,CAAC,EAJI,KAAK,KAAL,KAAK,QAIT;AAED,MAAM,MAAM,GAAG;IACb,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAA,kBAAS,EAAC,IAAA,oBAAW,EAAC,2CAA2C,CAAC,CAAC;I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,QAAA,wBAAwB,4BACgB;AAE9C,MAAM,gCAAgC,GAAG,CAAC,OAA2B,EAAY,EAAE,CACxF,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AADvE,QAAA,gCAAgC,oCACuC;AAE7E,MAAM,yCAAyC,GAAG,CAAC,OAA2B,EAAY,EAAE,CACjG,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAD3E,QAAA,yCAAyC,6CACkC"} \ No newline at end of file diff --git a/package.json b/package.json index 91b2c32..93280a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ethereum-attestation-service/eas-sdk", - "version": "2.6.1", + "version": "2.7.0", "description": "Ethereum Attestation Service - TypeScript/JavaScript SDK", "repository": "git@github.com:ethereum-attestation-service/eas-sdk.git", "author": "Leonid Beder ", diff --git a/src/eas.ts b/src/eas.ts index 7d58562..bf420ab 100644 --- a/src/eas.ts +++ b/src/eas.ts @@ -1,5 +1,12 @@ import { EAS as EASContract, EAS__factory as EASFactory } from '@ethereum-attestation-service/eas-contracts'; -import { ContractTransaction, Overrides, TransactionReceipt } from 'ethers'; +import { + ContractTransaction, + hexlify, + Overrides, + solidityPackedKeccak256, + toUtf8Bytes, + TransactionReceipt +} from 'ethers'; import semver from 'semver'; import { EIP712Proxy } from './eip712-proxy'; import { EAS as EASLegacyContract, EAS__factory as EASLegacyFactory } from './legacy/typechain'; @@ -598,6 +605,23 @@ export class EAS extends Base { return this.contract.getRevokeTypeHash(); } + // Return attestation UID + public static getAttestationUID = ( + schema: string, + recipient: string, + attester: string, + time: bigint, + expirationTime: bigint, + revocable: boolean, + refUID: string, + data: string, + bump: number + ) => + solidityPackedKeccak256( + ['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], + [hexlify(toUtf8Bytes(schema)), recipient, attester, time, expirationTime, revocable, refUID, data, bump] + ); + // Sets the delegated attestations helper private async setDelegated(): Promise { this.delegated = new Delegated( diff --git a/src/offchain/offchain.ts b/src/offchain/offchain.ts index 737d5a1..e6b0e71 100644 --- a/src/offchain/offchain.ts +++ b/src/offchain/offchain.ts @@ -1,6 +1,6 @@ -import { AbiCoder, hexlify, keccak256, randomBytes, toUtf8Bytes } from 'ethers'; +import { AbiCoder, hexlify, keccak256, randomBytes, solidityPackedKeccak256, toUtf8Bytes } from 'ethers'; import { EAS } from '../eas'; -import { getOffchainUID, ZERO_BYTES32 } from '../utils'; +import { ZERO_ADDRESS, ZERO_BYTES32 } from '../utils'; import { DomainTypedData, EIP712MessageTypes, @@ -241,7 +241,13 @@ export class Offchain extends TypedDataHandler { } public verifyOffchainAttestationSignature(attester: string, attestation: SignedOffchainAttestation): boolean { - if (attestation.uid !== Offchain.getOffchainUID(this.version, attestation)) { + const { + message: { schema, recipient, time, expirationTime, revocable, refUID, data, salt } + } = attestation; + if ( + attestation.uid !== + Offchain.getOffchainUID(this.version, schema, recipient, time, expirationTime, revocable, refUID, data, salt) + ) { return false; } @@ -268,7 +274,7 @@ export class Offchain extends TypedDataHandler { } private getOffchainUID(params: OffchainAttestationParams): string { - return getOffchainUID( + return Offchain.getOffchainUID( this.version, params.schema, params.recipient, @@ -281,17 +287,87 @@ export class Offchain extends TypedDataHandler { ); } - public static getOffchainUID(version: OffchainAttestationVersion, attestation: SignedOffchainAttestation): string { - return getOffchainUID( - version, - attestation.message.schema, - attestation.message.recipient, - attestation.message.time, - attestation.message.expirationTime, - attestation.message.revocable, - attestation.message.refUID, - attestation.message.data, - attestation.message.salt - ); + // public static getOffchainAttestationUID(version: OffchainAttestationVersion, attestation: SignedOffchainAttestation): string { + // return Offchain.getOffchainUID( + // version, + // attestation.message.schema, + // attestation.message.recipient, + // attestation.message.time, + // attestation.message.expirationTime, + // attestation.message.revocable, + // attestation.message.refUID, + // attestation.message.data, + // attestation.message.salt + // ); + // } + + public static getOffchainUID( + version: number, + schema: string, + recipient: string, + time: bigint, + expirationTime: bigint, + revocable: boolean, + refUID: string, + data: string, + salt?: string + ) { + switch (version) { + case OffchainAttestationVersion.Legacy: + return solidityPackedKeccak256( + ['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], + [hexlify(toUtf8Bytes(schema)), recipient, ZERO_ADDRESS, time, expirationTime, revocable, refUID, data, 0] + ); + + case OffchainAttestationVersion.Version1: + return solidityPackedKeccak256( + ['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], + [ + version, + hexlify(toUtf8Bytes(schema)), + recipient, + ZERO_ADDRESS, + time, + expirationTime, + revocable, + refUID, + data, + 0 + ] + ); + + case OffchainAttestationVersion.Version2: + return solidityPackedKeccak256( + [ + 'uint16', + 'bytes', + 'address', + 'address', + 'uint64', + 'uint64', + 'bool', + 'bytes32', + 'bytes', + 'bytes32', + 'uint32' + ], + [ + version, + hexlify(toUtf8Bytes(schema)), + recipient, + ZERO_ADDRESS, + time, + expirationTime, + revocable, + refUID, + data, + salt, + 0 + ] + ); + + default: + throw new Error('Unsupported version'); + } } } diff --git a/src/schema-registry.ts b/src/schema-registry.ts index 3ceb2a6..292f9fc 100644 --- a/src/schema-registry.ts +++ b/src/schema-registry.ts @@ -2,10 +2,10 @@ import { SchemaRegistry__factory, SchemaRegistry as SchemaRegistryContract } from '@ethereum-attestation-service/eas-contracts'; -import { Overrides, TransactionReceipt } from 'ethers'; +import { Overrides, solidityPackedKeccak256, TransactionReceipt } from 'ethers'; import { legacyVersion } from './legacy/version'; import { Base, RequireSigner, Transaction, TransactionProvider, TransactionSigner } from './transaction'; -import { getSchemaUID, ZERO_ADDRESS, ZERO_BYTES32 } from './utils'; +import { ZERO_ADDRESS, ZERO_BYTES32 } from './utils'; export declare type SchemaRecord = { uid: string; @@ -40,6 +40,11 @@ export class SchemaRegistry extends Base { return (await legacyVersion(this.contract)) ?? this.contract.version(); } + // Returns a schema UID + public static getSchemaUID(schema: string, resolverAddress: string, revocable: boolean) { + return solidityPackedKeccak256(['string', 'address', 'bool'], [schema, resolverAddress, revocable]); + } + // Registers a new schema and returns its UID @RequireSigner public async register( @@ -50,7 +55,7 @@ export class SchemaRegistry extends Base { await this.contract.register.populateTransaction(schema, resolverAddress, revocable, overrides ?? {}), this.signer!, // eslint-disable-next-line require-await - async (_receipt: TransactionReceipt) => getSchemaUID(schema, resolverAddress, revocable) + async (_receipt: TransactionReceipt) => SchemaRegistry.getSchemaUID(schema, resolverAddress, revocable) ); } diff --git a/src/utils.ts b/src/utils.ts index 3ee04e5..d7b6c3a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,15 +1,5 @@ import { EAS__factory } from '@ethereum-attestation-service/eas-contracts'; -import { - hexlify, - Interface, - keccak256, - solidityPackedKeccak256, - toUtf8Bytes, - TransactionReceipt, - TransactionResponse, - ZeroAddress -} from 'ethers'; -import { OffchainAttestationVersion } from './offchain'; +import { Interface, keccak256, toUtf8Bytes, TransactionReceipt, TransactionResponse, ZeroAddress } from 'ethers'; export const ZERO_ADDRESS = ZeroAddress; export const ZERO_BYTES = '0x'; @@ -27,83 +17,6 @@ const TOPICS = { [Event.RevokedOffchain]: keccak256(toUtf8Bytes('RevokedOffchain(address,bytes32,uint64)')) }; -export const getSchemaUID = (schema: string, resolverAddress: string, revocable: boolean) => - solidityPackedKeccak256(['string', 'address', 'bool'], [schema, resolverAddress, revocable]); - -export const getUID = ( - schema: string, - recipient: string, - attester: string, - time: bigint, - expirationTime: bigint, - revocable: boolean, - refUID: string, - data: string, - bump: number -) => - solidityPackedKeccak256( - ['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], - [hexlify(toUtf8Bytes(schema)), recipient, attester, time, expirationTime, revocable, refUID, data, bump] - ); - -export const getOffchainUID = ( - version: number, - schema: string, - recipient: string, - time: bigint, - expirationTime: bigint, - revocable: boolean, - refUID: string, - data: string, - salt?: string -) => { - switch (version) { - case OffchainAttestationVersion.Legacy: - return solidityPackedKeccak256( - ['bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], - [hexlify(toUtf8Bytes(schema)), recipient, ZERO_ADDRESS, time, expirationTime, revocable, refUID, data, 0] - ); - - case OffchainAttestationVersion.Version1: - return solidityPackedKeccak256( - ['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'uint32'], - [ - version, - hexlify(toUtf8Bytes(schema)), - recipient, - ZERO_ADDRESS, - time, - expirationTime, - revocable, - refUID, - data, - 0 - ] - ); - - case OffchainAttestationVersion.Version2: - return solidityPackedKeccak256( - ['uint16', 'bytes', 'address', 'address', 'uint64', 'uint64', 'bool', 'bytes32', 'bytes', 'bytes32', 'uint32'], - [ - version, - hexlify(toUtf8Bytes(schema)), - recipient, - ZERO_ADDRESS, - time, - expirationTime, - revocable, - refUID, - data, - salt, - 0 - ] - ); - - default: - throw new Error('Unsupported version'); - } -}; - const getDataFromReceipt = (receipt: TransactionReceipt, event: Event, attribute: string): string[] => { // eslint-disable-next-line camelcase const eas = new Interface(EAS__factory.abi); diff --git a/test/test/eas.ts b/test/test/eas.ts index 3fd2b3c..7ab1e6c 100644 --- a/test/test/eas.ts +++ b/test/test/eas.ts @@ -1,6 +1,5 @@ -import { encodeBytes32String, Signer } from 'ethers'; +import { encodeBytes32String, hexlify, Signer, solidityPackedKeccak256, toUtf8Bytes } from 'ethers'; import { ethers } from 'hardhat'; -import { getSchemaUID } from '../../src'; import { EAS, NO_EXPIRATION } from '../../src/eas'; import { EIP712Proxy } from '../../src/eip712-proxy'; import { @@ -60,14 +59,14 @@ describe('EAS API', () => { }); describe('partial signer', () => { - const schemaId = getSchemaUID('bool like', ZERO_ADDRESS, true); + const schemaId = SchemaRegistry.getSchemaUID('bool like', ZERO_ADDRESS, true); let recipient: string; let attester: string; const signature = { v: 1, s: ZERO_BYTES32, r: ZERO_BYTES32 }; beforeEach(async () => { - recipient: await sender.getAddress(); - attester: await sender.getAddress(); + recipient = await sender.getAddress(); + attester = await sender.getAddress(); }); enum PartialSignerType { @@ -1457,6 +1456,87 @@ describe('EAS API', () => { }); }); } + + describe('uid', () => { + for (const schema of [ + 'bool like', + 'address contractAddress,bool trusted', + 'bytes32 eventId,uint8 ticketType,uint32 ticketNum' + ]) { + for (const recipient of [ + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', + '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', + ZERO_ADDRESS + ]) { + for (const attester of [ + '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC', + '0x90F79bf6EB2c4f870365E785982E1f101E93b906' + ]) { + for (const time of [1n, 12345n, 1669299342n]) { + for (const expirationTime of [0n, 1669299342n]) { + for (const revocable of [true, false]) { + for (const refUID of [ + ZERO_BYTES32, + '0x7465737400000000000000000000000000000000000000000000000000000000' + ]) { + for (const data of [ZERO_BYTES32, '0x1234']) { + for (const bump of [0, 1, 2]) { + context( + // eslint-disable-next-line max-len + `schema=${schema},recipient=${recipient},attester=${attester},time=${time},expirationTime=${expirationTime},revocable=${revocable},data=${data},bump=${bump}`, + () => { + it('should properly derive uid', () => { + expect( + EAS.getAttestationUID( + schema, + recipient, + attester, + time, + expirationTime, + revocable, + refUID, + data, + bump + ) + ).to.equal( + solidityPackedKeccak256( + [ + 'bytes', + 'address', + 'address', + 'uint64', + 'uint64', + 'bool', + 'bytes32', + 'bytes', + 'uint32' + ], + [ + hexlify(toUtf8Bytes(schema)), + recipient, + attester, + time, + expirationTime, + revocable, + refUID, + data, + bump + ] + ) + ); + }); + } + ); + } + } + } + } + } + } + } + } + } + }); }); } }); diff --git a/test/test/helpers/eas.ts b/test/test/helpers/eas.ts index 927a5d5..c1e5618 100644 --- a/test/test/helpers/eas.ts +++ b/test/test/helpers/eas.ts @@ -19,10 +19,10 @@ import { EIP712Response, EIP712RevocationParams, EIP712RevocationProxyParams, + Offchain, OffchainAttestationVersion } from '../../../src/offchain'; import { Transaction } from '../../../src/transaction'; -import { getOffchainUID } from '../../../src/utils'; import { ZERO_BYTES, ZERO_BYTES32 } from '../../utils/Constants'; import { latest } from './time'; @@ -169,7 +169,7 @@ export const expectAttestation = async ( const now = await latest(); const salt = encodeBytes32String('SALT'); - const uid = getOffchainUID( + const uid = Offchain.getOffchainUID( OffchainAttestationVersion.Version2, schema, recipient, diff --git a/test/test/indexer.ts b/test/test/indexer.ts index 6cc2745..2f1a694 100644 --- a/test/test/indexer.ts +++ b/test/test/indexer.ts @@ -1,13 +1,13 @@ import { EAS as EASContract, Indexer as IndexerContract, - SchemaRegistry + SchemaRegistry as SchemaRegistryContract } from '@ethereum-attestation-service/eas-contracts'; import { Signer } from 'ethers'; import { ethers } from 'hardhat'; import { EAS, NO_EXPIRATION } from '../../src/eas'; import { Indexer } from '../../src/indexer'; -import { getSchemaUID } from '../../src/utils'; +import { SchemaRegistry } from '../../src/schema-registry'; import Contracts from '../components/Contracts'; import { ZERO_ADDRESS, ZERO_BYTES, ZERO_BYTES32 } from '../utils/Constants'; import chai from './helpers/chai'; @@ -15,7 +15,7 @@ import chai from './helpers/chai'; const { expect } = chai; describe('Indexer API', () => { - let registry: SchemaRegistry; + let registry: SchemaRegistryContract; let eas: EAS; let easContract: EASContract; let indexerContract: IndexerContract; @@ -48,7 +48,7 @@ describe('Indexer API', () => { describe('indexing', () => { context('with attestations', () => { const schema = 'bool liked'; - const schemaId = getSchemaUID(schema, ZERO_ADDRESS, true); + const schemaId = SchemaRegistry.getSchemaUID(schema, ZERO_ADDRESS, true); let uids: string[] = []; beforeEach(async () => { diff --git a/test/test/schema-registry.ts b/test/test/schema-registry.ts index 4bce96e..40334cb 100644 --- a/test/test/schema-registry.ts +++ b/test/test/schema-registry.ts @@ -1,8 +1,7 @@ import { SchemaRegistry as SchemaRegistryContract } from '@ethereum-attestation-service/eas-contracts'; -import { Signer } from 'ethers'; +import { Signer, solidityPackedKeccak256 } from 'ethers'; import { ethers } from 'hardhat'; import { SchemaRegistry } from '../../src/schema-registry'; -import { getSchemaUID } from '../../src/utils'; import Contracts from '../components/Contracts'; import { ZERO_ADDRESS, ZERO_BYTES } from '../utils/Constants'; import chai from './helpers/chai'; @@ -39,7 +38,7 @@ describe('SchemaRegistry API', () => { const testRegister = async (schema: string, resolver: string | Signer, revocable: boolean) => { const resolverAddress = typeof resolver === 'string' ? resolver : await resolver.getAddress(); - const uid = getSchemaUID(schema, resolverAddress, revocable); + const uid = SchemaRegistry.getSchemaUID(schema, resolverAddress, revocable); await expect(schemaRegistry.getSchema({ uid })).to.be.rejectedWith('Schema not found'); const tx = await schemaRegistry.register({ schema, resolverAddress, revocable }); @@ -70,4 +69,28 @@ describe('SchemaRegistry API', () => { await testRegister(ZERO_BYTES, ZERO_ADDRESS, true); }); }); + + describe('schema uid', () => { + for (const schema of [ + 'bool like', + 'address contractAddress,bool trusted', + 'bytes32 eventId,uint8 ticketType,uint32 ticketNum' + ]) { + for (const resolver of [ + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', + '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', + ZERO_ADDRESS + ]) { + for (const revocable of [true, false]) { + context(`schema=${schema},resolver=${resolver}},revocable=${revocable}`, () => { + it('should properly derive uid', () => { + expect(SchemaRegistry.getSchemaUID(schema, resolver, revocable)).to.equal( + solidityPackedKeccak256(['string', 'address', 'bool'], [schema, resolver, revocable]) + ); + }); + }); + } + } + } + }); }); diff --git a/test/test/utils.ts b/test/test/utils.ts deleted file mode 100644 index cf7dd6b..0000000 --- a/test/test/utils.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { hexlify, solidityPackedKeccak256, toUtf8Bytes } from 'ethers'; -import { getSchemaUID, getUID } from '../../src/utils'; -import { ZERO_ADDRESS, ZERO_BYTES32 } from '../utils/Constants'; -import chai from './helpers/chai'; - -const { expect } = chai; - -describe('utils', () => { - describe('uid', () => { - for (const schema of [ - 'bool like', - 'address contractAddress,bool trusted', - 'bytes32 eventId,uint8 ticketType,uint32 ticketNum' - ]) { - for (const recipient of [ - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - ZERO_ADDRESS - ]) { - for (const attester of [ - '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC', - '0x90F79bf6EB2c4f870365E785982E1f101E93b906' - ]) { - for (const time of [1n, 12345n, 1669299342n]) { - for (const expirationTime of [0n, 1669299342n]) { - for (const revocable of [true, false]) { - for (const refUID of [ - ZERO_BYTES32, - '0x7465737400000000000000000000000000000000000000000000000000000000' - ]) { - for (const data of [ZERO_BYTES32, '0x1234']) { - for (const bump of [0, 1, 2]) { - context( - // eslint-disable-next-line max-len - `schema=${schema},recipient=${recipient},attester=${attester},time=${time},expirationTime=${expirationTime},revocable=${revocable},data=${data},bump=${bump}`, - () => { - it('should properly derive uid', () => { - expect( - getUID(schema, recipient, attester, time, expirationTime, revocable, refUID, data, bump) - ).to.equal( - solidityPackedKeccak256( - [ - 'bytes', - 'address', - 'address', - 'uint64', - 'uint64', - 'bool', - 'bytes32', - 'bytes', - 'uint32' - ], - [ - hexlify(toUtf8Bytes(schema)), - recipient, - attester, - time, - expirationTime, - revocable, - refUID, - data, - bump - ] - ) - ); - }); - } - ); - } - } - } - } - } - } - } - } - } - }); - - describe('schema uid', () => { - for (const schema of [ - 'bool like', - 'address contractAddress,bool trusted', - 'bytes32 eventId,uint8 ticketType,uint32 ticketNum' - ]) { - for (const resolver of [ - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - ZERO_ADDRESS - ]) { - for (const revocable of [true, false]) { - context(`schema=${schema},resolver=${resolver}},revocable=${revocable}`, () => { - it('should properly derive uid', () => { - expect(getSchemaUID(schema, resolver, revocable)).to.equal( - solidityPackedKeccak256(['string', 'address', 'bool'], [schema, resolver, revocable]) - ); - }); - }); - } - } - } - }); -}); From 1dd42d8ffac97ffbfa9bd84263e1217a328b58ba Mon Sep 17 00:00:00 2001 From: lbeder Date: Sat, 5 Oct 2024 21:46:42 +0100 Subject: [PATCH 2/2] Update CHANGLELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baf8fc9..f57c87b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.7.0 -- Move getUID and getSchemaUID to EAS and SchemaRegistry respectably +- Move getUID, getSchemaUID, and getOffchainUID to EAS, SchemaRegistry, and Offchain respectively ## 2.6.1