Skip to content

Commit

Permalink
remove unwanted variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneh1999 committed Dec 5, 2024
1 parent 3e0b090 commit b0e24dc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 76 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Lint Contracts
run: yarn solhint

- name: Lint Test Scripts
run: yarn lint:test

- name: Build
run: yarn build:all

Expand Down
98 changes: 31 additions & 67 deletions src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import {
InvalidHeaderFlag,
NativeTokenMismatch,
BadMaxTimeVariation,
Deprecated,
InvalidTEEAttestationQuote
Deprecated
} from "../libraries/Error.sol";
import "./IBridge.sol";
import "./IInboxBase.sol";
Expand Down Expand Up @@ -248,16 +247,7 @@ 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 @@ -273,16 +263,7 @@ 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 @@ -606,11 +587,9 @@ 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 @@ -628,11 +607,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
);
Expand All @@ -657,11 +634,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
view
returns (bytes32, IBridge.TimeBounds memory)
{
function formCallDataHash(
bytes calldata data,
uint256 afterDelayedMessagesRead
) internal view returns (bytes32, IBridge.TimeBounds memory) {
uint256 fullDataLen = HEADER_LENGTH + data.length;
if (fullDataLen > maxDataSize) revert DataTooLarge(fullDataLen, maxDataSize);

Expand Down Expand Up @@ -694,15 +670,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
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 @@ -767,12 +737,7 @@ 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 @@ -800,9 +765,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 @@ -818,19 +783,18 @@ 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 @@ -866,10 +830,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
3 changes: 0 additions & 3 deletions src/libraries/Error.sol
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,3 @@ error Deprecated();

/// @dev Thrown when any component of maxTimeVariation is over uint64
error BadMaxTimeVariation();

/// @dev Thrown when the TEE Attestation quote is invalid
error InvalidTEEAttestationQuote();

0 comments on commit b0e24dc

Please sign in to comment.