@aztec/foundation 0.86.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/array/array.d.ts.map +1 -1
- package/dest/bigint/index.d.ts +2 -0
- package/dest/bigint/index.d.ts.map +1 -1
- package/dest/bigint/index.js +6 -0
- package/dest/bigint-buffer/index.d.ts +0 -2
- package/dest/bigint-buffer/index.d.ts.map +1 -1
- package/dest/buffer/buffer16.d.ts +80 -0
- package/dest/buffer/buffer16.d.ts.map +1 -0
- package/dest/buffer/buffer16.js +100 -0
- package/dest/buffer/buffer32.d.ts +3 -7
- package/dest/buffer/buffer32.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +6 -6
- package/dest/buffer/index.d.ts +1 -0
- package/dest/buffer/index.d.ts.map +1 -1
- package/dest/buffer/index.js +1 -0
- package/dest/collection/array.d.ts +0 -2
- package/dest/collection/array.d.ts.map +1 -1
- package/dest/collection/object.d.ts +2 -0
- package/dest/collection/object.d.ts.map +1 -1
- package/dest/collection/object.js +8 -0
- package/dest/config/env_var.d.ts +1 -1
- package/dest/config/env_var.d.ts.map +1 -1
- package/dest/crypto/aes128/index.d.ts +2 -4
- package/dest/crypto/aes128/index.d.ts.map +1 -1
- package/dest/crypto/ecdsa/index.d.ts +0 -2
- package/dest/crypto/ecdsa/index.d.ts.map +1 -1
- package/dest/crypto/ecdsa/signature.d.ts +1 -3
- package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
- package/dest/crypto/grumpkin/index.d.ts +0 -2
- package/dest/crypto/grumpkin/index.d.ts.map +1 -1
- package/dest/crypto/keccak/index.d.ts +2 -4
- package/dest/crypto/keccak/index.d.ts.map +1 -1
- package/dest/crypto/keys/index.d.ts +0 -2
- package/dest/crypto/keys/index.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.noble.d.ts +2 -4
- package/dest/crypto/pedersen/pedersen.noble.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.d.ts +2 -4
- package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
- package/dest/crypto/poseidon/index.d.ts +0 -2
- package/dest/crypto/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/random/index.d.ts +1 -3
- package/dest/crypto/random/index.d.ts.map +1 -1
- package/dest/crypto/random/randomness_singleton.d.ts +0 -2
- package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
- package/dest/crypto/schnorr/signature.d.ts +3 -5
- package/dest/crypto/schnorr/signature.d.ts.map +1 -1
- package/dest/crypto/secp256k1/index.d.ts +4 -6
- package/dest/crypto/secp256k1/index.d.ts.map +1 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts +0 -2
- package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
- package/dest/crypto/serialize.d.ts +4 -6
- package/dest/crypto/serialize.d.ts.map +1 -1
- package/dest/crypto/sha256/index.d.ts +2 -4
- package/dest/crypto/sha256/index.d.ts.map +1 -1
- package/dest/crypto/sha512/index.d.ts +1 -3
- package/dest/crypto/sha512/index.d.ts.map +1 -1
- package/dest/crypto/signature/index.d.ts +0 -2
- package/dest/crypto/signature/index.d.ts.map +1 -1
- package/dest/crypto/sync/pedersen/index.d.ts +2 -4
- package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
- package/dest/crypto/sync/poseidon/index.d.ts +0 -2
- package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
- package/dest/decorators/memoize.d.ts.map +1 -1
- package/dest/eth-address/index.d.ts +2 -5
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-signature/eth_signature.d.ts +0 -2
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/fields/coordinate.d.ts +0 -2
- package/dest/fields/coordinate.d.ts.map +1 -1
- package/dest/fields/fields.d.ts +0 -3
- package/dest/fields/fields.d.ts.map +1 -1
- package/dest/fields/point.d.ts +2 -4
- package/dest/fields/point.d.ts.map +1 -1
- package/dest/fields/point.js +2 -2
- package/dest/iterable/filter.js +1 -1
- package/dest/iterable/map.js +1 -1
- package/dest/json-rpc/client/fetch.d.ts +2 -2
- package/dest/json-rpc/client/fetch.d.ts.map +1 -1
- package/dest/json-rpc/client/fetch.js +16 -30
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +7 -3
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.js +135 -13
- package/dest/json-rpc/client/undici.d.ts.map +1 -1
- package/dest/json-rpc/client/undici.js +6 -7
- package/dest/json-rpc/convert.d.ts +1 -1
- package/dest/json-rpc/convert.d.ts.map +1 -1
- package/dest/json-rpc/convert.js +1 -1
- package/dest/json-rpc/errors.d.ts +4 -0
- package/dest/json-rpc/errors.d.ts.map +1 -0
- package/dest/json-rpc/errors.js +6 -0
- package/dest/json-rpc/fixtures/class_a.d.ts +5 -3
- package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/class_b.d.ts +5 -3
- package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
- package/dest/json-rpc/index.d.ts +1 -0
- package/dest/json-rpc/index.d.ts.map +1 -1
- package/dest/json-rpc/index.js +1 -0
- package/dest/json-rpc/js_utils.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +2 -1
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +112 -39
- package/dest/json-rpc/test/integration.d.ts +0 -1
- package/dest/json-rpc/test/integration.d.ts.map +1 -1
- package/dest/log/console.d.ts.map +1 -1
- package/dest/log/gcloud-logger-config.d.ts.map +1 -1
- package/dest/log/gcloud-logger-config.js +0 -4
- package/dest/log/pino-logger.d.ts +1 -2
- package/dest/log/pino-logger.d.ts.map +1 -1
- package/dest/message/index.d.ts.map +1 -1
- package/dest/mutex/mutex_database.d.ts.map +1 -1
- package/dest/queue/bounded_serial_queue.d.ts.map +1 -1
- package/dest/schemas/api.d.ts.map +1 -1
- package/dest/schemas/parse.js +1 -1
- package/dest/schemas/schemas.d.ts +3 -5
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/utils.d.ts +1 -3
- package/dest/schemas/utils.d.ts.map +1 -1
- package/dest/serialize/buffer_reader.d.ts +9 -2
- package/dest/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/serialize/buffer_reader.js +15 -2
- package/dest/serialize/field_reader.d.ts +2 -1
- package/dest/serialize/field_reader.d.ts.map +1 -1
- package/dest/serialize/field_reader.js +4 -1
- package/dest/serialize/free_funcs.d.ts +15 -9
- package/dest/serialize/free_funcs.d.ts.map +1 -1
- package/dest/serialize/free_funcs.js +11 -0
- package/dest/serialize/serialize.d.ts +3 -5
- package/dest/serialize/serialize.d.ts.map +1 -1
- package/dest/string/index.d.ts +2 -2
- package/dest/string/index.d.ts.map +1 -1
- package/dest/string/index.js +6 -0
- package/dest/testing/files/index.d.ts +0 -2
- package/dest/testing/files/index.d.ts.map +1 -1
- package/dest/timer/timeout.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +1 -1
- package/dest/transport/interface/connector.d.ts.map +1 -1
- package/dest/transport/interface/listener.d.ts +0 -1
- package/dest/transport/interface/listener.d.ts.map +1 -1
- package/dest/transport/interface/socket.d.ts.map +1 -1
- package/dest/transport/node/node_connector.d.ts +0 -1
- package/dest/transport/node/node_connector.d.ts.map +1 -1
- package/dest/transport/node/node_connector_socket.d.ts +0 -1
- package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
- package/dest/transport/node/node_listener.d.ts +0 -1
- package/dest/transport/node/node_listener.d.ts.map +1 -1
- package/dest/transport/node/node_listener_socket.d.ts +0 -1
- package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
- package/dest/transport/transport_client.d.ts +0 -1
- package/dest/transport/transport_client.d.ts.map +1 -1
- package/dest/transport/transport_server.d.ts.map +1 -1
- package/dest/trees/hasher.d.ts +4 -6
- package/dest/trees/hasher.d.ts.map +1 -1
- package/dest/trees/indexed_merkle_tree.d.ts +0 -2
- package/dest/trees/indexed_merkle_tree.d.ts.map +1 -1
- package/dest/trees/indexed_merkle_tree_calculator.d.ts +1 -3
- package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/indexed_tree_leaf.d.ts +0 -2
- package/dest/trees/indexed_tree_leaf.d.ts.map +1 -1
- package/dest/trees/membership_witness.d.ts +1 -3
- package/dest/trees/membership_witness.d.ts.map +1 -1
- package/dest/trees/merkle_tree.d.ts +0 -2
- package/dest/trees/merkle_tree.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.d.ts +1 -3
- package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/sibling_path.d.ts +6 -8
- package/dest/trees/sibling_path.d.ts.map +1 -1
- package/dest/trees/unbalanced_merkle_tree.d.ts +0 -2
- package/dest/trees/unbalanced_merkle_tree.d.ts.map +1 -1
- package/dest/types/index.d.ts +0 -2
- package/dest/types/index.d.ts.map +1 -1
- package/dest/url/index.d.ts.map +1 -1
- package/dest/url/index.js +1 -1
- package/package.json +16 -15
- package/src/bigint/index.ts +8 -0
- package/src/buffer/buffer16.ts +133 -0
- package/src/buffer/buffer32.ts +8 -6
- package/src/buffer/index.ts +1 -0
- package/src/collection/object.ts +10 -0
- package/src/config/env_var.ts +13 -3
- package/src/fields/point.ts +0 -2
- package/src/iterable/filter.ts +1 -1
- package/src/iterable/map.ts +1 -1
- package/src/json-rpc/client/fetch.ts +14 -33
- package/src/json-rpc/client/safe_json_rpc_client.ts +171 -13
- package/src/json-rpc/client/undici.ts +6 -13
- package/src/json-rpc/convert.ts +2 -2
- package/src/json-rpc/errors.ts +6 -0
- package/src/json-rpc/fixtures/class_a.ts +4 -1
- package/src/json-rpc/fixtures/class_b.ts +4 -1
- package/src/json-rpc/index.ts +1 -0
- package/src/json-rpc/server/safe_json_rpc_server.ts +78 -25
- package/src/log/console.ts +4 -1
- package/src/log/gcloud-logger-config.ts +2 -2
- package/src/log/pino-logger.ts +2 -2
- package/src/message/index.ts +5 -1
- package/src/mutex/mutex_database.ts +2 -3
- package/src/queue/bounded_serial_queue.ts +4 -1
- package/src/schemas/api.ts +4 -4
- package/src/schemas/parse.ts +1 -1
- package/src/serialize/buffer_reader.ts +23 -3
- package/src/serialize/field_reader.ts +11 -3
- package/src/serialize/free_funcs.ts +13 -0
- package/src/string/index.ts +9 -1
- package/src/timer/timeout.ts +5 -1
- package/src/transport/interface/connector.ts +0 -1
- package/src/transport/interface/listener.ts +2 -3
- package/src/transport/interface/socket.ts +2 -3
- package/src/transport/transport_client.ts +3 -4
- package/src/transport/transport_server.ts +4 -1
- package/src/trees/hasher.ts +4 -4
- package/src/trees/indexed_merkle_tree.ts +5 -1
- package/src/trees/indexed_merkle_tree_calculator.ts +2 -2
- package/src/trees/merkle_tree.ts +4 -1
- package/src/trees/merkle_tree_calculator.ts +8 -3
- package/src/types/index.ts +0 -5
- package/src/url/index.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexed_tree_leaf.d.ts","sourceRoot":"","sources":["../../src/trees/indexed_tree_leaf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexed_tree_leaf.d.ts","sourceRoot":"","sources":["../../src/trees/indexed_tree_leaf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,IAAI,eAAe,CAAC;IAC1B;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,UAAU,IAAI,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;CACxB"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '../fields/fields.js';
|
|
4
2
|
import { BufferReader, type Tuple } from '../serialize/index.js';
|
|
5
3
|
import type { SiblingPath } from './sibling_path.js';
|
|
@@ -28,7 +26,7 @@ export declare class MembershipWitness<N extends number> {
|
|
|
28
26
|
* Sibling path of the leaf in the Merkle tree.
|
|
29
27
|
*/
|
|
30
28
|
siblingPath: Tuple<Fr, N>);
|
|
31
|
-
toBuffer(): Buffer
|
|
29
|
+
toBuffer(): Buffer<ArrayBufferLike>;
|
|
32
30
|
/**
|
|
33
31
|
* Creates a random membership witness. Used for testing purposes.
|
|
34
32
|
* @param pathSize - Number of fields in the sibling path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership_witness.d.ts","sourceRoot":"","sources":["../../src/trees/membership_witness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"membership_witness.d.ts","sourceRoot":"","sources":["../../src/trees/membership_witness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAqB,MAAM,uBAAuB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,qBAAa,iBAAiB,CAAC,CAAC,SAAS,MAAM;IAM3C;;OAEG;IACI,SAAS,EAAE,MAAM;IACxB;;OAEG;IACI,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;;IAXhC;;OAEG;IACH,QAAQ,EAAE,CAAC;IACX;;OAEG;IACI,SAAS,EAAE,MAAM;IACxB;;OAEG;IACI,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAKlC,QAAQ;IAIR;;;;OAIG;WACW,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,CAAC;IAUlD;;;;;OAKG;WACW,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,SAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAOxF,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAQhH;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,IAAI,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAOjG;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG;QAAE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;KAAE;IAWnH,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC;CAG/G"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
/** A simple immutable Merkle tree container. Use a MerkleTreeCalculator to create a new instance from a set of leaves. */
|
|
4
2
|
export declare class MerkleTree {
|
|
5
3
|
readonly height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merkle_tree.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merkle_tree.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H,qBAAa,UAAU;aAEH,MAAM,EAAE,MAAM;aACd,KAAK,EAAE,MAAM,EAAE;gBADf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EAAE;IAQjC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED,wFAAwF;IACjF,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAC3C,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAwB7C,kDAAkD;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM;IAI/B,uFAAuF;IAChF,QAAQ,CAAC,QAAQ,SAAI;CAsB7B"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { MerkleTree } from './merkle_tree.js';
|
|
4
2
|
/**
|
|
5
3
|
* Merkle tree calculator.
|
|
@@ -9,7 +7,7 @@ export declare class MerkleTreeCalculator {
|
|
|
9
7
|
private zeroHashes;
|
|
10
8
|
private hasher;
|
|
11
9
|
private constructor();
|
|
12
|
-
static create(height: number, zeroLeaf?: Buffer
|
|
10
|
+
static create(height: number, zeroLeaf?: Buffer<ArrayBuffer>, hasher?: (left: Buffer, right: Buffer) => Promise<Buffer<ArrayBuffer>>): Promise<MerkleTreeCalculator>;
|
|
13
11
|
computeTree(leaves?: Buffer[]): Promise<MerkleTree>;
|
|
14
12
|
computeTreeRoot(leaves?: Buffer[]): Promise<Buffer>;
|
|
15
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merkle_tree_calculator.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree_calculator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merkle_tree_calculator.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree_calculator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IAHhB,OAAO;WAQM,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,QAAQ,sBAAmB,EAC3B,MAAM,IAAU,MAAM,MAAM,EAAE,OAAO,MAAM,iCAC4B;IASnE,WAAW,CAAC,MAAM,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBvD,eAAe,CAAC,MAAM,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC;CAmB9D"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '../fields/index.js';
|
|
4
2
|
import { type Tuple } from '../serialize/index.js';
|
|
5
3
|
import type { Hasher } from './hasher.js';
|
|
@@ -27,7 +25,7 @@ export declare class SiblingPath<N extends number> {
|
|
|
27
25
|
pathSize: N,
|
|
28
26
|
/** The sibling path data. */
|
|
29
27
|
path: Buffer[]);
|
|
30
|
-
static get schema(): import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, Buffer
|
|
28
|
+
static get schema(): import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, Buffer<ArrayBuffer>, string>, import("zod").ZodEffects<import("zod").ZodObject<{
|
|
31
29
|
type: import("zod").ZodLiteral<"Buffer">;
|
|
32
30
|
data: import("zod").ZodArray<import("zod").ZodNumber, "many">;
|
|
33
31
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -36,14 +34,14 @@ export declare class SiblingPath<N extends number> {
|
|
|
36
34
|
}, {
|
|
37
35
|
type: "Buffer";
|
|
38
36
|
data: number[];
|
|
39
|
-
}>, Buffer
|
|
37
|
+
}>, Buffer<ArrayBuffer>, {
|
|
40
38
|
type: "Buffer";
|
|
41
39
|
data: number[];
|
|
42
40
|
}>]>, SiblingPath<number>, string | {
|
|
43
41
|
type: "Buffer";
|
|
44
42
|
data: number[];
|
|
45
43
|
}>;
|
|
46
|
-
static schemaFor<N extends number>(size: N): import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, Buffer
|
|
44
|
+
static schemaFor<N extends number>(size: N): import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, Buffer<ArrayBuffer>, string>, import("zod").ZodEffects<import("zod").ZodObject<{
|
|
47
45
|
type: import("zod").ZodLiteral<"Buffer">;
|
|
48
46
|
data: import("zod").ZodArray<import("zod").ZodNumber, "many">;
|
|
49
47
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -52,7 +50,7 @@ export declare class SiblingPath<N extends number> {
|
|
|
52
50
|
}, {
|
|
53
51
|
type: "Buffer";
|
|
54
52
|
data: number[];
|
|
55
|
-
}>, Buffer
|
|
53
|
+
}>, Buffer<ArrayBuffer>, {
|
|
56
54
|
type: "Buffer";
|
|
57
55
|
data: number[];
|
|
58
56
|
}>]>, SiblingPath<N>, string | {
|
|
@@ -62,7 +60,7 @@ export declare class SiblingPath<N extends number> {
|
|
|
62
60
|
type: "Buffer";
|
|
63
61
|
data: number[];
|
|
64
62
|
}>;
|
|
65
|
-
toJSON(): Buffer
|
|
63
|
+
toJSON(): Buffer<ArrayBufferLike>;
|
|
66
64
|
/**
|
|
67
65
|
* Returns sibling path hashed up from the a element.
|
|
68
66
|
* @param size - The number of elements in a given path.
|
|
@@ -128,5 +126,5 @@ export declare class SiblingPath<N extends number> {
|
|
|
128
126
|
getSubtreeSiblingPath<SubtreeHeight extends number, SubtreeSiblingPathHeight extends number>(subtreeHeight: SubtreeHeight): SiblingPath<SubtreeSiblingPathHeight>;
|
|
129
127
|
}
|
|
130
128
|
/** Computes the expected root of a merkle tree given a leaf and its sibling path. */
|
|
131
|
-
export declare function computeRootFromSiblingPath(leaf: Buffer, siblingPath: Buffer[], index: number, hasher?: (left: Buffer, right: Buffer) => Promise<Buffer
|
|
129
|
+
export declare function computeRootFromSiblingPath(leaf: Buffer, siblingPath: Buffer[], index: number, hasher?: (left: Buffer, right: Buffer) => Promise<Buffer<ArrayBufferLike>>): Promise<Buffer<ArrayBufferLike>>;
|
|
132
130
|
//# sourceMappingURL=sibling_path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sibling_path.d.ts","sourceRoot":"","sources":["../../src/trees/sibling_path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sibling_path.d.ts","sourceRoot":"","sources":["../../src/trees/sibling_path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,OAAO,EACL,KAAK,KAAK,EAIX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;GASG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM;IASrC,+DAA+D;IACxD,QAAQ,EAAE,CAAC;IATpB,OAAO,CAAC,IAAI,CAAmB;IAE/B;;;;OAIG;;IAED,+DAA+D;IACxD,QAAQ,EAAE,CAAC;IAClB,6BAA6B;IAC7B,IAAI,EAAE,MAAM,EAAE;IAKhB,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;OAEhB;IAED,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC;;;;;;;;;;;;;;;;;;;IAO1C,MAAM;IAIN;;;;;;OAMG;WACW,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;IAUlG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC;IAKzC;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAIzB;;;OAGG;IACI,aAAa,IAAI,MAAM,EAAE;IAIhC;;;OAGG;IACI,QAAQ,IAAI,EAAE,EAAE;IAIvB;;;OAGG;IACI,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAK9B;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,WAAW,CAAC,CAAC,CAAC;IAK5E;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI;;;;IAU5D;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAIzB;;;;OAIG;WACW,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;IAIxE;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,SAAS,MAAM,EAAE,wBAAwB,SAAS,MAAM,EAChG,aAAa,EAAE,aAAa,GAC3B,WAAW,CAAC,wBAAwB,CAAC;CAMzC;AAED,qFAAqF;AACrF,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,IAAU,MAAM,MAAM,EAAE,OAAO,MAAM,qCAAmD,oCAQ/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unbalanced_merkle_tree.d.ts","sourceRoot":"","sources":["../../src/trees/unbalanced_merkle_tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unbalanced_merkle_tree.d.ts","sourceRoot":"","sources":["../../src/trees/unbalanced_merkle_tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,qBAAc,GAAG,MAAM,CAwC9G;AAgDD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;WAhC9D,MAAM;kBAAgB,MAAM;EAmCvC"}
|
package/dest/types/index.d.ts
CHANGED
|
@@ -14,6 +14,4 @@ export type Writeable<T> = {
|
|
|
14
14
|
};
|
|
15
15
|
/** Removes readonly modifiers for an object. */
|
|
16
16
|
export declare function unfreeze<T>(obj: T): Writeable<T>;
|
|
17
|
-
/** Maybe exists, maybe not. */
|
|
18
|
-
export type Maybe<T extends object> = T | unknown;
|
|
19
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,kCAAkC;AAClC,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE/E,6CAA6C;AAC7C,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE9D,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAEhD"}
|
package/dest/url/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AAEH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4CjD"}
|
package/dest/url/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
|
2
2
|
// Permission is hereby granted, free of charge, to any person obtaining
|
|
3
3
|
// a copy of this software and associated documentation files (the
|
|
4
4
|
// 'Software'), to deal in the Software without restriction, including
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dest/index.js",
|
|
6
6
|
"types": "./dest/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
"./eslint": "
|
|
9
|
-
"./eslint.docs": "
|
|
8
|
+
"./eslint": "./eslint.config.js",
|
|
9
|
+
"./eslint.docs": "./eslint.config.docs.js",
|
|
10
10
|
"./prettier": "./.prettierrc.json",
|
|
11
11
|
"./abi": "./dest/abi/index.js",
|
|
12
12
|
"./async-map": "./dest/async-map/index.js",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
]
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@aztec/bb.js": "0.
|
|
103
|
+
"@aztec/bb.js": "0.87.0",
|
|
104
104
|
"@koa/cors": "^5.0.0",
|
|
105
105
|
"@noble/curves": "^1.2.0",
|
|
106
106
|
"bn.js": "^5.2.1",
|
|
@@ -138,22 +138,23 @@
|
|
|
138
138
|
"@types/leveldown": "^4.0.3",
|
|
139
139
|
"@types/lodash.chunk": "^4.2.9",
|
|
140
140
|
"@types/lodash.clonedeepwith": "^4.5.7",
|
|
141
|
-
"@types/node": "^
|
|
141
|
+
"@types/node": "^22.15.17",
|
|
142
142
|
"@types/pako": "^2.0.0",
|
|
143
143
|
"@types/supertest": "^2.0.12",
|
|
144
|
-
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
145
|
-
"@typescript-eslint/parser": "^6.2.1",
|
|
146
144
|
"comlink": "^4.4.1",
|
|
147
|
-
"eslint": "^
|
|
148
|
-
"eslint-config-prettier": "^
|
|
149
|
-
"eslint-plugin-
|
|
150
|
-
"eslint-plugin-
|
|
151
|
-
"eslint-plugin-
|
|
145
|
+
"eslint": "^9.26.0",
|
|
146
|
+
"eslint-config-prettier": "^10.1.5",
|
|
147
|
+
"eslint-plugin-import": "^2.31.0",
|
|
148
|
+
"eslint-plugin-jsdoc": "^50.6.14",
|
|
149
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
150
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
151
|
+
"globals": "^16.1.0",
|
|
152
152
|
"jest": "^29.5.0",
|
|
153
|
-
"prettier": "^
|
|
153
|
+
"prettier": "^3.5.3",
|
|
154
154
|
"supertest": "^6.3.3",
|
|
155
155
|
"ts-node": "^10.9.1",
|
|
156
|
-
"typescript": "^5.
|
|
156
|
+
"typescript": "^5.3.3",
|
|
157
|
+
"typescript-eslint": "^8.32.1",
|
|
157
158
|
"viem": "2.23.7"
|
|
158
159
|
},
|
|
159
160
|
"files": [
|
|
@@ -162,6 +163,6 @@
|
|
|
162
163
|
"!*.test.*"
|
|
163
164
|
],
|
|
164
165
|
"engines": {
|
|
165
|
-
"node": ">=
|
|
166
|
+
"node": ">=20.10"
|
|
166
167
|
}
|
|
167
168
|
}
|
package/src/bigint/index.ts
CHANGED
|
@@ -5,3 +5,11 @@ export function minBigint(...values: bigint[]): bigint {
|
|
|
5
5
|
}
|
|
6
6
|
return values.reduce((min, value) => (value < min ? value : min), values[0]);
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
/** Returns maximim value across a list of bigints. */
|
|
10
|
+
export function maxBigint(...values: bigint[]): bigint {
|
|
11
|
+
if (values.length === 0) {
|
|
12
|
+
throw new Error('Cannot get max of empty array');
|
|
13
|
+
}
|
|
14
|
+
return values.reduce((max, value) => (value > max ? value : max), values[0]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
|
|
4
|
+
|
|
5
|
+
import { inspect } from 'util';
|
|
6
|
+
|
|
7
|
+
import { bufferToHex } from '../string/index.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A class representing a 16 byte Buffer.
|
|
11
|
+
*/
|
|
12
|
+
export class Buffer16 {
|
|
13
|
+
/**
|
|
14
|
+
* The size of the hash in bytes.
|
|
15
|
+
*/
|
|
16
|
+
public static SIZE = 16;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Buffer16 with value zero.
|
|
20
|
+
*/
|
|
21
|
+
public static ZERO = new Buffer16(Buffer.alloc(Buffer16.SIZE));
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
/**
|
|
25
|
+
* The buffer containing the hash.
|
|
26
|
+
*/
|
|
27
|
+
public buffer: Buffer,
|
|
28
|
+
) {
|
|
29
|
+
if (buffer.length !== Buffer16.SIZE) {
|
|
30
|
+
throw new Error(`Expected buffer to have length ${Buffer16.SIZE} but was ${buffer.length}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the raw buffer of the hash.
|
|
36
|
+
* @returns The buffer containing the hash.
|
|
37
|
+
*/
|
|
38
|
+
public toBuffer() {
|
|
39
|
+
return this.buffer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates a Buffer16 from a buffer.
|
|
44
|
+
* @param buffer - The buffer to create from.
|
|
45
|
+
* @returns A new Buffer16 object.
|
|
46
|
+
*/
|
|
47
|
+
public static fromBuffer(buffer: Buffer | BufferReader) {
|
|
48
|
+
const reader = BufferReader.asReader(buffer);
|
|
49
|
+
return new Buffer16(reader.readBytes(Buffer16.SIZE));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Checks if this hash and another hash are equal.
|
|
54
|
+
* @param hash - A hash to compare with.
|
|
55
|
+
* @returns True if the hashes are equal, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
public equals(hash: Buffer16): boolean {
|
|
58
|
+
return this.buffer.equals(hash.buffer);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns true if this hash is zero.
|
|
63
|
+
* @returns True if this hash is zero.
|
|
64
|
+
*/
|
|
65
|
+
public isZero(): boolean {
|
|
66
|
+
return this.buffer.equals(Buffer.alloc(16, 0));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Convert this hash to a hex string.
|
|
71
|
+
* @returns The hex string.
|
|
72
|
+
*/
|
|
73
|
+
public toString() {
|
|
74
|
+
return bufferToHex(this.buffer);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[inspect.custom]() {
|
|
78
|
+
return `Buffer16<${this.toString()}>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
toJSON() {
|
|
82
|
+
return this.toString();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Convert this hash to a big int.
|
|
87
|
+
* @returns The big int.
|
|
88
|
+
*/
|
|
89
|
+
public toBigInt() {
|
|
90
|
+
return deserializeBigInt(this.buffer, 0, Buffer16.SIZE).elem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Creates a Buffer16 from a bigint.
|
|
95
|
+
*/
|
|
96
|
+
public static fromBigInt(hash: bigint) {
|
|
97
|
+
return new Buffer16(serializeBigInt(hash, Buffer16.SIZE));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public static fromField(hash: Fr) {
|
|
101
|
+
return new Buffer16(serializeBigInt(hash.toBigInt()));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Converts a hex string into a Buffer16 object.
|
|
106
|
+
*/
|
|
107
|
+
public static fromString(str: string): Buffer16 {
|
|
108
|
+
if (str.startsWith('0x')) {
|
|
109
|
+
str = str.slice(2);
|
|
110
|
+
}
|
|
111
|
+
if (str.length !== this.SIZE * 2) {
|
|
112
|
+
throw new Error(`Expected string to be ${this.SIZE * 2} characters long, but was ${str.length}`);
|
|
113
|
+
}
|
|
114
|
+
return new Buffer16(Buffer.from(str, 'hex'));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Converts a number into a Buffer16 object.
|
|
119
|
+
* @param num - The number to convert.
|
|
120
|
+
* @returns A new Buffer16 object.
|
|
121
|
+
*/
|
|
122
|
+
public static fromNumber(num: number): Buffer16 {
|
|
123
|
+
return new Buffer16(serializeBigInt(BigInt(num), Buffer16.SIZE));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Generates a random Buffer16.
|
|
128
|
+
* @returns A new Buffer16 object.
|
|
129
|
+
*/
|
|
130
|
+
public static random(): Buffer16 {
|
|
131
|
+
return new Buffer16(Buffer.from(randomBytes(Buffer16.SIZE)));
|
|
132
|
+
}
|
|
133
|
+
}
|
package/src/buffer/buffer32.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { randomBytes } from '@aztec/foundation/crypto';
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
|
|
4
4
|
|
|
5
|
+
import { inspect } from 'util';
|
|
6
|
+
|
|
5
7
|
import { bufferToHex } from '../string/index.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -72,6 +74,10 @@ export class Buffer32 {
|
|
|
72
74
|
return bufferToHex(this.buffer);
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
[inspect.custom]() {
|
|
78
|
+
return `Buffer32<${this.toString()}>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
toJSON() {
|
|
76
82
|
return this.toString();
|
|
77
83
|
}
|
|
@@ -85,8 +91,6 @@ export class Buffer32 {
|
|
|
85
91
|
}
|
|
86
92
|
/**
|
|
87
93
|
* Creates a Buffer32 from a bigint.
|
|
88
|
-
* @param hash - The tx hash as a big int.
|
|
89
|
-
* @returns The Buffer32.
|
|
90
94
|
*/
|
|
91
95
|
public static fromBigInt(hash: bigint) {
|
|
92
96
|
return new Buffer32(serializeBigInt(hash, Buffer32.SIZE));
|
|
@@ -112,15 +116,13 @@ export class Buffer32 {
|
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
118
|
* Converts a string into a Buffer32 object.
|
|
115
|
-
* @param str - The TX hash in string format.
|
|
116
|
-
* @returns A new Buffer32 object.
|
|
117
119
|
*/
|
|
118
120
|
public static fromString(str: string): Buffer32 {
|
|
119
121
|
if (str.startsWith('0x')) {
|
|
120
122
|
str = str.slice(2);
|
|
121
123
|
}
|
|
122
|
-
if (str.length !==
|
|
123
|
-
throw new Error(`Expected string to be
|
|
124
|
+
if (str.length !== this.SIZE * 2) {
|
|
125
|
+
throw new Error(`Expected string to be ${this.SIZE * 2} characters long, but was ${str.length}`);
|
|
124
126
|
}
|
|
125
127
|
return new Buffer32(Buffer.from(str, 'hex'));
|
|
126
128
|
}
|
package/src/buffer/index.ts
CHANGED
package/src/collection/object.ts
CHANGED
|
@@ -64,3 +64,13 @@ export function fromEntries<const T extends ReadonlyArray<readonly [PropertyKey,
|
|
|
64
64
|
// See https://stackoverflow.com/a/76176570
|
|
65
65
|
return Object.fromEntries(entries) as { [K in T[number] as K[0]]: K[1] };
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
/** Asserts all values in object are not undefined. */
|
|
69
|
+
export function assertRequired<T extends object>(obj: T): Required<T> {
|
|
70
|
+
for (const key in obj) {
|
|
71
|
+
if (obj[key] === undefined) {
|
|
72
|
+
throw new Error(`Missing property ${key}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return obj as Required<T>;
|
|
76
|
+
}
|
package/src/config/env_var.ts
CHANGED
|
@@ -49,9 +49,15 @@ export type EnvVar =
|
|
|
49
49
|
| 'DATA_DIRECTORY'
|
|
50
50
|
| 'DATA_STORE_MAP_SIZE_KB'
|
|
51
51
|
| 'ARCHIVER_STORE_MAP_SIZE_KB'
|
|
52
|
+
| 'BLOB_SINK_MAP_SIZE_KB'
|
|
52
53
|
| 'P2P_STORE_MAP_SIZE_KB'
|
|
53
54
|
| 'PROVER_BROKER_STORE_MAP_SIZE_KB'
|
|
54
55
|
| 'WS_DB_MAP_SIZE_KB'
|
|
56
|
+
| 'ARCHIVE_TREE_MAP_SIZE_KB'
|
|
57
|
+
| 'NULLIFIER_TREE_MAP_SIZE_KB'
|
|
58
|
+
| 'NOTE_HASH_TREE_MAP_SIZE_KB'
|
|
59
|
+
| 'MESSAGE_TREE_MAP_SIZE_KB'
|
|
60
|
+
| 'PUBLIC_DATA_TREE_MAP_SIZE_KB'
|
|
55
61
|
| 'DEBUG'
|
|
56
62
|
| 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY'
|
|
57
63
|
| 'DEPLOY_AZTEC_CONTRACTS_SALT'
|
|
@@ -99,6 +105,7 @@ export type EnvVar =
|
|
|
99
105
|
| 'P2P_GOSSIPSUB_INTERVAL_MS'
|
|
100
106
|
| 'P2P_GOSSIPSUB_MCACHE_GOSSIP'
|
|
101
107
|
| 'P2P_GOSSIPSUB_MCACHE_LENGTH'
|
|
108
|
+
| 'P2P_GOSSIPSUB_SEEN_TTL'
|
|
102
109
|
| 'P2P_GOSSIPSUB_TX_INVALID_MESSAGE_DELIVERIES_DECAY'
|
|
103
110
|
| 'P2P_GOSSIPSUB_TX_INVALID_MESSAGE_DELIVERIES_WEIGHT'
|
|
104
111
|
| 'P2P_GOSSIPSUB_TX_TOPIC_WEIGHT'
|
|
@@ -114,8 +121,6 @@ export type EnvVar =
|
|
|
114
121
|
| 'P2P_PORT'
|
|
115
122
|
| 'P2P_BROADCAST_PORT'
|
|
116
123
|
| 'P2P_IP'
|
|
117
|
-
| 'P2P_TX_POOL_KEEP_PROVEN_FOR'
|
|
118
|
-
| 'P2P_ATTESTATION_POOL_KEEP_FOR'
|
|
119
124
|
| 'P2P_ARCHIVED_TX_LIMIT'
|
|
120
125
|
| 'P2P_TRUSTED_PEERS'
|
|
121
126
|
| 'P2P_PRIVATE_PEERS'
|
|
@@ -134,6 +139,7 @@ export type EnvVar =
|
|
|
134
139
|
| 'PROVER_BROKER_MAX_EPOCHS_TO_KEEP_RESULTS_FOR'
|
|
135
140
|
| 'PROVER_COORDINATION_NODE_URLS'
|
|
136
141
|
| 'PROVER_FAILED_PROOF_STORE'
|
|
142
|
+
| 'PROVER_NODE_FAILED_EPOCH_STORE'
|
|
137
143
|
| 'PROVER_ID'
|
|
138
144
|
| 'PROVER_NODE_POLLING_INTERVAL_MS'
|
|
139
145
|
| 'PROVER_NODE_MAX_PENDING_JOBS'
|
|
@@ -151,11 +157,13 @@ export type EnvVar =
|
|
|
151
157
|
| 'PXE_PROVER_ENABLED'
|
|
152
158
|
| 'REGISTRY_CONTRACT_ADDRESS'
|
|
153
159
|
| 'ROLLUP_CONTRACT_ADDRESS'
|
|
160
|
+
| 'RPC_SIMULATE_PUBLIC_MAX_GAS_LIMIT'
|
|
154
161
|
| 'SENTINEL_ENABLED'
|
|
155
162
|
| 'SENTINEL_HISTORY_LENGTH_IN_EPOCHS'
|
|
156
163
|
| 'SEQ_MAX_BLOCK_SIZE_IN_BYTES'
|
|
157
164
|
| 'SEQ_MAX_TX_PER_BLOCK'
|
|
158
165
|
| 'SEQ_MIN_TX_PER_BLOCK'
|
|
166
|
+
| 'SEQ_PUBLISH_TXS_WITH_PROPOSALS'
|
|
159
167
|
| 'SEQ_MAX_DA_BLOCK_GAS'
|
|
160
168
|
| 'SEQ_MAX_L2_BLOCK_GAS'
|
|
161
169
|
| 'SEQ_PUBLISH_RETRY_INTERVAL_MS'
|
|
@@ -221,4 +229,6 @@ export type EnvVar =
|
|
|
221
229
|
| 'K8S_POD_UID'
|
|
222
230
|
| 'K8S_NAMESPACE_NAME'
|
|
223
231
|
| 'CUSTOM_FORWARDER_CONTRACT_ADDRESS'
|
|
224
|
-
| 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS'
|
|
232
|
+
| 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS'
|
|
233
|
+
| 'AUTO_UPDATE'
|
|
234
|
+
| 'AUTO_UPDATE_URL';
|
package/src/fields/point.ts
CHANGED
|
@@ -246,9 +246,7 @@ export class Point {
|
|
|
246
246
|
|
|
247
247
|
// Used for IvpkM, OvpkM, NpkM and TpkM. TODO(#8124): Consider removing this method.
|
|
248
248
|
toWrappedNoirStruct() {
|
|
249
|
-
/* eslint-disable camelcase */
|
|
250
249
|
return { inner: this.toNoirStruct() };
|
|
251
|
-
/* eslint-enable camelcase */
|
|
252
250
|
}
|
|
253
251
|
|
|
254
252
|
/**
|
package/src/iterable/filter.ts
CHANGED
package/src/iterable/map.ts
CHANGED
|
@@ -8,9 +8,7 @@ const log = createLogger('json-rpc:json_rpc_client');
|
|
|
8
8
|
|
|
9
9
|
export type JsonRpcFetch = (
|
|
10
10
|
host: string,
|
|
11
|
-
rpcMethod: string,
|
|
12
11
|
body: any,
|
|
13
|
-
useApiEndpoints: boolean,
|
|
14
12
|
extraHeaders?: Record<string, string>,
|
|
15
13
|
noRetry?: boolean,
|
|
16
14
|
) => Promise<{ response: any; headers: { get: (header: string) => string | null | undefined } }>;
|
|
@@ -27,45 +25,35 @@ export type JsonRpcFetch = (
|
|
|
27
25
|
*/
|
|
28
26
|
export async function defaultFetch(
|
|
29
27
|
host: string,
|
|
30
|
-
|
|
31
|
-
body: any,
|
|
32
|
-
useApiEndpoints: boolean,
|
|
28
|
+
body: unknown,
|
|
33
29
|
extraHeaders: Record<string, string> = {},
|
|
34
30
|
noRetry = false,
|
|
35
31
|
): Promise<{ response: any; headers: { get: (header: string) => string | null | undefined } }> {
|
|
36
|
-
log.debug(format(`JsonRpcClient.fetch`, host,
|
|
32
|
+
log.debug(format(`JsonRpcClient.fetch`, host, '->', body));
|
|
37
33
|
let resp: Response;
|
|
38
34
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
resp = await fetch(host, {
|
|
47
|
-
method: 'POST',
|
|
48
|
-
body: jsonStringify({ ...body, method: rpcMethod }),
|
|
49
|
-
headers: { 'content-type': 'application/json', ...extraHeaders },
|
|
50
|
-
});
|
|
51
|
-
}
|
|
35
|
+
resp = await fetch(host, {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
body: jsonStringify(body),
|
|
38
|
+
headers: { 'content-type': 'application/json', ...extraHeaders },
|
|
39
|
+
});
|
|
52
40
|
} catch (err) {
|
|
53
|
-
const errorMessage = `Error fetching from host ${host}
|
|
41
|
+
const errorMessage = `Error fetching from host ${host}: ${inspect(err)}`;
|
|
54
42
|
throw new Error(errorMessage);
|
|
55
43
|
}
|
|
56
44
|
|
|
57
45
|
let responseJson;
|
|
58
46
|
try {
|
|
59
47
|
responseJson = await resp.json();
|
|
60
|
-
} catch
|
|
48
|
+
} catch {
|
|
61
49
|
if (!resp.ok) {
|
|
62
50
|
throw new Error(resp.statusText);
|
|
63
51
|
}
|
|
64
|
-
throw new Error(`Failed to parse body as JSON: ${resp.text()}`);
|
|
52
|
+
throw new Error(`Failed to parse body as JSON: ${await resp.text()}`);
|
|
65
53
|
}
|
|
66
54
|
|
|
67
55
|
if (!resp.ok) {
|
|
68
|
-
const errorMessage = `Error ${resp.status} from server ${host}
|
|
56
|
+
const errorMessage = `Error ${resp.status} from server ${host}: ${responseJson.error.message}`;
|
|
69
57
|
if (noRetry || (resp.status >= 400 && resp.status < 500)) {
|
|
70
58
|
throw new NoRetryError(errorMessage);
|
|
71
59
|
} else {
|
|
@@ -84,17 +72,10 @@ export async function defaultFetch(
|
|
|
84
72
|
* @returns A fetch function.
|
|
85
73
|
*/
|
|
86
74
|
export function makeFetch(retries: number[], defaultNoRetry: boolean, log?: Logger): typeof defaultFetch {
|
|
87
|
-
return async (
|
|
88
|
-
host: string,
|
|
89
|
-
rpcMethod: string,
|
|
90
|
-
body: any,
|
|
91
|
-
useApiEndpoints: boolean,
|
|
92
|
-
extraHeaders: Record<string, string> = {},
|
|
93
|
-
noRetry?: boolean,
|
|
94
|
-
) => {
|
|
75
|
+
return async (host: string, body: unknown, extraHeaders: Record<string, string> = {}, noRetry?: boolean) => {
|
|
95
76
|
return await retry(
|
|
96
|
-
() => defaultFetch(host,
|
|
97
|
-
`JsonRpcClient request
|
|
77
|
+
() => defaultFetch(host, body, extraHeaders, noRetry ?? defaultNoRetry),
|
|
78
|
+
`JsonRpcClient request to ${host}`,
|
|
98
79
|
makeBackoff(retries),
|
|
99
80
|
log,
|
|
100
81
|
false,
|