@aztec/ethereum 3.0.0-canary.a9708bd → 3.0.0-devnet.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/client.d.ts +1 -1
- package/dest/client.d.ts.map +1 -1
- package/dest/config.d.ts +11 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +124 -64
- package/dest/contracts/empire_base.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +2 -2
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +3 -3
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/governance.js +7 -3
- package/dest/contracts/governance_proposer.d.ts +1 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +1 -2
- package/dest/contracts/multicall.d.ts +3 -5
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +6 -4
- package/dest/contracts/rollup.d.ts +39 -19
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +84 -88
- package/dest/contracts/slasher_contract.d.ts +10 -0
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/slasher_contract.js +18 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +22 -3
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +55 -5
- package/dest/deploy_l1_contracts.d.ts +22 -7
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +555 -362
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/l1_artifacts.d.ts +8729 -6014
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +10 -5
- package/dest/l1_contract_addresses.d.ts +5 -1
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +16 -26
- package/dest/l1_reader.d.ts +1 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +8 -8
- package/dest/l1_tx_utils/config.d.ts +59 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +73 -0
- package/dest/l1_tx_utils/constants.d.ts +6 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +14 -0
- package/dest/l1_tx_utils/factory.d.ts +24 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +12 -0
- package/dest/l1_tx_utils/index.d.ts +10 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +10 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +95 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +81 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +294 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/publisher_manager.d.ts +7 -2
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +36 -8
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +11 -12
- package/dest/test/chain_monitor.d.ts +11 -0
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +81 -12
- package/dest/test/delayed_tx_utils.d.ts +2 -2
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +2 -2
- package/dest/test/eth_cheat_codes.d.ts +32 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +115 -28
- package/dest/test/rollup_cheat_codes.d.ts +11 -9
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +38 -6
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +3 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +10 -161
- package/dest/zkPassportVerifierAddress.js +1 -1
- package/package.json +7 -7
- package/src/client.ts +1 -1
- package/src/config.ts +136 -68
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/empire_slashing_proposer.ts +7 -3
- package/src/contracts/fee_asset_handler.ts +1 -1
- package/src/contracts/governance.ts +3 -3
- package/src/contracts/governance_proposer.ts +3 -4
- package/src/contracts/multicall.ts +12 -10
- package/src/contracts/rollup.ts +104 -106
- package/src/contracts/slasher_contract.ts +22 -0
- package/src/contracts/tally_slashing_proposer.ts +54 -6
- package/src/deploy_l1_contracts.ts +570 -328
- package/src/index.ts +1 -1
- package/src/l1_artifacts.ts +14 -6
- package/src/l1_contract_addresses.ts +17 -26
- package/src/l1_reader.ts +9 -9
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +140 -0
- package/src/l1_tx_utils/constants.ts +18 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/index.ts +12 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +372 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/publisher_manager.ts +51 -9
- package/src/queries.ts +13 -8
- package/src/test/chain_monitor.ts +89 -9
- package/src/test/delayed_tx_utils.ts +2 -2
- package/src/test/eth_cheat_codes.ts +142 -29
- package/src/test/rollup_cheat_codes.ts +54 -14
- package/src/test/upgrade_utils.ts +3 -2
- package/src/utils.ts +13 -185
- package/src/zkPassportVerifierAddress.ts +1 -1
- package/dest/l1_tx_utils.d.ts +0 -250
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -826
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -19
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -85
- package/src/l1_tx_utils.ts +0 -1105
- package/src/l1_tx_utils_with_blobs.ts +0 -144
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
3
3
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
|
-
import { type Account, type GetContractReturnType, type Hex, type StateOverride } from 'viem';
|
|
4
|
+
import { type Account, type GetContractReturnType, type Hex, type StateOverride, type WatchContractEventReturnType } from 'viem';
|
|
5
5
|
import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
|
|
6
6
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
7
7
|
import type { L1ReaderConfig } from '../l1_reader.js';
|
|
8
|
-
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
8
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
9
9
|
import type { ViemClient } from '../types.js';
|
|
10
10
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
11
11
|
import { SlasherContract } from './slasher_contract.js';
|
|
@@ -81,6 +81,8 @@ export declare class RollupContract {
|
|
|
81
81
|
getSlotDuration(): Promise<bigint>;
|
|
82
82
|
getTargetCommitteeSize(): Promise<bigint>;
|
|
83
83
|
getEjectionThreshold(): Promise<bigint>;
|
|
84
|
+
getLocalEjectionThreshold(): Promise<bigint>;
|
|
85
|
+
getLagInEpochs(): Promise<bigint>;
|
|
84
86
|
getActivationThreshold(): Promise<bigint>;
|
|
85
87
|
getExitDelay(): Promise<bigint>;
|
|
86
88
|
getManaTarget(): Promise<bigint>;
|
|
@@ -89,11 +91,23 @@ export declare class RollupContract {
|
|
|
89
91
|
getManaLimit(): Promise<bigint>;
|
|
90
92
|
getVersion(): Promise<bigint>;
|
|
91
93
|
getGenesisArchiveTreeRoot(): Promise<`0x${string}`>;
|
|
92
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Returns rollup constants used for epoch queries.
|
|
96
|
+
* Return type is `L1RollupConstants` which is defined in stdlib,
|
|
97
|
+
* so we cant reference it until we move this contract to that package.
|
|
98
|
+
*/
|
|
99
|
+
getRollupConstants(): Promise<{
|
|
100
|
+
l1StartBlock: bigint;
|
|
101
|
+
l1GenesisTime: bigint;
|
|
102
|
+
slotDuration: number;
|
|
103
|
+
epochDuration: number;
|
|
104
|
+
proofSubmissionEpochs: number;
|
|
105
|
+
}>;
|
|
106
|
+
getSlasherAddress(): Promise<`0x${string}`>;
|
|
93
107
|
/**
|
|
94
108
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
95
109
|
*/
|
|
96
|
-
getSlasherContract(): Promise<SlasherContract>;
|
|
110
|
+
getSlasherContract(): Promise<SlasherContract | undefined>;
|
|
97
111
|
getOwner(): Promise<`0x${string}`>;
|
|
98
112
|
getActiveAttesterCount(): Promise<bigint>;
|
|
99
113
|
getSlashingProposerAddress(): Promise<EthAddress>;
|
|
@@ -113,7 +127,7 @@ export declare class RollupContract {
|
|
|
113
127
|
getCurrentEpochCommittee(): Promise<readonly `0x${string}`[] | undefined>;
|
|
114
128
|
getCurrentProposer(): Promise<`0x${string}`>;
|
|
115
129
|
getProposerAt(timestamp: bigint): Promise<`0x${string}`>;
|
|
116
|
-
getBlock(blockNumber: bigint): Promise<{
|
|
130
|
+
getBlock(blockNumber: bigint | number): Promise<{
|
|
117
131
|
archive: `0x${string}`;
|
|
118
132
|
headerHash: `0x${string}`;
|
|
119
133
|
blobCommitmentsHash: `0x${string}`;
|
|
@@ -134,7 +148,10 @@ export declare class RollupContract {
|
|
|
134
148
|
}>;
|
|
135
149
|
getTimestampForSlot(slot: bigint): Promise<bigint>;
|
|
136
150
|
getEntryQueueLength(): Promise<bigint>;
|
|
137
|
-
|
|
151
|
+
getAvailableValidatorFlushes(): Promise<bigint>;
|
|
152
|
+
getNextFlushableEpoch(): Promise<bigint>;
|
|
153
|
+
getCurrentEpochNumber(): Promise<bigint>;
|
|
154
|
+
getEpochNumberForBlock(blockNumber: bigint): Promise<bigint>;
|
|
138
155
|
getRollupAddresses(): Promise<L1RollupContractAddresses>;
|
|
139
156
|
getFeeJuicePortal(): Promise<EthAddress>;
|
|
140
157
|
getEpochNumberForSlotNumber(slotNumber: bigint): Promise<bigint>;
|
|
@@ -143,6 +160,7 @@ export declare class RollupContract {
|
|
|
143
160
|
ViemHeader,
|
|
144
161
|
ViemCommitteeAttestations,
|
|
145
162
|
`0x${string}`[],
|
|
163
|
+
ViemSignature,
|
|
146
164
|
`0x${string}`,
|
|
147
165
|
`0x${string}`,
|
|
148
166
|
{
|
|
@@ -150,13 +168,6 @@ export declare class RollupContract {
|
|
|
150
168
|
ignoreSignatures: boolean;
|
|
151
169
|
}
|
|
152
170
|
], account: `0x${string}` | Account): Promise<void>;
|
|
153
|
-
/**
|
|
154
|
-
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
155
|
-
*
|
|
156
|
-
* @param attestations - Array of committee attestations with addresses and signatures
|
|
157
|
-
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
158
|
-
*/
|
|
159
|
-
static packAttestations(attestations: ViemCommitteeAttestation[]): ViemCommitteeAttestations;
|
|
160
171
|
/**
|
|
161
172
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
162
173
|
*
|
|
@@ -180,9 +191,9 @@ export declare class RollupContract {
|
|
|
180
191
|
*/
|
|
181
192
|
makePendingBlockNumberOverride(forcePendingBlockNumber: number | undefined): Promise<StateOverride>;
|
|
182
193
|
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */
|
|
183
|
-
buildInvalidateBadAttestationRequest(blockNumber: number,
|
|
194
|
+
buildInvalidateBadAttestationRequest(blockNumber: number, attestationsAndSigners: ViemCommitteeAttestations, committee: EthAddress[], invalidIndex: number): L1TxRequest;
|
|
184
195
|
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */
|
|
185
|
-
buildInvalidateInsufficientAttestationsRequest(blockNumber: number,
|
|
196
|
+
buildInvalidateInsufficientAttestationsRequest(blockNumber: number, attestationsAndSigners: ViemCommitteeAttestations, committee: EthAddress[]): L1TxRequest;
|
|
186
197
|
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */
|
|
187
198
|
getHasSubmittedProof(epochNumber: number, numberOfBlocksInEpoch: number, prover: Hex | EthAddress): Promise<boolean>;
|
|
188
199
|
getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean): Promise<bigint>;
|
|
@@ -221,18 +232,27 @@ export declare class RollupContract {
|
|
|
221
232
|
getBlobCommitmentsHash(blockNumber: bigint): Promise<`0x${string}`>;
|
|
222
233
|
getCurrentBlobCommitmentsHash(): Promise<`0x${string}`>;
|
|
223
234
|
getStakingAsset(): Promise<`0x${string}`>;
|
|
235
|
+
getRewardConfig(): Promise<{
|
|
236
|
+
rewardDistributor: `0x${string}`;
|
|
237
|
+
sequencerBps: number;
|
|
238
|
+
booster: `0x${string}`;
|
|
239
|
+
blockReward: bigint;
|
|
240
|
+
}>;
|
|
224
241
|
setupEpoch(l1TxUtils: L1TxUtils): Promise<{
|
|
225
242
|
receipt: import("viem").TransactionReceipt;
|
|
226
|
-
|
|
243
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
227
244
|
}>;
|
|
228
245
|
vote(l1TxUtils: L1TxUtils, proposalId: bigint): Promise<{
|
|
229
246
|
receipt: import("viem").TransactionReceipt;
|
|
230
|
-
|
|
247
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
231
248
|
}>;
|
|
232
249
|
listenToSlasherChanged(callback: (args: {
|
|
233
250
|
oldSlasher: `0x${string}`;
|
|
234
251
|
newSlasher: `0x${string}`;
|
|
235
|
-
}) => unknown):
|
|
252
|
+
}) => unknown): WatchContractEventReturnType;
|
|
253
|
+
listenToBlockInvalidated(callback: (args: {
|
|
254
|
+
blockNumber: bigint;
|
|
255
|
+
}) => unknown): WatchContractEventReturnType;
|
|
236
256
|
getSlashEvents(l1BlockHash: Hex): Promise<{
|
|
237
257
|
amount: bigint;
|
|
238
258
|
attester: EthAddress;
|
|
@@ -240,6 +260,6 @@ export declare class RollupContract {
|
|
|
240
260
|
listenToSlash(callback: (args: {
|
|
241
261
|
amount: bigint;
|
|
242
262
|
attester: EthAddress;
|
|
243
|
-
}) => unknown):
|
|
263
|
+
}) => unknown): WatchContractEventReturnType;
|
|
244
264
|
}
|
|
245
265
|
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup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'@aztec/foundation/decorators';
|
|
|
8
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
9
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
10
10
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
11
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
12
11
|
import chunk from 'lodash.chunk';
|
|
13
|
-
import { encodeFunctionData,
|
|
12
|
+
import { encodeFunctionData, getContract, hexToBigInt, keccak256 } from 'viem';
|
|
14
13
|
import { getPublicClient } from '../client.js';
|
|
15
14
|
import { formatViemError } from '../utils.js';
|
|
16
15
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
@@ -68,16 +67,11 @@ export class RollupContract {
|
|
|
68
67
|
return this.rollup;
|
|
69
68
|
}
|
|
70
69
|
async getSlashingProposer() {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
70
|
+
const slasher = await this.getSlasherContract();
|
|
71
|
+
if (!slasher) {
|
|
73
72
|
return undefined;
|
|
74
73
|
}
|
|
75
|
-
const
|
|
76
|
-
address: slasherAddress,
|
|
77
|
-
abi: SlasherAbi,
|
|
78
|
-
client: this.client
|
|
79
|
-
});
|
|
80
|
-
const proposerAddress = await slasher.read.PROPOSER();
|
|
74
|
+
const proposerAddress = await slasher.getProposer();
|
|
81
75
|
const proposerAbi = [
|
|
82
76
|
{
|
|
83
77
|
type: 'function',
|
|
@@ -94,7 +88,7 @@ export class RollupContract {
|
|
|
94
88
|
}
|
|
95
89
|
];
|
|
96
90
|
const proposer = getContract({
|
|
97
|
-
address: proposerAddress,
|
|
91
|
+
address: proposerAddress.toString(),
|
|
98
92
|
abi: proposerAbi,
|
|
99
93
|
client: this.client
|
|
100
94
|
});
|
|
@@ -128,6 +122,12 @@ export class RollupContract {
|
|
|
128
122
|
getEjectionThreshold() {
|
|
129
123
|
return this.rollup.read.getEjectionThreshold();
|
|
130
124
|
}
|
|
125
|
+
getLocalEjectionThreshold() {
|
|
126
|
+
return this.rollup.read.getLocalEjectionThreshold();
|
|
127
|
+
}
|
|
128
|
+
getLagInEpochs() {
|
|
129
|
+
return this.rollup.read.getLagInEpochs();
|
|
130
|
+
}
|
|
131
131
|
getActivationThreshold() {
|
|
132
132
|
return this.rollup.read.getActivationThreshold();
|
|
133
133
|
}
|
|
@@ -150,19 +150,41 @@ export class RollupContract {
|
|
|
150
150
|
return this.rollup.read.getVersion();
|
|
151
151
|
}
|
|
152
152
|
async getGenesisArchiveTreeRoot() {
|
|
153
|
-
|
|
153
|
+
return await this.rollup.read.archiveAt([
|
|
154
154
|
0n
|
|
155
155
|
]);
|
|
156
|
-
return block.archive;
|
|
157
156
|
}
|
|
158
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Returns rollup constants used for epoch queries.
|
|
159
|
+
* Return type is `L1RollupConstants` which is defined in stdlib,
|
|
160
|
+
* so we cant reference it until we move this contract to that package.
|
|
161
|
+
*/ async getRollupConstants() {
|
|
162
|
+
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs] = await Promise.all([
|
|
163
|
+
this.getL1StartBlock(),
|
|
164
|
+
this.getL1GenesisTime(),
|
|
165
|
+
this.getSlotDuration(),
|
|
166
|
+
this.getEpochDuration(),
|
|
167
|
+
this.getProofSubmissionEpochs()
|
|
168
|
+
]);
|
|
169
|
+
return {
|
|
170
|
+
l1StartBlock,
|
|
171
|
+
l1GenesisTime,
|
|
172
|
+
slotDuration: Number(slotDuration),
|
|
173
|
+
epochDuration: Number(epochDuration),
|
|
174
|
+
proofSubmissionEpochs: Number(proofSubmissionEpochs)
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
getSlasherAddress() {
|
|
159
178
|
return this.rollup.read.getSlasher();
|
|
160
179
|
}
|
|
161
180
|
/**
|
|
162
181
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
163
182
|
*/ async getSlasherContract() {
|
|
164
|
-
const slasherAddress = await this.
|
|
165
|
-
|
|
183
|
+
const slasherAddress = EthAddress.fromString(await this.getSlasherAddress());
|
|
184
|
+
if (slasherAddress.isZero()) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
return new SlasherContract(this.client, slasherAddress);
|
|
166
188
|
}
|
|
167
189
|
getOwner() {
|
|
168
190
|
return this.rollup.read.owner();
|
|
@@ -171,13 +193,11 @@ export class RollupContract {
|
|
|
171
193
|
return this.rollup.read.getActiveAttesterCount();
|
|
172
194
|
}
|
|
173
195
|
async getSlashingProposerAddress() {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
return EthAddress.fromString(await slasher.read.PROPOSER());
|
|
196
|
+
const slasher = await this.getSlasherContract();
|
|
197
|
+
if (!slasher) {
|
|
198
|
+
return EthAddress.ZERO;
|
|
199
|
+
}
|
|
200
|
+
return await slasher.getProposer();
|
|
181
201
|
}
|
|
182
202
|
getBlockReward() {
|
|
183
203
|
return this.rollup.read.getBlockReward();
|
|
@@ -266,7 +286,7 @@ export class RollupContract {
|
|
|
266
286
|
}
|
|
267
287
|
getBlock(blockNumber) {
|
|
268
288
|
return this.rollup.read.getBlock([
|
|
269
|
-
blockNumber
|
|
289
|
+
BigInt(blockNumber)
|
|
270
290
|
]);
|
|
271
291
|
}
|
|
272
292
|
getTips() {
|
|
@@ -280,8 +300,16 @@ export class RollupContract {
|
|
|
280
300
|
getEntryQueueLength() {
|
|
281
301
|
return this.rollup.read.getEntryQueueLength();
|
|
282
302
|
}
|
|
283
|
-
|
|
284
|
-
|
|
303
|
+
getAvailableValidatorFlushes() {
|
|
304
|
+
return this.rollup.read.getAvailableValidatorFlushes();
|
|
305
|
+
}
|
|
306
|
+
getNextFlushableEpoch() {
|
|
307
|
+
return this.rollup.read.getNextFlushableEpoch();
|
|
308
|
+
}
|
|
309
|
+
getCurrentEpochNumber() {
|
|
310
|
+
return this.rollup.read.getCurrentEpoch();
|
|
311
|
+
}
|
|
312
|
+
getEpochNumberForBlock(blockNumber) {
|
|
285
313
|
return this.rollup.read.getEpochForBlock([
|
|
286
314
|
BigInt(blockNumber)
|
|
287
315
|
]);
|
|
@@ -332,64 +360,6 @@ export class RollupContract {
|
|
|
332
360
|
}
|
|
333
361
|
}
|
|
334
362
|
/**
|
|
335
|
-
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
336
|
-
*
|
|
337
|
-
* @param attestations - Array of committee attestations with addresses and signatures
|
|
338
|
-
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
339
|
-
*/ static packAttestations(attestations) {
|
|
340
|
-
const length = attestations.length;
|
|
341
|
-
// Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
|
|
342
|
-
const bitmapSize = Math.ceil(length / 8);
|
|
343
|
-
const signatureIndices = new Uint8Array(bitmapSize);
|
|
344
|
-
// Calculate total data size needed
|
|
345
|
-
let totalDataSize = 0;
|
|
346
|
-
for(let i = 0; i < length; i++){
|
|
347
|
-
const signature = attestations[i].signature;
|
|
348
|
-
// Check if signature is empty (v = 0)
|
|
349
|
-
const isEmpty = signature.v === 0;
|
|
350
|
-
if (!isEmpty) {
|
|
351
|
-
totalDataSize += 65; // v (1) + r (32) + s (32)
|
|
352
|
-
} else {
|
|
353
|
-
totalDataSize += 20; // address only
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
const signaturesOrAddresses = new Uint8Array(totalDataSize);
|
|
357
|
-
let dataIndex = 0;
|
|
358
|
-
// Pack the data
|
|
359
|
-
for(let i = 0; i < length; i++){
|
|
360
|
-
const attestation = attestations[i];
|
|
361
|
-
const signature = attestation.signature;
|
|
362
|
-
// Check if signature is empty
|
|
363
|
-
const isEmpty = signature.v === 0;
|
|
364
|
-
if (!isEmpty) {
|
|
365
|
-
// Set bit in bitmap (bit 7-0 in each byte, left to right)
|
|
366
|
-
const byteIndex = Math.floor(i / 8);
|
|
367
|
-
const bitIndex = 7 - i % 8;
|
|
368
|
-
signatureIndices[byteIndex] |= 1 << bitIndex;
|
|
369
|
-
// Pack signature: v + r + s
|
|
370
|
-
signaturesOrAddresses[dataIndex] = signature.v;
|
|
371
|
-
dataIndex++;
|
|
372
|
-
// Pack r (32 bytes)
|
|
373
|
-
const rBytes = Buffer.from(signature.r.slice(2), 'hex');
|
|
374
|
-
signaturesOrAddresses.set(rBytes, dataIndex);
|
|
375
|
-
dataIndex += 32;
|
|
376
|
-
// Pack s (32 bytes)
|
|
377
|
-
const sBytes = Buffer.from(signature.s.slice(2), 'hex');
|
|
378
|
-
signaturesOrAddresses.set(sBytes, dataIndex);
|
|
379
|
-
dataIndex += 32;
|
|
380
|
-
} else {
|
|
381
|
-
// Pack address only (20 bytes)
|
|
382
|
-
const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
|
|
383
|
-
signaturesOrAddresses.set(addrBytes, dataIndex);
|
|
384
|
-
dataIndex += 20;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return {
|
|
388
|
-
signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
|
|
389
|
-
signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
363
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
394
364
|
*
|
|
395
365
|
* @dev Throws if unable to propose
|
|
@@ -453,7 +423,7 @@ export class RollupContract {
|
|
|
453
423
|
}
|
|
454
424
|
];
|
|
455
425
|
}
|
|
456
|
-
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(blockNumber,
|
|
426
|
+
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(blockNumber, attestationsAndSigners, committee, invalidIndex) {
|
|
457
427
|
return {
|
|
458
428
|
to: this.address,
|
|
459
429
|
data: encodeFunctionData({
|
|
@@ -461,14 +431,14 @@ export class RollupContract {
|
|
|
461
431
|
functionName: 'invalidateBadAttestation',
|
|
462
432
|
args: [
|
|
463
433
|
BigInt(blockNumber),
|
|
464
|
-
|
|
434
|
+
attestationsAndSigners,
|
|
465
435
|
committee.map((addr)=>addr.toString()),
|
|
466
436
|
BigInt(invalidIndex)
|
|
467
437
|
]
|
|
468
438
|
})
|
|
469
439
|
};
|
|
470
440
|
}
|
|
471
|
-
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(blockNumber,
|
|
441
|
+
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(blockNumber, attestationsAndSigners, committee) {
|
|
472
442
|
return {
|
|
473
443
|
to: this.address,
|
|
474
444
|
data: encodeFunctionData({
|
|
@@ -476,7 +446,7 @@ export class RollupContract {
|
|
|
476
446
|
functionName: 'invalidateInsufficientAttestations',
|
|
477
447
|
args: [
|
|
478
448
|
BigInt(blockNumber),
|
|
479
|
-
|
|
449
|
+
attestationsAndSigners,
|
|
480
450
|
committee.map((addr)=>addr.toString())
|
|
481
451
|
]
|
|
482
452
|
})
|
|
@@ -577,6 +547,9 @@ export class RollupContract {
|
|
|
577
547
|
getStakingAsset() {
|
|
578
548
|
return this.rollup.read.getStakingAsset();
|
|
579
549
|
}
|
|
550
|
+
getRewardConfig() {
|
|
551
|
+
return this.rollup.read.getRewardConfig();
|
|
552
|
+
}
|
|
580
553
|
setupEpoch(l1TxUtils) {
|
|
581
554
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
582
555
|
to: this.address,
|
|
@@ -611,6 +584,20 @@ export class RollupContract {
|
|
|
611
584
|
}
|
|
612
585
|
});
|
|
613
586
|
}
|
|
587
|
+
listenToBlockInvalidated(callback) {
|
|
588
|
+
return this.rollup.watchEvent.BlockInvalidated({}, {
|
|
589
|
+
onLogs: (logs)=>{
|
|
590
|
+
for (const log of logs){
|
|
591
|
+
const args = log.args;
|
|
592
|
+
if (args.blockNumber !== undefined) {
|
|
593
|
+
callback({
|
|
594
|
+
blockNumber: args.blockNumber
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
614
601
|
async getSlashEvents(l1BlockHash) {
|
|
615
602
|
const events = await this.rollup.getEvents.Slashed({}, {
|
|
616
603
|
blockHash: l1BlockHash,
|
|
@@ -657,6 +644,12 @@ _ts_decorate([
|
|
|
657
644
|
_ts_decorate([
|
|
658
645
|
memoize
|
|
659
646
|
], RollupContract.prototype, "getEjectionThreshold", null);
|
|
647
|
+
_ts_decorate([
|
|
648
|
+
memoize
|
|
649
|
+
], RollupContract.prototype, "getLocalEjectionThreshold", null);
|
|
650
|
+
_ts_decorate([
|
|
651
|
+
memoize
|
|
652
|
+
], RollupContract.prototype, "getLagInEpochs", null);
|
|
660
653
|
_ts_decorate([
|
|
661
654
|
memoize
|
|
662
655
|
], RollupContract.prototype, "getActivationThreshold", null);
|
|
@@ -681,3 +674,6 @@ _ts_decorate([
|
|
|
681
674
|
_ts_decorate([
|
|
682
675
|
memoize
|
|
683
676
|
], RollupContract.prototype, "getGenesisArchiveTreeRoot", null);
|
|
677
|
+
_ts_decorate([
|
|
678
|
+
memoize
|
|
679
|
+
], RollupContract.prototype, "getRollupConstants", null);
|
|
@@ -15,11 +15,21 @@ export declare class SlasherContract {
|
|
|
15
15
|
* @returns True if the payload is vetoed, false otherwise
|
|
16
16
|
*/
|
|
17
17
|
isPayloadVetoed(payloadAddress: EthAddress): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if slashing is currently enabled. Slashing can be disabled by the vetoer.
|
|
20
|
+
* @returns True if slashing is enabled, false otherwise
|
|
21
|
+
*/
|
|
22
|
+
isSlashingEnabled(): Promise<boolean>;
|
|
18
23
|
/**
|
|
19
24
|
* Gets the current vetoer address.
|
|
20
25
|
* @returns The vetoer address
|
|
21
26
|
*/
|
|
22
27
|
getVetoer(): Promise<EthAddress>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the disable duration by the vetoer.
|
|
30
|
+
* @returns The disable duration in seconds
|
|
31
|
+
*/
|
|
32
|
+
getSlashingDisableDuration(): Promise<number>;
|
|
23
33
|
/**
|
|
24
34
|
* Gets the current governance address.
|
|
25
35
|
* @returns The governance address
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slasher_contract.d.ts","sourceRoot":"","sources":["../../src/contracts/slasher_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,OAAO,CAAC,QAAQ,CAAuD;gBAGpD,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,GAAG,yCAAmC;IASzD;;;;OAIG;IACU,eAAe,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1E;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC;IAK7C;;;OAGG;IACU,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAKjD;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC;CAIhD"}
|
|
1
|
+
{"version":3,"file":"slasher_contract.d.ts","sourceRoot":"","sources":["../../src/contracts/slasher_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,OAAO,CAAC,QAAQ,CAAuD;gBAGpD,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,GAAG,yCAAmC;IASzD;;;;OAIG;IACU,eAAe,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1E;;;OAGG;IACU,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IASlD;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC;IAK7C;;;OAGG;IACU,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1D;;;OAGG;IACU,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAKjD;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC;CAIhD"}
|
|
@@ -34,6 +34,17 @@ import { getContract } from 'viem';
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
+
* Checks if slashing is currently enabled. Slashing can be disabled by the vetoer.
|
|
38
|
+
* @returns True if slashing is enabled, false otherwise
|
|
39
|
+
*/ async isSlashingEnabled() {
|
|
40
|
+
try {
|
|
41
|
+
return await this.contract.read.isSlashingEnabled();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
this.log.error(`Error checking if slashing is enabled`, error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
37
48
|
* Gets the current vetoer address.
|
|
38
49
|
* @returns The vetoer address
|
|
39
50
|
*/ async getVetoer() {
|
|
@@ -41,6 +52,13 @@ import { getContract } from 'viem';
|
|
|
41
52
|
return EthAddress.fromString(vetoer);
|
|
42
53
|
}
|
|
43
54
|
/**
|
|
55
|
+
* Gets the disable duration by the vetoer.
|
|
56
|
+
* @returns The disable duration in seconds
|
|
57
|
+
*/ async getSlashingDisableDuration() {
|
|
58
|
+
const duration = await this.contract.read.SLASHING_DISABLE_DURATION();
|
|
59
|
+
return Number(duration);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
44
62
|
* Gets the current governance address.
|
|
45
63
|
* @returns The governance address
|
|
46
64
|
*/ async getGovernance() {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type L1TxRequest, type ViemClient } from '@aztec/ethereum';
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import EventEmitter from 'events';
|
|
5
4
|
import { type Hex, type Log, type TypedDataDefinition } from 'viem';
|
|
6
5
|
/**
|
|
7
6
|
* Wrapper around the TallySlashingProposer contract that provides
|
|
8
7
|
* a TypeScript interface for interacting with the consensus-based slashing system.
|
|
9
8
|
*/
|
|
10
|
-
export declare class TallySlashingProposerContract
|
|
9
|
+
export declare class TallySlashingProposerContract {
|
|
11
10
|
readonly client: ViemClient;
|
|
12
11
|
private readonly contract;
|
|
13
12
|
readonly type: "tally";
|
|
@@ -29,9 +28,15 @@ export declare class TallySlashingProposerContract extends EventEmitter {
|
|
|
29
28
|
*/
|
|
30
29
|
getRound(round: bigint): Promise<{
|
|
31
30
|
isExecuted: boolean;
|
|
32
|
-
readyToExecute: boolean;
|
|
33
31
|
voteCount: bigint;
|
|
34
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if a round is ready to execute at a given slot
|
|
35
|
+
* @param round - The round number to check
|
|
36
|
+
* @param slot - The slot number to check at
|
|
37
|
+
* @returns Whether the round is ready to execute
|
|
38
|
+
*/
|
|
39
|
+
isRoundReadyToExecute(round: bigint, slot: bigint): Promise<boolean>;
|
|
35
40
|
/** Returns the slash actions and payload address for a given round (zero if no slash actions) */
|
|
36
41
|
getPayload(round: bigint): Promise<{
|
|
37
42
|
actions: {
|
|
@@ -96,6 +101,11 @@ export declare class TallySlashingProposerContract extends EventEmitter {
|
|
|
96
101
|
* @returns L1 transaction request
|
|
97
102
|
*/
|
|
98
103
|
buildExecuteRoundRequest(round: bigint, committees: EthAddress[][]): L1TxRequest;
|
|
104
|
+
/** Returns the last vote emitted for a given round */
|
|
105
|
+
getLastVote(round: bigint): Promise<{
|
|
106
|
+
validator: EthAddress;
|
|
107
|
+
slashAmount: bigint;
|
|
108
|
+
}[]>;
|
|
99
109
|
/**
|
|
100
110
|
* Listen for VoteCast events
|
|
101
111
|
* @param callback - Callback function to handle vote cast events
|
|
@@ -116,4 +126,13 @@ export declare class TallySlashingProposerContract extends EventEmitter {
|
|
|
116
126
|
l1BlockHash: Hex;
|
|
117
127
|
}) => void): () => void;
|
|
118
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Decodes a Buffer containing slash votes back into an array of numbers.
|
|
131
|
+
* Each vote is represented as a 2-bit value (0, 1, 2, or 3) representing slashing units.
|
|
132
|
+
* @dev This should live in stdlib next to encodeSlashConsensusVotes but is here since we
|
|
133
|
+
* do not have a dependency to stdlib from the ethereum package. We need a larger refactor to fix this.
|
|
134
|
+
* @param buffer - The Buffer containing encoded slash votes
|
|
135
|
+
* @returns An array of numbers representing the slash votes
|
|
136
|
+
*/
|
|
137
|
+
export declare function decodeSlashConsensusVotes(buffer: Buffer): number[];
|
|
119
138
|
//# sourceMappingURL=tally_slashing_proposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tally_slashing_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/tally_slashing_proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"tally_slashing_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/tally_slashing_proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAm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