@aztec/ethereum 0.0.1-commit.3fd054f6 → 0.0.1-commit.431c48d
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 +19 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +52 -3
- package/dest/config.d.ts +15 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +29 -9
- package/dest/contracts/chain_state_override.d.ts +78 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +137 -0
- package/dest/contracts/empire_base.d.ts +1 -3
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/fee_asset_price_oracle.d.ts +6 -2
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -1
- package/dest/contracts/fee_asset_price_oracle.js +11 -6
- package/dest/contracts/governance.d.ts +135 -35
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +226 -15
- package/dest/contracts/governance_proposer.d.ts +33 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +52 -13
- package/dest/contracts/gse.d.ts +4 -2
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/gse.js +2 -2
- package/dest/contracts/inbox.d.ts +3 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +12 -7
- package/dest/contracts/index.d.ts +3 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +2 -2
- package/dest/contracts/multicall.d.ts +79 -13
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +117 -95
- package/dest/contracts/outbox.d.ts +27 -4
- package/dest/contracts/outbox.d.ts.map +1 -1
- package/dest/contracts/outbox.js +34 -7
- package/dest/contracts/rollup.d.ts +5418 -28
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +389 -95
- package/dest/contracts/slashing_proposer.d.ts +171 -0
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/slashing_proposer.js +753 -0
- package/dest/contracts/watch_event.d.ts +36 -0
- package/dest/contracts/watch_event.d.ts.map +1 -0
- package/dest/contracts/watch_event.js +66 -0
- package/dest/deploy_aztec_l1_contracts.d.ts +4 -7
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +15 -8
- package/dest/foundry_binary.d.ts +13 -0
- package/dest/foundry_binary.d.ts.map +1 -0
- package/dest/foundry_binary.js +52 -0
- package/dest/generated/l1-contracts-defaults.d.ts +2 -2
- package/dest/generated/l1-contracts-defaults.js +2 -2
- package/dest/l1_artifacts.d.ts +14941 -16273
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +61 -65
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +101 -82
- package/dest/l1_reader.d.ts +3 -5
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +3 -6
- package/dest/l1_tx_utils/config.js +3 -3
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +9 -1
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +115 -54
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +49 -19
- package/dest/l1_tx_utils/tx_delayer.d.ts +5 -3
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -1
- package/dest/l1_tx_utils/tx_delayer.js +7 -5
- package/dest/publisher_manager.d.ts +18 -6
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +44 -7
- package/dest/queries.d.ts +13 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +62 -3
- package/dest/test/blob_kzg_warmup.d.ts +19 -0
- package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
- package/dest/test/blob_kzg_warmup.js +64 -0
- package/dest/test/chain_monitor.d.ts +34 -2
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +76 -6
- package/dest/test/eth_cheat_codes.d.ts +26 -3
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +61 -40
- package/dest/test/index.d.ts +2 -1
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -0
- package/dest/test/recording_rpc_server.d.ts +18 -0
- package/dest/test/recording_rpc_server.d.ts.map +1 -0
- package/dest/test/recording_rpc_server.js +68 -0
- package/dest/test/rollup_cheat_codes.d.ts +60 -3
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +86 -7
- package/dest/test/start_anvil.d.ts +1 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +41 -5
- package/dest/utils.d.ts +9 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +45 -14
- package/package.json +6 -6
- package/src/client.ts +63 -1
- package/src/config.ts +44 -13
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/empire_base.ts +0 -2
- package/src/contracts/fee_asset_price_oracle.ts +10 -5
- package/src/contracts/governance.ts +310 -10
- package/src/contracts/governance_proposer.ts +56 -13
- package/src/contracts/gse.ts +7 -2
- package/src/contracts/inbox.ts +13 -5
- package/src/contracts/index.ts +2 -2
- package/src/contracts/multicall.ts +179 -105
- package/src/contracts/outbox.ts +42 -8
- package/src/contracts/rollup.ts +429 -86
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +119 -45
- package/src/contracts/watch_event.ts +110 -0
- package/src/deploy_aztec_l1_contracts.ts +19 -10
- package/src/foundry_binary.ts +57 -0
- package/src/generated/l1-contracts-defaults.ts +2 -2
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +120 -94
- package/src/l1_reader.ts +4 -9
- package/src/l1_tx_utils/config.ts +3 -3
- package/src/l1_tx_utils/l1_tx_utils.ts +107 -50
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +49 -13
- package/src/l1_tx_utils/tx_delayer.ts +16 -7
- package/src/publisher_manager.ts +54 -18
- package/src/queries.ts +70 -4
- package/src/test/blob_kzg_warmup.ts +65 -0
- package/src/test/chain_monitor.ts +93 -5
- package/src/test/eth_cheat_codes.ts +57 -43
- package/src/test/index.ts +1 -0
- package/src/test/recording_rpc_server.ts +69 -0
- package/src/test/rollup_cheat_codes.ts +115 -6
- package/src/test/start_anvil.ts +38 -6
- package/src/utils.ts +41 -17
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -69
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -216
- package/dest/contracts/tally_slashing_proposer.d.ts +0 -140
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/tally_slashing_proposer.js +0 -320
- package/src/contracts/empire_slashing_proposer.ts +0 -265
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { L1TxRequest } from '@aztec/ethereum/l1-tx-utils';
|
|
2
|
-
import type { ViemClient } from '@aztec/ethereum/types';
|
|
3
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
5
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
import { type Hex, type Log, type TypedDataDefinition } from 'viem';
|
|
7
|
-
/**
|
|
8
|
-
* Wrapper around the TallySlashingProposer contract that provides
|
|
9
|
-
* a TypeScript interface for interacting with the consensus-based slashing system.
|
|
10
|
-
*/
|
|
11
|
-
export declare class TallySlashingProposerContract {
|
|
12
|
-
readonly client: ViemClient;
|
|
13
|
-
private readonly contract;
|
|
14
|
-
readonly type: "tally";
|
|
15
|
-
constructor(client: ViemClient, address: Hex | EthAddress);
|
|
16
|
-
get address(): EthAddress;
|
|
17
|
-
getQuorumSize(): Promise<bigint>;
|
|
18
|
-
getRoundSize(): Promise<bigint>;
|
|
19
|
-
getCommitteeSize(): Promise<bigint>;
|
|
20
|
-
getRoundSizeInEpochs(): Promise<bigint>;
|
|
21
|
-
getLifetimeInRounds(): Promise<bigint>;
|
|
22
|
-
getExecutionDelayInRounds(): Promise<bigint>;
|
|
23
|
-
getSlashingAmounts(): Promise<[bigint, bigint, bigint]>;
|
|
24
|
-
getSlashOffsetInRounds(): Promise<bigint>;
|
|
25
|
-
getCurrentRound(): Promise<bigint>;
|
|
26
|
-
/**
|
|
27
|
-
* Get round information
|
|
28
|
-
* @param round - The round number to query
|
|
29
|
-
* @returns Round status information
|
|
30
|
-
*/
|
|
31
|
-
getRound(round: bigint): Promise<{
|
|
32
|
-
isExecuted: boolean;
|
|
33
|
-
voteCount: bigint;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Check if a round is ready to execute at a given slot
|
|
37
|
-
* @param round - The round number to check
|
|
38
|
-
* @param slot - The slot number to check at
|
|
39
|
-
* @returns Whether the round is ready to execute
|
|
40
|
-
*/
|
|
41
|
-
isRoundReadyToExecute(round: bigint, slot: SlotNumber): Promise<boolean>;
|
|
42
|
-
/** Returns the slash actions and payload address for a given round (zero if no slash actions) */
|
|
43
|
-
getPayload(round: bigint): Promise<{
|
|
44
|
-
actions: {
|
|
45
|
-
slashAmount: bigint;
|
|
46
|
-
validator: EthAddress;
|
|
47
|
-
}[];
|
|
48
|
-
address: EthAddress;
|
|
49
|
-
}>;
|
|
50
|
-
/** Returns the slash actions to be executed for a given round based on votes */
|
|
51
|
-
getTally(round: bigint): Promise<{
|
|
52
|
-
actions: {
|
|
53
|
-
slashAmount: bigint;
|
|
54
|
-
validator: EthAddress;
|
|
55
|
-
}[];
|
|
56
|
-
committees: EthAddress[][];
|
|
57
|
-
}>;
|
|
58
|
-
private mapSlashActions;
|
|
59
|
-
/** Tries to extract a VoteCast event from the given logs. */
|
|
60
|
-
tryExtractVoteCastEvent(logs: Log[]): {
|
|
61
|
-
eventName: "VoteCast";
|
|
62
|
-
args: {
|
|
63
|
-
proposer: `0x${string}`;
|
|
64
|
-
round: bigint;
|
|
65
|
-
slot: bigint;
|
|
66
|
-
};
|
|
67
|
-
} | undefined;
|
|
68
|
-
/** Tries to extract a RoundExecuted event from the given logs. */
|
|
69
|
-
tryExtractRoundExecutedEvent(logs: Log[]): {
|
|
70
|
-
eventName: "RoundExecuted";
|
|
71
|
-
args: {
|
|
72
|
-
round: bigint;
|
|
73
|
-
slashCount: bigint;
|
|
74
|
-
};
|
|
75
|
-
} | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* Create a transaction to vote for slashing offenses
|
|
78
|
-
* @param votes - The encoded votes for slashing
|
|
79
|
-
* @param slot - The slot number for the vote
|
|
80
|
-
* @param signer - The signer to produce the signature
|
|
81
|
-
* @returns L1 transaction request
|
|
82
|
-
*/
|
|
83
|
-
buildVoteRequestFromSigner(votes: Hex, slot: SlotNumber, signer: (msg: TypedDataDefinition) => Promise<Hex>): Promise<L1TxRequest>;
|
|
84
|
-
/** Returns the typed data definition to EIP712-sign for voting */
|
|
85
|
-
buildVoteTypedData(votes: Hex, slot: SlotNumber): TypedDataDefinition;
|
|
86
|
-
/** Gets the digest to sign for voting directly from the contract */
|
|
87
|
-
getVoteDataDigest(votes: Hex, slot: SlotNumber): Promise<Buffer32>;
|
|
88
|
-
/**
|
|
89
|
-
* Create a transaction to vote for slashing offenses
|
|
90
|
-
* @param votes - The encoded votes for slashing
|
|
91
|
-
* @param signature - The signature from the current proposer
|
|
92
|
-
* @returns L1 transaction request
|
|
93
|
-
*/
|
|
94
|
-
buildVoteRequestWithSignature(votes: Hex, signature: {
|
|
95
|
-
v: number;
|
|
96
|
-
r: Hex;
|
|
97
|
-
s: Hex;
|
|
98
|
-
}): L1TxRequest;
|
|
99
|
-
/**
|
|
100
|
-
* Create a transaction to execute a slashing round
|
|
101
|
-
* @param round - The round number to execute
|
|
102
|
-
* @param committees - The committees for each epoch in the round
|
|
103
|
-
* @returns L1 transaction request
|
|
104
|
-
*/
|
|
105
|
-
buildExecuteRoundRequest(round: bigint, committees: EthAddress[][]): L1TxRequest;
|
|
106
|
-
/** Returns the last vote emitted for a given round */
|
|
107
|
-
getLastVote(round: bigint): Promise<{
|
|
108
|
-
validator: EthAddress;
|
|
109
|
-
slashAmount: bigint;
|
|
110
|
-
}[]>;
|
|
111
|
-
/**
|
|
112
|
-
* Listen for VoteCast events
|
|
113
|
-
* @param callback - Callback function to handle vote cast events
|
|
114
|
-
* @returns Unwatch function
|
|
115
|
-
*/
|
|
116
|
-
listenToVoteCast(callback: (args: {
|
|
117
|
-
round: bigint;
|
|
118
|
-
proposer: string;
|
|
119
|
-
}) => void): () => void;
|
|
120
|
-
/**
|
|
121
|
-
* Listen for RoundExecuted events
|
|
122
|
-
* @param callback - Callback function to handle round executed events
|
|
123
|
-
* @returns Unwatch function
|
|
124
|
-
*/
|
|
125
|
-
listenToRoundExecuted(callback: (args: {
|
|
126
|
-
round: bigint;
|
|
127
|
-
slashCount: bigint;
|
|
128
|
-
l1BlockHash: Hex;
|
|
129
|
-
}) => void): () => void;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Decodes a Buffer containing slash votes back into an array of numbers.
|
|
133
|
-
* Each vote is represented as a 2-bit value (0, 1, 2, or 3) representing slashing units.
|
|
134
|
-
* @dev This should live in stdlib next to encodeSlashConsensusVotes but is here since we
|
|
135
|
-
* do not have a dependency to stdlib from the ethereum package. We need a larger refactor to fix this.
|
|
136
|
-
* @param buffer - The Buffer containing encoded slash votes
|
|
137
|
-
* @returns An array of numbers representing the slash votes
|
|
138
|
-
*/
|
|
139
|
-
export declare function decodeSlashConsensusVotes(buffer: Buffer): number[];
|
|
140
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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C;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAcjG;IAED;;;;OAIG;IACI,qBAAqB,CAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,GAChF,MAAM,IAAI,CAcZ;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAelE"}
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
2
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
|
-
import { hexToBuffer } from '@aztec/foundation/string';
|
|
6
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
7
|
-
import { TallySlashingProposerAbi } from '@aztec/l1-artifacts/TallySlashingProposerAbi';
|
|
8
|
-
import { encodeFunctionData, getContract } from 'viem';
|
|
9
|
-
/**
|
|
10
|
-
* Wrapper around the TallySlashingProposer contract that provides
|
|
11
|
-
* a TypeScript interface for interacting with the consensus-based slashing system.
|
|
12
|
-
*/ export class TallySlashingProposerContract {
|
|
13
|
-
client;
|
|
14
|
-
contract;
|
|
15
|
-
type;
|
|
16
|
-
constructor(client, address){
|
|
17
|
-
this.client = client;
|
|
18
|
-
this.type = 'tally';
|
|
19
|
-
this.contract = getContract({
|
|
20
|
-
address: typeof address === 'string' ? address : address.toString(),
|
|
21
|
-
abi: TallySlashingProposerAbi,
|
|
22
|
-
client
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
get address() {
|
|
26
|
-
return EthAddress.fromString(this.contract.address);
|
|
27
|
-
}
|
|
28
|
-
getQuorumSize() {
|
|
29
|
-
return this.contract.read.QUORUM();
|
|
30
|
-
}
|
|
31
|
-
getRoundSize() {
|
|
32
|
-
return this.contract.read.ROUND_SIZE();
|
|
33
|
-
}
|
|
34
|
-
getCommitteeSize() {
|
|
35
|
-
return this.contract.read.COMMITTEE_SIZE();
|
|
36
|
-
}
|
|
37
|
-
getRoundSizeInEpochs() {
|
|
38
|
-
return this.contract.read.ROUND_SIZE_IN_EPOCHS();
|
|
39
|
-
}
|
|
40
|
-
getLifetimeInRounds() {
|
|
41
|
-
return this.contract.read.LIFETIME_IN_ROUNDS();
|
|
42
|
-
}
|
|
43
|
-
getExecutionDelayInRounds() {
|
|
44
|
-
return this.contract.read.EXECUTION_DELAY_IN_ROUNDS();
|
|
45
|
-
}
|
|
46
|
-
getSlashingAmounts() {
|
|
47
|
-
return Promise.all([
|
|
48
|
-
this.contract.read.SLASH_AMOUNT_SMALL(),
|
|
49
|
-
this.contract.read.SLASH_AMOUNT_MEDIUM(),
|
|
50
|
-
this.contract.read.SLASH_AMOUNT_LARGE()
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
getSlashOffsetInRounds() {
|
|
54
|
-
return this.contract.read.SLASH_OFFSET_IN_ROUNDS();
|
|
55
|
-
}
|
|
56
|
-
getCurrentRound() {
|
|
57
|
-
return this.contract.read.getCurrentRound();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get round information
|
|
61
|
-
* @param round - The round number to query
|
|
62
|
-
* @returns Round status information
|
|
63
|
-
*/ async getRound(round) {
|
|
64
|
-
const [isExecuted, voteCount] = await this.contract.read.getRound([
|
|
65
|
-
round
|
|
66
|
-
]);
|
|
67
|
-
return {
|
|
68
|
-
isExecuted,
|
|
69
|
-
voteCount
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Check if a round is ready to execute at a given slot
|
|
74
|
-
* @param round - The round number to check
|
|
75
|
-
* @param slot - The slot number to check at
|
|
76
|
-
* @returns Whether the round is ready to execute
|
|
77
|
-
*/ async isRoundReadyToExecute(round, slot) {
|
|
78
|
-
return await this.contract.read.isRoundReadyToExecute([
|
|
79
|
-
round,
|
|
80
|
-
BigInt(slot)
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
/** Returns the slash actions and payload address for a given round (zero if no slash actions) */ async getPayload(round) {
|
|
84
|
-
const { result: committees } = await this.contract.simulate.getSlashTargetCommittees([
|
|
85
|
-
round
|
|
86
|
-
]);
|
|
87
|
-
const tally = await this.contract.read.getTally([
|
|
88
|
-
round,
|
|
89
|
-
committees
|
|
90
|
-
]);
|
|
91
|
-
const address = await this.contract.read.getPayloadAddress([
|
|
92
|
-
round,
|
|
93
|
-
tally
|
|
94
|
-
]);
|
|
95
|
-
const actions = this.mapSlashActions(tally);
|
|
96
|
-
return {
|
|
97
|
-
actions,
|
|
98
|
-
address: EthAddress.fromString(address)
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
/** Returns the slash actions to be executed for a given round based on votes */ async getTally(round) {
|
|
102
|
-
const { result: committees } = await this.contract.simulate.getSlashTargetCommittees([
|
|
103
|
-
round
|
|
104
|
-
]);
|
|
105
|
-
const tally = await this.contract.read.getTally([
|
|
106
|
-
round,
|
|
107
|
-
committees
|
|
108
|
-
]);
|
|
109
|
-
return {
|
|
110
|
-
actions: this.mapSlashActions(tally),
|
|
111
|
-
committees: committees.map((c)=>c.map(EthAddress.fromString))
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
mapSlashActions(actions) {
|
|
115
|
-
return actions.map(({ validator, slashAmount })=>({
|
|
116
|
-
validator: EthAddress.fromString(validator),
|
|
117
|
-
slashAmount
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
/** Tries to extract a VoteCast event from the given logs. */ tryExtractVoteCastEvent(logs) {
|
|
121
|
-
return tryExtractEvent(logs, this.address.toString(), TallySlashingProposerAbi, 'VoteCast');
|
|
122
|
-
}
|
|
123
|
-
/** Tries to extract a RoundExecuted event from the given logs. */ tryExtractRoundExecutedEvent(logs) {
|
|
124
|
-
return tryExtractEvent(logs, this.address.toString(), TallySlashingProposerAbi, 'RoundExecuted');
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Create a transaction to vote for slashing offenses
|
|
128
|
-
* @param votes - The encoded votes for slashing
|
|
129
|
-
* @param slot - The slot number for the vote
|
|
130
|
-
* @param signer - The signer to produce the signature
|
|
131
|
-
* @returns L1 transaction request
|
|
132
|
-
*/ async buildVoteRequestFromSigner(votes, slot, signer) {
|
|
133
|
-
const typedData = this.buildVoteTypedData(votes, slot);
|
|
134
|
-
const signature = Signature.fromString(await signer(typedData));
|
|
135
|
-
return {
|
|
136
|
-
to: this.contract.address,
|
|
137
|
-
abi: TallySlashingProposerAbi,
|
|
138
|
-
data: encodeFunctionData({
|
|
139
|
-
abi: TallySlashingProposerAbi,
|
|
140
|
-
functionName: 'vote',
|
|
141
|
-
args: [
|
|
142
|
-
votes,
|
|
143
|
-
signature.toViemSignature()
|
|
144
|
-
]
|
|
145
|
-
})
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/** Returns the typed data definition to EIP712-sign for voting */ buildVoteTypedData(votes, slot) {
|
|
149
|
-
const domain = {
|
|
150
|
-
name: 'TallySlashingProposer',
|
|
151
|
-
version: '1',
|
|
152
|
-
chainId: this.client.chain.id,
|
|
153
|
-
verifyingContract: this.contract.address
|
|
154
|
-
};
|
|
155
|
-
const types = {
|
|
156
|
-
EIP712Domain: [
|
|
157
|
-
{
|
|
158
|
-
name: 'name',
|
|
159
|
-
type: 'string'
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'version',
|
|
163
|
-
type: 'string'
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: 'chainId',
|
|
167
|
-
type: 'uint256'
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: 'verifyingContract',
|
|
171
|
-
type: 'address'
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
Vote: [
|
|
175
|
-
{
|
|
176
|
-
name: 'votes',
|
|
177
|
-
type: 'bytes'
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: 'slot',
|
|
181
|
-
type: 'uint256'
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
};
|
|
185
|
-
return {
|
|
186
|
-
domain,
|
|
187
|
-
types,
|
|
188
|
-
primaryType: 'Vote',
|
|
189
|
-
message: {
|
|
190
|
-
votes,
|
|
191
|
-
slot: BigInt(slot)
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
/** Gets the digest to sign for voting directly from the contract */ async getVoteDataDigest(votes, slot) {
|
|
196
|
-
return Buffer32.fromString(await this.contract.read.getVoteSignatureDigest([
|
|
197
|
-
votes,
|
|
198
|
-
BigInt(slot)
|
|
199
|
-
]));
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Create a transaction to vote for slashing offenses
|
|
203
|
-
* @param votes - The encoded votes for slashing
|
|
204
|
-
* @param signature - The signature from the current proposer
|
|
205
|
-
* @returns L1 transaction request
|
|
206
|
-
*/ buildVoteRequestWithSignature(votes, signature) {
|
|
207
|
-
return {
|
|
208
|
-
to: this.contract.address,
|
|
209
|
-
abi: TallySlashingProposerAbi,
|
|
210
|
-
data: encodeFunctionData({
|
|
211
|
-
abi: TallySlashingProposerAbi,
|
|
212
|
-
functionName: 'vote',
|
|
213
|
-
args: [
|
|
214
|
-
votes,
|
|
215
|
-
signature
|
|
216
|
-
]
|
|
217
|
-
})
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Create a transaction to execute a slashing round
|
|
222
|
-
* @param round - The round number to execute
|
|
223
|
-
* @param committees - The committees for each epoch in the round
|
|
224
|
-
* @returns L1 transaction request
|
|
225
|
-
*/ buildExecuteRoundRequest(round, committees) {
|
|
226
|
-
return {
|
|
227
|
-
to: this.contract.address,
|
|
228
|
-
abi: mergeAbis([
|
|
229
|
-
TallySlashingProposerAbi,
|
|
230
|
-
SlasherAbi
|
|
231
|
-
]),
|
|
232
|
-
data: encodeFunctionData({
|
|
233
|
-
abi: TallySlashingProposerAbi,
|
|
234
|
-
functionName: 'executeRound',
|
|
235
|
-
args: [
|
|
236
|
-
round,
|
|
237
|
-
committees.map((c)=>c.map((addr)=>addr.toString()))
|
|
238
|
-
]
|
|
239
|
-
})
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
/** Returns the last vote emitted for a given round */ async getLastVote(round) {
|
|
243
|
-
const { voteCount } = await this.getRound(round);
|
|
244
|
-
const validators = (await this.contract.simulate.getSlashTargetCommittees([
|
|
245
|
-
round
|
|
246
|
-
])).result.flat();
|
|
247
|
-
const vote = await this.contract.read.getVotes([
|
|
248
|
-
round,
|
|
249
|
-
voteCount - 1n
|
|
250
|
-
]);
|
|
251
|
-
const decoded = decodeSlashConsensusVotes(hexToBuffer(vote));
|
|
252
|
-
const slashAmounts = await this.getSlashingAmounts();
|
|
253
|
-
return decoded.map((units, i)=>({
|
|
254
|
-
validator: EthAddress.fromString(validators[i]),
|
|
255
|
-
slashAmount: slashAmounts[units - 1] ?? 0n
|
|
256
|
-
})).filter((v)=>v.slashAmount > 0n);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Listen for VoteCast events
|
|
260
|
-
* @param callback - Callback function to handle vote cast events
|
|
261
|
-
* @returns Unwatch function
|
|
262
|
-
*/ listenToVoteCast(callback) {
|
|
263
|
-
return this.contract.watchEvent.VoteCast({}, {
|
|
264
|
-
onLogs: (logs)=>{
|
|
265
|
-
for (const log of logs){
|
|
266
|
-
const { round, proposer } = log.args;
|
|
267
|
-
if (round !== undefined && proposer) {
|
|
268
|
-
callback({
|
|
269
|
-
round,
|
|
270
|
-
proposer
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Listen for RoundExecuted events
|
|
279
|
-
* @param callback - Callback function to handle round executed events
|
|
280
|
-
* @returns Unwatch function
|
|
281
|
-
*/ listenToRoundExecuted(callback) {
|
|
282
|
-
return this.contract.watchEvent.RoundExecuted({}, {
|
|
283
|
-
onLogs: (logs)=>{
|
|
284
|
-
for (const log of logs){
|
|
285
|
-
const { round, slashCount } = log.args;
|
|
286
|
-
if (round !== undefined && slashCount !== undefined) {
|
|
287
|
-
callback({
|
|
288
|
-
round,
|
|
289
|
-
slashCount,
|
|
290
|
-
l1BlockHash: log.blockHash
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Decodes a Buffer containing slash votes back into an array of numbers.
|
|
300
|
-
* Each vote is represented as a 2-bit value (0, 1, 2, or 3) representing slashing units.
|
|
301
|
-
* @dev This should live in stdlib next to encodeSlashConsensusVotes but is here since we
|
|
302
|
-
* do not have a dependency to stdlib from the ethereum package. We need a larger refactor to fix this.
|
|
303
|
-
* @param buffer - The Buffer containing encoded slash votes
|
|
304
|
-
* @returns An array of numbers representing the slash votes
|
|
305
|
-
*/ export function decodeSlashConsensusVotes(buffer) {
|
|
306
|
-
const votes = [];
|
|
307
|
-
for(let i = 0; i < buffer.length; i++){
|
|
308
|
-
const voteByte = buffer.readUInt8(i);
|
|
309
|
-
// Decode votes from Solidity's bit order (LSB to MSB)
|
|
310
|
-
// Bits 0-1: validator at index i*4
|
|
311
|
-
// Bits 2-3: validator at index i*4+1
|
|
312
|
-
// Bits 4-5: validator at index i*4+2
|
|
313
|
-
// Bits 6-7: validator at index i*4+3
|
|
314
|
-
votes.push(voteByte >> 0 & 0x03);
|
|
315
|
-
votes.push(voteByte >> 2 & 0x03);
|
|
316
|
-
votes.push(voteByte >> 4 & 0x03);
|
|
317
|
-
votes.push(voteByte >> 6 & 0x03);
|
|
318
|
-
}
|
|
319
|
-
return votes;
|
|
320
|
-
}
|