Skip to content

Commit

Permalink
get_log binary (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
akonior authored May 29, 2024
2 parents 1581137 + 94557ab commit b673607
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/circuits_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
nargo prove --package get_storage --oracle-resolver=http://localhost:5555
nargo prove --package get_receipt --oracle-resolver=http://localhost:5555
nargo prove --package get_transaction --oracle-resolver=http://localhost:5555
nargo prove --package get_log --oracle-resolver=http://localhost:5555
nargo prove --package is_dao_worthy --oracle-resolver=http://localhost:5555
nargo prove --package is_ape_owner --oracle-resolver=http://localhost:5555
Expand All @@ -60,6 +61,7 @@ jobs:
nargo verify --package get_storage
nargo verify --package get_receipt
nargo verify --package get_transaction
nargo verify --package get_log
nargo verify --package is_dao_worthy
nargo verify --package is_ape_owner
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/contract_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
nargo codegen-verifier --package get_header
nargo codegen-verifier --package get_receipt
nargo codegen-verifier --package get_transaction
nargo codegen-verifier --package get_log
- name: Run Forge build
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
nargo prove --package get_storage --oracle-resolver=http://localhost:5555
nargo prove --package get_receipt --oracle-resolver=http://localhost:5555
nargo prove --package get_transaction --oracle-resolver=http://localhost:5555
nargo prove --package get_log --oracle-resolver=http://localhost:5555
- name: Run nargo codegen-verifier
run: |
Expand All @@ -58,6 +59,7 @@ jobs:
nargo codegen-verifier --package get_storage
nargo codegen-verifier --package get_receipt
nargo codegen-verifier --package get_transaction
nargo codegen-verifier --package get_log
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/static_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
echo '{ "abi": [] }' > target/get_header.json
echo '{ "abi": [] }' > target/get_receipt.json
echo '{ "abi": [] }' > target/get_transaction.json
echo '{ "abi": [] }' > target/get_log.json
- name: Create fake smart contract build artefacts
working-directory: .
Expand All @@ -51,6 +52,8 @@ jobs:
echo '{ "abi": [], "bytecode": { "object": "" } }' > ethereum/contracts/out/GetReceiptUltraPLONKVerifier.sol/UltraVerifier.json
mkdir -p ethereum/contracts/out/GetTransactionUltraPLONKVerifier.sol
echo '{ "abi": [], "bytecode": { "object": "" } }' > ethereum/contracts/out/GetTransactionUltraPLONKVerifier.sol/UltraVerifier.json
mkdir -p ethereum/contracts/out/GetLogUltraPLONKVerifier.sol
echo '{ "abi": [], "bytecode": { "object": "" } }' > ethereum/contracts/out/GetLogUltraPLONKVerifier.sol/UltraVerifier.json
- name: Run TypeScript Build
run: yarn build
Expand Down
1 change: 1 addition & 0 deletions Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"ethereum/circuits/get_account",
"ethereum/circuits/get_header",
"ethereum/circuits/get_transaction",
"ethereum/circuits/get_log",
"vlayer/ethereum/circuits/lib",
"vlayer/examples/circuits/is_dao_worthy",
"vlayer/examples/circuits/is_ape_owner",
Expand Down
7 changes: 7 additions & 0 deletions ethereum/circuits/get_log/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "get_log"
type = "bin"
compiler_version = ">=0.30.0"

[dependencies]
ethereum = { path = "../lib" }
4 changes: 4 additions & 0 deletions ethereum/circuits/get_log/Prover.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
chain_id = "1"
block_number = "19421720"
tx_idx = "291"
log_idx = "0"
18 changes: 18 additions & 0 deletions ethereum/circuits/get_log/Verifier.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
block_number = "0x0000000000000000000000000000000000000000000000000000000001285a18"
chain_id = "0x0000000000000000000000000000000000000000000000000000000000000001"
log_idx = "0x0000000000000000000000000000000000000000000000000000000000000000"
tx_idx = "0x0000000000000000000000000000000000000000000000000000000000000123"

[return]
block_hash = ["0x00000000000000000000000000000000000000000000000000000000000000cd", "0x00000000000000000000000000000000000000000000000000000000000000bb", "0x00000000000000000000000000000000000000000000000000000000000000f2", "0x00000000000000000000000000000000000000000000000000000000000000bf", "0x0000000000000000000000000000000000000000000000000000000000000017", "0x0000000000000000000000000000000000000000000000000000000000000020", "0x0000000000000000000000000000000000000000000000000000000000000048", "0x00000000000000000000000000000000000000000000000000000000000000ba", "0x0000000000000000000000000000000000000000000000000000000000000004", "0x000000000000000000000000000000000000000000000000000000000000004c", "0x00000000000000000000000000000000000000000000000000000000000000eb", "0x00000000000000000000000000000000000000000000000000000000000000f2", "0x0000000000000000000000000000000000000000000000000000000000000064", "0x000000000000000000000000000000000000000000000000000000000000000d", "0x00000000000000000000000000000000000000000000000000000000000000b2", "0x000000000000000000000000000000000000000000000000000000000000003b", "0x00000000000000000000000000000000000000000000000000000000000000d5", "0x00000000000000000000000000000000000000000000000000000000000000d5", "0x00000000000000000000000000000000000000000000000000000000000000d6", "0x00000000000000000000000000000000000000000000000000000000000000d2", "0x00000000000000000000000000000000000000000000000000000000000000e5", "0x00000000000000000000000000000000000000000000000000000000000000fe", "0x000000000000000000000000000000000000000000000000000000000000008e", "0x00000000000000000000000000000000000000000000000000000000000000e0", "0x00000000000000000000000000000000000000000000000000000000000000eb", "0x0000000000000000000000000000000000000000000000000000000000000036", "0x0000000000000000000000000000000000000000000000000000000000000045", "0x00000000000000000000000000000000000000000000000000000000000000f7", "0x0000000000000000000000000000000000000000000000000000000000000060", "0x00000000000000000000000000000000000000000000000000000000000000ee", "0x0000000000000000000000000000000000000000000000000000000000000096", "0x000000000000000000000000000000000000000000000000000000000000002e"]

[return.log]
address = ["0x00000000000000000000000000000000000000000000000000000000000000c0", "0x000000000000000000000000000000000000000000000000000000000000002a", "0x00000000000000000000000000000000000000000000000000000000000000aa", "0x0000000000000000000000000000000000000000000000000000000000000039", "0x00000000000000000000000000000000000000000000000000000000000000b2", "0x0000000000000000000000000000000000000000000000000000000000000023", "0x00000000000000000000000000000000000000000000000000000000000000fe", "0x000000000000000000000000000000000000000000000000000000000000008d", "0x000000000000000000000000000000000000000000000000000000000000000a", "0x000000000000000000000000000000000000000000000000000000000000000e", "0x000000000000000000000000000000000000000000000000000000000000005c", "0x000000000000000000000000000000000000000000000000000000000000004f", "0x0000000000000000000000000000000000000000000000000000000000000027", "0x00000000000000000000000000000000000000000000000000000000000000ea", "0x00000000000000000000000000000000000000000000000000000000000000d9", "0x0000000000000000000000000000000000000000000000000000000000000008", "0x000000000000000000000000000000000000000000000000000000000000003c", "0x0000000000000000000000000000000000000000000000000000000000000075", "0x000000000000000000000000000000000000000000000000000000000000006c", "0x00000000000000000000000000000000000000000000000000000000000000c2"]

[return.log.data]
len = "0x0000000000000000000000000000000000000000000000000000000000000020"
storage = ["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000037", "0x0000000000000000000000000000000000000000000000000000000000000082", "0x00000000000000000000000000000000000000000000000000000000000000da", "0x00000000000000000000000000000000000000000000000000000000000000ce", "0x000000000000000000000000000000000000000000000000000000000000009d", "0x0000000000000000000000000000000000000000000000000000000000000090", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000"]

[return.log.topics]
len = "0x0000000000000000000000000000000000000000000000000000000000000002"
storage = [["0x00000000000000000000000000000000000000000000000000000000000000e1", "0x00000000000000000000000000000000000000000000000000000000000000ff", "0x00000000000000000000000000000000000000000000000000000000000000fc", "0x00000000000000000000000000000000000000000000000000000000000000c4", "0x0000000000000000000000000000000000000000000000000000000000000092", "0x000000000000000000000000000000000000000000000000000000000000003d", "0x0000000000000000000000000000000000000000000000000000000000000004", "0x00000000000000000000000000000000000000000000000000000000000000b5", "0x0000000000000000000000000000000000000000000000000000000000000059", "0x00000000000000000000000000000000000000000000000000000000000000f4", "0x00000000000000000000000000000000000000000000000000000000000000d2", "0x000000000000000000000000000000000000000000000000000000000000009a", "0x000000000000000000000000000000000000000000000000000000000000008b", "0x00000000000000000000000000000000000000000000000000000000000000fc", "0x000000000000000000000000000000000000000000000000000000000000006c", "0x00000000000000000000000000000000000000000000000000000000000000da", "0x0000000000000000000000000000000000000000000000000000000000000004", "0x00000000000000000000000000000000000000000000000000000000000000eb", "0x000000000000000000000000000000000000000000000000000000000000005b", "0x000000000000000000000000000000000000000000000000000000000000000d", "0x000000000000000000000000000000000000000000000000000000000000003c", "0x0000000000000000000000000000000000000000000000000000000000000046", "0x0000000000000000000000000000000000000000000000000000000000000007", "0x0000000000000000000000000000000000000000000000000000000000000051", "0x00000000000000000000000000000000000000000000000000000000000000c2", "0x0000000000000000000000000000000000000000000000000000000000000040", "0x000000000000000000000000000000000000000000000000000000000000002c", "0x000000000000000000000000000000000000000000000000000000000000005c", "0x000000000000000000000000000000000000000000000000000000000000005c", "0x00000000000000000000000000000000000000000000000000000000000000c9", "0x0000000000000000000000000000000000000000000000000000000000000010", "0x000000000000000000000000000000000000000000000000000000000000009c"], ["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x00000000000000000000000000000000000000000000000000000000000000a6", "0x0000000000000000000000000000000000000000000000000000000000000060", "0x00000000000000000000000000000000000000000000000000000000000000f1", "0x000000000000000000000000000000000000000000000000000000000000008e", "0x00000000000000000000000000000000000000000000000000000000000000f5", "0x000000000000000000000000000000000000000000000000000000000000000e", "0x0000000000000000000000000000000000000000000000000000000000000073", "0x000000000000000000000000000000000000000000000000000000000000009f", "0x00000000000000000000000000000000000000000000000000000000000000d6", "0x000000000000000000000000000000000000000000000000000000000000004f", "0x0000000000000000000000000000000000000000000000000000000000000048", "0x0000000000000000000000000000000000000000000000000000000000000049", "0x000000000000000000000000000000000000000000000000000000000000009e", "0x000000000000000000000000000000000000000000000000000000000000006a", "0x000000000000000000000000000000000000000000000000000000000000005d", "0x000000000000000000000000000000000000000000000000000000000000009e", "0x00000000000000000000000000000000000000000000000000000000000000f0", "0x000000000000000000000000000000000000000000000000000000000000000d", "0x0000000000000000000000000000000000000000000000000000000000000026", "0x000000000000000000000000000000000000000000000000000000000000008c"], ["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000"], ["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000"]]
13 changes: 13 additions & 0 deletions ethereum/circuits/get_log/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use dep::ethereum::log::{get_log, LogWithinBlock};

global MAX_LOG_DATA_LEN = 32;
global MAX_LOGS_COUNT = 1;

fn main(
chain_id: pub Field,
block_number: pub u64,
tx_idx: pub Field,
log_idx: pub u64
) -> pub LogWithinBlock<MAX_LOG_DATA_LEN> {
get_log::<MAX_LOG_DATA_LEN, MAX_LOGS_COUNT>(chain_id, block_number, tx_idx, log_idx)
}
6 changes: 3 additions & 3 deletions ethereum/circuits/lib/src/log.nr
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ fn extract_log_fragment<MAX_LOGS_COUNT, MAX_RECEIPT_RLP_FRAGMENT_LEN>(
logs_fragment: Fragment<MAX_RECEIPT_RLP_FRAGMENT_LEN, u8>,
log_idx: u64
) -> Fragment<MAX_RECEIPT_RLP_FRAGMENT_LEN, u8> {
let logs_rlp_list = decode_list::<MAX_RECEIPT_RLP_FRAGMENT_LEN, MAX_LOGS_COUNT>(logs_fragment);
rlp_subfragment::<MAX_LOGS_COUNT, MAX_RECEIPT_RLP_FRAGMENT_LEN>(logs_fragment, logs_rlp_list.get(log_idx))
let logs_rlp_list: RlpList<MAX_LOGS_COUNT> = decode_list(logs_fragment);
rlp_subfragment(logs_fragment, logs_rlp_list.get(log_idx))
}

fn extract_address<MAX_RECEIPT_RLP_FRAGMENT_LEN>(
Expand Down Expand Up @@ -123,7 +123,7 @@ fn extract_data<MAX_RECEIPT_RLP_FRAGMENT_LEN>(
rlp_subfragment(log_fragment, log_values_rlp_list.get(LOG_DATA_INDEX))
}

fn rlp_subfragment<MAX_FIELDS, MAX_RECEIPT_RLP_FRAGMENT_LEN>(
fn rlp_subfragment<MAX_RECEIPT_RLP_FRAGMENT_LEN>(
fragment: Fragment<MAX_RECEIPT_RLP_FRAGMENT_LEN, u8>,
rlp_fragment: RlpFragment
) -> Fragment<MAX_RECEIPT_RLP_FRAGMENT_LEN, u8> {
Expand Down
Loading

0 comments on commit b673607

Please sign in to comment.