@aztec/ethereum 1.0.0 → 1.1.2
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/config.d.ts +27 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +90 -9
- package/dest/contracts/empire_base.d.ts +3 -4
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +4 -8
- package/dest/contracts/governance_proposer.d.ts +2 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +4 -9
- package/dest/contracts/multicall.d.ts +2 -1
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +79 -48
- package/dest/contracts/rollup.d.ts +13 -1
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +64 -0
- package/dest/contracts/slashing_proposer.d.ts +2 -2
- package/dest/contracts/slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/slashing_proposer.js +5 -10
- package/dest/deploy_l1_contracts.d.ts +837 -534
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +35 -19
- package/dest/l1_tx_utils.d.ts +7 -2
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +41 -13
- package/dest/l1_tx_utils_with_blobs.d.ts +2 -1
- package/dest/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils_with_blobs.js +5 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +5 -3
- package/dest/test/start_anvil.d.ts +2 -0
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +3 -0
- package/package.json +6 -4
- package/src/config.ts +102 -8
- package/src/contracts/empire_base.ts +10 -16
- package/src/contracts/governance_proposer.ts +10 -10
- package/src/contracts/multicall.ts +73 -46
- package/src/contracts/rollup.ts +82 -1
- package/src/contracts/slashing_proposer.ts +11 -11
- package/src/deploy_l1_contracts.ts +45 -18
- package/src/l1_tx_utils.ts +56 -19
- package/src/l1_tx_utils_with_blobs.ts +14 -3
- package/src/queries.ts +3 -0
- package/src/test/start_anvil.ts +5 -3
package/dest/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
1
|
+
import { type ConfigMappingsType, type NetworkNames } from '@aztec/foundation/config';
|
|
2
2
|
import { type L1TxUtilsConfig } from './l1_tx_utils.js';
|
|
3
3
|
export type GenesisStateConfig = {
|
|
4
4
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
@@ -33,6 +33,8 @@ export type L1ContractsConfig = {
|
|
|
33
33
|
manaTarget: bigint;
|
|
34
34
|
/** The proving cost per mana */
|
|
35
35
|
provingCostPerMana: bigint;
|
|
36
|
+
/** The number of seconds to wait for an exit */
|
|
37
|
+
exitDelaySeconds: number;
|
|
36
38
|
} & L1TxUtilsConfig;
|
|
37
39
|
export declare const DefaultL1ContractsConfig: {
|
|
38
40
|
ethereumSlotDuration: number;
|
|
@@ -48,18 +50,38 @@ export declare const DefaultL1ContractsConfig: {
|
|
|
48
50
|
governanceProposerRoundSize: number;
|
|
49
51
|
manaTarget: bigint;
|
|
50
52
|
provingCostPerMana: bigint;
|
|
53
|
+
exitDelaySeconds: number;
|
|
51
54
|
};
|
|
52
|
-
export declare const
|
|
55
|
+
export declare const getGovernanceConfiguration: (networkName: NetworkNames) => {
|
|
56
|
+
proposeConfig: {
|
|
57
|
+
lockDelay: bigint;
|
|
58
|
+
lockAmount: bigint;
|
|
59
|
+
};
|
|
60
|
+
votingDelay: bigint;
|
|
61
|
+
votingDuration: bigint;
|
|
62
|
+
executionDelay: bigint;
|
|
63
|
+
gracePeriod: bigint;
|
|
64
|
+
quorum: bigint;
|
|
65
|
+
voteDifferential: bigint;
|
|
66
|
+
minimumVotes: bigint;
|
|
67
|
+
};
|
|
68
|
+
export declare const getRewardConfig: (networkName: NetworkNames) => {
|
|
53
69
|
sequencerBps: number;
|
|
70
|
+
rewardDistributor: `0x${string}`;
|
|
71
|
+
booster: `0x${string}`;
|
|
72
|
+
};
|
|
73
|
+
export declare const getRewardBoostConfig: (networkName: NetworkNames) => {
|
|
54
74
|
increment: number;
|
|
55
75
|
maxScore: number;
|
|
56
76
|
a: number;
|
|
57
77
|
k: number;
|
|
58
78
|
minimum: number;
|
|
59
79
|
};
|
|
60
|
-
export declare const
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
export declare const getEntryQueueConfig: (networkName: NetworkNames) => {
|
|
81
|
+
bootstrapValidatorSetSize: number;
|
|
82
|
+
bootstrapFlushSize: number;
|
|
83
|
+
normalFlushSizeMin: number;
|
|
84
|
+
normalFlushSizeQuotient: number;
|
|
63
85
|
};
|
|
64
86
|
export declare const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig>;
|
|
65
87
|
export declare const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig>;
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAKlB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,eAAe,EAA2B,MAAM,kBAAkB,CAAC;AAEjF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yCAAyC;IACzC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,iBAAiB,EAAE,MAAM,CAAC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numberConfigHelper } from '@aztec/foundation/config';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import { l1TxUtilsConfigMappings } from './l1_tx_utils.js';
|
|
3
4
|
export const DefaultL1ContractsConfig = {
|
|
4
5
|
ethereumSlotDuration: 12,
|
|
@@ -8,28 +9,103 @@ export const DefaultL1ContractsConfig = {
|
|
|
8
9
|
aztecProofSubmissionEpochs: 1,
|
|
9
10
|
depositAmount: BigInt(100e18),
|
|
10
11
|
minimumStake: BigInt(50e18),
|
|
11
|
-
slashingQuorum:
|
|
12
|
-
slashingRoundSize:
|
|
13
|
-
governanceProposerQuorum:
|
|
14
|
-
governanceProposerRoundSize:
|
|
12
|
+
slashingQuorum: 101,
|
|
13
|
+
slashingRoundSize: 200,
|
|
14
|
+
governanceProposerQuorum: 151,
|
|
15
|
+
governanceProposerRoundSize: 300,
|
|
15
16
|
manaTarget: BigInt(1e10),
|
|
16
|
-
provingCostPerMana: BigInt(100)
|
|
17
|
+
provingCostPerMana: BigInt(100),
|
|
18
|
+
exitDelaySeconds: 2 * 24 * 60 * 60
|
|
19
|
+
};
|
|
20
|
+
const LocalGovernanceConfiguration = {
|
|
21
|
+
proposeConfig: {
|
|
22
|
+
lockDelay: 60n * 60n * 24n * 30n,
|
|
23
|
+
lockAmount: 1n * 10n ** 24n
|
|
24
|
+
},
|
|
25
|
+
votingDelay: 60n,
|
|
26
|
+
votingDuration: 60n * 60n,
|
|
27
|
+
executionDelay: 60n,
|
|
28
|
+
gracePeriod: 60n * 60n * 24n * 7n,
|
|
29
|
+
quorum: 1n * 10n ** 17n,
|
|
30
|
+
voteDifferential: 4n * 10n ** 16n,
|
|
31
|
+
minimumVotes: 400n * 10n ** 18n
|
|
32
|
+
};
|
|
33
|
+
const TestnetGovernanceConfiguration = {
|
|
34
|
+
proposeConfig: {
|
|
35
|
+
lockDelay: 60n * 60n * 24n,
|
|
36
|
+
lockAmount: DefaultL1ContractsConfig.depositAmount * 100n
|
|
37
|
+
},
|
|
38
|
+
votingDelay: 60n,
|
|
39
|
+
votingDuration: 60n * 60n,
|
|
40
|
+
executionDelay: 60n * 60n * 24n,
|
|
41
|
+
gracePeriod: 60n * 60n * 24n * 7n,
|
|
42
|
+
quorum: 3n * 10n ** 17n,
|
|
43
|
+
voteDifferential: 4n * 10n ** 16n,
|
|
44
|
+
minimumVotes: DefaultL1ContractsConfig.minimumStake * 200n
|
|
45
|
+
};
|
|
46
|
+
export const getGovernanceConfiguration = (networkName)=>{
|
|
47
|
+
if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
48
|
+
return TestnetGovernanceConfiguration;
|
|
49
|
+
}
|
|
50
|
+
return LocalGovernanceConfiguration;
|
|
17
51
|
};
|
|
18
52
|
// Making a default config here as we are only using it thought the deployment
|
|
19
53
|
// and do not expect to be using different setups, so having environment variables
|
|
20
54
|
// for it seems overkill
|
|
21
|
-
|
|
55
|
+
const LocalRewardConfig = {
|
|
56
|
+
sequencerBps: 5000,
|
|
57
|
+
rewardDistributor: EthAddress.ZERO.toString(),
|
|
58
|
+
booster: EthAddress.ZERO.toString()
|
|
59
|
+
};
|
|
60
|
+
const TestnetRewardConfig = {
|
|
22
61
|
sequencerBps: 5000,
|
|
62
|
+
rewardDistributor: EthAddress.ZERO.toString(),
|
|
63
|
+
booster: EthAddress.ZERO.toString()
|
|
64
|
+
};
|
|
65
|
+
export const getRewardConfig = (networkName)=>{
|
|
66
|
+
if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
67
|
+
return TestnetRewardConfig;
|
|
68
|
+
}
|
|
69
|
+
return LocalRewardConfig;
|
|
70
|
+
};
|
|
71
|
+
const LocalRewardBoostConfig = {
|
|
23
72
|
increment: 200000,
|
|
24
73
|
maxScore: 5000000,
|
|
25
74
|
a: 5000,
|
|
26
75
|
k: 1000000,
|
|
27
76
|
minimum: 100000
|
|
28
77
|
};
|
|
78
|
+
const TestnetRewardBoostConfig = {
|
|
79
|
+
increment: 125000,
|
|
80
|
+
maxScore: 15000000,
|
|
81
|
+
a: 1000,
|
|
82
|
+
k: 1000000,
|
|
83
|
+
minimum: 100000
|
|
84
|
+
};
|
|
85
|
+
export const getRewardBoostConfig = (networkName)=>{
|
|
86
|
+
if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
87
|
+
return TestnetRewardBoostConfig;
|
|
88
|
+
}
|
|
89
|
+
return LocalRewardBoostConfig;
|
|
90
|
+
};
|
|
29
91
|
// Similar to the above, no need for environment variables for this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
92
|
+
const LocalEntryQueueConfig = {
|
|
93
|
+
bootstrapValidatorSetSize: 0,
|
|
94
|
+
bootstrapFlushSize: 0,
|
|
95
|
+
normalFlushSizeMin: 48,
|
|
96
|
+
normalFlushSizeQuotient: 2
|
|
97
|
+
};
|
|
98
|
+
const TestnetEntryQueueConfig = {
|
|
99
|
+
bootstrapValidatorSetSize: 750,
|
|
100
|
+
bootstrapFlushSize: 75,
|
|
101
|
+
normalFlushSizeMin: 1,
|
|
102
|
+
normalFlushSizeQuotient: 2475
|
|
103
|
+
};
|
|
104
|
+
export const getEntryQueueConfig = (networkName)=>{
|
|
105
|
+
if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
106
|
+
return TestnetEntryQueueConfig;
|
|
107
|
+
}
|
|
108
|
+
return LocalEntryQueueConfig;
|
|
33
109
|
};
|
|
34
110
|
export const l1ContractsConfigMappings = {
|
|
35
111
|
ethereumSlotDuration: {
|
|
@@ -97,6 +173,11 @@ export const l1ContractsConfigMappings = {
|
|
|
97
173
|
description: 'The proving cost per mana',
|
|
98
174
|
...bigintConfigHelper(DefaultL1ContractsConfig.provingCostPerMana)
|
|
99
175
|
},
|
|
176
|
+
exitDelaySeconds: {
|
|
177
|
+
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
178
|
+
description: 'The delay before a validator can exit the set',
|
|
179
|
+
...numberConfigHelper(DefaultL1ContractsConfig.exitDelaySeconds)
|
|
180
|
+
},
|
|
100
181
|
...l1TxUtilsConfigMappings
|
|
101
182
|
};
|
|
102
183
|
export const genesisStateConfigMappings = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
2
|
-
import { type Hex
|
|
2
|
+
import { type Hex } from 'viem';
|
|
3
3
|
import type { L1TxRequest } from '../l1_tx_utils.js';
|
|
4
|
-
import type { ExtendedViemWalletClient } from '../types.js';
|
|
5
4
|
export interface IEmpireBase {
|
|
6
5
|
getRoundInfo(rollupAddress: Hex, round: bigint): Promise<{
|
|
7
6
|
lastVote: bigint;
|
|
@@ -10,7 +9,7 @@ export interface IEmpireBase {
|
|
|
10
9
|
}>;
|
|
11
10
|
computeRound(slot: bigint): Promise<bigint>;
|
|
12
11
|
createVoteRequest(payload: Hex): L1TxRequest;
|
|
13
|
-
createVoteRequestWithSignature(payload: Hex,
|
|
12
|
+
createVoteRequestWithSignature(payload: Hex, chainId: number, signerAddress: Hex, signer: (msg: Hex) => Promise<Hex>): Promise<L1TxRequest>;
|
|
14
13
|
}
|
|
15
14
|
export declare function encodeVote(payload: Hex): Hex;
|
|
16
15
|
export declare function encodeVoteWithSignature(payload: Hex, signature: Signature): `0x${string}`;
|
|
@@ -23,5 +22,5 @@ export declare function encodeVoteWithSignature(payload: Hex, signature: Signatu
|
|
|
23
22
|
* @param account - The account to sign with (optional if hoisted on wallet client)
|
|
24
23
|
* @returns The EIP-712 signature
|
|
25
24
|
*/
|
|
26
|
-
export declare function signVoteWithSig(
|
|
25
|
+
export declare function signVoteWithSig(signer: (msg: Hex) => Promise<Hex>, proposal: Hex, nonce: bigint, verifyingContract: Hex, chainId: number): Promise<Signature>;
|
|
27
26
|
//# sourceMappingURL=empire_base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empire_base.d.ts","sourceRoot":"","sources":["../../src/contracts/empire_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MA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B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
2
2
|
import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
|
|
3
|
-
import { encodeFunctionData } from 'viem';
|
|
3
|
+
import { encodeFunctionData, hashTypedData } from 'viem';
|
|
4
4
|
export function encodeVote(payload) {
|
|
5
5
|
return encodeFunctionData({
|
|
6
6
|
abi: EmpireBaseAbi,
|
|
@@ -28,7 +28,7 @@ export function encodeVoteWithSignature(payload, signature) {
|
|
|
28
28
|
* @param chainId - The chain ID where the contract is deployed
|
|
29
29
|
* @param account - The account to sign with (optional if hoisted on wallet client)
|
|
30
30
|
* @returns The EIP-712 signature
|
|
31
|
-
*/ export async function signVoteWithSig(
|
|
31
|
+
*/ export async function signVoteWithSig(signer, proposal, nonce, verifyingContract, chainId) {
|
|
32
32
|
const domain = {
|
|
33
33
|
name: 'EmpireBase',
|
|
34
34
|
version: '1',
|
|
@@ -51,15 +51,11 @@ export function encodeVoteWithSignature(payload, signature) {
|
|
|
51
51
|
proposal,
|
|
52
52
|
nonce
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
throw new Error('Wallet client must be connected to an account');
|
|
56
|
-
}
|
|
57
|
-
const signatureHex = await walletClient.signTypedData({
|
|
58
|
-
account: walletClient.account.address,
|
|
54
|
+
const msg = hashTypedData({
|
|
59
55
|
domain,
|
|
60
56
|
types,
|
|
61
57
|
primaryType: 'Vote',
|
|
62
58
|
message
|
|
63
59
|
});
|
|
64
|
-
return Signature.fromString(
|
|
60
|
+
return Signature.fromString(await signer(msg));
|
|
65
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { type Hex, type TransactionReceipt } from 'viem';
|
|
3
3
|
import type { GasPrice, L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ViemClient } from '../types.js';
|
|
5
5
|
import { type IEmpireBase } from './empire_base.js';
|
|
6
6
|
export declare class GovernanceProposerContract implements IEmpireBase {
|
|
7
7
|
readonly client: ViemClient;
|
|
@@ -21,7 +21,7 @@ export declare class GovernanceProposerContract implements IEmpireBase {
|
|
|
21
21
|
}>;
|
|
22
22
|
getProposalVotes(rollupAddress: Hex, round: bigint, proposal: Hex): Promise<bigint>;
|
|
23
23
|
createVoteRequest(payload: Hex): L1TxRequest;
|
|
24
|
-
createVoteRequestWithSignature(payload: Hex,
|
|
24
|
+
createVoteRequestWithSignature(payload: Hex, chainId: number, signerAddress: Hex, signer: (msg: Hex) => Promise<Hex>): Promise<L1TxRequest>;
|
|
25
25
|
executeProposal(round: bigint, l1TxUtils: L1TxUtils): Promise<{
|
|
26
26
|
receipt: TransactionReceipt;
|
|
27
27
|
gasPrice: GasPrice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/governance_proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAA8B,KAAK,GAAG,EAAE,KAAK,kBAAkB,EAAmC,MAAM,MAAM,CAAC;AAEtH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"governance_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/governance_proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAA8B,KAAK,GAAG,EAAE,KAAK,kBAAkB,EAAmC,MAAM,MAAM,CAAC;AAEtH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aA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CAYH"}
|
|
@@ -47,15 +47,10 @@ export class GovernanceProposerContract {
|
|
|
47
47
|
]);
|
|
48
48
|
}
|
|
49
49
|
async getRoundInfo(rollupAddress, round) {
|
|
50
|
-
|
|
50
|
+
return await this.proposer.read.getRoundData([
|
|
51
51
|
rollupAddress,
|
|
52
52
|
round
|
|
53
53
|
]);
|
|
54
|
-
return {
|
|
55
|
-
lastVote: roundInfo[0],
|
|
56
|
-
leader: roundInfo[1],
|
|
57
|
-
executed: roundInfo[2]
|
|
58
|
-
};
|
|
59
54
|
}
|
|
60
55
|
getProposalVotes(rollupAddress, round, proposal) {
|
|
61
56
|
return this.proposer.read.yeaCount([
|
|
@@ -70,9 +65,9 @@ export class GovernanceProposerContract {
|
|
|
70
65
|
data: encodeVote(payload)
|
|
71
66
|
};
|
|
72
67
|
}
|
|
73
|
-
async createVoteRequestWithSignature(payload,
|
|
74
|
-
const nonce = await this.getNonce(
|
|
75
|
-
const signature = await signVoteWithSig(
|
|
68
|
+
async createVoteRequestWithSignature(payload, chainId, signerAddress, signer) {
|
|
69
|
+
const nonce = await this.getNonce(signerAddress);
|
|
70
|
+
const signature = await signVoteWithSig(signer, payload, nonce, this.address.toString(), chainId);
|
|
76
71
|
return {
|
|
77
72
|
to: this.address.toString(),
|
|
78
73
|
data: encodeVoteWithSignature(payload, signature)
|
|
@@ -2,9 +2,10 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { type Hex } from 'viem';
|
|
3
3
|
import type { L1BlobInputs, L1GasConfig, L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
4
4
|
import type { ExtendedViemWalletClient } from '../types.js';
|
|
5
|
+
import { FormattedViemError } from '../utils.js';
|
|
5
6
|
export declare const MULTI_CALL_3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
6
7
|
export declare class Multicall3 {
|
|
7
|
-
static forward(requests: L1TxRequest[], l1TxUtils: L1TxUtils, gasConfig: L1GasConfig | undefined, blobConfig: L1BlobInputs | undefined, rollupAddress: Hex, logger: Logger): Promise<{
|
|
8
|
+
static forward(requests: L1TxRequest[], l1TxUtils: L1TxUtils, gasConfig: L1GasConfig | undefined, blobConfig: L1BlobInputs | undefined, rollupAddress: Hex, logger: Logger): Promise<FormattedViemError | {
|
|
8
9
|
receipt: import("viem").TransactionReceipt;
|
|
9
10
|
gasPrice: import("../l1_tx_utils.js").GasPrice;
|
|
10
11
|
stats: import("../l1_tx_utils.js").TransactionStats | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAqC,KAAK,GAAG,EAAqC,MAAM,MAAM,CAAC;AAEtG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAqC,KAAK,GAAG,EAAqC,MAAM,MAAM,CAAC;AAEtG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,oBAAoB,EAAG,4CAAqD,CAAC;AAE1F,qBAAa,UAAU;WACR,OAAO,CAClB,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,UAAU,EAAE,YAAY,GAAG,SAAS,EACpC,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,MAAM;;;;;;;;;;;CAmGjB;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBAyBxF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
2
2
|
import { encodeFunctionData, multicall3Abi } from 'viem';
|
|
3
|
+
import { FormattedViemError, formatViemError } from '../utils.js';
|
|
3
4
|
import { RollupContract } from './rollup.js';
|
|
4
5
|
export const MULTI_CALL_3_ADDRESS = '0xcA11bde05977b3631167028862bE2a173976CA11';
|
|
5
6
|
export class Multicall3 {
|
|
@@ -18,57 +19,87 @@ export class Multicall3 {
|
|
|
18
19
|
]
|
|
19
20
|
};
|
|
20
21
|
const encodedForwarderData = encodeFunctionData(forwarderFunctionData);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
try {
|
|
23
|
+
const { receipt, gasPrice } = await l1TxUtils.sendAndMonitorTransaction({
|
|
24
|
+
to: MULTI_CALL_3_ADDRESS,
|
|
25
|
+
data: encodedForwarderData
|
|
26
|
+
}, gasConfig, blobConfig);
|
|
27
|
+
if (receipt.status === 'success') {
|
|
28
|
+
const stats = await l1TxUtils.getTransactionStats(receipt.transactionHash);
|
|
29
|
+
return {
|
|
30
|
+
receipt,
|
|
31
|
+
gasPrice,
|
|
32
|
+
stats
|
|
33
|
+
};
|
|
34
|
+
} else {
|
|
35
|
+
logger.error('Forwarder transaction failed', undefined, {
|
|
36
|
+
receipt
|
|
37
|
+
});
|
|
38
|
+
const args = {
|
|
39
|
+
...forwarderFunctionData,
|
|
40
|
+
address: MULTI_CALL_3_ADDRESS
|
|
41
|
+
};
|
|
42
|
+
let errorMsg;
|
|
43
|
+
if (blobConfig) {
|
|
44
|
+
const maxFeePerBlobGas = blobConfig.maxFeePerBlobGas ?? gasPrice.maxFeePerBlobGas;
|
|
45
|
+
if (maxFeePerBlobGas === undefined) {
|
|
46
|
+
errorMsg = 'maxFeePerBlobGas is required to get the error message';
|
|
47
|
+
} else {
|
|
48
|
+
logger.debug('Trying to get error from reverted tx with blob config');
|
|
49
|
+
errorMsg = await l1TxUtils.tryGetErrorFromRevertedTx(encodedForwarderData, args, {
|
|
50
|
+
blobs: blobConfig.blobs,
|
|
51
|
+
kzg: blobConfig.kzg,
|
|
52
|
+
maxFeePerBlobGas
|
|
53
|
+
}, [
|
|
54
|
+
{
|
|
55
|
+
address: rollupAddress,
|
|
56
|
+
stateDiff: [
|
|
57
|
+
{
|
|
58
|
+
slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true),
|
|
59
|
+
value: toPaddedHex(0n, true)
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
45
65
|
} else {
|
|
46
|
-
logger.debug('Trying to get error from reverted tx
|
|
47
|
-
errorMsg = await l1TxUtils.tryGetErrorFromRevertedTx(encodedForwarderData, args,
|
|
48
|
-
blobs: blobConfig.blobs,
|
|
49
|
-
kzg: blobConfig.kzg,
|
|
50
|
-
maxFeePerBlobGas
|
|
51
|
-
}, [
|
|
52
|
-
{
|
|
53
|
-
address: rollupAddress,
|
|
54
|
-
stateDiff: [
|
|
55
|
-
{
|
|
56
|
-
slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true),
|
|
57
|
-
value: toPaddedHex(0n, true)
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
]);
|
|
66
|
+
logger.debug('Trying to get error from reverted tx without blob config');
|
|
67
|
+
errorMsg = await l1TxUtils.tryGetErrorFromRevertedTx(encodedForwarderData, args, undefined, []);
|
|
62
68
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
return {
|
|
70
|
+
receipt,
|
|
71
|
+
gasPrice,
|
|
72
|
+
errorMsg
|
|
73
|
+
};
|
|
66
74
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
} catch (err) {
|
|
76
|
+
for (const request of requests){
|
|
77
|
+
logger.debug('Simulating request', {
|
|
78
|
+
request
|
|
79
|
+
});
|
|
80
|
+
const result = await l1TxUtils.simulate(request, undefined, [
|
|
81
|
+
{
|
|
82
|
+
address: rollupAddress,
|
|
83
|
+
stateDiff: [
|
|
84
|
+
{
|
|
85
|
+
slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true),
|
|
86
|
+
value: toPaddedHex(0n, true)
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
]).catch((err)=>formatViemError(err, request.abi));
|
|
91
|
+
if (result instanceof FormattedViemError) {
|
|
92
|
+
logger.error('Found error in simulation', result, {
|
|
93
|
+
to: request.to ?? 'null',
|
|
94
|
+
data: request.data
|
|
95
|
+
});
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
logger.warn('Failed to get error from reverted tx', {
|
|
100
|
+
err
|
|
101
|
+
});
|
|
102
|
+
throw err;
|
|
72
103
|
}
|
|
73
104
|
}
|
|
74
105
|
}
|
|
@@ -12,6 +12,10 @@ export type ViemCommitteeAttestation = {
|
|
|
12
12
|
addr: `0x${string}`;
|
|
13
13
|
signature: ViemSignature;
|
|
14
14
|
};
|
|
15
|
+
export type ViemCommitteeAttestations = {
|
|
16
|
+
signatureIndices: `0x${string}`;
|
|
17
|
+
signaturesOrAddresses: `0x${string}`;
|
|
18
|
+
};
|
|
15
19
|
export type L1RollupContractAddresses = Pick<L1ContractAddresses, 'rollupAddress' | 'inboxAddress' | 'outboxAddress' | 'feeJuicePortalAddress' | 'feeJuiceAddress' | 'stakingAssetAddress' | 'rewardDistributorAddress' | 'slashFactoryAddress' | 'gseAddress'>;
|
|
16
20
|
export type EpochProofPublicInputArgs = {
|
|
17
21
|
previousArchive: `0x${string}`;
|
|
@@ -69,6 +73,7 @@ export declare class RollupContract {
|
|
|
69
73
|
getTargetCommitteeSize(): Promise<bigint>;
|
|
70
74
|
getMinimumStake(): Promise<bigint>;
|
|
71
75
|
getDepositAmount(): Promise<bigint>;
|
|
76
|
+
getExitDelay(): Promise<bigint>;
|
|
72
77
|
getManaTarget(): Promise<bigint>;
|
|
73
78
|
getProvingCostPerMana(): Promise<bigint>;
|
|
74
79
|
getProvingCostPerManaInFeeAsset(): Promise<bigint>;
|
|
@@ -110,7 +115,7 @@ export declare class RollupContract {
|
|
|
110
115
|
getEpochProofPublicInputs(args: readonly [bigint, bigint, EpochProofPublicInputArgs, readonly `0x${string}`[], `0x${string}`]): Promise<readonly `0x${string}`[]>;
|
|
111
116
|
validateHeader(args: readonly [
|
|
112
117
|
ViemHeader,
|
|
113
|
-
|
|
118
|
+
ViemCommitteeAttestations,
|
|
114
119
|
`0x${string}`,
|
|
115
120
|
`0x${string}`,
|
|
116
121
|
{
|
|
@@ -118,6 +123,13 @@ export declare class RollupContract {
|
|
|
118
123
|
ignoreSignatures: boolean;
|
|
119
124
|
}
|
|
120
125
|
], account: `0x${string}` | Account): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
128
|
+
*
|
|
129
|
+
* @param attestations - Array of committee attestations with addresses and signatures
|
|
130
|
+
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
131
|
+
*/
|
|
132
|
+
static packAttestations(attestations: ViemCommitteeAttestation[]): ViemCommitteeAttestations;
|
|
121
133
|
/**
|
|
122
134
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
123
135
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI1D,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,GAAG,EAA+C,MAAM,MAAM,CAAC;AAGvH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,mBAAmB,EACjB,eAAe,GACf,cAAc,GACd,eAAe,GACf,uBAAuB,GACvB,iBAAiB,GACjB,qBAAqB,GACrB,0BAA0B,GAC1B,qBAAqB,GACrB,YAAY,CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,KAAK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CAAC,EAAE,MAAM,CAAA;KAAE;IAK1E,OAAO;IAIP,SAAS,CAAC,WAAW,EAAE,MAAM;IAI7B,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,UAAU;IAO7C,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,UAAU;IAOxE,YAAY;IAIZ,eAAe,CAAC,OAAO,EAAE,GAAG,GAAG,UAAU;;;;;;;;;;;;;;;IAOzC,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,UAAU;IAOnC,sBAAsB,CAAC,WAAW,EAAE,MAAM;IAI1C,6BAA6B;IAI7B,eAAe;IAIf,UAAU,CAAC,SAAS,EAAE,SAAS;;;;IAW/B,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;;;;CAU9C"}
|
package/dest/contracts/rollup.js
CHANGED
|
@@ -87,6 +87,9 @@ export class RollupContract {
|
|
|
87
87
|
getDepositAmount() {
|
|
88
88
|
return this.rollup.read.getDepositAmount();
|
|
89
89
|
}
|
|
90
|
+
getExitDelay() {
|
|
91
|
+
return this.rollup.read.getExitDelay();
|
|
92
|
+
}
|
|
90
93
|
getManaTarget() {
|
|
91
94
|
return this.rollup.read.getManaTarget();
|
|
92
95
|
}
|
|
@@ -267,6 +270,64 @@ export class RollupContract {
|
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
/**
|
|
273
|
+
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
274
|
+
*
|
|
275
|
+
* @param attestations - Array of committee attestations with addresses and signatures
|
|
276
|
+
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
277
|
+
*/ static packAttestations(attestations) {
|
|
278
|
+
const length = attestations.length;
|
|
279
|
+
// Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
|
|
280
|
+
const bitmapSize = Math.ceil(length / 8);
|
|
281
|
+
const signatureIndices = new Uint8Array(bitmapSize);
|
|
282
|
+
// Calculate total data size needed
|
|
283
|
+
let totalDataSize = 0;
|
|
284
|
+
for(let i = 0; i < length; i++){
|
|
285
|
+
const signature = attestations[i].signature;
|
|
286
|
+
// Check if signature is empty (v = 0)
|
|
287
|
+
const isEmpty = signature.v === 0;
|
|
288
|
+
if (!isEmpty) {
|
|
289
|
+
totalDataSize += 65; // v (1) + r (32) + s (32)
|
|
290
|
+
} else {
|
|
291
|
+
totalDataSize += 20; // address only
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const signaturesOrAddresses = new Uint8Array(totalDataSize);
|
|
295
|
+
let dataIndex = 0;
|
|
296
|
+
// Pack the data
|
|
297
|
+
for(let i = 0; i < length; i++){
|
|
298
|
+
const attestation = attestations[i];
|
|
299
|
+
const signature = attestation.signature;
|
|
300
|
+
// Check if signature is empty
|
|
301
|
+
const isEmpty = signature.v === 0;
|
|
302
|
+
if (!isEmpty) {
|
|
303
|
+
// Set bit in bitmap (bit 7-0 in each byte, left to right)
|
|
304
|
+
const byteIndex = Math.floor(i / 8);
|
|
305
|
+
const bitIndex = 7 - i % 8;
|
|
306
|
+
signatureIndices[byteIndex] |= 1 << bitIndex;
|
|
307
|
+
// Pack signature: v + r + s
|
|
308
|
+
signaturesOrAddresses[dataIndex] = signature.v;
|
|
309
|
+
dataIndex++;
|
|
310
|
+
// Pack r (32 bytes)
|
|
311
|
+
const rBytes = Buffer.from(signature.r.slice(2), 'hex');
|
|
312
|
+
signaturesOrAddresses.set(rBytes, dataIndex);
|
|
313
|
+
dataIndex += 32;
|
|
314
|
+
// Pack s (32 bytes)
|
|
315
|
+
const sBytes = Buffer.from(signature.s.slice(2), 'hex');
|
|
316
|
+
signaturesOrAddresses.set(sBytes, dataIndex);
|
|
317
|
+
dataIndex += 32;
|
|
318
|
+
} else {
|
|
319
|
+
// Pack address only (20 bytes)
|
|
320
|
+
const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
|
|
321
|
+
signaturesOrAddresses.set(addrBytes, dataIndex);
|
|
322
|
+
dataIndex += 20;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
|
|
327
|
+
signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
270
331
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
271
332
|
*
|
|
272
333
|
* @dev Throws if unable to propose
|
|
@@ -438,6 +499,9 @@ _ts_decorate([
|
|
|
438
499
|
_ts_decorate([
|
|
439
500
|
memoize
|
|
440
501
|
], RollupContract.prototype, "getDepositAmount", null);
|
|
502
|
+
_ts_decorate([
|
|
503
|
+
memoize
|
|
504
|
+
], RollupContract.prototype, "getExitDelay", null);
|
|
441
505
|
_ts_decorate([
|
|
442
506
|
memoize
|
|
443
507
|
], RollupContract.prototype, "getManaTarget", null);
|