Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: SlashingLib + Snapshots #862

Open
wants to merge 3 commits into
base: slashing-testing
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions src/contracts/libraries/Snapshots.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin-upgrades/contracts/utils/math/MathUpgradeable.sol";
import "@openzeppelin-upgrades/contracts/utils/math/SafeCastUpgradeable.sol";

import "./SlashingLib.sol";

/**
* @title Library for handling snapshots as part of allocating and slashing.
Expand All @@ -22,6 +18,10 @@ import "./SlashingLib.sol";
* _Available since v4.5._
*/
library Snapshots {
error SnapshotKeyDecreased();

uint64 internal constant WAD = 1 ether;

struct DefaultWadHistory {
Snapshot[] _snapshots;
}
Expand Down Expand Up @@ -76,11 +76,12 @@ library Snapshots {
uint256 pos = self.length;

if (pos > 0) {

// Copying to memory is important here.
Snapshot memory last = _unsafeAccess(self, pos - 1);

// Snapshot keys must be non-decreasing.
require(last._key <= key, "Snapshot: decreasing keys");
require(last._key <= key, SnapshotKeyDecreased());

// Update or push new snapshot
if (last._key == key) {
Expand Down
495 changes: 0 additions & 495 deletions src/test/Delegation.t.sol

This file was deleted.

485 changes: 0 additions & 485 deletions src/test/DepositWithdraw.t.sol

This file was deleted.

295 changes: 0 additions & 295 deletions src/test/EigenLayerDeployer.t.sol

This file was deleted.

Loading
Loading