@aztec/aztec 1.0.0-nightly.20250708 → 1.0.0-nightly.20250710
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/cli/chain_l2_config.d.ts +1 -0
- package/dest/cli/chain_l2_config.d.ts.map +1 -1
- package/dest/cli/chain_l2_config.js +3 -0
- package/dest/sandbox/banana_fpc.js +3 -3
- package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
- package/dest/sandbox/sponsored_fpc.js +2 -2
- package/dest/testing/cheat_codes.d.ts +22 -1
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +35 -0
- package/package.json +31 -31
- package/src/cli/chain_l2_config.ts +4 -0
- package/src/sandbox/banana_fpc.ts +3 -3
- package/src/sandbox/sponsored_fpc.ts +7 -2
- package/src/testing/cheat_codes.ts +42 -1
|
@@ -53,6 +53,7 @@ export type L2ChainConfig = {
|
|
|
53
53
|
slashInactivityCreateTargetPercentage: number;
|
|
54
54
|
slashInactivitySignalTargetPercentage: number;
|
|
55
55
|
slashInactivityCreatePenalty: bigint;
|
|
56
|
+
slashInactivityMaxPenalty: bigint;
|
|
56
57
|
slashInvalidBlockEnabled: boolean;
|
|
57
58
|
slashInvalidBlockPenalty: bigint;
|
|
58
59
|
slashInvalidBlockMaxPenalty: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/cli/chain_l2_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,i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AG,SAAS,CAAC,CAWrE;AAmBD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA2E/E"}
|
|
@@ -39,6 +39,7 @@ export const testnetIgnitionL2ChainConfig = {
|
|
|
39
39
|
slashInactivityCreateTargetPercentage: 0,
|
|
40
40
|
slashInactivitySignalTargetPercentage: 0,
|
|
41
41
|
slashInactivityCreatePenalty: 0n,
|
|
42
|
+
slashInactivityMaxPenalty: 0n,
|
|
42
43
|
slashInvalidBlockEnabled: false,
|
|
43
44
|
slashPayloadTtlSeconds: 0,
|
|
44
45
|
slashPruneEnabled: false,
|
|
@@ -91,6 +92,7 @@ export const alphaTestnetL2ChainConfig = {
|
|
|
91
92
|
slashInactivityCreateTargetPercentage: 1,
|
|
92
93
|
slashInactivitySignalTargetPercentage: 1,
|
|
93
94
|
slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
95
|
+
slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
94
96
|
slashInvalidBlockEnabled: true,
|
|
95
97
|
slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
96
98
|
slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount
|
|
@@ -203,6 +205,7 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
203
205
|
enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
|
|
204
206
|
enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
|
|
205
207
|
enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
|
|
208
|
+
enrichVar('SLASH_INACTIVITY_MAX_PENALTY', config.slashInactivityMaxPenalty.toString());
|
|
206
209
|
enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
|
|
207
210
|
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
|
|
208
211
|
enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
|
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import {
|
|
6
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
7
7
|
const BANANA_COIN_SALT = new Fr(0);
|
|
8
8
|
const bananaCoinArgs = {
|
|
9
9
|
name: 'BC',
|
|
@@ -16,7 +16,7 @@ function getBananaAdmin(initialAccounts) {
|
|
|
16
16
|
}
|
|
17
17
|
async function getBananaCoinInstance(initialAccounts) {
|
|
18
18
|
const admin = getBananaAdmin(initialAccounts);
|
|
19
|
-
return await
|
|
19
|
+
return await getContractInstanceFromInstantiationParams(TokenContract.artifact, {
|
|
20
20
|
constructorArgs: [
|
|
21
21
|
admin,
|
|
22
22
|
bananaCoinArgs.name,
|
|
@@ -32,7 +32,7 @@ export async function getBananaCoinAddress(initialAccounts) {
|
|
|
32
32
|
async function getBananaFPCInstance(initialAccounts) {
|
|
33
33
|
const bananaCoin = await getBananaCoinAddress(initialAccounts);
|
|
34
34
|
const admin = getBananaAdmin(initialAccounts);
|
|
35
|
-
return await
|
|
35
|
+
return await getContractInstanceFromInstantiationParams(FPCContract.artifact, {
|
|
36
36
|
constructorArgs: [
|
|
37
37
|
bananaCoin,
|
|
38
38
|
admin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/sponsored_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sponsored_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/sponsored_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EAET,MAAM,iBAAiB,CAAC;AAUzB,wBAAsB,sBAAsB,oDAE3C;AAED,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,GAAG,mDAO5D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Fr,
|
|
1
|
+
import { Fr, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
|
|
2
2
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
3
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
4
4
|
async function getSponsoredFPCInstance() {
|
|
5
|
-
return await
|
|
5
|
+
return await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
6
6
|
salt: new Fr(SPONSORED_FPC_SALT)
|
|
7
7
|
});
|
|
8
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
3
|
+
import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
4
|
import { AztecCheatCodes } from './aztec_cheat_codes.js';
|
|
4
5
|
/**
|
|
5
6
|
* A class that provides utility functions for interacting with the chain.
|
|
@@ -19,5 +20,25 @@ export declare class CheatCodes {
|
|
|
19
20
|
/** Cheat codes for the Aztec Rollup contract on L1. */
|
|
20
21
|
rollup: RollupCheatCodes);
|
|
21
22
|
static create(rpcUrls: string[], pxe: PXE): Promise<CheatCodes>;
|
|
23
|
+
/**
|
|
24
|
+
* Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
|
|
25
|
+
* the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
|
|
26
|
+
* by the slot number, which advances in fixed intervals.
|
|
27
|
+
* This is useful for testing time-dependent contract behavior.
|
|
28
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
29
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
30
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
31
|
+
*/
|
|
32
|
+
warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
|
|
35
|
+
* least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
|
|
36
|
+
* number, which advances in fixed intervals.
|
|
37
|
+
* This is useful for testing time-dependent contract behavior.
|
|
38
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
39
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
40
|
+
* @param duration - The duration to advance time by (in seconds)
|
|
41
|
+
*/
|
|
42
|
+
warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
|
|
22
43
|
}
|
|
23
44
|
//# sourceMappingURL=cheat_codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,gCAAgC;IACzB,KAAK,EAAE,eAAe;IAC7B,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;;IAL/B,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,gCAAgC;IACzB,KAAK,EAAE,eAAe;IAC7B,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;WAGpB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAUrE;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IAe7G;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAKvG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
2
3
|
import { AztecCheatCodes } from './aztec_cheat_codes.js';
|
|
3
4
|
/**
|
|
4
5
|
* A class that provides utility functions for interacting with the chain.
|
|
@@ -17,4 +18,38 @@ import { AztecCheatCodes } from './aztec_cheat_codes.js';
|
|
|
17
18
|
const rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, await pxe.getNodeInfo().then((n)=>n.l1ContractAddresses));
|
|
18
19
|
return new CheatCodes(ethCheatCodes, aztecCheatCodes, rollupCheatCodes);
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
|
|
23
|
+
* the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
|
|
24
|
+
* by the slot number, which advances in fixed intervals.
|
|
25
|
+
* This is useful for testing time-dependent contract behavior.
|
|
26
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
27
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
28
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
29
|
+
*/ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
|
|
30
|
+
const currentL2BlockNumber = await node.getBlockNumber();
|
|
31
|
+
// We warp the L1 timestamp
|
|
32
|
+
await this.eth.warp(targetTimestamp, {
|
|
33
|
+
resetBlockInterval: true
|
|
34
|
+
});
|
|
35
|
+
// Force an empty block to be mined by "flushing" the sequencer.
|
|
36
|
+
sequencerClient.getSequencer().flush();
|
|
37
|
+
// Wait for a new block to be mined by polling the node
|
|
38
|
+
while(await node.getBlockNumber() === currentL2BlockNumber){
|
|
39
|
+
await sleep(2000);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
|
|
44
|
+
* least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
|
|
45
|
+
* number, which advances in fixed intervals.
|
|
46
|
+
* This is useful for testing time-dependent contract behavior.
|
|
47
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
48
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
49
|
+
* @param duration - The duration to advance time by (in seconds)
|
|
50
|
+
*/ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
|
|
51
|
+
const currentTimestamp = await this.eth.timestamp();
|
|
52
|
+
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
53
|
+
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
54
|
+
}
|
|
20
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250710",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "1.0.0-nightly.
|
|
32
|
-
"@aztec/archiver": "1.0.0-nightly.
|
|
33
|
-
"@aztec/aztec-faucet": "1.0.0-nightly.
|
|
34
|
-
"@aztec/aztec-node": "1.0.0-nightly.
|
|
35
|
-
"@aztec/aztec.js": "1.0.0-nightly.
|
|
36
|
-
"@aztec/bb-prover": "1.0.0-nightly.
|
|
37
|
-
"@aztec/bb.js": "1.0.0-nightly.
|
|
38
|
-
"@aztec/blob-sink": "1.0.0-nightly.
|
|
39
|
-
"@aztec/bot": "1.0.0-nightly.
|
|
40
|
-
"@aztec/builder": "1.0.0-nightly.
|
|
41
|
-
"@aztec/cli": "1.0.0-nightly.
|
|
42
|
-
"@aztec/cli-wallet": "1.0.0-nightly.
|
|
43
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
44
|
-
"@aztec/entrypoints": "1.0.0-nightly.
|
|
45
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
46
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
47
|
-
"@aztec/kv-store": "1.0.0-nightly.
|
|
48
|
-
"@aztec/l1-artifacts": "1.0.0-nightly.
|
|
49
|
-
"@aztec/noir-contracts.js": "1.0.0-nightly.
|
|
50
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "1.0.0-nightly.
|
|
52
|
-
"@aztec/p2p-bootstrap": "1.0.0-nightly.
|
|
53
|
-
"@aztec/protocol-contracts": "1.0.0-nightly.
|
|
54
|
-
"@aztec/prover-client": "1.0.0-nightly.
|
|
55
|
-
"@aztec/prover-node": "1.0.0-nightly.
|
|
56
|
-
"@aztec/pxe": "1.0.0-nightly.
|
|
57
|
-
"@aztec/stdlib": "1.0.0-nightly.
|
|
58
|
-
"@aztec/telemetry-client": "1.0.0-nightly.
|
|
59
|
-
"@aztec/txe": "1.0.0-nightly.
|
|
60
|
-
"@aztec/world-state": "1.0.0-nightly.
|
|
31
|
+
"@aztec/accounts": "1.0.0-nightly.20250710",
|
|
32
|
+
"@aztec/archiver": "1.0.0-nightly.20250710",
|
|
33
|
+
"@aztec/aztec-faucet": "1.0.0-nightly.20250710",
|
|
34
|
+
"@aztec/aztec-node": "1.0.0-nightly.20250710",
|
|
35
|
+
"@aztec/aztec.js": "1.0.0-nightly.20250710",
|
|
36
|
+
"@aztec/bb-prover": "1.0.0-nightly.20250710",
|
|
37
|
+
"@aztec/bb.js": "1.0.0-nightly.20250710",
|
|
38
|
+
"@aztec/blob-sink": "1.0.0-nightly.20250710",
|
|
39
|
+
"@aztec/bot": "1.0.0-nightly.20250710",
|
|
40
|
+
"@aztec/builder": "1.0.0-nightly.20250710",
|
|
41
|
+
"@aztec/cli": "1.0.0-nightly.20250710",
|
|
42
|
+
"@aztec/cli-wallet": "1.0.0-nightly.20250710",
|
|
43
|
+
"@aztec/constants": "1.0.0-nightly.20250710",
|
|
44
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250710",
|
|
45
|
+
"@aztec/ethereum": "1.0.0-nightly.20250710",
|
|
46
|
+
"@aztec/foundation": "1.0.0-nightly.20250710",
|
|
47
|
+
"@aztec/kv-store": "1.0.0-nightly.20250710",
|
|
48
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250710",
|
|
49
|
+
"@aztec/noir-contracts.js": "1.0.0-nightly.20250710",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.20250710",
|
|
51
|
+
"@aztec/p2p": "1.0.0-nightly.20250710",
|
|
52
|
+
"@aztec/p2p-bootstrap": "1.0.0-nightly.20250710",
|
|
53
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250710",
|
|
54
|
+
"@aztec/prover-client": "1.0.0-nightly.20250710",
|
|
55
|
+
"@aztec/prover-node": "1.0.0-nightly.20250710",
|
|
56
|
+
"@aztec/pxe": "1.0.0-nightly.20250710",
|
|
57
|
+
"@aztec/stdlib": "1.0.0-nightly.20250710",
|
|
58
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250710",
|
|
59
|
+
"@aztec/txe": "1.0.0-nightly.20250710",
|
|
60
|
+
"@aztec/world-state": "1.0.0-nightly.20250710",
|
|
61
61
|
"@types/chalk": "^2.2.0",
|
|
62
62
|
"abitype": "^0.8.11",
|
|
63
63
|
"chalk": "^5.3.0",
|
|
@@ -65,6 +65,7 @@ export type L2ChainConfig = {
|
|
|
65
65
|
slashInactivityCreateTargetPercentage: number;
|
|
66
66
|
slashInactivitySignalTargetPercentage: number;
|
|
67
67
|
slashInactivityCreatePenalty: bigint;
|
|
68
|
+
slashInactivityMaxPenalty: bigint;
|
|
68
69
|
slashInvalidBlockEnabled: boolean;
|
|
69
70
|
slashInvalidBlockPenalty: bigint;
|
|
70
71
|
slashInvalidBlockMaxPenalty: bigint;
|
|
@@ -120,6 +121,7 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
120
121
|
slashInactivityCreateTargetPercentage: 0,
|
|
121
122
|
slashInactivitySignalTargetPercentage: 0,
|
|
122
123
|
slashInactivityCreatePenalty: 0n,
|
|
124
|
+
slashInactivityMaxPenalty: 0n,
|
|
123
125
|
slashInvalidBlockEnabled: false,
|
|
124
126
|
slashPayloadTtlSeconds: 0,
|
|
125
127
|
slashPruneEnabled: false,
|
|
@@ -186,6 +188,7 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
|
|
|
186
188
|
slashInactivityCreateTargetPercentage: 1,
|
|
187
189
|
slashInactivitySignalTargetPercentage: 1,
|
|
188
190
|
slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
191
|
+
slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
189
192
|
slashInvalidBlockEnabled: true,
|
|
190
193
|
slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
191
194
|
slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
@@ -307,6 +310,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
307
310
|
enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
|
|
308
311
|
enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
|
|
309
312
|
enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
|
|
313
|
+
enrichVar('SLASH_INACTIVITY_MAX_PENALTY', config.slashInactivityMaxPenalty.toString());
|
|
310
314
|
enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
|
|
311
315
|
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
|
|
312
316
|
enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
|
|
@@ -5,7 +5,7 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
5
5
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
6
6
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
7
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import { type ContractInstanceWithAddress,
|
|
8
|
+
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
9
9
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
10
10
|
|
|
11
11
|
const BANANA_COIN_SALT = new Fr(0);
|
|
@@ -23,7 +23,7 @@ function getBananaAdmin(initialAccounts: InitialAccountData[]): AztecAddress {
|
|
|
23
23
|
|
|
24
24
|
async function getBananaCoinInstance(initialAccounts: InitialAccountData[]): Promise<ContractInstanceWithAddress> {
|
|
25
25
|
const admin = getBananaAdmin(initialAccounts);
|
|
26
|
-
return await
|
|
26
|
+
return await getContractInstanceFromInstantiationParams(TokenContract.artifact, {
|
|
27
27
|
constructorArgs: [admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal],
|
|
28
28
|
salt: BANANA_COIN_SALT,
|
|
29
29
|
});
|
|
@@ -36,7 +36,7 @@ export async function getBananaCoinAddress(initialAccounts: InitialAccountData[]
|
|
|
36
36
|
async function getBananaFPCInstance(initialAccounts: InitialAccountData[]): Promise<ContractInstanceWithAddress> {
|
|
37
37
|
const bananaCoin = await getBananaCoinAddress(initialAccounts);
|
|
38
38
|
const admin = getBananaAdmin(initialAccounts);
|
|
39
|
-
return await
|
|
39
|
+
return await getContractInstanceFromInstantiationParams(FPCContract.artifact, {
|
|
40
40
|
constructorArgs: [bananaCoin, admin],
|
|
41
41
|
salt: BANANA_FPC_SALT,
|
|
42
42
|
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ContractInstanceWithAddress,
|
|
3
|
+
Fr,
|
|
4
|
+
type PXE,
|
|
5
|
+
getContractInstanceFromInstantiationParams,
|
|
6
|
+
} from '@aztec/aztec.js';
|
|
2
7
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
8
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
4
9
|
|
|
5
10
|
async function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress> {
|
|
6
|
-
return await
|
|
11
|
+
return await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
7
12
|
salt: new Fr(SPONSORED_FPC_SALT),
|
|
8
13
|
});
|
|
9
14
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import
|
|
2
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
3
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
4
|
+
import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
5
|
|
|
4
6
|
import { AztecCheatCodes } from './aztec_cheat_codes.js';
|
|
5
7
|
|
|
@@ -25,4 +27,43 @@ export class CheatCodes {
|
|
|
25
27
|
);
|
|
26
28
|
return new CheatCodes(ethCheatCodes, aztecCheatCodes, rollupCheatCodes);
|
|
27
29
|
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
|
|
33
|
+
* the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
|
|
34
|
+
* by the slot number, which advances in fixed intervals.
|
|
35
|
+
* This is useful for testing time-dependent contract behavior.
|
|
36
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
37
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
38
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
39
|
+
*/
|
|
40
|
+
async warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number) {
|
|
41
|
+
const currentL2BlockNumber = await node.getBlockNumber();
|
|
42
|
+
|
|
43
|
+
// We warp the L1 timestamp
|
|
44
|
+
await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
|
|
45
|
+
|
|
46
|
+
// Force an empty block to be mined by "flushing" the sequencer.
|
|
47
|
+
sequencerClient.getSequencer().flush();
|
|
48
|
+
|
|
49
|
+
// Wait for a new block to be mined by polling the node
|
|
50
|
+
while ((await node.getBlockNumber()) === currentL2BlockNumber) {
|
|
51
|
+
await sleep(2000);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
|
|
57
|
+
* least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
|
|
58
|
+
* number, which advances in fixed intervals.
|
|
59
|
+
* This is useful for testing time-dependent contract behavior.
|
|
60
|
+
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
61
|
+
* @param node - The Aztec node used to query if a new block has been mined.
|
|
62
|
+
* @param duration - The duration to advance time by (in seconds)
|
|
63
|
+
*/
|
|
64
|
+
async warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number) {
|
|
65
|
+
const currentTimestamp = await this.eth.timestamp();
|
|
66
|
+
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
67
|
+
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
68
|
+
}
|
|
28
69
|
}
|