Skip to content

Commit

Permalink
Merge pull request #2 from EthSign/feat/v1.1.3
Browse files Browse the repository at this point in the history
v1.1.3
  • Loading branch information
boyuanx authored Jul 19, 2024
2 parents d607fc3 + 7b065f8 commit 31b7de1
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 93 deletions.
Empty file removed �@���@8
Empty file.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.24+commit.e11b9ed9",
"solidity.compileUsingRemoteVersion": "v0.8.26+commit.8a97fa7a",
"editor.formatOnSave": true,
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[profile.default]
src = "src"
out = "out"
solc = "0.8.23"
solc = "0.8.26"
bytecode_hash = "none"
optimizer = true
optimizer_runs = 50
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.24",
version: "0.8.26",
settings: {
optimizer: {
enabled: true,
Expand Down
41 changes: 6 additions & 35 deletions src/core/SP.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity ^0.8.20;
pragma solidity ^0.8.26;

import { ISP } from "../interfaces/ISP.sol";
import { ISPHook } from "../interfaces/ISPHook.sol";
Expand Down Expand Up @@ -89,34 +89,6 @@ contract SP is ISP, UUPSUpgradeable, OwnableUpgradeable {
_callGlobalHook();
}

function registerBatch(
Schema[] calldata schemas,
bytes calldata delegateSignature
)
external
override
returns (uint64[] memory schemaIds)
{
bool delegateMode = delegateSignature.length != 0;
address registrant = schemas[0].registrant;
if (delegateMode) {
// solhint-disable-next-line max-line-length
__checkDelegationSignature(schemas[0].registrant, getDelegatedRegisterBatchHash(schemas), delegateSignature);
} else {
if (schemas[0].registrant != _msgSender()) {
revert SchemaWrongRegistrant();
}
}
schemaIds = new uint64[](schemas.length);
for (uint256 i = 0; i < schemas.length; i++) {
if (delegateMode && schemas[i].registrant != registrant) {
revert SchemaWrongRegistrant();
}
schemaIds[i] = _register(schemas[i]);
}
_callGlobalHook();
}

function attest(
Attestation calldata attestation,
string calldata indexingKey,
Expand Down Expand Up @@ -605,17 +577,13 @@ contract SP is ISP, UUPSUpgradeable, OwnableUpgradeable {
}

function version() external pure override returns (string memory) {
return "1.1.2";
return "1.1.3";
}

function getDelegatedRegisterHash(Schema memory schema) public pure override returns (bytes32) {
return keccak256(abi.encode(REGISTER_ACTION_NAME, schema));
}

function getDelegatedRegisterBatchHash(Schema[] memory schemas) public pure override returns (bytes32) {
return keccak256(abi.encode(REGISTER_ACTION_NAME, schemas));
}

function getDelegatedAttestHash(Attestation memory attestation) public pure override returns (bytes32) {
return keccak256(abi.encode(ATTEST_ACTION_NAME, attestation));
}
Expand Down Expand Up @@ -701,6 +669,7 @@ contract SP is ISP, UUPSUpgradeable, OwnableUpgradeable {
emit SchemaRegistered(schemaId);
}

// solhint-disable-next-line code-complexity
function _attest(
Attestation memory attestation,
string memory indexingKey,
Expand All @@ -713,7 +682,6 @@ contract SP is ISP, UUPSUpgradeable, OwnableUpgradeable {
if ($.paused) revert Paused();
attestationId = $.attestationCounter++;
attestation.attestTimestamp = uint64(block.timestamp);
attestation.revokeTimestamp = 0;
// In delegation mode, the attester is already checked ahead of time.
if (!delegateMode && attestation.attester != _msgSender()) {
revert AttestationWrongAttester();
Expand All @@ -727,6 +695,9 @@ contract SP is ISP, UUPSUpgradeable, OwnableUpgradeable {
) {
revert AttestationWrongAttester();
}
if (attestation.revoked || attestation.revokeTimestamp > 0) {
revert AttestationAlreadyRevoked();
}
Schema memory s = $.schemaRegistry[attestation.schemaId];
if (!__schemaExists(attestation.schemaId)) revert SchemaNonexistent();
if (s.maxValidFor > 0) {
Expand Down
15 changes: 0 additions & 15 deletions src/interfaces/ISP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,6 @@ interface ISP is IVersionable {
)
external;

/**
* @notice Batch registers a Schema.
*/
function registerBatch(
Schema[] calldata schemas,
bytes calldata delegateSignature
)
external
returns (uint64[] calldata schemaIds);

/**
* @notice Batch attests.
*/
Expand Down Expand Up @@ -359,11 +349,6 @@ interface ISP is IVersionable {
*/
function getDelegatedRegisterHash(Schema memory schema) external pure returns (bytes32);

/**
* @notice Returns the hash that will be used to authorize a delegated batch registration.
*/
function getDelegatedRegisterBatchHash(Schema[] memory schemas) external pure returns (bytes32);

/**
* @notice Returns the hash that will be used to authorize a delegated attestation.
*/
Expand Down
Loading

0 comments on commit 31b7de1

Please sign in to comment.