Skip to content

Commit 351eb8c

Browse files
committed
chore: format echidna harnesses
Run Prettier (with Solidity plugin) to satisfy CI formatting checks. Made-with: Cursor
1 parent af9f7c1 commit 351eb8c

6 files changed

Lines changed: 230 additions & 85 deletions

src/echidna/EchidnaPostageStampHarness.sol

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,13 @@ contract EchidnaPostageStampHarness {
193193
token.transfer(address(_actor(actorId)), x);
194194
}
195195

196-
function act_createBatch(uint8 actorId, uint256 initialPerChunk, uint8 depthRaw, bytes32 nonce, bool immutableFlag)
197-
external
198-
{
196+
function act_createBatch(
197+
uint8 actorId,
198+
uint256 initialPerChunk,
199+
uint8 depthRaw,
200+
bytes32 nonce,
201+
bool immutableFlag
202+
) external {
199203
_clearPending();
200204
uint256 potBefore = stamp.pot();
201205
// Normalize expiry so createBatch's internal expireLimited() doesn't unexpectedly mutate other batches.
@@ -418,7 +422,9 @@ contract EchidnaPostageStampHarness {
418422
}
419423

420424
function echidna_minimumInitialBalancePerChunk_matches_formula() external view returns (bool) {
421-
return stamp.minimumInitialBalancePerChunk() == uint256(stamp.minimumValidityBlocks()) * uint256(stamp.lastPrice());
425+
return
426+
stamp.minimumInitialBalancePerChunk() ==
427+
uint256(stamp.minimumValidityBlocks()) * uint256(stamp.lastPrice());
422428
}
423429

424430
function echidna_lastExpiryBalance_never_exceeds_currentTotalOutPayment() external view returns (bool) {
@@ -469,15 +475,19 @@ contract EchidnaPostageStampHarness {
469475
if (stamp.lastUpdatedBlock() != pendingSetPriceLastUpdatedExpected) return false;
470476
if (stamp.lastPrice() != pendingSetPriceLastPriceExpected) return false;
471477
uint256 blocksSince = block.number - uint256(pendingSetPriceLastUpdatedExpected);
472-
uint256 expected = pendingSetPriceTotalOutPaymentBefore + uint256(pendingSetPriceLastPriceExpected) * blocksSince;
478+
uint256 expected = pendingSetPriceTotalOutPaymentBefore +
479+
uint256(pendingSetPriceLastPriceExpected) *
480+
blocksSince;
473481
return stamp.currentTotalOutPayment() == expected;
474482
}
475483

476484
function echidna_withdraw_postconditions_hold() external view returns (bool) {
477485
if (!pendingWithdraw) return true;
478486
if (stamp.pot() != 0) return false;
479-
if (token.balanceOf(pendingWithdrawBeneficiary) != pendingWithdrawBeneficiaryBalBefore + pendingWithdrawExpectedAmount)
480-
return false;
487+
if (
488+
token.balanceOf(pendingWithdrawBeneficiary) !=
489+
pendingWithdrawBeneficiaryBalBefore + pendingWithdrawExpectedAmount
490+
) return false;
481491
return token.balanceOf(address(stamp)) == pendingWithdrawStampBalBefore - pendingWithdrawExpectedAmount;
482492
}
483493

@@ -506,16 +516,17 @@ contract EchidnaPostageStampHarness {
506516
function _batchDigest(bytes32 batchId) internal view returns (bytes32) {
507517
address owner = stamp.batchOwner(batchId);
508518
if (owner == address(0)) return bytes32(0);
509-
return keccak256(
510-
abi.encodePacked(
511-
owner,
512-
stamp.batchDepth(batchId),
513-
stamp.batchBucketDepth(batchId),
514-
stamp.batchImmutableFlag(batchId),
515-
stamp.batchNormalisedBalance(batchId),
516-
stamp.batchLastUpdatedBlockNumber(batchId)
517-
)
518-
);
519+
return
520+
keccak256(
521+
abi.encodePacked(
522+
owner,
523+
stamp.batchDepth(batchId),
524+
stamp.batchBucketDepth(batchId),
525+
stamp.batchImmutableFlag(batchId),
526+
stamp.batchNormalisedBalance(batchId),
527+
stamp.batchLastUpdatedBlockNumber(batchId)
528+
)
529+
);
519530
}
520531

521532
function _armNonInterference(uint8 batchIndex, bytes32 target) internal {
@@ -598,4 +609,3 @@ contract EchidnaPostageStampHarness {
598609
pendingCreate = true;
599610
}
600611
}
601-

src/echidna/EchidnaPriceOracleHarness.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,3 @@ contract EchidnaPriceOracleHarness {
319319
pendingAdjust = false;
320320
}
321321
}
322-

src/echidna/EchidnaRedistributionClaimHarness.sol

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ contract EchidnaStakeRegistryMock2 is IStakeRegistry {
1717
mapping(address => Node) internal nodes;
1818
mapping(address => uint256) public freezeCount;
1919

20-
function setNode(address owner, bytes32 overlay, uint8 height, uint256 effectiveStake, uint256 lastUpdated) external {
20+
function setNode(
21+
address owner,
22+
bytes32 overlay,
23+
uint8 height,
24+
uint256 effectiveStake,
25+
uint256 lastUpdated
26+
) external {
2127
nodes[owner] = Node({
2228
overlay: overlay,
2329
height: height,
@@ -98,31 +104,58 @@ contract EchidnaPostageStampPotMock is IPostageStamp {
98104

99105
// Unused in this claim-stub harness but required by the interface.
100106
function setPrice(uint256) external {}
101-
function validChunkCount() external view returns (uint256) { return validChunkCountValue; }
102-
function batchOwner(bytes32) external pure returns (address) { return address(0); }
103-
function batchDepth(bytes32) external pure returns (uint8) { return 0; }
104-
function batchBucketDepth(bytes32) external pure returns (uint8) { return 0; }
105-
function remainingBalance(bytes32) external pure returns (uint256) { return 0; }
106-
function minimumInitialBalancePerChunk() external pure returns (uint256) { return 0; }
107-
function batches(bytes32)
107+
function validChunkCount() external view returns (uint256) {
108+
return validChunkCountValue;
109+
}
110+
function batchOwner(bytes32) external pure returns (address) {
111+
return address(0);
112+
}
113+
function batchDepth(bytes32) external pure returns (uint8) {
114+
return 0;
115+
}
116+
function batchBucketDepth(bytes32) external pure returns (uint8) {
117+
return 0;
118+
}
119+
function remainingBalance(bytes32) external pure returns (uint256) {
120+
return 0;
121+
}
122+
function minimumInitialBalancePerChunk() external pure returns (uint256) {
123+
return 0;
124+
}
125+
function batches(
126+
bytes32
127+
)
108128
external
109129
pure
110-
returns (address owner, uint8 depth, uint8 bucketDepth, bool immutableFlag, uint256 normalisedBalance, uint256 lastUpdatedBlockNumber)
130+
returns (
131+
address owner,
132+
uint8 depth,
133+
uint8 bucketDepth,
134+
bool immutableFlag,
135+
uint256 normalisedBalance,
136+
uint256 lastUpdatedBlockNumber
137+
)
111138
{
112139
return (address(0), 0, 0, false, 0, 0);
113140
}
114141
}
115142

116143
contract RedistributionClaimStub is Redistribution {
117-
constructor(address staking, address postageContract, address oracleContract) Redistribution(staking, postageContract, oracleContract) {}
144+
constructor(
145+
address staking,
146+
address postageContract,
147+
address oracleContract
148+
) Redistribution(staking, postageContract, oracleContract) {}
118149

119150
/// @notice Fuzz-only claim: run real winnerSelection(), then withdraw pot to winner.
120151
/// @dev Bypasses inclusion/SOC/stamp proof verification entirely.
121152
function claimStub() external whenNotPaused {
122153
winnerSelection();
123154
Reveal memory winnerSelected = winner;
124155

125-
(bool success, ) = address(PostageContract).call(abi.encodeWithSignature("withdraw(address)", winnerSelected.owner));
156+
(bool success, ) = address(PostageContract).call(
157+
abi.encodeWithSignature("withdraw(address)", winnerSelected.owner)
158+
);
126159
if (!success) {
127160
emit WithdrawFailed(winnerSelected.owner);
128161
}
@@ -209,7 +242,13 @@ contract EchidnaRedistributionClaimHarness {
209242
stampMock.seedPot(x);
210243
}
211244

212-
function act_setActorNode(uint8 actorId, bytes32 overlay, uint8 height, uint256 effectiveStake, uint256 lastUpdated) external {
245+
function act_setActorNode(
246+
uint8 actorId,
247+
bytes32 overlay,
248+
uint8 height,
249+
uint256 effectiveStake,
250+
uint256 lastUpdated
251+
) external {
213252
uint256 idx = uint256(actorId) % ACTOR_COUNT;
214253
uint8 h = uint8(height % 16);
215254
uint256 stake = effectiveStake == 0 ? 1e18 : (effectiveStake % 1e24) + 1;
@@ -347,4 +386,3 @@ contract EchidnaRedistributionClaimHarness {
347386
return 1;
348387
}
349388
}
350-

0 commit comments

Comments
 (0)