Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: blobs. #9302

Merged
merged 90 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
d2544a9
feat: first blobs commit - ts + nr only - overflow err
MirandaWood Sep 25, 2024
9cefc9a
feat: hash blob in chunks, force native sim for block-root
MirandaWood Sep 27, 2024
df93cf5
feat: add ts blob class, use real blob in rollup, more tests
MirandaWood Oct 2, 2024
c5539eb
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Oct 4, 2024
5e92023
feat: post merge fixes, add sponge to epoch prover, cleanup
MirandaWood Oct 4, 2024
1d17855
fix: more merge fixes + cleanup
MirandaWood Oct 4, 2024
aff5e35
feat: purge txseffectshash from nr and ts
MirandaWood Oct 7, 2024
dfe722b
feat: publish blobs to L1, verify, test, a lot of cleanup
MirandaWood Oct 11, 2024
bc0678c
chore: fmt, test refactors + fixes
MirandaWood Oct 21, 2024
ad090f6
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Oct 21, 2024
bf98bbc
fix: multiple post merge fixes, refactor err logging, prover-coord te…
MirandaWood Oct 24, 2024
2cd7570
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Oct 24, 2024
8a8dcab
feat: reinstate bignum code after fix, post merge fixes and fmt
MirandaWood Oct 24, 2024
cc01696
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Oct 24, 2024
6f92b1f
chore: revert e2e prover coord fix in favour of master
MirandaWood Oct 24, 2024
233d3fd
feat: added custom existing sponge absorber to save gates, fmt
MirandaWood Oct 25, 2024
7c1749d
feat: tightly pack blobs, encode and decode with prefixes
MirandaWood Oct 29, 2024
247a49d
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Oct 29, 2024
8f3d10f
chore: post merge fixes, formatting
MirandaWood Oct 31, 2024
20674cf
fix: apply fix for public processor state (PR9634)
MirandaWood Nov 1, 2024
38725f8
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 1, 2024
77dcf8e
chore: update fixtures + fmt
MirandaWood Nov 1, 2024
580b1b2
feat: add blob check override, simulate txs
MirandaWood Nov 4, 2024
2166780
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 4, 2024
99ac96e
feat: update bignum, fmt, comments, small fixes
MirandaWood Nov 5, 2024
43bb5f0
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 5, 2024
88733fe
chore: post merge fix
MirandaWood Nov 5, 2024
37f7af4
chore: fix viem kzg (ty Mike), cleanup
MirandaWood Nov 6, 2024
9bb2c21
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 6, 2024
c667c50
feat: added total len to encoding, comments, tests, fmt
MirandaWood Nov 6, 2024
3a7a997
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 6, 2024
225ba00
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 6, 2024
27d839e
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 6, 2024
f241744
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 6, 2024
9c4c4da
chore: remove unused body calldata variable name
MirandaWood Nov 6, 2024
6cbab7e
chore: update hardcoded test val
MirandaWood Nov 6, 2024
deeb044
Update ci.yml
ludamad Nov 6, 2024
afe79e0
chore: cleanup, fmt
MirandaWood Nov 7, 2024
38796a0
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 7, 2024
e80ff6e
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 7, 2024
4c2477f
feat: address some comments
MirandaWood Nov 7, 2024
5dbd06c
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 7, 2024
899eea0
chore: post merge fixes, fmt
MirandaWood Nov 8, 2024
a662fe4
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 8, 2024
5b80e50
chore: post merge fixes, fmt
MirandaWood Nov 8, 2024
079aef8
feat: add blob hash to header
MirandaWood Nov 8, 2024
23092c6
chore: cleanup, remove unused tat
MirandaWood Nov 8, 2024
ad7bb09
refactor: block builders now add all txs at once
MirandaWood Nov 8, 2024
fd6b875
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 8, 2024
a367e6f
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 11, 2024
5e506ce
chore: post merge fixes, fmt, fixtures
MirandaWood Nov 11, 2024
a418c58
feat: delete neg_roots constants, calc instead, small runtime gains
MirandaWood Nov 11, 2024
c06c2ef
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 11, 2024
46d2b3d
feat: save some gates in sponge absorbing
MirandaWood Nov 12, 2024
3969035
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 12, 2024
f4267c5
chore: post merge fixes, fmt, fxitures
MirandaWood Nov 12, 2024
0e9b2c8
feat: save more gates
MirandaWood Nov 12, 2024
96157d0
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 12, 2024
fcbc6ce
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 13, 2024
bcf452e
chore: update constants post merge
MirandaWood Nov 13, 2024
9a67624
chore: rename tofields -> toBlobFields, remove unused code
MirandaWood Nov 13, 2024
76ccac1
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 14, 2024
526b4c6
chore: include contract class logs in blob, some renaming
MirandaWood Nov 14, 2024
862b1b2
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 15, 2024
3d46ec1
Merge remote-tracking branch 'origin' into mw/blob-circuit
MirandaWood Nov 16, 2024
f7cd700
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 18, 2024
512d1b0
feat: 1 blob -> 3 blobs (#10014)
MirandaWood Nov 19, 2024
222b5ae
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 19, 2024
1301c39
chore: make skipBlobCheck shared in sol tests
MirandaWood Nov 19, 2024
03cc903
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 19, 2024
2f7bfd6
chore: remove unec. conversion
MirandaWood Nov 19, 2024
3da7258
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 19, 2024
081f351
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 19, 2024
574f363
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 20, 2024
a7f4080
chore: post merge fixes + fmt
MirandaWood Nov 20, 2024
8b0c9c4
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 20, 2024
16e86b5
chore: post merge fixes, replay base rollup changes
MirandaWood Nov 20, 2024
b2d563d
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 20, 2024
b3b769a
fix: replace c-kzg so browser works (temp sol)
MirandaWood Nov 21, 2024
b6cac9f
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 21, 2024
21d23f3
chore: increase timeouts + fmt
MirandaWood Nov 21, 2024
893f1ec
feat: add back c-kzg (otherwise v slow), remove fns for browser
MirandaWood Nov 21, 2024
02abb31
chore: revert some timeouts, re add test
MirandaWood Nov 22, 2024
c78d8ec
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 22, 2024
20ef3c1
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 22, 2024
20e44cc
feat: address comments, renaming etc
MirandaWood Nov 22, 2024
e66454d
feat: remove txsdecoder
MirandaWood Nov 22, 2024
6b82d25
Merge remote-tracking branch 'origin/master' into mw/blob-circuit
MirandaWood Nov 22, 2024
b787de6
chore: post merge fix w/ sequencer changes
MirandaWood Nov 22, 2024
f76eaf6
chore: disable e2e_epoch due to teardown timeout
MirandaWood Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
concurrency_key: build-x86
# prepare images locally, tagged by commit hash
- name: "Build E2E Image"
timeout-minutes: 40
timeout-minutes: 90
if: (needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master'
run: |
earthly-ci ./yarn-project+export-e2e-test-images
Expand Down
294 changes: 216 additions & 78 deletions l1-contracts/src/core/Rollup.sol

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions l1-contracts/src/core/interfaces/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ interface IRollup {
function propose(
ProposeArgs calldata _args,
SignatureLib.Signature[] memory _signatures,
bytes calldata _body
bytes calldata _body,
bytes calldata _blobInput
) external;

function proposeAndClaim(
ProposeArgs calldata _args,
SignatureLib.Signature[] memory _signatures,
bytes calldata _body,
bytes calldata _blobInput,
EpochProofQuoteLib.SignedEpochProofQuote calldata _quote
) external;

function submitEpochRootProof(
uint256 _epochSize,
bytes32[7] calldata _args,
bytes32[] calldata _fees,
DataStructures.SubmitProofArgs calldata _submitArgs,
bytes calldata _aggregationObject,
bytes calldata _proof
) external;
Expand All @@ -61,7 +61,7 @@ interface IRollup {
SignatureLib.Signature[] memory _signatures,
bytes32 _digest,
Timestamp _currentTime,
bytes32 _txsEffecstHash,
bytes32 _blobsHash,
DataStructures.ExecutionFlags memory _flags
) external view;

Expand Down Expand Up @@ -105,10 +105,7 @@ interface IRollup {
) external view;
function getEpochForBlock(uint256 _blockNumber) external view returns (Epoch);
function getEpochProofPublicInputs(
uint256 _epochSize,
bytes32[7] calldata _args,
bytes32[] calldata _fees,
DataStructures.SubmitProofArgs calldata _submitArgs,
bytes calldata _aggregationObject
) external view returns (bytes32[] memory);
function computeTxsEffectsHash(bytes calldata _body) external pure returns (bytes32);
}
24 changes: 20 additions & 4 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ library Constants {
uint256 internal constant FUNCTION_SELECTOR_NUM_BYTES = 4;
uint256 internal constant INITIALIZATION_SLOT_SEPARATOR = 1000000000;
uint256 internal constant INITIAL_L2_BLOCK_NUM = 1;
uint256 internal constant FIELDS_PER_BLOB = 4096;
uint256 internal constant BLOBS_PER_BLOCK = 3;
uint256 internal constant PRIVATE_LOG_SIZE_IN_BYTES = 576;
uint256 internal constant BLOB_SIZE_IN_BYTES = 126976;
uint256 internal constant AZTEC_MAX_EPOCH_DURATION = 32;
uint256 internal constant GENESIS_ARCHIVE_ROOT =
19007378675971183768036762391356802220352606103602592933942074152320327194720;
Expand Down Expand Up @@ -170,6 +171,9 @@ library Constants {
uint256 internal constant FUNCTION_LEAF_PREIMAGE_LENGTH = 5;
uint256 internal constant GLOBAL_VARIABLES_LENGTH = 9;
uint256 internal constant APPEND_ONLY_TREE_SNAPSHOT_LENGTH = 2;
uint256 internal constant APPEND_ONLY_TREE_SNAPSHOT_LENGTH_BYTES = 36;
uint256 internal constant SPONGE_BLOB_LENGTH = 11;
uint256 internal constant BLOB_PUBLIC_INPUTS = 6;
uint256 internal constant L1_TO_L2_MESSAGE_LENGTH = 6;
uint256 internal constant L2_TO_L1_MESSAGE_LENGTH = 3;
uint256 internal constant SCOPED_L2_TO_L1_MESSAGE_LENGTH = 4;
Expand Down Expand Up @@ -202,6 +206,7 @@ library Constants {
uint256 internal constant TX_REQUEST_LENGTH = 12;
uint256 internal constant TOTAL_FEES_LENGTH = 1;
uint256 internal constant HEADER_LENGTH = 24;
uint256 internal constant HEADER_LENGTH_BYTES = 616;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 490;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 866;
uint256 internal constant PRIVATE_CONTEXT_INPUTS_LENGTH = 37;
Expand All @@ -221,9 +226,9 @@ library Constants {
uint256 internal constant PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1140;
uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 605;
uint256 internal constant CONSTANT_ROLLUP_DATA_LENGTH = 13;
uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 30;
uint256 internal constant BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 90;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 76;
uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 51;
uint256 internal constant BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 666;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 652;
uint256 internal constant GET_NOTES_ORACLE_RETURN_LENGTH = 674;
uint256 internal constant NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP = 2048;
uint256 internal constant NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
Expand Down Expand Up @@ -272,6 +277,17 @@ library Constants {
uint256 internal constant START_EMIT_NULLIFIER_WRITE_OFFSET = 208;
uint256 internal constant START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET = 224;
uint256 internal constant START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET = 226;
uint256 internal constant TX_START_PREFIX = 8392562855083340404;
uint256 internal constant REVERT_CODE_PREFIX = 1;
uint256 internal constant TX_FEE_PREFIX = 2;
uint256 internal constant NOTES_PREFIX = 3;
uint256 internal constant NULLIFIERS_PREFIX = 4;
uint256 internal constant L2_L1_MSGS_PREFIX = 5;
uint256 internal constant PUBLIC_DATA_UPDATE_REQUESTS_PREFIX = 6;
uint256 internal constant NOTE_ENCRYPTED_LOGS_PREFIX = 7;
uint256 internal constant ENCRYPTED_LOGS_PREFIX = 8;
uint256 internal constant UNENCRYPTED_LOGS_PREFIX = 9;
uint256 internal constant CONTRACT_CLASS_LOGS_PREFIX = 10;
uint256 internal constant PROOF_TYPE_PLONK = 0;
uint256 internal constant PROOF_TYPE_HONK = 1;
uint256 internal constant PROOF_TYPE_OINK = 2;
Expand Down
14 changes: 14 additions & 0 deletions l1-contracts/src/core/libraries/DataStructures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,18 @@ library DataStructures {
address bondProvider;
address proposerClaimant;
}

/**
* @notice Struct for submitting the Epoch Proof
* @param epochSize - The size of the epoch (to be promoted to a constant)
* @param args - Array of public inputs to the proof (previousArchive, endArchive, previousBlockHash, endBlockHash, endTimestamp, outHash, proverId)
* @param fees - Array of recipient-value pairs with fees to be distributed for the epoch
* @param blobPublicInputs- The blob PIs for the proof
*/
struct SubmitProofArgs {
uint256 epochSize;
bytes32[7] args;
bytes32[] fees;
bytes blobPublicInputs;
}
}
7 changes: 3 additions & 4 deletions l1-contracts/src/core/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ library Errors {
error Rollup__InvalidProposedArchive(bytes32 expected, bytes32 actual); // 0x32532e73
error Rollup__InvalidTimestamp(Timestamp expected, Timestamp actual); // 0x3132e895
error Rollup__InvalidVersion(uint256 expected, uint256 actual); // 0x9ef30794
error Rollup__InvalidBlobHash(bytes32 blobHash); // 0xc4a168c6
error Rollup__InvalidBlobProof(bytes32 blobHash); // 0x5ca17bef
error Rollup__InvalidBlobPublicInputsHash(bytes32 expected, bytes32 actual); // 0xfe6b4994
error Rollup__NoEpochToProve(); // 0xcbaa3951
error Rollup__NonSequentialProving(); // 0x1e5be132
error Rollup__NotClaimingCorrectEpoch(Epoch expected, Epoch actual); // 0xf0e0744d
Expand All @@ -76,10 +79,6 @@ library Errors {
error Rollup__NonZeroL2Fee(); // 0x7e728abc
error Rollup__InvalidBasisPointFee(uint256 basisPointFee); // 0x4292d136

//TxsDecoder
error TxsDecoder__InvalidLogsLength(uint256 expected, uint256 actual); // 0x829ca981
error TxsDecoder__TxsTooLarge(uint256 expected, uint256 actual); // 0xc7d44a62

// HeaderLib
error HeaderLib__InvalidHeaderSize(uint256 expected, uint256 actual); // 0xf3ccb247
error HeaderLib__InvalidSlotNumber(Slot expected, Slot actual); // 0x09ba91ff
Expand Down
82 changes: 4 additions & 78 deletions l1-contracts/src/core/libraries/HeaderLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {Errors} from "@aztec/core/libraries/Errors.sol";
* | 0x0020 | 0x04 | lastArchive.nextAvailableLeafIndex
* | | | ContentCommitment {
* | 0x0024 | 0x20 | numTxs
* | 0x0044 | 0x20 | txsEffectsHash
* | 0x0044 | 0x20 | blobsHash
* | 0x0064 | 0x20 | inHash
* | 0x0084 | 0x20 | outHash
* | | | StateReference {
Expand Down Expand Up @@ -91,7 +91,7 @@ library HeaderLib {

struct ContentCommitment {
uint256 numTxs;
bytes32 txsEffectsHash;
bytes32 blobsHash;
bytes32 inHash;
bytes32 outHash;
}
Expand All @@ -104,7 +104,7 @@ library HeaderLib {
uint256 totalFees;
}

uint256 private constant HEADER_LENGTH = 0x268; // Header byte length
uint256 private constant HEADER_LENGTH = Constants.HEADER_LENGTH_BYTES; // Header byte length

/**
* @notice Decodes the header
Expand All @@ -126,7 +126,7 @@ library HeaderLib {

// Reading ContentCommitment
header.contentCommitment.numTxs = uint256(bytes32(_header[0x0024:0x0044]));
header.contentCommitment.txsEffectsHash = bytes32(_header[0x0044:0x0064]);
header.contentCommitment.blobsHash = bytes32(_header[0x0044:0x0064]);
header.contentCommitment.inHash = bytes32(_header[0x0064:0x0084]);
header.contentCommitment.outHash = bytes32(_header[0x0084:0x00a4]);

Expand Down Expand Up @@ -160,78 +160,4 @@ library HeaderLib {

return header;
}

function toFields(Header memory _header) internal pure returns (bytes32[] memory) {
bytes32[] memory fields = new bytes32[](24);

// must match the order in the Header.getFields
fields[0] = _header.lastArchive.root;
fields[1] = bytes32(uint256(_header.lastArchive.nextAvailableLeafIndex));
fields[2] = bytes32(_header.contentCommitment.numTxs);
fields[3] = _header.contentCommitment.txsEffectsHash;
fields[4] = _header.contentCommitment.inHash;
fields[5] = _header.contentCommitment.outHash;
fields[6] = _header.stateReference.l1ToL2MessageTree.root;
fields[7] = bytes32(uint256(_header.stateReference.l1ToL2MessageTree.nextAvailableLeafIndex));
fields[8] = _header.stateReference.partialStateReference.noteHashTree.root;
fields[9] = bytes32(
uint256(_header.stateReference.partialStateReference.noteHashTree.nextAvailableLeafIndex)
);
fields[10] = _header.stateReference.partialStateReference.nullifierTree.root;
fields[11] = bytes32(
uint256(_header.stateReference.partialStateReference.nullifierTree.nextAvailableLeafIndex)
);
fields[12] = _header.stateReference.partialStateReference.publicDataTree.root;
fields[13] = bytes32(
uint256(_header.stateReference.partialStateReference.publicDataTree.nextAvailableLeafIndex)
);
fields[14] = bytes32(_header.globalVariables.chainId);
fields[15] = bytes32(_header.globalVariables.version);
fields[16] = bytes32(_header.globalVariables.blockNumber);
fields[17] = bytes32(_header.globalVariables.slotNumber);
fields[18] = bytes32(_header.globalVariables.timestamp);
fields[19] = bytes32(uint256(uint160(_header.globalVariables.coinbase)));
fields[20] = bytes32(_header.globalVariables.feeRecipient);
fields[21] = bytes32(_header.globalVariables.gasFees.feePerDaGas);
fields[22] = bytes32(_header.globalVariables.gasFees.feePerL2Gas);
fields[23] = bytes32(_header.totalFees);

// fail if the header structure has changed without updating this function
require(
fields.length == Constants.HEADER_LENGTH,
Errors.HeaderLib__InvalidHeaderSize(Constants.HEADER_LENGTH, fields.length)
);

return fields;
}

// TODO(#7346): Currently using the below to verify block root proofs until batch rollups fully integrated.
// Once integrated, remove the below fn (not used anywhere else).
function toFields(GlobalVariables memory _globalVariables)
internal
pure
returns (bytes32[] memory)
{
bytes32[] memory fields = new bytes32[](Constants.GLOBAL_VARIABLES_LENGTH);

fields[0] = bytes32(_globalVariables.chainId);
fields[1] = bytes32(_globalVariables.version);
fields[2] = bytes32(_globalVariables.blockNumber);
fields[3] = bytes32(_globalVariables.slotNumber);
fields[4] = bytes32(_globalVariables.timestamp);
fields[5] = bytes32(uint256(uint160(_globalVariables.coinbase)));
fields[6] = bytes32(_globalVariables.feeRecipient);
fields[7] = bytes32(_globalVariables.gasFees.feePerDaGas);
fields[8] = bytes32(_globalVariables.gasFees.feePerL2Gas);

// fail if the header structure has changed without updating this function
// TODO(Miranda): Temporarily using this method and below error while block-root proofs are verified
// When we verify root proofs, this method can be removed => no need for separate named error
require(
fields.length == Constants.GLOBAL_VARIABLES_LENGTH,
Errors.HeaderLib__InvalidHeaderSize(Constants.HEADER_LENGTH, fields.length)
);

return fields;
}
}
Loading