Skip to content

Commit ae110bb

Browse files
committed
refactor: compartmentalise
1 parent f10f8e6 commit ae110bb

File tree

23 files changed

+451
-486
lines changed

23 files changed

+451
-486
lines changed

l1-contracts/src/core/FeeJuicePortal.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ contract FeeJuicePortal is IFeeJuicePortal {
6868
// Preamble
6969
address rollup = canonicalRollup();
7070
uint256 version = REGISTRY.getVersionFor(rollup);
71-
IInbox inbox = IRollup(rollup).INBOX();
71+
IInbox inbox = IRollup(rollup).getInbox();
7272
DataStructures.L2Actor memory actor = DataStructures.L2Actor(L2_TOKEN_ADDRESS, version);
7373

7474
// Hash the message content to be reconstructed in the receiving contract

l1-contracts/src/core/Rollup.sol

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ import {
1111
EnumerableSet
1212
} from "@aztec/core/interfaces/IStaking.sol";
1313
import {IValidatorSelection} from "@aztec/core/interfaces/IValidatorSelection.sol";
14+
import {DataStructures} from "@aztec/core/libraries/DataStructures.sol";
1415
import {FeeAssetValue} from "@aztec/core/libraries/RollupLibs/FeeMath.sol";
15-
16-
// We allow the unused imports here as they make it much simpler to import the Rollup later
17-
// solhint-disable no-unused-import
16+
import {FeeMath} from "@aztec/core/libraries/RollupLibs/FeeMath.sol";
17+
import {HeaderLib} from "@aztec/core/libraries/RollupLibs/HeaderLib.sol";
18+
import {EpochProofLib} from "./libraries/RollupLibs/EpochProofLib.sol";
1819
import {
1920
RollupCore,
2021
Config,
2122
IRewardDistributor,
2223
IFeeJuicePortal,
2324
IERC20,
2425
BlockLog,
25-
FeeHeader,
26-
ManaBaseFeeComponents,
27-
SubmitEpochRootProofArgs,
28-
L1FeeData,
2926
ValidatorSelectionLib,
3027
StakingLib,
3128
TimeLib,
@@ -34,18 +31,16 @@ import {
3431
Timestamp,
3532
Errors,
3633
Signature,
37-
DataStructures,
3834
ExtRollupLib,
39-
IntRollupLib,
40-
EpochRewards,
41-
FeeAssetPerEthE9,
4235
EthValue,
4336
PriceLib,
4437
STFLib,
45-
RollupStore
38+
RollupStore,
39+
IInbox,
40+
IOutbox,
41+
ProposeLib,
42+
EpochRewards
4643
} from "./RollupCore.sol";
47-
import {EpochProofLib} from "./libraries/RollupLibs/EpochProofLib.sol";
48-
// solhint-enable no-unused-import
4944

5045
/**
5146
* @title Rollup
@@ -60,7 +55,6 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
6055
using TimeLib for Timestamp;
6156
using TimeLib for Slot;
6257
using TimeLib for Epoch;
63-
using IntRollupLib for ManaBaseFeeComponents;
6458
using PriceLib for EthValue;
6559

6660
constructor(
@@ -198,8 +192,8 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
198192
bytes32 _blobsHash,
199193
DataStructures.ExecutionFlags memory _flags
200194
) external view override(IRollup) {
201-
_validateHeader(
202-
ExtRollupLib.decodeHeader(_header),
195+
ProposeLib.validateHeader(
196+
HeaderLib.decode(_header),
203197
_signatures,
204198
_digest,
205199
_currentTime,
@@ -524,6 +518,18 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
524518
return EpochProofLib.CUAUHXICALLI;
525519
}
526520

521+
function getVersion() external view override(IRollup) returns (uint256) {
522+
return STFLib.getStorage().config.version;
523+
}
524+
525+
function getInbox() external view override(IRollup) returns (IInbox) {
526+
return STFLib.getStorage().config.inbox;
527+
}
528+
529+
function getOutbox() external view override(IRollup) returns (IOutbox) {
530+
return STFLib.getStorage().config.outbox;
531+
}
532+
527533
function getFeeAsset() external view override(IRollup) returns (IERC20) {
528534
return STFLib.getStorage().config.feeAsset;
529535
}
@@ -593,7 +599,7 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
593599
override(IRollup)
594600
returns (uint256)
595601
{
596-
return getManaBaseFeeComponentsAt(_timestamp, _inFeeAsset).summedBaseFee();
602+
return FeeMath.summedBaseFee(getManaBaseFeeComponentsAt(_timestamp, _inFeeAsset));
597603
}
598604

599605
/**

0 commit comments

Comments
 (0)