Skip to content

Commit

Permalink
Merge pull request #150 from gnosisguild/auryn/add-block-timestamp-to-e3
Browse files Browse the repository at this point in the history
add: block number to e3 struct
  • Loading branch information
auryn-macmillan authored Oct 18, 2024
2 parents c75f232 + 1fbb950 commit 95d32d8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/evm/contracts/Enclave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
e3 = E3({
seed: seed,
threshold: threshold,
requestBlock: block.number,
startWindow: startWindow,
duration: duration,
expiration: 0,
Expand Down
2 changes: 2 additions & 0 deletions packages/evm/contracts/interfaces/IE3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IDecryptionVerifier } from "./IDecryptionVerifier.sol";
/// @title E3 struct
/// @notice This struct represents an E3 computation.
/// @param threshold M/N threshold for the committee.
/// @param requestBlock Block number when the E3 was requested.
/// @param startWindow Start window for the computation: index zero is minimum, index 1 is the maxium.
/// @param duration Duration of the E3.
/// @param expiration Timestamp when committee duties expire.
Expand All @@ -21,6 +22,7 @@ import { IDecryptionVerifier } from "./IDecryptionVerifier.sol";
struct E3 {
uint256 seed;
uint32[2] threshold;
uint256 requestBlock;
uint256[2] startWindow;
uint256 duration;
uint256 expiration;
Expand Down
10 changes: 10 additions & 0 deletions packages/evm/contracts/registry/NaiveRegistryFilter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ contract NaiveRegistryFilter is IRegistryFilter, OwnableUpgradeable {
error CommitteeAlreadyPublished();
error CommitteeDoesNotExist();
error CommitteeNotPublished();
error CiphernodeNotEnabled(address ciphernode);
error OnlyRegistry();

////////////////////////////////////////////////////////////
Expand All @@ -47,6 +48,15 @@ contract NaiveRegistryFilter is IRegistryFilter, OwnableUpgradeable {
_;
}

modifier onlyOwnerOrCiphernode() {
require(
msg.sender == owner() ||
ICiphernodeRegistry(registry).isCiphernodeEligible(msg.sender),
CiphernodeNotEnabled(msg.sender)
);
_;
}

////////////////////////////////////////////////////////////
// //
// Initialization //
Expand Down
2 changes: 2 additions & 0 deletions packages/evm/test/Enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,12 @@ describe("Enclave", function () {
{ value: 10 },
);
const e3 = await enclave.getE3(0);
const block = await ethers.provider.getBlock("latest").catch((e) => e);

expect(e3.threshold).to.deep.equal(request.threshold);
expect(e3.expiration).to.equal(0n);
expect(e3.e3Program).to.equal(request.e3Program);
expect(e3.requestBlock).to.equal(block.number);
expect(e3.inputValidator).to.equal(
await mocks.inputValidator.getAddress(),
);
Expand Down

0 comments on commit 95d32d8

Please sign in to comment.