-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * Validator test WIP, forge doesn't compile yet * buildable * most of the foundry tests working * Validator related tests fixed * truffle build working * cache bump * lint + prettify+ migrations * Enable optimization for Solidity 0.8 * prettify * Ci bump * CI bump 2 * Validators to 0.8 config * CI bump * foundry fix * Truffle migrations are partly fixed * Added import for ValidatorsMock08 in EpochManager.t.sol, I think it was removed by mistake * Added yarn.lock * Changes to mock with full implementation * Attempt to fix linking libraries not working with deployCodeTo https://github.com/foundry-rs/foundry/issues/4049 * truffle migrations fixed * CI bump * lint * forge test fixes * artifacts test fix * lint * update of foundry version * add ProxyFactory import to tests * library linking fix * Foundry migrations fix * migration tests fix * CI bump * Little cleanup + retrigger CI * forgot to commit Validators.sol * Fixed the ABI encoded * lint * Fix contract versions * add Adapter to ignored contracts * revert of ReentrancyGuard change * lint fix * remove adapters from check * storage layout fix --------- Co-authored-by: pahor167 <[email protected]>
- Loading branch information
Showing
47 changed files
with
891 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/protocol/contracts-0.8/common/interfaces/IPrecompiles.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.13 <0.9.0; | ||
|
||
interface IPrecompiles { | ||
function getEpochSize() external view returns (uint256); | ||
function getEpochNumber() external view returns (uint256); | ||
} |
106 changes: 106 additions & 0 deletions
106
packages/protocol/contracts-0.8/common/linkedlists/AddressLinkedList.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
pragma solidity >=0.8.0 <0.8.20; | ||
|
||
import "@openzeppelin/contracts8/utils/math/SafeMath.sol"; | ||
|
||
import "./LinkedList.sol"; | ||
|
||
/** | ||
* @title Maintains a doubly linked list keyed by address. | ||
* @dev Following the `next` pointers will lead you to the head, rather than the tail. | ||
*/ | ||
library AddressLinkedList { | ||
using LinkedList for LinkedList.List; | ||
using SafeMath for uint256; | ||
/** | ||
* @notice Inserts an element into a doubly linked list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param key The key of the element to insert. | ||
* @param previousKey The key of the element that comes before the element to insert. | ||
* @param nextKey The key of the element that comes after the element to insert. | ||
*/ | ||
function insert( | ||
LinkedList.List storage list, | ||
address key, | ||
address previousKey, | ||
address nextKey | ||
) public { | ||
list.insert(toBytes(key), toBytes(previousKey), toBytes(nextKey)); | ||
} | ||
|
||
/** | ||
* @notice Inserts an element at the end of the doubly linked list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param key The key of the element to insert. | ||
*/ | ||
function push(LinkedList.List storage list, address key) public { | ||
list.insert(toBytes(key), bytes32(0), list.tail); | ||
} | ||
|
||
/** | ||
* @notice Removes an element from the doubly linked list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param key The key of the element to remove. | ||
*/ | ||
function remove(LinkedList.List storage list, address key) public { | ||
list.remove(toBytes(key)); | ||
} | ||
|
||
/** | ||
* @notice Updates an element in the list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param key The element key. | ||
* @param previousKey The key of the element that comes before the updated element. | ||
* @param nextKey The key of the element that comes after the updated element. | ||
*/ | ||
function update( | ||
LinkedList.List storage list, | ||
address key, | ||
address previousKey, | ||
address nextKey | ||
) public { | ||
list.update(toBytes(key), toBytes(previousKey), toBytes(nextKey)); | ||
} | ||
|
||
/** | ||
* @notice Returns whether or not a particular key is present in the sorted list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param key The element key. | ||
* @return Whether or not the key is in the sorted list. | ||
*/ | ||
function contains(LinkedList.List storage list, address key) public view returns (bool) { | ||
return list.elements[toBytes(key)].exists; | ||
} | ||
|
||
/** | ||
* @notice Returns the N greatest elements of the list. | ||
* @param list A storage pointer to the underlying list. | ||
* @param n The number of elements to return. | ||
* @return The keys of the greatest elements. | ||
* @dev Reverts if n is greater than the number of elements in the list. | ||
*/ | ||
function headN(LinkedList.List storage list, uint256 n) public view returns (address[] memory) { | ||
bytes32[] memory byteKeys = list.headN(n); | ||
address[] memory keys = new address[](n); | ||
for (uint256 i = 0; i < n; i = i.add(1)) { | ||
keys[i] = toAddress(byteKeys[i]); | ||
} | ||
return keys; | ||
} | ||
|
||
/** | ||
* @notice Gets all element keys from the doubly linked list. | ||
* @param list A storage pointer to the underlying list. | ||
* @return All element keys from head to tail. | ||
*/ | ||
function getKeys(LinkedList.List storage list) public view returns (address[] memory) { | ||
return headN(list, list.numElements); | ||
} | ||
|
||
function toBytes(address a) public pure returns (bytes32) { | ||
return bytes32(uint256(uint160(a)) << 96); | ||
} | ||
|
||
function toAddress(bytes32 b) public pure returns (address) { | ||
return address(uint160(uint256(b) >> 96)); | ||
} | ||
} |
Oops, something went wrong.