Skip to content

Commit

Permalink
fix: format foundryup
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth committed Aug 15, 2024
1 parent 2f700f8 commit 3ca118c
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 175 deletions.
9 changes: 3 additions & 6 deletions src/bridge/AbsInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,9 @@ abstract contract AbsInbox is DelegateCallAware, PausableUpgradeable, IInboxBase
}

/// @inheritdoc IInboxBase
function sendL2Message(bytes calldata messageData)
external
whenNotPaused
onlyAllowed
returns (uint256)
{
function sendL2Message(
bytes calldata messageData
) external whenNotPaused onlyAllowed returns (uint256) {
if (_chainIdChanged()) revert L1Forked();
return _deliverMessage(L2_MSG, msg.sender, messageData, 0);
}
Expand Down
8 changes: 3 additions & 5 deletions src/bridge/AbsOutbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ abstract contract AbsOutbox is DelegateCallAware, IOutbox {
context = prevContext;
}

function _calcSpentIndexOffset(uint256 index)
internal
view
returns (uint256, uint256, bytes32)
{
function _calcSpentIndexOffset(
uint256 index
) internal view returns (uint256, uint256, bytes32) {
uint256 spentIndex = index / 255; // Note: Reserves the MSB.
uint256 bitOffset = index % 255;
bytes32 replay = spent[spentIndex];
Expand Down
7 changes: 3 additions & 4 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ interface ISequencerInbox is IDelayedMessageProvider {
/// @notice Calculates the upper bounds of the delay buffer
/// @param blockNumber The block number when a delayed message was created
/// @return blockNumberDeadline The block number at when the message can be force included
function forceInclusionDeadline(uint64 blockNumber)
external
view
returns (uint64 blockNumberDeadline);
function forceInclusionDeadline(
uint64 blockNumber
) external view returns (uint64 blockNumberDeadline);

// ---------- BatchPoster functions ----------

Expand Down
46 changes: 18 additions & 28 deletions src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
return deployTimeChainId != block.chainid;
}

function postUpgradeInit(BufferConfig memory bufferConfig_)
external
onlyDelegated
onlyProxyOwner
{
function postUpgradeInit(
BufferConfig memory bufferConfig_
) external onlyDelegated onlyProxyOwner {
if (!isDelayBufferable) revert NotDelayBufferable();

// Assuming we would not upgrade from a version that does not have the buffer initialized
Expand Down Expand Up @@ -555,11 +553,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
&& !buffer.isSynced();
}

function packHeader(uint256 afterDelayedMessagesRead)
internal
view
returns (bytes memory, IBridge.TimeBounds memory)
{
function packHeader(
uint256 afterDelayedMessagesRead
) internal view returns (bytes memory, IBridge.TimeBounds memory) {
IBridge.TimeBounds memory timeBounds = getTimeBounds();
bytes memory header = abi.encodePacked(
timeBounds.minTimestamp,
Expand All @@ -577,11 +573,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
/// @param afterDelayedMessagesRead The delayed messages count read up to
/// @return The data hash
/// @return The timebounds within which the message should be processed
function formEmptyDataHash(uint256 afterDelayedMessagesRead)
internal
view
returns (bytes32, IBridge.TimeBounds memory)
{
function formEmptyDataHash(
uint256 afterDelayedMessagesRead
) internal view returns (bytes32, IBridge.TimeBounds memory) {
(bytes memory header, IBridge.TimeBounds memory timeBounds) =
packHeader(afterDelayedMessagesRead);
return (keccak256(header), timeBounds);
Expand Down Expand Up @@ -638,12 +632,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
/// @return The data hash
/// @return The timebounds within which the message should be processed
/// @return The normalized amount of gas used for blob posting
function formBlobDataHash(uint256 afterDelayedMessagesRead)
internal
view
virtual
returns (bytes32, IBridge.TimeBounds memory, uint256)
{
function formBlobDataHash(
uint256 afterDelayedMessagesRead
) internal view virtual returns (bytes32, IBridge.TimeBounds memory, uint256) {
bytes32[] memory dataHashes = reader4844.getDataHashes();
if (dataHashes.length == 0) revert MissingDataHashes();

Expand Down Expand Up @@ -759,9 +750,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
}
}

function _setMaxTimeVariation(ISequencerInbox.MaxTimeVariation memory maxTimeVariation_)
internal
{
function _setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_
) internal {
if (
maxTimeVariation_.delayBlocks > type(uint64).max
|| maxTimeVariation_.futureBlocks > type(uint64).max
Expand All @@ -777,10 +768,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
}

/// @inheritdoc ISequencerInbox
function setMaxTimeVariation(ISequencerInbox.MaxTimeVariation memory maxTimeVariation_)
external
onlyRollupOwner
{
function setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_
) external onlyRollupOwner {
_setMaxTimeVariation(maxTimeVariation_);
emit MaxTimeVariationSet(maxTimeVariation_);
emit OwnerFunctionCalled(0);
Expand Down
9 changes: 3 additions & 6 deletions src/mocks/SequencerInboxBlobMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ contract SequencerInboxBlobMock is SequencerInbox {
/// @return The data hash
/// @return The timebounds within which the message should be processed
/// @return The normalized amount of gas used for blob posting
function formBlobDataHash(uint256 afterDelayedMessagesRead)
internal
view
override
returns (bytes32, IBridge.TimeBounds memory, uint256)
{
function formBlobDataHash(
uint256 afterDelayedMessagesRead
) internal view override returns (bytes32, IBridge.TimeBounds memory, uint256) {
bytes32[3] memory dataHashes = [bytes32(0), bytes32(0), bytes32(0)];
if (dataHashes.length == 0) revert MissingDataHashes();

Expand Down
9 changes: 3 additions & 6 deletions src/mocks/SimpleOneStepProofEntry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ contract SimpleOneStepProofEntry is IOneStepProofEntry {
return globalState.hash();
}

function getMachineHash(ExecutionState calldata execState)
external
pure
override
returns (bytes32)
{
function getMachineHash(
ExecutionState calldata execState
) external pure override returns (bytes32) {
require(execState.machineStatus == MachineStatus.FINISHED, "BAD_MACHINE_STATUS");
return execState.globalState.hash();
}
Expand Down
7 changes: 3 additions & 4 deletions src/node-interface/NodeInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ interface NodeInterface {
* @return firstBlock The first L2 block number with the given L1 block number
* @return lastBlock The last L2 block number with the given L1 block number
*/
function l2BlockRangeForL1(uint64 blockNum)
external
view
returns (uint64 firstBlock, uint64 lastBlock);
function l2BlockRangeForL1(
uint64 blockNum
) external view returns (uint64 firstBlock, uint64 lastBlock);
}
9 changes: 3 additions & 6 deletions src/osp/OneStepProofEntry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@ contract OneStepProofEntry is IOneStepProofEntry {
return mach.hash();
}

function getMachineHash(ExecutionState calldata execState)
external
pure
override
returns (bytes32)
{
function getMachineHash(
ExecutionState calldata execState
) external pure override returns (bytes32) {
if (execState.machineStatus == MachineStatus.FINISHED) {
return keccak256(abi.encodePacked("Machine finished:", execState.globalState.hash()));
} else if (execState.machineStatus == MachineStatus.ERRORED) {
Expand Down
14 changes: 6 additions & 8 deletions src/precompiles/ArbGasInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ interface ArbGasInfo {
/// per ArbGas congestion,
/// per ArbGas total
/// )
function getPricesInWeiWithAggregator(address aggregator)
external
view
returns (uint256, uint256, uint256, uint256, uint256, uint256);
function getPricesInWeiWithAggregator(
address aggregator
) external view returns (uint256, uint256, uint256, uint256, uint256, uint256);

/// @notice Get gas prices. Uses the caller's preferred aggregator, or the default if the caller doesn't have a preferred one.
/// @return return gas prices in wei
Expand All @@ -41,10 +40,9 @@ interface ArbGasInfo {

/// @notice Get prices in ArbGas for the supplied aggregator
/// @return (per L2 tx, per L1 calldata byte, per storage allocation)
function getPricesInArbGasWithAggregator(address aggregator)
external
view
returns (uint256, uint256, uint256);
function getPricesInArbGasWithAggregator(
address aggregator
) external view returns (uint256, uint256, uint256);

/// @notice Get prices in ArbGas. Assumes the callers preferred validator, or the default if caller doesn't have a preferred one.
/// @return (per L2 tx, per L1 calldata byte, per storage allocation)
Expand Down
14 changes: 6 additions & 8 deletions src/precompiles/ArbWasm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ interface ArbWasm {
/// @param program the program to activate
/// @return version the stylus version the program was activated against
/// @return dataFee the data fee paid to store the activated program
function activateProgram(address program)
external
payable
returns (uint16 version, uint256 dataFee);
function activateProgram(
address program
) external payable returns (uint16 version, uint256 dataFee);

/// @notice Gets the latest stylus version
/// @return version the stylus version
Expand All @@ -42,10 +41,9 @@ interface ArbWasm {
/// @notice Gets the cost to invoke the program
/// @return gas the amount of gas
/// @return gasWhenCached the amount of gas if the program was recently used
function programInitGas(address program)
external
view
returns (uint64 gas, uint64 gasWhenCached);
function programInitGas(
address program
) external view returns (uint64 gas, uint64 gasWhenCached);

/// @notice Gets the memory footprint of the program at the given address in pages
/// @return footprint the memory footprint of program in pages (reverts for EVM contracts)
Expand Down
8 changes: 3 additions & 5 deletions src/rollup/AssertionState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ struct AssertionState {
}

library AssertionStateLib {
function toExecutionState(AssertionState memory state)
internal
pure
returns (ExecutionState memory)
{
function toExecutionState(
AssertionState memory state
) internal pure returns (ExecutionState memory) {
return ExecutionState(state.globalState, state.machineStatus);
}

Expand Down
8 changes: 3 additions & 5 deletions src/rollup/BOLDUpgradeAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@ contract StateHashPreImageLookup {
emit HashSet(h, executionState, inboxMaxCount);
}

function get(bytes32 h)
public
view
returns (ExecutionState memory executionState, uint256 inboxMaxCount)
{
function get(
bytes32 h
) public view returns (ExecutionState memory executionState, uint256 inboxMaxCount) {
(executionState, inboxMaxCount) = abi.decode(preImages[h], (ExecutionState, uint256));
require(inboxMaxCount != 0, "Hash not yet set");
}
Expand Down
7 changes: 3 additions & 4 deletions src/rollup/IRollupCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ interface IRollupCore is IAssertionChain {
* This function will revert if the given assertion hash does not exist.
* @dev This function is meant for internal use only and has no stability guarantees.
*/
function getAssertionCreationBlockForLogLookup(bytes32 assertionHash)
external
view
returns (uint256);
function getAssertionCreationBlockForLogLookup(
bytes32 assertionHash
) external view returns (uint256);

/**
* @notice Get the address of the staker at the given index
Expand Down
26 changes: 9 additions & 17 deletions src/rollup/RollupCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,19 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
* @param assertionHash Id of the assertion
* @return Assertion struct
*/
function getAssertionStorage(bytes32 assertionHash)
internal
view
returns (AssertionNode storage)
{
function getAssertionStorage(
bytes32 assertionHash
) internal view returns (AssertionNode storage) {
require(assertionHash != bytes32(0), "ASSERTION_ID_CANNOT_BE_ZERO");
return _assertions[assertionHash];
}

/**
* @notice Get the Assertion for the given index.
*/
function getAssertion(bytes32 assertionHash)
public
view
override
returns (AssertionNode memory)
{
function getAssertion(
bytes32 assertionHash
) public view override returns (AssertionNode memory) {
return getAssertionStorage(assertionHash);
}

Expand All @@ -155,12 +150,9 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
* This function will revert if the given assertion hash does not exist.
* @dev This function is meant for internal use only and has no stability guarantees.
*/
function getAssertionCreationBlockForLogLookup(bytes32 assertionHash)
external
view
override
returns (uint256)
{
function getAssertionCreationBlockForLogLookup(
bytes32 assertionHash
) external view override returns (uint256) {
if (_hostChainIsArbitrum) {
uint256 blockNum = _assertionCreatedAtArbSysBlock[assertionHash];
require(blockNum > 0, "NO_ASSERTION");
Expand Down
8 changes: 3 additions & 5 deletions src/rollup/RollupCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ contract RollupCreator is Ownable {
* - dataHashReader The address of the data hash reader used to read blob hashes
* @return The address of the newly created rollup
*/
function createRollup(RollupDeploymentParams memory deployParams)
public
payable
returns (address)
{
function createRollup(
RollupDeploymentParams memory deployParams
) public payable returns (address) {
{
// Make sure the immutable maxDataSize is as expected
(
Expand Down
9 changes: 3 additions & 6 deletions src/rollup/RollupUserLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,9 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser {
* @notice From the staker's withdrawal address,
* refund a staker that is currently staked on an assertion that either has a chlid assertion or is the latest confirmed assertion.
*/
function returnOldDepositFor(address stakerAddress)
external
override
onlyValidator(stakerAddress)
whenNotPaused
{
function returnOldDepositFor(
address stakerAddress
) external override onlyValidator(stakerAddress) whenNotPaused {
require(msg.sender == withdrawalAddress(stakerAddress), "NOT_WITHDRAWAL_ADDRESS");
_requireInactiveAndWithdrawStaker(stakerAddress);
}
Expand Down
7 changes: 3 additions & 4 deletions src/rollup/ValidatorWalletCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ contract ValidatorWalletCreator is Ownable {
emit TemplateUpdated();
}

function createWallet(address[] calldata initialExecutorAllowedDests)
external
returns (address)
{
function createWallet(
address[] calldata initialExecutorAllowedDests
) external returns (address) {
address _executor = msg.sender;
address _owner = msg.sender;
ProxyAdmin admin = new ProxyAdmin();
Expand Down
Loading

0 comments on commit 3ca118c

Please sign in to comment.