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

fix: revert mistaken variable naming #63

Merged
merged 2 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions contracts/src/FastBridgeReceiverOnEthereum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ 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;
}

/**
* @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 _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
}

Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions contracts/src/FastBridgeReceiverOnGnosis.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274]
* @authors: [@jaybuidl, @shotaronowhere, @hrishibhat]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand Down Expand Up @@ -36,28 +36,28 @@ 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);
}

/**
* @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 _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
}

Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions contracts/src/FastBridgeReceiverOnPolygon.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274]
* @authors: [@jaybuidl, @shotaronowhere, @hrishibhat]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand Down Expand Up @@ -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);
}

// ************************************** //
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions contracts/src/FastBridgeSender.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@jaybuidl, @shotaronowhere, @adi274]
* @authors: [@jaybuidl, @shotaronowhere]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand Down Expand Up @@ -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);
}

Expand All @@ -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;
}
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions contracts/src/SafeBridgeRouterToGnosis.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@shotaronowhere, @jaybuidl, @adi274]
* @authors: [@shotaronowhere, @jaybuidl]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
12 changes: 6 additions & 6 deletions contracts/src/SafeBridgeRouterToPolygon.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@shotaronowhere, @hrishibhat, @jaybuidl, @adi274]
* @authors: [@shotaronowhere, @hrishibhat, @jaybuidl]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}
}
29 changes: 22 additions & 7 deletions contracts/src/test/FastBridgeReceiverMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

/**
* @authors: [@adi274]
* @authors: [@jaybuidl, @shotaronowhere, @hrishibhat, @adi274]
* @reviewers: []
* @auditors: []
* @bounties: []
Expand All @@ -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) {}
}
4 changes: 2 additions & 2 deletions contracts/test/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down