@aztec/stdlib 0.0.1-commit.f5d02921e → 0.0.1-commit.f7ea82942
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/authorization_selector.d.ts +3 -6
- package/dest/abi/authorization_selector.d.ts.map +1 -1
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +32 -6
- package/dest/abi/event_selector.d.ts +3 -6
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.d.ts +3 -6
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +1 -3
- package/dest/abi/note_selector.d.ts +3 -6
- package/dest/abi/note_selector.d.ts.map +1 -1
- package/dest/abi/note_selector.js +1 -3
- 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/avm/avm.d.ts +300 -300
- package/dest/avm/revert_code.d.ts +8 -18
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -30
- package/dest/aztec-address/index.d.ts +3 -6
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +2 -4
- package/dest/block/block_data.d.ts +8 -8
- package/dest/block/block_data.d.ts.map +1 -1
- package/dest/block/block_data.js +2 -2
- package/dest/block/block_hash.d.ts +11 -10
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +10 -9
- package/dest/block/l2_block_info.d.ts +6 -5
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +6 -5
- package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +1 -1
- package/dest/config/chain-config.d.ts +1 -1
- package/dest/config/chain-config.d.ts.map +1 -1
- package/dest/config/chain-config.js +7 -1
- package/dest/config/sequencer-config.d.ts +2 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +10 -3
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +2 -4
- package/dest/gas/fee_math.d.ts +49 -0
- package/dest/gas/fee_math.d.ts.map +1 -0
- package/dest/gas/fee_math.js +80 -0
- package/dest/gas/gas_fees.d.ts +5 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +10 -1
- package/dest/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/ha-signing/config.d.ts +6 -6
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +4 -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/ha-signing/local_config.js +1 -1
- package/dest/ha-signing/types.d.ts +37 -32
- package/dest/ha-signing/types.d.ts.map +1 -1
- package/dest/ha-signing/types.js +13 -6
- package/dest/hash/hash.d.ts +16 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +32 -0
- package/dest/interfaces/archiver.d.ts +11 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -1
- package/dest/interfaces/aztec-node-admin.d.ts +9 -14
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -3
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- package/dest/interfaces/aztec-node.d.ts +10 -1
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -0
- package/dest/interfaces/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +1 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +0 -3
- package/dest/interfaces/slasher.d.ts +1 -10
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +0 -2
- package/dest/interfaces/validator.d.ts +14 -17
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/l1-contracts/index.d.ts +2 -2
- package/dest/l1-contracts/index.d.ts.map +1 -1
- package/dest/l1-contracts/index.js +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
- package/dest/logs/log_id.d.ts +1 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +1 -2
- package/dest/logs/siloed_tag.d.ts +5 -7
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -0
- package/dest/logs/tag.d.ts +5 -6
- package/dest/logs/tag.d.ts.map +1 -1
- package/dest/logs/tag.js +4 -0
- package/dest/p2p/block_proposal.d.ts +6 -8
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +4 -9
- package/dest/p2p/checkpoint_attestation.d.ts +4 -6
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts +8 -10
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +5 -24
- package/dest/p2p/gossipable.d.ts +4 -4
- package/dest/p2p/gossipable.d.ts.map +1 -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 +8 -2
- package/dest/slashing/index.d.ts +2 -3
- package/dest/slashing/index.d.ts.map +1 -1
- package/dest/slashing/index.js +1 -2
- package/dest/slashing/serialization.d.ts +2 -6
- package/dest/slashing/serialization.d.ts.map +1 -1
- package/dest/slashing/serialization.js +0 -60
- package/dest/slashing/types.d.ts +4 -90
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +0 -14
- package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
- package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
- package/dest/slashing/{tally.js → votes.js} +1 -1
- package/dest/tests/factories.d.ts +2 -7
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +2 -8
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +14 -19
- package/dest/timetable/index.d.ts +51 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +204 -14
- 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 +3 -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/fee_provider.d.ts +10 -0
- package/dest/tx/fee_provider.d.ts.map +1 -0
- package/dest/tx/fee_provider.js +1 -0
- package/dest/tx/global_variable_builder.d.ts +3 -16
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/index.d.ts +2 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/indexed_tx_effect.d.ts +1 -1
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +1 -2
- package/dest/tx/simulated_tx.d.ts +4 -4
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +3 -3
- package/dest/tx/tx.d.ts +3 -3
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +8 -4
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +8 -15
- package/dest/types/shared.d.ts +1 -10
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/types/shared.js +0 -9
- package/dest/vks/verification_key.d.ts +2 -137
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +5 -126
- package/dest/world-state/genesis_data.d.ts +11 -0
- package/dest/world-state/genesis_data.d.ts.map +1 -0
- package/dest/world-state/genesis_data.js +4 -0
- package/dest/world-state/index.d.ts +2 -1
- package/dest/world-state/index.d.ts.map +1 -1
- package/dest/world-state/index.js +1 -0
- package/dest/world-state/world_state_revision.d.ts +8 -1
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +7 -1
- package/package.json +8 -8
- package/src/abi/authorization_selector.ts +2 -8
- package/src/abi/encoder.ts +42 -6
- package/src/abi/event_selector.ts +2 -8
- package/src/abi/function_selector.ts +3 -12
- package/src/abi/note_selector.ts +3 -12
- package/src/abi/selector.ts +1 -1
- package/src/avm/revert_code.ts +25 -39
- package/src/aztec-address/index.ts +4 -10
- package/src/block/block_data.ts +3 -4
- package/src/block/block_hash.ts +21 -14
- package/src/block/l2_block_info.ts +8 -6
- package/src/block/l2_block_stream/interfaces.ts +6 -2
- package/src/block/l2_block_stream/l2_tips_store_base.ts +1 -1
- package/src/block/test/l2_tips_store_test_suite.ts +1 -1
- package/src/config/chain-config.ts +7 -1
- package/src/config/sequencer-config.ts +14 -4
- package/src/contract/private_function.ts +3 -1
- package/src/gas/README.md +31 -0
- package/src/gas/fee_math.ts +120 -0
- package/src/gas/gas_fees.ts +17 -4
- package/src/gas/gas_settings.ts +65 -12
- package/src/gas/index.ts +1 -0
- package/src/ha-signing/config.ts +5 -2
- package/src/ha-signing/index.ts +3 -1
- package/src/ha-signing/local_config.ts +1 -1
- package/src/ha-signing/types.ts +48 -34
- package/src/hash/hash.ts +27 -0
- package/src/interfaces/archiver.ts +8 -0
- package/src/interfaces/aztec-node-admin.ts +5 -7
- package/src/interfaces/aztec-node-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +15 -0
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/merkle_tree_operations.ts +3 -2
- package/src/interfaces/prover-client.ts +2 -5
- package/src/interfaces/slasher.ts +0 -6
- package/src/interfaces/validator.ts +15 -8
- package/src/l1-contracts/index.ts +1 -1
- package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
- package/src/logs/log_id.ts +1 -2
- package/src/logs/siloed_tag.ts +8 -9
- package/src/logs/tag.ts +8 -8
- package/src/p2p/block_proposal.ts +13 -9
- package/src/p2p/checkpoint_attestation.ts +5 -9
- package/src/p2p/checkpoint_proposal.ts +21 -36
- package/src/p2p/gossipable.ts +4 -4
- package/src/rollup/block_headers_hash.ts +11 -2
- package/src/slashing/index.ts +1 -2
- package/src/slashing/serialization.ts +1 -81
- package/src/slashing/types.ts +3 -35
- package/src/slashing/{tally.ts → votes.ts} +1 -1
- package/src/tests/factories.ts +2 -10
- package/src/tests/mocks.ts +16 -12
- package/src/timetable/index.ts +293 -13
- package/src/trees/nullifier_leaf.ts +4 -0
- package/src/tx/block_header.ts +2 -2
- package/src/tx/fee_provider.ts +10 -0
- package/src/tx/global_variable_builder.ts +2 -18
- package/src/tx/index.ts +1 -0
- package/src/tx/indexed_tx_effect.ts +1 -2
- package/src/tx/simulated_tx.ts +6 -2
- package/src/tx/tx.ts +2 -2
- package/src/tx/tx_receipt.ts +11 -14
- package/src/types/shared.ts +0 -10
- package/src/vks/verification_key.ts +5 -184
- package/src/world-state/genesis_data.ts +15 -0
- package/src/world-state/index.ts +1 -0
- package/src/world-state/world_state_revision.ts +9 -1
- package/dest/abi/mocked_keys.d.ts +0 -2
- package/dest/abi/mocked_keys.d.ts.map +0 -1
- package/dest/abi/mocked_keys.js +0 -1
- package/dest/l1-contracts/slash_factory.d.ts +0 -45
- package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
- package/dest/l1-contracts/slash_factory.js +0 -158
- package/dest/slashing/empire.d.ts +0 -31
- package/dest/slashing/empire.d.ts.map +0 -1
- package/dest/slashing/empire.js +0 -87
- package/src/abi/mocked_keys.ts +0 -2
- package/src/l1-contracts/slash_factory.ts +0 -180
- package/src/slashing/empire.ts +0 -104
package/src/slashing/types.ts
CHANGED
|
@@ -126,45 +126,13 @@ export type ValidatorSlash = {
|
|
|
126
126
|
offenses: ValidatorSlashOffense[];
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
export type SlashPayload = {
|
|
131
|
-
address: EthAddress;
|
|
132
|
-
slashes: ValidatorSlash[];
|
|
133
|
-
timestamp: bigint;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/** Slash payload with round information from empire slash proposer */
|
|
137
|
-
export type SlashPayloadRound = SlashPayload & { votes: bigint; round: bigint };
|
|
138
|
-
|
|
139
|
-
export const SlashPayloadRoundSchema = zodFor<SlashPayloadRound>()(
|
|
140
|
-
z.object({
|
|
141
|
-
address: schemas.EthAddress,
|
|
142
|
-
timestamp: schemas.BigInt,
|
|
143
|
-
votes: schemas.BigInt,
|
|
144
|
-
round: schemas.BigInt,
|
|
145
|
-
slashes: z.array(
|
|
146
|
-
z.object({
|
|
147
|
-
validator: schemas.EthAddress,
|
|
148
|
-
amount: schemas.BigInt,
|
|
149
|
-
offenses: z.array(z.object({ offenseType: OffenseTypeSchema, epochOrSlot: schemas.BigInt })),
|
|
150
|
-
}),
|
|
151
|
-
),
|
|
152
|
-
}),
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
/** Votes for a validator slash in the consensus slash proposer */
|
|
129
|
+
/** Votes for a validator slash in the slashing proposer */
|
|
156
130
|
export type ValidatorSlashVote = number;
|
|
157
131
|
|
|
158
132
|
export type ProposerSlashAction =
|
|
159
|
-
/**
|
|
160
|
-
| { type: 'create-empire-payload'; data: ValidatorSlash[] }
|
|
161
|
-
/** Vote for a slashing payload on an empire-based slash proposer */
|
|
162
|
-
| { type: 'vote-empire-payload'; payload: EthAddress }
|
|
163
|
-
/** Execute a slashing payload on an empire-based slash proposer */
|
|
164
|
-
| { type: 'execute-empire-payload'; round: bigint }
|
|
165
|
-
/** Vote for offenses on a consensus slashing proposer */
|
|
133
|
+
/** Vote for offenses on the slashing proposer */
|
|
166
134
|
| { type: 'vote-offenses'; votes: ValidatorSlashVote[]; committees: EthAddress[][]; round: bigint }
|
|
167
|
-
/** Execute a slashing round on
|
|
135
|
+
/** Execute a slashing round on the slashing proposer */
|
|
168
136
|
| { type: 'execute-slash'; committees: EthAddress[][]; round: bigint };
|
|
169
137
|
|
|
170
138
|
export type ProposerSlashActionType = ProposerSlashAction['type'];
|
|
@@ -28,7 +28,7 @@ export function getSlashConsensusVotesFromOffenses(
|
|
|
28
28
|
targetCommitteeSize: number;
|
|
29
29
|
maxSlashedValidators?: number;
|
|
30
30
|
},
|
|
31
|
-
logger: Logger = createLogger('slasher:
|
|
31
|
+
logger: Logger = createLogger('slasher:votes'),
|
|
32
32
|
): ValidatorSlashVote[] {
|
|
33
33
|
const { slashingAmounts, targetCommitteeSize, maxSlashedValidators } = settings;
|
|
34
34
|
|
package/src/tests/factories.ts
CHANGED
|
@@ -176,7 +176,7 @@ import { TxHash } from '../tx/tx_hash.js';
|
|
|
176
176
|
import { TxRequest } from '../tx/tx_request.js';
|
|
177
177
|
import { Vector } from '../types/index.js';
|
|
178
178
|
import { VkData } from '../vks/index.js';
|
|
179
|
-
import {
|
|
179
|
+
import { VerificationKeyAsFields, VerificationKeyData } from '../vks/verification_key.js';
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* Creates an arbitrary side effect object with the given seed.
|
|
@@ -232,7 +232,7 @@ export function makeTxContext(seed: number = 1): TxContext {
|
|
|
232
232
|
* Creates a default instance of gas settings. No seed value is used to ensure we allocate a sensible amount of gas for testing.
|
|
233
233
|
*/
|
|
234
234
|
export function makeGasSettings() {
|
|
235
|
-
return GasSettings.
|
|
235
|
+
return GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) });
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|
|
@@ -573,14 +573,6 @@ export function makeVerificationKeyAsFields(size: number): VerificationKeyAsFiel
|
|
|
573
573
|
return VerificationKeyAsFields.makeFake(size);
|
|
574
574
|
}
|
|
575
575
|
|
|
576
|
-
/**
|
|
577
|
-
* Creates arbitrary/mocked verification key.
|
|
578
|
-
* @returns A verification key object
|
|
579
|
-
*/
|
|
580
|
-
export function makeVerificationKey(): VerificationKey {
|
|
581
|
-
return VerificationKey.makeFake();
|
|
582
|
-
}
|
|
583
|
-
|
|
584
576
|
/**
|
|
585
577
|
* Creates an arbitrary point in a curve.
|
|
586
578
|
* @param seed - Seed to generate the point values.
|
package/src/tests/mocks.ts
CHANGED
|
@@ -134,7 +134,7 @@ export const mockTx = async (
|
|
|
134
134
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
135
135
|
const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
|
|
136
136
|
data.constants.anchorBlockHeader = anchorBlockHeader;
|
|
137
|
-
data.constants.txContext.gasSettings = GasSettings.
|
|
137
|
+
data.constants.txContext.gasSettings = GasSettings.fallback({ gasLimits, maxFeesPerGas, maxPriorityFeesPerGas });
|
|
138
138
|
data.feePayer = feePayer ?? (await AztecAddress.random());
|
|
139
139
|
data.gasUsed = gasUsed;
|
|
140
140
|
data.constants.txContext.chainId = chainId;
|
|
@@ -200,7 +200,7 @@ export async function mockProcessedTx({
|
|
|
200
200
|
db,
|
|
201
201
|
chainId = Fr.ZERO,
|
|
202
202
|
version = Fr.ZERO,
|
|
203
|
-
gasSettings = GasSettings.
|
|
203
|
+
gasSettings = GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) }),
|
|
204
204
|
vkTreeRoot = Fr.ZERO,
|
|
205
205
|
protocolContracts = makeProtocolContracts(seed + 0x100),
|
|
206
206
|
globalVariables = GlobalVariables.empty(),
|
|
@@ -587,6 +587,7 @@ export const makeBlockProposal = (options?: MakeBlockProposalOptions): Promise<B
|
|
|
587
587
|
|
|
588
588
|
return BlockProposal.createProposalFromSigner(
|
|
589
589
|
blockHeader,
|
|
590
|
+
CheckpointNumber(1),
|
|
590
591
|
indexWithinCheckpoint,
|
|
591
592
|
inHash,
|
|
592
593
|
archiveRoot,
|
|
@@ -596,28 +597,31 @@ export const makeBlockProposal = (options?: MakeBlockProposalOptions): Promise<B
|
|
|
596
597
|
);
|
|
597
598
|
};
|
|
598
599
|
|
|
599
|
-
export const makeCheckpointProposal = (options?: MakeCheckpointProposalOptions): Promise<CheckpointProposal> => {
|
|
600
|
-
const blockHeader = options?.lastBlock?.blockHeader ?? makeBlockHeader(1);
|
|
600
|
+
export const makeCheckpointProposal = async (options?: MakeCheckpointProposalOptions): Promise<CheckpointProposal> => {
|
|
601
601
|
const checkpointHeader = options?.checkpointHeader ?? makeCheckpointHeader(1);
|
|
602
602
|
const archiveRoot = options?.archiveRoot ?? Fr.random();
|
|
603
603
|
const feeAssetPriceModifier = options?.feeAssetPriceModifier ?? 0n;
|
|
604
604
|
const signer = options?.signer ?? Secp256k1Signer.random();
|
|
605
605
|
|
|
606
|
-
// Build
|
|
607
|
-
const
|
|
608
|
-
? {
|
|
609
|
-
blockHeader,
|
|
610
|
-
indexWithinCheckpoint: options.lastBlock.indexWithinCheckpoint ?? IndexWithinCheckpoint(4),
|
|
611
|
-
|
|
606
|
+
// Build a signed block proposal if lastBlock options are provided
|
|
607
|
+
const lastBlockProposal = options?.lastBlock
|
|
608
|
+
? await makeBlockProposal({
|
|
609
|
+
blockHeader: options.lastBlock.blockHeader,
|
|
610
|
+
indexWithinCheckpoint: options.lastBlock.indexWithinCheckpoint ?? IndexWithinCheckpoint(4),
|
|
611
|
+
inHash: checkpointHeader.inHash,
|
|
612
|
+
archiveRoot,
|
|
613
|
+
txHashes: options.lastBlock.txHashes,
|
|
612
614
|
txs: options.lastBlock.txs,
|
|
613
|
-
|
|
615
|
+
signer,
|
|
616
|
+
})
|
|
614
617
|
: undefined;
|
|
615
618
|
|
|
616
619
|
return CheckpointProposal.createProposalFromSigner(
|
|
617
620
|
checkpointHeader,
|
|
618
621
|
archiveRoot,
|
|
622
|
+
CheckpointNumber(1),
|
|
619
623
|
feeAssetPriceModifier,
|
|
620
|
-
|
|
624
|
+
lastBlockProposal,
|
|
621
625
|
payload => Promise.resolve(signer.signMessage(payload)),
|
|
622
626
|
);
|
|
623
627
|
};
|
package/src/timetable/index.ts
CHANGED
|
@@ -25,6 +25,219 @@ export const DEFAULT_L1_PUBLISHING_TIME = 12;
|
|
|
25
25
|
/** Minimum execution time for building a block in seconds */
|
|
26
26
|
export const MIN_EXECUTION_TIME = 2;
|
|
27
27
|
|
|
28
|
+
export type CheckpointTimingConfig = {
|
|
29
|
+
aztecSlotDuration: number;
|
|
30
|
+
ethereumSlotDuration?: number;
|
|
31
|
+
blockDuration?: number;
|
|
32
|
+
checkpointAssembleTime?: number;
|
|
33
|
+
checkpointInitializationTime?: number;
|
|
34
|
+
l1PublishingTime?: number;
|
|
35
|
+
minExecutionTime?: number;
|
|
36
|
+
p2pPropagationTime?: number;
|
|
37
|
+
pipelining?: boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export interface CheckpointTiming {
|
|
41
|
+
readonly aztecSlotDuration: number;
|
|
42
|
+
readonly blockDuration: number | undefined;
|
|
43
|
+
readonly checkpointAssembleTime: number;
|
|
44
|
+
readonly checkpointInitializationTime: number;
|
|
45
|
+
readonly l1PublishingTime: number;
|
|
46
|
+
readonly minExecutionTime: number;
|
|
47
|
+
readonly p2pPropagationTime: number;
|
|
48
|
+
readonly checkpointFinalizationTime: number;
|
|
49
|
+
readonly pipeliningAttestationGracePeriod: number;
|
|
50
|
+
readonly timeReservedAtEnd: number;
|
|
51
|
+
readonly minimumBuildSlotWork: number;
|
|
52
|
+
readonly initializeDeadline: number;
|
|
53
|
+
readonly checkpointAssemblyDeadline: number;
|
|
54
|
+
readonly checkpointAttestationStartDeadline: number;
|
|
55
|
+
readonly checkpointAttestationDeadline: number;
|
|
56
|
+
readonly checkpointPublishingDeadline: number;
|
|
57
|
+
|
|
58
|
+
calculateMaxBlocksPerSlot(): number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PipelinedCheckpointTiming extends CheckpointTiming {
|
|
62
|
+
readonly proposalWindowIntoTargetSlot: number;
|
|
63
|
+
readonly attestationWindowIntoTargetSlot: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Shared base for checkpoint timing implementations.
|
|
68
|
+
*
|
|
69
|
+
* This class owns the common inputs and formulas used by both pipelined and
|
|
70
|
+
* non-pipelined scheduling. Variant-specific deadline math is delegated to the
|
|
71
|
+
* concrete subclasses below.
|
|
72
|
+
*/
|
|
73
|
+
abstract class BaseCheckpointTiming implements CheckpointTiming {
|
|
74
|
+
public readonly aztecSlotDuration: number;
|
|
75
|
+
public readonly blockDuration: number | undefined;
|
|
76
|
+
public readonly checkpointAssembleTime: number;
|
|
77
|
+
public readonly checkpointInitializationTime: number;
|
|
78
|
+
public readonly l1PublishingTime: number;
|
|
79
|
+
public readonly minExecutionTime: number;
|
|
80
|
+
public readonly p2pPropagationTime: number;
|
|
81
|
+
|
|
82
|
+
constructor(opts: CheckpointTimingConfig) {
|
|
83
|
+
this.aztecSlotDuration = opts.aztecSlotDuration;
|
|
84
|
+
this.blockDuration = opts.blockDuration;
|
|
85
|
+
|
|
86
|
+
this.checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
|
|
87
|
+
this.checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
|
|
88
|
+
this.l1PublishingTime = opts.l1PublishingTime ?? DEFAULT_L1_PUBLISHING_TIME;
|
|
89
|
+
this.minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
|
|
90
|
+
this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public get checkpointFinalizationTime(): number {
|
|
94
|
+
// Allow enough time to
|
|
95
|
+
// - build the checkpoint
|
|
96
|
+
// - Round-trip over p2p
|
|
97
|
+
// - Publish to L1
|
|
98
|
+
return this.checkpointAssembleTime + this.p2pPropagationTime * 2 + this.l1PublishingTime;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public get pipeliningAttestationGracePeriod(): number {
|
|
102
|
+
// Allow enough time to
|
|
103
|
+
// - build the block
|
|
104
|
+
// - pass it back over p2p
|
|
105
|
+
return (this.blockDuration ?? 0) + this.p2pPropagationTime;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public abstract get timeReservedAtEnd(): number;
|
|
109
|
+
public abstract get minimumBuildSlotWork(): number;
|
|
110
|
+
|
|
111
|
+
public get initializeDeadline(): number {
|
|
112
|
+
return this.aztecSlotDuration - this.minimumBuildSlotWork;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public abstract get checkpointAssemblyDeadline(): number;
|
|
116
|
+
|
|
117
|
+
public get checkpointAttestationStartDeadline(): number {
|
|
118
|
+
return this.checkpointAssemblyDeadline;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public abstract get checkpointAttestationDeadline(): number;
|
|
122
|
+
public abstract get checkpointPublishingDeadline(): number;
|
|
123
|
+
|
|
124
|
+
public calculateMaxBlocksPerSlot(): number {
|
|
125
|
+
if (!this.blockDuration) {
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const timeAvailableForBlocks = this.aztecSlotDuration - this.checkpointInitializationTime - this.timeReservedAtEnd;
|
|
130
|
+
return Math.floor(timeAvailableForBlocks / this.blockDuration);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Checkpoint timing model for the non-pipelined sequencer flow.
|
|
136
|
+
*
|
|
137
|
+
* In this mode, checkpoint assembly, attestation collection, and L1 publishing
|
|
138
|
+
* must all complete within the current Aztec slot.
|
|
139
|
+
*/
|
|
140
|
+
class StandardCheckpointTimingModel extends BaseCheckpointTiming {
|
|
141
|
+
public get timeReservedAtEnd(): number {
|
|
142
|
+
return (this.blockDuration ?? 0) + this.checkpointFinalizationTime;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public get minimumBuildSlotWork(): number {
|
|
146
|
+
return this.checkpointInitializationTime + this.minExecutionTime * 2 + this.checkpointFinalizationTime;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public get checkpointAssemblyDeadline(): number {
|
|
150
|
+
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.p2pPropagationTime;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public get checkpointAttestationDeadline(): number {
|
|
154
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public get checkpointPublishingDeadline(): number {
|
|
158
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Checkpoint timing model for proposer pipelining.
|
|
164
|
+
*
|
|
165
|
+
* In this mode, the build work still starts in the current slot, but checkpoint
|
|
166
|
+
* assembly and attestation collection can extend into the target slot. The extra
|
|
167
|
+
* target-slot window getters are intended for consumers such as P2P validators
|
|
168
|
+
* that need to validate pipelined messages against wallclock time.
|
|
169
|
+
*/
|
|
170
|
+
class PipelinedCheckpointTimingModel extends BaseCheckpointTiming implements PipelinedCheckpointTiming {
|
|
171
|
+
public get proposalWindowIntoTargetSlot(): number {
|
|
172
|
+
// Allow the p2p propagation time to receive a checkpoint proposal from leader
|
|
173
|
+
return this.p2pPropagationTime;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public get attestationWindowIntoTargetSlot(): number {
|
|
177
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public get timeReservedAtEnd(): number {
|
|
181
|
+
return this.checkpointAssembleTime + this.p2pPropagationTime;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public get minimumBuildSlotWork(): number {
|
|
185
|
+
return this.checkpointInitializationTime + this.minExecutionTime * 2;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public get checkpointAssemblyDeadline(): number {
|
|
189
|
+
// Allow enough time to
|
|
190
|
+
// - build all blocks
|
|
191
|
+
// - receive attestations
|
|
192
|
+
return this.aztecSlotDuration + this.pipeliningAttestationGracePeriod;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public get checkpointAttestationDeadline(): number {
|
|
196
|
+
// Allowed to be into the next wallclock slot minus the allocated l1 publishing time
|
|
197
|
+
return this.aztecSlotDuration * 2 - this.l1PublishingTime;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public get checkpointPublishingDeadline(): number {
|
|
201
|
+
// Allowed to be into the next wallclock slot minus the allocated l1 Publishing time
|
|
202
|
+
return this.aztecSlotDuration * 2 - this.l1PublishingTime;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Creates a checkpoint timing model for the requested scheduling mode.
|
|
208
|
+
*
|
|
209
|
+
* Most callers should use this factory and depend only on the shared
|
|
210
|
+
* `CheckpointTiming` interface. The returned implementation is selected from
|
|
211
|
+
* `opts.pipelining`.
|
|
212
|
+
*/
|
|
213
|
+
export function createCheckpointTimingModel(opts: CheckpointTimingConfig): CheckpointTiming {
|
|
214
|
+
validateCheckpointTimingConfig(opts);
|
|
215
|
+
const normalizedOpts = normalizeCheckpointTimingConfig(opts);
|
|
216
|
+
|
|
217
|
+
const timing = normalizedOpts.pipelining
|
|
218
|
+
? new PipelinedCheckpointTimingModel(normalizedOpts)
|
|
219
|
+
: new StandardCheckpointTimingModel(normalizedOpts);
|
|
220
|
+
validateCheckpointTimingModel(timing);
|
|
221
|
+
return timing;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Creates a pipelined checkpoint timing model with target-slot window accessors.
|
|
226
|
+
*
|
|
227
|
+
* Use this when the caller specifically needs the pipelined-only timing surface,
|
|
228
|
+
* such as proposal or attestation acceptance windows into the target slot.
|
|
229
|
+
*/
|
|
230
|
+
export function createPipelinedCheckpointTimingModel(
|
|
231
|
+
opts: Omit<CheckpointTimingConfig, 'pipelining'>,
|
|
232
|
+
): PipelinedCheckpointTiming {
|
|
233
|
+
validateCheckpointTimingConfig(opts);
|
|
234
|
+
const normalizedOpts = normalizeCheckpointTimingConfig(opts);
|
|
235
|
+
|
|
236
|
+
const timing = new PipelinedCheckpointTimingModel(normalizedOpts);
|
|
237
|
+
validateCheckpointTimingModel(timing);
|
|
238
|
+
return timing;
|
|
239
|
+
}
|
|
240
|
+
|
|
28
241
|
/**
|
|
29
242
|
* Calculates the maximum number of blocks that can be built in a slot.
|
|
30
243
|
* Used by both the sequencer timetable and p2p gossipsub scoring.
|
|
@@ -42,25 +255,92 @@ export function calculateMaxBlocksPerSlot(
|
|
|
42
255
|
checkpointAssembleTime?: number;
|
|
43
256
|
p2pPropagationTime?: number;
|
|
44
257
|
l1PublishingTime?: number;
|
|
258
|
+
pipelining?: boolean;
|
|
45
259
|
} = {},
|
|
46
260
|
): number {
|
|
47
|
-
|
|
48
|
-
|
|
261
|
+
return createCheckpointTimingModel({
|
|
262
|
+
aztecSlotDuration: aztecSlotDurationSec,
|
|
263
|
+
blockDuration: blockDurationSec,
|
|
264
|
+
checkpointAssembleTime: opts.checkpointAssembleTime,
|
|
265
|
+
checkpointInitializationTime: opts.checkpointInitializationTime,
|
|
266
|
+
l1PublishingTime: opts.l1PublishingTime,
|
|
267
|
+
p2pPropagationTime: opts.p2pPropagationTime,
|
|
268
|
+
pipelining: opts.pipelining,
|
|
269
|
+
}).calculateMaxBlocksPerSlot();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function assertNonNegative(name: string, value: number): void {
|
|
273
|
+
if (value < 0) {
|
|
274
|
+
throw new Error(`${name} must be non-negative (got ${value})`);
|
|
49
275
|
}
|
|
276
|
+
}
|
|
50
277
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
278
|
+
function validateCheckpointTimingConfig(opts: CheckpointTimingConfig): void {
|
|
279
|
+
if (opts.aztecSlotDuration <= 0) {
|
|
280
|
+
throw new Error(`aztecSlotDuration must be positive (got ${opts.aztecSlotDuration})`);
|
|
281
|
+
}
|
|
55
282
|
|
|
56
|
-
|
|
57
|
-
|
|
283
|
+
if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration <= 0) {
|
|
284
|
+
throw new Error(`ethereumSlotDuration must be positive when provided (got ${opts.ethereumSlotDuration})`);
|
|
285
|
+
}
|
|
58
286
|
|
|
59
|
-
|
|
60
|
-
|
|
287
|
+
if (opts.blockDuration !== undefined && opts.blockDuration <= 0) {
|
|
288
|
+
throw new Error(`blockDuration must be positive when provided (got ${opts.blockDuration})`);
|
|
289
|
+
}
|
|
61
290
|
|
|
62
|
-
|
|
63
|
-
|
|
291
|
+
if (opts.minExecutionTime !== undefined && opts.minExecutionTime <= 0) {
|
|
292
|
+
throw new Error(`minExecutionTime must be positive when provided (got ${opts.minExecutionTime})`);
|
|
293
|
+
}
|
|
64
294
|
|
|
65
|
-
|
|
295
|
+
if (opts.checkpointAssembleTime !== undefined) {
|
|
296
|
+
assertNonNegative('checkpointAssembleTime', opts.checkpointAssembleTime);
|
|
297
|
+
}
|
|
298
|
+
if (opts.checkpointInitializationTime !== undefined) {
|
|
299
|
+
assertNonNegative('checkpointInitializationTime', opts.checkpointInitializationTime);
|
|
300
|
+
}
|
|
301
|
+
if (opts.l1PublishingTime !== undefined) {
|
|
302
|
+
assertNonNegative('l1PublishingTime', opts.l1PublishingTime);
|
|
303
|
+
}
|
|
304
|
+
if (opts.p2pPropagationTime !== undefined) {
|
|
305
|
+
assertNonNegative('p2pPropagationTime', opts.p2pPropagationTime);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function normalizeCheckpointTimingConfig(opts: CheckpointTimingConfig): CheckpointTimingConfig {
|
|
310
|
+
let checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
|
|
311
|
+
let checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
|
|
312
|
+
let minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
|
|
313
|
+
let p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
314
|
+
|
|
315
|
+
if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration < 8) {
|
|
316
|
+
p2pPropagationTime = 0;
|
|
317
|
+
checkpointAssembleTime = 0.5;
|
|
318
|
+
checkpointInitializationTime = 0.5;
|
|
319
|
+
minExecutionTime = 1;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (opts.blockDuration !== undefined && minExecutionTime > opts.blockDuration) {
|
|
323
|
+
minExecutionTime = opts.blockDuration;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
...opts,
|
|
328
|
+
checkpointAssembleTime,
|
|
329
|
+
checkpointInitializationTime,
|
|
330
|
+
minExecutionTime,
|
|
331
|
+
p2pPropagationTime,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function validateCheckpointTimingModel(model: CheckpointTiming): void {
|
|
336
|
+
if (model.blockDuration === undefined) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const timeAvailableForBlocks = model.aztecSlotDuration - model.checkpointInitializationTime - model.timeReservedAtEnd;
|
|
341
|
+
if (timeAvailableForBlocks < model.blockDuration) {
|
|
342
|
+
throw new Error(
|
|
343
|
+
`Invalid timing configuration: only ${timeAvailableForBlocks}s available for block building, which is less than one blockDuration (${model.blockDuration}s).`,
|
|
344
|
+
);
|
|
345
|
+
}
|
|
66
346
|
}
|
|
@@ -86,6 +86,10 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
isEmpty(): boolean {
|
|
90
|
+
return this.leaf.isEmpty() && this.nextKey.isZero() && this.nextIndex === 0n;
|
|
91
|
+
}
|
|
92
|
+
|
|
89
93
|
toFields(): Fr[] {
|
|
90
94
|
return this.toHashInputs().map(buf => Fr.fromBuffer(buf));
|
|
91
95
|
}
|
package/src/tx/block_header.ts
CHANGED
|
@@ -172,8 +172,8 @@ export class BlockHeader {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
/** Manually set the hash for this block header if already computed */
|
|
175
|
-
setHash(hashed:
|
|
176
|
-
this._cachedHash = Promise.resolve(
|
|
175
|
+
setHash(hashed: BlockHash) {
|
|
176
|
+
this._cachedHash = Promise.resolve(hashed);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/** Recomputes the cached hash. Used for testing when header fields are mutated via unfreeze. */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ManaUsageEstimate } from '../gas/fee_math.js';
|
|
2
|
+
import type { GasFees } from '../gas/gas_fees.js';
|
|
3
|
+
|
|
4
|
+
/** Provides current and predicted fee information for transaction pricing. */
|
|
5
|
+
export interface FeeProvider {
|
|
6
|
+
/** Returns the current minimum fees for inclusion in the next block. */
|
|
7
|
+
getCurrentMinFees(): Promise<GasFees>;
|
|
8
|
+
/** Returns predicted min fees for each slot in the prediction window. */
|
|
9
|
+
getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]>;
|
|
10
|
+
}
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
|
|
3
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
3
|
import type { SlotNumber } from '@aztec/foundation/schemas';
|
|
5
4
|
|
|
6
5
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
-
import type { GasFees } from '../gas/gas_fees.js';
|
|
8
6
|
import type { UInt32 } from '../types/index.js';
|
|
9
7
|
import type { CheckpointGlobalVariables, GlobalVariables } from './global_variables.js';
|
|
10
8
|
|
|
11
|
-
/** Fee header fields needed for pipelining overrides. */
|
|
12
|
-
export type ForceProposedFeeHeader = {
|
|
13
|
-
checkpointNumber: CheckpointNumber;
|
|
14
|
-
feeHeader: FeeHeader;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/** Options for building checkpoint global variables during pipelining. */
|
|
18
|
-
export type BuildCheckpointGlobalVariablesOpts = {
|
|
19
|
-
forcePendingCheckpointNumber?: CheckpointNumber;
|
|
20
|
-
forceProposedFeeHeader?: ForceProposedFeeHeader;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
9
|
/**
|
|
24
10
|
* Interface for building global variables for Aztec blocks.
|
|
25
11
|
*/
|
|
26
12
|
export interface GlobalVariableBuilder {
|
|
27
|
-
getCurrentMinFees(): Promise<GasFees>;
|
|
28
|
-
|
|
29
13
|
/**
|
|
30
14
|
* Builds global variables for a given block.
|
|
31
15
|
* @param blockNumber - The block number to build global variables for.
|
|
@@ -46,6 +30,6 @@ export interface GlobalVariableBuilder {
|
|
|
46
30
|
coinbase: EthAddress,
|
|
47
31
|
feeRecipient: AztecAddress,
|
|
48
32
|
slotNumber: SlotNumber,
|
|
49
|
-
|
|
33
|
+
simulationOverridesPlan?: SimulationOverridesPlan,
|
|
50
34
|
): Promise<CheckpointGlobalVariables>;
|
|
51
35
|
}
|
package/src/tx/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './validator/tx_validator.js';
|
|
|
24
24
|
export * from './validator/empty_validator.js';
|
|
25
25
|
export * from './validator/error_texts.js';
|
|
26
26
|
export * from './capsule.js';
|
|
27
|
+
export * from './fee_provider.js';
|
|
27
28
|
export * from './global_variable_builder.js';
|
|
28
29
|
export * from './hashed_values.js';
|
|
29
30
|
export * from './indexed_tx_effect.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import { schemas } from '@aztec/foundation/schemas';
|
|
4
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
4
|
|
|
@@ -27,7 +26,7 @@ export function serializeIndexedTxEffect(effect: IndexedTxEffect): Buffer {
|
|
|
27
26
|
export function deserializeIndexedTxEffect(buffer: Buffer): IndexedTxEffect {
|
|
28
27
|
const reader = BufferReader.asReader(buffer);
|
|
29
28
|
|
|
30
|
-
const l2BlockHash =
|
|
29
|
+
const l2BlockHash = BlockHash.fromBuffer(reader);
|
|
31
30
|
const l2BlockNumber = BlockNumber(reader.readNumber());
|
|
32
31
|
const txIndexInBlock = reader.readNumber();
|
|
33
32
|
const data = reader.readObject(TxEffect);
|
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -38,7 +38,11 @@ export type ContractOverrides = Record<
|
|
|
38
38
|
* set, it *must* be run without the kernel circuits, or validations will fail
|
|
39
39
|
*/
|
|
40
40
|
export class SimulationOverrides {
|
|
41
|
-
|
|
41
|
+
public contracts?: ContractOverrides;
|
|
42
|
+
|
|
43
|
+
constructor(contracts: ContractOverrides = {}) {
|
|
44
|
+
this.contracts = Object.keys(contracts).length > 0 ? contracts : undefined;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
static get schema() {
|
|
44
48
|
return z
|
|
@@ -157,7 +161,7 @@ export class TxSimulationResult {
|
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
/**
|
|
160
|
-
* Recursively
|
|
164
|
+
* Recursively accumulate the return values of a call result and its nested executions,
|
|
161
165
|
* so they can be retrieved in order.
|
|
162
166
|
* @param executionResult
|
|
163
167
|
* @returns
|
package/src/tx/tx.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DA_GAS_PER_FIELD, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
2
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
import { type BaseBuffer32, Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
5
5
|
import { BufferReader, serializeArrayOfBufferableToVector, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -64,7 +64,7 @@ export class Tx extends Gossipable {
|
|
|
64
64
|
// docs:end:tx_class
|
|
65
65
|
|
|
66
66
|
// Gossipable method
|
|
67
|
-
override generateP2PMessageIdentifier(): Promise<
|
|
67
|
+
override generateP2PMessageIdentifier(): Promise<BaseBuffer32> {
|
|
68
68
|
return Promise.resolve(new Buffer32(this.getTxHash().toBuffer()));
|
|
69
69
|
}
|
|
70
70
|
|
package/src/tx/tx_receipt.ts
CHANGED
|
@@ -31,9 +31,16 @@ export const SortedTxStatuses: TxStatus[] = [
|
|
|
31
31
|
/** Execution result - only set when tx is in a block. */
|
|
32
32
|
export enum TxExecutionResult {
|
|
33
33
|
SUCCESS = 'success',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
REVERTED = 'reverted',
|
|
35
|
+
/** @deprecated Use REVERTED instead. */
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
37
|
+
APP_LOGIC_REVERTED = 'reverted',
|
|
38
|
+
/** @deprecated Use REVERTED instead. */
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
40
|
+
TEARDOWN_REVERTED = 'reverted',
|
|
41
|
+
/** @deprecated Use REVERTED instead. */
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
43
|
+
BOTH_REVERTED = 'reverted',
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
/**
|
|
@@ -143,16 +150,6 @@ export class TxReceipt {
|
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
public static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult {
|
|
146
|
-
|
|
147
|
-
return TxExecutionResult.SUCCESS;
|
|
148
|
-
} else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
149
|
-
return TxExecutionResult.APP_LOGIC_REVERTED;
|
|
150
|
-
} else if (revertCode.equals(RevertCode.TEARDOWN_REVERTED)) {
|
|
151
|
-
return TxExecutionResult.TEARDOWN_REVERTED;
|
|
152
|
-
} else if (revertCode.equals(RevertCode.BOTH_REVERTED)) {
|
|
153
|
-
return TxExecutionResult.BOTH_REVERTED;
|
|
154
|
-
} else {
|
|
155
|
-
throw new Error(`Unknown revert code: ${revertCode.getCode()}`);
|
|
156
|
-
}
|
|
153
|
+
return revertCode.isOK() ? TxExecutionResult.SUCCESS : TxExecutionResult.REVERTED;
|
|
157
154
|
}
|
|
158
155
|
}
|