Skip to content

Commit 27bc0cc

Browse files
committed
chore: latest nitro-contracts develop 5e9673f
1 parent 007877b commit 27bc0cc

File tree

96 files changed

+203
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+203
-201
lines changed

contracts/src/bridge/Bridge.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;

contracts/src/bridge/IBridge.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/bridge/IDelayedMessageProvider.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/bridge/IInbox.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/bridge/IOutbox.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/bridge/IOwnable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/bridge/ISequencerInbox.sol

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version
@@ -76,9 +76,17 @@ interface ISequencerInbox is IDelayedMessageProvider {
7676
uint64 creationBlock;
7777
}
7878

79-
// https://github.com/ethereum/solidity/issues/11826
80-
// function maxTimeVariation() external view returns (MaxTimeVariation calldata);
81-
// function dasKeySetInfo(bytes32) external view returns (DasKeySetInfo calldata);
79+
function maxTimeVariation()
80+
external
81+
view
82+
returns (
83+
uint256,
84+
uint256,
85+
uint256,
86+
uint256
87+
);
88+
89+
function dasKeySetInfo(bytes32) external view returns (bool, uint64);
8290

8391
/// @notice Remove force inclusion delay after a L1 chainId fork
8492
function removeDelayAfterFork() external;

contracts/src/bridge/Inbox.sol

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;
@@ -35,7 +35,7 @@ import {
3535
L2MessageType_unsignedEOATx,
3636
L2MessageType_unsignedContractTx
3737
} from "../libraries/MessageTypes.sol";
38-
import {MAX_DATA_SIZE, UNISWAP_L1_TIMELOCK, UNISWAP_L2_FACTORY} from "../libraries/Constants.sol";
38+
import {MAX_DATA_SIZE} from "../libraries/Constants.sol";
3939
import "../precompiles/ArbSys.sol";
4040

4141
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
@@ -527,84 +527,6 @@ contract Inbox is DelegateCallAware, PausableUpgradeable, IInbox {
527527
);
528528
}
529529

530-
/// @notice This is an one-time-exception to resolve a misconfiguration of Uniswap Arbitrum deployment
531-
/// Only the Uniswap L1 Timelock may call this function and it is allowed to create a crosschain
532-
/// retryable ticket without address aliasing. More info here:
533-
/// https://gov.uniswap.org/t/consensus-check-fix-the-cross-chain-messaging-bridge-on-arbitrum/18547
534-
/// @dev This function will be removed in future releases
535-
function uniswapCreateRetryableTicket(
536-
address to,
537-
uint256 l2CallValue,
538-
uint256 maxSubmissionCost,
539-
address excessFeeRefundAddress,
540-
address callValueRefundAddress,
541-
uint256 gasLimit,
542-
uint256 maxFeePerGas,
543-
bytes calldata data
544-
) external payable whenNotPaused onlyAllowed returns (uint256) {
545-
// this can only be called by UNISWAP_L1_TIMELOCK
546-
require(msg.sender == UNISWAP_L1_TIMELOCK, "NOT_UNISWAP_L1_TIMELOCK");
547-
// the retryable can only call UNISWAP_L2_FACTORY
548-
require(to == UNISWAP_L2_FACTORY, "NOT_TO_UNISWAP_L2_FACTORY");
549-
550-
// ensure the user's deposit alone will make submission succeed
551-
if (msg.value < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) {
552-
revert InsufficientValue(
553-
maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas,
554-
msg.value
555-
);
556-
}
557-
558-
// if a refund address is a contract, we apply the alias to it
559-
// so that it can access its funds on the L2
560-
// since the beneficiary and other refund addresses don't get rewritten by arb-os
561-
if (AddressUpgradeable.isContract(excessFeeRefundAddress)) {
562-
excessFeeRefundAddress = AddressAliasHelper.applyL1ToL2Alias(excessFeeRefundAddress);
563-
}
564-
if (AddressUpgradeable.isContract(callValueRefundAddress)) {
565-
// this is the beneficiary. be careful since this is the address that can cancel the retryable in the L2
566-
callValueRefundAddress = AddressAliasHelper.applyL1ToL2Alias(callValueRefundAddress);
567-
}
568-
569-
// gas price and limit of 1 should never be a valid input, so instead they are used as
570-
// magic values to trigger a revert in eth calls that surface data without requiring a tx trace
571-
if (gasLimit == 1 || maxFeePerGas == 1)
572-
revert RetryableData(
573-
msg.sender,
574-
to,
575-
l2CallValue,
576-
msg.value,
577-
maxSubmissionCost,
578-
excessFeeRefundAddress,
579-
callValueRefundAddress,
580-
gasLimit,
581-
maxFeePerGas,
582-
data
583-
);
584-
585-
uint256 submissionFee = calculateRetryableSubmissionFee(data.length, block.basefee);
586-
if (maxSubmissionCost < submissionFee)
587-
revert InsufficientSubmissionCost(submissionFee, maxSubmissionCost);
588-
589-
return
590-
_deliverMessage(
591-
L1MessageType_submitRetryableTx,
592-
AddressAliasHelper.undoL1ToL2Alias(msg.sender),
593-
abi.encodePacked(
594-
uint256(uint160(to)),
595-
l2CallValue,
596-
msg.value,
597-
maxSubmissionCost,
598-
uint256(uint160(excessFeeRefundAddress)),
599-
uint256(uint160(callValueRefundAddress)),
600-
gasLimit,
601-
maxFeePerGas,
602-
data.length,
603-
data
604-
)
605-
);
606-
}
607-
608530
function _deliverMessage(
609531
uint8 _kind,
610532
address _sender,

contracts/src/bridge/Messages.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/bridge/Outbox.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;

contracts/src/bridge/SequencerInbox.sol

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;
@@ -27,10 +27,12 @@ import "./IInbox.sol";
2727
import "./ISequencerInbox.sol";
2828
import "../rollup/IRollupLogic.sol";
2929
import "./Messages.sol";
30+
import "../precompiles/ArbGasInfo.sol";
3031

3132
import {L1MessageType_batchPostingReport} from "../libraries/MessageTypes.sol";
3233
import {GasRefundEnabled, IGasRefunder} from "../libraries/IGasRefunder.sol";
3334
import "../libraries/DelegateCallAware.sol";
35+
import "../libraries/ArbitrumChecker.sol";
3436
import {MAX_DATA_SIZE} from "../libraries/Constants.sol";
3537

3638
/**
@@ -66,6 +68,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
6668

6769
mapping(address => bool) public isSequencer;
6870

71+
// If the chain this SequencerInbox is deployed on is an Arbitrum chain.
72+
bool internal immutable hostChainIsArbitrum = ArbitrumChecker.runningOnArbitrum();
73+
6974
function _chainIdChanged() internal view returns (bool) {
7075
return deployTimeChainId != block.chainid;
7176
}
@@ -387,13 +392,29 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
387392
// this msg isn't included in the current sequencer batch, but instead added to
388393
// the delayed messages queue that is yet to be included
389394
address batchPoster = msg.sender;
390-
bytes memory spendingReportMsg = abi.encodePacked(
391-
block.timestamp,
392-
batchPoster,
393-
dataHash,
394-
seqMessageIndex,
395-
block.basefee
396-
);
395+
bytes memory spendingReportMsg;
396+
if (hostChainIsArbitrum) {
397+
// Include extra gas for the host chain's L1 gas charging
398+
uint256 l1Fees = ArbGasInfo(address(0x6c)).getCurrentTxL1GasFees();
399+
uint256 extraGas = l1Fees / block.basefee;
400+
require(extraGas <= type(uint64).max, "L1_GAS_NOT_UINT64");
401+
spendingReportMsg = abi.encodePacked(
402+
block.timestamp,
403+
batchPoster,
404+
dataHash,
405+
seqMessageIndex,
406+
block.basefee,
407+
uint64(extraGas)
408+
);
409+
} else {
410+
spendingReportMsg = abi.encodePacked(
411+
block.timestamp,
412+
batchPoster,
413+
dataHash,
414+
seqMessageIndex,
415+
block.basefee
416+
);
417+
}
397418
uint256 msgNum = bridge.submitBatchSpendingReport(
398419
batchPoster,
399420
keccak256(spendingReportMsg)

contracts/src/challenge/ChallengeLib.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/challenge/ChallengeManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/challenge/IChallengeManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/challenge/IChallengeResultReceiver.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/libraries/AddressAliasHelper.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/libraries/AdminFallbackProxy.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2021-2022, Offchain Labs, Inc.
2+
// For license information, see https://github.com/nitro/blob/master/LICENSE
3+
// SPDX-License-Identifier: BUSL-1.1
4+
5+
pragma solidity ^0.8.0;
6+
7+
import "../precompiles/ArbSys.sol";
8+
9+
library ArbitrumChecker {
10+
function runningOnArbitrum() internal view returns (bool) {
11+
(bool ok, bytes memory data) = address(100).staticcall(
12+
abi.encodeWithSelector(ArbSys.arbOSVersion.selector)
13+
);
14+
return ok && data.length == 32;
15+
}
16+
}

contracts/src/libraries/Constants.sol

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;
@@ -11,6 +11,3 @@ uint64 constant NO_CHAL_INDEX = 0;
1111

1212
// Expected seconds per block in Ethereum PoS
1313
uint256 constant ETH_POS_BLOCK_TIME = 12;
14-
15-
address constant UNISWAP_L1_TIMELOCK = 0x1a9C8182C09F50C8318d769245beA52c32BE35BC;
16-
address constant UNISWAP_L2_FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984;

contracts/src/libraries/CryptographyPrimitives.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/libraries/DelegateCallAware.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/libraries/Error.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;

contracts/src/libraries/IGasRefunder.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
// solhint-disable-next-line compiler-version

contracts/src/libraries/MerkleLib.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;

contracts/src/libraries/MessageTypes.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.4;

contracts/src/mocks/BridgeStub.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/mocks/BridgeUnproxied.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

contracts/src/mocks/InboxStub.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2021-2022, Offchain Labs, Inc.
2-
// For license information, see https://github.com/nitro/blob/master/LICENSE
2+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
33
// SPDX-License-Identifier: BUSL-1.1
44

55
pragma solidity ^0.8.0;

0 commit comments

Comments
 (0)