Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BASE_KEY = --private-key ${PRIVATE_KEY}



custom_ethereum := --with-gas-price 30000000000 # 53 gwei
custom_ethereum := --with-gas-price 20000000000 # 53 gwei
#custom_polygon := --with-gas-price 190000000000 # 560 gwei
#custom_avalanche := --with-gas-price 27000000000 # 27 gwei
#custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/
Expand Down Expand Up @@ -280,5 +280,8 @@ deploy-ccc-shuffle-payload:
deploy-zksync-path-payload:
$(call deploy_fn,payloads/adapters/zksync/Network_Deployments,ethereum)

deploy-linea-path-payload:
$(call deploy_fn,payloads/adapters/ethereum/Network_Deployments,ethereum)

update-owners-and-guardians:
$(call deploy_fn,helpers/Update_Ownership,zksync)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '../../../BaseDeployerScript.sol';
import '../../../../src/templates/SimpleAddForwarderAdapter.sol';

abstract contract Ethereum_Activate_Lina_Bridge_Adapter_Payload is BaseDeployerScript {
function _getPayloadByteCode() internal virtual returns (bytes memory);

function PAYLOAD_SALT() internal pure virtual returns (string memory) {
return 'Add Linea path to a.DI';
}

function DESTINATION_CHAIN_ID() internal pure virtual returns (uint256);

function _deployPayload(AddForwarderAdapterArgs memory args) internal returns (address) {
bytes memory payloadCode = abi.encodePacked(_getPayloadByteCode(), abi.encode(args));

return _deployByteCode(payloadCode, PAYLOAD_SALT());
}

function _execute(Addresses memory addresses) internal virtual override {
Addresses memory destinationAddresses = _getAddresses(DESTINATION_CHAIN_ID());

_deployPayload(
AddForwarderAdapterArgs({
crossChainController: addresses.crossChainController,
currentChainBridgeAdapter: addresses.lineaAdapter,
destinationChainBridgeAdapter: destinationAddresses.lineaAdapter,
destinationChainId: DESTINATION_CHAIN_ID()
})
);
}
}
18 changes: 18 additions & 0 deletions scripts/payloads/adapters/ethereum/Network_Deployments.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol';

contract Ethereum is Ethereum_Activate_Lina_Bridge_Adapter_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ETHEREUM;
}

function _getPayloadByteCode() internal pure override returns (bytes memory) {
return type(SimpleAddForwarderAdapter).creationCode;
}

function DESTINATION_CHAIN_ID() internal pure override returns (uint256) {
return ChainIds.LINEA;
}
}
92 changes: 92 additions & 0 deletions tests/payloads/ethereum/AddLineaPathTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import 'forge-std/console.sol';
import {ADITestBase} from '../../adi/ADITestBase.sol';
import {Addresses, Ethereum as PayloadEthereumScript} from '../../../scripts/payloads/adapters/ethereum/Network_Deployments.s.sol';
import '../../../src/templates/SimpleAddForwarderAdapter.sol';

abstract contract BaseAddLineaPathPayloadTest is ADITestBase {
address internal _payload;
address internal _crossChainController;

string internal NETWORK;
uint256 internal immutable BLOCK_NUMBER;

constructor(string memory network, uint256 blockNumber) {
NETWORK = network;
BLOCK_NUMBER = blockNumber;
}

function _getDeployedPayload() internal virtual returns (address);

function _getPayload() internal virtual returns (address);

function _getCurrentNetworkAddresses() internal virtual returns (Addresses memory);

function setUp() public {
vm.createSelectFork(vm.rpcUrl(NETWORK), BLOCK_NUMBER);

Addresses memory addresses = _getCurrentNetworkAddresses();
_crossChainController = addresses.crossChainController;

_payload = _getPayload();
}

function test_defaultTest() public {
defaultTest(
string.concat('add_linea_path_to_adi', NETWORK),
_crossChainController,
address(_payload),
false,
vm
);
}

function test_samePayloadAddress(
address currentChainAdapter,
address destinationChainAdapter,
address crossChainController,
uint256 destinationChainId
) public {
SimpleAddForwarderAdapter deployedPayload = SimpleAddForwarderAdapter(_getDeployedPayload());
SimpleAddForwarderAdapter predictedPayload = SimpleAddForwarderAdapter(_getPayload());

assertEq(predictedPayload.DESTINATION_CHAIN_ID(), deployedPayload.DESTINATION_CHAIN_ID());
assertEq(predictedPayload.CROSS_CHAIN_CONTROLLER(), deployedPayload.CROSS_CHAIN_CONTROLLER());
assertEq(
predictedPayload.CURRENT_CHAIN_BRIDGE_ADAPTER(),
deployedPayload.CURRENT_CHAIN_BRIDGE_ADAPTER()
);
assertEq(
predictedPayload.DESTINATION_CHAIN_BRIDGE_ADAPTER(),
deployedPayload.DESTINATION_CHAIN_BRIDGE_ADAPTER()
);
}
}

contract EthereumAddLineaPathPayloadTest is
PayloadEthereumScript,
BaseAddLineaPathPayloadTest('ethereum', 21386314)
{
function _getDeployedPayload() internal pure override returns (address) {
return 0x3C2A076cD5ECbed55D8Fc0A341c14Fc808bA7fF7;
}

function _getCurrentNetworkAddresses() internal view override returns (Addresses memory) {
return _getAddresses(TRANSACTION_NETWORK());
}

function _getPayload() internal override returns (address) {
Addresses memory currentAddresses = _getCurrentNetworkAddresses();
Addresses memory destinationAddresses = _getAddresses(DESTINATION_CHAIN_ID());

AddForwarderAdapterArgs memory args = AddForwarderAdapterArgs({
crossChainController: currentAddresses.crossChainController,
currentChainBridgeAdapter: 0x8097555ffDa4176C93FEf92dF473b9763e467686, // ethereum -> linea bridge adapter
destinationChainBridgeAdapter: 0xB3332d31ECFC3ef3BF6Cda79833D11d1A53f5cE6, // linea bridge adapter
destinationChainId: DESTINATION_CHAIN_ID()
});
return _deployPayload(args);
}
}
Loading