@aztec/stdlib 0.0.1-commit.a5db02d → 0.0.1-commit.aa0c64f
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/abi/abi.d.ts +8 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/contract_artifact.d.ts +1 -14
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +26 -25
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/avm/index.d.ts +1 -6
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -5
- package/dest/contract/contract_class.d.ts +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -2
- package/dest/contract/index.d.ts +1 -2
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -1
- package/dest/interfaces/block-builder.d.ts +7 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/private_kernel_prover.d.ts +64 -3
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +1 -1
- package/dest/interfaces/server.d.ts +1 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +0 -1
- package/dest/kernel/hints/index.d.ts +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +0 -1
- package/dest/kernel/index.d.ts +5 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +4 -0
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +3 -7
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +4 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +2 -1
- package/dest/kernel/utils/index.d.ts +1 -2
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +0 -1
- package/dest/logs/index.d.ts +3 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -0
- package/dest/logs/message_context.d.ts +17 -0
- package/dest/logs/message_context.d.ts.map +1 -0
- package/dest/logs/message_context.js +9 -0
- package/dest/logs/pending_tagged_log.d.ts +11 -0
- package/dest/logs/pending_tagged_log.d.ts.map +1 -0
- package/dest/logs/pending_tagged_log.js +4 -0
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +1 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -27
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +0 -30
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- package/dest/world-state/world_state_revision.d.ts +1 -18
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +0 -20
- package/package.json +8 -8
- package/src/abi/abi.ts +8 -0
- package/src/abi/contract_artifact.ts +33 -28
- package/src/avm/index.ts +0 -5
- package/src/contract/contract_class.ts +3 -2
- package/src/contract/index.ts +0 -1
- package/src/interfaces/block-builder.ts +6 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -2
- package/src/interfaces/private_kernel_prover.ts +94 -1
- package/src/interfaces/server.ts +0 -1
- package/src/kernel/hints/index.ts +0 -1
- package/src/kernel/index.ts +4 -0
- package/src/kernel/private_kernel_circuit_public_inputs.ts +0 -7
- package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
- package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
- package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
- package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
- package/src/kernel/private_kernel_prover_output.ts +4 -0
- package/src/kernel/private_kernel_simulated_output.ts +0 -7
- package/src/kernel/utils/index.ts +0 -1
- package/src/logs/index.ts +2 -0
- package/src/logs/message_context.ts +18 -0
- package/src/logs/pending_tagged_log.ts +12 -0
- package/src/noir/index.ts +2 -1
- package/src/p2p/index.ts +0 -1
- package/src/stats/stats.ts +4 -0
- package/src/tests/factories.ts +0 -38
- package/src/tx/index.ts +0 -1
- package/src/tx/profiling.ts +2 -0
- package/src/world-state/world_state_revision.ts +0 -33
- package/dest/avm/contract_storage_read.d.ts +0 -58
- package/dest/avm/contract_storage_read.d.ts.map +0 -1
- package/dest/avm/contract_storage_read.js +0 -65
- package/dest/avm/contract_storage_update_request.d.ts +0 -65
- package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
- package/dest/avm/contract_storage_update_request.js +0 -80
- package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
- package/dest/avm/public_call_stack_item_compressed.js +0 -70
- package/dest/avm/public_data_update_request.d.ts +0 -62
- package/dest/avm/public_data_update_request.d.ts.map +0 -1
- package/dest/avm/public_data_update_request.js +0 -67
- package/dest/avm/public_inner_call_request.d.ts +0 -50
- package/dest/avm/public_inner_call_request.d.ts.map +0 -1
- package/dest/avm/public_inner_call_request.js +0 -74
- package/dest/contract/deployment_info.d.ts +0 -24
- package/dest/contract/deployment_info.d.ts.map +0 -1
- package/dest/contract/deployment_info.js +0 -3
- package/dest/interfaces/prover-coordination.d.ts +0 -15
- package/dest/interfaces/prover-coordination.d.ts.map +0 -1
- package/dest/interfaces/prover-coordination.js +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
- package/dest/kernel/utils/optional_number.d.ts +0 -31
- package/dest/kernel/utils/optional_number.d.ts.map +0 -1
- package/dest/kernel/utils/optional_number.js +0 -42
- package/dest/p2p/interface.d.ts +0 -5
- package/dest/p2p/interface.d.ts.map +0 -1
- package/dest/p2p/interface.js +0 -1
- package/dest/tx/validator/empty_validator.d.ts +0 -5
- package/dest/tx/validator/empty_validator.d.ts.map +0 -1
- package/dest/tx/validator/empty_validator.js +0 -7
- package/src/avm/contract_storage_read.ts +0 -77
- package/src/avm/contract_storage_update_request.ts +0 -93
- package/src/avm/public_call_stack_item_compressed.ts +0 -113
- package/src/avm/public_data_update_request.ts +0 -106
- package/src/avm/public_inner_call_request.ts +0 -85
- package/src/contract/deployment_info.ts +0 -25
- package/src/interfaces/prover-coordination.ts +0 -17
- package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
- package/src/kernel/utils/optional_number.ts +0 -50
- package/src/p2p/interface.ts +0 -4
- package/src/tx/validator/empty_validator.ts +0 -7
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var _computedKey;
|
|
2
|
-
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
3
|
-
import { inspect } from 'util';
|
|
4
|
-
import { PublicCallStackItemCompressed } from './public_call_stack_item_compressed.js';
|
|
5
|
-
_computedKey = inspect.custom;
|
|
6
|
-
// TO BE REMOVED
|
|
7
|
-
/**
|
|
8
|
-
* Represents a request to call a public function.
|
|
9
|
-
*/ export class PublicInnerCallRequest {
|
|
10
|
-
item;
|
|
11
|
-
counter;
|
|
12
|
-
constructor(item, /**
|
|
13
|
-
* The counter for this call request.
|
|
14
|
-
*/ counter){
|
|
15
|
-
this.item = item;
|
|
16
|
-
this.counter = counter;
|
|
17
|
-
}
|
|
18
|
-
getSize() {
|
|
19
|
-
return this.isEmpty() ? 0 : this.toBuffer().length;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Serialize this as a buffer.
|
|
23
|
-
* @returns The buffer.
|
|
24
|
-
*/ toBuffer() {
|
|
25
|
-
return serializeToBuffer(this.item, this.counter);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Deserialize this from a buffer.
|
|
29
|
-
* @param buffer - The bufferable type from which to deserialize.
|
|
30
|
-
* @returns The deserialized instance of PublicInnerCallRequest.
|
|
31
|
-
*/ static fromBuffer(buffer) {
|
|
32
|
-
const reader = BufferReader.asReader(buffer);
|
|
33
|
-
return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromBuffer(reader), reader.readNumber());
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create PublicInnerCallRequest from a fields dictionary.
|
|
37
|
-
* @param fields - The dictionary.
|
|
38
|
-
* @returns A PublicInnerCallRequest object.
|
|
39
|
-
*/ static from(fields) {
|
|
40
|
-
return new PublicInnerCallRequest(...PublicInnerCallRequest.getFields(fields));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Serialize into a field array. Low-level utility.
|
|
44
|
-
* @param fields - Object with fields.
|
|
45
|
-
* @returns The array.
|
|
46
|
-
*/ static getFields(fields) {
|
|
47
|
-
return [
|
|
48
|
-
fields.item,
|
|
49
|
-
fields.counter
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
toFields() {
|
|
53
|
-
return serializeToFields([
|
|
54
|
-
this.item,
|
|
55
|
-
this.counter
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
static fromFields(fields) {
|
|
59
|
-
const reader = FieldReader.asReader(fields);
|
|
60
|
-
return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromFields(reader), reader.readU32());
|
|
61
|
-
}
|
|
62
|
-
static empty() {
|
|
63
|
-
return new PublicInnerCallRequest(PublicCallStackItemCompressed.empty(), 0);
|
|
64
|
-
}
|
|
65
|
-
isEmpty() {
|
|
66
|
-
return this.item.isEmpty() && this.counter == 0;
|
|
67
|
-
}
|
|
68
|
-
[_computedKey]() {
|
|
69
|
-
return `PublicInnerCallRequest {
|
|
70
|
-
item: ${this.item.toFields()}
|
|
71
|
-
counter: ${this.counter}
|
|
72
|
-
}`;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { CompleteAddress } from './complete_address.js';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the data generated as part of contract deployment.
|
|
5
|
-
*/
|
|
6
|
-
export type DeploymentInfo = {
|
|
7
|
-
/**
|
|
8
|
-
* The complete address of the deployed contract.
|
|
9
|
-
*/
|
|
10
|
-
completeAddress: CompleteAddress;
|
|
11
|
-
/**
|
|
12
|
-
* The contract's constructor verification key hash.
|
|
13
|
-
*/
|
|
14
|
-
constructorVkHash: Fr;
|
|
15
|
-
/**
|
|
16
|
-
* The contract's constructor hash.
|
|
17
|
-
*/
|
|
18
|
-
constructorHash: Fr;
|
|
19
|
-
/**
|
|
20
|
-
* The root of the contract's function tree.
|
|
21
|
-
*/
|
|
22
|
-
functionTreeRoot: Fr;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95bWVudF9pbmZvLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3QvZGVwbG95bWVudF9pbmZvLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXpELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTdEOztHQUVHO0FBQ0gsTUFBTSxNQUFNLGNBQWMsR0FBRztJQUMzQjs7T0FFRztJQUNILGVBQWUsRUFBRSxlQUFlLENBQUM7SUFDakM7O09BRUc7SUFDSCxpQkFBaUIsRUFBRSxFQUFFLENBQUM7SUFDdEI7O09BRUc7SUFDSCxlQUFlLEVBQUUsRUFBRSxDQUFDO0lBQ3BCOztPQUVHO0lBQ0gsZ0JBQWdCLEVBQUUsRUFBRSxDQUFDO0NBQ3RCLENBQUMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployment_info.d.ts","sourceRoot":"","sources":["../../src/contract/deployment_info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;IACjC;;OAEG;IACH,iBAAiB,EAAE,EAAE,CAAC;IACtB;;OAEG;IACH,eAAe,EAAE,EAAE,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,EAAE,CAAC;CACtB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Tx } from '../tx/tx.js';
|
|
2
|
-
import { TxHash } from '../tx/tx_hash.js';
|
|
3
|
-
import type { P2PClient } from './p2p.js';
|
|
4
|
-
/** Provides basic operations for ProverNodes to interact with other nodes in the network. */
|
|
5
|
-
export interface ProverCoordination {
|
|
6
|
-
/**
|
|
7
|
-
* Returns a set of transactions given their hashes if available.
|
|
8
|
-
* @param txHashes - The hashes of the transactions, used as an ID.
|
|
9
|
-
* @returns The transactions found, no necessarily in the same order as the hashes.
|
|
10
|
-
*/
|
|
11
|
-
getTxsByHash(txHashes: TxHash[]): Promise<Tx[]>;
|
|
12
|
-
gatherTxs(txHashes: TxHash[]): Promise<void>;
|
|
13
|
-
getP2PClient(): P2PClient | undefined;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmVyLWNvb3JkaW5hdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludGVyZmFjZXMvcHJvdmVyLWNvb3JkaW5hdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ2pDLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUMxQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFFMUMsNkZBQTZGO0FBQzdGLE1BQU0sV0FBVyxrQkFBa0I7SUFDakM7Ozs7T0FJRztJQUNILFlBQVksQ0FBQyxRQUFRLEVBQUUsTUFBTSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFFaEQsU0FBUyxDQUFDLFFBQVEsRUFBRSxNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFN0MsWUFBWSxJQUFJLFNBQVMsR0FBRyxTQUFTLENBQUM7Q0FDdkMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prover-coordination.d.ts","sourceRoot":"","sources":["../../src/interfaces/prover-coordination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C,YAAY,IAAI,SAAS,GAAG,SAAS,CAAC;CACvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/** Provides basic operations for ProverNodes to interact with other nodes in the network. */ export { };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
export declare class TreeLeafReadRequest {
|
|
4
|
-
value: Fr;
|
|
5
|
-
leafIndex: Fr;
|
|
6
|
-
constructor(value: Fr, leafIndex: Fr);
|
|
7
|
-
toBuffer(): Buffer;
|
|
8
|
-
static fromBuffer(buffer: Buffer | BufferReader): TreeLeafReadRequest;
|
|
9
|
-
toFields(): Fr[];
|
|
10
|
-
static fromFields(fields: Fr[] | FieldReader): TreeLeafReadRequest;
|
|
11
|
-
isEmpty(): boolean;
|
|
12
|
-
static empty(): TreeLeafReadRequest;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9sZWFmX3JlYWRfcmVxdWVzdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2tlcm5lbC9oaW50cy90cmVlX2xlYWZfcmVhZF9yZXF1ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsWUFBWSxFQUFFLFdBQVcsRUFBcUIsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRixxQkFBYSxtQkFBbUI7SUFFckIsS0FBSyxFQUFFLEVBQUU7SUFDVCxTQUFTLEVBQUUsRUFBRTtJQUZ0QixZQUNTLEtBQUssRUFBRSxFQUFFLEVBQ1QsU0FBUyxFQUFFLEVBQUUsRUFDbEI7SUFFSixRQUFRLElBQUksTUFBTSxDQUVqQjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxZQUFZLHVCQUc5QztJQUVELFFBQVEsSUFBSSxFQUFFLEVBQUUsQ0FFZjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLEVBQUUsRUFBRSxHQUFHLFdBQVcsdUJBRzNDO0lBRUQsT0FBTyxZQUVOO0lBRUQsTUFBTSxDQUFDLEtBQUssd0JBRVg7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree_leaf_read_request.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/tree_leaf_read_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,qBAAa,mBAAmB;IAErB,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IAFtB,YACS,KAAK,EAAE,EAAE,EACT,SAAS,EAAE,EAAE,EAClB;IAEJ,QAAQ,IAAI,MAAM,CAEjB;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,uBAG9C;IAED,QAAQ,IAAI,EAAE,EAAE,CAEf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,uBAG3C;IAED,OAAO,YAEN;IAED,MAAM,CAAC,KAAK,wBAEX;CACF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
export class TreeLeafReadRequest {
|
|
4
|
-
value;
|
|
5
|
-
leafIndex;
|
|
6
|
-
constructor(value, leafIndex){
|
|
7
|
-
this.value = value;
|
|
8
|
-
this.leafIndex = leafIndex;
|
|
9
|
-
}
|
|
10
|
-
toBuffer() {
|
|
11
|
-
return serializeToBuffer(this.value, this.leafIndex);
|
|
12
|
-
}
|
|
13
|
-
static fromBuffer(buffer) {
|
|
14
|
-
const reader = BufferReader.asReader(buffer);
|
|
15
|
-
return new TreeLeafReadRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
|
|
16
|
-
}
|
|
17
|
-
toFields() {
|
|
18
|
-
return [
|
|
19
|
-
this.value,
|
|
20
|
-
this.leafIndex
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
static fromFields(fields) {
|
|
24
|
-
const reader = FieldReader.asReader(fields);
|
|
25
|
-
return new TreeLeafReadRequest(reader.readField(), reader.readField());
|
|
26
|
-
}
|
|
27
|
-
isEmpty() {
|
|
28
|
-
return this.value.isZero() && this.leafIndex.isZero();
|
|
29
|
-
}
|
|
30
|
-
static empty() {
|
|
31
|
-
return new TreeLeafReadRequest(Fr.zero(), Fr.zero());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
-
export declare class OptionalNumber {
|
|
5
|
-
/**
|
|
6
|
-
* Whether a value was set.
|
|
7
|
-
*/
|
|
8
|
-
isSome: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* The actual number, if isSome is true.
|
|
11
|
-
*/
|
|
12
|
-
value: number;
|
|
13
|
-
constructor(
|
|
14
|
-
/**
|
|
15
|
-
* Whether a value was set.
|
|
16
|
-
*/
|
|
17
|
-
isSome: boolean,
|
|
18
|
-
/**
|
|
19
|
-
* The actual number, if isSome is true.
|
|
20
|
-
*/
|
|
21
|
-
value: number);
|
|
22
|
-
getSize(): number;
|
|
23
|
-
static getFields(fields: FieldsOf<OptionalNumber>): readonly [boolean, number];
|
|
24
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
25
|
-
static fromBuffer(buffer: Buffer | BufferReader): OptionalNumber;
|
|
26
|
-
toFields(): Fr[];
|
|
27
|
-
static fromFields(fields: Fr[] | FieldReader): OptionalNumber;
|
|
28
|
-
isEmpty(): boolean;
|
|
29
|
-
static empty(): OptionalNumber;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9uYWxfbnVtYmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMva2VybmVsL3V0aWxzL29wdGlvbmFsX251bWJlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEVBQUUsWUFBWSxFQUFFLFdBQVcsRUFBd0MsTUFBTSw2QkFBNkIsQ0FBQztBQUM5RyxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUV4RCxxQkFBYSxjQUFjO0lBRXZCOztPQUVHO0lBQ0ksTUFBTSxFQUFFLE9BQU87SUFDdEI7O09BRUc7SUFDSSxLQUFLLEVBQUUsTUFBTTtJQVJ0QjtJQUNFOztPQUVHO0lBQ0ksTUFBTSxFQUFFLE9BQU87SUFDdEI7O09BRUc7SUFDSSxLQUFLLEVBQUUsTUFBTSxFQUNsQjtJQUVKLE9BQU8sV0FFTjtJQUVELE1BQU0sQ0FBQyxTQUFTLENBQUMsTUFBTSxFQUFFLFFBQVEsQ0FBQyxjQUFjLENBQUMsOEJBRWhEO0lBRUQsUUFBUSw0QkFFUDtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxZQUFZLEdBQUcsY0FBYyxDQUcvRDtJQUVELFFBQVEsSUFBSSxFQUFFLEVBQUUsQ0FFZjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLEVBQUUsRUFBRSxHQUFHLFdBQVcsR0FBRyxjQUFjLENBRzVEO0lBRUQsT0FBTyxJQUFJLE9BQU8sQ0FFakI7SUFFRCxNQUFNLENBQUMsS0FBSyxtQkFFWDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optional_number.d.ts","sourceRoot":"","sources":["../../../src/kernel/utils/optional_number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,qBAAa,cAAc;IAEvB;;OAEG;IACI,MAAM,EAAE,OAAO;IACtB;;OAEG;IACI,KAAK,EAAE,MAAM;IARtB;IACE;;OAEG;IACI,MAAM,EAAE,OAAO;IACtB;;OAEG;IACI,KAAK,EAAE,MAAM,EAClB;IAEJ,OAAO,WAEN;IAED,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,8BAEhD;IAED,QAAQ,4BAEP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc,CAG/D;IAED,QAAQ,IAAI,EAAE,EAAE,CAEf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,cAAc,CAG5D;IAED,OAAO,IAAI,OAAO,CAEjB;IAED,MAAM,CAAC,KAAK,mBAEX;CACF"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
2
|
-
export class OptionalNumber {
|
|
3
|
-
isSome;
|
|
4
|
-
value;
|
|
5
|
-
constructor(/**
|
|
6
|
-
* Whether a value was set.
|
|
7
|
-
*/ isSome, /**
|
|
8
|
-
* The actual number, if isSome is true.
|
|
9
|
-
*/ value){
|
|
10
|
-
this.isSome = isSome;
|
|
11
|
-
this.value = value;
|
|
12
|
-
}
|
|
13
|
-
getSize() {
|
|
14
|
-
return this.toBuffer().length;
|
|
15
|
-
}
|
|
16
|
-
static getFields(fields) {
|
|
17
|
-
return [
|
|
18
|
-
fields.isSome,
|
|
19
|
-
fields.value
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
toBuffer() {
|
|
23
|
-
return serializeToBuffer(...OptionalNumber.getFields(this));
|
|
24
|
-
}
|
|
25
|
-
static fromBuffer(buffer) {
|
|
26
|
-
const reader = BufferReader.asReader(buffer);
|
|
27
|
-
return new OptionalNumber(reader.readBoolean(), reader.readNumber());
|
|
28
|
-
}
|
|
29
|
-
toFields() {
|
|
30
|
-
return serializeToFields(...OptionalNumber.getFields(this));
|
|
31
|
-
}
|
|
32
|
-
static fromFields(fields) {
|
|
33
|
-
const reader = FieldReader.asReader(fields);
|
|
34
|
-
return new OptionalNumber(reader.readBoolean(), reader.readU32());
|
|
35
|
-
}
|
|
36
|
-
isEmpty() {
|
|
37
|
-
return !this.isSome && !this.value;
|
|
38
|
-
}
|
|
39
|
-
static empty() {
|
|
40
|
-
return new OptionalNumber(false, 0);
|
|
41
|
-
}
|
|
42
|
-
}
|
package/dest/p2p/interface.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export interface RawGossipMessage {
|
|
2
|
-
topic: string;
|
|
3
|
-
data: Uint8Array;
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcDJwL2ludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLEtBQUssRUFBRSxNQUFNLENBQUM7SUFDZCxJQUFJLEVBQUUsVUFBVSxDQUFDO0NBQ2xCIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/p2p/interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB"}
|
package/dest/p2p/interface.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnyTx, TxValidationResult, TxValidator } from './tx_validator.js';
|
|
2
|
-
export declare class EmptyTxValidator<T = AnyTx> implements TxValidator<T> {
|
|
3
|
-
validateTx(_tx: T): Promise<TxValidationResult>;
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1wdHlfdmFsaWRhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHgvdmFsaWRhdG9yL2VtcHR5X3ZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsV0FBVyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFaEYscUJBQWEsZ0JBQWdCLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBRSxZQUFXLFdBQVcsQ0FBQyxDQUFDLENBQUM7SUFDekQsVUFBVSxDQUFDLEdBQUcsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBRXJEO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"empty_validator.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/empty_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,gBAAgB,CAAC,CAAC,GAAG,KAAK,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;IACzD,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAErD;CACF"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { CONTRACT_STORAGE_READ_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
|
|
5
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Contract storage read operation on a specific contract.
|
|
9
|
-
*
|
|
10
|
-
* Note: Similar to `PublicDataRead` but it's from the POV of contract storage so we are not working with public data
|
|
11
|
-
* tree leaf index but storage slot index.
|
|
12
|
-
*/
|
|
13
|
-
export class ContractStorageRead {
|
|
14
|
-
constructor(
|
|
15
|
-
/**
|
|
16
|
-
* Storage slot we are reading from.
|
|
17
|
-
*/
|
|
18
|
-
public readonly storageSlot: Fr,
|
|
19
|
-
/**
|
|
20
|
-
* Value read from the storage slot.
|
|
21
|
-
*/
|
|
22
|
-
public readonly currentValue: Fr,
|
|
23
|
-
/**
|
|
24
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
25
|
-
*/
|
|
26
|
-
public readonly counter: number,
|
|
27
|
-
/**
|
|
28
|
-
* Contract address whose storage is being read.
|
|
29
|
-
*/
|
|
30
|
-
public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
|
|
31
|
-
) {}
|
|
32
|
-
|
|
33
|
-
static from(args: { storageSlot: Fr; currentValue: Fr; counter: number; contractAddress?: AztecAddress }) {
|
|
34
|
-
return new ContractStorageRead(args.storageSlot, args.currentValue, args.counter, args.contractAddress);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
toBuffer() {
|
|
38
|
-
return serializeToBuffer(this.storageSlot, this.currentValue, new Fr(this.counter));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
42
|
-
const reader = BufferReader.asReader(buffer);
|
|
43
|
-
return new ContractStorageRead(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader).toNumber());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static empty() {
|
|
47
|
-
return new ContractStorageRead(Fr.ZERO, Fr.ZERO, 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
isEmpty() {
|
|
51
|
-
return this.storageSlot.isZero() && this.currentValue.isZero() && this.counter == 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
toFriendlyJSON() {
|
|
55
|
-
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.currentValue.toFriendlyJSON()}`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
toFields(): Fr[] {
|
|
59
|
-
const fields = [this.storageSlot, this.currentValue, new Fr(this.counter)];
|
|
60
|
-
if (fields.length !== CONTRACT_STORAGE_READ_LENGTH) {
|
|
61
|
-
throw new Error(
|
|
62
|
-
`Invalid number of fields for ContractStorageRead. Expected ${CONTRACT_STORAGE_READ_LENGTH}, got ${fields.length}`,
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
return fields;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
static fromFields(fields: Fr[] | FieldReader): ContractStorageRead {
|
|
69
|
-
const reader = FieldReader.asReader(fields);
|
|
70
|
-
|
|
71
|
-
const storageSlot = reader.readField();
|
|
72
|
-
const currentValue = reader.readField();
|
|
73
|
-
const counter = reader.readField().toNumber();
|
|
74
|
-
|
|
75
|
-
return new ContractStorageRead(storageSlot, currentValue, counter);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
-
|
|
6
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Contract storage update request for a slot on a specific contract.
|
|
10
|
-
*
|
|
11
|
-
* Note: Similar to `PublicDataUpdateRequest` but it's from the POV of contract storage so we are not working with
|
|
12
|
-
* public data tree leaf index but storage slot index.
|
|
13
|
-
*/
|
|
14
|
-
export class ContractStorageUpdateRequest {
|
|
15
|
-
constructor(
|
|
16
|
-
/**
|
|
17
|
-
* Storage slot we are updating.
|
|
18
|
-
*/
|
|
19
|
-
public readonly storageSlot: Fr,
|
|
20
|
-
/**
|
|
21
|
-
* New value of the storage slot.
|
|
22
|
-
*/
|
|
23
|
-
public readonly newValue: Fr,
|
|
24
|
-
/**
|
|
25
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
26
|
-
*/
|
|
27
|
-
public readonly counter: number,
|
|
28
|
-
/**
|
|
29
|
-
* Contract address whose storage is being read.
|
|
30
|
-
*/
|
|
31
|
-
public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
|
|
32
|
-
) {}
|
|
33
|
-
|
|
34
|
-
toBuffer() {
|
|
35
|
-
return serializeToBuffer(this.storageSlot, this.newValue, this.counter);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
39
|
-
const reader = BufferReader.asReader(buffer);
|
|
40
|
-
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Create ContractStorageUpdateRequest from a fields dictionary.
|
|
45
|
-
* @param fields - The dictionary.
|
|
46
|
-
* @returns A ContractStorageUpdateRequest object.
|
|
47
|
-
*/
|
|
48
|
-
static from(fields: FieldsOf<ContractStorageUpdateRequest>): ContractStorageUpdateRequest {
|
|
49
|
-
return new ContractStorageUpdateRequest(...ContractStorageUpdateRequest.getFields(fields));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Serialize into a field array. Low-level utility.
|
|
54
|
-
* @param fields - Object with fields.
|
|
55
|
-
* @returns The array.
|
|
56
|
-
*/
|
|
57
|
-
static getFields(fields: FieldsOf<ContractStorageUpdateRequest>) {
|
|
58
|
-
return [fields.storageSlot, fields.newValue, fields.counter, fields.contractAddress] as const;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static empty() {
|
|
62
|
-
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
isEmpty() {
|
|
66
|
-
return this.storageSlot.isZero() && this.newValue.isZero();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
toFriendlyJSON() {
|
|
70
|
-
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, sideEffectCounter=${
|
|
71
|
-
this.counter
|
|
72
|
-
}`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
toFields(): Fr[] {
|
|
76
|
-
const fields = [this.storageSlot, this.newValue, new Fr(this.counter)];
|
|
77
|
-
if (fields.length !== CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Invalid number of fields for ContractStorageUpdateRequest. Expected ${CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH}, got ${fields.length}`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
return fields;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static fromFields(fields: Fr[] | FieldReader): ContractStorageUpdateRequest {
|
|
86
|
-
const reader = FieldReader.asReader(fields);
|
|
87
|
-
|
|
88
|
-
const storageSlot = reader.readField();
|
|
89
|
-
const newValue = reader.readField();
|
|
90
|
-
|
|
91
|
-
return new ContractStorageUpdateRequest(storageSlot, newValue, reader.readU32());
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
-
|
|
6
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
-
import { Gas } from '../gas/gas.js';
|
|
8
|
-
import { CallContext } from '../tx/call_context.js';
|
|
9
|
-
import { RevertCode } from './revert_code.js';
|
|
10
|
-
|
|
11
|
-
// TO BE REMOVED
|
|
12
|
-
/**
|
|
13
|
-
* Compressed call stack item on a public call.
|
|
14
|
-
*/
|
|
15
|
-
export class PublicCallStackItemCompressed {
|
|
16
|
-
constructor(
|
|
17
|
-
public contractAddress: AztecAddress,
|
|
18
|
-
public callContext: CallContext,
|
|
19
|
-
public argsHash: Fr,
|
|
20
|
-
public returnsHash: Fr,
|
|
21
|
-
public revertCode: RevertCode,
|
|
22
|
-
/** How much gas was available for execution. */
|
|
23
|
-
public startGasLeft: Gas,
|
|
24
|
-
/** How much gas was left after execution. */
|
|
25
|
-
public endGasLeft: Gas,
|
|
26
|
-
) {}
|
|
27
|
-
|
|
28
|
-
static getFields(fields: FieldsOf<PublicCallStackItemCompressed>) {
|
|
29
|
-
return [
|
|
30
|
-
fields.contractAddress,
|
|
31
|
-
fields.callContext,
|
|
32
|
-
fields.argsHash,
|
|
33
|
-
fields.returnsHash,
|
|
34
|
-
fields.revertCode,
|
|
35
|
-
fields.startGasLeft,
|
|
36
|
-
fields.endGasLeft,
|
|
37
|
-
] as const;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
toFields(): Fr[] {
|
|
41
|
-
const fields = serializeToFields(...PublicCallStackItemCompressed.getFields(this));
|
|
42
|
-
if (fields.length !== PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Invalid number of fields for PublicCallStackItemCompressed. Expected ${PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH}, got ${fields.length}`,
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return fields;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
toBuffer() {
|
|
51
|
-
return serializeToBuffer(...PublicCallStackItemCompressed.getFields(this));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Deserializes from a buffer or reader.
|
|
56
|
-
* @param buffer - Buffer or reader to read from.
|
|
57
|
-
* @returns The deserialized instance.
|
|
58
|
-
*/
|
|
59
|
-
static fromBuffer(buffer: Buffer | BufferReader): PublicCallStackItemCompressed {
|
|
60
|
-
const reader = BufferReader.asReader(buffer);
|
|
61
|
-
return new PublicCallStackItemCompressed(
|
|
62
|
-
reader.readObject(AztecAddress),
|
|
63
|
-
reader.readObject(CallContext),
|
|
64
|
-
reader.readObject(Fr),
|
|
65
|
-
reader.readObject(Fr),
|
|
66
|
-
reader.readObject(RevertCode),
|
|
67
|
-
reader.readObject(Gas),
|
|
68
|
-
reader.readObject(Gas),
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
static fromFields(fields: Fr[] | FieldReader): PublicCallStackItemCompressed {
|
|
73
|
-
const reader = FieldReader.asReader(fields);
|
|
74
|
-
|
|
75
|
-
return new PublicCallStackItemCompressed(
|
|
76
|
-
AztecAddress.fromFields(reader),
|
|
77
|
-
CallContext.fromFields(reader),
|
|
78
|
-
reader.readField(),
|
|
79
|
-
reader.readField(),
|
|
80
|
-
RevertCode.fromFields(reader),
|
|
81
|
-
Gas.fromFields(reader),
|
|
82
|
-
Gas.fromFields(reader),
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Returns a new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
88
|
-
* @returns A new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
89
|
-
*/
|
|
90
|
-
public static empty(): PublicCallStackItemCompressed {
|
|
91
|
-
return new PublicCallStackItemCompressed(
|
|
92
|
-
AztecAddress.ZERO,
|
|
93
|
-
CallContext.empty(),
|
|
94
|
-
Fr.ZERO,
|
|
95
|
-
Fr.ZERO,
|
|
96
|
-
RevertCode.OK,
|
|
97
|
-
Gas.empty(),
|
|
98
|
-
Gas.empty(),
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
isEmpty() {
|
|
103
|
-
return (
|
|
104
|
-
this.contractAddress.isZero() &&
|
|
105
|
-
this.callContext.isEmpty() &&
|
|
106
|
-
this.argsHash.isEmpty() &&
|
|
107
|
-
this.returnsHash.isEmpty() &&
|
|
108
|
-
this.revertCode.equals(RevertCode.OK) &&
|
|
109
|
-
this.startGasLeft.isEmpty() &&
|
|
110
|
-
this.endGasLeft.isEmpty()
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|