@aztec-labs/ethereum 6.0.0-nightly.20260829
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/README.md +3 -0
- package/dest/account.d.ts +2 -0
- package/dest/account.d.ts.map +1 -0
- package/dest/account.js +4 -0
- package/dest/chain.d.ts +25 -0
- package/dest/chain.d.ts.map +1 -0
- package/dest/chain.js +53 -0
- package/dest/client.d.ts +42 -0
- package/dest/client.d.ts.map +1 -0
- package/dest/client.js +104 -0
- package/dest/config.d.ts +103 -0
- package/dest/config.d.ts.map +1 -0
- package/dest/config.js +233 -0
- package/dest/constants.d.ts +4 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/contracts/chain_state_override.d.ts +81 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +139 -0
- package/dest/contracts/empire_base.d.ts +30 -0
- package/dest/contracts/empire_base.d.ts.map +1 -0
- package/dest/contracts/empire_base.js +84 -0
- package/dest/contracts/errors.d.ts +7 -0
- package/dest/contracts/errors.d.ts.map +1 -0
- package/dest/contracts/errors.js +12 -0
- package/dest/contracts/fee_asset_handler.d.ts +20 -0
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
- package/dest/contracts/fee_asset_handler.js +59 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +656 -0
- package/dest/contracts/fee_juice.d.ts +14 -0
- package/dest/contracts/fee_juice.d.ts.map +1 -0
- package/dest/contracts/fee_juice.js +59 -0
- package/dest/contracts/governance.d.ts +192 -0
- package/dest/contracts/governance.d.ts.map +1 -0
- package/dest/contracts/governance.js +471 -0
- package/dest/contracts/governance_proposer.d.ts +63 -0
- package/dest/contracts/governance_proposer.d.ts.map +1 -0
- package/dest/contracts/governance_proposer.js +536 -0
- package/dest/contracts/gse.d.ts +38 -0
- package/dest/contracts/gse.d.ts.map +1 -0
- package/dest/contracts/gse.js +81 -0
- package/dest/contracts/inbox.d.ts +94 -0
- package/dest/contracts/inbox.d.ts.map +1 -0
- package/dest/contracts/inbox.js +141 -0
- package/dest/contracts/index.d.ts +18 -0
- package/dest/contracts/index.d.ts.map +1 -0
- package/dest/contracts/index.js +17 -0
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +138 -0
- package/dest/contracts/multicall.d.ts.map +1 -0
- package/dest/contracts/multicall.js +266 -0
- package/dest/contracts/outbox.d.ts +64 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +113 -0
- package/dest/contracts/registry.d.ts +31 -0
- package/dest/contracts/registry.d.ts.map +1 -0
- package/dest/contracts/registry.js +142 -0
- package/dest/contracts/rollup.d.ts +5836 -0
- package/dest/contracts/rollup.d.ts.map +1 -0
- package/dest/contracts/rollup.js +1612 -0
- package/dest/contracts/slasher_contract.d.ts +44 -0
- package/dest/contracts/slasher_contract.d.ts.map +1 -0
- package/dest/contracts/slasher_contract.js +75 -0
- package/dest/contracts/slashing_proposer.d.ts +174 -0
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/slashing_proposer.js +755 -0
- package/dest/contracts/utils.d.ts +3 -0
- package/dest/contracts/utils.d.ts.map +1 -0
- package/dest/contracts/utils.js +11 -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 +267 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +424 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- package/dest/eth-signer/eth-signer.d.ts +21 -0
- package/dest/eth-signer/eth-signer.d.ts.map +1 -0
- package/dest/eth-signer/eth-signer.js +5 -0
- package/dest/eth-signer/index.d.ts +2 -0
- package/dest/eth-signer/index.d.ts.map +1 -0
- package/dest/eth-signer/index.js +1 -0
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- 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/l1_artifacts.d.ts +81896 -0
- package/dest/l1_artifacts.d.ts.map +1 -0
- package/dest/l1_artifacts.js +151 -0
- package/dest/l1_contract_addresses.d.ts +73 -0
- package/dest/l1_contract_addresses.d.ts.map +1 -0
- package/dest/l1_contract_addresses.js +120 -0
- package/dest/l1_reader.d.ts +18 -0
- package/dest/l1_reader.d.ts.map +1 -0
- package/dest/l1_reader.js +35 -0
- package/dest/l1_tx_utils/config.d.ts +65 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +109 -0
- package/dest/l1_tx_utils/constants.d.ts +12 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +39 -0
- package/dest/l1_tx_utils/factory.d.ts +32 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +22 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +13 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +13 -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_fee_analyzer.d.ts +252 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +568 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +113 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +720 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +83 -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 +357 -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/tx_delayer.d.ts +58 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/l1_tx_utils/tx_delayer.js +223 -0
- package/dest/l1_tx_utils/types.d.ts +93 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +36 -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/l1_types.d.ts +6 -0
- package/dest/l1_types.d.ts.map +1 -0
- package/dest/l1_types.js +1 -0
- package/dest/publisher_manager.d.ts +42 -0
- package/dest/publisher_manager.d.ts.map +1 -0
- package/dest/publisher_manager.js +199 -0
- package/dest/queries.d.ts +25 -0
- package/dest/queries.d.ts.map +1 -0
- package/dest/queries.js +144 -0
- 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 +126 -0
- package/dest/test/chain_monitor.d.ts.map +1 -0
- package/dest/test/chain_monitor.js +314 -0
- package/dest/test/eth_cheat_codes.d.ts +260 -0
- package/dest/test/eth_cheat_codes.d.ts.map +1 -0
- package/dest/test/eth_cheat_codes.js +608 -0
- package/dest/test/eth_cheat_codes_with_state.d.ts +18 -0
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -0
- package/dest/test/eth_cheat_codes_with_state.js +34 -0
- package/dest/test/index.d.ts +8 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +7 -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 +142 -0
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
- package/dest/test/rollup_cheat_codes.js +338 -0
- package/dest/test/start_anvil.d.ts +40 -0
- package/dest/test/start_anvil.d.ts.map +1 -0
- package/dest/test/start_anvil.js +210 -0
- package/dest/test/upgrade_utils.d.ts +12 -0
- package/dest/test/upgrade_utils.d.ts.map +1 -0
- package/dest/test/upgrade_utils.js +111 -0
- package/dest/types.d.ts +68 -0
- package/dest/types.d.ts.map +1 -0
- package/dest/types.js +3 -0
- package/dest/utils.d.ts +45 -0
- package/dest/utils.d.ts.map +1 -0
- package/dest/utils.js +260 -0
- package/dest/zkPassportVerifierAddress.d.ts +15 -0
- package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
- package/dest/zkPassportVerifierAddress.js +11 -0
- package/package.json +122 -0
- package/src/account.ts +5 -0
- package/src/chain.ts +71 -0
- package/src/client.ts +165 -0
- package/src/config.ts +342 -0
- package/src/constants.ts +4 -0
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +203 -0
- package/src/contracts/empire_base.ts +89 -0
- package/src/contracts/errors.ts +13 -0
- package/src/contracts/fee_asset_handler.ts +66 -0
- package/src/contracts/fee_asset_price_oracle.ts +284 -0
- package/src/contracts/fee_juice.ts +57 -0
- package/src/contracts/governance.ts +597 -0
- package/src/contracts/governance_proposer.ts +181 -0
- package/src/contracts/gse.ts +105 -0
- package/src/contracts/inbox.ts +223 -0
- package/src/contracts/index.ts +17 -0
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +298 -0
- package/src/contracts/outbox.ts +132 -0
- package/src/contracts/registry.ts +161 -0
- package/src/contracts/rollup.ts +1502 -0
- package/src/contracts/slasher_contract.ts +89 -0
- package/src/contracts/slashing_proposer.ts +397 -0
- package/src/contracts/utils.ts +14 -0
- package/src/contracts/watch_event.ts +109 -0
- package/src/deploy_aztec_l1_contracts.ts +663 -0
- package/src/deploy_l1_contract.ts +361 -0
- package/src/eth-signer/eth-signer.ts +24 -0
- package/src/eth-signer/index.ts +1 -0
- package/src/forwarder_proxy.ts +107 -0
- package/src/foundry_binary.ts +57 -0
- package/src/l1_artifacts.ts +231 -0
- package/src/l1_contract_addresses.ts +149 -0
- package/src/l1_reader.ts +57 -0
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +181 -0
- package/src/l1_tx_utils/constants.ts +29 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +162 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +244 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +55 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +107 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +15 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +874 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +840 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +459 -0
- package/src/l1_tx_utils/signer.ts +27 -0
- package/src/l1_tx_utils/tx_delayer.ts +302 -0
- package/src/l1_tx_utils/types.ts +116 -0
- package/src/l1_tx_utils/utils.ts +15 -0
- package/src/l1_types.ts +6 -0
- package/src/publisher_manager.ts +239 -0
- package/src/queries.ts +189 -0
- package/src/test/blob_kzg_warmup.ts +65 -0
- package/src/test/chain_monitor.ts +389 -0
- package/src/test/eth_cheat_codes.ts +624 -0
- package/src/test/eth_cheat_codes_with_state.ts +38 -0
- package/src/test/index.ts +7 -0
- package/src/test/recording_rpc_server.ts +69 -0
- package/src/test/rollup_cheat_codes.ts +398 -0
- package/src/test/start_anvil.ts +255 -0
- package/src/test/upgrade_utils.ts +109 -0
- package/src/types.ts +97 -0
- package/src/utils.ts +344 -0
- package/src/zkPassportVerifierAddress.ts +15 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
2
|
+
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
3
|
+
import { sleep } from '@aztec-labs/foundation/sleep';
|
|
4
|
+
import { encodeFunctionData, getContract, parseEventLogs } from 'viem';
|
|
5
|
+
import { createL1TxUtils } from '../l1_tx_utils/index.js';
|
|
6
|
+
import { isExtendedClient } from '../types.js';
|
|
7
|
+
// Minimal ABI for IProposerPayload (`l1-contracts/src/governance/interfaces/IProposerPayload.sol`).
|
|
8
|
+
// The GovernanceProposer wraps every original payload in a GSEPayload before submitting it to
|
|
9
|
+
// Governance, so `Proposal.payload` on the Governance contract is the wrapper address rather than
|
|
10
|
+
// the original. We only need `getOriginalPayload` to recover the underlying payload, so we inline
|
|
11
|
+
// the ABI here instead of generating a full artifact.
|
|
12
|
+
const ProposerPayloadAbi = [
|
|
13
|
+
{
|
|
14
|
+
type: 'function',
|
|
15
|
+
name: 'getOriginalPayload',
|
|
16
|
+
inputs: [],
|
|
17
|
+
outputs: [
|
|
18
|
+
{
|
|
19
|
+
type: 'address'
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
stateMutability: 'view'
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
// NOTE: Must be kept in sync with IGovernance.ProposalState in l1-contracts
|
|
26
|
+
export var ProposalState = /*#__PURE__*/ function(ProposalState) {
|
|
27
|
+
ProposalState[ProposalState["Pending"] = 0] = "Pending";
|
|
28
|
+
ProposalState[ProposalState["Active"] = 1] = "Active";
|
|
29
|
+
ProposalState[ProposalState["Queued"] = 2] = "Queued";
|
|
30
|
+
ProposalState[ProposalState["Executable"] = 3] = "Executable";
|
|
31
|
+
ProposalState[ProposalState["Rejected"] = 4] = "Rejected";
|
|
32
|
+
ProposalState[ProposalState["Executed"] = 5] = "Executed";
|
|
33
|
+
ProposalState[ProposalState["Droppable"] = 6] = "Droppable";
|
|
34
|
+
ProposalState[ProposalState["Dropped"] = 7] = "Dropped";
|
|
35
|
+
ProposalState[ProposalState["Expired"] = 8] = "Expired";
|
|
36
|
+
return ProposalState;
|
|
37
|
+
}({});
|
|
38
|
+
/** Set of `ProposalState` values for which a proposal is fully immutable on-chain. */ const TERMINAL_PROPOSAL_STATES = new Set([
|
|
39
|
+
5,
|
|
40
|
+
4,
|
|
41
|
+
7,
|
|
42
|
+
8
|
|
43
|
+
]);
|
|
44
|
+
// Set of `ProposalState` values in which a proposal is still progressing towards execution.
|
|
45
|
+
// `Droppable` is deliberately excluded: it is neither live (it cannot progress on its own) nor
|
|
46
|
+
// terminal (it can resume its lifecycle if the governanceProposer is restored), so it is handled
|
|
47
|
+
// separately and is never memoized as immutable.
|
|
48
|
+
const LIVE_PROPOSAL_STATES = new Set([
|
|
49
|
+
0,
|
|
50
|
+
1,
|
|
51
|
+
2,
|
|
52
|
+
3
|
|
53
|
+
]);
|
|
54
|
+
// Hard upper bound on the wall-clock lifetime of any Governance proposal, in seconds.
|
|
55
|
+
// Each proposal stores its own snapshot of `ProposalConfiguration` at creation time and progresses
|
|
56
|
+
// through Pending -> Active -> Queued -> Executable using those frozen durations
|
|
57
|
+
// (see `ProposalLib.{pendingThrough,activeThrough,queuedThrough,executableThrough}`). Each of those
|
|
58
|
+
// four durations is bounded by `ConfigurationLib.TIME_UPPER = 90 days` (validated in
|
|
59
|
+
// `ConfigurationLib.assertValid`), so no proposal can be live for more than 4 * 90 days regardless
|
|
60
|
+
// of what config it was created under. Once past this point, the proposal is guaranteed to be in a
|
|
61
|
+
// terminal state (Executed / Rejected / Dropped / Expired).
|
|
62
|
+
export const MAX_PROPOSAL_LIFETIME_SECONDS = 4n * 90n * 24n * 3600n;
|
|
63
|
+
/**
|
|
64
|
+
* Validates a number returned by an on-chain `ProposalState` enum field and narrows it to the
|
|
65
|
+
* `ProposalState` enum. Throws if the value is out of range.
|
|
66
|
+
*/ function asProposalState(raw) {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
68
|
+
if (raw < 0 || raw > 8) {
|
|
69
|
+
throw new Error(`Invalid proposal state: ${raw}`);
|
|
70
|
+
}
|
|
71
|
+
return raw;
|
|
72
|
+
}
|
|
73
|
+
export function extractProposalIdFromLogs(logs) {
|
|
74
|
+
const parsedLogs = parseEventLogs({
|
|
75
|
+
abi: GovernanceAbi,
|
|
76
|
+
logs: logs,
|
|
77
|
+
eventName: 'Proposed'
|
|
78
|
+
});
|
|
79
|
+
if (parsedLogs.length === 0) {
|
|
80
|
+
throw new Error('Proposal log not found');
|
|
81
|
+
}
|
|
82
|
+
return parsedLogs[0].args.proposalId;
|
|
83
|
+
}
|
|
84
|
+
export class ReadOnlyGovernanceContract {
|
|
85
|
+
client;
|
|
86
|
+
governanceContract;
|
|
87
|
+
/**
|
|
88
|
+
* Cache of fully-resolved proposals keyed by id. We populate this lazily and only retain entries
|
|
89
|
+
* whose state is provably terminal -- once `cachedState` is `Executed` or `Dropped` the on-chain
|
|
90
|
+
* proposal struct is frozen and safe to memoize indefinitely. Other state transitions (e.g.
|
|
91
|
+
* Pending -> Active, or accumulating votes) leave the cache untouched and force a fresh fetch.
|
|
92
|
+
*/ proposalCache;
|
|
93
|
+
/**
|
|
94
|
+
* Cache of `IProposerPayload.getOriginalPayload()` results keyed by wrapper address. The wrapper
|
|
95
|
+
* contract's bytecode is immutable, so this mapping never changes -- a value of `undefined`
|
|
96
|
+
* encodes a proposal whose payload doesn't implement `getOriginalPayload` (e.g. proposeWithLock
|
|
97
|
+
* proposals) and should be treated as "no original".
|
|
98
|
+
*/ originalPayloadCache;
|
|
99
|
+
/**
|
|
100
|
+
* Payloads (lowercased hex) observed as the subject of an `Executed` Governance proposal. Execution
|
|
101
|
+
* is immutable on-chain, so this verdict never expires within a process. It restores the
|
|
102
|
+
* `'executed'` classification for payloads whose executed proposal has since aged past the bounded
|
|
103
|
+
* lookback below. Lost on restart, at which point the bounded-lookback limitation applies again.
|
|
104
|
+
*/ executedPayloads;
|
|
105
|
+
constructor(address, client){
|
|
106
|
+
this.client = client;
|
|
107
|
+
this.proposalCache = new Map();
|
|
108
|
+
this.originalPayloadCache = new Map();
|
|
109
|
+
this.executedPayloads = new Set();
|
|
110
|
+
this.governanceContract = getContract({
|
|
111
|
+
address,
|
|
112
|
+
abi: GovernanceAbi,
|
|
113
|
+
client: client
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
get address() {
|
|
117
|
+
return EthAddress.fromString(this.governanceContract.address);
|
|
118
|
+
}
|
|
119
|
+
async getGovernanceProposerAddress() {
|
|
120
|
+
return EthAddress.fromString(await this.governanceContract.read.governanceProposer());
|
|
121
|
+
}
|
|
122
|
+
async getConfiguration() {
|
|
123
|
+
const raw = await this.governanceContract.read.getConfiguration();
|
|
124
|
+
return {
|
|
125
|
+
proposeConfig: {
|
|
126
|
+
lockDelay: raw.proposeConfig.lockDelay,
|
|
127
|
+
lockAmount: raw.proposeConfig.lockAmount
|
|
128
|
+
},
|
|
129
|
+
votingDelay: raw.votingDelay,
|
|
130
|
+
votingDuration: raw.votingDuration,
|
|
131
|
+
executionDelay: raw.executionDelay,
|
|
132
|
+
gracePeriod: raw.gracePeriod,
|
|
133
|
+
quorum: raw.quorum,
|
|
134
|
+
requiredYeaMargin: raw.requiredYeaMargin,
|
|
135
|
+
minimumVotes: raw.minimumVotes
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Fetches a proposal by id together with its live state, returning the mapped {@link Proposal}
|
|
140
|
+
* type. Issues `getProposal` and `getProposalState` in parallel so the result carries both the
|
|
141
|
+
* raw stored `cachedState` and the time-derived `state` -- callers can use whichever they need
|
|
142
|
+
* without an extra round-trip.
|
|
143
|
+
*
|
|
144
|
+
* Backed by an in-memory cache that retains entries only when `state` is in one of the four
|
|
145
|
+
* terminal phases (`Executed` / `Rejected` / `Dropped` / `Expired`). At that point the entire
|
|
146
|
+
* proposal struct is provably immutable on-chain (no further votes can be cast and no
|
|
147
|
+
* state-mutating call can succeed), so caching is safe forever. Non-terminal states force a
|
|
148
|
+
* fresh fetch on every call so callers always see fresh `state` and `summedBallot` values.
|
|
149
|
+
*/ async getProposal(proposalId) {
|
|
150
|
+
const cached = this.proposalCache.get(proposalId);
|
|
151
|
+
if (cached !== undefined) {
|
|
152
|
+
return cached;
|
|
153
|
+
}
|
|
154
|
+
const [raw, rawState] = await Promise.all([
|
|
155
|
+
this.governanceContract.read.getProposal([
|
|
156
|
+
proposalId
|
|
157
|
+
]),
|
|
158
|
+
this.governanceContract.read.getProposalState([
|
|
159
|
+
proposalId
|
|
160
|
+
])
|
|
161
|
+
]);
|
|
162
|
+
const proposal = {
|
|
163
|
+
config: {
|
|
164
|
+
votingDelay: raw.config.votingDelay,
|
|
165
|
+
votingDuration: raw.config.votingDuration,
|
|
166
|
+
executionDelay: raw.config.executionDelay,
|
|
167
|
+
gracePeriod: raw.config.gracePeriod,
|
|
168
|
+
quorum: raw.config.quorum,
|
|
169
|
+
requiredYeaMargin: raw.config.requiredYeaMargin,
|
|
170
|
+
minimumVotes: raw.config.minimumVotes
|
|
171
|
+
},
|
|
172
|
+
cachedState: asProposalState(raw.cachedState),
|
|
173
|
+
state: asProposalState(rawState),
|
|
174
|
+
payload: EthAddress.fromString(raw.payload),
|
|
175
|
+
proposer: EthAddress.fromString(raw.proposer),
|
|
176
|
+
creation: raw.creation,
|
|
177
|
+
summedBallot: {
|
|
178
|
+
yea: raw.summedBallot.yea,
|
|
179
|
+
nay: raw.summedBallot.nay
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
if (TERMINAL_PROPOSAL_STATES.has(proposal.state)) {
|
|
183
|
+
this.proposalCache.set(proposalId, proposal);
|
|
184
|
+
}
|
|
185
|
+
return proposal;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Returns the live state of a proposal as computed by `Governance.getProposalState`. Prefer
|
|
189
|
+
* {@link getProposal} when you also need any other proposal data -- it returns this same value
|
|
190
|
+
* via {@link Proposal.state} alongside the rest of the struct in a single round-trip.
|
|
191
|
+
*/ async getProposalState(proposalId) {
|
|
192
|
+
return asProposalState(await this.governanceContract.read.getProposalState([
|
|
193
|
+
proposalId
|
|
194
|
+
]));
|
|
195
|
+
}
|
|
196
|
+
getProposalCount() {
|
|
197
|
+
return this.governanceContract.read.proposalCount();
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Classifies the given original payload against the Governance proposal history. Distinguishes a
|
|
201
|
+
* payload that is still the subject of a live proposal (`'live'`) from one whose proposal was
|
|
202
|
+
* already executed (`'executed'`) from one that has no relevant proposal (`'none'`), so callers can
|
|
203
|
+
* stop re-signalling an executed payload while still re-signalling one whose proposal was merely
|
|
204
|
+
* rejected/dropped/expired (each GovernanceProposer round is independent and there is no
|
|
205
|
+
* payload-level uniqueness check on-chain).
|
|
206
|
+
*
|
|
207
|
+
* A proposal matches the payload either directly (its stored `payload` equals the target, as for
|
|
208
|
+
* `proposeWithLock` proposals) or via its `GSEPayload` wrapper unwrapping to the target. `'live'`
|
|
209
|
+
* (including `Droppable`) takes precedence over `'executed'`, so a payload re-submitted while a
|
|
210
|
+
* prior execution is still in the lookback window reads as `'live'`.
|
|
211
|
+
*
|
|
212
|
+
* Implemented as a bounded view-call sweep over `Governance.proposals` rather than an event scan,
|
|
213
|
+
* because `eth_getLogs` over the full deployment history of a long-lived rollup exceeds typical
|
|
214
|
+
* RPC block-range caps. The number of proposals (`proposalCount`) is small in practice, and we
|
|
215
|
+
* walk newest -> oldest with a hard early-stop on the protocol-wide proposal lifetime cap. This
|
|
216
|
+
* makes the `'executed'` verdict a *bounded lookback* rather than permanent suppression: a proposal
|
|
217
|
+
* executed longer ago than the lifetime cap is only reported once it has been observed and
|
|
218
|
+
* memoized in-process (memo is lost on restart).
|
|
219
|
+
*/ async getPayloadProposalStatus(payload) {
|
|
220
|
+
const target = payload.toLowerCase();
|
|
221
|
+
const proposalCount = await this.getProposalCount();
|
|
222
|
+
if (proposalCount === 0n) {
|
|
223
|
+
return this.executedPayloads.has(target) ? 'executed' : 'none';
|
|
224
|
+
}
|
|
225
|
+
// Anything created before this cutoff is guaranteed terminal regardless of its frozen config.
|
|
226
|
+
const block = await this.client.getBlock();
|
|
227
|
+
const hardCutoff = block.timestamp - MAX_PROPOSAL_LIFETIME_SECONDS;
|
|
228
|
+
// Proposals are append-only with monotonically non-decreasing creation timestamps, so iterating
|
|
229
|
+
// from newest -> oldest lets us early-stop as soon as we cross the lifetime cutoff.
|
|
230
|
+
for(let id = proposalCount - 1n; id >= 0n; id--){
|
|
231
|
+
const proposal = await this.getProposal(id);
|
|
232
|
+
// Hard early-stop: every older proposal is also older than the cutoff and therefore terminal.
|
|
233
|
+
if (proposal.creation < hardCutoff) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
const proposalPayload = proposal.payload.toString().toLowerCase();
|
|
237
|
+
const original = await this.getOriginalPayload(proposal.payload);
|
|
238
|
+
const matches = proposalPayload === target || original !== undefined && original.toLowerCase() === target;
|
|
239
|
+
if (!matches) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
// A live or Droppable proposal blocks re-signalling and wins over any executed one.
|
|
243
|
+
if (LIVE_PROPOSAL_STATES.has(proposal.state) || proposal.state === 6) {
|
|
244
|
+
return 'live';
|
|
245
|
+
}
|
|
246
|
+
if (proposal.state === 5) {
|
|
247
|
+
this.executedPayloads.add(target);
|
|
248
|
+
}
|
|
249
|
+
// Rejected/Dropped/Expired proposals allow re-proposing the same payload; keep scanning.
|
|
250
|
+
}
|
|
251
|
+
return this.executedPayloads.has(target) ? 'executed' : 'none';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Resolves the original payload behind a `GSEPayload` wrapper. Returns `undefined` if the
|
|
255
|
+
* wrapper does not implement `IProposerPayload.getOriginalPayload` (e.g. proposals created via
|
|
256
|
+
* `Governance.proposeWithLock`, which bypass GSEPayload entirely and store the raw `IPayload`
|
|
257
|
+
* directly). Results are memoized indefinitely because deployed wrapper bytecode is immutable.
|
|
258
|
+
*/ async getOriginalPayload(wrapper) {
|
|
259
|
+
const key = wrapper.toString();
|
|
260
|
+
if (this.originalPayloadCache.has(key)) {
|
|
261
|
+
return this.originalPayloadCache.get(key);
|
|
262
|
+
}
|
|
263
|
+
let original;
|
|
264
|
+
try {
|
|
265
|
+
original = await this.client.readContract({
|
|
266
|
+
address: key,
|
|
267
|
+
abi: ProposerPayloadAbi,
|
|
268
|
+
functionName: 'getOriginalPayload'
|
|
269
|
+
});
|
|
270
|
+
} catch {
|
|
271
|
+
original = undefined;
|
|
272
|
+
}
|
|
273
|
+
this.originalPayloadCache.set(key, original);
|
|
274
|
+
return original;
|
|
275
|
+
}
|
|
276
|
+
async awaitProposalActive({ proposalId, logger }) {
|
|
277
|
+
const state = await this.getProposalState(proposalId);
|
|
278
|
+
if (state === 1) {
|
|
279
|
+
return;
|
|
280
|
+
} else if (state !== 0) {
|
|
281
|
+
throw new Error(`Proposal ${proposalId} is in state [${state}]: it will never be active`);
|
|
282
|
+
} else {
|
|
283
|
+
const proposal = await this.getProposal(proposalId);
|
|
284
|
+
const startOfActive = proposal.creation + proposal.config.votingDelay;
|
|
285
|
+
const block = await this.client.getBlock();
|
|
286
|
+
// Add 12 seconds to the time to make sure we don't vote too early
|
|
287
|
+
const secondsToActive = Number(startOfActive - block.timestamp) + 12;
|
|
288
|
+
const now = new Date();
|
|
289
|
+
logger.info(`
|
|
290
|
+
The time is ${now.toISOString()}.
|
|
291
|
+
The proposal will be active at ${new Date(Number(startOfActive) * 1000).toISOString()}.
|
|
292
|
+
Waiting ${secondsToActive} seconds for proposal to be active.
|
|
293
|
+
`);
|
|
294
|
+
await sleep(secondsToActive * 1000);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
async awaitProposalExecutable({ proposalId, logger }) {
|
|
298
|
+
const state = await this.getProposalState(proposalId);
|
|
299
|
+
if (state === 3) {
|
|
300
|
+
return;
|
|
301
|
+
} else if (![
|
|
302
|
+
0,
|
|
303
|
+
1,
|
|
304
|
+
2,
|
|
305
|
+
3
|
|
306
|
+
].includes(state)) {
|
|
307
|
+
throw new Error(`Proposal ${proposalId} is in state [${state}]: it will never be executable`);
|
|
308
|
+
} else {
|
|
309
|
+
const proposal = await this.getProposal(proposalId);
|
|
310
|
+
const startOfExecutable = proposal.creation + proposal.config.votingDelay + proposal.config.votingDuration + proposal.config.executionDelay;
|
|
311
|
+
const block = await this.client.getBlock();
|
|
312
|
+
const secondsToExecutable = Number(startOfExecutable - block.timestamp) + 12;
|
|
313
|
+
const now = new Date();
|
|
314
|
+
logger.info(`
|
|
315
|
+
The time is ${now.toISOString()}.
|
|
316
|
+
The proposal will be executable at ${new Date(Number(startOfExecutable) * 1000).toISOString()}.
|
|
317
|
+
Waiting ${secondsToExecutable} seconds for proposal to be executable.
|
|
318
|
+
`);
|
|
319
|
+
await sleep(secondsToExecutable * 1000);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
324
|
+
client;
|
|
325
|
+
governanceContract;
|
|
326
|
+
constructor(address, client){
|
|
327
|
+
if (address instanceof EthAddress) {
|
|
328
|
+
address = address.toString();
|
|
329
|
+
}
|
|
330
|
+
super(address, client), this.client = client;
|
|
331
|
+
if (!isExtendedClient(client)) {
|
|
332
|
+
throw new Error('GovernanceContract has to be instantiated with a wallet client.');
|
|
333
|
+
}
|
|
334
|
+
this.governanceContract = getContract({
|
|
335
|
+
address,
|
|
336
|
+
abi: GovernanceAbi,
|
|
337
|
+
client
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
async deposit(onBehalfOf, amount) {
|
|
341
|
+
const depositTx = await this.governanceContract.write.deposit([
|
|
342
|
+
onBehalfOf,
|
|
343
|
+
amount
|
|
344
|
+
]);
|
|
345
|
+
await this.client.waitForTransactionReceipt({
|
|
346
|
+
hash: depositTx
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async proposeWithLock({ payloadAddress, withdrawAddress }) {
|
|
350
|
+
const proposeTx = await this.governanceContract.write.proposeWithLock([
|
|
351
|
+
payloadAddress,
|
|
352
|
+
withdrawAddress
|
|
353
|
+
]);
|
|
354
|
+
const receipt = await this.client.waitForTransactionReceipt({
|
|
355
|
+
hash: proposeTx
|
|
356
|
+
});
|
|
357
|
+
if (receipt.status !== 'success') {
|
|
358
|
+
throw new Error(`Proposal failed: ${receipt.status}`);
|
|
359
|
+
}
|
|
360
|
+
return extractProposalIdFromLogs(receipt.logs);
|
|
361
|
+
}
|
|
362
|
+
async getPower() {
|
|
363
|
+
const now = await this.client.getBlock();
|
|
364
|
+
return this.governanceContract.read.powerAt([
|
|
365
|
+
this.client.account.address,
|
|
366
|
+
now.timestamp
|
|
367
|
+
]);
|
|
368
|
+
}
|
|
369
|
+
/** Returns the user's voting power for a specific proposal, checked at pendingThrough timestamp. */ async getPowerForProposal(proposalId) {
|
|
370
|
+
const proposal = await this.getProposal(proposalId);
|
|
371
|
+
const pendingThrough = proposal.creation + proposal.config.votingDelay;
|
|
372
|
+
return this.governanceContract.read.powerAt([
|
|
373
|
+
this.client.account.address,
|
|
374
|
+
pendingThrough
|
|
375
|
+
]);
|
|
376
|
+
}
|
|
377
|
+
async vote({ proposalId, voteAmount, inFavor, retries = 10, logger }) {
|
|
378
|
+
const l1TxUtils = createL1TxUtils(this.client, {
|
|
379
|
+
logger
|
|
380
|
+
});
|
|
381
|
+
const retryDelaySeconds = 12;
|
|
382
|
+
voteAmount = voteAmount ?? await this.getPowerForProposal(proposalId);
|
|
383
|
+
let success = false;
|
|
384
|
+
for(let i = 0; i < retries; i++){
|
|
385
|
+
try {
|
|
386
|
+
const voteFunctionData = {
|
|
387
|
+
abi: GovernanceAbi,
|
|
388
|
+
functionName: 'vote',
|
|
389
|
+
args: [
|
|
390
|
+
proposalId,
|
|
391
|
+
voteAmount,
|
|
392
|
+
inFavor
|
|
393
|
+
]
|
|
394
|
+
};
|
|
395
|
+
const encodedVoteData = encodeFunctionData(voteFunctionData);
|
|
396
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
397
|
+
to: this.governanceContract.address,
|
|
398
|
+
abi: GovernanceAbi,
|
|
399
|
+
data: encodedVoteData
|
|
400
|
+
});
|
|
401
|
+
if (receipt.status === 'success') {
|
|
402
|
+
success = true;
|
|
403
|
+
break;
|
|
404
|
+
} else {
|
|
405
|
+
const args = {
|
|
406
|
+
...voteFunctionData,
|
|
407
|
+
address: this.governanceContract.address
|
|
408
|
+
};
|
|
409
|
+
const errorMsg = await l1TxUtils.tryGetErrorFromRevertedTx(encodedVoteData, args, undefined, []);
|
|
410
|
+
logger.error(`Error voting on proposal ${proposalId}: ${errorMsg}`);
|
|
411
|
+
}
|
|
412
|
+
} catch (error) {
|
|
413
|
+
logger.error(`Error voting on proposal ${proposalId}: ${error}`);
|
|
414
|
+
}
|
|
415
|
+
logger.info(`Retrying vote on proposal ${proposalId} in ${retryDelaySeconds} seconds`);
|
|
416
|
+
await sleep(retryDelaySeconds * 1000);
|
|
417
|
+
}
|
|
418
|
+
if (!success) {
|
|
419
|
+
throw new Error(`Failed to vote on proposal ${proposalId} after ${retries} retries`);
|
|
420
|
+
}
|
|
421
|
+
logger.info(`Voted [${inFavor ? 'yea' : 'nay'}] on proposal [${proposalId}]`);
|
|
422
|
+
const proposal = await this.getProposal(proposalId);
|
|
423
|
+
logger.info(`Proposal [${proposalId}] has cached state [${proposal.cachedState}]`);
|
|
424
|
+
logger.info(`Proposal [${proposalId}] has summedBallot yea [${proposal.summedBallot.yea}]`);
|
|
425
|
+
logger.info(`Proposal [${proposalId}] has summedBallot nay [${proposal.summedBallot.nay}]`);
|
|
426
|
+
}
|
|
427
|
+
async executeProposal({ proposalId, retries = 10, logger }) {
|
|
428
|
+
const l1TxUtils = createL1TxUtils(this.client, {
|
|
429
|
+
logger
|
|
430
|
+
});
|
|
431
|
+
const retryDelaySeconds = 12;
|
|
432
|
+
let success = false;
|
|
433
|
+
for(let i = 0; i < retries; i++){
|
|
434
|
+
try {
|
|
435
|
+
const executeFunctionData = {
|
|
436
|
+
abi: GovernanceAbi,
|
|
437
|
+
functionName: 'execute',
|
|
438
|
+
args: [
|
|
439
|
+
proposalId
|
|
440
|
+
]
|
|
441
|
+
};
|
|
442
|
+
const encodedExecuteData = encodeFunctionData(executeFunctionData);
|
|
443
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
444
|
+
to: this.governanceContract.address,
|
|
445
|
+
abi: GovernanceAbi,
|
|
446
|
+
data: encodedExecuteData
|
|
447
|
+
});
|
|
448
|
+
if (receipt.status === 'success') {
|
|
449
|
+
success = true;
|
|
450
|
+
break;
|
|
451
|
+
} else {
|
|
452
|
+
const args = {
|
|
453
|
+
...executeFunctionData,
|
|
454
|
+
address: this.governanceContract.address
|
|
455
|
+
};
|
|
456
|
+
const errorMsg = await l1TxUtils.tryGetErrorFromRevertedTx(encodedExecuteData, args, undefined, []);
|
|
457
|
+
logger.error(`Error executing proposal ${proposalId}: ${errorMsg}`);
|
|
458
|
+
}
|
|
459
|
+
} catch (error) {
|
|
460
|
+
logger.error(`Error executing proposal ${proposalId}: ${error}`);
|
|
461
|
+
}
|
|
462
|
+
logger.info(`Retrying execute proposal ${proposalId} in ${retryDelaySeconds} seconds`);
|
|
463
|
+
await sleep(retryDelaySeconds * 1000);
|
|
464
|
+
}
|
|
465
|
+
if (!success) {
|
|
466
|
+
throw new Error(`Failed to execute proposal ${proposalId} after ${retries} retries`);
|
|
467
|
+
} else {
|
|
468
|
+
logger.info(`Executed proposal ${proposalId}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec-labs/foundation/branded-types';
|
|
2
|
+
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
3
|
+
import { type Hex, type TransactionReceipt, type TypedDataDefinition } from 'viem';
|
|
4
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
5
|
+
import type { ViemClient } from '../types.js';
|
|
6
|
+
import { type IEmpireBase } from './empire_base.js';
|
|
7
|
+
import { type PayloadProposalStatus, ReadOnlyGovernanceContract } from './governance.js';
|
|
8
|
+
export declare class GovernanceProposerContract implements IEmpireBase {
|
|
9
|
+
readonly client: ViemClient;
|
|
10
|
+
private readonly proposer;
|
|
11
|
+
/**
|
|
12
|
+
* Cache of bytecode-existence checks keyed by payload address. The check is stable for a
|
|
13
|
+
* contract's lifetime -- a contract either has code or it does not, and code cannot be removed
|
|
14
|
+
* after deployment (selfdestruct aside, which is not relevant here). Safe to memoize
|
|
15
|
+
* indefinitely for the lifetime of this instance.
|
|
16
|
+
*/
|
|
17
|
+
private readonly emptyPayloadCache;
|
|
18
|
+
constructor(client: ViemClient, address: Hex | EthAddress);
|
|
19
|
+
get address(): EthAddress;
|
|
20
|
+
getRollupAddress(): Promise<EthAddress>;
|
|
21
|
+
getRegistryAddress(): Promise<EthAddress>;
|
|
22
|
+
getQuorumSize(): Promise<bigint>;
|
|
23
|
+
getRoundSize(): Promise<bigint>;
|
|
24
|
+
computeRound(slot: SlotNumber): Promise<bigint>;
|
|
25
|
+
getRoundInfo(rollupAddress: Hex, round: bigint): Promise<{
|
|
26
|
+
lastSignalSlot: SlotNumber;
|
|
27
|
+
payloadWithMostSignals: Hex;
|
|
28
|
+
quorumReached: boolean;
|
|
29
|
+
executed: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint>;
|
|
32
|
+
createSignalRequest(payload: Hex): L1TxRequest;
|
|
33
|
+
createSignalRequestWithSignature(payload: Hex, slot: SlotNumber, chainId: number, signerAddress: Hex, signer: (msg: TypedDataDefinition) => Promise<Hex>): Promise<L1TxRequest>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the Governance contract this proposer submits winners to. Lazily reads
|
|
36
|
+
* `GovernanceProposer.getGovernance()` (which itself looks the address up via the registry) and
|
|
37
|
+
* memoizes the resulting wrapper.
|
|
38
|
+
*/
|
|
39
|
+
getGovernance(): Promise<ReadOnlyGovernanceContract>;
|
|
40
|
+
/**
|
|
41
|
+
* Classifies the given original payload against the Governance proposal history (`'live'` /
|
|
42
|
+
* `'executed'` / `'none'`). Delegates to `ReadOnlyGovernanceContract.getPayloadProposalStatus`,
|
|
43
|
+
* which implements the actual sweep against the Governance contract -- this method exists only as
|
|
44
|
+
* a convenience wrapper so callers that already hold a GovernanceProposer reference don't have to
|
|
45
|
+
* resolve the Governance address themselves.
|
|
46
|
+
*/
|
|
47
|
+
getPayloadProposalStatus(payload: Hex): Promise<PayloadProposalStatus>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns true if the given payload address has no deployed bytecode. Used as a cheap
|
|
50
|
+
* pre-flight check before casting a governance signal — voting for a zero-code address
|
|
51
|
+
* is unrecoverable.
|
|
52
|
+
*
|
|
53
|
+
* We only cache the `false` result (address has bytecode). The `true` result is NOT
|
|
54
|
+
* cached because a CREATE2-redeployed address could go from empty to populated, and
|
|
55
|
+
* caching `true` would make us keep skipping a payload that later becomes valid.
|
|
56
|
+
*/
|
|
57
|
+
isPayloadEmpty(payload: EthAddress): Promise<boolean>;
|
|
58
|
+
submitRoundWinner(round: bigint, l1TxUtils: L1TxUtils): Promise<{
|
|
59
|
+
receipt: TransactionReceipt;
|
|
60
|
+
proposalId: bigint;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ292ZXJuYW5jZV9wcm9wb3Nlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0cy9nb3Zlcm5hbmNlX3Byb3Bvc2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUVsRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFDaEUsT0FBTyxFQUVMLEtBQUssR0FBRyxFQUNSLEtBQUssa0JBQWtCLE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