-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Revert "chore: Validate RPC inputs" (#9875)
Reverts #9672 as it broke some e2e tests and boxes
- Loading branch information
Showing
268 changed files
with
3,007 additions
and
5,990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
EncryptedNoteL2BlockL2Logs, | ||
ExtendedUnencryptedL2Log, | ||
L2Block, | ||
NullifierMembershipWitness, | ||
TxReceipt, | ||
UnencryptedL2BlockL2Logs, | ||
} from '@aztec/circuit-types'; | ||
import { EthAddress, Fr } from '@aztec/circuits.js'; | ||
import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client'; | ||
|
||
import { type ArchiveSource } from '../archiver/archiver.js'; | ||
|
||
export const createArchiverClient = (url: string, fetch = makeFetch([1, 2, 3], true)): ArchiveSource => | ||
createJsonRpcClient<ArchiveSource>( | ||
url, | ||
{ | ||
EthAddress, | ||
ExtendedUnencryptedL2Log, | ||
Fr, | ||
L2Block, | ||
EncryptedNoteL2BlockL2Logs, | ||
UnencryptedL2BlockL2Logs, | ||
}, | ||
{ TxReceipt, NullifierMembershipWitness }, | ||
false, | ||
'archiver', | ||
fetch, | ||
) as ArchiveSource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
EncryptedNoteL2BlockL2Logs, | ||
ExtendedUnencryptedL2Log, | ||
L2Block, | ||
NullifierMembershipWitness, | ||
TxEffect, | ||
TxReceipt, | ||
UnencryptedL2BlockL2Logs, | ||
} from '@aztec/circuit-types'; | ||
import { EthAddress, Fr } from '@aztec/circuits.js'; | ||
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server'; | ||
|
||
import { type Archiver } from '../archiver/archiver.js'; | ||
|
||
/** | ||
* Wrap an Archiver instance with a JSON RPC HTTP server. | ||
* @param archiverService - The Archiver instance | ||
* @returns An JSON-RPC HTTP server | ||
*/ | ||
export function createArchiverRpcServer(archiverService: Archiver): JsonRpcServer { | ||
return new JsonRpcServer( | ||
archiverService, | ||
{ | ||
EthAddress, | ||
ExtendedUnencryptedL2Log, | ||
Fr, | ||
L2Block, | ||
EncryptedNoteL2BlockL2Logs, | ||
UnencryptedL2BlockL2Logs, | ||
TxEffect, | ||
}, | ||
{ TxReceipt, NullifierMembershipWitness }, | ||
['start', 'stop'], | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
import { type ArchiverApi, ArchiverApiSchema } from '@aztec/circuit-types'; | ||
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client'; | ||
import { createSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server'; | ||
|
||
export function createArchiverClient(url: string, fetch = makeFetch([1, 2, 3], true)): ArchiverApi { | ||
return createSafeJsonRpcClient<ArchiverApi>(url, ArchiverApiSchema, false, 'archiver', fetch); | ||
} | ||
|
||
export function createArchiverRpcServer(handler: ArchiverApi) { | ||
return createSafeJsonRpcServer(handler, ArchiverApiSchema); | ||
} | ||
export * from './archiver_client.js'; | ||
export * from './archiver_server.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,66 @@ | ||
import { type AztecNode, AztecNodeApiSchema } from '@aztec/circuit-types'; | ||
import { createSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server'; | ||
import { | ||
type AztecNode, | ||
EncryptedL2NoteLog, | ||
EncryptedNoteL2BlockL2Logs, | ||
EpochProofQuote, | ||
ExtendedUnencryptedL2Log, | ||
L2Block, | ||
LogId, | ||
NullifierMembershipWitness, | ||
PublicDataWitness, | ||
PublicSimulationOutput, | ||
SiblingPath, | ||
Tx, | ||
TxEffect, | ||
TxHash, | ||
TxReceipt, | ||
UnencryptedL2BlockL2Logs, | ||
} from '@aztec/circuit-types'; | ||
import { FunctionSelector, Header, PublicKeys } from '@aztec/circuits.js'; | ||
import { NoteSelector } from '@aztec/foundation/abi'; | ||
import { AztecAddress } from '@aztec/foundation/aztec-address'; | ||
import { Buffer32 } from '@aztec/foundation/buffer'; | ||
import { EthAddress } from '@aztec/foundation/eth-address'; | ||
import { Fr } from '@aztec/foundation/fields'; | ||
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server'; | ||
|
||
/** | ||
* Wrap an AztecNode instance with a JSON RPC HTTP server. | ||
* @param node - The AztecNode | ||
* @returns An JSON-RPC HTTP server | ||
*/ | ||
export function createAztecNodeRpcServer(node: AztecNode) { | ||
return createSafeJsonRpcServer(node, AztecNodeApiSchema); | ||
const rpc = new JsonRpcServer( | ||
node, | ||
{ | ||
AztecAddress, | ||
EthAddress, | ||
ExtendedUnencryptedL2Log, | ||
Fr, | ||
FunctionSelector, | ||
Header, | ||
L2Block, | ||
TxEffect, | ||
LogId, | ||
TxHash, | ||
Buffer32, | ||
PublicDataWitness, | ||
PublicKeys, | ||
SiblingPath, | ||
}, | ||
{ | ||
EncryptedNoteL2BlockL2Logs, | ||
EncryptedL2NoteLog, | ||
NoteSelector, | ||
NullifierMembershipWitness, | ||
PublicSimulationOutput, | ||
Tx, | ||
TxReceipt, | ||
UnencryptedL2BlockL2Logs, | ||
EpochProofQuote, | ||
}, | ||
// disable methods not part of the AztecNode interface | ||
['start', 'stop'], | ||
); | ||
return rpc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,97 @@ | ||
import { type PXE, PXESchema } from '@aztec/circuit-types'; | ||
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client'; | ||
import { | ||
AuthWitness, | ||
CountedNoteLog, | ||
CountedPublicExecutionRequest, | ||
EncryptedL2Log, | ||
EncryptedL2NoteLog, | ||
EncryptedNoteL2BlockL2Logs, | ||
EventMetadata, | ||
ExtendedNote, | ||
ExtendedUnencryptedL2Log, | ||
L2Block, | ||
LogId, | ||
Note, | ||
NullifierMembershipWitness, | ||
type PXE, | ||
PrivateExecutionResult, | ||
SiblingPath, | ||
Tx, | ||
TxEffect, | ||
TxExecutionRequest, | ||
TxHash, | ||
TxProvingResult, | ||
TxReceipt, | ||
TxSimulationResult, | ||
UnencryptedL2BlockL2Logs, | ||
UnencryptedL2Log, | ||
UniqueNote, | ||
} from '@aztec/circuit-types'; | ||
import { | ||
AztecAddress, | ||
CompleteAddress, | ||
EthAddress, | ||
Fr, | ||
FunctionSelector, | ||
GrumpkinScalar, | ||
Point, | ||
PrivateCircuitPublicInputs, | ||
PublicKeys, | ||
} from '@aztec/circuits.js'; | ||
import { EventSelector, NoteSelector } from '@aztec/foundation/abi'; | ||
import { Buffer32 } from '@aztec/foundation/buffer'; | ||
import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client'; | ||
|
||
/** | ||
* Creates a JSON-RPC client to remotely talk to PXE. | ||
* @param url - The URL of the PXE. | ||
* @param fetch - The fetch implementation to use. | ||
* @returns A JSON-RPC client of PXE. | ||
*/ | ||
export function createPXEClient(url: string, fetch = makeFetch([1, 2, 3], false)): PXE { | ||
return createSafeJsonRpcClient<PXE>(url, PXESchema, false, 'pxe', fetch); | ||
} | ||
export const createPXEClient = (url: string, fetch = makeFetch([1, 2, 3], false)): PXE => | ||
createJsonRpcClient<PXE>( | ||
url, | ||
{ | ||
AuthWitness, | ||
AztecAddress, | ||
CompleteAddress, | ||
FunctionSelector, | ||
EthAddress, | ||
EventSelector, | ||
ExtendedNote, | ||
UniqueNote, | ||
ExtendedUnencryptedL2Log, | ||
Fr, | ||
GrumpkinScalar, | ||
L2Block, | ||
TxEffect, | ||
LogId, | ||
Note, | ||
Point, | ||
PublicKeys, | ||
TxExecutionRequest, | ||
TxHash, | ||
Buffer32, | ||
SiblingPath, | ||
}, | ||
{ | ||
EncryptedNoteL2BlockL2Logs, | ||
EncryptedL2NoteLog, | ||
EncryptedL2Log, | ||
EventMetadata, | ||
UnencryptedL2Log, | ||
NoteSelector, | ||
NullifierMembershipWitness, | ||
TxSimulationResult, | ||
TxProvingResult, | ||
PrivateCircuitPublicInputs, | ||
PrivateExecutionResult, | ||
CountedPublicExecutionRequest, | ||
CountedNoteLog, | ||
Tx, | ||
TxReceipt, | ||
UnencryptedL2BlockL2Logs, | ||
}, | ||
false, | ||
'pxe', | ||
fetch, | ||
) as PXE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.