@aztec/sequencer-client 0.82.0 → 0.82.1
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/publisher/sequencer-publisher.d.ts +3 -3
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/tx_validator/gas_validator.js +7 -9
- package/dest/tx_validator/phases_validator.d.ts +2 -2
- package/dest/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/tx_validator/phases_validator.js +5 -4
- package/dest/tx_validator/test_utils.d.ts +3 -9
- package/dest/tx_validator/test_utils.d.ts.map +1 -1
- package/dest/tx_validator/test_utils.js +12 -16
- package/package.json +25 -25
- package/src/tx_validator/gas_validator.ts +13 -14
- package/src/tx_validator/phases_validator.ts +11 -7
- package/src/tx_validator/test_utils.ts +15 -20
|
@@ -36,14 +36,14 @@ export declare class SequencerPublisher {
|
|
|
36
36
|
private metrics;
|
|
37
37
|
private epochCache;
|
|
38
38
|
private forwarderContract;
|
|
39
|
-
protected governanceLog: import("@aztec/
|
|
39
|
+
protected governanceLog: import("@aztec/foundation/log").Logger;
|
|
40
40
|
protected governanceProposerAddress?: EthAddress;
|
|
41
41
|
private governancePayload;
|
|
42
|
-
protected slashingLog: import("@aztec/
|
|
42
|
+
protected slashingLog: import("@aztec/foundation/log").Logger;
|
|
43
43
|
protected slashingProposerAddress?: EthAddress;
|
|
44
44
|
private getSlashPayload?;
|
|
45
45
|
private myLastVotes;
|
|
46
|
-
protected log: import("@aztec/
|
|
46
|
+
protected log: import("@aztec/foundation/log").Logger;
|
|
47
47
|
protected ethereumSlotDuration: bigint;
|
|
48
48
|
private blobSinkClient;
|
|
49
49
|
static PROPOSE_GAS_GUESS: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":";;AAAA,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BAAa,cAAe,YAAW,WAAW,CAAC,EAAE,CAAC;;gBAMxC,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO;IAM1F,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"gas_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/gas_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,EAAoB,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExG,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;CACvE;AAED,qBAAa,cAAe,YAAW,WAAW,CAAC,EAAE,CAAC;;gBAMxC,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO;IAM1F,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAyEtD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
3
|
-
import {
|
|
3
|
+
import { getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
4
4
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import { TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
6
6
|
export class GasTxValidator {
|
|
@@ -49,15 +49,13 @@ export class GasTxValidator {
|
|
|
49
49
|
// Read current balance of the feePayer
|
|
50
50
|
const initialBalance = await this.#publicDataSource.storageRead(this.#feeJuiceAddress, await computeFeePayerBalanceStorageSlot(feePayer));
|
|
51
51
|
// If there is a claim in this tx that increases the fee payer balance in Fee Juice, add it to balance
|
|
52
|
-
const setupFns =
|
|
52
|
+
const setupFns = getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.SETUP);
|
|
53
53
|
const increasePublicBalanceSelector = await FunctionSelector.fromSignature('_increase_public_balance((Field),u128)');
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// - Index 2: Amount being claimed
|
|
60
|
-
const balance = claimFunctionCall ? initialBalance.add(claimFunctionCall.args[2]) : initialBalance;
|
|
54
|
+
// Arguments of the claim function call:
|
|
55
|
+
// - args[0]: Amount recipient.
|
|
56
|
+
// - args[1]: Amount being claimed.
|
|
57
|
+
const claimFunctionCall = setupFns.find((fn)=>fn.request.contractAddress.equals(this.#feeJuiceAddress) && fn.request.msgSender.equals(this.#feeJuiceAddress) && fn.calldata.length > 2 && fn.functionSelector.equals(increasePublicBalanceSelector) && fn.args[0].equals(feePayer.toField()) && !fn.request.isStaticCall);
|
|
58
|
+
const balance = claimFunctionCall ? initialBalance.add(claimFunctionCall.args[1]) : initialBalance;
|
|
61
59
|
if (balance.lt(feeLimit)) {
|
|
62
60
|
this.#log.warn(`Rejecting transaction due to not enough fee payer balance`, {
|
|
63
61
|
feePayer,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
2
2
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
import {
|
|
3
|
+
import { Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
export declare class PhasesTxValidator implements TxValidator<Tx> {
|
|
5
5
|
#private;
|
|
6
6
|
private setupAllowList;
|
|
@@ -8,6 +8,6 @@ export declare class PhasesTxValidator implements TxValidator<Tx> {
|
|
|
8
8
|
private contractsDB;
|
|
9
9
|
constructor(contracts: ContractDataSource, setupAllowList: AllowedElement[], blockNumber: number);
|
|
10
10
|
validateTx(tx: Tx): Promise<TxValidationResult>;
|
|
11
|
-
isOnAllowList
|
|
11
|
+
private isOnAllowList;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=phases_validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phases_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/phases_validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"phases_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/phases_validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAEL,EAAE,EAEF,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,WAAW,CAAC,EAAE,CAAC;;IAIZ,OAAO,CAAC,cAAc;IAAoB,OAAO,CAAC,WAAW;IAFxG,OAAO,CAAC,WAAW,CAAoB;gBAE3B,SAAS,EAAE,kBAAkB,EAAU,cAAc,EAAE,cAAc,EAAE,EAAU,WAAW,EAAE,MAAM;IAI1G,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAkCvC,aAAa;CAiD5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { PublicContractsDB,
|
|
2
|
+
import { PublicContractsDB, getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
3
3
|
import { Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
4
4
|
export class PhasesTxValidator {
|
|
5
5
|
setupAllowList;
|
|
@@ -24,10 +24,10 @@ export class PhasesTxValidator {
|
|
|
24
24
|
result: 'valid'
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
const setupFns =
|
|
27
|
+
const setupFns = getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.SETUP);
|
|
28
28
|
for (const setupFn of setupFns){
|
|
29
29
|
if (!await this.isOnAllowList(setupFn, this.setupAllowList)) {
|
|
30
|
-
this.#log.warn(`Rejecting tx ${await Tx.getHash(tx)} because it calls setup function not on allow list: ${setupFn.
|
|
30
|
+
this.#log.warn(`Rejecting tx ${await Tx.getHash(tx)} because it calls setup function not on allow list: ${setupFn.request.contractAddress}:${setupFn.functionSelector}`, {
|
|
31
31
|
allowList: this.setupAllowList
|
|
32
32
|
});
|
|
33
33
|
return {
|
|
@@ -49,7 +49,8 @@ export class PhasesTxValidator {
|
|
|
49
49
|
if (publicCall.isEmpty()) {
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const contractAddress = publicCall.request.contractAddress;
|
|
53
|
+
const functionSelector = publicCall.functionSelector;
|
|
53
54
|
// do these checks first since they don't require the contract class
|
|
54
55
|
for (const entry of allowList){
|
|
55
56
|
if ('address' in entry && !('selector' in entry)) {
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type
|
|
4
|
+
import { type Tx } from '@aztec/stdlib/tx';
|
|
5
5
|
export declare function patchNonRevertibleFn(tx: Tx, index: number, overrides: {
|
|
6
6
|
address?: AztecAddress;
|
|
7
7
|
selector: FunctionSelector;
|
|
8
8
|
args?: Fr[];
|
|
9
9
|
msgSender?: AztecAddress;
|
|
10
|
-
}): Promise<
|
|
11
|
-
address: AztecAddress;
|
|
12
|
-
selector: FunctionSelector;
|
|
13
|
-
}>;
|
|
10
|
+
}): Promise<AztecAddress>;
|
|
14
11
|
export declare function patchRevertibleFn(tx: Tx, index: number, overrides: {
|
|
15
12
|
address?: AztecAddress;
|
|
16
13
|
selector: FunctionSelector;
|
|
17
14
|
args?: Fr[];
|
|
18
15
|
msgSender?: AztecAddress;
|
|
19
|
-
}): Promise<
|
|
20
|
-
address: AztecAddress;
|
|
21
|
-
selector: FunctionSelector;
|
|
22
|
-
}>;
|
|
16
|
+
}): Promise<AztecAddress>;
|
|
23
17
|
//# sourceMappingURL=test_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_utils.d.ts","sourceRoot":"","sources":["../../src/tx_validator/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"test_utils.d.ts","sourceRoot":"","sources":["../../src/tx_validator/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAgB,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEzD,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,EACb,SAAS,EAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,GACvG,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,EACb,SAAS,EAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,GACvG,OAAO,CAAC,YAAY,CAAC,CAEvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HashedValues } from '@aztec/stdlib/tx';
|
|
2
2
|
export function patchNonRevertibleFn(tx, index, overrides) {
|
|
3
3
|
return patchFn('nonRevertibleAccumulatedData', tx, index, overrides);
|
|
4
4
|
}
|
|
@@ -6,21 +6,17 @@ export function patchRevertibleFn(tx, index, overrides) {
|
|
|
6
6
|
return patchFn('revertibleAccumulatedData', tx, index, overrides);
|
|
7
7
|
}
|
|
8
8
|
async function patchFn(where, tx, index, overrides) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const calldataIndex = where === 'nonRevertibleAccumulatedData' ? index : index + tx.data.forPublic.nonRevertibleAccumulatedData.publicCallRequests.length;
|
|
10
|
+
const calldata = [
|
|
11
|
+
overrides.selector.toField(),
|
|
12
|
+
...overrides.args ?? []
|
|
13
|
+
];
|
|
14
|
+
const hashedCalldata = await HashedValues.fromCalldata(calldata);
|
|
15
|
+
tx.publicFunctionCalldata[calldataIndex] = hashedCalldata;
|
|
15
16
|
const request = tx.data.forPublic[where].publicCallRequests[index];
|
|
16
|
-
request.contractAddress =
|
|
17
|
-
request.msgSender =
|
|
18
|
-
request.
|
|
19
|
-
request.isStaticCall = fn.callContext.isStaticCall;
|
|
20
|
-
request.argsHash = await computeVarArgsHash(fn.args);
|
|
17
|
+
request.contractAddress = overrides.address ?? request.contractAddress;
|
|
18
|
+
request.msgSender = overrides.msgSender ?? request.msgSender;
|
|
19
|
+
request.calldataHash = hashedCalldata.hash;
|
|
21
20
|
tx.data.forPublic[where].publicCallRequests[index] = request;
|
|
22
|
-
return
|
|
23
|
-
address: fn.callContext.contractAddress,
|
|
24
|
-
selector: fn.callContext.functionSelector
|
|
25
|
-
};
|
|
21
|
+
return request.contractAddress;
|
|
26
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/aztec.js": "0.82.
|
|
32
|
-
"@aztec/bb-prover": "0.82.
|
|
33
|
-
"@aztec/blob-lib": "0.82.
|
|
34
|
-
"@aztec/blob-sink": "0.82.
|
|
35
|
-
"@aztec/constants": "0.82.
|
|
36
|
-
"@aztec/epoch-cache": "0.82.
|
|
37
|
-
"@aztec/ethereum": "0.82.
|
|
38
|
-
"@aztec/foundation": "0.82.
|
|
39
|
-
"@aztec/l1-artifacts": "0.82.
|
|
40
|
-
"@aztec/merkle-tree": "0.82.
|
|
41
|
-
"@aztec/noir-acvm_js": "0.82.
|
|
42
|
-
"@aztec/noir-contracts.js": "0.82.
|
|
43
|
-
"@aztec/noir-protocol-circuits-types": "0.82.
|
|
44
|
-
"@aztec/noir-types": "0.82.
|
|
45
|
-
"@aztec/p2p": "0.82.
|
|
46
|
-
"@aztec/protocol-contracts": "0.82.
|
|
47
|
-
"@aztec/prover-client": "0.82.
|
|
48
|
-
"@aztec/simulator": "0.82.
|
|
49
|
-
"@aztec/stdlib": "0.82.
|
|
50
|
-
"@aztec/telemetry-client": "0.82.
|
|
51
|
-
"@aztec/validator-client": "0.82.
|
|
52
|
-
"@aztec/world-state": "0.82.
|
|
31
|
+
"@aztec/aztec.js": "0.82.1",
|
|
32
|
+
"@aztec/bb-prover": "0.82.1",
|
|
33
|
+
"@aztec/blob-lib": "0.82.1",
|
|
34
|
+
"@aztec/blob-sink": "0.82.1",
|
|
35
|
+
"@aztec/constants": "0.82.1",
|
|
36
|
+
"@aztec/epoch-cache": "0.82.1",
|
|
37
|
+
"@aztec/ethereum": "0.82.1",
|
|
38
|
+
"@aztec/foundation": "0.82.1",
|
|
39
|
+
"@aztec/l1-artifacts": "0.82.1",
|
|
40
|
+
"@aztec/merkle-tree": "0.82.1",
|
|
41
|
+
"@aztec/noir-acvm_js": "0.82.1",
|
|
42
|
+
"@aztec/noir-contracts.js": "0.82.1",
|
|
43
|
+
"@aztec/noir-protocol-circuits-types": "0.82.1",
|
|
44
|
+
"@aztec/noir-types": "0.82.1",
|
|
45
|
+
"@aztec/p2p": "0.82.1",
|
|
46
|
+
"@aztec/protocol-contracts": "0.82.1",
|
|
47
|
+
"@aztec/prover-client": "0.82.1",
|
|
48
|
+
"@aztec/simulator": "0.82.1",
|
|
49
|
+
"@aztec/stdlib": "0.82.1",
|
|
50
|
+
"@aztec/telemetry-client": "0.82.1",
|
|
51
|
+
"@aztec/validator-client": "0.82.1",
|
|
52
|
+
"@aztec/world-state": "0.82.1",
|
|
53
53
|
"lodash.chunk": "^4.2.0",
|
|
54
54
|
"lodash.pick": "^4.4.0",
|
|
55
55
|
"tslib": "^2.4.0",
|
|
56
56
|
"viem": "2.23.7"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.82.
|
|
60
|
-
"@aztec/kv-store": "0.82.
|
|
59
|
+
"@aztec/archiver": "0.82.1",
|
|
60
|
+
"@aztec/kv-store": "0.82.1",
|
|
61
61
|
"@jest/globals": "^29.5.0",
|
|
62
62
|
"@types/jest": "^29.5.0",
|
|
63
63
|
"@types/levelup": "^5.1.2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
4
|
-
import {
|
|
4
|
+
import { getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
5
5
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
@@ -68,26 +68,25 @@ export class GasTxValidator implements TxValidator<Tx> {
|
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
// If there is a claim in this tx that increases the fee payer balance in Fee Juice, add it to balance
|
|
71
|
-
const setupFns =
|
|
71
|
+
const setupFns = getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.SETUP);
|
|
72
72
|
const increasePublicBalanceSelector = await FunctionSelector.fromSignature(
|
|
73
73
|
'_increase_public_balance((Field),u128)',
|
|
74
74
|
);
|
|
75
|
+
|
|
76
|
+
// Arguments of the claim function call:
|
|
77
|
+
// - args[0]: Amount recipient.
|
|
78
|
+
// - args[1]: Amount being claimed.
|
|
75
79
|
const claimFunctionCall = setupFns.find(
|
|
76
80
|
fn =>
|
|
77
|
-
fn.
|
|
78
|
-
fn.
|
|
79
|
-
fn.
|
|
80
|
-
|
|
81
|
-
fn.args[0].equals(
|
|
82
|
-
fn.
|
|
83
|
-
!fn.callContext.isStaticCall,
|
|
81
|
+
fn.request.contractAddress.equals(this.#feeJuiceAddress) &&
|
|
82
|
+
fn.request.msgSender.equals(this.#feeJuiceAddress) &&
|
|
83
|
+
fn.calldata.length > 2 &&
|
|
84
|
+
fn.functionSelector.equals(increasePublicBalanceSelector) &&
|
|
85
|
+
fn.args[0].equals(feePayer.toField()) &&
|
|
86
|
+
!fn.request.isStaticCall,
|
|
84
87
|
);
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
// - Index 0: Target function selector (due to dispatch routing)
|
|
88
|
-
// - Index 1: Amount recipient
|
|
89
|
-
// - Index 2: Amount being claimed
|
|
90
|
-
const balance = claimFunctionCall ? initialBalance.add(claimFunctionCall.args[2]) : initialBalance;
|
|
89
|
+
const balance = claimFunctionCall ? initialBalance.add(claimFunctionCall.args[1]) : initialBalance;
|
|
91
90
|
if (balance.lt(feeLimit)) {
|
|
92
91
|
this.#log.warn(`Rejecting transaction due to not enough fee payer balance`, {
|
|
93
92
|
feePayer,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { PublicContractsDB,
|
|
2
|
+
import { PublicContractsDB, getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
3
3
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
PublicCallRequestWithCalldata,
|
|
7
7
|
Tx,
|
|
8
8
|
TxExecutionPhase,
|
|
9
9
|
type TxValidationResult,
|
|
@@ -32,13 +32,13 @@ export class PhasesTxValidator implements TxValidator<Tx> {
|
|
|
32
32
|
return { result: 'valid' };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const setupFns =
|
|
35
|
+
const setupFns = getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.SETUP);
|
|
36
36
|
for (const setupFn of setupFns) {
|
|
37
37
|
if (!(await this.isOnAllowList(setupFn, this.setupAllowList))) {
|
|
38
38
|
this.#log.warn(
|
|
39
39
|
`Rejecting tx ${await Tx.getHash(tx)} because it calls setup function not on allow list: ${
|
|
40
|
-
setupFn.
|
|
41
|
-
}:${setupFn.
|
|
40
|
+
setupFn.request.contractAddress
|
|
41
|
+
}:${setupFn.functionSelector}`,
|
|
42
42
|
{ allowList: this.setupAllowList },
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -52,12 +52,16 @@ export class PhasesTxValidator implements TxValidator<Tx> {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
async isOnAllowList(
|
|
55
|
+
private async isOnAllowList(
|
|
56
|
+
publicCall: PublicCallRequestWithCalldata,
|
|
57
|
+
allowList: AllowedElement[],
|
|
58
|
+
): Promise<boolean> {
|
|
56
59
|
if (publicCall.isEmpty()) {
|
|
57
60
|
return true;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
const
|
|
63
|
+
const contractAddress = publicCall.request.contractAddress;
|
|
64
|
+
const functionSelector = publicCall.functionSelector;
|
|
61
65
|
|
|
62
66
|
// do these checks first since they don't require the contract class
|
|
63
67
|
for (const entry of allowList) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import {
|
|
5
|
-
import type { Tx } from '@aztec/stdlib/tx';
|
|
4
|
+
import { HashedValues, type Tx } from '@aztec/stdlib/tx';
|
|
6
5
|
|
|
7
6
|
export function patchNonRevertibleFn(
|
|
8
7
|
tx: Tx,
|
|
9
8
|
index: number,
|
|
10
9
|
overrides: { address?: AztecAddress; selector: FunctionSelector; args?: Fr[]; msgSender?: AztecAddress },
|
|
11
|
-
): Promise<
|
|
10
|
+
): Promise<AztecAddress> {
|
|
12
11
|
return patchFn('nonRevertibleAccumulatedData', tx, index, overrides);
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -16,7 +15,7 @@ export function patchRevertibleFn(
|
|
|
16
15
|
tx: Tx,
|
|
17
16
|
index: number,
|
|
18
17
|
overrides: { address?: AztecAddress; selector: FunctionSelector; args?: Fr[]; msgSender?: AztecAddress },
|
|
19
|
-
): Promise<
|
|
18
|
+
): Promise<AztecAddress> {
|
|
20
19
|
return patchFn('revertibleAccumulatedData', tx, index, overrides);
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -25,24 +24,20 @@ async function patchFn(
|
|
|
25
24
|
tx: Tx,
|
|
26
25
|
index: number,
|
|
27
26
|
overrides: { address?: AztecAddress; selector: FunctionSelector; args?: Fr[]; msgSender?: AztecAddress },
|
|
28
|
-
): Promise<
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
): Promise<AztecAddress> {
|
|
28
|
+
const calldataIndex =
|
|
29
|
+
where === 'nonRevertibleAccumulatedData'
|
|
30
|
+
? index
|
|
31
|
+
: index + tx.data.forPublic!.nonRevertibleAccumulatedData.publicCallRequests.length;
|
|
32
|
+
const calldata = [overrides.selector.toField(), ...(overrides.args ?? [])];
|
|
33
|
+
const hashedCalldata = await HashedValues.fromCalldata(calldata);
|
|
34
|
+
tx.publicFunctionCalldata[calldataIndex] = hashedCalldata;
|
|
35
35
|
|
|
36
36
|
const request = tx.data.forPublic![where].publicCallRequests[index];
|
|
37
|
-
request.contractAddress =
|
|
38
|
-
request.msgSender =
|
|
39
|
-
request.
|
|
40
|
-
request.isStaticCall = fn.callContext.isStaticCall;
|
|
41
|
-
request.argsHash = await computeVarArgsHash(fn.args);
|
|
37
|
+
request.contractAddress = overrides.address ?? request.contractAddress;
|
|
38
|
+
request.msgSender = overrides.msgSender ?? request.msgSender;
|
|
39
|
+
request.calldataHash = hashedCalldata.hash;
|
|
42
40
|
tx.data.forPublic![where].publicCallRequests[index] = request;
|
|
43
41
|
|
|
44
|
-
return
|
|
45
|
-
address: fn.callContext.contractAddress,
|
|
46
|
-
selector: fn.callContext.functionSelector,
|
|
47
|
-
};
|
|
42
|
+
return request.contractAddress;
|
|
48
43
|
}
|