@aztec/ethereum 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config.d.ts +15 -28
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +50 -57
- package/dest/contracts/empire_base.d.ts +3 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +3 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +22 -15
- 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/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +14 -4
- package/dest/contracts/governance_proposer.d.ts +3 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +395 -9
- package/dest/contracts/inbox.d.ts +18 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +32 -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 +1 -1
- 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/rollup.d.ts +161 -96
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +677 -132
- package/dest/contracts/tally_slashing_proposer.d.ts +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +8 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +16 -4
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +110 -33
- package/dest/deploy_l1_contract.js +3 -3
- 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 +5877 -1515
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.d.ts +7 -1
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +14 -1
- package/dest/l1_tx_utils/constants.d.ts +1 -1
- package/dest/l1_tx_utils/constants.js +2 -2
- package/dest/l1_tx_utils/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 +3 -2
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/index.js +2 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +2 -12
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +36 -18
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +2 -11
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +37 -19
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +14 -27
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/types.js +0 -21
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +15 -15
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +9 -15
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -3
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/index-blobs.js +2 -2
- package/dest/l1_tx_utils/index.d.ts +2 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +2 -2
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.js +3 -3
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +15 -5
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +47 -13
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -5
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +17 -54
- 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 +62 -34
- 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 +6 -3
- package/dest/test/chain_monitor.js +1 -2
- package/dest/test/eth_cheat_codes.d.ts +13 -1
- package/dest/test/eth_cheat_codes.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 +5 -2
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +19 -2
- package/dest/test/start_anvil.js +1 -1
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/utils.d.ts +2 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +46 -0
- package/package.json +8 -7
- package/src/config.ts +58 -56
- package/src/contracts/README.md +157 -0
- package/src/contracts/empire_base.ts +2 -0
- package/src/contracts/empire_slashing_proposer.ts +22 -27
- 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 +10 -1
- package/src/contracts/inbox.ts +48 -1
- 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/rollup.ts +348 -100
- package/src/contracts/tally_slashing_proposer.ts +5 -1
- package/src/deploy_aztec_l1_contracts.ts +135 -42
- package/src/deploy_l1_contract.ts +3 -3
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_tx_utils/config.ts +20 -0
- package/src/l1_tx_utils/constants.ts +2 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +1 -1
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +46 -42
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +49 -45
- package/src/l1_tx_utils/fee-strategies/types.ts +14 -46
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +43 -54
- package/src/l1_tx_utils/index-blobs.ts +2 -2
- package/src/l1_tx_utils/index.ts +1 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +2 -3
- package/src/l1_tx_utils/l1_tx_utils.ts +52 -17
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +23 -62
- package/src/{test → l1_tx_utils}/tx_delayer.ts +78 -50
- package/src/publisher_manager.ts +4 -2
- package/src/queries.ts +5 -3
- package/src/test/chain_monitor.ts +1 -1
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +21 -3
- package/src/test/start_anvil.ts +1 -1
- package/src/test/upgrade_utils.ts +2 -2
- package/src/utils.ts +53 -0
- 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/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,13 +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;
|
|
7
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';
|
|
8
377
|
import { memoize } from '@aztec/foundation/decorators';
|
|
9
378
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
379
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
380
|
+
import { EscapeHatchAbi } from '@aztec/l1-artifacts/EscapeHatchAbi';
|
|
11
381
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
12
382
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
13
383
|
import chunk from 'lodash.chunk';
|
|
@@ -25,10 +395,120 @@ export var SlashingProposerType = /*#__PURE__*/ function(SlashingProposerType) {
|
|
|
25
395
|
SlashingProposerType[SlashingProposerType["Empire"] = 2] = "Empire";
|
|
26
396
|
return SlashingProposerType;
|
|
27
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
|
+
}({});
|
|
28
408
|
export class RollupContract {
|
|
29
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
|
+
"getRollupConstants"
|
|
506
|
+
]
|
|
507
|
+
], []));
|
|
508
|
+
}
|
|
30
509
|
rollup;
|
|
31
510
|
static cachedStfStorageSlot;
|
|
511
|
+
cachedEscapeHatch;
|
|
32
512
|
static get checkBlobStorageSlot() {
|
|
33
513
|
const asString = RollupStorage.find((storage)=>storage.label === 'checkBlob')?.slot;
|
|
34
514
|
if (asString === undefined) {
|
|
@@ -50,6 +530,7 @@ export class RollupContract {
|
|
|
50
530
|
}
|
|
51
531
|
constructor(client, address){
|
|
52
532
|
this.client = client;
|
|
533
|
+
_initProto(this);
|
|
53
534
|
if (address instanceof EthAddress) {
|
|
54
535
|
address = address.toString();
|
|
55
536
|
}
|
|
@@ -59,8 +540,8 @@ export class RollupContract {
|
|
|
59
540
|
client
|
|
60
541
|
});
|
|
61
542
|
}
|
|
62
|
-
getGSE() {
|
|
63
|
-
return this.rollup.read.getGSE();
|
|
543
|
+
async getGSE() {
|
|
544
|
+
return EthAddress.fromString(await this.rollup.read.getGSE());
|
|
64
545
|
}
|
|
65
546
|
get address() {
|
|
66
547
|
return this.rollup.address;
|
|
@@ -109,17 +590,17 @@ export class RollupContract {
|
|
|
109
590
|
getL1GenesisTime() {
|
|
110
591
|
return this.rollup.read.getGenesisTime();
|
|
111
592
|
}
|
|
112
|
-
getProofSubmissionEpochs() {
|
|
113
|
-
return this.rollup.read.getProofSubmissionEpochs();
|
|
593
|
+
async getProofSubmissionEpochs() {
|
|
594
|
+
return Number(await this.rollup.read.getProofSubmissionEpochs());
|
|
114
595
|
}
|
|
115
|
-
getEpochDuration() {
|
|
116
|
-
return this.rollup.read.getEpochDuration();
|
|
596
|
+
async getEpochDuration() {
|
|
597
|
+
return Number(await this.rollup.read.getEpochDuration());
|
|
117
598
|
}
|
|
118
599
|
async getSlotDuration() {
|
|
119
600
|
return Number(await this.rollup.read.getSlotDuration());
|
|
120
601
|
}
|
|
121
|
-
getTargetCommitteeSize() {
|
|
122
|
-
return this.rollup.read.getTargetCommitteeSize();
|
|
602
|
+
async getTargetCommitteeSize() {
|
|
603
|
+
return Number(await this.rollup.read.getTargetCommitteeSize());
|
|
123
604
|
}
|
|
124
605
|
getEjectionThreshold() {
|
|
125
606
|
return this.rollup.read.getEjectionThreshold();
|
|
@@ -127,17 +608,17 @@ export class RollupContract {
|
|
|
127
608
|
getLocalEjectionThreshold() {
|
|
128
609
|
return this.rollup.read.getLocalEjectionThreshold();
|
|
129
610
|
}
|
|
130
|
-
getLagInEpochsForValidatorSet() {
|
|
131
|
-
return this.rollup.read.getLagInEpochsForValidatorSet();
|
|
611
|
+
async getLagInEpochsForValidatorSet() {
|
|
612
|
+
return Number(await this.rollup.read.getLagInEpochsForValidatorSet());
|
|
132
613
|
}
|
|
133
|
-
getLagInEpochsForRandao() {
|
|
134
|
-
return this.rollup.read.getLagInEpochsForRandao();
|
|
614
|
+
async getLagInEpochsForRandao() {
|
|
615
|
+
return Number(await this.rollup.read.getLagInEpochsForRandao());
|
|
135
616
|
}
|
|
136
617
|
getActivationThreshold() {
|
|
137
618
|
return this.rollup.read.getActivationThreshold();
|
|
138
619
|
}
|
|
139
|
-
getExitDelay() {
|
|
140
|
-
return this.rollup.read.getExitDelay();
|
|
620
|
+
async getExitDelay() {
|
|
621
|
+
return Number(await this.rollup.read.getExitDelay());
|
|
141
622
|
}
|
|
142
623
|
getManaTarget() {
|
|
143
624
|
return this.rollup.read.getManaTarget();
|
|
@@ -155,47 +636,93 @@ export class RollupContract {
|
|
|
155
636
|
return this.rollup.read.getVersion();
|
|
156
637
|
}
|
|
157
638
|
async getGenesisArchiveTreeRoot() {
|
|
158
|
-
return await this.rollup.read.archiveAt([
|
|
639
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
159
640
|
0n
|
|
160
|
-
]);
|
|
641
|
+
]));
|
|
161
642
|
}
|
|
162
643
|
/**
|
|
163
644
|
* Returns rollup constants used for epoch queries.
|
|
164
645
|
* Return type is `L1RollupConstants` which is defined in stdlib,
|
|
165
646
|
* so we cant reference it until we move this contract to that package.
|
|
166
647
|
*/ async getRollupConstants() {
|
|
167
|
-
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs] = await Promise.all([
|
|
648
|
+
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs, targetCommitteeSize] = await Promise.all([
|
|
168
649
|
this.getL1StartBlock(),
|
|
169
650
|
this.getL1GenesisTime(),
|
|
170
651
|
this.getSlotDuration(),
|
|
171
652
|
this.getEpochDuration(),
|
|
172
|
-
this.getProofSubmissionEpochs()
|
|
653
|
+
this.getProofSubmissionEpochs(),
|
|
654
|
+
this.getTargetCommitteeSize()
|
|
173
655
|
]);
|
|
174
656
|
return {
|
|
175
657
|
l1StartBlock,
|
|
176
658
|
l1GenesisTime,
|
|
177
659
|
slotDuration,
|
|
178
660
|
epochDuration: Number(epochDuration),
|
|
179
|
-
proofSubmissionEpochs: Number(proofSubmissionEpochs)
|
|
661
|
+
proofSubmissionEpochs: Number(proofSubmissionEpochs),
|
|
662
|
+
targetCommitteeSize
|
|
180
663
|
};
|
|
181
664
|
}
|
|
182
|
-
getSlasherAddress() {
|
|
183
|
-
return this.rollup.read.getSlasher();
|
|
665
|
+
async getSlasherAddress() {
|
|
666
|
+
return EthAddress.fromString(await this.rollup.read.getSlasher());
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Returns the configured escape hatch contract address, or zero if disabled.
|
|
670
|
+
*/ async getEscapeHatchAddress() {
|
|
671
|
+
return EthAddress.fromString(await this.rollup.read.getEscapeHatch());
|
|
672
|
+
}
|
|
673
|
+
async getEscapeHatchContract() {
|
|
674
|
+
const escapeHatchAddress = await this.getEscapeHatchAddress();
|
|
675
|
+
if (escapeHatchAddress.isZero()) {
|
|
676
|
+
return undefined;
|
|
677
|
+
}
|
|
678
|
+
// Cache the viem contract wrapper since it will be used frequently.
|
|
679
|
+
if (!this.cachedEscapeHatch || !this.cachedEscapeHatch.address.equals(escapeHatchAddress)) {
|
|
680
|
+
this.cachedEscapeHatch = {
|
|
681
|
+
address: escapeHatchAddress,
|
|
682
|
+
contract: getContract({
|
|
683
|
+
address: escapeHatchAddress.toString(),
|
|
684
|
+
abi: EscapeHatchAbi,
|
|
685
|
+
client: this.client
|
|
686
|
+
})
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
return this.cachedEscapeHatch.contract;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Returns whether the escape hatch is open for the given epoch.
|
|
693
|
+
* If escape hatch is not configured, returns false.
|
|
694
|
+
*
|
|
695
|
+
* This function is intentionally defensive: any failure to query the escape hatch
|
|
696
|
+
* (RPC issues, transient errors, etc.) is treated as "closed" to avoid callers
|
|
697
|
+
* needing to sprinkle try/catch everywhere.
|
|
698
|
+
*/ async isEscapeHatchOpen(epoch) {
|
|
699
|
+
try {
|
|
700
|
+
const escapeHatch = await this.getEscapeHatchContract();
|
|
701
|
+
if (!escapeHatch) {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
const [isOpen] = await escapeHatch.read.isHatchOpen([
|
|
705
|
+
BigInt(epoch)
|
|
706
|
+
]);
|
|
707
|
+
return isOpen;
|
|
708
|
+
} catch {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
184
711
|
}
|
|
185
712
|
/**
|
|
186
713
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
187
714
|
*/ async getSlasherContract() {
|
|
188
|
-
const slasherAddress =
|
|
715
|
+
const slasherAddress = await this.getSlasherAddress();
|
|
189
716
|
if (slasherAddress.isZero()) {
|
|
190
717
|
return undefined;
|
|
191
718
|
}
|
|
192
719
|
return new SlasherContract(this.client, slasherAddress);
|
|
193
720
|
}
|
|
194
|
-
getOwner() {
|
|
195
|
-
return this.rollup.read.owner();
|
|
721
|
+
async getOwner() {
|
|
722
|
+
return EthAddress.fromString(await this.rollup.read.owner());
|
|
196
723
|
}
|
|
197
|
-
getActiveAttesterCount() {
|
|
198
|
-
return this.rollup.read.getActiveAttesterCount();
|
|
724
|
+
async getActiveAttesterCount() {
|
|
725
|
+
return Number(await this.rollup.read.getActiveAttesterCount());
|
|
199
726
|
}
|
|
200
727
|
async getSlashingProposerAddress() {
|
|
201
728
|
const slasher = await this.getSlasherContract();
|
|
@@ -216,13 +743,17 @@ export class RollupContract {
|
|
|
216
743
|
async getSlotNumber() {
|
|
217
744
|
return SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
218
745
|
}
|
|
219
|
-
getL1FeesAt(timestamp) {
|
|
220
|
-
|
|
746
|
+
async getL1FeesAt(timestamp) {
|
|
747
|
+
const result = await this.rollup.read.getL1FeesAt([
|
|
221
748
|
timestamp
|
|
222
749
|
]);
|
|
750
|
+
return {
|
|
751
|
+
baseFee: result.baseFee,
|
|
752
|
+
blobFee: result.blobFee
|
|
753
|
+
};
|
|
223
754
|
}
|
|
224
|
-
|
|
225
|
-
return this.rollup.read.
|
|
755
|
+
getEthPerFeeAsset() {
|
|
756
|
+
return this.rollup.read.getEthPerFeeAsset();
|
|
226
757
|
}
|
|
227
758
|
async getCommitteeAt(timestamp) {
|
|
228
759
|
const { result } = await this.client.simulateContract({
|
|
@@ -240,15 +771,15 @@ export class RollupContract {
|
|
|
240
771
|
}
|
|
241
772
|
throw e;
|
|
242
773
|
});
|
|
243
|
-
return result;
|
|
774
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
244
775
|
}
|
|
245
|
-
getSampleSeedAt(timestamp) {
|
|
246
|
-
return this.rollup.read.getSampleSeedAt([
|
|
776
|
+
async getSampleSeedAt(timestamp) {
|
|
777
|
+
return Buffer32.fromBigInt(await this.rollup.read.getSampleSeedAt([
|
|
247
778
|
timestamp
|
|
248
|
-
]);
|
|
779
|
+
]));
|
|
249
780
|
}
|
|
250
|
-
getCurrentSampleSeed() {
|
|
251
|
-
return this.rollup.read.getCurrentSampleSeed();
|
|
781
|
+
async getCurrentSampleSeed() {
|
|
782
|
+
return Buffer32.fromBigInt(await this.rollup.read.getCurrentSampleSeed());
|
|
252
783
|
}
|
|
253
784
|
async getCurrentEpoch() {
|
|
254
785
|
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
@@ -267,7 +798,7 @@ export class RollupContract {
|
|
|
267
798
|
}
|
|
268
799
|
throw e;
|
|
269
800
|
});
|
|
270
|
-
return result;
|
|
801
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
271
802
|
}
|
|
272
803
|
async getCurrentProposer() {
|
|
273
804
|
const { result } = await this.client.simulateContract({
|
|
@@ -276,7 +807,7 @@ export class RollupContract {
|
|
|
276
807
|
functionName: 'getCurrentProposer',
|
|
277
808
|
args: []
|
|
278
809
|
});
|
|
279
|
-
return result;
|
|
810
|
+
return EthAddress.fromString(result);
|
|
280
811
|
}
|
|
281
812
|
async getProposerAt(timestamp) {
|
|
282
813
|
const { result } = await this.client.simulateContract({
|
|
@@ -287,12 +818,27 @@ export class RollupContract {
|
|
|
287
818
|
timestamp
|
|
288
819
|
]
|
|
289
820
|
});
|
|
290
|
-
return result;
|
|
821
|
+
return EthAddress.fromString(result);
|
|
291
822
|
}
|
|
292
|
-
getCheckpoint(checkpointNumber) {
|
|
293
|
-
|
|
823
|
+
async getCheckpoint(checkpointNumber) {
|
|
824
|
+
const result = await this.rollup.read.getCheckpoint([
|
|
294
825
|
BigInt(checkpointNumber)
|
|
295
826
|
]);
|
|
827
|
+
return {
|
|
828
|
+
archive: Fr.fromString(result.archive),
|
|
829
|
+
headerHash: Buffer32.fromString(result.headerHash),
|
|
830
|
+
blobCommitmentsHash: Buffer32.fromString(result.blobCommitmentsHash),
|
|
831
|
+
attestationsHash: Buffer32.fromString(result.attestationsHash),
|
|
832
|
+
payloadDigest: Buffer32.fromString(result.payloadDigest),
|
|
833
|
+
slotNumber: SlotNumber.fromBigInt(result.slotNumber),
|
|
834
|
+
feeHeader: {
|
|
835
|
+
excessMana: result.feeHeader.excessMana,
|
|
836
|
+
manaUsed: result.feeHeader.manaUsed,
|
|
837
|
+
ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
|
|
838
|
+
congestionCost: result.feeHeader.congestionCost,
|
|
839
|
+
proverCost: result.feeHeader.proverCost
|
|
840
|
+
}
|
|
841
|
+
};
|
|
296
842
|
}
|
|
297
843
|
/** Returns the pending checkpoint from the rollup contract */ getPendingCheckpoint() {
|
|
298
844
|
// We retry because of race conditions during prunes: we may get a pending checkpoint number which is immediately
|
|
@@ -319,11 +865,11 @@ export class RollupContract {
|
|
|
319
865
|
BigInt(slot)
|
|
320
866
|
]);
|
|
321
867
|
}
|
|
322
|
-
getEntryQueueLength() {
|
|
323
|
-
return this.rollup.read.getEntryQueueLength();
|
|
868
|
+
async getEntryQueueLength() {
|
|
869
|
+
return Number(await this.rollup.read.getEntryQueueLength());
|
|
324
870
|
}
|
|
325
|
-
getAvailableValidatorFlushes() {
|
|
326
|
-
return this.rollup.read.getAvailableValidatorFlushes();
|
|
871
|
+
async getAvailableValidatorFlushes() {
|
|
872
|
+
return Number(await this.rollup.read.getAvailableValidatorFlushes());
|
|
327
873
|
}
|
|
328
874
|
async getNextFlushableEpoch() {
|
|
329
875
|
return EpochNumber.fromBigInt(await this.rollup.read.getNextFlushableEpoch());
|
|
@@ -365,8 +911,9 @@ export class RollupContract {
|
|
|
365
911
|
BigInt(slotNumber)
|
|
366
912
|
]));
|
|
367
913
|
}
|
|
368
|
-
getEpochProofPublicInputs(args) {
|
|
369
|
-
|
|
914
|
+
async getEpochProofPublicInputs(args) {
|
|
915
|
+
const result = await this.rollup.read.getEpochProofPublicInputs(args);
|
|
916
|
+
return result.map(Fr.fromString);
|
|
370
917
|
}
|
|
371
918
|
async validateHeader(args, account) {
|
|
372
919
|
try {
|
|
@@ -446,6 +993,7 @@ export class RollupContract {
|
|
|
446
993
|
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(checkpointNumber, attestationsAndSigners, committee, invalidIndex) {
|
|
447
994
|
return {
|
|
448
995
|
to: this.address,
|
|
996
|
+
abi: RollupAbi,
|
|
449
997
|
data: encodeFunctionData({
|
|
450
998
|
abi: RollupAbi,
|
|
451
999
|
functionName: 'invalidateBadAttestation',
|
|
@@ -461,6 +1009,7 @@ export class RollupContract {
|
|
|
461
1009
|
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(checkpointNumber, attestationsAndSigners, committee) {
|
|
462
1010
|
return {
|
|
463
1011
|
to: this.address,
|
|
1012
|
+
abi: RollupAbi,
|
|
464
1013
|
data: encodeFunctionData({
|
|
465
1014
|
abi: RollupAbi,
|
|
466
1015
|
functionName: 'invalidateInsufficientAttestations',
|
|
@@ -482,8 +1031,8 @@ export class RollupContract {
|
|
|
482
1031
|
prover
|
|
483
1032
|
]);
|
|
484
1033
|
}
|
|
485
|
-
|
|
486
|
-
return this.rollup.read.
|
|
1034
|
+
getManaMinFeeAt(timestamp, inFeeAsset) {
|
|
1035
|
+
return this.rollup.read.getManaMinFeeAt([
|
|
487
1036
|
timestamp,
|
|
488
1037
|
inFeeAsset
|
|
489
1038
|
]);
|
|
@@ -495,9 +1044,16 @@ export class RollupContract {
|
|
|
495
1044
|
}
|
|
496
1045
|
async status(checkpointNumber, options) {
|
|
497
1046
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
498
|
-
|
|
1047
|
+
const result = await this.rollup.read.status([
|
|
499
1048
|
BigInt(checkpointNumber)
|
|
500
1049
|
], options);
|
|
1050
|
+
return {
|
|
1051
|
+
provenCheckpointNumber: CheckpointNumber.fromBigInt(result[0]),
|
|
1052
|
+
provenArchive: Fr.fromString(result[1]),
|
|
1053
|
+
pendingCheckpointNumber: CheckpointNumber.fromBigInt(result[2]),
|
|
1054
|
+
pendingArchive: Fr.fromString(result[3]),
|
|
1055
|
+
archiveOfMyCheckpoint: Fr.fromString(result[4])
|
|
1056
|
+
};
|
|
501
1057
|
}
|
|
502
1058
|
async canPruneAtTime(timestamp, options) {
|
|
503
1059
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
@@ -505,13 +1061,13 @@ export class RollupContract {
|
|
|
505
1061
|
timestamp
|
|
506
1062
|
], options);
|
|
507
1063
|
}
|
|
508
|
-
archive() {
|
|
509
|
-
return this.rollup.read.archive();
|
|
1064
|
+
async archive() {
|
|
1065
|
+
return Fr.fromString(await this.rollup.read.archive());
|
|
510
1066
|
}
|
|
511
|
-
archiveAt(checkpointNumber) {
|
|
512
|
-
return this.rollup.read.archiveAt([
|
|
1067
|
+
async archiveAt(checkpointNumber) {
|
|
1068
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
513
1069
|
BigInt(checkpointNumber)
|
|
514
|
-
]);
|
|
1070
|
+
]));
|
|
515
1071
|
}
|
|
516
1072
|
getSequencerRewards(address) {
|
|
517
1073
|
if (address instanceof EthAddress) {
|
|
@@ -535,44 +1091,71 @@ export class RollupContract {
|
|
|
535
1091
|
const gse = new GSEContract(this.client, await this.getGSE());
|
|
536
1092
|
const ts = (await this.client.getBlock()).timestamp;
|
|
537
1093
|
const indices = Array.from({
|
|
538
|
-
length:
|
|
1094
|
+
length: attesterSize
|
|
539
1095
|
}, (_, i)=>BigInt(i));
|
|
540
1096
|
const chunks = chunk(indices, 1000);
|
|
541
|
-
|
|
1097
|
+
const results = await Promise.all(chunks.map((chunk)=>gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)));
|
|
1098
|
+
return results.flat().map((addr)=>EthAddress.fromString(addr));
|
|
542
1099
|
}
|
|
543
|
-
getAttesterView(address) {
|
|
1100
|
+
async getAttesterView(address) {
|
|
544
1101
|
if (address instanceof EthAddress) {
|
|
545
1102
|
address = address.toString();
|
|
546
1103
|
}
|
|
547
|
-
|
|
1104
|
+
const result = await this.rollup.read.getAttesterView([
|
|
548
1105
|
address
|
|
549
1106
|
]);
|
|
1107
|
+
return {
|
|
1108
|
+
status: result.status,
|
|
1109
|
+
effectiveBalance: result.effectiveBalance,
|
|
1110
|
+
exit: {
|
|
1111
|
+
withdrawalId: result.exit.withdrawalId,
|
|
1112
|
+
amount: result.exit.amount,
|
|
1113
|
+
exitableAt: result.exit.exitableAt,
|
|
1114
|
+
recipientOrWithdrawer: EthAddress.fromString(result.exit.recipientOrWithdrawer),
|
|
1115
|
+
isRecipient: result.exit.isRecipient,
|
|
1116
|
+
exists: result.exit.exists
|
|
1117
|
+
},
|
|
1118
|
+
config: {
|
|
1119
|
+
publicKey: {
|
|
1120
|
+
x: result.config.publicKey.x,
|
|
1121
|
+
y: result.config.publicKey.y
|
|
1122
|
+
},
|
|
1123
|
+
withdrawer: EthAddress.fromString(result.config.withdrawer)
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
550
1126
|
}
|
|
551
|
-
getStatus(address) {
|
|
1127
|
+
async getStatus(address) {
|
|
552
1128
|
if (address instanceof EthAddress) {
|
|
553
1129
|
address = address.toString();
|
|
554
1130
|
}
|
|
555
|
-
return this.rollup.read.getStatus([
|
|
1131
|
+
return await this.rollup.read.getStatus([
|
|
556
1132
|
address
|
|
557
1133
|
]);
|
|
558
1134
|
}
|
|
559
|
-
getBlobCommitmentsHash(checkpointNumber) {
|
|
560
|
-
return this.rollup.read.getBlobCommitmentsHash([
|
|
1135
|
+
async getBlobCommitmentsHash(checkpointNumber) {
|
|
1136
|
+
return Buffer32.fromString(await this.rollup.read.getBlobCommitmentsHash([
|
|
561
1137
|
BigInt(checkpointNumber)
|
|
562
|
-
]);
|
|
1138
|
+
]));
|
|
563
1139
|
}
|
|
564
|
-
getCurrentBlobCommitmentsHash() {
|
|
565
|
-
return this.rollup.read.getCurrentBlobCommitmentsHash();
|
|
1140
|
+
async getCurrentBlobCommitmentsHash() {
|
|
1141
|
+
return Buffer32.fromString(await this.rollup.read.getCurrentBlobCommitmentsHash());
|
|
566
1142
|
}
|
|
567
|
-
getStakingAsset() {
|
|
568
|
-
return this.rollup.read.getStakingAsset();
|
|
1143
|
+
async getStakingAsset() {
|
|
1144
|
+
return EthAddress.fromString(await this.rollup.read.getStakingAsset());
|
|
569
1145
|
}
|
|
570
|
-
getRewardConfig() {
|
|
571
|
-
|
|
1146
|
+
async getRewardConfig() {
|
|
1147
|
+
const result = await this.rollup.read.getRewardConfig();
|
|
1148
|
+
return {
|
|
1149
|
+
rewardDistributor: EthAddress.fromString(result.rewardDistributor),
|
|
1150
|
+
sequencerBps: BigInt(result.sequencerBps),
|
|
1151
|
+
booster: EthAddress.fromString(result.booster),
|
|
1152
|
+
checkpointReward: result.checkpointReward
|
|
1153
|
+
};
|
|
572
1154
|
}
|
|
573
1155
|
setupEpoch(l1TxUtils) {
|
|
574
1156
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
575
1157
|
to: this.address,
|
|
1158
|
+
abi: RollupAbi,
|
|
576
1159
|
data: encodeFunctionData({
|
|
577
1160
|
abi: RollupAbi,
|
|
578
1161
|
functionName: 'setupEpoch',
|
|
@@ -583,6 +1166,7 @@ export class RollupContract {
|
|
|
583
1166
|
vote(l1TxUtils, proposalId) {
|
|
584
1167
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
585
1168
|
to: this.address,
|
|
1169
|
+
abi: RollupAbi,
|
|
586
1170
|
data: encodeFunctionData({
|
|
587
1171
|
abi: RollupAbi,
|
|
588
1172
|
functionName: 'vote',
|
|
@@ -642,61 +1226,22 @@ export class RollupContract {
|
|
|
642
1226
|
}
|
|
643
1227
|
});
|
|
644
1228
|
}
|
|
1229
|
+
/** Fetches CheckpointProposed events within the given block range. */ async getCheckpointProposedEvents(fromBlock, toBlock) {
|
|
1230
|
+
const logs = await this.rollup.getEvents.CheckpointProposed({}, {
|
|
1231
|
+
fromBlock,
|
|
1232
|
+
toBlock
|
|
1233
|
+
});
|
|
1234
|
+
return logs.filter((log)=>log.blockNumber >= fromBlock && log.blockNumber <= toBlock).map((log)=>({
|
|
1235
|
+
l1BlockNumber: log.blockNumber,
|
|
1236
|
+
l1BlockHash: Buffer32.fromString(log.blockHash),
|
|
1237
|
+
l1TransactionHash: log.transactionHash,
|
|
1238
|
+
args: {
|
|
1239
|
+
checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber),
|
|
1240
|
+
archive: Fr.fromString(log.args.archive),
|
|
1241
|
+
versionedBlobHashes: log.args.versionedBlobHashes.map((h)=>Buffer.from(h.slice(2), 'hex')),
|
|
1242
|
+
attestationsHash: log.args.attestationsHash ? Buffer32.fromString(log.args.attestationsHash) : undefined,
|
|
1243
|
+
payloadDigest: log.args.payloadDigest ? Buffer32.fromString(log.args.payloadDigest) : undefined
|
|
1244
|
+
}
|
|
1245
|
+
}));
|
|
1246
|
+
}
|
|
645
1247
|
}
|
|
646
|
-
_ts_decorate([
|
|
647
|
-
memoize
|
|
648
|
-
], RollupContract.prototype, "getL1StartBlock", null);
|
|
649
|
-
_ts_decorate([
|
|
650
|
-
memoize
|
|
651
|
-
], RollupContract.prototype, "getL1GenesisTime", null);
|
|
652
|
-
_ts_decorate([
|
|
653
|
-
memoize
|
|
654
|
-
], RollupContract.prototype, "getProofSubmissionEpochs", null);
|
|
655
|
-
_ts_decorate([
|
|
656
|
-
memoize
|
|
657
|
-
], RollupContract.prototype, "getEpochDuration", null);
|
|
658
|
-
_ts_decorate([
|
|
659
|
-
memoize
|
|
660
|
-
], RollupContract.prototype, "getSlotDuration", null);
|
|
661
|
-
_ts_decorate([
|
|
662
|
-
memoize
|
|
663
|
-
], RollupContract.prototype, "getTargetCommitteeSize", null);
|
|
664
|
-
_ts_decorate([
|
|
665
|
-
memoize
|
|
666
|
-
], RollupContract.prototype, "getEjectionThreshold", null);
|
|
667
|
-
_ts_decorate([
|
|
668
|
-
memoize
|
|
669
|
-
], RollupContract.prototype, "getLocalEjectionThreshold", null);
|
|
670
|
-
_ts_decorate([
|
|
671
|
-
memoize
|
|
672
|
-
], RollupContract.prototype, "getLagInEpochsForValidatorSet", null);
|
|
673
|
-
_ts_decorate([
|
|
674
|
-
memoize
|
|
675
|
-
], RollupContract.prototype, "getLagInEpochsForRandao", null);
|
|
676
|
-
_ts_decorate([
|
|
677
|
-
memoize
|
|
678
|
-
], RollupContract.prototype, "getActivationThreshold", null);
|
|
679
|
-
_ts_decorate([
|
|
680
|
-
memoize
|
|
681
|
-
], RollupContract.prototype, "getExitDelay", null);
|
|
682
|
-
_ts_decorate([
|
|
683
|
-
memoize
|
|
684
|
-
], RollupContract.prototype, "getManaTarget", null);
|
|
685
|
-
_ts_decorate([
|
|
686
|
-
memoize
|
|
687
|
-
], RollupContract.prototype, "getProvingCostPerMana", null);
|
|
688
|
-
_ts_decorate([
|
|
689
|
-
memoize
|
|
690
|
-
], RollupContract.prototype, "getProvingCostPerManaInFeeAsset", null);
|
|
691
|
-
_ts_decorate([
|
|
692
|
-
memoize
|
|
693
|
-
], RollupContract.prototype, "getManaLimit", null);
|
|
694
|
-
_ts_decorate([
|
|
695
|
-
memoize
|
|
696
|
-
], RollupContract.prototype, "getVersion", null);
|
|
697
|
-
_ts_decorate([
|
|
698
|
-
memoize
|
|
699
|
-
], RollupContract.prototype, "getGenesisArchiveTreeRoot", null);
|
|
700
|
-
_ts_decorate([
|
|
701
|
-
memoize
|
|
702
|
-
], RollupContract.prototype, "getRollupConstants", null);
|