Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidu28 committed Dec 26, 2023
1 parent 8ea334d commit dcf8a04
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/contracts/interfaces/IEigenPodManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ interface IEigenPodManager is IPausable {
struct WithdrawalCallbackInfo {
// oracle timestamp
uint64 oracleTimestamp;
// prover fee
uint64 feeGwei;
// prover fee for each pod being proven for
uint64[] feesGwei;
/// @notice SNARK proof acting as the cryptographic seal over the execution results.
bytes seal;
/// @notice Digest of the zkVM SystemState after execution.
Expand Down
10 changes: 6 additions & 4 deletions src/contracts/pods/EigenPod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,17 @@ contract EigenPod is IEigenPod, Initializable, ReentrancyGuardUpgradeable, Eigen
require(verifiedPartialWithdrawal.mostRecentWithdrawalTimestamp == mostRecentWithdrawalTimestamp, "EigenPod.fulfillPartialWithdrawalProofRequest: proven mostRecentWithdrawalTimestamp must match mostRecentWithdrawalTimestamp in the EigenPod");
require(mostRecentWithdrawalTimestamp < verifiedPartialWithdrawal.endTimestamp, "EigenPod.fulfillPartialWithdrawalProofRequest: mostRecentWithdrawalTimestamp must precede endTimestamp");

require(sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei + feeGwei <= verifiedPartialWithdrawal.provenPartialWithdrawalSumGwei, "EigenPod.fulfillPartialWithdrawalProofRequest: proven sum must be less than or equal to provenPartialWithdrawalSumGwei + feeGwei");
require(sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei <= verifiedPartialWithdrawal.provenPartialWithdrawalSumGwei - feeGwei, "EigenPod.fulfillPartialWithdrawalProofRequest: proven sum must be less than or equal to provenPartialWithdrawalSumGwei + feeGwei");
uint64 provenPartialWithdrawalSumGwei = verifiedPartialWithdrawal.provenPartialWithdrawalSumGwei;
provenPartialWithdrawalSumGwei -= feeGwei;


// subtract an partial withdrawals that may have been claimed via merkle proofs
provenPartialWithdrawalSumGwei -= sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei;
sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei = 0;
_sendETH_AsDelayedWithdrawal(podOwner, provenPartialWithdrawalSumGwei);
if(provenPartialWithdrawalSumGwei > sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei){
provenPartialWithdrawalSumGwei -= sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei;
sumOfPartialWithdrawalsClaimedViaMerkleProvenGwei = 0;
_sendETH_AsDelayedWithdrawal(podOwner, provenPartialWithdrawalSumGwei);
}

mostRecentWithdrawalTimestamp = verifiedPartialWithdrawal.endTimestamp;

Expand Down
3 changes: 1 addition & 2 deletions src/contracts/pods/EigenPodManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ contract EigenPodManager is

// these checks are verified in the snark, we add them here again as a sanity check
require(callbackInfo.oracleTimestamp >= journal.endTimestamps[i], "EigenPodManager.proofServiceCallback: oracle timestamp must be greater than or equal to callback timestamp");
require(callbackInfo.feeGwei <= journal.maxFeesGwei[i], "EigenPodManager.proofServiceCallback: fee must be less than or equal to maxFee");
require(callbackInfo.feesGwei[i] <= journal.maxFeesGwei[i], "EigenPodManager.proofServiceCallback: fee must be less than or equal to maxFee");

//ensure the correct pod is being called
IEigenPod pod = ownerToPod[journal.podOwners[i]];
Expand All @@ -248,7 +248,6 @@ contract EigenPodManager is
provenPartialWithdrawalSumGwei: journal.provenPartialWithdrawalSumsGwei[i],
mostRecentWithdrawalTimestamp: journal.mostRecentWithdrawalTimestamps[i],
endTimestamp: journal.endTimestamps[i]

});

pod.fulfillPartialWithdrawalProofRequest(partialWithdrawal, callbackInfo.feeGwei, proofService.feeRecipient);
Expand Down
4 changes: 3 additions & 1 deletion src/test/unit/EigenPodUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,10 @@ contract EigenPodUnitTests_OffchainPartialWithdrawalProofTests is EigenPodUnitTe
}

function testFuzz_proofCallbackRequest_PartialWithdrawalSumEqualsAlreadyProvenSum(uint64 endTimestamp, uint64 sumOfPartialWithdrawalsClaimedGwei, uint64 provenAmount, uint64 fee) external {
cheats.assume(sumOfPartialWithdrawalsClaimedGwei < 1000);
cheats.assume(fee < 1000);
cheats.assume(sumOfPartialWithdrawalsClaimedGwei + fee > provenAmount);
cheats.assume(sumOfPartialWithdrawalsClaimedGwei + fee < 1000);

cheats.assume(eigenPod.mostRecentWithdrawalTimestamp() < endTimestamp);
bytes32 slot = bytes32(uint256(56));
bytes32 value = bytes32(uint256(sumOfPartialWithdrawalsClaimedGwei));
Expand Down

0 comments on commit dcf8a04

Please sign in to comment.