@aztec/sequencer-client 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +84 -7
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +4 -3
- package/dest/index.d.ts +0 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/sequencer/sequencer.d.ts +6 -7
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +10 -11
- package/dest/tx_validator/aggregate_tx_validator.d.ts +7 -0
- package/dest/tx_validator/aggregate_tx_validator.d.ts.map +1 -0
- package/dest/tx_validator/aggregate_tx_validator.js +23 -0
- package/dest/tx_validator/double_spend_validator.d.ts +11 -0
- package/dest/tx_validator/double_spend_validator.d.ts.map +1 -0
- package/dest/tx_validator/double_spend_validator.js +50 -0
- package/dest/tx_validator/gas_validator.d.ts +12 -0
- package/dest/tx_validator/gas_validator.d.ts.map +1 -0
- package/dest/tx_validator/gas_validator.js +62 -0
- package/dest/tx_validator/metadata_validator.d.ts +8 -0
- package/dest/tx_validator/metadata_validator.d.ts.map +1 -0
- package/dest/tx_validator/metadata_validator.js +50 -0
- package/dest/tx_validator/phases_validator.d.ts +13 -0
- package/dest/tx_validator/phases_validator.d.ts.map +1 -0
- package/dest/tx_validator/phases_validator.js +73 -0
- package/dest/tx_validator/tx_validator_factory.d.ts +13 -0
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
- package/dest/tx_validator/tx_validator_factory.js +21 -0
- package/package.json +14 -13
- package/src/client/sequencer-client.ts +2 -3
- package/src/config.ts +93 -7
- package/src/global_variable_builder/global_builder.ts +3 -2
- package/src/index.ts +0 -1
- package/src/sequencer/sequencer.ts +27 -20
- package/src/tx_validator/aggregate_tx_validator.ts +24 -0
- package/src/tx_validator/double_spend_validator.ts +65 -0
- package/src/tx_validator/gas_validator.ts +81 -0
- package/src/tx_validator/metadata_validator.ts +60 -0
- package/src/tx_validator/phases_validator.ts +101 -0
- package/src/tx_validator/tx_validator_factory.ts +37 -0
- package/dest/sequencer/abstract_phase_manager.d.ts +0 -77
- package/dest/sequencer/abstract_phase_manager.d.ts.map +0 -1
- package/dest/sequencer/abstract_phase_manager.js +0 -307
- package/dest/sequencer/app_logic_phase_manager.d.ts +0 -28
- package/dest/sequencer/app_logic_phase_manager.d.ts.map +0 -1
- package/dest/sequencer/app_logic_phase_manager.js +0 -41
- package/dest/sequencer/hints_builder.d.ts +0 -23
- package/dest/sequencer/hints_builder.d.ts.map +0 -1
- package/dest/sequencer/hints_builder.js +0 -62
- package/dest/sequencer/phase_manager_factory.d.ts +0 -18
- package/dest/sequencer/phase_manager_factory.d.ts.map +0 -1
- package/dest/sequencer/phase_manager_factory.js +0 -56
- package/dest/sequencer/public_processor.d.ts +0 -54
- package/dest/sequencer/public_processor.d.ts.map +0 -1
- package/dest/sequencer/public_processor.js +0 -142
- package/dest/sequencer/setup_phase_manager.d.ts +0 -28
- package/dest/sequencer/setup_phase_manager.d.ts.map +0 -1
- package/dest/sequencer/setup_phase_manager.js +0 -30
- package/dest/sequencer/tail_phase_manager.d.ts +0 -29
- package/dest/sequencer/tail_phase_manager.d.ts.map +0 -1
- package/dest/sequencer/tail_phase_manager.js +0 -52
- package/dest/sequencer/teardown_phase_manager.d.ts +0 -28
- package/dest/sequencer/teardown_phase_manager.d.ts.map +0 -1
- package/dest/sequencer/teardown_phase_manager.js +0 -30
- package/dest/sequencer/tx_validator.d.ts +0 -29
- package/dest/sequencer/tx_validator.d.ts.map +0 -1
- package/dest/sequencer/tx_validator.js +0 -174
- package/dest/sequencer/tx_validator_factory.d.ts +0 -12
- package/dest/sequencer/tx_validator_factory.d.ts.map +0 -1
- package/dest/sequencer/tx_validator_factory.js +0 -17
- package/dest/sequencer/utils.d.ts +0 -8
- package/dest/sequencer/utils.d.ts.map +0 -1
- package/dest/sequencer/utils.js +0 -29
- package/dest/simulator/index.d.ts +0 -31
- package/dest/simulator/index.d.ts.map +0 -1
- package/dest/simulator/index.js +0 -2
- package/dest/simulator/public_executor.d.ts +0 -79
- package/dest/simulator/public_executor.d.ts.map +0 -1
- package/dest/simulator/public_executor.js +0 -198
- package/dest/simulator/public_kernel.d.ts +0 -37
- package/dest/simulator/public_kernel.d.ts.map +0 -1
- package/dest/simulator/public_kernel.js +0 -97
- package/src/sequencer/abstract_phase_manager.ts +0 -549
- package/src/sequencer/app_logic_phase_manager.ts +0 -62
- package/src/sequencer/hints_builder.ts +0 -119
- package/src/sequencer/phase_manager_factory.ts +0 -126
- package/src/sequencer/public_processor.ts +0 -209
- package/src/sequencer/setup_phase_manager.ts +0 -50
- package/src/sequencer/tail_phase_manager.ts +0 -111
- package/src/sequencer/teardown_phase_manager.ts +0 -50
- package/src/sequencer/tx_validator.ts +0 -265
- package/src/sequencer/tx_validator_factory.ts +0 -32
- package/src/sequencer/utils.ts +0 -31
- package/src/simulator/index.ts +0 -36
- package/src/simulator/public_executor.ts +0 -267
- package/src/simulator/public_kernel.ts +0 -139
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Tx, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
+
import { type AztecAddress, Fr } from '@aztec/circuits.js';
|
|
3
|
+
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
4
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { GasTokenContract } from '@aztec/noir-contracts.js';
|
|
6
|
+
import { AbstractPhaseManager, PublicKernelPhase } from '@aztec/simulator';
|
|
7
|
+
|
|
8
|
+
/** Provides a view into public contract state */
|
|
9
|
+
export interface PublicStateSource {
|
|
10
|
+
storageRead: (contractAddress: AztecAddress, slot: Fr) => Promise<Fr>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class GasTxValidator implements TxValidator<Tx> {
|
|
14
|
+
#log = createDebugLogger('aztec:sequencer:tx_validator:tx_gas');
|
|
15
|
+
#publicDataSource: PublicStateSource;
|
|
16
|
+
#gasTokenAddress: AztecAddress;
|
|
17
|
+
#requireFees: boolean;
|
|
18
|
+
|
|
19
|
+
constructor(publicDataSource: PublicStateSource, gasTokenAddress: AztecAddress, requireFees = false) {
|
|
20
|
+
this.#publicDataSource = publicDataSource;
|
|
21
|
+
this.#gasTokenAddress = gasTokenAddress;
|
|
22
|
+
this.#requireFees = requireFees;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async validateTxs(txs: Tx[]): Promise<[validTxs: Tx[], invalidTxs: Tx[]]> {
|
|
26
|
+
const validTxs: Tx[] = [];
|
|
27
|
+
const invalidTxs: Tx[] = [];
|
|
28
|
+
|
|
29
|
+
for (const tx of txs) {
|
|
30
|
+
if (await this.#validateTxFee(tx)) {
|
|
31
|
+
validTxs.push(tx);
|
|
32
|
+
} else {
|
|
33
|
+
invalidTxs.push(tx);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return [validTxs, invalidTxs];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async #validateTxFee(tx: Tx): Promise<boolean> {
|
|
41
|
+
const { [PublicKernelPhase.TEARDOWN]: teardownFns } = AbstractPhaseManager.extractEnqueuedPublicCallsByPhase(
|
|
42
|
+
tx.data,
|
|
43
|
+
tx.enqueuedPublicFunctionCalls,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (teardownFns.length === 0) {
|
|
47
|
+
if (this.#requireFees) {
|
|
48
|
+
this.#log.warn(
|
|
49
|
+
`Rejecting tx ${Tx.getHash(tx)} because it should pay for gas but has no enqueued teardown functions`,
|
|
50
|
+
);
|
|
51
|
+
return false;
|
|
52
|
+
} else {
|
|
53
|
+
this.#log.debug(`Tx ${Tx.getHash(tx)} does not pay fees. Skipping balance check.`);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (teardownFns.length > 1) {
|
|
59
|
+
this.#log.warn(`Rejecting tx ${Tx.getHash(tx)} because it has multiple teardown functions`);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// check that the caller of the teardown function has enough balance to pay for tx costs
|
|
64
|
+
const teardownFn = teardownFns[0];
|
|
65
|
+
const slot = pedersenHash([GasTokenContract.storage.balances.slot, teardownFn.callContext.msgSender]);
|
|
66
|
+
const gasBalance = await this.#publicDataSource.storageRead(this.#gasTokenAddress, slot);
|
|
67
|
+
|
|
68
|
+
// TODO(#5004) calculate fee needed based on tx limits and gas prices
|
|
69
|
+
const gasAmountNeeded = new Fr(1);
|
|
70
|
+
if (gasBalance.lt(gasAmountNeeded)) {
|
|
71
|
+
this.#log.warn(
|
|
72
|
+
`Rejecting tx ${Tx.getHash(
|
|
73
|
+
tx,
|
|
74
|
+
)} because it should pay for gas but has insufficient balance ${gasBalance.toShortString()} < ${gasAmountNeeded.toShortString()}`,
|
|
75
|
+
);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type AnyTx, Tx, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
+
import { type GlobalVariables } from '@aztec/circuits.js';
|
|
3
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
|
+
|
|
5
|
+
export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
6
|
+
#log = createDebugLogger('aztec:sequencer:tx_validator:tx_metadata');
|
|
7
|
+
#globalVariables: GlobalVariables;
|
|
8
|
+
|
|
9
|
+
constructor(globalVariables: GlobalVariables) {
|
|
10
|
+
this.#globalVariables = globalVariables;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
validateTxs(txs: T[]): Promise<[validTxs: T[], invalidTxs: T[]]> {
|
|
14
|
+
const validTxs: T[] = [];
|
|
15
|
+
const invalidTxs: T[] = [];
|
|
16
|
+
for (const tx of txs) {
|
|
17
|
+
if (!this.#hasCorrectChainId(tx)) {
|
|
18
|
+
invalidTxs.push(tx);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!this.#isValidForBlockNumber(tx)) {
|
|
23
|
+
invalidTxs.push(tx);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
validTxs.push(tx);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Promise.resolve([validTxs, invalidTxs]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#hasCorrectChainId(tx: T): boolean {
|
|
34
|
+
if (!tx.data.constants.txContext.chainId.equals(this.#globalVariables.chainId)) {
|
|
35
|
+
this.#log.warn(
|
|
36
|
+
`Rejecting tx ${Tx.getHash(
|
|
37
|
+
tx,
|
|
38
|
+
)} because of incorrect chain ${tx.data.constants.txContext.chainId.toNumber()} != ${this.#globalVariables.chainId.toNumber()}`,
|
|
39
|
+
);
|
|
40
|
+
return false;
|
|
41
|
+
} else {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#isValidForBlockNumber(tx: T): boolean {
|
|
47
|
+
const target =
|
|
48
|
+
tx instanceof Tx
|
|
49
|
+
? tx.data.forRollup?.rollupValidationRequests || tx.data.forPublic!.validationRequests.forRollup
|
|
50
|
+
: tx.data.rollupValidationRequests;
|
|
51
|
+
const maxBlockNumber = target.maxBlockNumber;
|
|
52
|
+
|
|
53
|
+
if (maxBlockNumber.isSome && maxBlockNumber.value < this.#globalVariables.blockNumber) {
|
|
54
|
+
this.#log.warn(`Rejecting tx ${Tx.getHash(tx)} for low max block number`);
|
|
55
|
+
return false;
|
|
56
|
+
} else {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type AllowedFunction, Tx, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
+
import { type PublicCallRequest } from '@aztec/circuits.js';
|
|
3
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { AbstractPhaseManager, PublicKernelPhase } from '@aztec/simulator';
|
|
5
|
+
import { type ContractDataSource } from '@aztec/types/contracts';
|
|
6
|
+
|
|
7
|
+
export class PhasesTxValidator implements TxValidator<Tx> {
|
|
8
|
+
#log = createDebugLogger('aztec:sequencer:tx_validator:tx_phases');
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
private contractDataSource: ContractDataSource,
|
|
12
|
+
private setupAllowList: AllowedFunction[],
|
|
13
|
+
private teardownAllowList: AllowedFunction[],
|
|
14
|
+
) {}
|
|
15
|
+
|
|
16
|
+
async validateTxs(txs: Tx[]): Promise<[validTxs: Tx[], invalidTxs: Tx[]]> {
|
|
17
|
+
const validTxs: Tx[] = [];
|
|
18
|
+
const invalidTxs: Tx[] = [];
|
|
19
|
+
|
|
20
|
+
for (const tx of txs) {
|
|
21
|
+
if (await this.#validateTx(tx)) {
|
|
22
|
+
validTxs.push(tx);
|
|
23
|
+
} else {
|
|
24
|
+
invalidTxs.push(tx);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return Promise.resolve([validTxs, invalidTxs]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async #validateTx(tx: Tx): Promise<boolean> {
|
|
32
|
+
if (!tx.data.forPublic) {
|
|
33
|
+
this.#log.debug(`Tx ${Tx.getHash(tx)} does not contain enqueued public functions. Skipping phases validation.`);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { [PublicKernelPhase.SETUP]: setupFns, [PublicKernelPhase.TEARDOWN]: teardownFns } =
|
|
38
|
+
AbstractPhaseManager.extractEnqueuedPublicCallsByPhase(tx.data, tx.enqueuedPublicFunctionCalls);
|
|
39
|
+
|
|
40
|
+
for (const setupFn of setupFns) {
|
|
41
|
+
if (!(await this.isOnAllowList(setupFn, this.setupAllowList))) {
|
|
42
|
+
this.#log.warn(
|
|
43
|
+
`Rejecting tx ${Tx.getHash(tx)} because it calls setup function not on allow list: ${
|
|
44
|
+
setupFn.contractAddress
|
|
45
|
+
}:${setupFn.functionData.selector}`,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (const teardownFn of teardownFns) {
|
|
53
|
+
if (!(await this.isOnAllowList(teardownFn, this.teardownAllowList))) {
|
|
54
|
+
this.#log.warn(
|
|
55
|
+
`Rejecting tx ${Tx.getHash(tx)} because it calls teardown function not on allowlist: ${
|
|
56
|
+
teardownFn.contractAddress
|
|
57
|
+
}:${teardownFn.functionData.selector}`,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async isOnAllowList(publicCall: PublicCallRequest, allowList: AllowedFunction[]): Promise<boolean> {
|
|
68
|
+
const {
|
|
69
|
+
contractAddress,
|
|
70
|
+
functionData: { selector },
|
|
71
|
+
} = publicCall;
|
|
72
|
+
|
|
73
|
+
// do these checks first since they don't require the contract class
|
|
74
|
+
for (const entry of allowList) {
|
|
75
|
+
if (!('address' in entry)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (contractAddress.equals(entry.address) && entry.selector.equals(selector)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const contractClass = await this.contractDataSource.getContract(contractAddress);
|
|
85
|
+
if (!contractClass) {
|
|
86
|
+
throw new Error(`Contract not found: ${publicCall.contractAddress.toString()}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
for (const entry of allowList) {
|
|
90
|
+
if (!('classId' in entry)) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (contractClass.contractClassId.equals(entry.classId) && entry.selector.equals(selector)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type AllowedFunction, type ProcessedTx, type Tx, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
+
import { type EthAddress, type GlobalVariables } from '@aztec/circuits.js';
|
|
3
|
+
import { getCanonicalGasTokenAddress } from '@aztec/protocol-contracts/gas-token';
|
|
4
|
+
import { WorldStateDB, WorldStatePublicDB } from '@aztec/simulator';
|
|
5
|
+
import { type ContractDataSource } from '@aztec/types/contracts';
|
|
6
|
+
import { type MerkleTreeOperations } from '@aztec/world-state';
|
|
7
|
+
|
|
8
|
+
import { AggregateTxValidator } from './aggregate_tx_validator.js';
|
|
9
|
+
import { DoubleSpendTxValidator } from './double_spend_validator.js';
|
|
10
|
+
import { GasTxValidator } from './gas_validator.js';
|
|
11
|
+
import { MetadataTxValidator } from './metadata_validator.js';
|
|
12
|
+
import { PhasesTxValidator } from './phases_validator.js';
|
|
13
|
+
|
|
14
|
+
export class TxValidatorFactory {
|
|
15
|
+
constructor(
|
|
16
|
+
private merkleTreeDb: MerkleTreeOperations,
|
|
17
|
+
private contractDataSource: ContractDataSource,
|
|
18
|
+
private gasPortalAddress: EthAddress,
|
|
19
|
+
) {}
|
|
20
|
+
|
|
21
|
+
validatorForNewTxs(
|
|
22
|
+
globalVariables: GlobalVariables,
|
|
23
|
+
setupAllowList: AllowedFunction[],
|
|
24
|
+
teardownAllowList: AllowedFunction[],
|
|
25
|
+
): TxValidator<Tx> {
|
|
26
|
+
return new AggregateTxValidator(
|
|
27
|
+
new MetadataTxValidator(globalVariables),
|
|
28
|
+
new DoubleSpendTxValidator(new WorldStateDB(this.merkleTreeDb)),
|
|
29
|
+
new PhasesTxValidator(this.contractDataSource, setupAllowList, teardownAllowList),
|
|
30
|
+
new GasTxValidator(new WorldStatePublicDB(this.merkleTreeDb), getCanonicalGasTokenAddress(this.gasPortalAddress)),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
validatorForProcessedTxs(): TxValidator<ProcessedTx> {
|
|
35
|
+
return new DoubleSpendTxValidator(new WorldStateDB(this.merkleTreeDb));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { type SimulationError, type Tx, type UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
|
-
import { Fr, type GlobalVariables, type Header, type KernelCircuitPublicInputs, type PrivateKernelTailCircuitPublicInputs, type Proof, PublicCallData, type PublicCallRequest, PublicCallStackItem, PublicCircuitPublicInputs, type PublicKernelCircuitPublicInputs, PublicKernelData } from '@aztec/circuits.js';
|
|
3
|
-
import { type ProcessReturnValues } from '@aztec/foundation/abi';
|
|
4
|
-
import { type DebugLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { type PublicExecutionResult, type PublicExecutor } from '@aztec/simulator';
|
|
6
|
-
import { type MerkleTreeOperations } from '@aztec/world-state';
|
|
7
|
-
import { type PublicKernelCircuitSimulator } from '../simulator/index.js';
|
|
8
|
-
import { HintsBuilder } from './hints_builder.js';
|
|
9
|
-
export declare enum PublicKernelPhase {
|
|
10
|
-
SETUP = "setup",
|
|
11
|
-
APP_LOGIC = "app-logic",
|
|
12
|
-
TEARDOWN = "teardown",
|
|
13
|
-
TAIL = "tail"
|
|
14
|
-
}
|
|
15
|
-
export declare const PhaseIsRevertible: Record<PublicKernelPhase, boolean>;
|
|
16
|
-
export declare abstract class AbstractPhaseManager {
|
|
17
|
-
protected db: MerkleTreeOperations;
|
|
18
|
-
protected publicExecutor: PublicExecutor;
|
|
19
|
-
protected publicKernel: PublicKernelCircuitSimulator;
|
|
20
|
-
protected globalVariables: GlobalVariables;
|
|
21
|
-
protected historicalHeader: Header;
|
|
22
|
-
phase: PublicKernelPhase;
|
|
23
|
-
protected hintsBuilder: HintsBuilder;
|
|
24
|
-
protected log: DebugLogger;
|
|
25
|
-
constructor(db: MerkleTreeOperations, publicExecutor: PublicExecutor, publicKernel: PublicKernelCircuitSimulator, globalVariables: GlobalVariables, historicalHeader: Header, phase: PublicKernelPhase);
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param tx - the tx to be processed
|
|
29
|
-
* @param publicKernelPublicInputs - the output of the public kernel circuit for the previous phase
|
|
30
|
-
* @param previousPublicKernelProof - the proof of the public kernel circuit for the previous phase
|
|
31
|
-
*/
|
|
32
|
-
abstract handle(tx: Tx, publicKernelPublicInputs: PublicKernelCircuitPublicInputs, previousPublicKernelProof: Proof): Promise<{
|
|
33
|
-
/**
|
|
34
|
-
* the output of the public kernel circuit for this phase
|
|
35
|
-
*/
|
|
36
|
-
publicKernelOutput: PublicKernelCircuitPublicInputs;
|
|
37
|
-
/**
|
|
38
|
-
* the final output of the public kernel circuit for this phase
|
|
39
|
-
*/
|
|
40
|
-
finalKernelOutput?: KernelCircuitPublicInputs;
|
|
41
|
-
/**
|
|
42
|
-
* the proof of the public kernel circuit for this phase
|
|
43
|
-
*/
|
|
44
|
-
publicKernelProof: Proof;
|
|
45
|
-
/**
|
|
46
|
-
* revert reason, if any
|
|
47
|
-
*/
|
|
48
|
-
revertReason: SimulationError | undefined;
|
|
49
|
-
returnValues: ProcessReturnValues;
|
|
50
|
-
}>;
|
|
51
|
-
static extractEnqueuedPublicCallsByPhase(publicInputs: PrivateKernelTailCircuitPublicInputs, enqueuedPublicFunctionCalls: PublicCallRequest[]): Record<PublicKernelPhase, PublicCallRequest[]>;
|
|
52
|
-
protected extractEnqueuedPublicCalls(tx: Tx): PublicCallRequest[];
|
|
53
|
-
protected processEnqueuedPublicCalls(tx: Tx, previousPublicKernelOutput: PublicKernelCircuitPublicInputs, previousPublicKernelProof: Proof): Promise<[
|
|
54
|
-
PublicKernelCircuitPublicInputs,
|
|
55
|
-
Proof,
|
|
56
|
-
UnencryptedFunctionL2Logs[],
|
|
57
|
-
SimulationError | undefined,
|
|
58
|
-
ProcessReturnValues
|
|
59
|
-
]>;
|
|
60
|
-
protected runKernelCircuit(previousOutput: PublicKernelCircuitPublicInputs, previousProof: Proof, callData: PublicCallData): Promise<[PublicKernelCircuitPublicInputs, Proof]>;
|
|
61
|
-
protected getKernelCircuitOutput(previousOutput: PublicKernelCircuitPublicInputs, previousProof: Proof, callData: PublicCallData): Promise<PublicKernelCircuitPublicInputs>;
|
|
62
|
-
protected getPreviousKernelData(previousOutput: PublicKernelCircuitPublicInputs, previousProof: Proof): PublicKernelData;
|
|
63
|
-
protected getPublicCircuitPublicInputs(result: PublicExecutionResult): Promise<PublicCircuitPublicInputs>;
|
|
64
|
-
protected getPublicCallStackItem(result: PublicExecutionResult, isExecutionRequest?: boolean): Promise<PublicCallStackItem>;
|
|
65
|
-
protected getPublicCallStackPreimages(result: PublicExecutionResult): Promise<PublicCallStackItem[]>;
|
|
66
|
-
protected getBytecodeHash(_result: PublicExecutionResult): Promise<Fr>;
|
|
67
|
-
/**
|
|
68
|
-
* Calculates the PublicCircuitOutput for this execution result along with its proof,
|
|
69
|
-
* and assembles a PublicCallData object from it.
|
|
70
|
-
* @param result - The execution result.
|
|
71
|
-
* @param preimages - The preimages of the callstack items.
|
|
72
|
-
* @param isExecutionRequest - Whether the current callstack item should be considered a public fn execution request.
|
|
73
|
-
* @returns A corresponding PublicCallData object.
|
|
74
|
-
*/
|
|
75
|
-
protected getPublicCallData(result: PublicExecutionResult, isExecutionRequest?: boolean): Promise<PublicCallData>;
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=abstract_phase_manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract_phase_manager.d.ts","sourceRoot":"","sources":["../../src/sequencer/abstract_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