From a1ae452539951cf556221c9dc5dd60f9bd6314db Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 24 May 2024 11:08:38 +0200 Subject: [PATCH] Move RPC oracles to a separate subfolder --- ethereum/oracles/src/noir/oracles/oracles.ts | 10 +++++----- .../transactionOracle.int.test.ts.snap | 0 .../oracles/{ => rpc}/accountOracle.int.test.ts | 2 +- .../noir/oracles/{ => rpc}/accountOracle.test.ts | 2 +- .../src/noir/oracles/{ => rpc}/accountOracle.ts | 10 +++++----- .../oracles/{ => rpc}/accountOracle/encode.test.ts | 2 +- .../noir/oracles/{ => rpc}/accountOracle/encode.ts | 8 ++++---- .../accountOracle/fixtures/accountAsFields.json | 0 .../accountOracle/fixtures/stateProofAsFields.json | 0 .../fixtures/storageProofAsFields.json | 0 .../oracles/{ => rpc}/common/proofConfig.test.ts | 2 +- .../noir/oracles/{ => rpc}/common/proofConfig.ts | 4 ++-- .../{ => rpc}/common/proofConfig/account.ts | 2 +- .../{ => rpc}/common/proofConfig/receipt.ts | 2 +- .../{ => rpc}/common/proofConfig/storage.ts | 2 +- .../oracles/{ => rpc}/common/proofConfig/tx.ts | 2 +- .../src/noir/oracles/{ => rpc}/common/txConfig.ts | 0 .../src/noir/oracles/{ => rpc}/common/util.test.ts | 2 +- .../src/noir/oracles/{ => rpc}/common/util.ts | 2 +- .../oracles/{ => rpc}/headerOracle.int.test.ts | 6 +++--- .../noir/oracles/{ => rpc}/headerOracle.test.ts | 0 .../src/noir/oracles/{ => rpc}/headerOracle.ts | 14 +++++++------- .../noir/oracles/{ => rpc}/headerOracle/encode.ts | 6 +++--- .../noir/oracles/{ => rpc}/proofOracle.int.test.ts | 2 +- .../src/noir/oracles/{ => rpc}/proofOracle.test.ts | 4 ++-- .../src/noir/oracles/{ => rpc}/proofOracle.ts | 10 +++++----- .../oracles/{ => rpc}/receiptOracle.int.test.ts | 6 +++--- .../noir/oracles/{ => rpc}/receiptOracle.test.ts | 0 .../src/noir/oracles/{ => rpc}/receiptOracle.ts | 14 +++++++------- .../oracles/{ => rpc}/receiptOracle/encode.test.ts | 6 +++--- .../noir/oracles/{ => rpc}/receiptOracle/encode.ts | 14 +++++++------- .../{ => rpc}/transactionOracle.int.test.ts | 6 +++--- .../noir/oracles/{ => rpc}/transactionOracle.ts | 10 +++++----- .../{ => rpc}/transactionOracle/encode.test.ts | 8 ++++---- .../oracles/{ => rpc}/transactionOracle/encode.ts | 14 +++++++------- ethereum/oracles/src/noir/oracles/server/app.ts | 10 +++++----- .../oracles/src/script/noir_fixtures/account.ts | 2 +- .../oracles/src/script/noir_fixtures/header.ts | 2 +- ethereum/oracles/src/script/noir_fixtures/log.ts | 2 +- .../oracles/src/script/noir_fixtures/new_proof.ts | 2 +- .../src/script/noir_fixtures/new_receipt_proof.ts | 2 +- .../src/script/noir_fixtures/new_state_proof.ts | 4 ++-- .../src/script/noir_fixtures/new_storage_proof.ts | 2 +- .../script/noir_fixtures/new_transaction_proof.ts | 2 +- .../oracles/src/script/noir_fixtures/receipt.ts | 2 +- .../src/script/noir_fixtures/receipt_proof.ts | 5 ++++- .../src/script/noir_fixtures/state_proof.ts | 4 ++-- .../src/script/noir_fixtures/storage_proof.ts | 2 +- .../src/script/noir_fixtures/transaction.ts | 4 ++-- .../src/script/noir_fixtures/transaction_proof.ts | 2 +- .../src/script/prepareMerkleProofFixtures.ts | 2 +- ethereum/oracles/tsconfig.json | 2 +- 52 files changed, 113 insertions(+), 110 deletions(-) rename ethereum/oracles/src/noir/oracles/{ => rpc}/__snapshots__/transactionOracle.int.test.ts.snap (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle.int.test.ts (94%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle.test.ts (88%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle.ts (84%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle/encode.test.ts (97%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle/encode.ts (90%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle/fixtures/accountAsFields.json (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle/fixtures/stateProofAsFields.json (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/accountOracle/fixtures/storageProofAsFields.json (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig.test.ts (90%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig.ts (87%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig/account.ts (92%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig/receipt.ts (88%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig/storage.ts (84%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/proofConfig/tx.ts (88%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/txConfig.ts (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/util.test.ts (95%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/common/util.ts (85%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/headerOracle.int.test.ts (87%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/headerOracle.test.ts (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/headerOracle.ts (74%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/headerOracle/encode.ts (84%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/proofOracle.int.test.ts (96%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/proofOracle.test.ts (86%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/proofOracle.ts (85%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/receiptOracle.int.test.ts (96%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/receiptOracle.test.ts (100%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/receiptOracle.ts (82%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/receiptOracle/encode.test.ts (89%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/receiptOracle/encode.ts (80%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/transactionOracle.int.test.ts (95%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/transactionOracle.ts (84%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/transactionOracle/encode.test.ts (92%) rename ethereum/oracles/src/noir/oracles/{ => rpc}/transactionOracle/encode.ts (79%) diff --git a/ethereum/oracles/src/noir/oracles/oracles.ts b/ethereum/oracles/src/noir/oracles/oracles.ts index b5ececa4c..b451cfad7 100644 --- a/ethereum/oracles/src/noir/oracles/oracles.ts +++ b/ethereum/oracles/src/noir/oracles/oracles.ts @@ -1,10 +1,10 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; import { MultiChainClient } from '../../ethereum/client.js'; -import { getAccountOracle } from './accountOracle.js'; -import { getHeaderOracle } from './headerOracle.js'; -import { getProofOracle } from './proofOracle.js'; -import { getReceiptOracle } from './receiptOracle.js'; -import { getTransactionOracle } from './transactionOracle.js'; +import { getAccountOracle } from './rpc/accountOracle.js'; +import { getHeaderOracle } from './rpc/headerOracle.js'; +import { getProofOracle } from './rpc/proofOracle.js'; +import { getReceiptOracle } from './rpc/receiptOracle.js'; +import { getTransactionOracle } from './rpc/transactionOracle.js'; export type NoirArgument = string[]; export type NoirArguments = NoirArgument[]; diff --git a/ethereum/oracles/src/noir/oracles/__snapshots__/transactionOracle.int.test.ts.snap b/ethereum/oracles/src/noir/oracles/rpc/__snapshots__/transactionOracle.int.test.ts.snap similarity index 100% rename from ethereum/oracles/src/noir/oracles/__snapshots__/transactionOracle.int.test.ts.snap rename to ethereum/oracles/src/noir/oracles/rpc/__snapshots__/transactionOracle.int.test.ts.snap diff --git a/ethereum/oracles/src/noir/oracles/accountOracle.int.test.ts b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.int.test.ts similarity index 94% rename from ethereum/oracles/src/noir/oracles/accountOracle.int.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle.int.test.ts index 0efbf87a2..8234948fb 100644 --- a/ethereum/oracles/src/noir/oracles/accountOracle.int.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.int.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { OFFSETS, getAccountOracle } from './accountOracle.js'; -import { createMockMultiChainClient } from '../../ethereum/mockClient.js'; +import { createMockMultiChainClient } from '../../../ethereum/mockClient.js'; describe('accountOracle', () => { it('getAccountOracle', async () => { diff --git a/ethereum/oracles/src/noir/oracles/accountOracle.test.ts b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.test.ts similarity index 88% rename from ethereum/oracles/src/noir/oracles/accountOracle.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle.test.ts index d53189ca9..a3ab132a8 100644 --- a/ethereum/oracles/src/noir/oracles/accountOracle.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { CRYPTO_PUNKS_ADDRESS } from '../../ethereum/recordingClient.test.js'; +import { CRYPTO_PUNKS_ADDRESS } from '../../../ethereum/recordingClient.test.js'; import { decodeGetAccountArguments } from './accountOracle.js'; import { mainnet } from 'viem/chains'; diff --git a/ethereum/oracles/src/noir/oracles/accountOracle.ts b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.ts similarity index 84% rename from ethereum/oracles/src/noir/oracles/accountOracle.ts rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle.ts index 8d339b6d7..d4dc42e55 100644 --- a/ethereum/oracles/src/noir/oracles/accountOracle.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/accountOracle.ts @@ -1,11 +1,11 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; import { type Address } from 'viem'; -import { assert } from '../../util/assert.js'; +import { assert } from '../../../util/assert.js'; import { encodeAccount, encodeStateProof } from './accountOracle/encode.js'; -import { decodeAddress, decodeField } from './common/decode.js'; -import { NoirArguments } from './oracles.js'; -import { MultiChainClient } from '../../ethereum/client.js'; -import { Enum } from '../../util/enum.js'; +import { decodeAddress, decodeField } from '../common/decode.js'; +import { NoirArguments } from '../oracles.js'; +import { MultiChainClient } from '../../../ethereum/client.js'; +import { Enum } from '../../../util/enum.js'; export enum ARGS { CHAIN_ID, diff --git a/ethereum/oracles/src/noir/oracles/accountOracle/encode.test.ts b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.test.ts similarity index 97% rename from ethereum/oracles/src/noir/oracles/accountOracle/encode.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.test.ts index 35b9ae59c..316938d93 100644 --- a/ethereum/oracles/src/noir/oracles/accountOracle/encode.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { loadProofFixture } from '../../../historyAPIFixtures.js'; +import { loadProofFixture } from '../../../../historyAPIFixtures.js'; import accountAsFields from './fixtures/accountAsFields.json'; import stateProofAsFields from './fixtures/stateProofAsFields.json'; import storageProofAsFields from './fixtures/storageProofAsFields.json'; diff --git a/ethereum/oracles/src/noir/oracles/accountOracle/encode.ts b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.ts similarity index 90% rename from ethereum/oracles/src/noir/oracles/accountOracle/encode.ts rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.ts index 06d3930af..1dda00d43 100644 --- a/ethereum/oracles/src/noir/oracles/accountOracle/encode.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/encode.ts @@ -1,9 +1,9 @@ import { ForeignCallOutput } from '@noir-lang/noir_js'; import { GetProofReturnType, Hex, fromRlp, isHex } from 'viem'; -import { encodeBytes32, encodeField, encodeHex, encodeProof } from '../common/encode.js'; -import { padArray } from '../../../util/array.js'; -import { ZERO_PAD_VALUE } from '../common/const.js'; -import { assert } from '../../../util/assert.js'; +import { encodeBytes32, encodeField, encodeHex, encodeProof } from '../../common/encode.js'; +import { padArray } from '../../../../util/array.js'; +import { ZERO_PAD_VALUE } from '../../common/const.js'; +import { assert } from '../../../../util/assert.js'; import { accountProofConfig, LEGACY_MAX_ACCOUNT_STATE_LEN } from '../common/proofConfig/account.js'; import { storageProofConfig } from '../common/proofConfig/storage.js'; diff --git a/ethereum/oracles/src/noir/oracles/accountOracle/fixtures/accountAsFields.json b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/accountAsFields.json similarity index 100% rename from ethereum/oracles/src/noir/oracles/accountOracle/fixtures/accountAsFields.json rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/accountAsFields.json diff --git a/ethereum/oracles/src/noir/oracles/accountOracle/fixtures/stateProofAsFields.json b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/stateProofAsFields.json similarity index 100% rename from ethereum/oracles/src/noir/oracles/accountOracle/fixtures/stateProofAsFields.json rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/stateProofAsFields.json diff --git a/ethereum/oracles/src/noir/oracles/accountOracle/fixtures/storageProofAsFields.json b/ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/storageProofAsFields.json similarity index 100% rename from ethereum/oracles/src/noir/oracles/accountOracle/fixtures/storageProofAsFields.json rename to ethereum/oracles/src/noir/oracles/rpc/accountOracle/fixtures/storageProofAsFields.json diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig.test.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.test.ts similarity index 90% rename from ethereum/oracles/src/noir/oracles/common/proofConfig.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.test.ts index 61a5a1899..3fa4ce227 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { getProofConfig } from './proofConfig.js'; -import { MAX_TRIE_NODE_LEN } from './const.js'; +import { MAX_TRIE_NODE_LEN } from '../../common/const.js'; describe('getProofConfig', () => { it('state proof', () => { diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.ts similarity index 87% rename from ethereum/oracles/src/noir/oracles/common/proofConfig.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.ts index 728903819..5ba06f506 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig.ts @@ -1,5 +1,5 @@ -import { BYTE_HEX_LEN } from '../../../util/const.js'; -import { MAX_TRIE_NODE_LEN } from './const.js'; +import { BYTE_HEX_LEN } from '../../../../util/const.js'; +import { MAX_TRIE_NODE_LEN } from '../../common/const.js'; import { getMaxRlpEncodedSize } from './util.js'; export interface ProofConfig { diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig/account.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/account.ts similarity index 92% rename from ethereum/oracles/src/noir/oracles/common/proofConfig/account.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/account.ts index 2eecea393..a8740b088 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig/account.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/account.ts @@ -1,4 +1,4 @@ -import { U64_LEN, BYTES32_LEN } from '../const.js'; +import { U64_LEN, BYTES32_LEN } from '../../../common/const.js'; import { getProofConfig } from '../proofConfig.js'; import { getMaxRlpEncodedSize } from '../util.js'; diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig/receipt.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/receipt.ts similarity index 88% rename from ethereum/oracles/src/noir/oracles/common/proofConfig/receipt.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/receipt.ts index b35f2db3c..1c02b38e1 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig/receipt.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/receipt.ts @@ -1,4 +1,4 @@ -import { BYTE_HEX_LEN } from '../../../../util/const.js'; +import { BYTE_HEX_LEN } from '../../../../../util/const.js'; import { getProofConfig } from '../proofConfig.js'; // TODO: Remove this when we remove legacy fixtures diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig/storage.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/storage.ts similarity index 84% rename from ethereum/oracles/src/noir/oracles/common/proofConfig/storage.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/storage.ts index 6f501d5b2..57ef4a099 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig/storage.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/storage.ts @@ -1,4 +1,4 @@ -import { BYTES32_LEN } from '../const.js'; +import { BYTES32_LEN } from '../../../common/const.js'; import { getProofConfig } from '../proofConfig.js'; const KEY_LEN = BYTES32_LEN; diff --git a/ethereum/oracles/src/noir/oracles/common/proofConfig/tx.ts b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/tx.ts similarity index 88% rename from ethereum/oracles/src/noir/oracles/common/proofConfig/tx.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/tx.ts index 50f4ac9d1..8ac250436 100644 --- a/ethereum/oracles/src/noir/oracles/common/proofConfig/tx.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/proofConfig/tx.ts @@ -1,4 +1,4 @@ -import { BYTE_HEX_LEN } from '../../../../util/const.js'; +import { BYTE_HEX_LEN } from '../../../../../util/const.js'; import { getProofConfig } from '../proofConfig.js'; // TODO: Remove this when we remove legacy fixtures diff --git a/ethereum/oracles/src/noir/oracles/common/txConfig.ts b/ethereum/oracles/src/noir/oracles/rpc/common/txConfig.ts similarity index 100% rename from ethereum/oracles/src/noir/oracles/common/txConfig.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/txConfig.ts diff --git a/ethereum/oracles/src/noir/oracles/common/util.test.ts b/ethereum/oracles/src/noir/oracles/rpc/common/util.test.ts similarity index 95% rename from ethereum/oracles/src/noir/oracles/common/util.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/util.test.ts index dac69237a..6ddccfd5d 100644 --- a/ethereum/oracles/src/noir/oracles/common/util.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/util.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { RLP_SHORT_ENTITY_MAX_LEN, getMaxRlpEncodedSize, getMaxRlpHeaderSize } from './util.js'; -import { ADDRESS_LEN, BYTES32_LEN } from './const.js'; +import { ADDRESS_LEN, BYTES32_LEN } from '../../common/const.js'; describe('getRlpHeaderSize', () => { it('should return 1 for short entities', () => { diff --git a/ethereum/oracles/src/noir/oracles/common/util.ts b/ethereum/oracles/src/noir/oracles/rpc/common/util.ts similarity index 85% rename from ethereum/oracles/src/noir/oracles/common/util.ts rename to ethereum/oracles/src/noir/oracles/rpc/common/util.ts index dad9da1f6..d9272cf82 100644 --- a/ethereum/oracles/src/noir/oracles/common/util.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/common/util.ts @@ -1,4 +1,4 @@ -import { BYTE_HEX_LEN } from '../../../util/const.js'; +import { BYTE_HEX_LEN } from '../../../../util/const.js'; export const RLP_SHORT_ENTITY_MAX_LEN = 55; diff --git a/ethereum/oracles/src/noir/oracles/headerOracle.int.test.ts b/ethereum/oracles/src/noir/oracles/rpc/headerOracle.int.test.ts similarity index 87% rename from ethereum/oracles/src/noir/oracles/headerOracle.int.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/headerOracle.int.test.ts index 361ea085f..63fe36674 100644 --- a/ethereum/oracles/src/noir/oracles/headerOracle.int.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/headerOracle.int.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; import { getBlockHeader, getHeaderOracle } from './headerOracle.js'; import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { createMockClient } from '../../ethereum/mockClient.js'; -import { HISTORY_API_FIXTURES } from '../../fixtures/historyAPIConfig.js'; -import { MultiChainClient } from '../../ethereum/client.js'; +import { createMockClient } from '../../../ethereum/mockClient.js'; +import { HISTORY_API_FIXTURES } from '../../../fixtures/historyAPIConfig.js'; +import { MultiChainClient } from '../../../ethereum/client.js'; describe('headerOracle', async () => { const mockFilePaths = ['./fixtures/mainnet/paris/usdc_circle/eth_getBlockByHash_19000000.json']; diff --git a/ethereum/oracles/src/noir/oracles/headerOracle.test.ts b/ethereum/oracles/src/noir/oracles/rpc/headerOracle.test.ts similarity index 100% rename from ethereum/oracles/src/noir/oracles/headerOracle.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/headerOracle.test.ts diff --git a/ethereum/oracles/src/noir/oracles/headerOracle.ts b/ethereum/oracles/src/noir/oracles/rpc/headerOracle.ts similarity index 74% rename from ethereum/oracles/src/noir/oracles/headerOracle.ts rename to ethereum/oracles/src/noir/oracles/rpc/headerOracle.ts index c19d104e6..ee490ae59 100644 --- a/ethereum/oracles/src/noir/oracles/headerOracle.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/headerOracle.ts @@ -1,12 +1,12 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { type BlockHeader, blockToHeader } from '../../ethereum/blockHeader.js'; -import { assert } from '../../util/assert.js'; +import { type BlockHeader, blockToHeader } from '../../../ethereum/blockHeader.js'; +import { assert } from '../../../util/assert.js'; import { encodeBlockHeader } from './headerOracle/encode.js'; -import { decodeField } from './common/decode.js'; -import { NoirArguments } from './oracles.js'; -import { type Block } from '../../ethereum/blockHeader.js'; -import { AlchemyClient, MultiChainClient } from '../../ethereum/client.js'; -import { Enum } from '../../util/enum.js'; +import { decodeField } from '../common/decode.js'; +import { NoirArguments } from '../oracles.js'; +import { type Block } from '../../../ethereum/blockHeader.js'; +import { AlchemyClient, MultiChainClient } from '../../../ethereum/client.js'; +import { Enum } from '../../../util/enum.js'; export enum ARGS { CHAIN_ID, diff --git a/ethereum/oracles/src/noir/oracles/headerOracle/encode.ts b/ethereum/oracles/src/noir/oracles/rpc/headerOracle/encode.ts similarity index 84% rename from ethereum/oracles/src/noir/oracles/headerOracle/encode.ts rename to ethereum/oracles/src/noir/oracles/rpc/headerOracle/encode.ts index 2985199f7..e03a30c2e 100644 --- a/ethereum/oracles/src/noir/oracles/headerOracle/encode.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/headerOracle/encode.ts @@ -1,8 +1,8 @@ import { ForeignCallOutput } from '@noir-lang/noir_js'; import { hexToBytes, keccak256 } from 'viem'; -import { BlockHeader, headerToRlp } from '../../../ethereum/blockHeader.js'; -import { padArray } from '../../../util/array.js'; -import { encodeField, encodeHex } from '../common/encode.js'; +import { BlockHeader, headerToRlp } from '../../../../ethereum/blockHeader.js'; +import { padArray } from '../../../../util/array.js'; +import { encodeField, encodeHex } from '../../common/encode.js'; export const MAX_HEADER_RLP_LEN = 708; diff --git a/ethereum/oracles/src/noir/oracles/proofOracle.int.test.ts b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.int.test.ts similarity index 96% rename from ethereum/oracles/src/noir/oracles/proofOracle.int.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/proofOracle.int.test.ts index 7c192dea0..8f4748634 100644 --- a/ethereum/oracles/src/noir/oracles/proofOracle.int.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.int.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { createMockMultiChainClient } from '../../ethereum/mockClient.js'; +import { createMockMultiChainClient } from '../../../ethereum/mockClient.js'; import { getProofOracle } from './proofOracle.js'; describe( diff --git a/ethereum/oracles/src/noir/oracles/proofOracle.test.ts b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.test.ts similarity index 86% rename from ethereum/oracles/src/noir/oracles/proofOracle.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/proofOracle.test.ts index 1940f69ca..1b7161671 100644 --- a/ethereum/oracles/src/noir/oracles/proofOracle.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { CRYPTO_PUNKS_ADDRESS } from '../../ethereum/recordingClient.test.js'; +import { CRYPTO_PUNKS_ADDRESS } from '../../../ethereum/recordingClient.test.js'; import { decodeGetProofArguments } from './proofOracle.js'; -import { CIRCLE_USDC_BALANCE_STORAGE_KEY } from '../../fixtures/historyAPIConfig.js'; +import { CIRCLE_USDC_BALANCE_STORAGE_KEY } from '../../../fixtures/historyAPIConfig.js'; import { mainnet } from 'viem/chains'; describe('proofOracle', () => { diff --git a/ethereum/oracles/src/noir/oracles/proofOracle.ts b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.ts similarity index 85% rename from ethereum/oracles/src/noir/oracles/proofOracle.ts rename to ethereum/oracles/src/noir/oracles/rpc/proofOracle.ts index 591e025e0..72c60359a 100644 --- a/ethereum/oracles/src/noir/oracles/proofOracle.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/proofOracle.ts @@ -1,11 +1,11 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { assert } from '../../util/assert.js'; +import { assert } from '../../../util/assert.js'; import { encodeAccount, encodeStateProof, encodeStorageProof } from './accountOracle/encode.js'; -import { decodeAddress, decodeBytes32, decodeField } from './common/decode.js'; -import { NoirArguments } from './oracles.js'; +import { decodeAddress, decodeBytes32, decodeField } from '../common/decode.js'; +import { NoirArguments } from '../oracles.js'; import { Hex } from 'viem'; -import { MultiChainClient } from '../../ethereum/client.js'; -import { Enum } from '../../util/enum.js'; +import { MultiChainClient } from '../../../ethereum/client.js'; +import { Enum } from '../../../util/enum.js'; export enum ARGS { CHAIN_ID, diff --git a/ethereum/oracles/src/noir/oracles/receiptOracle.int.test.ts b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle.int.test.ts similarity index 96% rename from ethereum/oracles/src/noir/oracles/receiptOracle.int.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/receiptOracle.int.test.ts index 1078289ae..b74658ffe 100644 --- a/ethereum/oracles/src/noir/oracles/receiptOracle.int.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle.int.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest'; -import { createMockMultiChainClient } from '../../ethereum/mockClient.js'; +import { createMockMultiChainClient } from '../../../ethereum/mockClient.js'; import { OFFSETS, getReceiptOracle } from './receiptOracle.js'; -import { BYTES32_LEN, ZERO_PAD_VALUE } from './common/const.js'; -import { padArray } from '../../util/array.js'; +import { BYTES32_LEN, ZERO_PAD_VALUE } from '../common/const.js'; +import { padArray } from '../../../util/array.js'; import { receiptProofConfigM } from './common/proofConfig/receipt.js'; describe('getReceiptOracle', () => { diff --git a/ethereum/oracles/src/noir/oracles/receiptOracle.test.ts b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle.test.ts similarity index 100% rename from ethereum/oracles/src/noir/oracles/receiptOracle.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/receiptOracle.test.ts diff --git a/ethereum/oracles/src/noir/oracles/receiptOracle.ts b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle.ts similarity index 82% rename from ethereum/oracles/src/noir/oracles/receiptOracle.ts rename to ethereum/oracles/src/noir/oracles/rpc/receiptOracle.ts index ef79afae0..989f098b3 100644 --- a/ethereum/oracles/src/noir/oracles/receiptOracle.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle.ts @@ -1,12 +1,12 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { assert } from '../../util/assert.js'; -import { decodeField } from './common/decode.js'; -import { NoirArguments } from './oracles.js'; -import { MultiChainClient } from '../../ethereum/client.js'; -import { getReceiptProof } from '../../ethereum/receiptProof.js'; +import { assert } from '../../../util/assert.js'; +import { decodeField } from '../common/decode.js'; +import { NoirArguments } from '../oracles.js'; +import { MultiChainClient } from '../../../ethereum/client.js'; +import { getReceiptProof } from '../../../ethereum/receiptProof.js'; import { encodeReceipt, encodeReceiptProof } from './receiptOracle/encode.js'; -import { txTypeToHex } from '../../ethereum/receipt.js'; -import { Enum } from '../../util/enum.js'; +import { txTypeToHex } from '../../../ethereum/receipt.js'; +import { Enum } from '../../../util/enum.js'; export enum ARGS { CHAIN_ID, diff --git a/ethereum/oracles/src/noir/oracles/receiptOracle/encode.test.ts b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.test.ts similarity index 89% rename from ethereum/oracles/src/noir/oracles/receiptOracle/encode.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.test.ts index 3e6ab8c60..9ceeba4d1 100644 --- a/ethereum/oracles/src/noir/oracles/receiptOracle/encode.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest'; -import { assert } from '../../../util/assert.js'; +import { assert } from '../../../../util/assert.js'; import { RECEIPT_OFFSETS } from './encode.js'; -import { encodeReceipt } from '../receiptOracle/encode.js'; -import { loadReceiptFixture } from '../../../historyAPIFixtures.js'; +import { encodeReceipt } from './encode.js'; +import { loadReceiptFixture } from '../../../../historyAPIFixtures.js'; describe('ReceiptOracle encode', () => { describe('encodeReceipt', () => { diff --git a/ethereum/oracles/src/noir/oracles/receiptOracle/encode.ts b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.ts similarity index 80% rename from ethereum/oracles/src/noir/oracles/receiptOracle/encode.ts rename to ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.ts index 15646cd70..b72ce3aa0 100644 --- a/ethereum/oracles/src/noir/oracles/receiptOracle/encode.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/receiptOracle/encode.ts @@ -1,11 +1,11 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { statusToHex } from '../../../ethereum/receipt.js'; -import { padArray } from '../../../util/array.js'; -import { encodeField, encodeHex, encodeProof, encodeBytes } from '../common/encode.js'; -import { MAX_TRIE_NODE_LEN, ZERO_PAD_VALUE } from '../common/const.js'; -import { Proof } from '../../../ethereum/proof.js'; -import { TransactionReceipt } from '../../../types.js'; -import { BYTES_32_ZERO, U1_ZERO } from '../../../util/const.js'; +import { statusToHex } from '../../../../ethereum/receipt.js'; +import { padArray } from '../../../../util/array.js'; +import { encodeField, encodeHex, encodeProof, encodeBytes } from '../../common/encode.js'; +import { MAX_TRIE_NODE_LEN, ZERO_PAD_VALUE } from '../../common/const.js'; +import { Proof } from '../../../../ethereum/proof.js'; +import { TransactionReceipt } from '../../../../types.js'; +import { BYTES_32_ZERO, U1_ZERO } from '../../../../util/const.js'; import { receiptProofConfigM } from '../common/proofConfig/receipt.js'; export enum RECEIPT_OFFSETS { diff --git a/ethereum/oracles/src/noir/oracles/transactionOracle.int.test.ts b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle.int.test.ts similarity index 95% rename from ethereum/oracles/src/noir/oracles/transactionOracle.int.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/transactionOracle.int.test.ts index f966dabf6..beb80717d 100644 --- a/ethereum/oracles/src/noir/oracles/transactionOracle.int.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle.int.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { createMockMultiChainClient } from '../../ethereum/mockClient.js'; +import { createMockMultiChainClient } from '../../../ethereum/mockClient.js'; import { OFFSETS, getTransactionOracle } from './transactionOracle.js'; import { MAX_DATA_LEN_M } from './common/txConfig.js'; -import { ZERO_PAD_VALUE } from './common/const.js'; -import { padArray } from '../../util/array.js'; +import { padArray } from '../../../util/array.js'; +import { ZERO_PAD_VALUE } from '../common/const.js'; import { txProofConfigM } from './common/proofConfig/tx.js'; describe('getTransactionOracle', () => { diff --git a/ethereum/oracles/src/noir/oracles/transactionOracle.ts b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle.ts similarity index 84% rename from ethereum/oracles/src/noir/oracles/transactionOracle.ts rename to ethereum/oracles/src/noir/oracles/rpc/transactionOracle.ts index 2ae8ffc15..9133e277c 100644 --- a/ethereum/oracles/src/noir/oracles/transactionOracle.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle.ts @@ -1,11 +1,11 @@ import { type ForeignCallOutput } from '@noir-lang/noir_js'; -import { NoirArguments } from './oracles.js'; -import { MultiChainClient } from '../../ethereum/client.js'; -import { txTypeToHex } from '../../ethereum/receipt.js'; -import { getTxProof } from '../../ethereum/txProof.js'; +import { NoirArguments } from '../oracles.js'; +import { MultiChainClient } from '../../../ethereum/client.js'; +import { txTypeToHex } from '../../../ethereum/receipt.js'; +import { getTxProof } from '../../../ethereum/txProof.js'; import { encodeTx, encodeTxProof } from './transactionOracle/encode.js'; import { decodeGetReceiptArguments } from './receiptOracle.js'; -import { assert } from '../../util/assert.js'; +import { assert } from '../../../util/assert.js'; export enum OFFSETS { TX_TYPE, diff --git a/ethereum/oracles/src/noir/oracles/transactionOracle/encode.test.ts b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.test.ts similarity index 92% rename from ethereum/oracles/src/noir/oracles/transactionOracle/encode.test.ts rename to ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.test.ts index 0537dc3a6..eeeb7629c 100644 --- a/ethereum/oracles/src/noir/oracles/transactionOracle/encode.test.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; import { TX_OFFSETS, encodeTx } from './encode.js'; -import { loadTxFixture } from '../../../historyAPIFixtures.js'; -import { ETH_TRANSFER_TX_HASH, CHAIN_LINK_TRANSFER_TX_HASH } from '../../../fixtures/historyAPIConfig.js'; +import { loadTxFixture } from '../../../../historyAPIFixtures.js'; +import { ETH_TRANSFER_TX_HASH, CHAIN_LINK_TRANSFER_TX_HASH } from '../../../../fixtures/historyAPIConfig.js'; import { MAX_DATA_LEN_M } from '../common/txConfig.js'; -import { ZERO_PAD_VALUE } from '../common/const.js'; -import { padArray } from '../../../util/array.js'; +import { ZERO_PAD_VALUE } from '../../common/const.js'; +import { padArray } from '../../../../util/array.js'; // TODO: Add a test for contract creation transaction when we support transactions longer than trie nodes. describe('TransactionOracle encode', () => { diff --git a/ethereum/oracles/src/noir/oracles/transactionOracle/encode.ts b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.ts similarity index 79% rename from ethereum/oracles/src/noir/oracles/transactionOracle/encode.ts rename to ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.ts index 9425b67ae..b78276fef 100644 --- a/ethereum/oracles/src/noir/oracles/transactionOracle/encode.ts +++ b/ethereum/oracles/src/noir/oracles/rpc/transactionOracle/encode.ts @@ -1,13 +1,13 @@ import { Transaction } from 'viem'; -import { MAX_TRIE_NODE_LEN, ZERO_PAD_VALUE } from '../common/const.js'; +import { MAX_DATA_LEN_M } from '../common/txConfig.js'; import { ForeignCallOutput } from '@noir-lang/noir_js'; -import { encodeAddress, encodeBytes, encodeField, encodeHex, encodeProof, encodeU128 } from '../common/encode.js'; -import { BYTE_HEX_LEN, U1_ZERO } from '../../../util/const.js'; -import { Proof } from '../../../ethereum/proof.js'; -import { padArray } from '../../../util/array.js'; -import { removeHexPrefix } from '../../../util/hex.js'; +import { padArray } from '../../../../util/array.js'; +import { U1_ZERO, BYTE_HEX_LEN } from '../../../../util/const.js'; +import { removeHexPrefix } from '../../../../util/hex.js'; +import { ZERO_PAD_VALUE, MAX_TRIE_NODE_LEN } from '../../common/const.js'; +import { encodeField, encodeAddress, encodeU128, encodeHex, encodeBytes, encodeProof } from '../../common/encode.js'; import { txProofConfigM } from '../common/proofConfig/tx.js'; -import { MAX_DATA_LEN_M } from '../common/txConfig.js'; +import { Proof } from '../../../../ethereum/proof.js'; export enum TX_OFFSETS { NONCE, diff --git a/ethereum/oracles/src/noir/oracles/server/app.ts b/ethereum/oracles/src/noir/oracles/server/app.ts index 1316d5fb4..09f20cf43 100644 --- a/ethereum/oracles/src/noir/oracles/server/app.ts +++ b/ethereum/oracles/src/noir/oracles/server/app.ts @@ -3,11 +3,11 @@ import Fastify from 'fastify'; import http from 'http'; import { JSONRPCServerMethods, ServerParams, getOracleHandler } from './handlers.js'; import { MultiChainClient } from '../../../ethereum/client.js'; -import { getHeaderOracle } from '../headerOracle.js'; -import { getAccountOracle } from '../accountOracle.js'; -import { getProofOracle } from '../proofOracle.js'; -import { getReceiptOracle } from '../receiptOracle.js'; -import { getTransactionOracle } from '../transactionOracle.js'; +import { getHeaderOracle } from '../rpc/headerOracle.js'; +import { getAccountOracle } from '../rpc/accountOracle.js'; +import { getProofOracle } from '../rpc/proofOracle.js'; +import { getReceiptOracle } from '../rpc/receiptOracle.js'; +import { getTransactionOracle } from '../rpc/transactionOracle.js'; const HTTP_STATUS_NO_CONTENT = 204; diff --git a/ethereum/oracles/src/script/noir_fixtures/account.ts b/ethereum/oracles/src/script/noir_fixtures/account.ts index d08042421..7ab234832 100644 --- a/ethereum/oracles/src/script/noir_fixtures/account.ts +++ b/ethereum/oracles/src/script/noir_fixtures/account.ts @@ -1,6 +1,6 @@ import { GetProofReturnType } from 'viem'; import { encodeHexString, joinArray } from '../../noir/noir_js/encode.js'; -import { encodeValue } from '../../noir/oracles/accountOracle/encode.js'; +import { encodeValue } from '../../noir/oracles/rpc/accountOracle/encode.js'; export function createAccountFixture(stateProof: GetProofReturnType): string { const address = encodeHexString(stateProof.address); diff --git a/ethereum/oracles/src/script/noir_fixtures/header.ts b/ethereum/oracles/src/script/noir_fixtures/header.ts index 2ad446916..7fcaf387d 100644 --- a/ethereum/oracles/src/script/noir_fixtures/header.ts +++ b/ethereum/oracles/src/script/noir_fixtures/header.ts @@ -2,7 +2,7 @@ import { GetBlockReturnType } from 'viem'; import { encodeHexString, joinArray } from '../../noir/noir_js/encode.js'; import { blockToHeader, headerToRlp } from '../../ethereum/blockHeader.js'; import { padArray } from '../../util/array.js'; -import { MAX_HEADER_RLP_LEN } from '../../noir/oracles/headerOracle/encode.js'; +import { MAX_HEADER_RLP_LEN } from '../../noir/oracles/rpc/headerOracle/encode.js'; import { ZERO_PAD_VALUE } from '../../noir/oracles/common/const.js'; export function createHeaderFixture(block: GetBlockReturnType): string { diff --git a/ethereum/oracles/src/script/noir_fixtures/log.ts b/ethereum/oracles/src/script/noir_fixtures/log.ts index 7d020f935..23eef06c2 100644 --- a/ethereum/oracles/src/script/noir_fixtures/log.ts +++ b/ethereum/oracles/src/script/noir_fixtures/log.ts @@ -6,7 +6,7 @@ import { BYTES_32_ZERO } from '../../util/const.js'; import { logToRlpFields } from '../../ethereum/receipt.js'; import { encodeHex } from '../../noir/oracles/common/encode.js'; import { ZERO_PAD_VALUE } from '../../noir/oracles/common/const.js'; -import { LEGACY_MAX_RECEIPT_RLP_LEN } from '../../noir/oracles/common/proofConfig/receipt.js'; +import { LEGACY_MAX_RECEIPT_RLP_LEN } from '../../noir/oracles/rpc/common/proofConfig/receipt.js'; const MAX_TOPICS = 4; diff --git a/ethereum/oracles/src/script/noir_fixtures/new_proof.ts b/ethereum/oracles/src/script/noir_fixtures/new_proof.ts index 4f186cb90..94d59996d 100644 --- a/ethereum/oracles/src/script/noir_fixtures/new_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/new_proof.ts @@ -4,7 +4,7 @@ import { padArray } from '../../util/array.js'; import { MAX_TRIE_NODE_LEN, ZERO_PAD_VALUE } from '../../noir/oracles/common/const.js'; import { Proof } from '../../ethereum/proof.js'; import { Hex, padHex } from 'viem'; -import { ProofConfig } from '../../noir/oracles/common/proofConfig.js'; +import { ProofConfig } from '../../noir/oracles/rpc/common/proofConfig.js'; export function createNewTopLevelProofFixtureWithRoot(proof: Proof, root: Hex[], config: ProofConfig): string { return `use crate::merkle_patricia_proofs::proof::{Proof, ProofInput}; diff --git a/ethereum/oracles/src/script/noir_fixtures/new_receipt_proof.ts b/ethereum/oracles/src/script/noir_fixtures/new_receipt_proof.ts index 40f2977ef..936cdfbad 100644 --- a/ethereum/oracles/src/script/noir_fixtures/new_receipt_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/new_receipt_proof.ts @@ -1,5 +1,5 @@ import { Proof } from '../../ethereum/proof.js'; -import { receiptProofConfigM } from '../../noir/oracles/common/proofConfig/receipt.js'; +import { receiptProofConfigM } from '../../noir/oracles/rpc/common/proofConfig/receipt.js'; import { createNewTopLevelProofFixture } from './new_proof.js'; export function createNewReceiptProofFixture(proof: Proof): string { diff --git a/ethereum/oracles/src/script/noir_fixtures/new_state_proof.ts b/ethereum/oracles/src/script/noir_fixtures/new_state_proof.ts index ab92b771a..cf048eb2e 100644 --- a/ethereum/oracles/src/script/noir_fixtures/new_state_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/new_state_proof.ts @@ -1,8 +1,8 @@ import { GetProofReturnType, keccak256 } from 'viem'; -import { getValue } from '../../noir/oracles/accountOracle/encode.js'; +import { getValue } from '../../noir/oracles/rpc/accountOracle/encode.js'; import { createNewTopLevelProofFixture } from './new_proof.js'; -import { accountProofConfig } from '../../noir/oracles/common/proofConfig/account.js'; +import { accountProofConfig } from '../../noir/oracles/rpc/common/proofConfig/account.js'; export function createNewStateProofFixture(stateProof: GetProofReturnType): string { return createNewTopLevelProofFixture( diff --git a/ethereum/oracles/src/script/noir_fixtures/new_storage_proof.ts b/ethereum/oracles/src/script/noir_fixtures/new_storage_proof.ts index 88a0e7df7..b052a35a7 100644 --- a/ethereum/oracles/src/script/noir_fixtures/new_storage_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/new_storage_proof.ts @@ -2,7 +2,7 @@ import { Hex, keccak256, toRlp } from 'viem'; import { createNewProofInputFixture } from './new_proof.js'; import { joinArrayVertical } from '../../noir/noir_js/encode.js'; import { toHexString } from '../../ethereum/blockHeader.js'; -import { storageProofConfig } from '../../noir/oracles/common/proofConfig/storage.js'; +import { storageProofConfig } from '../../noir/oracles/rpc/common/proofConfig/storage.js'; interface StorageProof { key: Hex; diff --git a/ethereum/oracles/src/script/noir_fixtures/new_transaction_proof.ts b/ethereum/oracles/src/script/noir_fixtures/new_transaction_proof.ts index aa4e83eec..bf4159749 100644 --- a/ethereum/oracles/src/script/noir_fixtures/new_transaction_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/new_transaction_proof.ts @@ -1,5 +1,5 @@ import { Proof } from '../../ethereum/proof.js'; -import { txProofConfigM } from '../../noir/oracles/common/proofConfig/tx.js'; +import { txProofConfigM } from '../../noir/oracles/rpc/common/proofConfig/tx.js'; import { createNewTopLevelProofFixture } from './new_proof.js'; export function createNewTransactionProofFixture(proof: Proof): string { diff --git a/ethereum/oracles/src/script/noir_fixtures/receipt.ts b/ethereum/oracles/src/script/noir_fixtures/receipt.ts index 4d27640e4..2c2f29fe0 100644 --- a/ethereum/oracles/src/script/noir_fixtures/receipt.ts +++ b/ethereum/oracles/src/script/noir_fixtures/receipt.ts @@ -8,7 +8,7 @@ import { toRlp } from 'viem'; import { LEGACY_MAX_RECEIPT_ENCODED_LEN, LEGACY_MAX_RECEIPT_RLP_LEN -} from '../../noir/oracles/common/proofConfig/receipt.js'; +} from '../../noir/oracles/rpc/common/proofConfig/receipt.js'; export function createReceiptFixture(receipt: TransactionReceipt): string { const receiptRlp = joinArray( diff --git a/ethereum/oracles/src/script/noir_fixtures/receipt_proof.ts b/ethereum/oracles/src/script/noir_fixtures/receipt_proof.ts index 043592d3a..5e9014e7d 100644 --- a/ethereum/oracles/src/script/noir_fixtures/receipt_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/receipt_proof.ts @@ -1,5 +1,8 @@ import { Proof } from '../../ethereum/proof.js'; -import { LEGACY_MAX_RECEIPT_ENCODED_LEN, receiptProofConfigM } from '../../noir/oracles/common/proofConfig/receipt.js'; +import { + LEGACY_MAX_RECEIPT_ENCODED_LEN, + receiptProofConfigM +} from '../../noir/oracles/rpc/common/proofConfig/receipt.js'; import { BYTE_HEX_LEN } from '../../util/const.js'; import { createProofFixture } from './proof.js'; diff --git a/ethereum/oracles/src/script/noir_fixtures/state_proof.ts b/ethereum/oracles/src/script/noir_fixtures/state_proof.ts index 2e1222c0f..4ab347c6f 100644 --- a/ethereum/oracles/src/script/noir_fixtures/state_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/state_proof.ts @@ -1,8 +1,8 @@ import { GetProofReturnType } from 'viem'; import { encodeHexString, indentBlock, joinArray } from '../../noir/noir_js/encode.js'; import { encodeProof } from '../../noir/oracles/common/encode.js'; -import { encodeValue } from '../../noir/oracles/accountOracle/encode.js'; -import { accountProofConfig } from '../../noir/oracles/common/proofConfig/account.js'; +import { encodeValue } from '../../noir/oracles/rpc/accountOracle/encode.js'; +import { accountProofConfig } from '../../noir/oracles/rpc/common/proofConfig/account.js'; export function createStateProofFixture(stateProof: GetProofReturnType): string { const key = encodeHexString(stateProof.address); diff --git a/ethereum/oracles/src/script/noir_fixtures/storage_proof.ts b/ethereum/oracles/src/script/noir_fixtures/storage_proof.ts index 878500d3c..92e498731 100644 --- a/ethereum/oracles/src/script/noir_fixtures/storage_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/storage_proof.ts @@ -1,7 +1,7 @@ import { Hash } from 'viem'; import { encodeHexString, indentBlock, joinArray } from '../../noir/noir_js/encode.js'; import { encodeBytes32, encodeProof } from '../../noir/oracles/common/encode.js'; -import { storageProofConfig } from '../../noir/oracles/common/proofConfig/storage.js'; +import { storageProofConfig } from '../../noir/oracles/rpc/common/proofConfig/storage.js'; interface StorageProof { key: Hash; diff --git a/ethereum/oracles/src/script/noir_fixtures/transaction.ts b/ethereum/oracles/src/script/noir_fixtures/transaction.ts index 38ce43524..7db2ff238 100644 --- a/ethereum/oracles/src/script/noir_fixtures/transaction.ts +++ b/ethereum/oracles/src/script/noir_fixtures/transaction.ts @@ -6,8 +6,8 @@ import { padArray } from '../../util/array.js'; import { TxRlpEncoder, encodeTx } from '../../ethereum/transaction.js'; import { ZERO_PAD_VALUE } from '../../noir/oracles/common/const.js'; import { createBoundedVecFixture } from './boundedVec.js'; -import { LEGACY_MAX_TX_RLP_LEN, LEGACY_MAX_TX_ENCODED_LEN } from '../../noir/oracles/common/proofConfig/tx.js'; -import { MAX_DATA_LEN_M } from '../../noir/oracles/common/txConfig.js'; +import { LEGACY_MAX_TX_RLP_LEN, LEGACY_MAX_TX_ENCODED_LEN } from '../../noir/oracles/rpc/common/proofConfig/tx.js'; +import { MAX_DATA_LEN_M } from '../../noir/oracles/rpc/common/txConfig.js'; export function createTransactionFixture(tx: GetTransactionReturnType): string { const rlpFields = TxRlpEncoder.txToFields(tx); diff --git a/ethereum/oracles/src/script/noir_fixtures/transaction_proof.ts b/ethereum/oracles/src/script/noir_fixtures/transaction_proof.ts index 6176b5b0a..9ea15ce74 100644 --- a/ethereum/oracles/src/script/noir_fixtures/transaction_proof.ts +++ b/ethereum/oracles/src/script/noir_fixtures/transaction_proof.ts @@ -1,5 +1,5 @@ import { Proof } from '../../ethereum/proof.js'; -import { LEGACY_MAX_TX_ENCODED_LEN, txProofConfigM } from '../../noir/oracles/common/proofConfig/tx.js'; +import { LEGACY_MAX_TX_ENCODED_LEN, txProofConfigM } from '../../noir/oracles/rpc/common/proofConfig/tx.js'; import { BYTE_HEX_LEN } from '../../util/const.js'; import { createProofFixture } from './proof.js'; diff --git a/ethereum/oracles/src/script/prepareMerkleProofFixtures.ts b/ethereum/oracles/src/script/prepareMerkleProofFixtures.ts index b3026fd4a..72b5870c5 100644 --- a/ethereum/oracles/src/script/prepareMerkleProofFixtures.ts +++ b/ethereum/oracles/src/script/prepareMerkleProofFixtures.ts @@ -5,7 +5,7 @@ import { assert, encodeHexStringToArray } from '../main.js'; import { hasDuplicates } from '../util/array.js'; import { bytesToHex } from 'viem'; import { createNewTopLevelProofFixtureWithRoot } from './noir_fixtures/new_proof.js'; -import { getProofConfig } from '../noir/oracles/common/proofConfig.js'; +import { getProofConfig } from '../noir/oracles/rpc/common/proofConfig.js'; import { BYTE_HEX_LEN } from '../util/const.js'; import { encodeUint8Array } from '../noir/oracles/common/encode.js'; diff --git a/ethereum/oracles/tsconfig.json b/ethereum/oracles/tsconfig.json index ebc9aea10..4cc15cb5b 100644 --- a/ethereum/oracles/tsconfig.json +++ b/ethereum/oracles/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../tsconfig.common.json", - "include": ["src/**/*", "src/noir/oracles/accountOracle/fixtures/*.json"], + "include": ["src/**/*", "src/noir/oracles/rpc/accountOracle/fixtures/*.json"], "compilerOptions": { "rootDirs": ["src"], "outDir": "dist"