Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bgd-labs/aave-delivery-infrastructu…
Browse files Browse the repository at this point in the history
…re into feat/linea
  • Loading branch information
sendra committed Dec 10, 2024
2 parents df0bd2e + 75ad342 commit ef0978b
Show file tree
Hide file tree
Showing 22 changed files with 75 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/certora-review-controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.19
sudo mv solc-static-linux /usr/local/bin/solc8.20
- name: Verify rule ${{ matrix.rule }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/certora-review-forwarder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.19
sudo mv solc-static-linux /usr/local/bin/solc8.20
- name: Verify rule ${{ matrix.rule }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/certora-review-receiver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.19
sudo mv solc-static-linux /usr/local/bin/solc8.20
- name: Verify rule ${{ matrix.rule }}
run: |
Expand All @@ -51,6 +51,6 @@ jobs:
max-parallel: 16
matrix:
rule:
- verifyCrossChainReceiver.conf
- verifyCrossChainReceiver.conf


4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = release-v4.9
[submodule "lib/solidity-utils"]
path = lib/solidity-utils
url = https://github.com/bgd-labs/solidity-utils
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ evm_version = 'shanghai'

fs_permissions = [{ access = "read-write", path = "./"}]

solc = "0.8.19"
solc = "0.8.20"

[profile.default.zksync]
fallback_oz = true
Expand Down
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from dc44c9
2 changes: 1 addition & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
solidity-utils/=lib/solidity-utils/src/
forge-std/=lib/solidity-utils/lib/forge-std/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"process": "emv",
"prover_args": [
" -copyLoopUnroll 8"
],
"smt_timeout": "6000",
"solc": "solc8.19",
"solc": "solc8.20",
// "rule_sanity": "basic",
"verify": "CrossChainControllerWithEmergencyModeHarness:security/certora/specs/CrossChainControllerWithEmergencyMode.spec"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarnessED:security/certora/specs/CrossChainForwarder-encode-decode-correct.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/CrossChainForwarder-envelopRetry.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/invariants.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/CrossChainForwarder-newEnvelope.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
4 changes: 2 additions & 2 deletions security/certora/confs/verifyCrossChainForwarder-sanity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/CrossChainForwarder-sanity.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
4 changes: 2 additions & 2 deletions security/certora/confs/verifyCrossChainForwarder-shuffle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/CrossChainForwarder-shuffle.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"verify": "CrossChainForwarderHarness:security/certora/specs/CrossChainForwarder-simpleRules.spec",
"solc": "solc8.19",
"solc": "solc8.20",
"optimistic_hashing": true,
"hashing_length_bound": "384", // This is the minimal value that passes sanity
"optimistic_loop": true,
Expand Down
4 changes: 2 additions & 2 deletions security/certora/confs/verifyCrossChainReceiver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"packages": [
"solidity-utils/=lib/solidity-utils/src",
"forge-std/=lib/solidity-utils/lib/forge-std/src",
"openzeppelin-contracts/=lib/openzeppelin-contracts",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
],
"process": "emv",
"prover_args": [
Expand All @@ -22,7 +22,7 @@
//"prover_version" : "EyalH/FixSanityRuleToBaseMatching",
"smt_timeout": "6000",
"disable_auto_cache_key_gen" :true,
"solc": "solc8.19",
"solc": "solc8.20",
"rule_sanity": "basic",
"verify": "CrossChainReceiverHarness:security/certora/specs/CrossChainReceiver.spec"
}
15 changes: 11 additions & 4 deletions src/contracts/BaseCrossChainController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.8;

import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {IRescuable} from 'solidity-utils/contracts/utils/interfaces/IRescuable.sol';
import {Rescuable, RescuableBase, IERC20} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {IRescuable, IRescuableBase} from 'solidity-utils/contracts/utils/interfaces/IRescuable.sol';
import {CrossChainReceiver} from './CrossChainReceiver.sol';
import {CrossChainForwarder} from './CrossChainForwarder.sol';
import {Errors} from './libs/Errors.sol';
Expand Down Expand Up @@ -61,11 +61,18 @@ contract BaseCrossChainController is
);
}

/// @inheritdoc IRescuable
function whoCanRescue() public view override(IRescuable, Rescuable) returns (address) {
/// @inheritdoc Rescuable
function whoCanRescue() public view override(Rescuable) returns (address) {
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(IRescuableBase, RescuableBase) returns (uint256) {
return IERC20(erc20Token).balanceOf(address(this));
}

/// @notice Enable contract to receive ETH/Native token
receive() external payable {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.8;
import {ICrossChainForwarder} from '../interfaces/ICrossChainForwarder.sol';
import {ICrossChainControllerWithEmergencyMode} from '../interfaces/ICrossChainControllerWithEmergencyMode.sol';
import {IGranularGuardianAccessControl, Envelope, ICrossChainReceiver} from './IGranularGuardianAccessControl.sol';
import {AccessControlEnumerable} from 'openzeppelin-contracts/contracts/access/AccessControlEnumerable.sol';
import {AccessControlEnumerable} from 'openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol';
import {IWithGuardian} from 'solidity-utils/contracts/access-control/OwnableWithGuardian.sol';
import {ICrossChainControllerWithEmergencyModeDeprecated} from '../interfaces/ICrossChainControllerWithEmergencyModeDeprecated.sol';

Expand Down
10 changes: 6 additions & 4 deletions tests/BaseCrossChainController.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-prox
import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
import {Errors} from '../src/contracts/libs/Errors.sol';
import {IBaseAdapter} from '../src/contracts/adapters/IBaseAdapter.sol';
import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
import {IRescuable} from 'solidity-utils/contracts/utils/interfaces/IRescuable.sol';

abstract contract BaseCrossChainControllerTest is Test {
address public constant OWNER = address(65536 + 123);
Expand Down Expand Up @@ -104,7 +106,7 @@ abstract contract BaseCrossChainControllerTest is Test {
crossChainController = IBaseCrossChainController(
proxyFactory.createDeterministic(
crossChainControllerImpl,
proxyAdmin,
ProxyAdmin(proxyAdmin),
_getEncodedInitializer(
OWNER,
GUARDIAN,
Expand Down Expand Up @@ -144,7 +146,7 @@ abstract contract BaseCrossChainControllerTest is Test {
vm.expectRevert(bytes(Errors.INVALID_REQUIRED_CONFIRMATIONS));
proxyFactory.createDeterministic(
crossChainControllerImpl,
proxyAdmin,
ProxyAdmin(proxyAdmin),
_getEncodedInitializer(
OWNER,
GUARDIAN,
Expand Down Expand Up @@ -191,7 +193,7 @@ abstract contract BaseCrossChainControllerTest is Test {

address recipient = address(1230123519);

vm.expectRevert((bytes('ONLY_RESCUE_GUARDIAN')));
vm.expectRevert(abi.encodeWithSelector(IRescuable.OnlyRescueGuardian.selector));
crossChainController.emergencyEtherTransfer(recipient, 5 ether);
}

Expand Down Expand Up @@ -224,7 +226,7 @@ abstract contract BaseCrossChainControllerTest is Test {

address recipient = address(1230123519);

vm.expectRevert((bytes('ONLY_RESCUE_GUARDIAN')));
vm.expectRevert(abi.encodeWithSelector(IRescuable.OnlyRescueGuardian.selector));
crossChainController.emergencyTokenTransfer(address(testToken), recipient, 3 ether);
}
}
2 changes: 1 addition & 1 deletion tests/CrossChainControllerWithEmergencyMode.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract CrossChainControllerWithEmergencyModeTest is BaseCrossChainControllerTe
vm.expectRevert(bytes(Errors.INVALID_EMERGENCY_ORACLE));
proxyFactory.createDeterministic(
crossChainControllerImpl,
proxyAdmin,
ProxyAdmin(proxyAdmin),
abi.encodeWithSelector(
ICrossChainControllerWithEmergencyMode.initialize.selector,
OWNER,
Expand Down
44 changes: 20 additions & 24 deletions tests/access_control/GranularGuardianAccessControl.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {TestUtils} from '../utils/TestUtils.sol';
import '../../src/contracts/access_control/GranularGuardianAccessControl.sol';
import {OwnableWithGuardian, IWithGuardian} from 'solidity-utils/contracts/access-control/OwnableWithGuardian.sol';
import '../BaseTest.sol';
import {IAccessControl} from 'openzeppelin-contracts/contracts/access/IAccessControl.sol';

contract GranularGuardianAccessControlTest is BaseTest {
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
Expand Down Expand Up @@ -105,13 +106,12 @@ contract GranularGuardianAccessControlTest is BaseTest {
) public setUpGranularGuardians(defaultAdmin, retryGuardian, solveEmergencyGuardian, ccc) {
vm.assume(retryCaller != retryGuardian);
hoax(retryCaller);

vm.expectRevert(
bytes(
string.concat(
'AccessControl: account 0x',
TestUtils.toAsciiString(retryCaller),
' is missing role 0xc448b9502bbdf9850cc39823b6ea40cfe96d3ac63008e89edd2b8e98c6cc0af3'
)
abi.encodeWithSelector(
IAccessControl.AccessControlUnauthorizedAccount.selector,
retryCaller,
0xc448b9502bbdf9850cc39823b6ea40cfe96d3ac63008e89edd2b8e98c6cc0af3
)
);
_retryTx(ccc);
Expand Down Expand Up @@ -141,13 +141,12 @@ contract GranularGuardianAccessControlTest is BaseTest {
) public setUpGranularGuardians(defaultAdmin, retryGuardian, solveEmergencyGuardian, ccc) {
vm.assume(retryCaller != retryGuardian);
hoax(retryCaller);

vm.expectRevert(
bytes(
string.concat(
'AccessControl: account 0x',
TestUtils.toAsciiString(retryCaller),
' is missing role 0xc448b9502bbdf9850cc39823b6ea40cfe96d3ac63008e89edd2b8e98c6cc0af3'
)
abi.encodeWithSelector(
IAccessControl.AccessControlUnauthorizedAccount.selector,
retryCaller,
0xc448b9502bbdf9850cc39823b6ea40cfe96d3ac63008e89edd2b8e98c6cc0af3
)
);
_retryEnvelope(ccc, mockEnvId);
Expand All @@ -174,12 +173,10 @@ contract GranularGuardianAccessControlTest is BaseTest {
vm.assume(solveCaller != solveEmergencyGuardian);
hoax(solveCaller);
vm.expectRevert(
bytes(
string.concat(
'AccessControl: account 0x',
TestUtils.toAsciiString(solveCaller),
' is missing role 0xf4cdc679c22cbf47d6de8e836ce79ffdae51f38408dcde3f0645de7634fa607d'
)
abi.encodeWithSelector(
IAccessControl.AccessControlUnauthorizedAccount.selector,
solveCaller,
0xf4cdc679c22cbf47d6de8e836ce79ffdae51f38408dcde3f0645de7634fa607d
)
);
_solveEmergency(ccc);
Expand Down Expand Up @@ -213,13 +210,12 @@ contract GranularGuardianAccessControlTest is BaseTest {
) public setUpGranularGuardians(defaultAdmin, retryGuardian, solveEmergencyGuardian, ccc) {
vm.assume(guardianCaller != defaultAdmin);
hoax(guardianCaller);

vm.expectRevert(
bytes(
string.concat(
'AccessControl: account 0x',
TestUtils.toAsciiString(guardianCaller),
' is missing role 0x0000000000000000000000000000000000000000000000000000000000000000'
)
abi.encodeWithSelector(
IAccessControl.AccessControlUnauthorizedAccount.selector,
guardianCaller,
0x0000000000000000000000000000000000000000000000000000000000000000
)
);
control.updateGuardian(newGuardian);
Expand Down
Loading

0 comments on commit ef0978b

Please sign in to comment.