Skip to content

Commit

Permalink
fix: prettier .sol files
Browse files Browse the repository at this point in the history
  • Loading branch information
RISHABHAGRAWALZRA committed Aug 11, 2024
1 parent 2992775 commit b70a6e5
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 44 deletions.
100 changes: 69 additions & 31 deletions src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
// True if the chain this SequencerInbox is deployed on uses custom fee token
bool public immutable isUsingFeeToken;

constructor(uint256 _maxDataSize, IReader4844 reader4844_, bool _isUsingFeeToken) {
constructor(
uint256 _maxDataSize,
IReader4844 reader4844_,
bool _isUsingFeeToken
) {
maxDataSize = _maxDataSize;
if (hostChainIsArbitrum) {
if (reader4844_ != IReader4844(address(0))) revert DataBlobsNotSupported();
Expand Down Expand Up @@ -245,7 +249,16 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
futureSeconds = 1;
}

function maxTimeVariation() external view returns (uint256, uint256, uint256, uint256) {
function maxTimeVariation()
external
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
(
uint64 delayBlocks_,
uint64 futureBlocks_,
Expand All @@ -261,7 +274,16 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
);
}

function maxTimeVariationInternal() internal view returns (uint64, uint64, uint64, uint64) {
function maxTimeVariationInternal()
internal
view
returns (
uint64,
uint64,
uint64,
uint64
)
{
if (_chainIdChanged()) {
return (1, 1, 1, 1);
} else {
Expand Down Expand Up @@ -507,9 +529,11 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
emit SequencerBatchData(seqMessageIndex, data);
}

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 @@ -527,9 +551,11 @@ 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
);
Expand All @@ -555,10 +581,10 @@ 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 formCallDataHash(
bytes calldata data,
uint256 afterDelayedMessagesRead
) internal returns (bytes32, IBridge.TimeBounds memory) {
function formCallDataHash(bytes calldata data, uint256 afterDelayedMessagesRead)
internal
returns (bytes32, IBridge.TimeBounds memory)
{
uint256 fullDataLen = HEADER_LENGTH + data.length;
if (fullDataLen > maxDataSize) revert DataTooLarge(fullDataLen, maxDataSize);

Expand Down Expand Up @@ -593,9 +619,15 @@ 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 returns (bytes32, IBridge.TimeBounds memory, uint256) {
function formBlobDataHash(uint256 afterDelayedMessagesRead)
internal
view
returns (
bytes32,
IBridge.TimeBounds memory,
uint256
)
{
bytes32[] memory dataHashes = reader4844.getDataHashes();
if (dataHashes.length == 0) revert MissingDataHashes();

Expand Down Expand Up @@ -660,7 +692,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
uint256 newMessageCount
)
internal
returns (uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 acc)
returns (
uint256 seqMessageIndex,
bytes32 beforeAcc,
bytes32 delayedAcc,
bytes32 acc
)
{
if (afterDelayedMessagesRead < totalDelayedMessagesRead) revert DelayedBackwards();
if (afterDelayedMessagesRead > bridge.delayedMessageCount()) revert DelayedTooFar();
Expand Down Expand Up @@ -688,9 +725,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
return bridge.sequencerMessageCount();
}

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 @@ -706,18 +743,19 @@ 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 OwnerFunctionCalled(0);
}

/// @inheritdoc ISequencerInbox
function setIsBatchPoster(
address addr,
bool isBatchPoster_
) external onlyRollupOwnerOrBatchPosterManager {
function setIsBatchPoster(address addr, bool isBatchPoster_)
external
onlyRollupOwnerOrBatchPosterManager
{
isBatchPoster[addr] = isBatchPoster_;
emit OwnerFunctionCalled(1);
}
Expand Down Expand Up @@ -753,10 +791,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
}

/// @inheritdoc ISequencerInbox
function setIsSequencer(
address addr,
bool isSequencer_
) external onlyRollupOwnerOrBatchPosterManager {
function setIsSequencer(address addr, bool isSequencer_)
external
onlyRollupOwnerOrBatchPosterManager
{
isSequencer[addr] = isSequencer_;
emit OwnerFunctionCalled(4); // Owner in this context can also be batch poster manager
}
Expand Down
4 changes: 3 additions & 1 deletion src/data-availability/AvailDABridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

pragma solidity ^0.8.4;
import "./IDABridge.sol";

//import "hardhat/console.sol";
contract AvailDABridge is IDABridge {
struct BlobProof {
Expand Down Expand Up @@ -47,8 +48,9 @@ contract AvailDABridge is IDABridge {
// uint256 leafIndex;
// }

bytes1 constant AVAIL_MESSAGE_HEADER_FLAG = 0x0a;
bytes1 public constant AVAIL_MESSAGE_HEADER_FLAG = 0x0a;

// solhint-disable-next-line func-name-mixedcase
function DA_MESSAGE_HEADER_FLAG() external pure returns (bytes1) {
return AVAIL_MESSAGE_HEADER_FLAG;
}
Expand Down
2 changes: 1 addition & 1 deletion src/data-availability/IDABridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ interface IDABridge {
*/
function verifyBatchAttestation(bytes calldata data) external returns (bool);

event validatedBatchAttestationOverDA(bytes32 indexed blobHash);
event ValidatedBatchAttestationOverDA(bytes32 indexed blobHash);
}
8 changes: 4 additions & 4 deletions src/rollup/BridgeCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ contract BridgeCreator is Ownable {
emit ERC20TemplatesUpdated();
}

function _createBridge(
address adminProxy,
BridgeContracts storage templates
) internal returns (BridgeContracts memory) {
function _createBridge(address adminProxy, BridgeContracts storage templates)
internal
returns (BridgeContracts memory)
{
BridgeContracts memory frame;
frame.bridge = IBridge(
address(new TransparentUpgradeableProxy(address(templates.bridge), adminProxy, ""))
Expand Down
16 changes: 9 additions & 7 deletions src/rollup/RollupCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ 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
(, ISequencerInbox ethSequencerInbox, IInboxBase ethInbox, , , ) = bridgeCreator
Expand Down Expand Up @@ -232,10 +234,10 @@ contract RollupCreator is Ownable {
return address(rollup);
}

function _deployUpgradeExecutor(
address rollupOwner,
ProxyAdmin proxyAdmin
) internal returns (address) {
function _deployUpgradeExecutor(address rollupOwner, ProxyAdmin proxyAdmin)
internal
returns (address)
{
IUpgradeExecutor upgradeExecutor = IUpgradeExecutor(
address(
new TransparentUpgradeableProxy(
Expand Down

0 comments on commit b70a6e5

Please sign in to comment.