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

update finalizeBatchWithProof -> finalizeBatchWithProof4844 #346

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
15 changes: 9 additions & 6 deletions src/content/docs/en/technology/chain/rollup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function commitBatchWithBlobProof(
bytes[] memory chunks,
bytes calldata skippedL1MessageBitmap,
bytes calldata blobDataProof
) external;
) external override OnlySequencer;
```

After the `commitBatchWithBlobProof` function verifies the parent batch is committed before, it constructs the batch header of the batch and stores the hash of the batch header in the `ScrollChain` contract.
Expand Down Expand Up @@ -90,24 +90,27 @@ In addition, the `commitBatchWithBlobProof` function contains a bitmap of skippe

## Finalize Transaction

The Finalize Transaction finalizes the previously-committed batch with a validity proof. The transaction also submits the state root and the withdraw root after the batch. Here is the function signature of `finalizeBatchWithProof`:
The Finalize Transaction finalizes the previously-committed batch with a validity proof. The transaction also submits the state root and the withdraw root after the batch. Here is the function signature of `finalizeBatchWithProof4844`:

```solidity
function finalizeBatchWithProof(
function finalizeBatchWithProof4844(
bytes calldata batchHeader,
bytes32 prevStateRoot,
bytes32,
bytes32 postStateRoot,
bytes32 withdrawRoot,
bytes calldata blobDataProof,
bytes calldata aggrProof
) external override OnlyProver
```

The `finalizeBatchWithProof` function first verifies if the batch has been committed in the contract. It then calculates the public input hash as follows
The `finalizeBatchWithProof4844` function first verifies if the batch has been committed in the contract. It then calculates the public input hash as follows

```
publicInputHash := keccak(chainId || prevStateRoot || postStateRoot || withdrawRoot || batch.dataHash)
publicInputHash := keccak(chainId || prevStateRoot || postStateRoot || withdrawRoot || batch.dataHash || blobDataProof[0:64] || blobVersionedHash)
```

, where the `prevStateRoot` is read from the `finalizedStateRoots` map variable on the contract and `blobVersionedHash` is as described in the [Codec](#batchheader-codec) section.

The public input hash and the validity proof are sent to the plonk solidity verifier. Once the verification passes, the new state root and withdraw root are stored in the `ScrollChain` contract.

```solidity
Expand Down