Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1062,5 +1062,5 @@
"deployedLinkReferences": {},
"immutableReferences": {},
"inputSourceName": "project/contracts/interfaces/IBondingRegistry.sol",
"buildInfoId": "solc-0_8_28-ee94505d711997b4b070a2e6b0539519e6dc16bf"
"buildInfoId": "solc-0_8_28-ce8ef221f0c6b7e9da5e81af1e5b728128db3d16"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1000,5 +1000,5 @@
"deployedLinkReferences": {},
"immutableReferences": {},
"inputSourceName": "project/contracts/interfaces/ICiphernodeRegistry.sol",
"buildInfoId": "solc-0_8_28-ee94505d711997b4b070a2e6b0539519e6dc16bf"
"buildInfoId": "solc-0_8_28-ce8ef221f0c6b7e9da5e81af1e5b728128db3d16"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1318,13 +1318,7 @@
}
],
"name": "claimRewards",
"outputs": [
{
"internalType": "uint256",
"name": "totalClaimed",
"type": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
Expand Down Expand Up @@ -2433,5 +2427,5 @@
"deployedLinkReferences": {},
"immutableReferences": {},
"inputSourceName": "project/contracts/interfaces/IEnclave.sol",
"buildInfoId": "solc-0_8_28-ee94505d711997b4b070a2e6b0539519e6dc16bf"
"buildInfoId": "solc-0_8_28-ce8ef221f0c6b7e9da5e81af1e5b728128db3d16"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1186,5 +1186,5 @@
"deployedLinkReferences": {},
"immutableReferences": {},
"inputSourceName": "project/contracts/interfaces/ISlashingManager.sol",
"buildInfoId": "solc-0_8_28-ee94505d711997b4b070a2e6b0539519e6dc16bf"
"buildInfoId": "solc-0_8_28-ce8ef221f0c6b7e9da5e81af1e5b728128db3d16"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 7 additions & 17 deletions packages/enclave-contracts/contracts/E3RefundManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ pragma solidity 0.8.28;
import {
Ownable2StepUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand All @@ -27,11 +24,7 @@ import { IBondingRegistry } from "./interfaces/IBondingRegistry.sol";
* @dev Implements fault-attribution based refund system
*
*/
contract E3RefundManager is
IE3RefundManager,
Ownable2StepUpgradeable,
ReentrancyGuardUpgradeable
{
contract E3RefundManager is IE3RefundManager, Ownable2StepUpgradeable {
using SafeERC20 for IERC20;
////////////////////////////////////////////////////////////
// //
Expand Down Expand Up @@ -106,7 +99,6 @@ contract E3RefundManager is
) public initializer {
require(_owner != address(0), "Invalid owner");
__Ownable_init(msg.sender);
__ReentrancyGuard_init();

require(_enclave != address(0), "Invalid enclave");
require(_treasury != address(0), "Invalid treasury");
Expand Down Expand Up @@ -318,7 +310,7 @@ contract E3RefundManager is
/// @inheritdoc IE3RefundManager
function claimRequesterRefund(
uint256 e3Id
) external nonReentrant returns (uint256 amount) {
) external returns (uint256 amount) {
RefundDistribution storage dist = _distributions[e3Id];
if (!dist.calculated) revert RefundNotCalculated(e3Id);

Expand Down Expand Up @@ -348,7 +340,7 @@ contract E3RefundManager is
/// @inheritdoc IE3RefundManager
function claimHonestNodeReward(
uint256 e3Id
) external nonReentrant returns (uint256 amount) {
) external returns (uint256 amount) {
RefundDistribution storage dist = _distributions[e3Id];
require(dist.calculated, RefundNotCalculated(e3Id));

Expand Down Expand Up @@ -639,7 +631,7 @@ contract E3RefundManager is
function withdrawOrphanedSlashedFunds(
uint256 e3Id,
IERC20 paymentToken
) external onlyOwner nonReentrant {
) external onlyOwner {
uint256 amount = _pendingSlashedFunds[e3Id];
require(amount > 0, "No orphaned funds");

Expand Down Expand Up @@ -682,15 +674,15 @@ contract E3RefundManager is
/// @inheritdoc IE3RefundManager
function claimSlashedFundsOnSuccess(
uint256 e3Id
) external nonReentrant returns (uint256 amount) {
) external returns (uint256 amount) {
amount = _claimSlashedFundsOnSuccess(e3Id, msg.sender);
require(amount > 0, NothingToClaim());
}

/// @inheritdoc IE3RefundManager
function claimSlashedFundsOnSuccessBatch(
uint256[] calldata e3Ids
) external nonReentrant {
) external {
uint256 len = e3Ids.length;
uint256 totalClaimed;
for (uint256 i = 0; i < len; i++) {
Expand Down Expand Up @@ -720,9 +712,7 @@ contract E3RefundManager is
}

/// @inheritdoc IE3RefundManager
function treasuryClaim(
IERC20 token
) external nonReentrant returns (uint256 amount) {
function treasuryClaim(IERC20 token) external returns (uint256 amount) {
amount = _pendingTreasury[msg.sender][token];
require(amount > 0, NothingToClaim());
_pendingTreasury[msg.sender][token] = 0;
Expand Down
26 changes: 7 additions & 19 deletions packages/enclave-contracts/contracts/Enclave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import { IPkVerifier } from "./interfaces/IPkVerifier.sol";
import {
Ownable2StepUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand All @@ -30,11 +27,7 @@ import { EnclavePricing } from "./lib/EnclavePricing.sol";
* @dev Coordinates E3 lifecycle including request, activation, input publishing, and output verification
*/
// solhint-disable-next-line max-states-count
contract Enclave is
IEnclave,
Ownable2StepUpgradeable,
ReentrancyGuardUpgradeable
{
contract Enclave is IEnclave, Ownable2StepUpgradeable {
using SafeERC20 for IERC20;

/// @notice Thrown when {renounceOwnership} is called.
Expand Down Expand Up @@ -241,7 +234,6 @@ contract Enclave is
) public initializer {
require(_owner != address(0), "Invalid owner");
__Ownable_init(msg.sender);
__ReentrancyGuard_init();
setMaxDuration(_maxDuration);
setCiphernodeRegistry(_ciphernodeRegistry);
setBondingRegistry(_bondingRegistry);
Expand Down Expand Up @@ -273,7 +265,7 @@ contract Enclave is
/// @inheritdoc IEnclave
function request(
E3RequestParams calldata requestParams
) external nonReentrant returns (uint256 e3Id, E3 memory e3) {
) external returns (uint256 e3Id, E3 memory e3) {
// Fee-token allow-list gate: protects requesters from being
// forced into a fee token they did not consent to (e.g. a malicious
// owner pointing `feeToken` at a fee-on-transfer or rebasing token).
Expand Down Expand Up @@ -385,7 +377,7 @@ contract Enclave is
uint256 e3Id,
bytes calldata ciphertextOutput,
bytes calldata proof
) external nonReentrant returns (bool success) {
) external returns (bool success) {
E3 memory e3 = getE3(e3Id);

E3Stage current = _e3Stages[e3Id];
Expand Down Expand Up @@ -426,7 +418,7 @@ contract Enclave is
uint256 e3Id,
bytes calldata plaintextOutput,
bytes calldata proof
) external nonReentrant returns (bool success) {
) external returns (bool success) {
E3 memory e3 = getE3(e3Id);

// Check we are in the right stage
Expand Down Expand Up @@ -1155,15 +1147,13 @@ contract Enclave is
////////////////////////////////////////////////////////////

/// @inheritdoc IEnclave
function claimReward(
uint256 e3Id
) external nonReentrant returns (uint256 amount) {
function claimReward(uint256 e3Id) external returns (uint256 amount) {
amount = _claimReward(e3Id, msg.sender);
require(amount > 0, NothingToClaim());
}

/// @inheritdoc IEnclave
function claimRewards(uint256[] calldata e3Ids) external nonReentrant {
function claimRewards(uint256[] calldata e3Ids) external {
uint256 len = e3Ids.length;
uint256 totalClaimed;
for (uint256 i = 0; i < len; i++) {
Expand Down Expand Up @@ -1196,9 +1186,7 @@ contract Enclave is
}

/// @inheritdoc IEnclave
function treasuryClaim(
IERC20 token
) external nonReentrant returns (uint256 amount) {
function treasuryClaim(IERC20 token) external returns (uint256 amount) {
amount = _pendingTreasury[msg.sender][token];
require(amount > 0, NothingToClaim());
_pendingTreasury[msg.sender][token] = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ contract BondingRegistry is
function claimExits(
uint256 maxTicketAmount,
uint256 maxLicenseAmount
) external nonReentrant {
) external {
(uint256 ticketClaim, uint256 licenseClaim) = _exits.claimAssets(
msg.sender,
maxTicketAmount,
Expand Down Expand Up @@ -638,7 +638,7 @@ contract BondingRegistry is
IERC20 rewardToken,
address[] calldata recipients,
uint256[] calldata amounts
) external nonReentrant onlyAuthorizedDistributor {
) external onlyAuthorizedDistributor {
require(recipients.length == amounts.length, ArrayLengthMismatch());

uint256 len = recipients.length;
Expand Down Expand Up @@ -799,7 +799,7 @@ contract BondingRegistry is
function withdrawSlashedFunds(
uint256 ticketAmount,
uint256 licenseAmount
) public nonReentrant onlyOwner {
) public onlyOwner {
require(ticketAmount <= slashedTicketBalance, InsufficientBalance());
require(licenseAmount <= slashedLicenseBond, InsufficientBalance());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import { ISlashingManager } from "../interfaces/ISlashingManager.sol";
import {
Ownable2StepUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import {
InternalLazyIMT,
LazyIMTData
Expand All @@ -32,8 +29,7 @@ import { CommitteeHashLib } from "../lib/CommitteeHashLib.sol";
*/
contract CiphernodeRegistryOwnable is
ICiphernodeRegistry,
Ownable2StepUpgradeable,
ReentrancyGuardUpgradeable
Ownable2StepUpgradeable
{
using InternalLazyIMT for LazyIMTData;

Expand Down Expand Up @@ -175,7 +171,6 @@ contract CiphernodeRegistryOwnable is
require(_owner != address(0), ZeroAddress());

__Ownable_init(msg.sender);
__ReentrancyGuard_init();
ciphernodes._init(TREE_DEPTH);
setSortitionSubmissionWindow(_submissionWindow);
if (_owner != owner()) _transferOwnership(_owner);
Expand Down Expand Up @@ -237,7 +232,7 @@ contract CiphernodeRegistryOwnable is
bytes calldata publicKey,
bytes32 pkCommitment,
bytes calldata proof
) external nonReentrant {
) external {
Committee storage c = committees[e3Id];

require(
Expand All @@ -249,6 +244,8 @@ contract CiphernodeRegistryOwnable is

bytes32 committeeHash = CommitteeHashLib.hash(c.topNodes);
c.committeeHash = committeeHash;
c.publicKey = pkCommitment;
publicKeyHashes[e3Id] = pkCommitment;

E3 memory e3 = enclave.getE3(e3Id);
if (e3.proofAggregationEnabled) {
Expand All @@ -268,9 +265,6 @@ contract CiphernodeRegistryOwnable is
);
}

c.publicKey = pkCommitment;
publicKeyHashes[e3Id] = pkCommitment;

enclave.onCommitteePublished(e3Id, pkCommitment);

emit CommitteePublished(
Expand Down Expand Up @@ -377,9 +371,7 @@ contract CiphernodeRegistryOwnable is
/// @dev Can be called by anyone after the deadline. If threshold not met, marks E3 as failed.
/// @param e3Id ID of the E3 computation
/// @return success True if committee formed successfully, false if threshold not met
function finalizeCommittee(
uint256 e3Id
) external nonReentrant returns (bool success) {
function finalizeCommittee(uint256 e3Id) external returns (bool success) {
Committee storage c = committees[e3Id];
require(
c.stage != ICiphernodeRegistry.CommitteeStage.None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import {
} from "@openzeppelin/contracts/access/extensions/AccessControlDefaultAdminRules.sol";
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {
ReentrancyGuard
} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { ISlashingManager } from "../interfaces/ISlashingManager.sol";
import { IBondingRegistry } from "../interfaces/IBondingRegistry.sol";
import { ICiphernodeRegistry } from "../interfaces/ICiphernodeRegistry.sol";
Expand All @@ -32,8 +29,7 @@ import { IE3RefundManager } from "../interfaces/IE3RefundManager.sol";
contract SlashingManager is
ISlashingManager,
AccessControlDefaultAdminRules,
EIP712,
ReentrancyGuard
EIP712
{
// ======================
// Constants & Roles
Expand Down Expand Up @@ -331,7 +327,7 @@ contract SlashingManager is
uint256 e3Id,
address operator,
bytes calldata proof
) external nonReentrant returns (uint256 proposalId) {
) external returns (uint256 proposalId) {
require(operator != address(0), ZeroAddress());
require(proof.length != 0, ProofRequired());

Expand Down Expand Up @@ -457,7 +453,7 @@ contract SlashingManager is

/// @inheritdoc ISlashingManager
/// @dev Executes a deferred Lane A or Lane B proposal after the appeal window has elapsed.
function executeSlash(uint256 proposalId) external nonReentrant {
function executeSlash(uint256 proposalId) external {
require(proposalId < totalProposals, InvalidProposal());
SlashProposal storage p = _proposals[proposalId];
require(!p.executed, AlreadyExecuted());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ contract EnclaveTicketToken is
* @param to Address to payout to.
* @param amount Amount of ticket tokens to payout.
*/
function payout(
address to,
uint256 amount
) external onlyRegistry nonReentrant {
function payout(address to, uint256 amount) external onlyRegistry {
require(amount <= payableBalance, "Exceeds payable balance");
payableBalance -= amount;
SafeERC20.safeTransfer(IERC20(address(underlying())), to, amount);
Expand All @@ -348,7 +345,7 @@ contract EnclaveTicketToken is
IERC20 token,
address to,
uint256 amount
) external onlyOwner nonReentrant {
) external onlyOwner {
if (address(token) == address(underlying())) {
revert CannotRescueUnderlying();
}
Expand Down
Loading