@aztec/ethereum 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf
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 +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +5 -0
- package/dest/contracts/empire_slashing_proposer.d.ts +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +13 -15
- package/dest/contracts/fee_asset_handler.d.ts +1 -1
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +2 -0
- package/dest/contracts/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +11 -1
- package/dest/contracts/governance_proposer.d.ts +1 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +4 -1
- package/dest/contracts/multicall.d.ts +1 -1
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +2 -1
- package/dest/contracts/rollup.d.ts +3 -3
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +7 -3
- package/dest/contracts/tally_slashing_proposer.d.ts +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +8 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +3 -1
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +1 -0
- package/dest/generated/l1-contracts-defaults.d.ts +2 -1
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -1
- package/dest/generated/l1-contracts-defaults.js +1 -0
- package/dest/l1_artifacts.d.ts +846 -50
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.d.ts +1 -1
- package/dest/l1_tx_utils/constants.js +2 -2
- package/dest/l1_tx_utils/l1_tx_utils.js +6 -6
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +3 -3
- package/dest/publisher_manager.d.ts +3 -2
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +2 -2
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +2 -1
- package/dest/test/rollup_cheat_codes.d.ts +4 -2
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +10 -1
- package/dest/test/start_anvil.js +1 -1
- package/dest/utils.d.ts +2 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +46 -0
- package/package.json +5 -5
- package/src/config.ts +7 -0
- package/src/contracts/empire_slashing_proposer.ts +16 -27
- package/src/contracts/fee_asset_handler.ts +2 -0
- package/src/contracts/governance.ts +10 -1
- package/src/contracts/governance_proposer.ts +4 -1
- package/src/contracts/multicall.ts +5 -2
- package/src/contracts/rollup.ts +8 -4
- package/src/contracts/tally_slashing_proposer.ts +5 -1
- package/src/deploy_aztec_l1_contracts.ts +1 -0
- package/src/generated/l1-contracts-defaults.ts +1 -0
- package/src/l1_tx_utils/constants.ts +2 -2
- package/src/l1_tx_utils/l1_tx_utils.ts +6 -6
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +3 -3
- package/src/publisher_manager.ts +4 -2
- package/src/queries.ts +1 -0
- package/src/test/rollup_cheat_codes.ts +11 -2
- package/src/test/start_anvil.ts +1 -1
- package/src/utils.ts +53 -0
|
@@ -35,6 +35,15 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
|
35
35
|
ts
|
|
36
36
|
]));
|
|
37
37
|
}
|
|
38
|
+
/** Returns the number of seconds until the start of the given slot based on L1 block timestamp. */ async getSecondsUntilSlot(slot) {
|
|
39
|
+
const [currentTimestamp, targetTimestamp] = await Promise.all([
|
|
40
|
+
this.client.getBlock().then((b)=>BigInt(b.timestamp)),
|
|
41
|
+
this.rollup.read.getTimestampForSlot([
|
|
42
|
+
BigInt(slot)
|
|
43
|
+
])
|
|
44
|
+
]);
|
|
45
|
+
return Math.max(0, Number(targetTimestamp - currentTimestamp));
|
|
46
|
+
}
|
|
38
47
|
/** Returns the current epoch */ async getEpoch() {
|
|
39
48
|
const slotNumber = await this.getSlot();
|
|
40
49
|
return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([
|
|
@@ -86,7 +95,7 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
|
86
95
|
* @param opts - Options
|
|
87
96
|
*/ async advanceToEpoch(epoch, opts = {}) {
|
|
88
97
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
89
|
-
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
98
|
+
const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
|
|
90
99
|
const timestamp = await this.rollup.read.getTimestampForSlot([
|
|
91
100
|
BigInt(slotNumber)
|
|
92
101
|
]) + BigInt(opts.offset ?? 0);
|
package/dest/test/start_anvil.js
CHANGED
|
@@ -16,7 +16,7 @@ import { dirname, resolve } from 'path';
|
|
|
16
16
|
const anvil = createAnvil({
|
|
17
17
|
anvilBinary,
|
|
18
18
|
host: '127.0.0.1',
|
|
19
|
-
port: opts.port ?? 8545,
|
|
19
|
+
port: opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545),
|
|
20
20
|
blockTime: opts.l1BlockTime,
|
|
21
21
|
stopTimeout: 1000,
|
|
22
22
|
accounts: opts.accounts ?? 20,
|
package/dest/utils.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class FormattedViemError extends Error {
|
|
|
14
14
|
export declare function extractEvent<const TAbi extends Abi | readonly unknown[], TEventName extends ContractEventName<TAbi>, TEventType = DecodeEventLogReturnType<TAbi, TEventName, Hex[], undefined, true>>(logs: Log[], address: Hex, abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, logger?: Logger): TEventType;
|
|
15
15
|
export declare function tryExtractEvent<const TAbi extends Abi | readonly unknown[], TEventName extends ContractEventName<TAbi>, TEventType = DecodeEventLogReturnType<TAbi, TEventName, Hex[], undefined, true>>(logs: Log[], address: Hex, abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, logger?: Logger): TEventType | undefined;
|
|
16
16
|
export declare function prettyLogViemErrorMsg(err: any): any;
|
|
17
|
+
export declare function mergeAbis(abis: Abi[]): Abi;
|
|
17
18
|
/**
|
|
18
19
|
* Formats a Viem error into a FormattedViemError instance.
|
|
19
20
|
* @param error - The error to format.
|
|
@@ -34,4 +35,4 @@ export declare function isBlobTransaction(tx: FormattedTransaction): tx is Forma
|
|
|
34
35
|
* Calculates a percentile from an array of bigints
|
|
35
36
|
*/
|
|
36
37
|
export declare function calculatePercentile(values: bigint[], percentile: number): bigint;
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUdwRCxPQUFPLEVBQ0wsS0FBSyxHQUFHLEVBR1IsS0FBSyxpQkFBaUIsRUFFdEIsS0FBSyx3QkFBd0IsRUFDN0IsS0FBSyxvQkFBb0IsRUFDekIsS0FBSyxHQUFHLEVBQ1IsS0FBSyxHQUFHLEVBR1QsTUFBTSxNQUFNLENBQUM7QUFHZCxNQUFNLFdBQVcsT0FBTztJQUN0QixXQUFXLEVBQUUsRUFBRSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLENBQUM7SUFDaEIsV0FBVyxF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iB,CAAC,IAAI,CAAC,EAC1C,UAAU,GAAG,wBAAwB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,EAE/E,IAAI,EAAE,GAAG,EAAE,EACX,OAAO,EAAE,GAAG,EACZ,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,UAAU,GAAG,SAAS,CAgBxB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,OAW7C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAe1C;AA4DD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,GAAE,GAAe,GAAG,kBAAkB,CAwEpF;AAyBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,sBAa7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,oBAAoB,GAAG,EAAE,IAAI,oBAAoB,GAAG;IACxF,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,SAAS,GAAG,EAAE,CAAC;CACrC,CAOA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAOhF"}
|
package/dest/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ErrorsAbi } from '@aztec/l1-artifacts/ErrorsAbi';
|
|
2
2
|
import { BaseError, ContractFunctionRevertedError, decodeErrorResult, decodeEventLog } from 'viem';
|
|
3
|
+
import { formatAbiItem, formatAbiParams } from 'viem/utils';
|
|
3
4
|
export class FormattedViemError extends Error {
|
|
4
5
|
metaMessages;
|
|
5
6
|
constructor(message, metaMessages){
|
|
@@ -46,6 +47,51 @@ export function prettyLogViemErrorMsg(err) {
|
|
|
46
47
|
}
|
|
47
48
|
return err?.message ?? err;
|
|
48
49
|
}
|
|
50
|
+
export function mergeAbis(abis) {
|
|
51
|
+
let merged = [];
|
|
52
|
+
const seen = new Set();
|
|
53
|
+
for (const abi of abis){
|
|
54
|
+
for (const item of abi){
|
|
55
|
+
const key = getAbiItemKey(item);
|
|
56
|
+
if (!seen.has(key)) {
|
|
57
|
+
seen.add(key);
|
|
58
|
+
merged = [
|
|
59
|
+
...merged,
|
|
60
|
+
item
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return merged;
|
|
66
|
+
}
|
|
67
|
+
function getAbiItemKey(item) {
|
|
68
|
+
if (item.type === 'function') {
|
|
69
|
+
const signature = formatAbiItem(item);
|
|
70
|
+
const outputs = formatAbiParams(item.outputs);
|
|
71
|
+
const stateMutability = typeof item.stateMutability === 'string' ? item.stateMutability : '';
|
|
72
|
+
return `function:${signature}:${outputs}:${stateMutability}`;
|
|
73
|
+
}
|
|
74
|
+
if (item.type === 'event') {
|
|
75
|
+
const signature = formatAbiItem(item);
|
|
76
|
+
const indexed = (item.inputs ?? []).map((input)=>input.indexed ? '1' : '0').join('');
|
|
77
|
+
const anonymous = item.anonymous ? 'anonymous' : 'not-anonymous';
|
|
78
|
+
return `event:${signature}:${indexed}:${anonymous}`;
|
|
79
|
+
}
|
|
80
|
+
if (item.type === 'error') {
|
|
81
|
+
const signature = formatAbiItem(item);
|
|
82
|
+
return `error:${signature}`;
|
|
83
|
+
}
|
|
84
|
+
if (item.type === 'constructor') {
|
|
85
|
+
const inputs = formatAbiParams(item.inputs);
|
|
86
|
+
const stateMutability = typeof item.stateMutability === 'string' ? item.stateMutability : '';
|
|
87
|
+
return `constructor::${inputs}:${stateMutability}`;
|
|
88
|
+
}
|
|
89
|
+
if (item.type === 'fallback' || item.type === 'receive') {
|
|
90
|
+
const stateMutability = typeof item.stateMutability === 'string' ? item.stateMutability : '';
|
|
91
|
+
return `${item.type}:::${stateMutability}`;
|
|
92
|
+
}
|
|
93
|
+
return 'unknown';
|
|
94
|
+
}
|
|
49
95
|
function getNestedErrorData(error) {
|
|
50
96
|
// If nothing, bail
|
|
51
97
|
if (!error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.fc805bf",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./account": "./dest/account.js",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"../package.common.json"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
54
|
-
"@aztec/constants": "0.0.1-commit.
|
|
55
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
56
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
53
|
+
"@aztec/blob-lib": "0.0.1-commit.fc805bf",
|
|
54
|
+
"@aztec/constants": "0.0.1-commit.fc805bf",
|
|
55
|
+
"@aztec/foundation": "0.0.1-commit.fc805bf",
|
|
56
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fc805bf",
|
|
57
57
|
"@viem/anvil": "^0.0.10",
|
|
58
58
|
"dotenv": "^16.0.3",
|
|
59
59
|
"lodash.chunk": "^4.2.0",
|
package/src/config.ts
CHANGED
|
@@ -75,6 +75,8 @@ export type L1ContractsConfig = {
|
|
|
75
75
|
manaTarget: bigint;
|
|
76
76
|
/** The proving cost per mana */
|
|
77
77
|
provingCostPerMana: bigint;
|
|
78
|
+
/** The initial ETH per fee asset price (with 1e12 precision) */
|
|
79
|
+
initialEthPerFeeAsset: bigint;
|
|
78
80
|
/** The number of seconds to wait for an exit */
|
|
79
81
|
exitDelaySeconds: number;
|
|
80
82
|
} & L1TxUtilsConfig;
|
|
@@ -226,6 +228,11 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
226
228
|
description: 'The proving cost per mana',
|
|
227
229
|
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA)),
|
|
228
230
|
},
|
|
231
|
+
initialEthPerFeeAsset: {
|
|
232
|
+
env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
|
|
233
|
+
description: 'The initial ETH per fee asset price (with 1e12 precision)',
|
|
234
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET)),
|
|
235
|
+
},
|
|
229
236
|
exitDelaySeconds: {
|
|
230
237
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
231
238
|
description: 'The delay before a validator can exit the set',
|
|
@@ -6,7 +6,6 @@ import { EmpireSlashingProposerAbi } from '@aztec/l1-artifacts/EmpireSlashingPro
|
|
|
6
6
|
|
|
7
7
|
import EventEmitter from 'events';
|
|
8
8
|
import {
|
|
9
|
-
type EncodeFunctionDataParameters,
|
|
10
9
|
type GetContractReturnType,
|
|
11
10
|
type Hex,
|
|
12
11
|
type Log,
|
|
@@ -100,6 +99,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
100
99
|
public createSignalRequest(payload: Hex): L1TxRequest {
|
|
101
100
|
return {
|
|
102
101
|
to: this.address.toString(),
|
|
102
|
+
abi: EmpireSlashingProposerAbi,
|
|
103
103
|
data: encodeSignal(payload),
|
|
104
104
|
};
|
|
105
105
|
}
|
|
@@ -121,6 +121,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
121
121
|
);
|
|
122
122
|
return {
|
|
123
123
|
to: this.address.toString(),
|
|
124
|
+
abi: EmpireSlashingProposerAbi,
|
|
124
125
|
data: encodeSignalWithSignature(payload, signature),
|
|
125
126
|
};
|
|
126
127
|
}
|
|
@@ -180,6 +181,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
180
181
|
public buildExecuteRoundRequest(round: bigint): L1TxRequest {
|
|
181
182
|
return {
|
|
182
183
|
to: this.address.toString(),
|
|
184
|
+
abi: EmpireSlashingProposerAbi,
|
|
183
185
|
data: encodeFunctionData({
|
|
184
186
|
abi: EmpireSlashingProposerAbi,
|
|
185
187
|
functionName: 'submitRoundWinner',
|
|
@@ -222,24 +224,13 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
222
224
|
if (typeof round === 'number') {
|
|
223
225
|
round = BigInt(round);
|
|
224
226
|
}
|
|
225
|
-
const
|
|
226
|
-
abi: EmpireSlashingProposerAbi,
|
|
227
|
-
functionName: 'submitRoundWinner',
|
|
228
|
-
args: [round],
|
|
229
|
-
};
|
|
230
|
-
const data = encodeFunctionData(args);
|
|
227
|
+
const request = this.buildExecuteRoundRequest(round);
|
|
231
228
|
const response = await txUtils
|
|
232
|
-
.sendAndMonitorTransaction(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
{
|
|
238
|
-
// Gas estimation is way off for this, likely because we are creating the contract/selector to call
|
|
239
|
-
// for the actual slashing dynamically.
|
|
240
|
-
gasLimitBufferPercentage: 50, // +50% gas
|
|
241
|
-
},
|
|
242
|
-
)
|
|
229
|
+
.sendAndMonitorTransaction(request, {
|
|
230
|
+
// Gas estimation is way off for this, likely because we are creating the contract/selector to call
|
|
231
|
+
// for the actual slashing dynamically.
|
|
232
|
+
gasLimitBufferPercentage: 50, // +50% gas
|
|
233
|
+
})
|
|
243
234
|
.catch(err => {
|
|
244
235
|
if (err instanceof FormattedViemError && err.message.includes('ProposalAlreadyExecuted')) {
|
|
245
236
|
throw new ProposalAlreadyExecutedError(round);
|
|
@@ -248,15 +239,13 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
248
239
|
});
|
|
249
240
|
|
|
250
241
|
if (response.receipt.status === 'reverted') {
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
[],
|
|
259
|
-
);
|
|
242
|
+
const args = {
|
|
243
|
+
abi: EmpireSlashingProposerAbi,
|
|
244
|
+
functionName: 'submitRoundWinner' as const,
|
|
245
|
+
args: [round] as const,
|
|
246
|
+
address: this.address.toString(),
|
|
247
|
+
};
|
|
248
|
+
const error = await txUtils.tryGetErrorFromRevertedTx(request.data!, args, undefined, []);
|
|
260
249
|
if (error?.includes('ProposalAlreadyExecuted')) {
|
|
261
250
|
throw new ProposalAlreadyExecutedError(round);
|
|
262
251
|
}
|
|
@@ -43,6 +43,7 @@ export class FeeAssetHandlerContract {
|
|
|
43
43
|
}
|
|
44
44
|
return txUtils.sendAndMonitorTransaction({
|
|
45
45
|
to: this.address.toString(),
|
|
46
|
+
abi: FeeAssetHandlerAbi,
|
|
46
47
|
data: encodeFunctionData({
|
|
47
48
|
abi: FeeAssetHandlerAbi,
|
|
48
49
|
functionName: 'mint',
|
|
@@ -54,6 +55,7 @@ export class FeeAssetHandlerContract {
|
|
|
54
55
|
public setMintAmount(txUtils: L1TxUtils, amount: bigint) {
|
|
55
56
|
return txUtils.sendAndMonitorTransaction({
|
|
56
57
|
to: this.address.toString(),
|
|
58
|
+
abi: FeeAssetHandlerAbi,
|
|
57
59
|
data: encodeFunctionData({
|
|
58
60
|
abi: FeeAssetHandlerAbi,
|
|
59
61
|
functionName: 'setMintAmount',
|
|
@@ -174,6 +174,13 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
174
174
|
return this.governanceContract.read.powerAt([this.client.account.address, now.timestamp]);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/** Returns the user's voting power for a specific proposal, checked at pendingThrough timestamp. */
|
|
178
|
+
public async getPowerForProposal(proposalId: bigint): Promise<bigint> {
|
|
179
|
+
const proposal = await this.getProposal(proposalId);
|
|
180
|
+
const pendingThrough = proposal.creation + proposal.config.votingDelay;
|
|
181
|
+
return this.governanceContract.read.powerAt([this.client.account.address, pendingThrough]);
|
|
182
|
+
}
|
|
183
|
+
|
|
177
184
|
public async vote({
|
|
178
185
|
proposalId,
|
|
179
186
|
voteAmount,
|
|
@@ -190,7 +197,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
190
197
|
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
191
198
|
const retryDelaySeconds = 12;
|
|
192
199
|
|
|
193
|
-
voteAmount = voteAmount ?? (await this.
|
|
200
|
+
voteAmount = voteAmount ?? (await this.getPowerForProposal(proposalId));
|
|
194
201
|
|
|
195
202
|
let success = false;
|
|
196
203
|
for (let i = 0; i < retries; i++) {
|
|
@@ -204,6 +211,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
204
211
|
|
|
205
212
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
206
213
|
to: this.governanceContract.address,
|
|
214
|
+
abi: GovernanceAbi,
|
|
207
215
|
data: encodedVoteData,
|
|
208
216
|
});
|
|
209
217
|
|
|
@@ -258,6 +266,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
258
266
|
|
|
259
267
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
260
268
|
to: this.governanceContract.address,
|
|
269
|
+
abi: GovernanceAbi,
|
|
261
270
|
data: encodedExecuteData,
|
|
262
271
|
});
|
|
263
272
|
|
|
@@ -83,6 +83,7 @@ export class GovernanceProposerContract implements IEmpireBase {
|
|
|
83
83
|
public createSignalRequest(payload: Hex): L1TxRequest {
|
|
84
84
|
return {
|
|
85
85
|
to: this.address.toString(),
|
|
86
|
+
abi: GovernanceProposerAbi,
|
|
86
87
|
data: encodeSignal(payload),
|
|
87
88
|
};
|
|
88
89
|
}
|
|
@@ -104,6 +105,7 @@ export class GovernanceProposerContract implements IEmpireBase {
|
|
|
104
105
|
);
|
|
105
106
|
return {
|
|
106
107
|
to: this.address.toString(),
|
|
108
|
+
abi: GovernanceProposerAbi,
|
|
107
109
|
data: encodeSignalWithSignature(payload, signature),
|
|
108
110
|
};
|
|
109
111
|
}
|
|
@@ -117,8 +119,9 @@ export class GovernanceProposerContract implements IEmpireBase {
|
|
|
117
119
|
}> {
|
|
118
120
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
119
121
|
to: this.address.toString(),
|
|
122
|
+
abi: GovernanceProposerAbi,
|
|
120
123
|
data: encodeFunctionData({
|
|
121
|
-
abi:
|
|
124
|
+
abi: GovernanceProposerAbi,
|
|
122
125
|
functionName: 'submitRoundWinner',
|
|
123
126
|
args: [round],
|
|
124
127
|
}),
|
|
@@ -34,10 +34,13 @@ export class Multicall3 {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const encodedForwarderData = encodeFunctionData(forwarderFunctionData);
|
|
37
|
-
|
|
38
37
|
try {
|
|
39
38
|
const { receipt, state } = await l1TxUtils.sendAndMonitorTransaction(
|
|
40
|
-
{
|
|
39
|
+
{
|
|
40
|
+
to: MULTI_CALL_3_ADDRESS,
|
|
41
|
+
data: encodedForwarderData,
|
|
42
|
+
abi: multicall3Abi,
|
|
43
|
+
},
|
|
41
44
|
gasConfig,
|
|
42
45
|
blobConfig,
|
|
43
46
|
);
|
package/src/contracts/rollup.ts
CHANGED
|
@@ -108,7 +108,7 @@ export enum AttesterStatus {
|
|
|
108
108
|
export type FeeHeader = {
|
|
109
109
|
excessMana: bigint;
|
|
110
110
|
manaUsed: bigint;
|
|
111
|
-
|
|
111
|
+
ethPerFeeAsset: bigint;
|
|
112
112
|
congestionCost: bigint;
|
|
113
113
|
proverCost: bigint;
|
|
114
114
|
};
|
|
@@ -515,8 +515,8 @@ export class RollupContract {
|
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
|
|
519
|
-
return this.rollup.read.
|
|
518
|
+
getEthPerFeeAsset(): Promise<bigint> {
|
|
519
|
+
return this.rollup.read.getEthPerFeeAsset();
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
async getCommitteeAt(timestamp: bigint): Promise<EthAddress[] | undefined> {
|
|
@@ -601,7 +601,7 @@ export class RollupContract {
|
|
|
601
601
|
feeHeader: {
|
|
602
602
|
excessMana: result.feeHeader.excessMana,
|
|
603
603
|
manaUsed: result.feeHeader.manaUsed,
|
|
604
|
-
|
|
604
|
+
ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
|
|
605
605
|
congestionCost: result.feeHeader.congestionCost,
|
|
606
606
|
proverCost: result.feeHeader.proverCost,
|
|
607
607
|
},
|
|
@@ -805,6 +805,7 @@ export class RollupContract {
|
|
|
805
805
|
): L1TxRequest {
|
|
806
806
|
return {
|
|
807
807
|
to: this.address,
|
|
808
|
+
abi: RollupAbi,
|
|
808
809
|
data: encodeFunctionData({
|
|
809
810
|
abi: RollupAbi,
|
|
810
811
|
functionName: 'invalidateBadAttestation',
|
|
@@ -826,6 +827,7 @@ export class RollupContract {
|
|
|
826
827
|
): L1TxRequest {
|
|
827
828
|
return {
|
|
828
829
|
to: this.address,
|
|
830
|
+
abi: RollupAbi,
|
|
829
831
|
data: encodeFunctionData({
|
|
830
832
|
abi: RollupAbi,
|
|
831
833
|
functionName: 'invalidateInsufficientAttestations',
|
|
@@ -959,6 +961,7 @@ export class RollupContract {
|
|
|
959
961
|
setupEpoch(l1TxUtils: L1TxUtils) {
|
|
960
962
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
961
963
|
to: this.address,
|
|
964
|
+
abi: RollupAbi,
|
|
962
965
|
data: encodeFunctionData({
|
|
963
966
|
abi: RollupAbi,
|
|
964
967
|
functionName: 'setupEpoch',
|
|
@@ -970,6 +973,7 @@ export class RollupContract {
|
|
|
970
973
|
vote(l1TxUtils: L1TxUtils, proposalId: bigint) {
|
|
971
974
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
972
975
|
to: this.address,
|
|
976
|
+
abi: RollupAbi,
|
|
973
977
|
data: encodeFunctionData({
|
|
974
978
|
abi: RollupAbi,
|
|
975
979
|
functionName: 'vote',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { L1TxRequest } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import type { ViemClient } from '@aztec/ethereum/types';
|
|
3
|
-
import { tryExtractEvent } from '@aztec/ethereum/utils';
|
|
3
|
+
import { mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
4
4
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
5
5
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
8
|
import { hexToBuffer } from '@aztec/foundation/string';
|
|
9
|
+
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
9
10
|
import { TallySlashingProposerAbi } from '@aztec/l1-artifacts/TallySlashingProposerAbi';
|
|
10
11
|
|
|
11
12
|
import {
|
|
@@ -160,6 +161,7 @@ export class TallySlashingProposerContract {
|
|
|
160
161
|
|
|
161
162
|
return {
|
|
162
163
|
to: this.contract.address,
|
|
164
|
+
abi: TallySlashingProposerAbi,
|
|
163
165
|
data: encodeFunctionData({
|
|
164
166
|
abi: TallySlashingProposerAbi,
|
|
165
167
|
functionName: 'vote',
|
|
@@ -207,6 +209,7 @@ export class TallySlashingProposerContract {
|
|
|
207
209
|
public buildVoteRequestWithSignature(votes: Hex, signature: { v: number; r: Hex; s: Hex }): L1TxRequest {
|
|
208
210
|
return {
|
|
209
211
|
to: this.contract.address,
|
|
212
|
+
abi: TallySlashingProposerAbi,
|
|
210
213
|
data: encodeFunctionData({
|
|
211
214
|
abi: TallySlashingProposerAbi,
|
|
212
215
|
functionName: 'vote',
|
|
@@ -224,6 +227,7 @@ export class TallySlashingProposerContract {
|
|
|
224
227
|
public buildExecuteRoundRequest(round: bigint, committees: EthAddress[][]): L1TxRequest {
|
|
225
228
|
return {
|
|
226
229
|
to: this.contract.address,
|
|
230
|
+
abi: mergeAbis([TallySlashingProposerAbi, SlasherAbi]),
|
|
227
231
|
data: encodeFunctionData({
|
|
228
232
|
abi: TallySlashingProposerAbi,
|
|
229
233
|
functionName: 'executeRound',
|
|
@@ -549,6 +549,7 @@ export function getDeployRollupForUpgradeEnvVars(
|
|
|
549
549
|
AZTEC_MANA_TARGET: args.manaTarget.toString(),
|
|
550
550
|
AZTEC_EXIT_DELAY_SECONDS: args.exitDelaySeconds.toString(),
|
|
551
551
|
AZTEC_PROVING_COST_PER_MANA: args.provingCostPerMana.toString(),
|
|
552
|
+
AZTEC_INITIAL_ETH_PER_FEE_ASSET: args.initialEthPerFeeAsset.toString(),
|
|
552
553
|
AZTEC_SLASHER_FLAVOR: args.slasherFlavor,
|
|
553
554
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: args.slashingRoundSizeInEpochs.toString(),
|
|
554
555
|
AZTEC_SLASHING_QUORUM: args.slashingQuorum?.toString(),
|
|
@@ -17,6 +17,7 @@ export const l1ContractsDefaultEnv = {
|
|
|
17
17
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
18
18
|
AZTEC_MANA_TARGET: 100000000,
|
|
19
19
|
AZTEC_PROVING_COST_PER_MANA: 100,
|
|
20
|
+
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
20
21
|
AZTEC_SLASHER_FLAVOR: 'tally',
|
|
21
22
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
|
|
22
23
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// 1_000_000_000_000_000_000 Wei = 1 ETH
|
|
4
4
|
export const WEI_CONST = 1_000_000_000n;
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
export const
|
|
6
|
+
// EIP-7825: protocol-level cap on tx gas limit (2^24). Clients reject above this.
|
|
7
|
+
export const MAX_L1_TX_LIMIT = 16_777_216n;
|
|
8
8
|
|
|
9
9
|
// setting a minimum bump percentage to 10% due to geth's implementation
|
|
10
10
|
// https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/legacypool/list.go#L298
|
|
@@ -27,7 +27,7 @@ import { jsonRpc } from 'viem/nonce';
|
|
|
27
27
|
import type { ViemClient } from '../types.js';
|
|
28
28
|
import { formatViemError } from '../utils.js';
|
|
29
29
|
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './config.js';
|
|
30
|
-
import {
|
|
30
|
+
import { MAX_L1_TX_LIMIT } from './constants.js';
|
|
31
31
|
import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
|
|
32
32
|
import { ReadOnlyL1TxUtils } from './readonly_l1_tx_utils.js';
|
|
33
33
|
import {
|
|
@@ -207,7 +207,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
207
207
|
|
|
208
208
|
let gasLimit: bigint;
|
|
209
209
|
if (this.debugMaxGasLimit) {
|
|
210
|
-
gasLimit =
|
|
210
|
+
gasLimit = MAX_L1_TX_LIMIT;
|
|
211
211
|
} else if (gasConfig.gasLimit) {
|
|
212
212
|
gasLimit = gasConfig.gasLimit;
|
|
213
213
|
} else {
|
|
@@ -283,7 +283,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
283
283
|
return { txHash, state: l1TxState };
|
|
284
284
|
} catch (err: any) {
|
|
285
285
|
const viemError = formatViemError(err, request.abi);
|
|
286
|
-
this.logger.error(`Failed to send L1 transaction`, viemError, {
|
|
286
|
+
this.logger.error(`Failed to send L1 transaction: ${viemError.message}`, viemError, {
|
|
287
287
|
request: pick(request, 'to', 'value'),
|
|
288
288
|
});
|
|
289
289
|
throw viemError;
|
|
@@ -631,12 +631,12 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
631
631
|
from: request.from ?? this.getSenderAddress().toString(),
|
|
632
632
|
maxFeePerGas: gasPrice.maxFeePerGas,
|
|
633
633
|
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
|
|
634
|
-
gas: request.gas ??
|
|
634
|
+
gas: request.gas ?? MAX_L1_TX_LIMIT,
|
|
635
635
|
};
|
|
636
636
|
|
|
637
637
|
if (!request.gas && !gasConfig.ignoreBlockGasLimit) {
|
|
638
|
-
//
|
|
639
|
-
blockOverrides.gasLimit =
|
|
638
|
+
// MAX_L1_TX_LIMIT is set as call.gas, ensure block gasLimit is sufficient
|
|
639
|
+
blockOverrides.gasLimit = MAX_L1_TX_LIMIT;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
return this._simulate(call, blockOverrides, stateOverrides, gasConfig, abi);
|
|
@@ -27,7 +27,7 @@ import type { ViemClient } from '../types.js';
|
|
|
27
27
|
import { type L1TxUtilsConfig, defaultL1TxUtilsConfig, l1TxUtilsConfigMappings } from './config.js';
|
|
28
28
|
import {
|
|
29
29
|
BLOCK_TIME_MS,
|
|
30
|
-
|
|
30
|
+
MAX_L1_TX_LIMIT,
|
|
31
31
|
MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE,
|
|
32
32
|
MIN_REPLACEMENT_BUMP_PERCENTAGE,
|
|
33
33
|
WEI_CONST,
|
|
@@ -249,7 +249,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
249
249
|
...request,
|
|
250
250
|
..._blobInputs,
|
|
251
251
|
maxFeePerBlobGas: gasPrice.maxFeePerBlobGas!,
|
|
252
|
-
gas:
|
|
252
|
+
gas: MAX_L1_TX_LIMIT,
|
|
253
253
|
blockTag: 'latest',
|
|
254
254
|
});
|
|
255
255
|
|
|
@@ -258,7 +258,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
258
258
|
initialEstimate = await this.client.estimateGas({
|
|
259
259
|
account,
|
|
260
260
|
...request,
|
|
261
|
-
gas:
|
|
261
|
+
gas: MAX_L1_TX_LIMIT,
|
|
262
262
|
blockTag: 'latest',
|
|
263
263
|
});
|
|
264
264
|
this.logger?.trace(`Estimated gas for non-blob tx: ${initialEstimate}`);
|
package/src/publisher_manager.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pick } from '@aztec/foundation/collection';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
|
|
4
4
|
import { L1TxUtils, TxUtilsState } from './l1_tx_utils/index.js';
|
|
5
5
|
|
|
@@ -28,13 +28,15 @@ const busyStates: TxUtilsState[] = [
|
|
|
28
28
|
export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
|
|
29
29
|
|
|
30
30
|
export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
31
|
-
private log
|
|
31
|
+
private log: Logger;
|
|
32
32
|
private config: { publisherAllowInvalidStates?: boolean };
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
35
|
private publishers: UtilsType[],
|
|
36
36
|
config: { publisherAllowInvalidStates?: boolean },
|
|
37
|
+
bindings?: LoggerBindings,
|
|
37
38
|
) {
|
|
39
|
+
this.log = createLogger('publisher:manager', bindings);
|
|
38
40
|
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
39
41
|
this.publishers = publishers;
|
|
40
42
|
this.config = pick(config, 'publisherAllowInvalidStates');
|
package/src/queries.ts
CHANGED
|
@@ -119,5 +119,6 @@ export async function getL1ContractsConfig(
|
|
|
119
119
|
slashAmountSmall: slashingAmounts[0],
|
|
120
120
|
slashAmountMedium: slashingAmounts[1],
|
|
121
121
|
slashAmountLarge: slashingAmounts[2],
|
|
122
|
+
initialEthPerFeeAsset: DefaultL1ContractsConfig.initialEthPerFeeAsset,
|
|
122
123
|
};
|
|
123
124
|
}
|
|
@@ -56,6 +56,15 @@ export class RollupCheatCodes {
|
|
|
56
56
|
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/** Returns the number of seconds until the start of the given slot based on L1 block timestamp. */
|
|
60
|
+
public async getSecondsUntilSlot(slot: SlotNumber): Promise<number> {
|
|
61
|
+
const [currentTimestamp, targetTimestamp] = await Promise.all([
|
|
62
|
+
this.client.getBlock().then(b => BigInt(b.timestamp)),
|
|
63
|
+
this.rollup.read.getTimestampForSlot([BigInt(slot)]),
|
|
64
|
+
]);
|
|
65
|
+
return Math.max(0, Number(targetTimestamp - currentTimestamp));
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
/** Returns the current epoch */
|
|
60
69
|
public async getEpoch(): Promise<EpochNumber> {
|
|
61
70
|
const slotNumber = await this.getSlot();
|
|
@@ -124,7 +133,7 @@ export class RollupCheatCodes {
|
|
|
124
133
|
} = {},
|
|
125
134
|
) {
|
|
126
135
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
127
|
-
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
136
|
+
const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
|
|
128
137
|
const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
|
|
129
138
|
try {
|
|
130
139
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
@@ -176,7 +185,7 @@ export class RollupCheatCodes {
|
|
|
176
185
|
* Marks the specified checkpoint (or latest if none) as proven
|
|
177
186
|
* @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
|
|
178
187
|
*/
|
|
179
|
-
public markAsProven(maybeCheckpointNumber?:
|
|
188
|
+
public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
|
|
180
189
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
181
190
|
const tipsBefore = await this.getTips();
|
|
182
191
|
const { pending, proven } = tipsBefore;
|
package/src/test/start_anvil.ts
CHANGED
|
@@ -33,7 +33,7 @@ export async function startAnvil(
|
|
|
33
33
|
const anvil = createAnvil({
|
|
34
34
|
anvilBinary,
|
|
35
35
|
host: '127.0.0.1',
|
|
36
|
-
port: opts.port ?? 8545,
|
|
36
|
+
port: opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545),
|
|
37
37
|
blockTime: opts.l1BlockTime,
|
|
38
38
|
stopTimeout: 1000,
|
|
39
39
|
accounts: opts.accounts ?? 20,
|