Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions l1-contracts/src/core/interfaces/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ struct PublicInputArgs {
bytes32 previousArchive;
bytes32 endArchive;
bytes32 outHash;
// Inbox rolling-hash chain segment consumed across the proven epoch (AZIP-22 Fast Inbox). Deliberately UNVALIDATED
// until the Fast Inbox flip, when they get checked against per-checkpoint records written at propose; for now they
// are only passed through to the proof's public inputs.
bytes32 previousInboxRollingHash;
bytes32 endInboxRollingHash;
address proverId;
}

Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library Constants {
355_785_372_471_781_095_838_790_036_702_437_931_769_306_153_278_986_832_745_847_530_947_941_691_539;
uint256 internal constant FEE_JUICE_ADDRESS = 3;
uint256 internal constant BLS12_POINT_COMPRESSED_BYTES = 48;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 111;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 113;
uint256 internal constant NUM_MSGS_PER_BASE_PARITY = 256;
uint256 internal constant NUM_BASE_PARITY_PER_ROOT_PARITY = 4;
}
12 changes: 10 additions & 2 deletions l1-contracts/src/core/libraries/rollup/EpochProofLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ library EpochProofLib {
// previous_archive_root: Field,
// end_archive_root: Field,
// out_hash: Field,
// previous_inbox_rolling_hash: Field,
// end_inbox_rolling_hash: Field,
// checkpointHeaderHashes: [Field; Constants.MAX_CHECKPOINTS_PER_EPOCH],
// fees: [FeeRecipient; Constants.MAX_CHECKPOINTS_PER_EPOCH],
// chain_id: Field,
Expand All @@ -208,15 +210,21 @@ library EpochProofLib {
publicInputs[1] = _args.endArchive;

publicInputs[2] = _args.outHash;

// Inbox rolling-hash chain segment consumed across the epoch (AZIP-22 Fast Inbox). Deliberately UNVALIDATED
// until the Fast Inbox flip, when they get checked against per-checkpoint records written at propose; for now
// they are only passed through to the proof's public inputs.
publicInputs[3] = _args.previousInboxRollingHash;
publicInputs[4] = _args.endInboxRollingHash;
}

uint256 numCheckpoints = _end - _start + 1;

for (uint256 i = 0; i < numCheckpoints; i++) {
publicInputs[3 + i] = STFLib.getHeaderHash(_start + i);
publicInputs[5 + i] = STFLib.getHeaderHash(_start + i);
}

uint256 offset = 3 + Constants.MAX_CHECKPOINTS_PER_EPOCH;
uint256 offset = 5 + Constants.MAX_CHECKPOINTS_PER_EPOCH;

// Taking recipient/value from the checkpoint headers rather than the prover
// as defense in depth. Slots past numCheckpoints stay zero.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct ProposedHeader {
bytes32 blockHeadersHash;
bytes32 blobsHash;
bytes32 inHash;
bytes32 inboxRollingHash;
bytes32 outHash;
Slot slotNumber;
Timestamp timestamp;
Expand Down Expand Up @@ -56,6 +57,7 @@ library ProposedHeaderLib {
_header.blockHeadersHash,
_header.blobsHash,
_header.inHash,
_header.inboxRollingHash,
_header.outHash,
_header.slotNumber,
Timestamp.unwrap(_header.timestamp).toUint64(),
Expand Down
16 changes: 13 additions & 3 deletions l1-contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,12 @@ contract RollupTest is RollupBase {
CheckpointLog memory checkpoint = rollup.getCheckpoint(0);

PublicInputArgs memory args = PublicInputArgs({
previousArchive: checkpoint.archive, endArchive: data.archive, outHash: data.header.outHash, proverId: address(0)
previousArchive: checkpoint.archive,
endArchive: data.archive,
outHash: data.header.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: data.header.inboxRollingHash,
proverId: address(0)
});

ProposedHeader[] memory headers = new ProposedHeader[](1);
Expand All @@ -896,7 +901,7 @@ contract RollupTest is RollupBase {
bytes32[] memory publicInputs = rollup.getEpochProofPublicInputs(1, 1, args, headers, data.batchedBlobInputs);
assertEq(publicInputs.length, Constants.ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH, "Unexpected public inputs length");

uint256 feesOffset = 3 + Constants.MAX_CHECKPOINTS_PER_EPOCH;
uint256 feesOffset = 5 + Constants.MAX_CHECKPOINTS_PER_EPOCH;
assertEq(
publicInputs[feesOffset], bytes32(uint256(uint160(headers[0].coinbase))), "Coinbase not sourced from header"
);
Expand Down Expand Up @@ -936,7 +941,12 @@ contract RollupTest is RollupBase {
address _prover
) internal {
PublicInputArgs memory args = PublicInputArgs({
previousArchive: _prevArchive, endArchive: _archive, outHash: _outHash, proverId: _prover
previousArchive: _prevArchive,
endArchive: _archive,
outHash: _outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: _prover
});

uint256 size = _end - _start + 1;
Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/base/DecoderBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ contract DecoderBase is TestBase {
bytes32 feeRecipient;
GasFees gasFees;
bytes32 inHash;
bytes32 inboxRollingHash;
bytes32 lastArchiveRoot;
bytes32 outHash;
uint256 slotNumber;
Expand Down Expand Up @@ -104,6 +105,7 @@ contract DecoderBase is TestBase {
blockHeadersHash: full.checkpoint.header.blockHeadersHash,
blobsHash: full.checkpoint.header.blobsHash,
inHash: full.checkpoint.header.inHash,
inboxRollingHash: full.checkpoint.header.inboxRollingHash,
outHash: full.checkpoint.header.outHash,
slotNumber: Slot.wrap(full.checkpoint.header.slotNumber),
timestamp: Timestamp.wrap(full.checkpoint.header.timestamp),
Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/base/RollupBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ contract RollupBase is DecoderBase {
previousArchive: parentCheckpointLog.archive,
endArchive: endFull.checkpoint.archive,
outHash: endFull.checkpoint.header.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: _prover
});

Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/benchmark/happy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ contract BenchmarkRollupTest is FeeModelTestPoints, DecoderBase {
previousArchive: rollup.getCheckpoint(start).archive,
endArchive: endCheckpoint.archive,
outHash: endCheckpoint.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(0)
});

Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/compression/PreHeating.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ contract PreHeatingTest is FeeModelTestPoints, DecoderBase {
previousArchive: rollup.getCheckpoint(start).archive,
endArchive: endCheckpoint.archive,
outHash: endCheckpoint.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(0)
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ abstract contract EscapeHatchIntegrationBase is ValidatorSelectionTestBase {
blockHeadersHash: full.checkpoint.header.blockHeadersHash,
blobsHash: full.checkpoint.header.blobsHash,
inHash: full.checkpoint.header.inHash,
inboxRollingHash: full.checkpoint.header.inboxRollingHash,
outHash: full.checkpoint.header.outHash,
slotNumber: slotNumber,
timestamp: rollup.getTimestampForSlot(slotNumber),
Expand Down Expand Up @@ -324,6 +325,8 @@ abstract contract EscapeHatchIntegrationBase is ValidatorSelectionTestBase {
previousArchive: previousArchive,
endArchive: endArchive,
outHash: endFull.checkpoint.header.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: _prover
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ contract OutHashValidationSkippedTest is EscapeHatchIntegrationBase {
previousArchive: rollup.archiveAt(0),
endArchive: rollup.archiveAt(1),
outHash: wrongOutHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(this)
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ contract submitEpochRootProofTest is EscapeHatchIntegrationBase {
bytes32 outHash = rollup.getCheckpoint(1).outHash;

PublicInputArgs memory args = PublicInputArgs({
previousArchive: previousArchive, endArchive: endArchive, outHash: outHash, proverId: address(this)
previousArchive: previousArchive,
endArchive: endArchive,
outHash: outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(this)
});

ProposedHeader[] memory headers = new ProposedHeader[](1);
Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/fees/FeeRollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ contract FeeRollupTest is FeeModelTestPoints, DecoderBase {
previousArchive: rollup.getCheckpoint(_start).archive,
endArchive: endCheckpoint.archive,
outHash: endCheckpoint.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(0)
});

Expand Down
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/empty_checkpoint_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"blockHeadersHash": "0x2e3e0911389bc48fa8126a93273d016cc7dc08019f8ffc5f1f5ae7d90745eaa2",
"blobsHash": "0x00e5b752fe6bc2154155ff3a979c4c5fa91d3ac0d716169ac521e1560fd83b2b",
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
"outHash": "0x00c95e0ceb41951039e1592745ec2faea9866f6eaf01bf189a4463b4143af093",
"slotNumber": 99,
"timestamp": 1776857814,
Expand All @@ -47,7 +48,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x0069eb49ccf7b0dd2902a19712dd167fd3b5d890df7f0711fdcfe4d2987838ad",
"headerHash": "0x0002fc455005d993521be4e6f8ed92d1e0b50e58b21445881c87d02ed51a1e4c",
"numTxs": 0
}
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/empty_checkpoint_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"blockHeadersHash": "0x0b3bda1754ca30707b8c0bbe72760c68e574cf23309e7e4fd7cabea36b4078da",
"blobsHash": "0x000e9acabf609c9c113078ecb383ba6310573ce246958b605452132617d2c960",
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
"outHash": "0x00c95e0ceb41951039e1592745ec2faea9866f6eaf01bf189a4463b4143af093",
"slotNumber": 102,
"timestamp": 1776858030,
Expand All @@ -47,7 +48,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x0004d4907090fd10f0c7fa759b7ce89c3b7055385423b585c5f7e959c17290ef",
"headerHash": "0x00120ecaf7a72f61adf3c8ee180acd930401221668a4792a8f91584755840d16",
"numTxs": 0
}
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/mixed_checkpoint_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"blockHeadersHash": "0x087b6f59388fa4207876ee1b50521ff838d6eed422d0ad07ff996393f32a77e6",
"blobsHash": "0x001bef3ff3f657c565ff86d5072186f7f2bfddb8a31ca0714562c164fe954d84",
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
"outHash": "0x00cffdbb0e7f5e164d314d781d38ae31230910a3bae4c34e7df6222df71b1539",
"slotNumber": 99,
"timestamp": 1776857848,
Expand All @@ -80,7 +81,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x003ce6d2bb91ea8852841510f5485595dfbddbaa0420e083caf37f182be2140a",
"headerHash": "0x00c1431d117825d25f8169e35eb70ed4b16c0fc4b3cac85506852c240d03740e",
"numTxs": 4
}
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/mixed_checkpoint_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"blockHeadersHash": "0x144dbe32a03df9ccc672207c93cd22099eb91e44a71e1676148cd3c6c6c98b9e",
"blobsHash": "0x008bd0b669b942b57ccf85d3401214db65cde3608afa0b2ae0e57f35ec60d72e",
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
"outHash": "0x008a85da85a596471f2e5fe402fde332723da8d24b6e7affd60d16c7cb7e9020",
"slotNumber": 102,
"timestamp": 1776858064,
Expand All @@ -80,7 +81,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x00eb0f37a51d2df835ea48d6cdde28398df86078d8507d467f34434dac062456",
"headerHash": "0x00ab5faa05cb38faa2cd1fc62c40007f64594c9fdc3bb8b7b478a351a7c7dc5a",
"numTxs": 4
}
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/single_tx_checkpoint_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"blockHeadersHash": "0x07db5c24565ad9a2c9d39ef7d9a4446e9742d6090567ff28aef9a45f4738a5cb",
"blobsHash": "0x00ec2400a7cfc9d975cb0802980d49387588738160a0cf0301f07e1abad6456c",
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
"outHash": "0x007c92c6cf05665e1c02a305370a4d38bcb8b555261c6b39c862f8c067d6bcb7",
"slotNumber": 99,
"timestamp": 1776857833,
Expand All @@ -56,7 +57,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x00628120df9716928e25a69ca7b1ac2497f22fdaab439f64315ad4daf7bc5191",
"headerHash": "0x0072a35395a79027db315321cbdaba5bc0b070979c3395b7369ec902ca48d9b2",
"numTxs": 1
}
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/fixtures/single_tx_checkpoint_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"blockHeadersHash": "0x12813725f2d16ce92088d2401ffa4a53ce6061bf75b77320ca7b8ef6c5145adf",
"blobsHash": "0x002b8ae4c9f405529e2b689b829852ad52f77acdac57d1dbac3dabea1760affc",
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
"outHash": "0x0007eac1d76cddf92b28b8f11cd292f199f35dfc588376092986575cef487f59",
"slotNumber": 102,
"timestamp": 1776858049,
Expand All @@ -56,7 +57,7 @@
"totalManaUsed": 0,
"accumulatedFees": 0
},
"headerHash": "0x00f2d5075ed8fdbb50bc0171790cb495308b229325c0aa3e1c3fadd5772d11f4",
"headerHash": "0x000b3c0bf27d3123a81b66570e4b63734cb06bbfd260a70fabbbfd41dec13255",
"numTxs": 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ contract ValidatorSelectionTest is ValidatorSelectionTestBase {
previousArchive: parentCheckpointLog.archive,
endArchive: endFull.checkpoint.archive,
outHash: endFull.checkpoint.header.outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: prover
});

Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/test/validator-selection/tmnt207.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ contract Tmnt207Test is RollupBase {
previousArchive: rollup.getCheckpoint(0).archive,
endArchive: rollup.getCheckpoint(1).archive,
outHash: rollup.getCheckpoint(1).outHash,
previousInboxRollingHash: 0,
endInboxRollingHash: 0,
proverId: address(0)
}),
headers: headers,
Expand Down
Loading
Loading