## SP1 Celestia-EVM
### Initial Block execution benchmarks
All transactions are basic EVM sends using the following `txflood` CLI:
https://github.com/celestiaorg/celestia-zkevm-hl-testnet/tree/main/txflood
> ⚠️ Note that the current architecture still includes `SignedHeader` blobs in the Namespace which are skipped but must still be proven for Namespace completion.
See [SP1 Prover Network Latency Estimates](https://docs.google.com/spreadsheets/d/1--LmJ_UbI7EspOdYiZBpmAYEojR9CFudk1H45hJT_cY/edit?gid=578931512#gid=578931512) for latency estimates by prover gas.
#### 1. Celestia Block with 0 blobs in namespace.
Proof inputs collected from the docker-compose network:
```
cargo run -p evm-exec-script --bin data-gen --release -- --start 2 --blocks 1
Processing block: 2
Got 0 blobs for block: 2
Got NamespaceProofs, total: 0
Writing proof input data to: testdata/inputs/block-2
Finished processing blobs for Celestia block: 2
```
Benchmark Report:

<details>
<summary>Click to expand Benchmark Results JSON </summary>
```json
{
"total_gas": 4550602,
"total_instruction_count": 162255,
"total_syscall_count": 329,
"cycle_tracker_results": {
"deserialize inputs": 76490,
"execute EVM blocks": 372,
"commit public outputs": 67639,
"verify blob-header equivalency": 419,
"filter signed data blobs and verify signatures": 531,
"verify namespace data": 13498
}
}
```
</details>
```
Outputs: BlockExecOutput {
celestia_header_hash: 15d86cd6d552cf2b3242d49dff86e6714e249e60a3e59442992a23483d9bde3d
prev_celestia_header_hash: c8473a0b7c068c4adbd0f09b1ea22be26210a5fcf6be1ed8cde1a29cd6f96804
new_height: 0
new_state_root: 0000000000000000000000000000000000000000000000000000000000000000
prev_height: 0
prev_state_root: 0000000000000000000000000000000000000000000000000000000000000000
namespace: 00000000000000000000000000000000000000b7b24d9321578eb83626
public_key: e8fa58ffc002ed444a7db888a048358bfd1eb8f4a7363687608fc46edf6bbcc4
}
```
#### 2. Celestia block with 1 `SignedData` containing 1 transaction.
<a name="cel-2"></a>
Proof inputs collected from the docker-compose network:
```shell
cargo run -p evm-exec-script --bin data-gen --release -- --start 149 --blocks 1
Processing block: 149
Got 7 blobs for block: 149
Got NamespaceProofs, total: 3
Got SignedData for EVM block 602
Writing proof input data to: testdata/inputs/block-149
Finished processing blobs for Celestia block: 149
```
Benchmark Report:

<details>
<summary>Click to expand Benchmark Results JSON </summary>
```json
{
"total_gas": 10708352,
"total_instruction_count": 4677375,
"total_syscall_count": 1462,
"cycle_tracker_results": {
"block execution": 420567,
"compute state root": 47836,
"execute EVM blocks": 755739,
"commit public outputs": 67699,
"validate header": 19940,
"deserialize inputs": 543995,
"verify namespace data": 211599,
"initialize witness db": 59328,
"verify blob-header equivalency": 11232,
"validate block post-execution": 16488,
"filter signed data blobs and verify signatures": 3081599,
"recover senders": 56574
}
}
```
</details>
```
Outputs: BlockExecOutput {
celestia_header_hash: 5d4284868638d71b580298b426bab93d7e96d469813db7851c0e42c52a3244ed
prev_celestia_header_hash: 52dba934574a459411c4709860ee86aec09079efb1db6010492321dea2d653e0
new_height: 602
new_state_root: 1642522dd6ffa3320f0c2739f3578d7ecb39048a427e5439cf8cf3def6df0fbd
prev_height: 601
prev_state_root: 53f2255e103c99645f1a8110b510bd5fa45d18b0e790415517d7986c0499f4ce
namespace: 00000000000000000000000000000000000000b7b24d9321578eb83626
public_key: e8fa58ffc002ed444a7db888a048358bfd1eb8f4a7363687608fc46edf6bbcc4
}
```
#### 3. Celestia block with 1 `SignedData` containing 10 transactions.
<a name="cel-3"></a>
Proof inputs collected from the docker-compose network:
```
cargo run -p evm-exec-script --bin data-gen --release -- --start 300 --blocks 1
Finished `release` profile [optimized] target(s) in 1.04s
Running `target/release/data-gen --start 300 --blocks 1`
Processing block: 300
Got 7 blobs for block: 300
Got NamespaceProofs, total: 3
Got SignedData for EVM block 1236
Writing proof input data to: testdata/inputs/block-300
Finished processing blobs for Celestia block: 300
```
Benchmark Report:

<details>
<summary>Click to expand Benchmark Results JSON </summary>
```json
{
"total_gas": 37023740,
"total_instruction_count": 19094167,
"total_syscall_count": 79697,
"cycle_tracker_results": {
"block execution": 3646394,
"compute state root": 137049,
"execute EVM blocks": 10813177,
"commit public outputs": 67646,
"validate header": 551069,
"deserialize inputs": 2386276,
"verify namespace data": 650515,
"initialize witness db": 108133,
"verify blob-header equivalency": 887620,
"validate block post-execution": 869931,
"filter signed data blobs and verify signatures": 4280536,
"recover senders": 5267995
}
}
```
</details>
```
Outputs: BlockExecOutput {
celestia_header_hash: 419fb6e1ca9f30f52232b158590ed498050d5eeb4994cb76972e1d3ca070534a
prev_celestia_header_hash: d290660f278458d50e0e9c8e80671cdc1a857486f984a237f8226a2b1e330011
new_height: 1236
new_state_root: 431f906578a45a52d31002929d574787602e6e32d7bd193c472ee15aa6bd3895
prev_height: 1235
prev_state_root: 1642522dd6ffa3320f0c2739f3578d7ecb39048a427e5439cf8cf3def6df0fbd
namespace: 00000000000000000000000000000000000000b7b24d9321578eb83626
public_key: e8fa58ffc002ed444a7db888a048358bfd1eb8f4a7363687608fc46edf6bbcc4
}
```
#### 4. Celestia block with 1 `SignedData` containing 50 transactions.
<a name="cel-4"></a>
Proof inputs collected from the docker-compose network:
```
cargo run -p evm-exec-script --bin data-gen --release -- --start 388 --blocks 1
Processing block: 388
Got 7 blobs for block: 388
Got NamespaceProofs, total: 3
Got SignedData for EVM block 1608
Writing proof input data to: testdata/inputs/block-388
Finished processing blobs for Celestia block: 388
```
Benchmark Report:

<details>
<summary>Click to expand Benchmark Results JSON </summary>
```json
{
"total_gas": 21671296,
"total_instruction_count": 12028126,
"total_syscall_count": 40236,
"cycle_tracker_results": {
"block execution": 2068453,
"compute state root": 137572,
"execute EVM blocks": 5862273,
"commit public outputs": 67664,
"validate header": 285133,
"deserialize inputs": 1533067,
"verify namespace data": 460381,
"initialize witness db": 108367,
"verify blob-header equivalency": 447876,
"validate block post-execution": 441435,
"filter signed data blobs and verify signatures": 3649473,
"recover senders": 2633235
}
}
```
</details>
```
Outputs: BlockExecOutput {
celestia_header_hash: ce888787b0071452882aff362615df97981fc45c1597be5fde1da34c9aee9ecf
prev_celestia_header_hash: 22d7a8e5909140db499e8cf774d93e98430bf15de6dc58b15a5843b842e6e865
new_height: 1608
new_state_root: abd348ff7fab6edf4cbdc44a12dad2b67ad2ef8fd0eb6adbd3ba837e10a4ddd8
prev_height: 1607
prev_state_root: 431f906578a45a52d31002929d574787602e6e32d7bd193c472ee15aa6bd3895
namespace: 00000000000000000000000000000000000000b7b24d9321578eb83626
public_key: e8fa58ffc002ed444a7db888a048358bfd1eb8f4a7363687608fc46edf6bbcc4
}
```
#### 5. Celestia block with 1 `SignedData` containing 100 transactions.
<a name="cel-5"></a>
Proof inputs collected from the docker-compose network:
```
cargo run -p evm-exec-script --bin data-gen --release -- --start 32 --blocks 1
Processing block: 32
Got 7 blobs for block: 32
Got NamespaceProofs, total: 5
Got SignedData for EVM block 111
Writing proof input data to: testdata/inputs/block-32
Finished processing blobs for Celestia block: 32
```
Benchmark Report:

<details>
<summary>Click to expand Benchmark Results JSON </summary>
```json
{
"total_gas": 37023740,
"total_instruction_count": 19094167,
"total_syscall_count": 79697,
"cycle_tracker_results": {
"block execution": 3646394,
"compute state root": 137049,
"execute EVM blocks": 10813177,
"commit public outputs": 67646,
"validate header": 551069,
"deserialize inputs": 2386276,
"verify namespace data": 650515,
"initialize witness db": 108133,
"verify blob-header equivalency": 887620,
"validate block post-execution": 869931,
"filter signed data blobs and verify signatures": 4280536,
"recover senders": 5267995
}
}
```
</details>
```
Outputs: BlockExecOutput {
celestia_header_hash: 8ff7be08de9e421f474b75f3e61b136c8d76b5e0e407ed57e12ada3c50f21d91
prev_celestia_header_hash: 71e2b31d1651b95b1da01a9fcef23bf175bb27166bff793de294996b1ee45325
new_height: 111
new_state_root: a3745045639fc15f5b4b27026efe395bdee5711a9cf556176abceea4f427b02f
prev_height: 110
prev_state_root: 4adf90e58da14edc882a95d5e148bf1577de0c856ceaa8d34feb05bd73c6c79f
namespace: 00000000000000000000000000000000000000b7b24d9321578eb83626
public_key: 3e805d2a78a55af2a97343a928b9c2a2c85aff69fb7f031000aebfc04a8dbe57
}
```
### Method for data collection
1. Use `txflood` CLI to send txs.
2. Query a tx hash output by the CLI to determine the EVM block number.
3. Query the EVM block number and ensure all txs included.
4. Query the celestia inclusion height.
5. Scrape the data using the rust CLI as shown above.
Determine the inclusion height of a `SignedData` blob in celestia.
E.g. where height=1236, response contains value which is base64 little endian encoded integer.
```shell
grpcurl -plaintext -d '{"key": "rhb/1236/d"}' localhost:7331 rollkit.v1.StoreService.GetMetadata
{
"value": "LAEAAAAAAAA="
}
```