diff --git a/contracts/src/FastBridgeReceiverOnEthereum.sol b/contracts/src/FastBridgeReceiverOnEthereum.sol index 26dbd1fd..2c6df07d 100644 --- a/contracts/src/FastBridgeReceiverOnEthereum.sol +++ b/contracts/src/FastBridgeReceiverOnEthereum.sol @@ -38,7 +38,7 @@ contract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceive function isSentBySafeBridge() internal view virtual override returns (bool) { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); - return (msg.sender == address(outbox) && outbox.l2ToL1Sender() == fastBridgeSender); + return msg.sender == address(outbox) && outbox.l2ToL1Sender() == safeBridgeSender; } /** @@ -46,20 +46,20 @@ contract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceive * @param _deposit The deposit amount to submit a claim in wei. * @param _epochPeriod The duration of each epoch. * @param _challengePeriod The duration of the period allowing to challenge a claim. - * @param _fastBridgeSender The address of the Safe Bridge Sender on the connecting chain. + * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain. * @param _inbox Ethereum receiver specific: The address of the inbox contract on Ethereum. */ constructor( uint256 _deposit, uint256 _epochPeriod, uint256 _challengePeriod, - address _fastBridgeSender, + address _safeBridgeSender, address _inbox // Ethereum receiver specific ) { deposit = _deposit; epochPeriod = _epochPeriod; challengePeriod = _challengePeriod; - fastBridgeSender = _fastBridgeSender; + safeBridgeSender = _safeBridgeSender; inbox = IInbox(_inbox); // Ethereum receiver specific } @@ -95,7 +95,7 @@ contract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceive uint256 public immutable deposit; // The deposit required to submit a claim or challenge uint256 public immutable override epochPeriod; // Epochs mark the period between potential batches of messages. uint256 public immutable override challengePeriod; // Epochs mark the period between potential batches of messages. - address public immutable fastBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. + address public immutable safeBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. mapping(uint256 => bytes32) public fastInbox; // epoch => validated batch merkle root(optimistically, or challenged and verified with the safe bridge) mapping(uint256 => Claim) public claims; // epoch => claim diff --git a/contracts/src/FastBridgeReceiverOnGnosis.sol b/contracts/src/FastBridgeReceiverOnGnosis.sol index 4ed63052..9602e1bd 100644 --- a/contracts/src/FastBridgeReceiverOnGnosis.sol +++ b/contracts/src/FastBridgeReceiverOnGnosis.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274] + * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -36,7 +36,7 @@ contract FastBridgeReceiverOnGnosis is IFastBridgeReceiver, ISafeBridgeReceiver // ************************************* // function isSentBySafeBridge() internal view override returns (bool) { - return (msg.sender == address(amb)) && (amb.messageSender() == fastBridgeSender); + return (msg.sender == address(amb)) && (amb.messageSender() == safeBridgeSender); } /** @@ -44,20 +44,20 @@ contract FastBridgeReceiverOnGnosis is IFastBridgeReceiver, ISafeBridgeReceiver * @param _deposit The deposit amount to submit a claim in wei. * @param _epochPeriod The duration of each epoch. * @param _challengePeriod The duration of the period allowing to challenge a claim. - * @param _fastBridgeSender The address of the Safe Bridge Sender on the connecting chain. + * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain. * @param _amb The AMB contract on Gnosis Chain. */ constructor( uint256 _deposit, uint256 _epochPeriod, uint256 _challengePeriod, - address _fastBridgeSender, // Gnosis receiver specific + address _safeBridgeSender, // Gnosis receiver specific address _amb // Gnosis receiver specific ) { deposit = _deposit; epochPeriod = _epochPeriod; challengePeriod = _challengePeriod; - fastBridgeSender = _fastBridgeSender; + safeBridgeSender = _safeBridgeSender; amb = IAMB(_amb); // Gnosis receiver specific } @@ -93,7 +93,7 @@ contract FastBridgeReceiverOnGnosis is IFastBridgeReceiver, ISafeBridgeReceiver uint256 public immutable deposit; // The deposit required to submit a claim or challenge uint256 public immutable override epochPeriod; // Epochs mark the period between potential batches of messages. uint256 public immutable override challengePeriod; // Epochs mark the period between potential batches of messages. - address public immutable fastBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. + address public immutable safeBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. mapping(uint256 => bytes32) public fastInbox; // epoch => validated batch merkle root(optimistically, or challenged and verified with the safe bridge) mapping(uint256 => Claim) public claims; // epoch => claim diff --git a/contracts/src/FastBridgeReceiverOnPolygon.sol b/contracts/src/FastBridgeReceiverOnPolygon.sol index c0b77286..59bc8336 100644 --- a/contracts/src/FastBridgeReceiverOnPolygon.sol +++ b/contracts/src/FastBridgeReceiverOnPolygon.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274] + * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -38,21 +38,21 @@ contract FastBridgeReceiverOnPolygon is FxBaseChildTunnel, IFastBridgeReceiver, * @param _deposit The deposit amount to submit a claim in wei. * @param _epochPeriod The duration of each epoch. * @param _challengePeriod The duration of the period allowing to challenge a claim. - * @param _fastBridgeSender The address of the Safe Bridge Sender on the connecting chain. fxRootTunnel contract in ethereum + * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain. fxRootTunnel contract in ethereum * @param _fxChild The the fxChild contract on Polygon Chain. */ constructor( uint256 _deposit, uint256 _epochPeriod, uint256 _challengePeriod, - address _fastBridgeSender, // Polygon receiver specific + address _safeBridgeSender, // Polygon receiver specific address _fxChild // Polygon receiver specific ) FxBaseChildTunnel(_fxChild) { deposit = _deposit; epochPeriod = _epochPeriod; challengePeriod = _challengePeriod; - fastBridgeSender = _fastBridgeSender; - setFxRootTunnel(_fastBridgeSender); + safeBridgeSender = _safeBridgeSender; + setFxRootTunnel(_safeBridgeSender); } // ************************************** // @@ -87,7 +87,7 @@ contract FastBridgeReceiverOnPolygon is FxBaseChildTunnel, IFastBridgeReceiver, uint256 public immutable deposit; // The deposit required to submit a claim or challenge uint256 public immutable override epochPeriod; // Epochs mark the period between potential batches of messages. uint256 public immutable override challengePeriod; // Epochs mark the period between potential batches of messages. - address public immutable fastBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. + address public immutable safeBridgeSender; // The address of the Safe Bridge Sender on the connecting chain. mapping(uint256 => bytes32) public fastInbox; // epoch => validated batch merkle root(optimistically, or challenged and verified with the safe bridge) mapping(uint256 => Claim) public claims; // epoch => claim diff --git a/contracts/src/FastBridgeSender.sol b/contracts/src/FastBridgeSender.sol index 73bdbda0..b6475b4e 100644 --- a/contracts/src/FastBridgeSender.sol +++ b/contracts/src/FastBridgeSender.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@jaybuidl, @shotaronowhere, @adi274] + * @authors: [@jaybuidl, @shotaronowhere] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -44,7 +44,7 @@ contract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender { bytes4 methodSelector = ISafeBridgeReceiver.verifySafeBatch.selector; bytes memory safeMessageData = abi.encodeWithSelector(methodSelector, _epoch, batchMerkleRoot); - bytes32 ticketID = _sendSafe(fastBridgeReceiver, safeMessageData); + bytes32 ticketID = _sendSafe(safeBridgeReceiver, safeMessageData); emit SentSafe(_epoch, ticketID); } @@ -56,11 +56,11 @@ contract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender { /** * @dev Constructor. * @param _epochPeriod The duration between epochs. - * @param _fastBridgeReceiver The the Safe Bridge Router on Ethereum to the receiving chain. + * @param _safeBridgeReceiver The the Safe Bridge Router on Ethereum to the receiving chain. */ - constructor(uint256 _epochPeriod, address _fastBridgeReceiver) { + constructor(uint256 _epochPeriod, address _safeBridgeReceiver) { epochPeriod = _epochPeriod; - fastBridgeReceiver = _fastBridgeReceiver; + safeBridgeReceiver = _safeBridgeReceiver; unchecked { currentBatchID = block.timestamp / _epochPeriod - 1; } @@ -79,7 +79,7 @@ contract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender { uint256 public immutable epochPeriod; // Epochs mark the period between potential batches of messages. uint256 public currentBatchID; mapping(uint256 => bytes32) public fastOutbox; // epoch count => merkle root of batched messages - address public immutable fastBridgeReceiver; + address public immutable safeBridgeReceiver; // merkle tree representation of a batch of messages // supports 2^64 messages. diff --git a/contracts/src/SafeBridgeRouterToGnosis.sol b/contracts/src/SafeBridgeRouterToGnosis.sol index 90946342..0b04ca4f 100644 --- a/contracts/src/SafeBridgeRouterToGnosis.sol +++ b/contracts/src/SafeBridgeRouterToGnosis.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@shotaronowhere, @jaybuidl, @adi274] + * @authors: [@shotaronowhere, @jaybuidl] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -25,25 +25,25 @@ contract SafeBridgeRouter is ISafeBridgeRouter { IInbox public immutable inbox; // The address of the Arbitrum Inbox contract. IAMB public immutable amb; // The address of the AMB contract on Ethereum. - address public immutable fastBridgeSender; // The address of the Fast Bridge sender on Arbitrum. + address public immutable safeBridgeSender; // The address of the Safe Bridge sender on Arbitrum. address public immutable fastBridgeReceiverOnGnosisChain; // The address of the Fast Bridge Receiver on Gnosis Chain. /** * @dev Constructor. * @param _inbox The address of the inbox contract on Ethereum. * @param _amb The address of the AMB contract on Ethereum. - * @param _fastBridgeSender The fast bridge sender on Arbitrum. + * @param _safeBridgeSender The safe bridge sender on Arbitrum. * @param _fastBridgeReceiverOnGnosisChain The fast bridge receiver on Gnosis Chain. */ constructor( IInbox _inbox, IAMB _amb, - address _fastBridgeSender, + address _safeBridgeSender, address _fastBridgeReceiverOnGnosisChain ) { inbox = _inbox; amb = _amb; - fastBridgeSender = _fastBridgeSender; + safeBridgeSender = _safeBridgeSender; fastBridgeReceiverOnGnosisChain = _fastBridgeReceiverOnGnosisChain; } @@ -74,6 +74,6 @@ contract SafeBridgeRouter is ISafeBridgeRouter { function isSentBySafeBridge() internal view override returns (bool) { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); - return outbox.l2ToL1Sender() == fastBridgeSender; + return outbox.l2ToL1Sender() == safeBridgeSender; } } diff --git a/contracts/src/SafeBridgeRouterToPolygon.sol b/contracts/src/SafeBridgeRouterToPolygon.sol index 15deb005..56653e4b 100644 --- a/contracts/src/SafeBridgeRouterToPolygon.sol +++ b/contracts/src/SafeBridgeRouterToPolygon.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@shotaronowhere, @hrishibhat, @jaybuidl, @adi274] + * @authors: [@shotaronowhere, @hrishibhat, @jaybuidl] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -24,24 +24,24 @@ contract SafeBridgeRouterToPolygon is ISafeBridgeRouter, FxBaseRootTunnel { // ************************************* // IInbox public immutable inbox; // The address of the Arbitrum Inbox contract. - address public immutable fastBridgeSender; // The address of the Safe Bridge sender on Arbitrum. + address public immutable safeBridgeSender; // The address of the Safe Bridge sender on Arbitrum. /** * @dev Constructor. * @param _inbox The address of the inbox contract on Ethereum. * @param _fxRoot The address of the fxRoot contract in Ethereum. - * @param _fastBridgeSender The safe bridge sender on Arbitrum. + * @param _safeBridgeSender The safe bridge sender on Arbitrum. * @param _fastBridgeReceiverOnPolygon The fast bridge receiver on Polygon Chain. */ constructor( IInbox _inbox, address _checkpointManager, address _fxRoot, - address _fastBridgeSender, + address _safeBridgeSender, address _fastBridgeReceiverOnPolygon ) FxBaseRootTunnel(_checkpointManager, _fxRoot) { inbox = _inbox; - fastBridgeSender = _fastBridgeSender; + safeBridgeSender = _safeBridgeSender; setFxChildTunnel(_fastBridgeReceiverOnPolygon); } @@ -80,6 +80,6 @@ contract SafeBridgeRouterToPolygon is ISafeBridgeRouter, FxBaseRootTunnel { function isSentBySafeBridge() internal view override returns (bool) { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); - return outbox.l2ToL1Sender() == fastBridgeSender; + return outbox.l2ToL1Sender() == safeBridgeSender; } } diff --git a/contracts/src/test/FastBridgeReceiverMock.sol b/contracts/src/test/FastBridgeReceiverMock.sol index 9c981c47..25a9847b 100644 --- a/contracts/src/test/FastBridgeReceiverMock.sol +++ b/contracts/src/test/FastBridgeReceiverMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @authors: [@adi274] + * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274] * @reviewers: [] * @auditors: [] * @bounties: [] @@ -13,23 +13,38 @@ pragma solidity ^0.8.0; import "../FastBridgeReceiverOnEthereum.sol"; /** - * Fast Bridge Receiver - * Counterpart of `Fast Sender` + * Fast Receiver On Ethereum + * Counterpart of `FastSenderFromArbitrum` */ contract FastBridgeReceiverOnEthereumMock is FastBridgeReceiverOnEthereum { // **************************************** // - // * Hardhat Specific * // + // * * // + // * Ethereum Receiver Specific * // + // * * // // **************************************** // + + // ************************************* // + // * Views * // + // ************************************* // + function isSentBySafeBridge() internal view override returns (bool) { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); - return outbox.l2ToL1Sender() == fastBridgeSender; + return outbox.l2ToL1Sender() == safeBridgeSender; } + /** + * @dev Constructor. + * @param _deposit The deposit amount to submit a claim in wei. + * @param _epochPeriod The duration of each epoch. + * @param _challengePeriod The duration of the period allowing to challenge a claim. + * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain. + * @param _inbox Ethereum receiver specific: The address of the inbox contract on Ethereum. + */ constructor( uint256 _deposit, uint256 _epochPeriod, uint256 _challengePeriod, - address _fastBridgeSender, + address _safeBridgeSender, address _inbox // Ethereum receiver specific - ) FastBridgeReceiverOnEthereum(_deposit, _epochPeriod, _challengePeriod, _fastBridgeSender, _inbox) {} + ) FastBridgeReceiverOnEthereum(_deposit, _epochPeriod, _challengePeriod, _safeBridgeSender, _inbox) {} } diff --git a/contracts/test/integration/index.ts b/contracts/test/integration/index.ts index 81bdc759..86fb07c0 100644 --- a/contracts/test/integration/index.ts +++ b/contracts/test/integration/index.ts @@ -65,13 +65,13 @@ describe("Integration tests", async () => { // FastBridgeSender expect(await fastBridgeSender.arbSys()).to.equal(arbsysMock.address); expect(await fastBridgeSender.epochPeriod()).to.equal(EPOCH_PERIOD); - expect(await fastBridgeSender.fastBridgeReceiver()).to.equal(fastBridgeReceiver.address); + expect(await fastBridgeSender.safeBridgeReceiver()).to.equal(fastBridgeReceiver.address); // FastBridgeReceiver expect(await fastBridgeReceiver.deposit()).to.equal(ONE_TENTH_ETH); expect(await fastBridgeReceiver.epochPeriod()).to.equal(EPOCH_PERIOD); expect(await fastBridgeReceiver.challengePeriod()).to.equal(CHALLENGE_PERIOD); - expect(await fastBridgeReceiver.fastBridgeSender()).to.equal(fastBridgeSender.address); + expect(await fastBridgeReceiver.safeBridgeSender()).to.equal(fastBridgeSender.address); expect(await fastBridgeReceiver.inbox()).to.equal(inbox.address); // ReceiverGateway