@aztec/ethereum 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891
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/account.d.ts +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +10 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +13 -3
- package/dest/config.d.ts +24 -68
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +67 -380
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +9 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +8 -4
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +39 -17
- package/dest/contracts/errors.d.ts +1 -1
- package/dest/contracts/errors.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +11 -9
- package/dest/contracts/fee_asset_price_oracle.d.ts +101 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +651 -0
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +18 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +14 -4
- package/dest/contracts/governance_proposer.d.ts +8 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +412 -11
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +36 -1
- package/dest/contracts/index.d.ts +4 -1
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +3 -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 +2 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +2 -1
- package/dest/contracts/outbox.d.ts +41 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +86 -0
- package/dest/contracts/registry.d.ts +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +208 -123
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +807 -188
- package/dest/contracts/slasher_contract.d.ts +1 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts +9 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +11 -4
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +259 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +413 -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 +1 -1
- package/dest/eth-signer/index.d.ts +1 -1
- 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/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +7608 -2048
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +3 -3
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -3
- package/dest/l1_reader.d.ts +5 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +12 -1
- package/dest/l1_tx_utils/config.d.ts +11 -5
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +43 -7
- package/dest/l1_tx_utils/constants.d.ts +8 -2
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +27 -2
- package/dest/l1_tx_utils/factory.d.ts +18 -10
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +17 -7
- 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 +4 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +3 -0
- package/dest/l1_tx_utils/interfaces.d.ts +2 -2
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +18 -8
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +75 -46
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -30
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +63 -167
- package/dest/l1_tx_utils/signer.d.ts +1 -1
- package/dest/l1_tx_utils/tx_delayer.d.ts +56 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +65 -36
- package/dest/l1_tx_utils/types.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/utils.d.ts +1 -1
- package/dest/l1_types.d.ts +1 -1
- 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 +2 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +16 -6
- package/dest/test/chain_monitor.d.ts +47 -25
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +66 -38
- package/dest/test/eth_cheat_codes.d.ts +11 -3
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +11 -3
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -2
- package/dest/test/rollup_cheat_codes.d.ts +17 -13
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +62 -38
- package/dest/test/start_anvil.d.ts +18 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +129 -28
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +16 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +80 -12
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/package.json +34 -16
- package/src/client.ts +10 -2
- package/src/config.ts +86 -460
- package/src/contracts/README.md +157 -0
- package/src/contracts/empire_base.ts +8 -5
- package/src/contracts/empire_slashing_proposer.ts +38 -32
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +280 -0
- package/src/contracts/governance.ts +13 -4
- package/src/contracts/governance_proposer.ts +26 -6
- package/src/contracts/inbox.ts +55 -3
- package/src/contracts/index.ts +3 -0
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +5 -2
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +485 -162
- package/src/contracts/tally_slashing_proposer.ts +15 -8
- package/src/deploy_aztec_l1_contracts.ts +650 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_contract_addresses.ts +22 -20
- package/src/l1_reader.ts +21 -1
- package/src/l1_tx_utils/config.ts +52 -11
- package/src/l1_tx_utils/constants.ts +13 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +3 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +84 -36
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +77 -213
- package/src/{test → l1_tx_utils}/tx_delayer.ts +82 -52
- package/src/publisher_manager.ts +4 -2
- package/src/queries.ts +17 -6
- package/src/test/chain_monitor.ts +110 -51
- package/src/test/eth_cheat_codes.ts +9 -3
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +63 -43
- package/src/test/start_anvil.ts +156 -27
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +100 -15
- package/dest/deploy_l1_contracts.d.ts +0 -226
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1473
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
- package/dest/test/delayed_tx_utils.d.ts +0 -13
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -28
- package/dest/test/tx_delayer.d.ts +0 -36
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/src/deploy_l1_contracts.ts +0 -1849
- package/src/index.ts +0 -17
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
package/dest/contracts/rollup.js
CHANGED
|
@@ -1,11 +1,383 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function applyDecs2203RFactory() {
|
|
2
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
3
|
+
return function addInitializer(initializer) {
|
|
4
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
5
|
+
assertCallable(initializer, "An initializer");
|
|
6
|
+
initializers.push(initializer);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
10
|
+
var kindStr;
|
|
11
|
+
switch(kind){
|
|
12
|
+
case 1:
|
|
13
|
+
kindStr = "accessor";
|
|
14
|
+
break;
|
|
15
|
+
case 2:
|
|
16
|
+
kindStr = "method";
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
kindStr = "getter";
|
|
20
|
+
break;
|
|
21
|
+
case 4:
|
|
22
|
+
kindStr = "setter";
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
kindStr = "field";
|
|
26
|
+
}
|
|
27
|
+
var ctx = {
|
|
28
|
+
kind: kindStr,
|
|
29
|
+
name: isPrivate ? "#" + name : name,
|
|
30
|
+
static: isStatic,
|
|
31
|
+
private: isPrivate,
|
|
32
|
+
metadata: metadata
|
|
33
|
+
};
|
|
34
|
+
var decoratorFinishedRef = {
|
|
35
|
+
v: false
|
|
36
|
+
};
|
|
37
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
38
|
+
var get, set;
|
|
39
|
+
if (kind === 0) {
|
|
40
|
+
if (isPrivate) {
|
|
41
|
+
get = desc.get;
|
|
42
|
+
set = desc.set;
|
|
43
|
+
} else {
|
|
44
|
+
get = function() {
|
|
45
|
+
return this[name];
|
|
46
|
+
};
|
|
47
|
+
set = function(v) {
|
|
48
|
+
this[name] = v;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} else if (kind === 2) {
|
|
52
|
+
get = function() {
|
|
53
|
+
return desc.value;
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
if (kind === 1 || kind === 3) {
|
|
57
|
+
get = function() {
|
|
58
|
+
return desc.get.call(this);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (kind === 1 || kind === 4) {
|
|
62
|
+
set = function(v) {
|
|
63
|
+
desc.set.call(this, v);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ctx.access = get && set ? {
|
|
68
|
+
get: get,
|
|
69
|
+
set: set
|
|
70
|
+
} : get ? {
|
|
71
|
+
get: get
|
|
72
|
+
} : {
|
|
73
|
+
set: set
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
return dec(value, ctx);
|
|
77
|
+
} finally{
|
|
78
|
+
decoratorFinishedRef.v = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
82
|
+
if (decoratorFinishedRef.v) {
|
|
83
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertCallable(fn, hint) {
|
|
87
|
+
if (typeof fn !== "function") {
|
|
88
|
+
throw new TypeError(hint + " must be a function");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function assertValidReturnValue(kind, value) {
|
|
92
|
+
var type = typeof value;
|
|
93
|
+
if (kind === 1) {
|
|
94
|
+
if (type !== "object" || value === null) {
|
|
95
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
96
|
+
}
|
|
97
|
+
if (value.get !== undefined) {
|
|
98
|
+
assertCallable(value.get, "accessor.get");
|
|
99
|
+
}
|
|
100
|
+
if (value.set !== undefined) {
|
|
101
|
+
assertCallable(value.set, "accessor.set");
|
|
102
|
+
}
|
|
103
|
+
if (value.init !== undefined) {
|
|
104
|
+
assertCallable(value.init, "accessor.init");
|
|
105
|
+
}
|
|
106
|
+
} else if (type !== "function") {
|
|
107
|
+
var hint;
|
|
108
|
+
if (kind === 0) {
|
|
109
|
+
hint = "field";
|
|
110
|
+
} else if (kind === 10) {
|
|
111
|
+
hint = "class";
|
|
112
|
+
} else {
|
|
113
|
+
hint = "method";
|
|
114
|
+
}
|
|
115
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
119
|
+
var decs = decInfo[0];
|
|
120
|
+
var desc, init, value;
|
|
121
|
+
if (isPrivate) {
|
|
122
|
+
if (kind === 0 || kind === 1) {
|
|
123
|
+
desc = {
|
|
124
|
+
get: decInfo[3],
|
|
125
|
+
set: decInfo[4]
|
|
126
|
+
};
|
|
127
|
+
} else if (kind === 3) {
|
|
128
|
+
desc = {
|
|
129
|
+
get: decInfo[3]
|
|
130
|
+
};
|
|
131
|
+
} else if (kind === 4) {
|
|
132
|
+
desc = {
|
|
133
|
+
set: decInfo[3]
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
desc = {
|
|
137
|
+
value: decInfo[3]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
} else if (kind !== 0) {
|
|
141
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
142
|
+
}
|
|
143
|
+
if (kind === 1) {
|
|
144
|
+
value = {
|
|
145
|
+
get: desc.get,
|
|
146
|
+
set: desc.set
|
|
147
|
+
};
|
|
148
|
+
} else if (kind === 2) {
|
|
149
|
+
value = desc.value;
|
|
150
|
+
} else if (kind === 3) {
|
|
151
|
+
value = desc.get;
|
|
152
|
+
} else if (kind === 4) {
|
|
153
|
+
value = desc.set;
|
|
154
|
+
}
|
|
155
|
+
var newValue, get, set;
|
|
156
|
+
if (typeof decs === "function") {
|
|
157
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
158
|
+
if (newValue !== void 0) {
|
|
159
|
+
assertValidReturnValue(kind, newValue);
|
|
160
|
+
if (kind === 0) {
|
|
161
|
+
init = newValue;
|
|
162
|
+
} else if (kind === 1) {
|
|
163
|
+
init = newValue.init;
|
|
164
|
+
get = newValue.get || value.get;
|
|
165
|
+
set = newValue.set || value.set;
|
|
166
|
+
value = {
|
|
167
|
+
get: get,
|
|
168
|
+
set: set
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
value = newValue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
176
|
+
var dec = decs[i];
|
|
177
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
178
|
+
if (newValue !== void 0) {
|
|
179
|
+
assertValidReturnValue(kind, newValue);
|
|
180
|
+
var newInit;
|
|
181
|
+
if (kind === 0) {
|
|
182
|
+
newInit = newValue;
|
|
183
|
+
} else if (kind === 1) {
|
|
184
|
+
newInit = newValue.init;
|
|
185
|
+
get = newValue.get || value.get;
|
|
186
|
+
set = newValue.set || value.set;
|
|
187
|
+
value = {
|
|
188
|
+
get: get,
|
|
189
|
+
set: set
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
value = newValue;
|
|
193
|
+
}
|
|
194
|
+
if (newInit !== void 0) {
|
|
195
|
+
if (init === void 0) {
|
|
196
|
+
init = newInit;
|
|
197
|
+
} else if (typeof init === "function") {
|
|
198
|
+
init = [
|
|
199
|
+
init,
|
|
200
|
+
newInit
|
|
201
|
+
];
|
|
202
|
+
} else {
|
|
203
|
+
init.push(newInit);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (kind === 0 || kind === 1) {
|
|
210
|
+
if (init === void 0) {
|
|
211
|
+
init = function(instance, init) {
|
|
212
|
+
return init;
|
|
213
|
+
};
|
|
214
|
+
} else if (typeof init !== "function") {
|
|
215
|
+
var ownInitializers = init;
|
|
216
|
+
init = function(instance, init) {
|
|
217
|
+
var value = init;
|
|
218
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
219
|
+
value = ownInitializers[i].call(instance, value);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
var originalInitializer = init;
|
|
225
|
+
init = function(instance, init) {
|
|
226
|
+
return originalInitializer.call(instance, init);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
ret.push(init);
|
|
230
|
+
}
|
|
231
|
+
if (kind !== 0) {
|
|
232
|
+
if (kind === 1) {
|
|
233
|
+
desc.get = value.get;
|
|
234
|
+
desc.set = value.set;
|
|
235
|
+
} else if (kind === 2) {
|
|
236
|
+
desc.value = value;
|
|
237
|
+
} else if (kind === 3) {
|
|
238
|
+
desc.get = value;
|
|
239
|
+
} else if (kind === 4) {
|
|
240
|
+
desc.set = value;
|
|
241
|
+
}
|
|
242
|
+
if (isPrivate) {
|
|
243
|
+
if (kind === 1) {
|
|
244
|
+
ret.push(function(instance, args) {
|
|
245
|
+
return value.get.call(instance, args);
|
|
246
|
+
});
|
|
247
|
+
ret.push(function(instance, args) {
|
|
248
|
+
return value.set.call(instance, args);
|
|
249
|
+
});
|
|
250
|
+
} else if (kind === 2) {
|
|
251
|
+
ret.push(value);
|
|
252
|
+
} else {
|
|
253
|
+
ret.push(function(instance, args) {
|
|
254
|
+
return value.call(instance, args);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
Object.defineProperty(base, name, desc);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
263
|
+
var ret = [];
|
|
264
|
+
var protoInitializers;
|
|
265
|
+
var staticInitializers;
|
|
266
|
+
var existingProtoNonFields = new Map();
|
|
267
|
+
var existingStaticNonFields = new Map();
|
|
268
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
269
|
+
var decInfo = decInfos[i];
|
|
270
|
+
if (!Array.isArray(decInfo)) continue;
|
|
271
|
+
var kind = decInfo[1];
|
|
272
|
+
var name = decInfo[2];
|
|
273
|
+
var isPrivate = decInfo.length > 3;
|
|
274
|
+
var isStatic = kind >= 5;
|
|
275
|
+
var base;
|
|
276
|
+
var initializers;
|
|
277
|
+
if (isStatic) {
|
|
278
|
+
base = Class;
|
|
279
|
+
kind = kind - 5;
|
|
280
|
+
staticInitializers = staticInitializers || [];
|
|
281
|
+
initializers = staticInitializers;
|
|
282
|
+
} else {
|
|
283
|
+
base = Class.prototype;
|
|
284
|
+
protoInitializers = protoInitializers || [];
|
|
285
|
+
initializers = protoInitializers;
|
|
286
|
+
}
|
|
287
|
+
if (kind !== 0 && !isPrivate) {
|
|
288
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
289
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
290
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
291
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
292
|
+
} else if (!existingKind && kind > 2) {
|
|
293
|
+
existingNonFields.set(name, kind);
|
|
294
|
+
} else {
|
|
295
|
+
existingNonFields.set(name, true);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
299
|
+
}
|
|
300
|
+
pushInitializers(ret, protoInitializers);
|
|
301
|
+
pushInitializers(ret, staticInitializers);
|
|
302
|
+
return ret;
|
|
303
|
+
}
|
|
304
|
+
function pushInitializers(ret, initializers) {
|
|
305
|
+
if (initializers) {
|
|
306
|
+
ret.push(function(instance) {
|
|
307
|
+
for(var i = 0; i < initializers.length; i++){
|
|
308
|
+
initializers[i].call(instance);
|
|
309
|
+
}
|
|
310
|
+
return instance;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
315
|
+
if (classDecs.length > 0) {
|
|
316
|
+
var initializers = [];
|
|
317
|
+
var newClass = targetClass;
|
|
318
|
+
var name = targetClass.name;
|
|
319
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
320
|
+
var decoratorFinishedRef = {
|
|
321
|
+
v: false
|
|
322
|
+
};
|
|
323
|
+
try {
|
|
324
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
325
|
+
kind: "class",
|
|
326
|
+
name: name,
|
|
327
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
328
|
+
metadata
|
|
329
|
+
});
|
|
330
|
+
} finally{
|
|
331
|
+
decoratorFinishedRef.v = true;
|
|
332
|
+
}
|
|
333
|
+
if (nextNewClass !== undefined) {
|
|
334
|
+
assertValidReturnValue(10, nextNewClass);
|
|
335
|
+
newClass = nextNewClass;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
defineMetadata(newClass, metadata),
|
|
340
|
+
function() {
|
|
341
|
+
for(var i = 0; i < initializers.length; i++){
|
|
342
|
+
initializers[i].call(newClass);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function defineMetadata(Class, metadata) {
|
|
349
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
350
|
+
configurable: true,
|
|
351
|
+
enumerable: true,
|
|
352
|
+
value: metadata
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
356
|
+
if (parentClass !== void 0) {
|
|
357
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
358
|
+
}
|
|
359
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
360
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
361
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
362
|
+
return {
|
|
363
|
+
e: e,
|
|
364
|
+
get c () {
|
|
365
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
371
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
6
372
|
}
|
|
373
|
+
var _initProto;
|
|
374
|
+
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
375
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
376
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
377
|
import { memoize } from '@aztec/foundation/decorators';
|
|
8
378
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
379
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
380
|
+
import { EscapeHatchAbi } from '@aztec/l1-artifacts/EscapeHatchAbi';
|
|
9
381
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
10
382
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
11
383
|
import chunk from 'lodash.chunk';
|
|
@@ -23,10 +395,130 @@ export var SlashingProposerType = /*#__PURE__*/ function(SlashingProposerType) {
|
|
|
23
395
|
SlashingProposerType[SlashingProposerType["Empire"] = 2] = "Empire";
|
|
24
396
|
return SlashingProposerType;
|
|
25
397
|
}({});
|
|
398
|
+
/**
|
|
399
|
+
* Status of a validator/attester in the staking system.
|
|
400
|
+
* Matches the Status enum in StakingLib.sol
|
|
401
|
+
*/ export var AttesterStatus = /*#__PURE__*/ function(AttesterStatus) {
|
|
402
|
+
AttesterStatus[AttesterStatus["NONE"] = 0] = "NONE";
|
|
403
|
+
AttesterStatus[AttesterStatus["VALIDATING"] = 1] = "VALIDATING";
|
|
404
|
+
AttesterStatus[AttesterStatus["ZOMBIE"] = 2] = "ZOMBIE";
|
|
405
|
+
AttesterStatus[AttesterStatus["EXITING"] = 3] = "EXITING";
|
|
406
|
+
return AttesterStatus;
|
|
407
|
+
}({});
|
|
26
408
|
export class RollupContract {
|
|
27
409
|
client;
|
|
410
|
+
static{
|
|
411
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
412
|
+
[
|
|
413
|
+
memoize,
|
|
414
|
+
2,
|
|
415
|
+
"getL1StartBlock"
|
|
416
|
+
],
|
|
417
|
+
[
|
|
418
|
+
memoize,
|
|
419
|
+
2,
|
|
420
|
+
"getL1GenesisTime"
|
|
421
|
+
],
|
|
422
|
+
[
|
|
423
|
+
memoize,
|
|
424
|
+
2,
|
|
425
|
+
"getProofSubmissionEpochs"
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
memoize,
|
|
429
|
+
2,
|
|
430
|
+
"getEpochDuration"
|
|
431
|
+
],
|
|
432
|
+
[
|
|
433
|
+
memoize,
|
|
434
|
+
2,
|
|
435
|
+
"getSlotDuration"
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
memoize,
|
|
439
|
+
2,
|
|
440
|
+
"getTargetCommitteeSize"
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
memoize,
|
|
444
|
+
2,
|
|
445
|
+
"getEjectionThreshold"
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
memoize,
|
|
449
|
+
2,
|
|
450
|
+
"getLocalEjectionThreshold"
|
|
451
|
+
],
|
|
452
|
+
[
|
|
453
|
+
memoize,
|
|
454
|
+
2,
|
|
455
|
+
"getLagInEpochsForValidatorSet"
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
memoize,
|
|
459
|
+
2,
|
|
460
|
+
"getLagInEpochsForRandao"
|
|
461
|
+
],
|
|
462
|
+
[
|
|
463
|
+
memoize,
|
|
464
|
+
2,
|
|
465
|
+
"getActivationThreshold"
|
|
466
|
+
],
|
|
467
|
+
[
|
|
468
|
+
memoize,
|
|
469
|
+
2,
|
|
470
|
+
"getExitDelay"
|
|
471
|
+
],
|
|
472
|
+
[
|
|
473
|
+
memoize,
|
|
474
|
+
2,
|
|
475
|
+
"getManaTarget"
|
|
476
|
+
],
|
|
477
|
+
[
|
|
478
|
+
memoize,
|
|
479
|
+
2,
|
|
480
|
+
"getProvingCostPerMana"
|
|
481
|
+
],
|
|
482
|
+
[
|
|
483
|
+
memoize,
|
|
484
|
+
2,
|
|
485
|
+
"getProvingCostPerManaInFeeAsset"
|
|
486
|
+
],
|
|
487
|
+
[
|
|
488
|
+
memoize,
|
|
489
|
+
2,
|
|
490
|
+
"getManaLimit"
|
|
491
|
+
],
|
|
492
|
+
[
|
|
493
|
+
memoize,
|
|
494
|
+
2,
|
|
495
|
+
"getVersion"
|
|
496
|
+
],
|
|
497
|
+
[
|
|
498
|
+
memoize,
|
|
499
|
+
2,
|
|
500
|
+
"getGenesisArchiveTreeRoot"
|
|
501
|
+
],
|
|
502
|
+
[
|
|
503
|
+
memoize,
|
|
504
|
+
2,
|
|
505
|
+
"getVkTreeRoot"
|
|
506
|
+
],
|
|
507
|
+
[
|
|
508
|
+
memoize,
|
|
509
|
+
2,
|
|
510
|
+
"getProtocolContractsHash"
|
|
511
|
+
],
|
|
512
|
+
[
|
|
513
|
+
memoize,
|
|
514
|
+
2,
|
|
515
|
+
"getRollupConstants"
|
|
516
|
+
]
|
|
517
|
+
], []));
|
|
518
|
+
}
|
|
28
519
|
rollup;
|
|
29
520
|
static cachedStfStorageSlot;
|
|
521
|
+
cachedEscapeHatch;
|
|
30
522
|
static get checkBlobStorageSlot() {
|
|
31
523
|
const asString = RollupStorage.find((storage)=>storage.label === 'checkBlob')?.slot;
|
|
32
524
|
if (asString === undefined) {
|
|
@@ -48,6 +540,7 @@ export class RollupContract {
|
|
|
48
540
|
}
|
|
49
541
|
constructor(client, address){
|
|
50
542
|
this.client = client;
|
|
543
|
+
_initProto(this);
|
|
51
544
|
if (address instanceof EthAddress) {
|
|
52
545
|
address = address.toString();
|
|
53
546
|
}
|
|
@@ -57,8 +550,8 @@ export class RollupContract {
|
|
|
57
550
|
client
|
|
58
551
|
});
|
|
59
552
|
}
|
|
60
|
-
getGSE() {
|
|
61
|
-
return this.rollup.read.getGSE();
|
|
553
|
+
async getGSE() {
|
|
554
|
+
return EthAddress.fromString(await this.rollup.read.getGSE());
|
|
62
555
|
}
|
|
63
556
|
get address() {
|
|
64
557
|
return this.rollup.address;
|
|
@@ -107,17 +600,17 @@ export class RollupContract {
|
|
|
107
600
|
getL1GenesisTime() {
|
|
108
601
|
return this.rollup.read.getGenesisTime();
|
|
109
602
|
}
|
|
110
|
-
getProofSubmissionEpochs() {
|
|
111
|
-
return this.rollup.read.getProofSubmissionEpochs();
|
|
603
|
+
async getProofSubmissionEpochs() {
|
|
604
|
+
return Number(await this.rollup.read.getProofSubmissionEpochs());
|
|
112
605
|
}
|
|
113
|
-
getEpochDuration() {
|
|
114
|
-
return this.rollup.read.getEpochDuration();
|
|
606
|
+
async getEpochDuration() {
|
|
607
|
+
return Number(await this.rollup.read.getEpochDuration());
|
|
115
608
|
}
|
|
116
|
-
getSlotDuration() {
|
|
117
|
-
return this.rollup.read.getSlotDuration();
|
|
609
|
+
async getSlotDuration() {
|
|
610
|
+
return Number(await this.rollup.read.getSlotDuration());
|
|
118
611
|
}
|
|
119
|
-
getTargetCommitteeSize() {
|
|
120
|
-
return this.rollup.read.getTargetCommitteeSize();
|
|
612
|
+
async getTargetCommitteeSize() {
|
|
613
|
+
return Number(await this.rollup.read.getTargetCommitteeSize());
|
|
121
614
|
}
|
|
122
615
|
getEjectionThreshold() {
|
|
123
616
|
return this.rollup.read.getEjectionThreshold();
|
|
@@ -125,14 +618,17 @@ export class RollupContract {
|
|
|
125
618
|
getLocalEjectionThreshold() {
|
|
126
619
|
return this.rollup.read.getLocalEjectionThreshold();
|
|
127
620
|
}
|
|
128
|
-
|
|
129
|
-
return this.rollup.read.
|
|
621
|
+
async getLagInEpochsForValidatorSet() {
|
|
622
|
+
return Number(await this.rollup.read.getLagInEpochsForValidatorSet());
|
|
623
|
+
}
|
|
624
|
+
async getLagInEpochsForRandao() {
|
|
625
|
+
return Number(await this.rollup.read.getLagInEpochsForRandao());
|
|
130
626
|
}
|
|
131
627
|
getActivationThreshold() {
|
|
132
628
|
return this.rollup.read.getActivationThreshold();
|
|
133
629
|
}
|
|
134
|
-
getExitDelay() {
|
|
135
|
-
return this.rollup.read.getExitDelay();
|
|
630
|
+
async getExitDelay() {
|
|
631
|
+
return Number(await this.rollup.read.getExitDelay());
|
|
136
632
|
}
|
|
137
633
|
getManaTarget() {
|
|
138
634
|
return this.rollup.read.getManaTarget();
|
|
@@ -150,47 +646,111 @@ export class RollupContract {
|
|
|
150
646
|
return this.rollup.read.getVersion();
|
|
151
647
|
}
|
|
152
648
|
async getGenesisArchiveTreeRoot() {
|
|
153
|
-
return await this.rollup.read.archiveAt([
|
|
649
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
154
650
|
0n
|
|
155
|
-
]);
|
|
651
|
+
]));
|
|
652
|
+
}
|
|
653
|
+
async getVkTreeRoot() {
|
|
654
|
+
const slot = BigInt(RollupContract.stfStorageSlot) + 3n;
|
|
655
|
+
const value = await this.client.getStorageAt({
|
|
656
|
+
address: this.address,
|
|
657
|
+
slot: `0x${slot.toString(16)}`
|
|
658
|
+
});
|
|
659
|
+
return Fr.fromString(value ?? '0x0');
|
|
660
|
+
}
|
|
661
|
+
async getProtocolContractsHash() {
|
|
662
|
+
const slot = BigInt(RollupContract.stfStorageSlot) + 4n;
|
|
663
|
+
const value = await this.client.getStorageAt({
|
|
664
|
+
address: this.address,
|
|
665
|
+
slot: `0x${slot.toString(16)}`
|
|
666
|
+
});
|
|
667
|
+
return Fr.fromString(value ?? '0x0');
|
|
156
668
|
}
|
|
157
669
|
/**
|
|
158
670
|
* Returns rollup constants used for epoch queries.
|
|
159
671
|
* Return type is `L1RollupConstants` which is defined in stdlib,
|
|
160
672
|
* so we cant reference it until we move this contract to that package.
|
|
161
673
|
*/ async getRollupConstants() {
|
|
162
|
-
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs] = await Promise.all([
|
|
674
|
+
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs, targetCommitteeSize, rollupManaLimit] = await Promise.all([
|
|
163
675
|
this.getL1StartBlock(),
|
|
164
676
|
this.getL1GenesisTime(),
|
|
165
677
|
this.getSlotDuration(),
|
|
166
678
|
this.getEpochDuration(),
|
|
167
|
-
this.getProofSubmissionEpochs()
|
|
679
|
+
this.getProofSubmissionEpochs(),
|
|
680
|
+
this.getTargetCommitteeSize(),
|
|
681
|
+
this.getManaLimit()
|
|
168
682
|
]);
|
|
169
683
|
return {
|
|
170
684
|
l1StartBlock,
|
|
171
685
|
l1GenesisTime,
|
|
172
|
-
slotDuration
|
|
686
|
+
slotDuration,
|
|
173
687
|
epochDuration: Number(epochDuration),
|
|
174
|
-
proofSubmissionEpochs: Number(proofSubmissionEpochs)
|
|
688
|
+
proofSubmissionEpochs: Number(proofSubmissionEpochs),
|
|
689
|
+
targetCommitteeSize,
|
|
690
|
+
rollupManaLimit: Number(rollupManaLimit)
|
|
175
691
|
};
|
|
176
692
|
}
|
|
177
|
-
getSlasherAddress() {
|
|
178
|
-
return this.rollup.read.getSlasher();
|
|
693
|
+
async getSlasherAddress() {
|
|
694
|
+
return EthAddress.fromString(await this.rollup.read.getSlasher());
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Returns the configured escape hatch contract address, or zero if disabled.
|
|
698
|
+
*/ async getEscapeHatchAddress() {
|
|
699
|
+
return EthAddress.fromString(await this.rollup.read.getEscapeHatch());
|
|
700
|
+
}
|
|
701
|
+
async getEscapeHatchContract() {
|
|
702
|
+
const escapeHatchAddress = await this.getEscapeHatchAddress();
|
|
703
|
+
if (escapeHatchAddress.isZero()) {
|
|
704
|
+
return undefined;
|
|
705
|
+
}
|
|
706
|
+
// Cache the viem contract wrapper since it will be used frequently.
|
|
707
|
+
if (!this.cachedEscapeHatch || !this.cachedEscapeHatch.address.equals(escapeHatchAddress)) {
|
|
708
|
+
this.cachedEscapeHatch = {
|
|
709
|
+
address: escapeHatchAddress,
|
|
710
|
+
contract: getContract({
|
|
711
|
+
address: escapeHatchAddress.toString(),
|
|
712
|
+
abi: EscapeHatchAbi,
|
|
713
|
+
client: this.client
|
|
714
|
+
})
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
return this.cachedEscapeHatch.contract;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Returns whether the escape hatch is open for the given epoch.
|
|
721
|
+
* If escape hatch is not configured, returns false.
|
|
722
|
+
*
|
|
723
|
+
* This function is intentionally defensive: any failure to query the escape hatch
|
|
724
|
+
* (RPC issues, transient errors, etc.) is treated as "closed" to avoid callers
|
|
725
|
+
* needing to sprinkle try/catch everywhere.
|
|
726
|
+
*/ async isEscapeHatchOpen(epoch) {
|
|
727
|
+
try {
|
|
728
|
+
const escapeHatch = await this.getEscapeHatchContract();
|
|
729
|
+
if (!escapeHatch) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
const [isOpen] = await escapeHatch.read.isHatchOpen([
|
|
733
|
+
BigInt(epoch)
|
|
734
|
+
]);
|
|
735
|
+
return isOpen;
|
|
736
|
+
} catch {
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
179
739
|
}
|
|
180
740
|
/**
|
|
181
741
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
182
742
|
*/ async getSlasherContract() {
|
|
183
|
-
const slasherAddress =
|
|
743
|
+
const slasherAddress = await this.getSlasherAddress();
|
|
184
744
|
if (slasherAddress.isZero()) {
|
|
185
745
|
return undefined;
|
|
186
746
|
}
|
|
187
747
|
return new SlasherContract(this.client, slasherAddress);
|
|
188
748
|
}
|
|
189
|
-
getOwner() {
|
|
190
|
-
return this.rollup.read.owner();
|
|
749
|
+
async getOwner() {
|
|
750
|
+
return EthAddress.fromString(await this.rollup.read.owner());
|
|
191
751
|
}
|
|
192
|
-
getActiveAttesterCount() {
|
|
193
|
-
return this.rollup.read.getActiveAttesterCount();
|
|
752
|
+
async getActiveAttesterCount() {
|
|
753
|
+
return Number(await this.rollup.read.getActiveAttesterCount());
|
|
194
754
|
}
|
|
195
755
|
async getSlashingProposerAddress() {
|
|
196
756
|
const slasher = await this.getSlasherContract();
|
|
@@ -199,25 +759,30 @@ export class RollupContract {
|
|
|
199
759
|
}
|
|
200
760
|
return await slasher.getProposer();
|
|
201
761
|
}
|
|
202
|
-
|
|
203
|
-
return this.rollup.read.
|
|
762
|
+
getCheckpointReward() {
|
|
763
|
+
return this.rollup.read.getCheckpointReward();
|
|
204
764
|
}
|
|
205
|
-
|
|
206
|
-
return this.rollup.read.
|
|
765
|
+
async getCheckpointNumber() {
|
|
766
|
+
return CheckpointNumber.fromBigInt(await this.rollup.read.getPendingCheckpointNumber());
|
|
207
767
|
}
|
|
208
|
-
|
|
209
|
-
|
|
768
|
+
async getProvenCheckpointNumber(options) {
|
|
769
|
+
await checkBlockTag(options?.blockNumber, this.client);
|
|
770
|
+
return CheckpointNumber.fromBigInt(await this.rollup.read.getProvenCheckpointNumber(options));
|
|
210
771
|
}
|
|
211
|
-
getSlotNumber() {
|
|
212
|
-
return this.rollup.read.getCurrentSlot();
|
|
772
|
+
async getSlotNumber() {
|
|
773
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
213
774
|
}
|
|
214
|
-
getL1FeesAt(timestamp) {
|
|
215
|
-
|
|
775
|
+
async getL1FeesAt(timestamp) {
|
|
776
|
+
const result = await this.rollup.read.getL1FeesAt([
|
|
216
777
|
timestamp
|
|
217
778
|
]);
|
|
779
|
+
return {
|
|
780
|
+
baseFee: result.baseFee,
|
|
781
|
+
blobFee: result.blobFee
|
|
782
|
+
};
|
|
218
783
|
}
|
|
219
|
-
|
|
220
|
-
return this.rollup.read.
|
|
784
|
+
getEthPerFeeAsset() {
|
|
785
|
+
return this.rollup.read.getEthPerFeeAsset();
|
|
221
786
|
}
|
|
222
787
|
async getCommitteeAt(timestamp) {
|
|
223
788
|
const { result } = await this.client.simulateContract({
|
|
@@ -235,18 +800,18 @@ export class RollupContract {
|
|
|
235
800
|
}
|
|
236
801
|
throw e;
|
|
237
802
|
});
|
|
238
|
-
return result;
|
|
803
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
239
804
|
}
|
|
240
|
-
getSampleSeedAt(timestamp) {
|
|
241
|
-
return this.rollup.read.getSampleSeedAt([
|
|
805
|
+
async getSampleSeedAt(timestamp) {
|
|
806
|
+
return Buffer32.fromBigInt(await this.rollup.read.getSampleSeedAt([
|
|
242
807
|
timestamp
|
|
243
|
-
]);
|
|
808
|
+
]));
|
|
244
809
|
}
|
|
245
|
-
getCurrentSampleSeed() {
|
|
246
|
-
return this.rollup.read.getCurrentSampleSeed();
|
|
810
|
+
async getCurrentSampleSeed() {
|
|
811
|
+
return Buffer32.fromBigInt(await this.rollup.read.getCurrentSampleSeed());
|
|
247
812
|
}
|
|
248
|
-
getCurrentEpoch() {
|
|
249
|
-
return this.rollup.read.getCurrentEpoch();
|
|
813
|
+
async getCurrentEpoch() {
|
|
814
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
250
815
|
}
|
|
251
816
|
async getCurrentEpochCommittee() {
|
|
252
817
|
const { result } = await this.client.simulateContract({
|
|
@@ -262,7 +827,7 @@ export class RollupContract {
|
|
|
262
827
|
}
|
|
263
828
|
throw e;
|
|
264
829
|
});
|
|
265
|
-
return result;
|
|
830
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
266
831
|
}
|
|
267
832
|
async getCurrentProposer() {
|
|
268
833
|
const { result } = await this.client.simulateContract({
|
|
@@ -271,7 +836,7 @@ export class RollupContract {
|
|
|
271
836
|
functionName: 'getCurrentProposer',
|
|
272
837
|
args: []
|
|
273
838
|
});
|
|
274
|
-
return result;
|
|
839
|
+
return EthAddress.fromString(result);
|
|
275
840
|
}
|
|
276
841
|
async getProposerAt(timestamp) {
|
|
277
842
|
const { result } = await this.client.simulateContract({
|
|
@@ -282,37 +847,69 @@ export class RollupContract {
|
|
|
282
847
|
timestamp
|
|
283
848
|
]
|
|
284
849
|
});
|
|
285
|
-
return result;
|
|
850
|
+
return EthAddress.fromString(result);
|
|
286
851
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
BigInt(
|
|
852
|
+
async getCheckpoint(checkpointNumber) {
|
|
853
|
+
const result = await this.rollup.read.getCheckpoint([
|
|
854
|
+
BigInt(checkpointNumber)
|
|
290
855
|
]);
|
|
856
|
+
return {
|
|
857
|
+
archive: Fr.fromString(result.archive),
|
|
858
|
+
headerHash: Buffer32.fromString(result.headerHash),
|
|
859
|
+
blobCommitmentsHash: Buffer32.fromString(result.blobCommitmentsHash),
|
|
860
|
+
attestationsHash: Buffer32.fromString(result.attestationsHash),
|
|
861
|
+
payloadDigest: Buffer32.fromString(result.payloadDigest),
|
|
862
|
+
slotNumber: SlotNumber.fromBigInt(result.slotNumber),
|
|
863
|
+
feeHeader: {
|
|
864
|
+
excessMana: result.feeHeader.excessMana,
|
|
865
|
+
manaUsed: result.feeHeader.manaUsed,
|
|
866
|
+
ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
|
|
867
|
+
congestionCost: result.feeHeader.congestionCost,
|
|
868
|
+
proverCost: result.feeHeader.proverCost
|
|
869
|
+
}
|
|
870
|
+
};
|
|
291
871
|
}
|
|
292
|
-
|
|
293
|
-
|
|
872
|
+
/** Returns the pending checkpoint from the rollup contract */ getPendingCheckpoint() {
|
|
873
|
+
// We retry because of race conditions during prunes: we may get a pending checkpoint number which is immediately
|
|
874
|
+
// reorged out due to a prune happening, causing the subsequent getCheckpoint call to fail. So we try again in that case.
|
|
875
|
+
return retry(async ()=>{
|
|
876
|
+
const pendingCheckpointNumber = await this.getCheckpointNumber();
|
|
877
|
+
const pendingCheckpoint = await this.getCheckpoint(pendingCheckpointNumber);
|
|
878
|
+
return pendingCheckpoint;
|
|
879
|
+
}, 'getting pending checkpoint', makeBackoff([
|
|
880
|
+
0.5,
|
|
881
|
+
0.5,
|
|
882
|
+
0.5
|
|
883
|
+
]));
|
|
884
|
+
}
|
|
885
|
+
async getTips() {
|
|
886
|
+
const { pending, proven } = await this.rollup.read.getTips();
|
|
887
|
+
return {
|
|
888
|
+
pending: CheckpointNumber.fromBigInt(pending),
|
|
889
|
+
proven: CheckpointNumber.fromBigInt(proven)
|
|
890
|
+
};
|
|
294
891
|
}
|
|
295
892
|
getTimestampForSlot(slot) {
|
|
296
893
|
return this.rollup.read.getTimestampForSlot([
|
|
297
|
-
slot
|
|
894
|
+
BigInt(slot)
|
|
298
895
|
]);
|
|
299
896
|
}
|
|
300
|
-
getEntryQueueLength() {
|
|
301
|
-
return this.rollup.read.getEntryQueueLength();
|
|
897
|
+
async getEntryQueueLength() {
|
|
898
|
+
return Number(await this.rollup.read.getEntryQueueLength());
|
|
302
899
|
}
|
|
303
|
-
getAvailableValidatorFlushes() {
|
|
304
|
-
return this.rollup.read.getAvailableValidatorFlushes();
|
|
900
|
+
async getAvailableValidatorFlushes() {
|
|
901
|
+
return Number(await this.rollup.read.getAvailableValidatorFlushes());
|
|
305
902
|
}
|
|
306
|
-
getNextFlushableEpoch() {
|
|
307
|
-
return this.rollup.read.getNextFlushableEpoch();
|
|
903
|
+
async getNextFlushableEpoch() {
|
|
904
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getNextFlushableEpoch());
|
|
308
905
|
}
|
|
309
|
-
getCurrentEpochNumber() {
|
|
310
|
-
return this.rollup.read.getCurrentEpoch();
|
|
906
|
+
async getCurrentEpochNumber() {
|
|
907
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
311
908
|
}
|
|
312
|
-
|
|
313
|
-
return this.rollup.read.
|
|
314
|
-
BigInt(
|
|
315
|
-
]);
|
|
909
|
+
async getEpochNumberForCheckpoint(checkpointNumber) {
|
|
910
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getEpochForCheckpoint([
|
|
911
|
+
BigInt(checkpointNumber)
|
|
912
|
+
]));
|
|
316
913
|
}
|
|
317
914
|
async getRollupAddresses() {
|
|
318
915
|
const [inboxAddress, outboxAddress, feeJuicePortalAddress, rewardDistributorAddress, feeJuiceAddress, stakingAssetAddress, gseAddress] = (await Promise.all([
|
|
@@ -339,12 +936,13 @@ export class RollupContract {
|
|
|
339
936
|
return EthAddress.fromString(await this.rollup.read.getFeeAssetPortal());
|
|
340
937
|
}
|
|
341
938
|
async getEpochNumberForSlotNumber(slotNumber) {
|
|
342
|
-
return await this.rollup.read.getEpochAtSlot([
|
|
343
|
-
slotNumber
|
|
344
|
-
]);
|
|
939
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([
|
|
940
|
+
BigInt(slotNumber)
|
|
941
|
+
]));
|
|
345
942
|
}
|
|
346
|
-
getEpochProofPublicInputs(args) {
|
|
347
|
-
|
|
943
|
+
async getEpochProofPublicInputs(args) {
|
|
944
|
+
const result = await this.rollup.read.getEpochProofPublicInputs(args);
|
|
945
|
+
return result.map(Fr.fromString);
|
|
348
946
|
}
|
|
349
947
|
async validateHeader(args, account) {
|
|
350
948
|
try {
|
|
@@ -365,17 +963,15 @@ export class RollupContract {
|
|
|
365
963
|
* @dev Throws if unable to propose
|
|
366
964
|
*
|
|
367
965
|
* @param archive - The archive that we expect to be current state
|
|
368
|
-
* @return [slot,
|
|
966
|
+
* @return [slot, checkpointNumber, timeOfNextL1Slot] - If you can propose, the L2 slot number, checkpoint number and
|
|
967
|
+
* timestamp of the next L1 block
|
|
369
968
|
* @throws otherwise
|
|
370
|
-
*/ async
|
|
371
|
-
if (typeof slotDuration === 'number') {
|
|
372
|
-
slotDuration = BigInt(slotDuration);
|
|
373
|
-
}
|
|
969
|
+
*/ async canProposeAt(archive, account, slotDuration, slotOffset, opts = {}) {
|
|
374
970
|
const latestBlock = await this.client.getBlock();
|
|
375
|
-
const timeOfNextL1Slot = latestBlock.timestamp + slotDuration;
|
|
971
|
+
const timeOfNextL1Slot = latestBlock.timestamp + slotDuration + slotOffset;
|
|
376
972
|
const who = typeof account === 'string' ? account : account.address;
|
|
377
973
|
try {
|
|
378
|
-
const { result: [slot,
|
|
974
|
+
const { result: [slot, checkpointNumber] } = await this.client.simulateContract({
|
|
379
975
|
address: this.address,
|
|
380
976
|
abi: RollupAbi,
|
|
381
977
|
functionName: 'canProposeAtTime',
|
|
@@ -385,11 +981,11 @@ export class RollupContract {
|
|
|
385
981
|
who
|
|
386
982
|
],
|
|
387
983
|
account,
|
|
388
|
-
stateOverride: await this.
|
|
984
|
+
stateOverride: await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber)
|
|
389
985
|
});
|
|
390
986
|
return {
|
|
391
|
-
slot,
|
|
392
|
-
|
|
987
|
+
slot: SlotNumber.fromBigInt(slot),
|
|
988
|
+
checkpointNumber: CheckpointNumber.fromBigInt(checkpointNumber),
|
|
393
989
|
timeOfNextL1Slot
|
|
394
990
|
};
|
|
395
991
|
} catch (err) {
|
|
@@ -397,11 +993,11 @@ export class RollupContract {
|
|
|
397
993
|
}
|
|
398
994
|
}
|
|
399
995
|
/**
|
|
400
|
-
* Returns a state override that sets the pending
|
|
401
|
-
* Requires querying the current state of the contract to get the current proven
|
|
996
|
+
* Returns a state override that sets the pending checkpoint number to the specified value. Useful for simulations.
|
|
997
|
+
* Requires querying the current state of the contract to get the current proven checkpoint number, as they are both
|
|
402
998
|
* stored in the same slot. If the argument is undefined, it returns an empty override.
|
|
403
|
-
*/ async
|
|
404
|
-
if (
|
|
999
|
+
*/ async makePendingCheckpointNumberOverride(forcePendingCheckpointNumber) {
|
|
1000
|
+
if (forcePendingCheckpointNumber === undefined) {
|
|
405
1001
|
return [];
|
|
406
1002
|
}
|
|
407
1003
|
const slot = RollupContract.stfStorageSlot;
|
|
@@ -409,8 +1005,8 @@ export class RollupContract {
|
|
|
409
1005
|
address: this.address,
|
|
410
1006
|
slot
|
|
411
1007
|
});
|
|
412
|
-
const
|
|
413
|
-
const newValue = BigInt(
|
|
1008
|
+
const currentProvenCheckpointNumber = currentValue ? hexToBigInt(currentValue) & (1n << 128n) - 1n : 0n;
|
|
1009
|
+
const newValue = BigInt(forcePendingCheckpointNumber) << 128n | currentProvenCheckpointNumber;
|
|
414
1010
|
return [
|
|
415
1011
|
{
|
|
416
1012
|
address: this.address,
|
|
@@ -423,14 +1019,15 @@ export class RollupContract {
|
|
|
423
1019
|
}
|
|
424
1020
|
];
|
|
425
1021
|
}
|
|
426
|
-
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(
|
|
1022
|
+
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(checkpointNumber, attestationsAndSigners, committee, invalidIndex) {
|
|
427
1023
|
return {
|
|
428
1024
|
to: this.address,
|
|
1025
|
+
abi: RollupAbi,
|
|
429
1026
|
data: encodeFunctionData({
|
|
430
1027
|
abi: RollupAbi,
|
|
431
1028
|
functionName: 'invalidateBadAttestation',
|
|
432
1029
|
args: [
|
|
433
|
-
BigInt(
|
|
1030
|
+
BigInt(checkpointNumber),
|
|
434
1031
|
attestationsAndSigners,
|
|
435
1032
|
committee.map((addr)=>addr.toString()),
|
|
436
1033
|
BigInt(invalidIndex)
|
|
@@ -438,46 +1035,66 @@ export class RollupContract {
|
|
|
438
1035
|
})
|
|
439
1036
|
};
|
|
440
1037
|
}
|
|
441
|
-
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(
|
|
1038
|
+
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(checkpointNumber, attestationsAndSigners, committee) {
|
|
442
1039
|
return {
|
|
443
1040
|
to: this.address,
|
|
1041
|
+
abi: RollupAbi,
|
|
444
1042
|
data: encodeFunctionData({
|
|
445
1043
|
abi: RollupAbi,
|
|
446
1044
|
functionName: 'invalidateInsufficientAttestations',
|
|
447
1045
|
args: [
|
|
448
|
-
BigInt(
|
|
1046
|
+
BigInt(checkpointNumber),
|
|
449
1047
|
attestationsAndSigners,
|
|
450
1048
|
committee.map((addr)=>addr.toString())
|
|
451
1049
|
]
|
|
452
1050
|
})
|
|
453
1051
|
};
|
|
454
1052
|
}
|
|
455
|
-
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */ getHasSubmittedProof(epochNumber,
|
|
1053
|
+
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */ getHasSubmittedProof(epochNumber, numberOfCheckpointsInEpoch, prover) {
|
|
456
1054
|
if (prover instanceof EthAddress) {
|
|
457
1055
|
prover = prover.toString();
|
|
458
1056
|
}
|
|
459
1057
|
return this.rollup.read.getHasSubmitted([
|
|
460
1058
|
BigInt(epochNumber),
|
|
461
|
-
BigInt(
|
|
1059
|
+
BigInt(numberOfCheckpointsInEpoch),
|
|
462
1060
|
prover
|
|
463
1061
|
]);
|
|
464
1062
|
}
|
|
465
|
-
|
|
466
|
-
return this.rollup.read.
|
|
1063
|
+
getManaMinFeeAt(timestamp, inFeeAsset) {
|
|
1064
|
+
return this.rollup.read.getManaMinFeeAt([
|
|
467
1065
|
timestamp,
|
|
468
1066
|
inFeeAsset
|
|
469
1067
|
]);
|
|
470
1068
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
timestamp
|
|
1069
|
+
async getManaMinFeeComponentsAt(timestamp, inFeeAsset) {
|
|
1070
|
+
const result = await this.rollup.read.getManaMinFeeComponentsAt([
|
|
1071
|
+
timestamp,
|
|
1072
|
+
inFeeAsset
|
|
474
1073
|
]);
|
|
1074
|
+
return {
|
|
1075
|
+
sequencerCost: result.sequencerCost,
|
|
1076
|
+
proverCost: result.proverCost,
|
|
1077
|
+
congestionCost: result.congestionCost,
|
|
1078
|
+
congestionMultiplier: result.congestionMultiplier
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
async getSlotAt(timestamp) {
|
|
1082
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([
|
|
1083
|
+
timestamp
|
|
1084
|
+
]));
|
|
475
1085
|
}
|
|
476
|
-
async status(
|
|
1086
|
+
async status(checkpointNumber, options) {
|
|
477
1087
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
478
|
-
|
|
479
|
-
|
|
1088
|
+
const result = await this.rollup.read.status([
|
|
1089
|
+
BigInt(checkpointNumber)
|
|
480
1090
|
], options);
|
|
1091
|
+
return {
|
|
1092
|
+
provenCheckpointNumber: CheckpointNumber.fromBigInt(result[0]),
|
|
1093
|
+
provenArchive: Fr.fromString(result[1]),
|
|
1094
|
+
pendingCheckpointNumber: CheckpointNumber.fromBigInt(result[2]),
|
|
1095
|
+
pendingArchive: Fr.fromString(result[3]),
|
|
1096
|
+
archiveOfMyCheckpoint: Fr.fromString(result[4])
|
|
1097
|
+
};
|
|
481
1098
|
}
|
|
482
1099
|
async canPruneAtTime(timestamp, options) {
|
|
483
1100
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
@@ -485,13 +1102,13 @@ export class RollupContract {
|
|
|
485
1102
|
timestamp
|
|
486
1103
|
], options);
|
|
487
1104
|
}
|
|
488
|
-
archive() {
|
|
489
|
-
return this.rollup.read.archive();
|
|
1105
|
+
async archive() {
|
|
1106
|
+
return Fr.fromString(await this.rollup.read.archive());
|
|
490
1107
|
}
|
|
491
|
-
archiveAt(
|
|
492
|
-
return this.rollup.read.archiveAt([
|
|
493
|
-
|
|
494
|
-
]);
|
|
1108
|
+
async archiveAt(checkpointNumber) {
|
|
1109
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
1110
|
+
BigInt(checkpointNumber)
|
|
1111
|
+
]));
|
|
495
1112
|
}
|
|
496
1113
|
getSequencerRewards(address) {
|
|
497
1114
|
if (address instanceof EthAddress) {
|
|
@@ -515,44 +1132,71 @@ export class RollupContract {
|
|
|
515
1132
|
const gse = new GSEContract(this.client, await this.getGSE());
|
|
516
1133
|
const ts = (await this.client.getBlock()).timestamp;
|
|
517
1134
|
const indices = Array.from({
|
|
518
|
-
length:
|
|
1135
|
+
length: attesterSize
|
|
519
1136
|
}, (_, i)=>BigInt(i));
|
|
520
1137
|
const chunks = chunk(indices, 1000);
|
|
521
|
-
|
|
1138
|
+
const results = await Promise.all(chunks.map((chunk)=>gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)));
|
|
1139
|
+
return results.flat().map((addr)=>EthAddress.fromString(addr));
|
|
522
1140
|
}
|
|
523
|
-
getAttesterView(address) {
|
|
1141
|
+
async getAttesterView(address) {
|
|
524
1142
|
if (address instanceof EthAddress) {
|
|
525
1143
|
address = address.toString();
|
|
526
1144
|
}
|
|
527
|
-
|
|
1145
|
+
const result = await this.rollup.read.getAttesterView([
|
|
528
1146
|
address
|
|
529
1147
|
]);
|
|
1148
|
+
return {
|
|
1149
|
+
status: result.status,
|
|
1150
|
+
effectiveBalance: result.effectiveBalance,
|
|
1151
|
+
exit: {
|
|
1152
|
+
withdrawalId: result.exit.withdrawalId,
|
|
1153
|
+
amount: result.exit.amount,
|
|
1154
|
+
exitableAt: result.exit.exitableAt,
|
|
1155
|
+
recipientOrWithdrawer: EthAddress.fromString(result.exit.recipientOrWithdrawer),
|
|
1156
|
+
isRecipient: result.exit.isRecipient,
|
|
1157
|
+
exists: result.exit.exists
|
|
1158
|
+
},
|
|
1159
|
+
config: {
|
|
1160
|
+
publicKey: {
|
|
1161
|
+
x: result.config.publicKey.x,
|
|
1162
|
+
y: result.config.publicKey.y
|
|
1163
|
+
},
|
|
1164
|
+
withdrawer: EthAddress.fromString(result.config.withdrawer)
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
530
1167
|
}
|
|
531
|
-
getStatus(address) {
|
|
1168
|
+
async getStatus(address) {
|
|
532
1169
|
if (address instanceof EthAddress) {
|
|
533
1170
|
address = address.toString();
|
|
534
1171
|
}
|
|
535
|
-
return this.rollup.read.getStatus([
|
|
1172
|
+
return await this.rollup.read.getStatus([
|
|
536
1173
|
address
|
|
537
1174
|
]);
|
|
538
1175
|
}
|
|
539
|
-
getBlobCommitmentsHash(
|
|
540
|
-
return this.rollup.read.getBlobCommitmentsHash([
|
|
541
|
-
|
|
542
|
-
]);
|
|
1176
|
+
async getBlobCommitmentsHash(checkpointNumber) {
|
|
1177
|
+
return Buffer32.fromString(await this.rollup.read.getBlobCommitmentsHash([
|
|
1178
|
+
BigInt(checkpointNumber)
|
|
1179
|
+
]));
|
|
543
1180
|
}
|
|
544
|
-
getCurrentBlobCommitmentsHash() {
|
|
545
|
-
return this.rollup.read.getCurrentBlobCommitmentsHash();
|
|
1181
|
+
async getCurrentBlobCommitmentsHash() {
|
|
1182
|
+
return Buffer32.fromString(await this.rollup.read.getCurrentBlobCommitmentsHash());
|
|
546
1183
|
}
|
|
547
|
-
getStakingAsset() {
|
|
548
|
-
return this.rollup.read.getStakingAsset();
|
|
1184
|
+
async getStakingAsset() {
|
|
1185
|
+
return EthAddress.fromString(await this.rollup.read.getStakingAsset());
|
|
549
1186
|
}
|
|
550
|
-
getRewardConfig() {
|
|
551
|
-
|
|
1187
|
+
async getRewardConfig() {
|
|
1188
|
+
const result = await this.rollup.read.getRewardConfig();
|
|
1189
|
+
return {
|
|
1190
|
+
rewardDistributor: EthAddress.fromString(result.rewardDistributor),
|
|
1191
|
+
sequencerBps: BigInt(result.sequencerBps),
|
|
1192
|
+
booster: EthAddress.fromString(result.booster),
|
|
1193
|
+
checkpointReward: result.checkpointReward
|
|
1194
|
+
};
|
|
552
1195
|
}
|
|
553
1196
|
setupEpoch(l1TxUtils) {
|
|
554
1197
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
555
1198
|
to: this.address,
|
|
1199
|
+
abi: RollupAbi,
|
|
556
1200
|
data: encodeFunctionData({
|
|
557
1201
|
abi: RollupAbi,
|
|
558
1202
|
functionName: 'setupEpoch',
|
|
@@ -563,6 +1207,7 @@ export class RollupContract {
|
|
|
563
1207
|
vote(l1TxUtils, proposalId) {
|
|
564
1208
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
565
1209
|
to: this.address,
|
|
1210
|
+
abi: RollupAbi,
|
|
566
1211
|
data: encodeFunctionData({
|
|
567
1212
|
abi: RollupAbi,
|
|
568
1213
|
functionName: 'vote',
|
|
@@ -584,14 +1229,14 @@ export class RollupContract {
|
|
|
584
1229
|
}
|
|
585
1230
|
});
|
|
586
1231
|
}
|
|
587
|
-
|
|
588
|
-
return this.rollup.watchEvent.
|
|
1232
|
+
listenToCheckpointInvalidated(callback) {
|
|
1233
|
+
return this.rollup.watchEvent.CheckpointInvalidated({}, {
|
|
589
1234
|
onLogs: (logs)=>{
|
|
590
1235
|
for (const log of logs){
|
|
591
1236
|
const args = log.args;
|
|
592
|
-
if (args.
|
|
1237
|
+
if (args.checkpointNumber !== undefined) {
|
|
593
1238
|
callback({
|
|
594
|
-
|
|
1239
|
+
checkpointNumber: CheckpointNumber.fromBigInt(args.checkpointNumber)
|
|
595
1240
|
});
|
|
596
1241
|
}
|
|
597
1242
|
}
|
|
@@ -622,58 +1267,32 @@ export class RollupContract {
|
|
|
622
1267
|
}
|
|
623
1268
|
});
|
|
624
1269
|
}
|
|
1270
|
+
/** Fetches CheckpointProposed events within the given block range. */ async getCheckpointProposedEvents(fromBlock, toBlock) {
|
|
1271
|
+
const logs = await this.rollup.getEvents.CheckpointProposed({}, {
|
|
1272
|
+
fromBlock,
|
|
1273
|
+
toBlock
|
|
1274
|
+
});
|
|
1275
|
+
return logs.filter((log)=>log.blockNumber >= fromBlock && log.blockNumber <= toBlock).map((log)=>({
|
|
1276
|
+
l1BlockNumber: log.blockNumber,
|
|
1277
|
+
l1BlockHash: Buffer32.fromString(log.blockHash),
|
|
1278
|
+
l1TransactionHash: log.transactionHash,
|
|
1279
|
+
args: {
|
|
1280
|
+
checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber),
|
|
1281
|
+
archive: Fr.fromString(log.args.archive),
|
|
1282
|
+
versionedBlobHashes: log.args.versionedBlobHashes.map((h)=>Buffer.from(h.slice(2), 'hex')),
|
|
1283
|
+
attestationsHash: (()=>{
|
|
1284
|
+
if (!log.args.attestationsHash) {
|
|
1285
|
+
throw new Error(`CheckpointProposed event missing attestationsHash for checkpoint ${log.args.checkpointNumber}`);
|
|
1286
|
+
}
|
|
1287
|
+
return Buffer32.fromString(log.args.attestationsHash);
|
|
1288
|
+
})(),
|
|
1289
|
+
payloadDigest: (()=>{
|
|
1290
|
+
if (!log.args.payloadDigest) {
|
|
1291
|
+
throw new Error(`CheckpointProposed event missing payloadDigest for checkpoint ${log.args.checkpointNumber}`);
|
|
1292
|
+
}
|
|
1293
|
+
return Buffer32.fromString(log.args.payloadDigest);
|
|
1294
|
+
})()
|
|
1295
|
+
}
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
625
1298
|
}
|
|
626
|
-
_ts_decorate([
|
|
627
|
-
memoize
|
|
628
|
-
], RollupContract.prototype, "getL1StartBlock", null);
|
|
629
|
-
_ts_decorate([
|
|
630
|
-
memoize
|
|
631
|
-
], RollupContract.prototype, "getL1GenesisTime", null);
|
|
632
|
-
_ts_decorate([
|
|
633
|
-
memoize
|
|
634
|
-
], RollupContract.prototype, "getProofSubmissionEpochs", null);
|
|
635
|
-
_ts_decorate([
|
|
636
|
-
memoize
|
|
637
|
-
], RollupContract.prototype, "getEpochDuration", null);
|
|
638
|
-
_ts_decorate([
|
|
639
|
-
memoize
|
|
640
|
-
], RollupContract.prototype, "getSlotDuration", null);
|
|
641
|
-
_ts_decorate([
|
|
642
|
-
memoize
|
|
643
|
-
], RollupContract.prototype, "getTargetCommitteeSize", null);
|
|
644
|
-
_ts_decorate([
|
|
645
|
-
memoize
|
|
646
|
-
], RollupContract.prototype, "getEjectionThreshold", null);
|
|
647
|
-
_ts_decorate([
|
|
648
|
-
memoize
|
|
649
|
-
], RollupContract.prototype, "getLocalEjectionThreshold", null);
|
|
650
|
-
_ts_decorate([
|
|
651
|
-
memoize
|
|
652
|
-
], RollupContract.prototype, "getLagInEpochs", null);
|
|
653
|
-
_ts_decorate([
|
|
654
|
-
memoize
|
|
655
|
-
], RollupContract.prototype, "getActivationThreshold", null);
|
|
656
|
-
_ts_decorate([
|
|
657
|
-
memoize
|
|
658
|
-
], RollupContract.prototype, "getExitDelay", null);
|
|
659
|
-
_ts_decorate([
|
|
660
|
-
memoize
|
|
661
|
-
], RollupContract.prototype, "getManaTarget", null);
|
|
662
|
-
_ts_decorate([
|
|
663
|
-
memoize
|
|
664
|
-
], RollupContract.prototype, "getProvingCostPerMana", null);
|
|
665
|
-
_ts_decorate([
|
|
666
|
-
memoize
|
|
667
|
-
], RollupContract.prototype, "getProvingCostPerManaInFeeAsset", null);
|
|
668
|
-
_ts_decorate([
|
|
669
|
-
memoize
|
|
670
|
-
], RollupContract.prototype, "getManaLimit", null);
|
|
671
|
-
_ts_decorate([
|
|
672
|
-
memoize
|
|
673
|
-
], RollupContract.prototype, "getVersion", null);
|
|
674
|
-
_ts_decorate([
|
|
675
|
-
memoize
|
|
676
|
-
], RollupContract.prototype, "getGenesisArchiveTreeRoot", null);
|
|
677
|
-
_ts_decorate([
|
|
678
|
-
memoize
|
|
679
|
-
], RollupContract.prototype, "getRollupConstants", null);
|