Skip to content

Commit 007877b

Browse files
committed
chore: nitro-contracts 2aacfaa with refactoring
1 parent fce78e2 commit 007877b

27 files changed

+379
-259
lines changed

contracts/src/bridge/Inbox.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ contract Inbox is DelegateCallAware, PausableUpgradeable, IInbox {
352352
nonce,
353353
uint256(uint160(address(100))), // ArbSys address
354354
value,
355-
abi.encode(ArbSys.withdrawEth.selector, withdrawTo)
355+
abi.encodeWithSelector(ArbSys.withdrawEth.selector, withdrawTo)
356356
)
357357
);
358358
}

contracts/src/libraries/AdminFallbackProxy.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ contract AdminFallbackProxy is Proxy, DoubleLogicERC1967Upgrade {
107107
* Only the `adminAddr` is able to use the `adminLogic` functions
108108
* All other addresses can interact with the `userLogic` functions
109109
*/
110-
constructor(
110+
function _initialize(
111111
address adminLogic,
112112
bytes memory adminData,
113113
address userLogic,
114114
bytes memory userData,
115115
address adminAddr
116-
) payable {
116+
) internal {
117117
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
118118
assert(
119119
_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)

contracts/src/mocks/InboxStub.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ contract InboxStub is IInbox {
151151
address,
152152
uint256,
153153
bytes calldata
154-
) external returns (uint256) {
154+
) external pure returns (uint256) {
155155
revert("NOT_IMPLEMENTED");
156156
}
157157

@@ -161,7 +161,7 @@ contract InboxStub is IInbox {
161161
uint256,
162162
uint256,
163163
address
164-
) external returns (uint256) {
164+
) external pure returns (uint256) {
165165
revert("NOT_IMPLEMENTED");
166166
}
167167

contracts/src/mocks/Simple.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ contract Simple {
4343
return block.number;
4444
}
4545

46+
function getBlockDifficulty() external view returns (uint256) {
47+
return block.difficulty;
48+
}
49+
4650
function noop() external pure {}
4751

4852
function pleaseRevert() external pure {
@@ -113,7 +117,9 @@ contract Simple {
113117

114118
function checkGasUsed(address to, bytes calldata input) external view returns (uint256) {
115119
uint256 before = gasleft();
116-
to.staticcall{gas: before - 10000}(input);
120+
// The inner call may revert, but we still want to return the amount of gas used,
121+
// so we ignore the result of this call.
122+
(to.staticcall{gas: before - 10000}(input));
117123
return before - gasleft();
118124
}
119125
}

contracts/src/node-interface/NodeInterface.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ interface NodeInterface {
9898
/**
9999
* @notice Estimates a transaction's l1 costs.
100100
* @dev Use eth_call to call.
101-
* This method is exactly like gasEstimateComponents, but doesn't include the l2 component
101+
* This method is similar to gasEstimateComponents, but doesn't include the l2 component
102102
* so that the l1 component can be known even when the tx may fail.
103+
* This method also doesn't pad the estimate as gas estimation normally does.
104+
* If using this value to submit a transaction, we'd recommend first padding it by 10%.
103105
* @param data the tx's calldata. Everything else like "From" and "Gas" are copied over
104106
* @param to the tx's "To" (ignored when contractCreation is true)
105107
* @param contractCreation whether "To" is omitted

contracts/src/osp/IOneStepProver.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
77
import "../state/Machine.sol";
88
import "../state/Module.sol";
99
import "../state/Instructions.sol";
10+
import "../state/GlobalState.sol";
1011
import "../bridge/ISequencerInbox.sol";
1112
import "../bridge/IBridge.sol";
1213

contracts/src/osp/OneStepProverHostIo.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
77
import "../state/Value.sol";
88
import "../state/Machine.sol";
99
import "../state/Deserialize.sol";
10+
import "../state/ModuleMemory.sol";
1011
import "./IOneStepProver.sol";
1112
import "../bridge/Messages.sol";
1213
import "../bridge/IBridge.sol";

contracts/src/osp/OneStepProverMemory.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
77
import "../state/Value.sol";
88
import "../state/Machine.sol";
99
import "../state/Deserialize.sol";
10+
import "../state/ModuleMemory.sol";
1011
import "./IOneStepProver.sol";
1112

1213
contract OneStepProverMemory is IOneStepProver {

contracts/src/precompiles/ArbOwner.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ interface ArbOwner {
8484
/// @notice Releases surplus funds from L1PricerFundsPoolAddress for use
8585
function releaseL1PricerSurplusFunds(uint256 maxWeiToRelease) external returns (uint256);
8686

87+
/// @notice Sets serialized chain config in ArbOS state
88+
function setChainConfig(string calldata chainConfig) external;
89+
8790
// Emitted when a successful call is made to this precompile
8891
event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
8992
}

contracts/src/rollup/Config.sol

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 "../state/GlobalState.sol";
8+
import "../state/Machine.sol";
9+
import "../bridge/ISequencerInbox.sol";
10+
import "../bridge/IBridge.sol";
11+
import "../bridge/IOutbox.sol";
12+
import "../bridge/IInbox.sol";
13+
import "./IRollupEventInbox.sol";
14+
import "./IRollupLogic.sol";
15+
import "../challenge/IChallengeManager.sol";
16+
17+
struct Config {
18+
uint64 confirmPeriodBlocks;
19+
uint64 extraChallengeTimeBlocks;
20+
address stakeToken;
21+
uint256 baseStake;
22+
bytes32 wasmModuleRoot;
23+
address owner;
24+
address loserStakeEscrow;
25+
uint256 chainId;
26+
string chainConfig;
27+
uint64 genesisBlockNum;
28+
ISequencerInbox.MaxTimeVariation sequencerInboxMaxTimeVariation;
29+
}
30+
31+
struct ContractDependencies {
32+
IBridge bridge;
33+
ISequencerInbox sequencerInbox;
34+
IInbox inbox;
35+
IOutbox outbox;
36+
IRollupEventInbox rollupEventInbox;
37+
IChallengeManager challengeManager;
38+
address rollupAdminLogic;
39+
IRollupUser rollupUserLogic;
40+
// misc contracts that are useful when interacting with the rollup
41+
address validatorUtils;
42+
address validatorWalletCreator;
43+
}

0 commit comments

Comments
 (0)