@aztec-labs/stdlib 6.0.0-rc.2 → 6.0.0-rc.4
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 +2 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +1 -0
- package/dest/abi/authorization_selector.d.ts +2 -1
- package/dest/abi/authorization_selector.d.ts.map +1 -1
- package/dest/abi/authorization_selector.js +1 -0
- package/dest/abi/buffer.d.ts +2 -1
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +1 -0
- package/dest/abi/contract_artifact.d.ts +2 -1
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +1 -0
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +1 -0
- package/dest/abi/event_selector.d.ts +2 -1
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/event_selector.js +1 -0
- package/dest/abi/function_selector.d.ts +2 -1
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +1 -0
- package/dest/abi/note_selector.d.ts +2 -1
- package/dest/abi/note_selector.d.ts.map +1 -1
- package/dest/abi/note_selector.js +1 -0
- package/dest/abi/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- package/dest/abi/utils.d.ts +2 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +1 -0
- package/dest/avm/avm.d.ts +212 -211
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +1 -0
- package/dest/avm/avm_accumulated_data.d.ts +2 -2
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +2 -2
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +1 -1
- package/dest/avm/message_pack.js +1 -1
- package/dest/avm/revert_code.d.ts +3 -2
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +2 -1
- package/dest/aztec-address/index.d.ts +3 -2
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +2 -1
- package/dest/block/block_hash.d.ts +2 -2
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +1 -1
- package/dest/block/body.d.ts +2 -2
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +1 -1
- package/dest/block/l2_block_source.d.ts +19 -3
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.d.ts +2 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +1 -0
- package/dest/block/proposal/committee_attestation.d.ts +2 -1
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
- package/dest/block/proposal/committee_attestation.js +1 -0
- package/dest/checkpoint/checkpoint_data.d.ts +11 -3
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +3 -2
- package/dest/config/network-consensus-config.d.ts +1 -1
- package/dest/config/network-consensus-config.d.ts.map +1 -1
- package/dest/config/network-consensus-config.js +3 -2
- package/dest/contract/artifact_hash.d.ts +2 -1
- package/dest/contract/artifact_hash.d.ts.map +1 -1
- package/dest/contract/artifact_hash.js +1 -0
- package/dest/contract/complete_address.d.ts +2 -1
- package/dest/contract/complete_address.d.ts.map +1 -1
- package/dest/contract/complete_address.js +1 -0
- package/dest/contract/contract_address.d.ts +1 -1
- package/dest/contract/contract_address.js +1 -1
- 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 +1 -0
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/interfaces/contract_class.d.ts +2 -1
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -0
- package/dest/database-version/database_version.d.ts +2 -1
- package/dest/database-version/database_version.d.ts.map +1 -1
- package/dest/database-version/database_version.js +1 -0
- package/dest/fees/transaction_fee.js +1 -1
- package/dest/file-store/http.d.ts +2 -1
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +1 -0
- package/dest/file-store/memory.d.ts +2 -1
- package/dest/file-store/memory.d.ts.map +1 -1
- package/dest/file-store/memory.js +1 -0
- package/dest/file-store/s3.d.ts +2 -1
- package/dest/file-store/s3.d.ts.map +1 -1
- package/dest/file-store/s3.js +3 -1
- package/dest/gas/fee_math.d.ts +2 -2
- package/dest/gas/fee_math.js +2 -2
- package/dest/gas/gas.d.ts +2 -2
- package/dest/gas/gas.d.ts.map +1 -1
- package/dest/gas/gas.js +1 -1
- package/dest/gas/gas_fees.d.ts +2 -2
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +1 -1
- package/dest/ha-signing/config.d.ts +4 -2
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +5 -3
- package/dest/ha-signing/index.d.ts +2 -2
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +1 -1
- package/dest/interfaces/aztec-node-admin.d.ts +9 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -1
- package/dest/interfaces/configs.d.ts +7 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/kernel/claimed_length_array.d.ts +2 -2
- package/dest/kernel/claimed_length_array.d.ts.map +1 -1
- package/dest/kernel/claimed_length_array.js +1 -1
- package/dest/kernel/hints/transient_data_squashing_hint.d.ts +2 -2
- package/dest/kernel/hints/transient_data_squashing_hint.d.ts.map +1 -1
- package/dest/kernel/hints/transient_data_squashing_hint.js +1 -1
- package/dest/kernel/log_hash.d.ts +2 -2
- package/dest/kernel/log_hash.d.ts.map +1 -1
- package/dest/kernel/log_hash.js +1 -1
- package/dest/kernel/private_log_data.d.ts +2 -2
- package/dest/kernel/private_log_data.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +1 -1
- package/dest/kernel/private_to_avm_accumulated_data.d.ts +2 -2
- package/dest/kernel/private_to_avm_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_avm_accumulated_data.js +1 -1
- package/dest/kernel/private_to_public_accumulated_data.d.ts +2 -2
- package/dest/kernel/private_to_public_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_public_accumulated_data.js +1 -1
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts +2 -2
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +1 -1
- package/dest/kernel/private_validation_requests.d.ts +2 -2
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +1 -1
- package/dest/kernel/public_call_request.d.ts +2 -2
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +1 -1
- package/dest/keys/derivation.js +2 -2
- package/dest/keys/public_keys.d.ts +2 -1
- package/dest/keys/public_keys.d.ts.map +1 -1
- package/dest/keys/public_keys.js +1 -0
- package/dest/logs/contract_class_log.d.ts +2 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +1 -1
- package/dest/logs/log_cursor.d.ts +2 -1
- package/dest/logs/log_cursor.d.ts.map +1 -1
- package/dest/logs/log_cursor.js +1 -0
- package/dest/logs/private_log.d.ts +2 -2
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +1 -1
- package/dest/logs/public_log.d.ts +2 -2
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +1 -1
- package/dest/messaging/l1_to_l2_message.d.ts +21 -1
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +31 -8
- package/dest/messaging/l2_to_l1_membership.d.ts +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +1 -0
- package/dest/messaging/out_hash.d.ts +1 -1
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +1 -0
- package/dest/note/note_dao.d.ts +2 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -0
- package/dest/proofs/chonk_proof.d.ts +2 -1
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +1 -0
- package/dest/proofs/proof.d.ts +2 -1
- package/dest/proofs/proof.d.ts.map +1 -1
- package/dest/proofs/proof.js +2 -1
- package/dest/rollup/block_headers_hash.d.ts +1 -1
- package/dest/rollup/block_headers_hash.d.ts.map +1 -1
- package/dest/rollup/block_headers_hash.js +1 -0
- package/dest/rollup/checkpoint_constant_data.d.ts +2 -2
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +1 -1
- package/dest/rollup/checkpoint_header.d.ts +2 -2
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +1 -0
- package/dest/slashing/votes.d.ts +2 -1
- package/dest/slashing/votes.d.ts.map +1 -1
- package/dest/slashing/votes.js +1 -0
- package/dest/snapshots/download.d.ts +2 -2
- package/dest/snapshots/download.d.ts.map +1 -1
- package/dest/snapshots/download.js +8 -2
- package/dest/snapshots/index.d.ts +2 -2
- package/dest/snapshots/index.d.ts.map +1 -1
- package/dest/snapshots/index.js +1 -1
- package/dest/snapshots/upload.d.ts +1 -1
- package/dest/snapshots/upload.d.ts.map +1 -1
- package/dest/snapshots/upload.js +1 -0
- package/dest/tests/factories.d.ts +2 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +1 -0
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +1 -0
- package/dest/trees/append_only_tree_snapshot.d.ts +2 -2
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +1 -1
- package/dest/trees/nullifier_leaf.d.ts +2 -1
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_leaf.js +1 -0
- package/dest/trees/public_data_leaf.d.ts +2 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +1 -0
- package/dest/tx/block_header.d.ts +2 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +1 -1
- package/dest/tx/call_context.d.ts +2 -2
- package/dest/tx/call_context.d.ts.map +1 -1
- package/dest/tx/call_context.js +1 -1
- package/dest/tx/global_variables.d.ts +2 -2
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +1 -1
- package/dest/tx/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +1 -0
- package/dest/tx/public_call_request_with_calldata.d.ts +2 -2
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
- package/dest/tx/public_call_request_with_calldata.js +1 -1
- package/dest/tx/state_reference.d.ts +2 -2
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/state_reference.js +1 -1
- package/dest/tx/tree_snapshots.d.ts +2 -2
- package/dest/tx/tree_snapshots.d.ts.map +1 -1
- package/dest/tx/tree_snapshots.js +1 -1
- package/dest/tx/tx.d.ts +7 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +8 -1
- package/dest/tx/tx_effect.d.ts +2 -2
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +1 -1
- package/dest/tx/tx_execution_request.d.ts +2 -2
- package/dest/tx/tx_execution_request.d.ts.map +1 -1
- package/dest/tx/tx_execution_request.js +1 -1
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +13 -0
- package/dest/vks/verification_key.d.ts +2 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +1 -0
- package/dest/zkpassport/index.d.ts +2 -1
- package/dest/zkpassport/index.d.ts.map +1 -1
- package/dest/zkpassport/index.js +1 -0
- package/package.json +10 -9
- package/src/abi/abi.ts +1 -0
- package/src/abi/authorization_selector.ts +1 -0
- package/src/abi/buffer.ts +1 -0
- package/src/abi/contract_artifact.ts +1 -0
- package/src/abi/encoder.ts +1 -0
- package/src/abi/event_selector.ts +1 -0
- package/src/abi/function_selector.ts +1 -0
- package/src/abi/note_selector.ts +1 -0
- package/src/abi/selector.ts +1 -1
- package/src/abi/utils.ts +2 -0
- package/src/avm/avm.ts +1 -0
- package/src/avm/avm_accumulated_data.ts +1 -1
- package/src/avm/avm_circuit_public_inputs.ts +1 -1
- package/src/avm/message_pack.ts +1 -1
- package/src/avm/revert_code.ts +2 -1
- package/src/aztec-address/index.ts +2 -1
- package/src/block/block_hash.ts +1 -1
- package/src/block/body.ts +1 -1
- package/src/block/l2_block_source.ts +19 -2
- package/src/block/proposal/attestations_and_signers.ts +1 -0
- package/src/block/proposal/committee_attestation.ts +1 -0
- package/src/checkpoint/checkpoint_data.ts +9 -1
- package/src/config/network-consensus-config.ts +3 -2
- package/src/contract/artifact_hash.ts +1 -0
- package/src/contract/complete_address.ts +1 -0
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class.ts +1 -0
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/interfaces/contract_class.ts +1 -0
- package/src/database-version/database_version.ts +1 -0
- package/src/fees/transaction_fee.ts +1 -1
- package/src/file-store/http.ts +1 -0
- package/src/file-store/memory.ts +1 -0
- package/src/file-store/s3.ts +3 -1
- package/src/gas/README.md +2 -2
- package/src/gas/fee_math.ts +2 -2
- package/src/gas/gas.ts +1 -1
- package/src/gas/gas_fees.ts +1 -1
- package/src/ha-signing/config.ts +8 -4
- package/src/ha-signing/index.ts +1 -0
- package/src/interfaces/aztec-node-admin.ts +8 -0
- package/src/interfaces/configs.ts +6 -0
- package/src/kernel/claimed_length_array.ts +1 -1
- package/src/kernel/hints/transient_data_squashing_hint.ts +1 -1
- package/src/kernel/log_hash.ts +1 -1
- package/src/kernel/private_log_data.ts +1 -1
- package/src/kernel/private_to_avm_accumulated_data.ts +1 -1
- package/src/kernel/private_to_public_accumulated_data.ts +1 -1
- package/src/kernel/private_to_rollup_accumulated_data.ts +1 -1
- package/src/kernel/private_validation_requests.ts +1 -1
- package/src/kernel/public_call_request.ts +1 -1
- package/src/keys/derivation.ts +2 -2
- package/src/keys/public_keys.ts +1 -0
- package/src/logs/contract_class_log.ts +1 -1
- package/src/logs/log_cursor.ts +1 -0
- package/src/logs/private_log.ts +1 -1
- package/src/logs/public_log.ts +1 -1
- package/src/messaging/l1_to_l2_message.ts +40 -11
- package/src/messaging/l2_to_l1_membership.ts +1 -0
- package/src/messaging/out_hash.ts +1 -0
- package/src/note/note_dao.ts +1 -0
- package/src/proofs/chonk_proof.ts +1 -0
- package/src/proofs/proof.ts +2 -1
- package/src/rollup/block_headers_hash.ts +1 -0
- package/src/rollup/checkpoint_constant_data.ts +1 -1
- package/src/rollup/checkpoint_header.ts +1 -1
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +1 -0
- package/src/slashing/votes.ts +1 -0
- package/src/snapshots/download.ts +28 -19
- package/src/snapshots/index.ts +7 -1
- package/src/snapshots/upload.ts +1 -0
- package/src/tests/factories.ts +1 -0
- package/src/tests/mocks.ts +1 -0
- package/src/trees/append_only_tree_snapshot.ts +1 -1
- package/src/trees/nullifier_leaf.ts +1 -0
- package/src/trees/public_data_leaf.ts +1 -0
- package/src/tx/block_header.ts +1 -1
- package/src/tx/call_context.ts +1 -1
- package/src/tx/global_variables.ts +1 -1
- package/src/tx/profiling.ts +1 -0
- package/src/tx/public_call_request_with_calldata.ts +1 -1
- package/src/tx/state_reference.ts +1 -1
- package/src/tx/tree_snapshots.ts +1 -1
- package/src/tx/tx.ts +10 -0
- package/src/tx/tx_effect.ts +1 -1
- package/src/tx/tx_execution_request.ts +1 -1
- package/src/tx/validator/error_texts.ts +18 -0
- package/src/vks/verification_key.ts +1 -0
- package/src/zkpassport/index.ts +1 -0
|
@@ -5,6 +5,7 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
|
5
5
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
6
6
|
import { bufferToHex } from '@aztec-labs/foundation/string';
|
|
7
7
|
import { SiblingPath } from '@aztec-labs/foundation/trees';
|
|
8
|
+
import { Buffer } from 'buffer';
|
|
8
9
|
|
|
9
10
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
10
11
|
import type { BlockParameter } from '../block/block_parameter.js';
|
|
@@ -95,16 +96,24 @@ export function computeFeeJuiceMessageNullifier(messageHash: Fr, secret: Fr): Pr
|
|
|
95
96
|
return poseidon2HashWithSeparator([messageHash, secret], DomainSeparator.MESSAGE_NULLIFIER);
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
/** The outcome of {@link lookUpL1ToL2MessageWitness}. */
|
|
100
|
+
export type L1ToL2MessageWitnessLookup =
|
|
101
|
+
/** The message is in the tree and, if a nullifier was given, has not been consumed. */
|
|
102
|
+
| { type: 'found'; witness: [bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] }
|
|
103
|
+
/** The message is not in the tree. */
|
|
104
|
+
| { type: 'missing' }
|
|
105
|
+
/** A nullifier was given and the message has been consumed. */
|
|
106
|
+
| { type: 'nullified' };
|
|
107
|
+
|
|
98
108
|
/**
|
|
99
|
-
*
|
|
100
|
-
* additionally required to be un-nullified.
|
|
109
|
+
* Looks up the membership witness of an L1 to L2 message in the L1 to L2 message tree at `referenceBlock`.
|
|
101
110
|
*/
|
|
102
|
-
export async function
|
|
111
|
+
export async function lookUpL1ToL2MessageWitness(
|
|
103
112
|
node: AztecNode,
|
|
104
113
|
messageHash: Fr,
|
|
105
|
-
unsiloedNullifier
|
|
106
|
-
referenceBlock: BlockParameter
|
|
107
|
-
): Promise<
|
|
114
|
+
unsiloedNullifier: UnsiloedMessageNullifier | undefined,
|
|
115
|
+
referenceBlock: BlockParameter,
|
|
116
|
+
): Promise<L1ToL2MessageWitnessLookup> {
|
|
108
117
|
// Both requests are dispatched before awaiting so they run concurrently.
|
|
109
118
|
const l1ToL2ResponsePromise = node.getL1ToL2MessageMembershipWitness(referenceBlock, messageHash);
|
|
110
119
|
const nullifierResponsePromise = unsiloedNullifier
|
|
@@ -113,17 +122,37 @@ export async function getL1ToL2MessageWitness(
|
|
|
113
122
|
)
|
|
114
123
|
: undefined;
|
|
115
124
|
|
|
116
|
-
const l1ToL2Response = await l1ToL2ResponsePromise;
|
|
125
|
+
const [l1ToL2Response, nullifierResponse] = await Promise.all([l1ToL2ResponsePromise, nullifierResponsePromise]);
|
|
117
126
|
if (!l1ToL2Response) {
|
|
118
|
-
|
|
127
|
+
return { type: 'missing' };
|
|
119
128
|
}
|
|
120
129
|
|
|
121
|
-
const nullifierResponse = await nullifierResponsePromise;
|
|
122
130
|
if (nullifierResponse?.[0] !== undefined) {
|
|
123
|
-
|
|
131
|
+
return { type: 'nullified' };
|
|
124
132
|
}
|
|
125
133
|
|
|
126
|
-
return l1ToL2Response;
|
|
134
|
+
return { type: 'found', witness: l1ToL2Response };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Fetches the membership witness of an L1 to L2 message. When `unsiloedNullifier` is provided, the message is
|
|
139
|
+
* additionally required to be un-nullified.
|
|
140
|
+
*/
|
|
141
|
+
export async function getL1ToL2MessageWitness(
|
|
142
|
+
node: AztecNode,
|
|
143
|
+
messageHash: Fr,
|
|
144
|
+
unsiloedNullifier?: UnsiloedMessageNullifier,
|
|
145
|
+
referenceBlock: BlockParameter = 'latest',
|
|
146
|
+
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
|
|
147
|
+
const lookup = await lookUpL1ToL2MessageWitness(node, messageHash, unsiloedNullifier, referenceBlock);
|
|
148
|
+
switch (lookup.type) {
|
|
149
|
+
case 'missing':
|
|
150
|
+
throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
151
|
+
case 'nullified':
|
|
152
|
+
throw new Error(`No non-nullified L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
153
|
+
case 'found':
|
|
154
|
+
return lookup.witness;
|
|
155
|
+
}
|
|
127
156
|
}
|
|
128
157
|
|
|
129
158
|
// This functionality is not on the node because we do not want to pass the node the secret, and give the node the ability to derive a valid nullifer for an L1 to L2 message.
|
|
@@ -2,6 +2,7 @@ import { MAX_CHECKPOINTS_PER_EPOCH, OUT_HASH_TREE_LEAF_COUNT } from '@aztec-labs
|
|
|
2
2
|
import { type EpochNumber, EpochNumberSchema } from '@aztec-labs/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
4
4
|
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedShaRoot } from '@aztec-labs/foundation/trees';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
|
|
7
8
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
@@ -2,6 +2,7 @@ import { OUT_HASH_TREE_LEAF_COUNT } from '@aztec-labs/constants';
|
|
|
2
2
|
import { padArrayEnd } from '@aztec-labs/foundation/collection';
|
|
3
3
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
4
4
|
import { computeBalancedShaRoot, computeUnbalancedShaRoot, computeWonkyShaRoot } from '@aztec-labs/foundation/trees';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Computes the out hash of a tx. It's the root of the unbalanced tree of all the L2-to-L1 messages emitted by the tx.
|
package/src/note/note_dao.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serializ
|
|
|
4
4
|
import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
5
5
|
import { Note } from '@aztec-labs/stdlib/note';
|
|
6
6
|
import { TxHash } from '@aztec-labs/stdlib/tx';
|
|
7
|
+
import { Buffer } from 'buffer';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
|
|
@@ -6,6 +6,7 @@ import { randomBytes } from '@aztec-labs/foundation/crypto/random';
|
|
|
6
6
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
7
7
|
import { bufferSchemaFor } from '@aztec-labs/foundation/schemas';
|
|
8
8
|
import { BufferReader, BufferSink } from '@aztec-labs/foundation/serialize';
|
|
9
|
+
import { Buffer } from 'buffer';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Serialization format detection for ChonkProof is value-based on the leading uint32:
|
package/src/proofs/proof.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { PAIRING_POINTS_SIZE } from '@aztec-labs/constants';
|
|
|
2
2
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
4
4
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
5
|
-
import {
|
|
5
|
+
import { assert } from '@aztec-labs/foundation/validation';
|
|
6
|
+
import { Buffer } from 'buffer';
|
|
6
7
|
|
|
7
8
|
const EMPTY_PROOF_SIZE = 42;
|
|
8
9
|
|
|
@@ -2,6 +2,7 @@ import { DomainSeparator } from '@aztec-labs/constants';
|
|
|
2
2
|
import { poseidon2HashWithSeparator } from '@aztec-labs/foundation/crypto/poseidon';
|
|
3
3
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
4
4
|
import { computeUnbalancedMerkleTreeRootAsync } from '@aztec-labs/foundation/trees';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
|
|
6
7
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
7
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SlotNumber } from '@aztec-labs/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
3
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
4
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
4
5
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
5
6
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
6
|
-
import { inspect } from 'util';
|
|
7
7
|
|
|
8
8
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
9
9
|
import { GasFees } from '../gas/gas_fees.js';
|
|
@@ -3,11 +3,11 @@ import { SlotNumber } from '@aztec-labs/foundation/branded-types';
|
|
|
3
3
|
import { sha256ToField } from '@aztec-labs/foundation/crypto/sha256';
|
|
4
4
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
5
5
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
6
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
6
7
|
import type { ZodFor } from '@aztec-labs/foundation/schemas';
|
|
7
8
|
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
8
9
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
9
10
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
10
|
-
import { inspect } from 'util';
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
|
|
13
13
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -6,6 +6,7 @@ import { bufferSchemaFor } from '@aztec-labs/foundation/schemas';
|
|
|
6
6
|
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
7
7
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
8
8
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
9
|
+
import { Buffer } from 'buffer';
|
|
9
10
|
|
|
10
11
|
import { ParityPublicInputs } from '../parity/parity_public_inputs.js';
|
|
11
12
|
import { ProofData, type RollupHonkProofData, type UltraHonkProofData } from '../proofs/proof_data.js';
|
package/src/slashing/votes.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { padArrayEnd } from '@aztec-labs/foundation/collection';
|
|
|
3
3
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
4
4
|
import { type Logger, createLogger } from '@aztec-labs/foundation/log';
|
|
5
5
|
import type { PartialBy } from '@aztec-labs/foundation/types';
|
|
6
|
+
import { Buffer } from 'buffer';
|
|
6
7
|
|
|
7
8
|
import { getEpochForOffense } from './helpers.js';
|
|
8
9
|
import type { Offense, ValidatorSlashVote } from './types.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fromEntries, getEntries, maxBy } from '@aztec-labs/foundation/collection';
|
|
2
2
|
import { jsonParseWithSchema } from '@aztec-labs/foundation/json-rpc';
|
|
3
3
|
import type { ReadOnlyFileStore } from '@aztec-labs/stdlib/file-store';
|
|
4
|
+
import { Buffer } from 'buffer';
|
|
4
5
|
import { createReadStream, createWriteStream } from 'fs';
|
|
5
6
|
import fs from 'fs/promises';
|
|
6
7
|
import pathMod from 'path';
|
|
@@ -94,29 +95,37 @@ export async function downloadSnapshot(
|
|
|
94
95
|
snapshot: Pick<SnapshotMetadata, 'dataUrls'>,
|
|
95
96
|
localPaths: Record<SnapshotDataKeys, string>,
|
|
96
97
|
store: ReadOnlyFileStore,
|
|
98
|
+
keys: readonly SnapshotDataKeys[] = SnapshotDataKeys,
|
|
97
99
|
): Promise<void> {
|
|
98
|
-
await Promise.
|
|
99
|
-
getEntries(localPaths)
|
|
100
|
-
|
|
100
|
+
const results = await Promise.allSettled(
|
|
101
|
+
getEntries(localPaths)
|
|
102
|
+
.filter(([key]) => keys.includes(key))
|
|
103
|
+
.map(async ([key, path]) => {
|
|
104
|
+
await fs.mkdir(pathMod.dirname(path), { recursive: true });
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
const tmpPath = `${path}.download`;
|
|
107
|
+
try {
|
|
108
|
+
const url = snapshot.dataUrls[key];
|
|
109
|
+
await store.download(url, tmpPath);
|
|
106
110
|
|
|
107
|
-
|
|
111
|
+
const isGzip = await detectGzip(tmpPath);
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const read = createReadStream(tmpPath);
|
|
114
|
+
const write = createWriteStream(path);
|
|
115
|
+
if (isGzip) {
|
|
116
|
+
const gunzip = createGunzip();
|
|
117
|
+
await pipeline(read, gunzip, write);
|
|
118
|
+
} else {
|
|
119
|
+
await pipeline(read, write);
|
|
120
|
+
}
|
|
121
|
+
} finally {
|
|
122
|
+
await fs.unlink(tmpPath).catch(() => undefined);
|
|
116
123
|
}
|
|
117
|
-
}
|
|
118
|
-
await fs.unlink(tmpPath).catch(() => undefined);
|
|
119
|
-
}
|
|
120
|
-
}),
|
|
124
|
+
}),
|
|
121
125
|
);
|
|
126
|
+
for (const result of results) {
|
|
127
|
+
if (result.status === 'rejected') {
|
|
128
|
+
throw result.reason;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
122
131
|
}
|
package/src/snapshots/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './upload.js';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
getBasePath,
|
|
5
|
+
downloadSnapshot,
|
|
6
|
+
getSnapshotIndex,
|
|
7
|
+
getLatestSnapshotMetadata,
|
|
8
|
+
makeSnapshotPaths,
|
|
9
|
+
} from './download.js';
|
package/src/snapshots/upload.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { fromEntries, getEntries, pick } from '@aztec-labs/foundation/collection
|
|
|
2
2
|
import { jsonStringify } from '@aztec-labs/foundation/json-rpc';
|
|
3
3
|
import { isoDate } from '@aztec-labs/foundation/string';
|
|
4
4
|
import type { FileStore } from '@aztec-labs/stdlib/file-store';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
|
|
6
7
|
import { getBasePath, getSnapshotIndex, getSnapshotIndexPath } from './download.js';
|
|
7
8
|
import type { SnapshotDataKeys, SnapshotMetadata, SnapshotsIndex, UploadSnapshotMetadata } from './types.js';
|
package/src/tests/factories.ts
CHANGED
|
@@ -52,6 +52,7 @@ import { GrumpkinScalar, Point } from '@aztec-labs/foundation/curves/grumpkin';
|
|
|
52
52
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
53
53
|
import type { Bufferable, Serializable, Tuple } from '@aztec-labs/foundation/serialize';
|
|
54
54
|
import { MembershipWitness } from '@aztec-labs/foundation/trees';
|
|
55
|
+
import { Buffer } from 'buffer';
|
|
55
56
|
|
|
56
57
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
57
58
|
import {
|
package/src/tests/mocks.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { Secp256k1Signer } from '@aztec-labs/foundation/crypto/secp256k1-signer'
|
|
|
18
18
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
19
19
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
20
20
|
import { Signature } from '@aztec-labs/foundation/eth-signature';
|
|
21
|
+
import { Buffer } from 'buffer';
|
|
21
22
|
import { type TypedDataDefinition, hashTypedData } from 'viem';
|
|
22
23
|
|
|
23
24
|
import type { ContractArtifact } from '../abi/abi.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TreeLeafIndex, TreeLeafIndexSchema } from '@aztec-labs/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
3
4
|
import { schemas } from '@aztec-labs/foundation/schemas';
|
|
4
5
|
import { BufferReader, BufferSink, FieldReader } from '@aztec-labs/foundation/serialize';
|
|
5
6
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
6
|
-
import { inspect } from 'util';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -3,6 +3,7 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
|
3
3
|
import { schemas } from '@aztec-labs/foundation/schemas';
|
|
4
4
|
import { BufferReader } from '@aztec-labs/foundation/serialize';
|
|
5
5
|
import type { IndexedTreeLeaf, IndexedTreeLeafPreimage } from '@aztec-labs/foundation/trees';
|
|
6
|
+
import { Buffer } from 'buffer';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -4,6 +4,7 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
|
4
4
|
import { schemas } from '@aztec-labs/foundation/schemas';
|
|
5
5
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
6
6
|
import type { IndexedTreeLeaf, IndexedTreeLeafPreimage } from '@aztec-labs/foundation/trees';
|
|
7
|
+
import { Buffer } from 'buffer';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
|
|
9
10
|
/**
|
package/src/tx/block_header.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BlockNumber, SlotNumber } from '@aztec-labs/foundation/branded-types';
|
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec-labs/foundation/crypto/poseidon';
|
|
4
4
|
import { randomInt } from '@aztec-labs/foundation/crypto/random';
|
|
5
5
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
6
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
6
7
|
import { type ZodFor, schemas } from '@aztec-labs/foundation/schemas';
|
|
7
8
|
import {
|
|
8
9
|
BufferReader,
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
} from '@aztec-labs/foundation/serialize';
|
|
14
15
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
15
16
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
16
|
-
import { inspect } from 'util';
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
|
|
19
19
|
import { BlockHash } from '../block/block_hash.js';
|
package/src/tx/call_context.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CALL_CONTEXT_LENGTH } from '@aztec-labs/constants';
|
|
2
2
|
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
3
4
|
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec-labs/foundation/serialize';
|
|
4
5
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
5
|
-
import { inspect } from 'util';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
import { FunctionSelector } from '../abi/index.js';
|
|
@@ -3,6 +3,7 @@ import { BlockNumber, BlockNumberSchema, SlotNumber } from '@aztec-labs/foundati
|
|
|
3
3
|
import { randomInt } from '@aztec-labs/foundation/crypto/random';
|
|
4
4
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
5
5
|
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
6
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
6
7
|
import { jsonStringify } from '@aztec-labs/foundation/json-rpc';
|
|
7
8
|
import {
|
|
8
9
|
BufferReader,
|
|
@@ -12,7 +13,6 @@ import {
|
|
|
12
13
|
serializeToSink,
|
|
13
14
|
} from '@aztec-labs/foundation/serialize';
|
|
14
15
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
15
|
-
import { inspect } from 'util';
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
|
|
18
18
|
import { AztecAddress } from '../aztec-address/index.js';
|
package/src/tx/profiling.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CircuitKind } from '@aztec-foundation/bb.js';
|
|
|
2
2
|
|
|
3
3
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
4
4
|
import { type ZodFor, optional, schemas } from '@aztec-labs/foundation/schemas';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
|
|
7
8
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
2
3
|
import { BufferReader, BufferSink, serializeToSink } from '@aztec-labs/foundation/serialize';
|
|
3
|
-
import { inspect } from 'util';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, STATE_REFERENCE_LENGTH } from '@aztec-labs/constants';
|
|
2
2
|
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
3
4
|
import { BufferReader, BufferSink, FieldReader, serializeToSink } from '@aztec-labs/foundation/serialize';
|
|
4
5
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
5
|
-
import { inspect } from 'util';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
package/src/tx/tree_snapshots.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TREE_SNAPSHOTS_LENGTH } from '@aztec-labs/constants';
|
|
2
2
|
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
3
4
|
import { BufferReader, BufferSink, FieldReader, serializeToSink } from '@aztec-labs/foundation/serialize';
|
|
4
|
-
import { inspect } from 'util';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
package/src/tx/tx.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
TX_DA_GAS_OVERHEAD,
|
|
7
7
|
} from '@aztec-labs/constants';
|
|
8
8
|
import { type BaseBuffer32, Buffer32 } from '@aztec-labs/foundation/buffer';
|
|
9
|
+
import { sum } from '@aztec-labs/foundation/collection';
|
|
9
10
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
10
11
|
import type { ZodFor } from '@aztec-labs/foundation/schemas';
|
|
11
12
|
import {
|
|
@@ -124,10 +125,19 @@ export class Tx extends Gossipable {
|
|
|
124
125
|
return callRequests.map(r => this.#combinePublicCallRequestWithCallData(r));
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
/** Returns the number of calldata fields across the supplied calldata entries, whichever calls use them. */
|
|
127
129
|
getTotalPublicCalldataCount(): number {
|
|
128
130
|
return this.publicFunctionCalldata.reduce((accum, cd) => accum + cd.values.length, 0);
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Returns the number of calldata fields the public calls receive. Calldata shared by several calls counts once per
|
|
135
|
+
* call, and a call with no matching calldata entry counts as receiving none.
|
|
136
|
+
*/
|
|
137
|
+
getDeliveredPublicCalldataCount(): number {
|
|
138
|
+
return sum(this.getPublicCallRequestsWithCalldata().map(r => r.calldata.length));
|
|
139
|
+
}
|
|
140
|
+
|
|
131
141
|
getGasSettings(): GasSettings {
|
|
132
142
|
return this.data.constants.txContext.gasSettings;
|
|
133
143
|
}
|
package/src/tx/tx_effect.ts
CHANGED
|
@@ -21,10 +21,10 @@ import { type FieldsOf, makeTuple, makeTupleAsync } from '@aztec-labs/foundation
|
|
|
21
21
|
import { poseidon2HashWithSeparator } from '@aztec-labs/foundation/crypto/poseidon';
|
|
22
22
|
import { randomInt } from '@aztec-labs/foundation/crypto/random';
|
|
23
23
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
24
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
24
25
|
import { type ZodFor, schemas } from '@aztec-labs/foundation/schemas';
|
|
25
26
|
import { BufferReader, serializeArrayOfBufferableToVector, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
26
27
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
27
|
-
import { inspect } from 'util';
|
|
28
28
|
import { z } from 'zod';
|
|
29
29
|
|
|
30
30
|
import { PublicDataWrite } from '../avm/public_data_write.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import { inspect } from '@aztec-labs/foundation/inspect';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
3
4
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
4
5
|
import type { FieldsOf } from '@aztec-labs/foundation/types';
|
|
5
|
-
import { inspect } from 'util';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
@@ -53,3 +53,21 @@ export const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = 'Failed to parse contract c
|
|
|
53
53
|
|
|
54
54
|
// General
|
|
55
55
|
export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
|
|
56
|
+
|
|
57
|
+
// Reasons a tx can fail only because the receiver's own state moved on (later timestamp, raised fee
|
|
58
|
+
// floor, dropped fee-payer balance, committed nullifier, advanced archive root) - not the relayer's fault.
|
|
59
|
+
const RECEIVER_LOCAL_STATE_DRIFT_TX_ERRORS = [
|
|
60
|
+
TX_ERROR_INVALID_EXPIRATION_TIMESTAMP,
|
|
61
|
+
TX_ERROR_EXISTING_NULLIFIER,
|
|
62
|
+
TX_ERROR_BLOCK_HEADER,
|
|
63
|
+
TX_ERROR_INSUFFICIENT_FEE_PER_GAS,
|
|
64
|
+
TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE,
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// True when every reason is receiver-local drift. Prefix match: some reasons append detail (e.g. fees).
|
|
68
|
+
export function isReceiverLocalStateDrift(reasons: string[]): boolean {
|
|
69
|
+
return (
|
|
70
|
+
reasons.length > 0 &&
|
|
71
|
+
reasons.every(reason => RECEIVER_LOCAL_STATE_DRIFT_TX_ERRORS.some(drift => reason.startsWith(drift)))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -4,6 +4,7 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
|
4
4
|
import { bufferSchemaFor } from '@aztec-labs/foundation/schemas';
|
|
5
5
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
6
6
|
import { bufferToHex, hexToBuffer } from '@aztec-labs/foundation/string';
|
|
7
|
+
import { Buffer } from 'buffer';
|
|
7
8
|
|
|
8
9
|
import { hashVK } from '../hash/index.js';
|
|
9
10
|
|
package/src/zkpassport/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { randomBytes } from '@aztec-labs/foundation/crypto/random';
|
|
|
3
3
|
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
|
|
5
5
|
import { withoutHexPrefix } from '@aztec-labs/foundation/string';
|
|
6
|
+
import { Buffer } from 'buffer';
|
|
6
7
|
|
|
7
8
|
export type ViemZkPassportProofParams = {
|
|
8
9
|
version: `0x${string}`;
|