Skip to content

Commit

Permalink
Revert "fix: Revert "feat: blobs. (#9302)" (#10187)"
Browse files Browse the repository at this point in the history
This reverts commit a415f65.
  • Loading branch information
MirandaWood committed Nov 25, 2024
1 parent a415f65 commit b4033be
Show file tree
Hide file tree
Showing 128 changed files with 17,443 additions and 11,034 deletions.
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

0 comments on commit b4033be

Please sign in to comment.