Skip to content

Commit

Permalink
README for get_log
Browse files Browse the repository at this point in the history
  • Loading branch information
akonior committed Jun 3, 2024
1 parent 1f6e07e commit 0703724
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ethereum/circuits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The main library is available in [lib/](./lib) directory and consists of:
- [smart contract storage variables](./get_storage/README.md)
- [transaction](./get_transaction/README.md)
- [receipts](./get_receipt/README.md)
- logs
- [logs](./get_log/README.md)
- [rlp decoding](./lib/src/rlp/README.md) used by Ethereum to store data
- [merkle patricia proofs](./lib/src/merkle_patricia_proofs/README.md) - implementation for Ethereum Merkle Patricia tries
- [fragments](./lib/src/misc/fragment.nr) structure similar to Rust's slice, used for parsing data
Expand All @@ -35,6 +35,7 @@ Additionally, there are binary crates used for recursive proving. See detailed s
| [`get_storage_recursive`](./get_storage_recursive/) | Binary crate for generating recursive storage proofs | [Docs](./get_storage_recursive/README.md) |
| [`get_receipt`](./get_receipt/) | Binary crate for generating receipt proofs | [Docs](./get_receipt/README.md) |
| [`get_transaction`](./get_transaction/) | Binary crate for generating transaction proofs | [Docs](./get_transaction/README.md) |
| [`get_log`](./get_log/) | Binary crate for generating log proofs | [Docs](./get_log/README.md) |

### Recursive binaries

Expand Down
9 changes: 9 additions & 0 deletions ethereum/circuits/get_log/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Noir get_log binary circuit

This is a binary Noir crate used to generate log proofs.

```rust
fn main(chain_id: pub Field, block_number: pub u64, tx_idx: pub Field, log_idx: pub u64) -> pub LogWithinBlock<...>;
```

Prover data is located in [`Prover.toml`](Prover.toml)
25 changes: 25 additions & 0 deletions ethereum/circuits/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ pub fn get_transaction<MAX_DATA_LEN, ...>(
) -> TransactionWithinBlock<MAX_DATA_LEN>;
```

```rust
pub fn get_log<MAX_LOG_DATA_LEN, MAX_LOGS_COUNT>(
chain_id: Field,
block_number: u64,
tx_idx: Field,
log_idx: u64
) -> LogWithinBlock<MAX_LOG_DATA_LEN>;
```

### Without oracles

If you decide to not use Oracles - you will need to provide all the data manually, but you can still use verifier functions to verify data & proofs.
Expand Down Expand Up @@ -106,6 +115,7 @@ All the function in this library prove that the objects are contained within som
├── receipt.nr
├── account.nr
├── account_with_storage.nr
├── log.nr
├── transaction.nr
├── uint256.nr
└── verifiers
Expand Down Expand Up @@ -202,6 +212,21 @@ struct TransactionWithinBlock<MAX_DATA_LEN> {
}
```

```rust
struct Log<MAX_LOG_DATA_LEN> {
address: Address,
topics: BoundedVec<Bytes32, MAX_TOPICS_COUNT>,
data: BoundedVec<u8, MAX_LOG_DATA_LEN>,
}
```

```rust
struct LogWithinBlock<MAX_LOG_DATA_LEN> {
log: Log<MAX_LOG_DATA_LEN>,
block_hash: Bytes32
}
```

## RLP decoding

[rlp folder](./src/rlp/README.md) contains tools to work with RLP encoded data
Expand Down
5 changes: 4 additions & 1 deletion ethereum/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This repo contains the following smart contracts:
- [`GetStorageUltraPlonkVerifier`](src/generated-verifier/GetStorageUltraPLONKVerifier.sol) auto-generated from [get_storage](../circuits/get_storage)
- [`GetReceiptUltraPlonkVerifier`](src/generated-verifier/GetReceiptUltraPLONKVerifier.sol) auto-generated from [get_receipt](../circuits/get_receipt)
- [`GetTransactionUltraPlonkVerifier`](src/generated-verifier/GetTransactionUltraPLONKVerifier.sol) auto-generated from [get_transaction](../circuits/get_transaction)
- [`GetLogUltraPlonkVerifier`](src/generated-verifier/GetLogUltraPLONKVerifier.sol) auto-generated from [get_log](../circuits/get_log)

Because forge can not compile files outside of it's `src` directory - we symlink autogenerated contracts.

Expand Down Expand Up @@ -36,7 +37,9 @@ out
│   └── UltraVerifier.json
├── GetStorageUltraPLONKVerifier.sol
│  └── UltraVerifier.json
└── GetTransactionUltraPLONKVerifier.sol
├─── GetTransactionUltraPLONKVerifier.sol
│   └── UltraVerifier.json
└── GetLogUltraPLONKVerifier.sol
   └── UltraVerifier.json
```

Expand Down

0 comments on commit 0703724

Please sign in to comment.