Skip to content

Commit

Permalink
get_storage_recursive oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
akonior committed Jun 6, 2024
1 parent b7d75db commit a52f4ac
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/circuits_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,25 @@ jobs:
with:
toolchain: nightly-2024-05-22

- name: Nargo backend checks
run: |
set -x
ll ~
ll ~/.nargo
ll ~/.nargo/backends
ll ~/.nargo/backends/acvm-backend-barretenberg
ll ~/.nargo/backends/acvm-backend-barretenberg/backend_binary
nargo --help
nargo --version
noirup --help
- name: Compile Circuit
run: nargo compile --workspace --deny-warnings
run: nargo compile --workspace #--deny-warnings

- name: Generate verification key for recursive proof
working-directory: ethereum/oracles
run: |
yarn generate-get-storage-vk
- name: Start Oracle Server
working-directory: ethereum/oracles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn get_account_with_storage_recursive(
storage_within_block
}

#[oracle(get_account_with_storage_recursive)]
#[oracle(get_storage_recursive)]
unconstrained fn get_account_with_storage_recursive_oracle(
chain_id: Field,
block_number: u64,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::account_with_storage_recursive::{get_account_with_storage_recursive, RecursiveProof};
use crate::account_with_storage::StorageWithinBlock;
use crate::fixtures::mainnet::paris::usdc_circle::{header::{number, hash}, account::{address, account} storage::{keys, values}};
use crate::fixtures::mainnet::paris::usdc_circle::{header::{number, hash}, account::{address, account}, storage::{keys, values}};
use crate::chain::ETHEREUM_MAINNET_ID;
use crate::misc::types::{Bytes32, Address};
use dep::std::test::OracleMock;
Expand All @@ -10,7 +10,7 @@ fn success() {
let result = StorageWithinBlock { block_hash: hash, account, values };
let recursive_proof = RecursiveProof { key_hash: 1, verification_key: [0; 114], proof: [0; 93] };

let _ = OracleMock::mock("get_account_with_storage_recursive").returns((result.serialize(), recursive_proof));
let _ = OracleMock::mock("get_storage_recursive").returns((result.serialize(), recursive_proof));

get_account_with_storage_recursive(ETHEREUM_MAINNET_ID, number, address, keys[0]);
let _ = get_account_with_storage_recursive(ETHEREUM_MAINNET_ID, number, address, keys[0]);
}
2 changes: 1 addition & 1 deletion ethereum/oracles/src/noir/oracles/server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jsonRPCServer.addMethod('get_account', getRpcOracleHandler.bind(this, getAccount
jsonRPCServer.addMethod('get_proof', getRpcOracleHandler.bind(this, getProofOracle));
jsonRPCServer.addMethod('get_receipt', getRpcOracleHandler.bind(this, getReceiptOracle));
jsonRPCServer.addMethod('get_transaction', getRpcOracleHandler.bind(this, getTransactionOracle));
jsonRPCServer.addMethod('recursive_get_storage', getOracleHandler.bind(this, getStorageOracle));
jsonRPCServer.addMethod('get_storage_recursive', getOracleHandler.bind(this, getStorageOracle));

export function buildOracleServer(
opts: Fastify.FastifyHttpOptions<http.Server> = {},
Expand Down
2 changes: 1 addition & 1 deletion ethereum/oracles/src/noir/oracles/server/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type JSONRPCServerMethods = {
get_proof(params: ForeignCallParams): ForeignCallResult;
get_receipt(params: ForeignCallParams): ForeignCallResult;
get_transaction(params: ForeignCallParams): ForeignCallResult;
recursive_get_storage(params: ForeignCallParams): ForeignCallResult;
get_storage_recursive(params: ForeignCallParams): ForeignCallResult;
};

export interface ServerParams {
Expand Down
2 changes: 1 addition & 1 deletion ethereum/oracles/src/script/generateGetStorageVK.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MonorepoCircuit } from '../noir/circuit/circuit.js';
import { VerificationKey, generateVk } from '../noir/circuit/vk.js';

const circuit = await MonorepoCircuit.create('../../', 'get_storage');
const circuit = await MonorepoCircuit.create('../../', 'get_storage_recursive');
await generateVk(circuit.artefact.bytecode, circuit.vkPath(), circuit.vkAsFieldsPath());
const vk = await VerificationKey.create(circuit.vkAsFieldsPath());
// eslint-disable-next-line no-console
Expand Down

0 comments on commit a52f4ac

Please sign in to comment.