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

Added version view function #270

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/Coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
version: nightly-de33b6af53005037b463318d2628b5cfcaf39916

- name: Run coverage
run: forge coverage --report lcov && mv lcov.info lcov.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/HeavyTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: install foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
version: nightly-de33b6af53005037b463318d2628b5cfcaf39916

- name: run tests
run: forge test --force -vvv --gas-report --match-contract HEAVY_FUZZING
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
version: nightly-de33b6af53005037b463318d2628b5cfcaf39916

- name: Run tests
run: make test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/foundry-gas-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
version: nightly-de33b6af53005037b463318d2628b5cfcaf39916

# Add any step generating a gas report to a temporary file named gasreport.ansi. For example:
- name: Run tests
Expand Down
8 changes: 7 additions & 1 deletion contracts/src/Allowlist.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.20;

import "./interfaces/IAllowlist.1.sol";
import "./interfaces/IVersion.sol";

import "./libraries/LibAllowlistMasks.sol";
import "./Initializable.sol";
Expand All @@ -18,7 +19,7 @@ import "./state/allowlist/Allowlist.sol";
/// @notice each bit represents a right in the system. The DENY_MASK defined the mask
/// @notice used to identify if the denied bit is on, preventing users from interacting
/// @notice with the system
contract AllowlistV1 is IAllowlistV1, Initializable, Administrable {
contract AllowlistV1 is IAllowlistV1, IVersionV1, Initializable, Administrable {
/// @inheritdoc IAllowlistV1
function initAllowlistV1(address _admin, address _allower) external init(0) {
_setAdmin(_admin);
Expand Down Expand Up @@ -158,4 +159,9 @@ contract AllowlistV1 is IAllowlistV1, Initializable, Administrable {

emit SetAllowlistPermissions(_accounts, _permissions);
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/CoverageFund.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.20;
import "./interfaces/IRiver.1.sol";
import "./interfaces/IAllowlist.1.sol";
import "./interfaces/ICoverageFund.1.sol";
import "./interfaces/IVersion.sol";

import "./libraries/LibUint256.sol";
import "./libraries/LibAllowlistMasks.sol";
Expand All @@ -28,7 +29,7 @@ import "./state/slashingCoverage/BalanceForCoverage.sol";
/// @notice the coverage fund will be pulled after the revenue stream, and there won't be any commission on the eth pulled.
/// @notice Once a Slashing event occurs, the team will do its best to inject the recovery funds in at maximum 365 days
/// @notice The entities allowed to donate are selected by the team. It will mainly be treasury entities or insurance protocols able to fill this coverage fund properly.
contract CoverageFundV1 is Initializable, ICoverageFundV1 {
contract CoverageFundV1 is Initializable, ICoverageFundV1, IVersionV1 {
/// @inheritdoc ICoverageFundV1
function initCoverageFundV1(address _riverAddress) external init(0) {
RiverAddress.set(_riverAddress);
Expand Down Expand Up @@ -71,4 +72,9 @@ contract CoverageFundV1 is Initializable, ICoverageFundV1 {
fallback() external payable {
revert InvalidCall();
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/ELFeeRecipient.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.20;

import "./interfaces/IRiver.1.sol";
import "./interfaces/IELFeeRecipient.1.sol";
import "./interfaces/IVersion.sol";

import "./libraries/LibUint256.sol";

Expand All @@ -13,7 +14,7 @@ import "./state/shared/RiverAddress.sol";
/// @title Execution Layer Fee Recipient (v1)
/// @author Kiln
/// @notice This contract receives all the execution layer fees from the proposed blocks + bribes
contract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1 {
contract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1, IVersionV1 {
/// @inheritdoc IELFeeRecipientV1
function initELFeeRecipientV1(address _riverAddress) external init(0) {
RiverAddress.set(_riverAddress);
Expand Down Expand Up @@ -42,4 +43,9 @@ contract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1 {
fallback() external payable {
revert InvalidCall();
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/Firewall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.20;

import "./interfaces/IFirewall.sol";
import "./interfaces/IVersion.sol";

import "./Administrable.sol";

Expand All @@ -14,7 +15,7 @@ import "./Administrable.sol";
/// Random callers cannot call anything through this contract, even if the underlying function
/// is unpermissioned in the underlying contract.
/// Calls to non-admin functions should be called at the underlying contract directly.
contract Firewall is IFirewall, Administrable {
contract Firewall is IFirewall, IVersionV1, Administrable {
/// @inheritdoc IFirewall
address public executor;

Expand Down Expand Up @@ -115,4 +116,9 @@ contract Firewall is IFirewall, Administrable {
_checkCallerRole();
_forward(destination, msg.value);
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/OperatorsRegistry.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.20;

import "./interfaces/IOperatorRegistry.1.sol";
import "./interfaces/IRiver.1.sol";
import "./interfaces/IVersion.sol";

import "./libraries/LibUint256.sol";

Expand All @@ -22,7 +23,7 @@ import "./state/migration/OperatorsRegistry_FundedKeyEventRebroadcasting_Operato
/// @title Operators Registry (v1)
/// @author Kiln
/// @notice This contract handles the list of operators and their keys
contract OperatorsRegistryV1 is IOperatorsRegistryV1, Initializable, Administrable {
contract OperatorsRegistryV1 is IOperatorsRegistryV1, IVersionV1, Initializable, Administrable {
/// @notice Maximum validators given to an operator per selection loop round
uint256 internal constant MAX_VALIDATOR_ATTRIBUTION_PER_ROUND = 5;

Expand Down Expand Up @@ -897,4 +898,9 @@ contract OperatorsRegistryV1 is IOperatorsRegistryV1, Initializable, Administrab
TotalValidatorExitsRequested.set(_newValue);
emit SetTotalValidatorExitsRequested(_currentValue, _newValue);
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/Oracle.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.20;

import "./interfaces/IRiver.1.sol";
import "./interfaces/IOracle.1.sol";
import "./interfaces/IVersion.sol";

import "./Administrable.sol";
import "./Initializable.sol";
Expand All @@ -17,7 +18,7 @@ import "./state/oracle/ReportsPositions.sol";
/// @title Oracle (v1)
/// @author Kiln
/// @notice This contract handles the input from the allowed oracle members. Highly inspired by Lido's implementation.
contract OracleV1 is IOracleV1, Initializable, Administrable {
contract OracleV1 is IOracleV1, IVersionV1, Initializable, Administrable {
modifier onlyAdminOrMember(address _oracleMember) {
if (msg.sender != _getAdmin() && msg.sender != _oracleMember) {
revert LibErrors.Unauthorized(msg.sender);
Expand Down Expand Up @@ -280,4 +281,9 @@ contract OracleV1 is IOracleV1, Initializable, Administrable {
function _river() internal view returns (IRiverV1) {
return IRiverV1(payable(RiverAddress.get()));
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/RedeemManager.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.20;
import "./interfaces/IAllowlist.1.sol";
import "./interfaces/IRiver.1.sol";
import "./interfaces/IRedeemManager.1.sol";
import "./interfaces/IVersion.sol";
import "./libraries/LibAllowlistMasks.sol";
import "./libraries/LibUint256.sol";
import "./Initializable.sol";
Expand All @@ -17,7 +18,7 @@ import "./state/redeemManager/RedeemDemand.sol";
/// @title Redeem Manager (v1)
/// @author Kiln
/// @notice This contract handles the redeem requests of all users
contract RedeemManagerV1 is Initializable, IRedeemManagerV1 {
contract RedeemManagerV1 is Initializable, IRedeemManagerV1, IVersionV1 {
/// @notice Value returned when resolving a redeem request that is unsatisfied
int64 internal constant RESOLVE_UNSATISFIED = -1;
/// @notice Value returned when resolving a redeem request that is out of bounds
Expand Down Expand Up @@ -548,4 +549,9 @@ contract RedeemManagerV1 is Initializable, IRedeemManagerV1 {
emit SetRedeemDemand(RedeemDemand.get(), _newValue);
RedeemDemand.set(_newValue);
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
9 changes: 8 additions & 1 deletion contracts/src/River.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "./interfaces/IRiver.1.sol";
import "./interfaces/IWithdraw.1.sol";
import "./interfaces/IELFeeRecipient.1.sol";
import "./interfaces/ICoverageFund.1.sol";
import "./interfaces/IVersion.sol";

import "./components/ConsensusLayerDepositManager.1.sol";
import "./components/UserDepositManager.1.sol";
Expand Down Expand Up @@ -38,7 +39,8 @@ contract RiverV1 is
OracleManagerV1,
Initializable,
Administrable,
IRiverV1
IRiverV1,
IVersionV1
{
/// @inheritdoc IRiverV1
function initRiverV1(
Expand Down Expand Up @@ -609,4 +611,9 @@ contract RiverV1 is
_setBalanceToDeposit(currentBalanceToDeposit - currentMaxCommittableAmount);
}
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 7 additions & 1 deletion contracts/src/Withdraw.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.20;
import "./Initializable.sol";
import "./interfaces/IRiver.1.sol";
import "./interfaces/IWithdraw.1.sol";
import "./interfaces/IVersion.sol";
import "./libraries/LibErrors.sol";
import "./libraries/LibUint256.sol";

Expand All @@ -12,7 +13,7 @@ import "./state/shared/RiverAddress.sol";
/// @title Withdraw (v1)
/// @author Kiln
/// @notice This contract is in charge of holding the exit and skimming funds and allow river to pull these funds
contract WithdrawV1 is IWithdrawV1, Initializable {
contract WithdrawV1 is IWithdrawV1, Initializable, IVersionV1 {
modifier onlyRiver() {
if (msg.sender != RiverAddress.get()) {
revert LibErrors.Unauthorized(msg.sender);
Expand Down Expand Up @@ -51,4 +52,9 @@ contract WithdrawV1 is IWithdrawV1, Initializable {
RiverAddress.set(_river);
emit SetRiver(_river);
}

/// @inheritdoc IVersionV1
function version() external pure returns (string memory) {
return "1.0.0";
}
}
8 changes: 8 additions & 0 deletions contracts/src/interfaces/IVersion.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

interface IVersionV1 {
/// @notice Retrieves the version of the contract
/// @return Version of the contract
function version() external pure returns (string memory);
}
4 changes: 4 additions & 0 deletions contracts/test/Allowlist.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,8 @@ contract AllowlistV1Tests is AllowlistV1TestBase {
vm.expectRevert(abi.encodeWithSignature("InvalidCount()"));
allowlist.setAllowPermissions(allowees, permissions);
}

function testVersion() external {
assertEq(allowlist.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/CoverageFund.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,8 @@ contract CoverageFundTestV1 is CoverageFundV1TestBase {
river.pullCoverageFunds(address(coverageFund), 0);
assertEq(0, address(river).balance);
}

function testVersion() external {
assertEq(coverageFund.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/ELFeeRecipient.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,8 @@ contract ELFeeRecipientV1Test is ELFeeRecipientV1TestBase {
address(feeRecipient).call{value: 1e18}(abi.encodeWithSignature("Hello()"));
vm.stopPrank();
}

function testVersion() external {
assertEq(feeRecipient.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/Firewall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,8 @@ contract FirewallTests is BytesGenerator, Test {
riverFirewall.setExecutor(don);
vm.stopPrank();
}

function testVersion() external {
assertEq(riverFirewall.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/OperatorsRegistry.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3076,4 +3076,8 @@ contract OperatorsRegistryV1TestDistribution is Test {
assert(publicKeys.length == 0);
assert(signatures.length == 0);
}

function testVersion() external {
assertEq(operatorsRegistry.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/Oracle.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -742,4 +742,8 @@ contract OracleV1Tests is OracleV1TestBase {
function testGetReportVariantCount() external {
assertEq(0, oracle.getReportVariantsCount());
}

function testVersion() external {
assertEq(oracle.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/RedeemManager.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1722,4 +1722,8 @@ contract RedeemManagerV1Tests is Test {
vm.prank(user2);
redeemManager.claimRedeemRequests(redeemRequestIds, withdrawEventIds, true, type(uint16).max);
}

function testVersion() external {
assertEq(redeemManager.version(), "1.0.0");
}
}
4 changes: 4 additions & 0 deletions contracts/test/River.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ contract RiverV1Tests is RiverV1TestBase {
vm.stopPrank();
}

function testVersion() external {
assertEq(river.version(), "1.0.0");
}

function testOnlyAdminCanSetKeeper() public {
address keeper = makeAddr("keeper");
assert(river.getKeeper() == admin);
Expand Down
4 changes: 4 additions & 0 deletions contracts/test/Withdraw.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,8 @@ contract WithdrawV1Tests is WithdrawV1TestBase {
river.debug_pullFunds(address(withdraw), 0);
assertEq(0, address(river).balance);
}

function testVersion() external {
assertEq(withdraw.version(), "1.0.0");
}
}
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ optimizer_runs = 100

[rpc_endpoints]
mainnet = "${MAINNET_FORK_RPC_URL}"

[fuzz]
runs = 1500
Loading