@aztec/sequencer-client 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/client/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +21 -16
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +75 -28
- package/dest/config.d.ts +35 -9
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +113 -42
- package/dest/global_variable_builder/global_builder.d.ts +20 -16
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +54 -40
- package/dest/global_variable_builder/index.d.ts +1 -1
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/publisher/config.d.ts +43 -20
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +109 -34
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +15 -6
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +28 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +23 -86
- package/dest/publisher/sequencer-publisher.d.ts +103 -69
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +999 -190
- package/dest/sequencer/checkpoint_proposal_job.d.ts +108 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1289 -0
- package/dest/sequencer/checkpoint_voter.d.ts +35 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +109 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +1 -1
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/events.d.ts +47 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +4 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +3 -1
- package/dest/sequencer/metrics.d.ts +48 -3
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +243 -50
- package/dest/sequencer/sequencer.d.ts +127 -144
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +770 -545
- package/dest/sequencer/timetable.d.ts +54 -16
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +147 -62
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +14 -8
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +7 -4
- package/dest/test/index.d.ts +6 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +95 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +231 -0
- package/dest/test/utils.d.ts +53 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +104 -0
- package/package.json +32 -30
- package/src/client/sequencer-client.ts +100 -52
- package/src/config.ts +132 -51
- package/src/global_variable_builder/global_builder.ts +69 -60
- package/src/index.ts +1 -7
- package/src/publisher/config.ts +139 -50
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +45 -11
- package/src/publisher/sequencer-publisher-metrics.ts +19 -71
- package/src/publisher/sequencer-publisher.ts +717 -248
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1049 -0
- package/src/sequencer/checkpoint_voter.ts +130 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +3 -1
- package/src/sequencer/metrics.ts +310 -61
- package/src/sequencer/sequencer.ts +541 -735
- package/src/sequencer/timetable.ts +178 -83
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +18 -9
- package/src/test/index.ts +5 -6
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +167 -0
- package/dest/sequencer/block_builder.d.ts +0 -27
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -130
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -53
- package/src/sequencer/block_builder.ts +0 -218
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -132
|
@@ -1,18 +1,399 @@
|
|
|
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);
|
|
372
|
+
}
|
|
373
|
+
var _dec, _dec1, _dec2, _initProto;
|
|
1
374
|
import { Blob, getBlobsPerL1Block, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
375
|
+
import { FeeAssetPriceOracle, MULTI_CALL_3_ADDRESS, Multicall3, RollupContract } from '@aztec/ethereum/contracts';
|
|
376
|
+
import { L1FeeAnalyzer } from '@aztec/ethereum/l1-fee-analysis';
|
|
377
|
+
import { MAX_L1_TX_LIMIT, WEI_CONST } from '@aztec/ethereum/l1-tx-utils';
|
|
378
|
+
import { FormattedViemError, formatViemError, mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
4
379
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
5
380
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
381
|
+
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
382
|
+
import { trimmedBytesLength } from '@aztec/foundation/buffer';
|
|
383
|
+
import { pick } from '@aztec/foundation/collection';
|
|
384
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
6
385
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
386
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
387
|
import { createLogger } from '@aztec/foundation/log';
|
|
388
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
9
389
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
10
390
|
import { Timer } from '@aztec/foundation/timer';
|
|
11
391
|
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
12
392
|
import { encodeSlashConsensusVotes } from '@aztec/slasher';
|
|
13
|
-
import {
|
|
14
|
-
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
15
|
-
import { encodeFunctionData, toHex } from 'viem';
|
|
393
|
+
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
394
|
+
import { getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
395
|
+
import { encodeFunctionData, keccak256, multicall3Abi, toHex } from 'viem';
|
|
396
|
+
import { createL1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
16
397
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
17
398
|
export const Actions = [
|
|
18
399
|
'invalidate-by-invalid-attestation',
|
|
@@ -27,21 +408,45 @@ export const Actions = [
|
|
|
27
408
|
];
|
|
28
409
|
// Sorting for actions such that invalidations go before proposals, and proposals go before votes
|
|
29
410
|
export const compareActions = (a, b)=>Actions.indexOf(a) - Actions.indexOf(b);
|
|
411
|
+
_dec = trackSpan('SequencerPublisher.sendRequests'), _dec1 = trackSpan('SequencerPublisher.validateBlockHeader'), _dec2 = trackSpan('SequencerPublisher.validateCheckpointForSubmission');
|
|
30
412
|
export class SequencerPublisher {
|
|
31
413
|
config;
|
|
414
|
+
static{
|
|
415
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
416
|
+
[
|
|
417
|
+
_dec,
|
|
418
|
+
2,
|
|
419
|
+
"sendRequests"
|
|
420
|
+
],
|
|
421
|
+
[
|
|
422
|
+
_dec1,
|
|
423
|
+
2,
|
|
424
|
+
"validateBlockHeader"
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
_dec2,
|
|
428
|
+
2,
|
|
429
|
+
"validateCheckpointForSubmission"
|
|
430
|
+
]
|
|
431
|
+
], []));
|
|
432
|
+
}
|
|
32
433
|
interrupted;
|
|
33
434
|
metrics;
|
|
34
435
|
epochCache;
|
|
436
|
+
failedTxStore;
|
|
35
437
|
governanceLog;
|
|
36
438
|
slashingLog;
|
|
37
439
|
lastActions;
|
|
440
|
+
isPayloadEmptyCache;
|
|
441
|
+
payloadProposedCache;
|
|
38
442
|
log;
|
|
39
443
|
ethereumSlotDuration;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
444
|
+
aztecSlotDuration;
|
|
445
|
+
blobClient;
|
|
446
|
+
/** Address to use for simulations in fisherman mode (actual proposer's address) */ proposerAddressForSimulation;
|
|
447
|
+
/** Optional callback to obtain a replacement publisher when the current one fails to send. */ getNextPublisher;
|
|
448
|
+
/** L1 fee analyzer for fisherman mode */ l1FeeAnalyzer;
|
|
449
|
+
/** Fee asset price oracle for computing price modifiers from Uniswap V4 */ feeAssetPriceOracle;
|
|
45
450
|
// A CALL to a cold address is 2700 gas
|
|
46
451
|
static MULTICALL_OVERHEAD_GAS_GUESS = 5000n;
|
|
47
452
|
// Gas report for VotingWithSigTest shows a max gas of 100k, but we've seen it cost 700k+ in testnet
|
|
@@ -51,24 +456,28 @@ export class SequencerPublisher {
|
|
|
51
456
|
govProposerContract;
|
|
52
457
|
slashingProposerContract;
|
|
53
458
|
slashFactoryContract;
|
|
459
|
+
tracer;
|
|
54
460
|
requests;
|
|
55
461
|
constructor(config, deps){
|
|
56
462
|
this.config = config;
|
|
57
|
-
this.interrupted = false;
|
|
463
|
+
this.interrupted = (_initProto(this), false);
|
|
58
464
|
this.governanceLog = createLogger('sequencer:publisher:governance');
|
|
59
465
|
this.slashingLog = createLogger('sequencer:publisher:slashing');
|
|
60
466
|
this.lastActions = {};
|
|
467
|
+
this.isPayloadEmptyCache = new Map();
|
|
468
|
+
this.payloadProposedCache = new Set();
|
|
61
469
|
this.requests = [];
|
|
62
470
|
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
63
471
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
472
|
+
this.aztecSlotDuration = BigInt(config.aztecSlotDuration);
|
|
64
473
|
this.epochCache = deps.epochCache;
|
|
65
474
|
this.lastActions = deps.lastActions;
|
|
66
|
-
this.
|
|
67
|
-
logger: createLogger('sequencer:blob-sink:client')
|
|
68
|
-
});
|
|
475
|
+
this.blobClient = deps.blobClient;
|
|
69
476
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
70
477
|
this.metrics = deps.metrics ?? new SequencerPublisherMetrics(telemetry, 'SequencerPublisher');
|
|
478
|
+
this.tracer = telemetry.getTracer('SequencerPublisher');
|
|
71
479
|
this.l1TxUtils = deps.l1TxUtils;
|
|
480
|
+
this.getNextPublisher = deps.getNextPublisher;
|
|
72
481
|
this.rollupContract = deps.rollupContract;
|
|
73
482
|
this.govProposerContract = deps.governanceProposerContract;
|
|
74
483
|
this.slashingProposerContract = deps.slashingProposerContract;
|
|
@@ -78,18 +487,108 @@ export class SequencerPublisher {
|
|
|
78
487
|
this.slashingProposerContract = newSlashingProposer;
|
|
79
488
|
});
|
|
80
489
|
this.slashFactoryContract = deps.slashFactoryContract;
|
|
490
|
+
// Initialize L1 fee analyzer for fisherman mode
|
|
491
|
+
if (config.fishermanMode) {
|
|
492
|
+
this.l1FeeAnalyzer = new L1FeeAnalyzer(this.l1TxUtils.client, deps.dateProvider, createLogger('sequencer:publisher:fee-analyzer'));
|
|
493
|
+
}
|
|
494
|
+
// Initialize fee asset price oracle
|
|
495
|
+
this.feeAssetPriceOracle = new FeeAssetPriceOracle(this.l1TxUtils.client, this.rollupContract, createLogger('sequencer:publisher:price-oracle'));
|
|
496
|
+
// Initialize failed L1 tx store (optional, for test networks)
|
|
497
|
+
this.failedTxStore = createL1TxFailedStore(config.l1TxFailedStore, this.log);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Backs up a failed L1 transaction to the configured store for debugging.
|
|
501
|
+
* Does nothing if no store is configured.
|
|
502
|
+
*/ backupFailedTx(failedTx) {
|
|
503
|
+
if (!this.failedTxStore) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
const tx = {
|
|
507
|
+
...failedTx,
|
|
508
|
+
timestamp: Date.now()
|
|
509
|
+
};
|
|
510
|
+
// Fire and forget - don't block on backup
|
|
511
|
+
void this.failedTxStore.then((store)=>store?.saveFailedTx(tx)).catch((err)=>{
|
|
512
|
+
this.log.warn(`Failed to backup failed L1 tx to store`, err);
|
|
513
|
+
});
|
|
81
514
|
}
|
|
82
515
|
getRollupContract() {
|
|
83
516
|
return this.rollupContract;
|
|
84
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Gets the fee asset price modifier from the oracle.
|
|
520
|
+
* Returns 0n if the oracle query fails.
|
|
521
|
+
*/ getFeeAssetPriceModifier() {
|
|
522
|
+
return this.feeAssetPriceOracle.computePriceModifier();
|
|
523
|
+
}
|
|
85
524
|
getSenderAddress() {
|
|
86
525
|
return this.l1TxUtils.getSenderAddress();
|
|
87
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* Gets the L1 fee analyzer instance (only available in fisherman mode)
|
|
529
|
+
*/ getL1FeeAnalyzer() {
|
|
530
|
+
return this.l1FeeAnalyzer;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Sets the proposer address to use for simulations in fisherman mode.
|
|
534
|
+
* @param proposerAddress - The actual proposer's address to use for balance lookups in simulations
|
|
535
|
+
*/ setProposerAddressForSimulation(proposerAddress) {
|
|
536
|
+
this.proposerAddressForSimulation = proposerAddress;
|
|
537
|
+
}
|
|
88
538
|
addRequest(request) {
|
|
89
539
|
this.requests.push(request);
|
|
90
540
|
}
|
|
91
541
|
getCurrentL2Slot() {
|
|
92
|
-
return this.epochCache.
|
|
542
|
+
return this.epochCache.getSlotNow();
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Clears all pending requests without sending them.
|
|
546
|
+
*/ clearPendingRequests() {
|
|
547
|
+
const count = this.requests.length;
|
|
548
|
+
this.requests = [];
|
|
549
|
+
if (count > 0) {
|
|
550
|
+
this.log.debug(`Cleared ${count} pending request(s)`);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Analyzes L1 fees for the pending requests without sending them.
|
|
555
|
+
* This is used in fisherman mode to validate fee calculations.
|
|
556
|
+
* @param l2SlotNumber - The L2 slot number for this analysis
|
|
557
|
+
* @param onComplete - Optional callback to invoke when analysis completes (after block is mined)
|
|
558
|
+
* @returns The analysis result (incomplete until block mines), or undefined if no requests
|
|
559
|
+
*/ async analyzeL1Fees(l2SlotNumber, onComplete) {
|
|
560
|
+
if (!this.l1FeeAnalyzer) {
|
|
561
|
+
this.log.warn('L1 fee analyzer not available (not in fisherman mode)');
|
|
562
|
+
return undefined;
|
|
563
|
+
}
|
|
564
|
+
const requestsToAnalyze = [
|
|
565
|
+
...this.requests
|
|
566
|
+
];
|
|
567
|
+
if (requestsToAnalyze.length === 0) {
|
|
568
|
+
this.log.debug('No requests to analyze for L1 fees');
|
|
569
|
+
return undefined;
|
|
570
|
+
}
|
|
571
|
+
// Extract blob config from requests (if any)
|
|
572
|
+
const blobConfigs = requestsToAnalyze.filter((request)=>request.blobConfig).map((request)=>request.blobConfig);
|
|
573
|
+
const blobConfig = blobConfigs[0];
|
|
574
|
+
// Get gas configs
|
|
575
|
+
const gasConfigs = requestsToAnalyze.filter((request)=>request.gasConfig).map((request)=>request.gasConfig);
|
|
576
|
+
const gasLimits = gasConfigs.map((g)=>g?.gasLimit).filter((g)=>g !== undefined);
|
|
577
|
+
const gasLimit = gasLimits.length > 0 ? gasLimits.reduce((sum, g)=>sum + g, 0n) : 0n;
|
|
578
|
+
// Get the transaction requests
|
|
579
|
+
const l1Requests = requestsToAnalyze.map((r)=>r.request);
|
|
580
|
+
// Start the analysis
|
|
581
|
+
const analysisId = await this.l1FeeAnalyzer.startAnalysis(l2SlotNumber, gasLimit > 0n ? gasLimit : MAX_L1_TX_LIMIT, l1Requests, blobConfig, onComplete);
|
|
582
|
+
this.log.info('Started L1 fee analysis', {
|
|
583
|
+
analysisId,
|
|
584
|
+
l2SlotNumber: l2SlotNumber.toString(),
|
|
585
|
+
requestCount: requestsToAnalyze.length,
|
|
586
|
+
hasBlobConfig: !!blobConfig,
|
|
587
|
+
gasLimit: gasLimit.toString(),
|
|
588
|
+
actions: requestsToAnalyze.map((r)=>r.action)
|
|
589
|
+
});
|
|
590
|
+
// Return the analysis result (will be incomplete until block mines)
|
|
591
|
+
return this.l1FeeAnalyzer.getAnalysis(analysisId);
|
|
93
592
|
}
|
|
94
593
|
/**
|
|
95
594
|
* Sends all requests that are still valid.
|
|
@@ -102,7 +601,7 @@ export class SequencerPublisher {
|
|
|
102
601
|
...this.requests
|
|
103
602
|
];
|
|
104
603
|
this.requests = [];
|
|
105
|
-
if (this.interrupted) {
|
|
604
|
+
if (this.interrupted || requestsToProcess.length === 0) {
|
|
106
605
|
return undefined;
|
|
107
606
|
}
|
|
108
607
|
const currentL2Slot = this.getCurrentL2Slot();
|
|
@@ -129,15 +628,24 @@ export class SequencerPublisher {
|
|
|
129
628
|
// @note - we can only have one blob config per bundle
|
|
130
629
|
// find requests with gas and blob configs
|
|
131
630
|
// See https://github.com/AztecProtocol/aztec-packages/issues/11513
|
|
132
|
-
const gasConfigs =
|
|
133
|
-
const blobConfigs =
|
|
631
|
+
const gasConfigs = validRequests.filter((request)=>request.gasConfig).map((request)=>request.gasConfig);
|
|
632
|
+
const blobConfigs = validRequests.filter((request)=>request.blobConfig).map((request)=>request.blobConfig);
|
|
134
633
|
if (blobConfigs.length > 1) {
|
|
135
634
|
throw new Error('Multiple blob configs found');
|
|
136
635
|
}
|
|
137
636
|
const blobConfig = blobConfigs[0];
|
|
138
637
|
// Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
|
|
139
638
|
const gasLimits = gasConfigs.map((g)=>g?.gasLimit).filter((g)=>g !== undefined);
|
|
140
|
-
|
|
639
|
+
let gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
640
|
+
// Cap at L1 block gas limit so the node accepts the tx ("gas limit too high" otherwise).
|
|
641
|
+
const maxGas = MAX_L1_TX_LIMIT;
|
|
642
|
+
if (gasLimit !== undefined && gasLimit > maxGas) {
|
|
643
|
+
this.log.debug('Capping bundled tx gas limit to L1 max', {
|
|
644
|
+
requested: gasLimit,
|
|
645
|
+
capped: maxGas
|
|
646
|
+
});
|
|
647
|
+
gasLimit = maxGas;
|
|
648
|
+
}
|
|
141
649
|
const txTimeoutAts = gasConfigs.map((g)=>g?.txTimeoutAt).filter((g)=>g !== undefined);
|
|
142
650
|
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map((g)=>g.getTime()))) : undefined; // earliest
|
|
143
651
|
const txConfig = {
|
|
@@ -148,12 +656,34 @@ export class SequencerPublisher {
|
|
|
148
656
|
// This ensures the committee gets precomputed correctly
|
|
149
657
|
validRequests.sort((a, b)=>compareActions(a.action, b.action));
|
|
150
658
|
try {
|
|
659
|
+
// Capture context for failed tx backup before sending
|
|
660
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
661
|
+
const multicallData = encodeFunctionData({
|
|
662
|
+
abi: multicall3Abi,
|
|
663
|
+
functionName: 'aggregate3',
|
|
664
|
+
args: [
|
|
665
|
+
validRequests.map((r)=>({
|
|
666
|
+
target: r.request.to,
|
|
667
|
+
callData: r.request.data,
|
|
668
|
+
allowFailure: true
|
|
669
|
+
}))
|
|
670
|
+
]
|
|
671
|
+
});
|
|
672
|
+
const blobDataHex = blobConfig?.blobs?.map((b)=>toHex(b));
|
|
673
|
+
const txContext = {
|
|
674
|
+
multicallData,
|
|
675
|
+
blobData: blobDataHex,
|
|
676
|
+
l1BlockNumber
|
|
677
|
+
};
|
|
151
678
|
this.log.debug('Forwarding transactions', {
|
|
152
679
|
validRequests: validRequests.map((request)=>request.action),
|
|
153
680
|
txConfig
|
|
154
681
|
});
|
|
155
|
-
const result = await
|
|
156
|
-
|
|
682
|
+
const result = await this.forwardWithPublisherRotation(validRequests, txConfig, blobConfig);
|
|
683
|
+
if (result === undefined) {
|
|
684
|
+
return undefined;
|
|
685
|
+
}
|
|
686
|
+
const { successfulActions = [], failedActions = [] } = this.callbackBundledTransactions(validRequests, result, txContext);
|
|
157
687
|
return {
|
|
158
688
|
result,
|
|
159
689
|
expiredActions,
|
|
@@ -173,17 +703,83 @@ export class SequencerPublisher {
|
|
|
173
703
|
}
|
|
174
704
|
}
|
|
175
705
|
}
|
|
176
|
-
|
|
706
|
+
/**
|
|
707
|
+
* Forwards transactions via Multicall3, rotating to the next available publisher if a send
|
|
708
|
+
* failure occurs (i.e. the tx never reached the chain).
|
|
709
|
+
* On-chain reverts and simulation errors are returned as-is without rotation.
|
|
710
|
+
*/ async forwardWithPublisherRotation(validRequests, txConfig, blobConfig) {
|
|
711
|
+
const triedAddresses = [];
|
|
712
|
+
let currentPublisher = this.l1TxUtils;
|
|
713
|
+
while(true){
|
|
714
|
+
triedAddresses.push(currentPublisher.getSenderAddress());
|
|
715
|
+
try {
|
|
716
|
+
const result = await Multicall3.forward(validRequests.map((r)=>r.request), currentPublisher, txConfig, blobConfig, this.rollupContract.address, this.log);
|
|
717
|
+
this.l1TxUtils = currentPublisher;
|
|
718
|
+
return result;
|
|
719
|
+
} catch (err) {
|
|
720
|
+
if (err instanceof TimeoutError) {
|
|
721
|
+
throw err;
|
|
722
|
+
}
|
|
723
|
+
const viemError = formatViemError(err);
|
|
724
|
+
if (!this.getNextPublisher) {
|
|
725
|
+
this.log.error('Failed to publish bundled transactions', viemError);
|
|
726
|
+
return undefined;
|
|
727
|
+
}
|
|
728
|
+
this.log.warn(`Publisher ${currentPublisher.getSenderAddress()} failed to send, rotating to next publisher`, viemError);
|
|
729
|
+
const nextPublisher = await this.getNextPublisher([
|
|
730
|
+
...triedAddresses
|
|
731
|
+
]);
|
|
732
|
+
if (!nextPublisher) {
|
|
733
|
+
this.log.error('All available publishers exhausted, failed to publish bundled transactions');
|
|
734
|
+
return undefined;
|
|
735
|
+
}
|
|
736
|
+
currentPublisher = nextPublisher;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
callbackBundledTransactions(requests, result, txContext) {
|
|
177
741
|
const actionsListStr = requests.map((r)=>r.action).join(', ');
|
|
178
742
|
if (result instanceof FormattedViemError) {
|
|
179
743
|
this.log.error(`Failed to publish bundled transactions (${actionsListStr})`, result);
|
|
744
|
+
this.backupFailedTx({
|
|
745
|
+
id: keccak256(txContext.multicallData),
|
|
746
|
+
failureType: 'send-error',
|
|
747
|
+
request: {
|
|
748
|
+
to: MULTI_CALL_3_ADDRESS,
|
|
749
|
+
data: txContext.multicallData
|
|
750
|
+
},
|
|
751
|
+
blobData: txContext.blobData,
|
|
752
|
+
l1BlockNumber: txContext.l1BlockNumber.toString(),
|
|
753
|
+
error: {
|
|
754
|
+
message: result.message,
|
|
755
|
+
name: result.name
|
|
756
|
+
},
|
|
757
|
+
context: {
|
|
758
|
+
actions: requests.map((r)=>r.action),
|
|
759
|
+
requests: requests.map((r)=>({
|
|
760
|
+
action: r.action,
|
|
761
|
+
to: r.request.to,
|
|
762
|
+
data: r.request.data
|
|
763
|
+
})),
|
|
764
|
+
sender: this.getSenderAddress().toString()
|
|
765
|
+
}
|
|
766
|
+
});
|
|
180
767
|
return {
|
|
181
768
|
failedActions: requests.map((r)=>r.action)
|
|
182
769
|
};
|
|
183
770
|
} else {
|
|
184
771
|
this.log.verbose(`Published bundled transactions (${actionsListStr})`, {
|
|
185
772
|
result,
|
|
186
|
-
requests
|
|
773
|
+
requests: requests.map((r)=>({
|
|
774
|
+
...r,
|
|
775
|
+
// Avoid logging large blob data
|
|
776
|
+
blobConfig: r.blobConfig ? {
|
|
777
|
+
...r.blobConfig,
|
|
778
|
+
blobs: r.blobConfig.blobs.map((b)=>({
|
|
779
|
+
size: trimmedBytesLength(b)
|
|
780
|
+
}))
|
|
781
|
+
} : undefined
|
|
782
|
+
}))
|
|
187
783
|
});
|
|
188
784
|
const successfulActions = [];
|
|
189
785
|
const failedActions = [];
|
|
@@ -194,6 +790,37 @@ export class SequencerPublisher {
|
|
|
194
790
|
failedActions.push(request.action);
|
|
195
791
|
}
|
|
196
792
|
}
|
|
793
|
+
// Single backup for the whole reverted tx
|
|
794
|
+
if (failedActions.length > 0 && result?.receipt?.status === 'reverted') {
|
|
795
|
+
this.backupFailedTx({
|
|
796
|
+
id: result.receipt.transactionHash,
|
|
797
|
+
failureType: 'revert',
|
|
798
|
+
request: {
|
|
799
|
+
to: MULTI_CALL_3_ADDRESS,
|
|
800
|
+
data: txContext.multicallData
|
|
801
|
+
},
|
|
802
|
+
blobData: txContext.blobData,
|
|
803
|
+
l1BlockNumber: result.receipt.blockNumber.toString(),
|
|
804
|
+
receipt: {
|
|
805
|
+
transactionHash: result.receipt.transactionHash,
|
|
806
|
+
blockNumber: result.receipt.blockNumber.toString(),
|
|
807
|
+
gasUsed: (result.receipt.gasUsed ?? 0n).toString(),
|
|
808
|
+
status: 'reverted'
|
|
809
|
+
},
|
|
810
|
+
error: {
|
|
811
|
+
message: result.errorMsg ?? 'Transaction reverted'
|
|
812
|
+
},
|
|
813
|
+
context: {
|
|
814
|
+
actions: failedActions,
|
|
815
|
+
requests: requests.filter((r)=>failedActions.includes(r.action)).map((r)=>({
|
|
816
|
+
action: r.action,
|
|
817
|
+
to: r.request.to,
|
|
818
|
+
data: r.request.data
|
|
819
|
+
})),
|
|
820
|
+
sender: this.getSenderAddress().toString()
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
197
824
|
return {
|
|
198
825
|
successfulActions,
|
|
199
826
|
failedActions
|
|
@@ -201,17 +828,21 @@ export class SequencerPublisher {
|
|
|
201
828
|
}
|
|
202
829
|
}
|
|
203
830
|
/**
|
|
204
|
-
* @notice Will call `
|
|
831
|
+
* @notice Will call `canProposeAt` to make sure that it is possible to propose
|
|
205
832
|
* @param tipArchive - The archive to check
|
|
206
833
|
* @returns The slot and block number if it is possible to propose, undefined otherwise
|
|
207
|
-
*/
|
|
834
|
+
*/ canProposeAt(tipArchive, msgSender, opts = {}) {
|
|
208
835
|
// TODO: #14291 - should loop through multiple keys to check if any of them can propose
|
|
209
836
|
const ignoredErrors = [
|
|
210
837
|
'SlotAlreadyInChain',
|
|
211
838
|
'InvalidProposer',
|
|
212
839
|
'InvalidArchive'
|
|
213
840
|
];
|
|
214
|
-
|
|
841
|
+
const pipelined = opts.pipelined ?? this.epochCache.isProposerPipeliningEnabled();
|
|
842
|
+
const slotOffset = pipelined ? this.aztecSlotDuration : 0n;
|
|
843
|
+
return this.rollupContract.canProposeAt(tipArchive.toBuffer(), msgSender.toString(), this.ethereumSlotDuration, slotOffset, {
|
|
844
|
+
forcePendingCheckpointNumber: opts.forcePendingCheckpointNumber
|
|
845
|
+
}).catch((err)=>{
|
|
215
846
|
if (err instanceof FormattedViemError && ignoredErrors.find((e)=>err.message.includes(e))) {
|
|
216
847
|
this.log.warn(`Failed canProposeAtTime check with ${ignoredErrors.find((e)=>err.message.includes(e))}`, {
|
|
217
848
|
error: err.message
|
|
@@ -238,13 +869,23 @@ export class SequencerPublisher {
|
|
|
238
869
|
[],
|
|
239
870
|
Signature.empty().toViemSignature(),
|
|
240
871
|
`0x${'0'.repeat(64)}`,
|
|
241
|
-
header.
|
|
872
|
+
header.blobsHash.toString(),
|
|
242
873
|
flags
|
|
243
874
|
];
|
|
244
875
|
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
this.
|
|
876
|
+
const stateOverrides = await this.rollupContract.makePendingCheckpointNumberOverride(opts?.forcePendingCheckpointNumber);
|
|
877
|
+
let balance = 0n;
|
|
878
|
+
if (this.config.fishermanMode) {
|
|
879
|
+
// In fisherman mode, we can't know where the proposer is publishing from
|
|
880
|
+
// so we just add sufficient balance to the multicall3 address
|
|
881
|
+
balance = 10n * WEI_CONST * WEI_CONST; // 10 ETH
|
|
882
|
+
} else {
|
|
883
|
+
balance = await this.l1TxUtils.getSenderBalance();
|
|
884
|
+
}
|
|
885
|
+
stateOverrides.push({
|
|
886
|
+
address: MULTI_CALL_3_ADDRESS,
|
|
887
|
+
balance
|
|
888
|
+
});
|
|
248
889
|
await this.l1TxUtils.simulate({
|
|
249
890
|
to: this.rollupContract.address,
|
|
250
891
|
data: encodeFunctionData({
|
|
@@ -255,44 +896,42 @@ export class SequencerPublisher {
|
|
|
255
896
|
from: MULTI_CALL_3_ADDRESS
|
|
256
897
|
}, {
|
|
257
898
|
time: ts + 1n
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
address: MULTI_CALL_3_ADDRESS,
|
|
261
|
-
balance
|
|
262
|
-
},
|
|
263
|
-
...await this.rollupContract.makePendingBlockNumberOverride(opts?.forcePendingBlockNumber)
|
|
264
|
-
]);
|
|
899
|
+
}, stateOverrides);
|
|
265
900
|
this.log.debug(`Simulated validateHeader`);
|
|
266
901
|
}
|
|
267
902
|
/**
|
|
268
|
-
* Simulate making a call to invalidate a
|
|
269
|
-
* @param
|
|
270
|
-
*/ async
|
|
903
|
+
* Simulate making a call to invalidate a checkpoint with invalid attestations. Returns undefined if no need to invalidate.
|
|
904
|
+
* @param validationResult - The validation result indicating which checkpoint to invalidate (as returned by the archiver)
|
|
905
|
+
*/ async simulateInvalidateCheckpoint(validationResult) {
|
|
271
906
|
if (validationResult.valid) {
|
|
272
907
|
return undefined;
|
|
273
908
|
}
|
|
274
|
-
const { reason,
|
|
275
|
-
const
|
|
909
|
+
const { reason, checkpoint } = validationResult;
|
|
910
|
+
const checkpointNumber = checkpoint.checkpointNumber;
|
|
276
911
|
const logData = {
|
|
277
|
-
...
|
|
912
|
+
...checkpoint,
|
|
278
913
|
reason
|
|
279
914
|
};
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
this.log.verbose(`Skipping
|
|
283
|
-
|
|
915
|
+
const currentCheckpointNumber = await this.rollupContract.getCheckpointNumber();
|
|
916
|
+
if (currentCheckpointNumber < checkpointNumber) {
|
|
917
|
+
this.log.verbose(`Skipping checkpoint ${checkpointNumber} invalidation since it has already been removed from the pending chain`, {
|
|
918
|
+
currentCheckpointNumber,
|
|
284
919
|
...logData
|
|
285
920
|
});
|
|
286
921
|
return undefined;
|
|
287
922
|
}
|
|
288
|
-
const request = this.
|
|
289
|
-
this.log.debug(`Simulating invalidate
|
|
923
|
+
const request = this.buildInvalidateCheckpointRequest(validationResult);
|
|
924
|
+
this.log.debug(`Simulating invalidate checkpoint ${checkpointNumber}`, {
|
|
290
925
|
...logData,
|
|
291
926
|
request
|
|
292
927
|
});
|
|
928
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
293
929
|
try {
|
|
294
|
-
const { gasUsed } = await this.l1TxUtils.simulate(request, undefined, undefined,
|
|
295
|
-
|
|
930
|
+
const { gasUsed } = await this.l1TxUtils.simulate(request, undefined, undefined, mergeAbis([
|
|
931
|
+
request.abi ?? [],
|
|
932
|
+
ErrorsAbi
|
|
933
|
+
]));
|
|
934
|
+
this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} succeeded`, {
|
|
296
935
|
...logData,
|
|
297
936
|
request,
|
|
298
937
|
gasUsed
|
|
@@ -300,91 +939,94 @@ export class SequencerPublisher {
|
|
|
300
939
|
return {
|
|
301
940
|
request,
|
|
302
941
|
gasUsed,
|
|
303
|
-
|
|
304
|
-
|
|
942
|
+
checkpointNumber,
|
|
943
|
+
forcePendingCheckpointNumber: CheckpointNumber(checkpointNumber - 1),
|
|
305
944
|
reason
|
|
306
945
|
};
|
|
307
946
|
} catch (err) {
|
|
308
947
|
const viemError = formatViemError(err);
|
|
309
|
-
// If the error is due to the
|
|
310
|
-
// we can safely ignore it and return undefined so we go ahead with
|
|
311
|
-
if (viemError.message?.includes('
|
|
312
|
-
this.log.verbose(`Simulation for invalidate
|
|
948
|
+
// If the error is due to the checkpoint not being in the pending chain, and it was indeed removed by someone else,
|
|
949
|
+
// we can safely ignore it and return undefined so we go ahead with checkpoint building.
|
|
950
|
+
if (viemError.message?.includes('Rollup__CheckpointNotInPendingChain')) {
|
|
951
|
+
this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`, {
|
|
313
952
|
...logData,
|
|
314
953
|
request,
|
|
315
954
|
error: viemError.message
|
|
316
955
|
});
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
this.log.verbose(`
|
|
956
|
+
const latestPendingCheckpointNumber = await this.rollupContract.getCheckpointNumber();
|
|
957
|
+
if (latestPendingCheckpointNumber < checkpointNumber) {
|
|
958
|
+
this.log.verbose(`Checkpoint ${checkpointNumber} has already been invalidated`, {
|
|
320
959
|
...logData
|
|
321
960
|
});
|
|
322
961
|
return undefined;
|
|
323
962
|
} else {
|
|
324
|
-
this.log.error(`Simulation for invalidate ${
|
|
325
|
-
throw new Error(`Failed to simulate invalidate
|
|
963
|
+
this.log.error(`Simulation for invalidate checkpoint ${checkpointNumber} failed and it is still in pending chain`, viemError, logData);
|
|
964
|
+
throw new Error(`Failed to simulate invalidate checkpoint ${checkpointNumber} while it is still in pending chain`, {
|
|
326
965
|
cause: viemError
|
|
327
966
|
});
|
|
328
967
|
}
|
|
329
968
|
}
|
|
330
|
-
// Otherwise, throw. We cannot build the next
|
|
331
|
-
this.log.error(`Simulation for invalidate
|
|
332
|
-
|
|
969
|
+
// Otherwise, throw. We cannot build the next checkpoint if we cannot invalidate the previous one.
|
|
970
|
+
this.log.error(`Simulation for invalidate checkpoint ${checkpointNumber} failed`, viemError, logData);
|
|
971
|
+
this.backupFailedTx({
|
|
972
|
+
id: keccak256(request.data),
|
|
973
|
+
failureType: 'simulation',
|
|
974
|
+
request: {
|
|
975
|
+
to: request.to,
|
|
976
|
+
data: request.data,
|
|
977
|
+
value: request.value?.toString()
|
|
978
|
+
},
|
|
979
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
980
|
+
error: {
|
|
981
|
+
message: viemError.message,
|
|
982
|
+
name: viemError.name
|
|
983
|
+
},
|
|
984
|
+
context: {
|
|
985
|
+
actions: [
|
|
986
|
+
`invalidate-${reason}`
|
|
987
|
+
],
|
|
988
|
+
checkpointNumber,
|
|
989
|
+
sender: this.getSenderAddress().toString()
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
throw new Error(`Failed to simulate invalidate checkpoint ${checkpointNumber}`, {
|
|
333
993
|
cause: viemError
|
|
334
994
|
});
|
|
335
995
|
}
|
|
336
996
|
}
|
|
337
|
-
|
|
997
|
+
buildInvalidateCheckpointRequest(validationResult) {
|
|
338
998
|
if (validationResult.valid) {
|
|
339
|
-
throw new Error('Cannot invalidate a valid
|
|
999
|
+
throw new Error('Cannot invalidate a valid checkpoint');
|
|
340
1000
|
}
|
|
341
|
-
const {
|
|
1001
|
+
const { checkpoint, committee, reason } = validationResult;
|
|
342
1002
|
const logData = {
|
|
343
|
-
...
|
|
1003
|
+
...checkpoint,
|
|
344
1004
|
reason
|
|
345
1005
|
};
|
|
346
|
-
this.log.debug(`
|
|
1006
|
+
this.log.debug(`Building invalidate checkpoint ${checkpoint.checkpointNumber} request`, logData);
|
|
347
1007
|
const attestationsAndSigners = new CommitteeAttestationsAndSigners(validationResult.attestations).getPackedAttestations();
|
|
348
1008
|
if (reason === 'invalid-attestation') {
|
|
349
|
-
return this.rollupContract.buildInvalidateBadAttestationRequest(
|
|
1009
|
+
return this.rollupContract.buildInvalidateBadAttestationRequest(checkpoint.checkpointNumber, attestationsAndSigners, committee, validationResult.invalidIndex);
|
|
350
1010
|
} else if (reason === 'insufficient-attestations') {
|
|
351
|
-
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(
|
|
1011
|
+
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(checkpoint.checkpointNumber, attestationsAndSigners, committee);
|
|
352
1012
|
} else {
|
|
353
1013
|
const _ = reason;
|
|
354
1014
|
throw new Error(`Unknown reason for invalidation`);
|
|
355
1015
|
}
|
|
356
1016
|
}
|
|
357
|
-
/**
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
* @param attestationData - The block's attestation data
|
|
364
|
-
*
|
|
365
|
-
*/ async validateBlockForSubmission(block, attestationsAndSigners, attestationsAndSignersSignature, options) {
|
|
366
|
-
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
367
|
-
// If we have no attestations, we still need to provide the empty attestations
|
|
368
|
-
// so that the committee is recalculated correctly
|
|
369
|
-
const ignoreSignatures = attestationsAndSigners.attestations.length === 0;
|
|
370
|
-
if (ignoreSignatures) {
|
|
371
|
-
const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber.toBigInt());
|
|
372
|
-
if (!committee) {
|
|
373
|
-
this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
374
|
-
throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
375
|
-
}
|
|
376
|
-
attestationsAndSigners.attestations = committee.map((committeeMember)=>CommitteeAttestation.fromAddress(committeeMember));
|
|
377
|
-
}
|
|
378
|
-
const blobFields = block.getCheckpointBlobFields();
|
|
379
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
1017
|
+
/** Simulates `propose` to make sure that the checkpoint is valid for submission */ async validateCheckpointForSubmission(checkpoint, attestationsAndSigners, attestationsAndSignersSignature, options) {
|
|
1018
|
+
// Anchor the simulation timestamp to the checkpoint's own slot start time
|
|
1019
|
+
// rather than the current L1 block timestamp, which may overshoot into the next slot if the build ran late.
|
|
1020
|
+
const ts = checkpoint.header.timestamp;
|
|
1021
|
+
const blobFields = checkpoint.toBlobFields();
|
|
1022
|
+
const blobs = await getBlobsPerL1Block(blobFields);
|
|
380
1023
|
const blobInput = getPrefixedEthBlobCommitments(blobs);
|
|
381
1024
|
const args = [
|
|
382
1025
|
{
|
|
383
|
-
header:
|
|
384
|
-
archive: toHex(
|
|
385
|
-
stateReference: block.header.state.toViem(),
|
|
1026
|
+
header: checkpoint.header.toViem(),
|
|
1027
|
+
archive: toHex(checkpoint.archive.root.toBuffer()),
|
|
386
1028
|
oracleInput: {
|
|
387
|
-
feeAssetPriceModifier:
|
|
1029
|
+
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier
|
|
388
1030
|
}
|
|
389
1031
|
},
|
|
390
1032
|
attestationsAndSigners.getPackedAttestations(),
|
|
@@ -409,9 +1051,38 @@ export class SequencerPublisher {
|
|
|
409
1051
|
}
|
|
410
1052
|
const round = await base.computeRound(slotNumber);
|
|
411
1053
|
const roundInfo = await base.getRoundInfo(this.rollupContract.address, round);
|
|
1054
|
+
if (roundInfo.quorumReached) {
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
412
1057
|
if (roundInfo.lastSignalSlot >= slotNumber) {
|
|
413
1058
|
return false;
|
|
414
1059
|
}
|
|
1060
|
+
if (await this.isPayloadEmpty(payload)) {
|
|
1061
|
+
this.log.warn(`Skipping vote cast for payload with empty code`);
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
// Check if payload was already submitted to governance
|
|
1065
|
+
const cacheKey = payload.toString();
|
|
1066
|
+
if (!this.payloadProposedCache.has(cacheKey)) {
|
|
1067
|
+
try {
|
|
1068
|
+
const l1StartBlock = await this.rollupContract.getL1StartBlock();
|
|
1069
|
+
const proposed = await retry(()=>base.hasPayloadBeenProposed(payload.toString(), l1StartBlock), 'Check if payload was proposed', makeBackoff([
|
|
1070
|
+
0,
|
|
1071
|
+
1,
|
|
1072
|
+
2
|
|
1073
|
+
]), this.log, true);
|
|
1074
|
+
if (proposed) {
|
|
1075
|
+
this.payloadProposedCache.add(cacheKey);
|
|
1076
|
+
}
|
|
1077
|
+
} catch (err) {
|
|
1078
|
+
this.log.warn(`Failed to check if payload ${payload} was proposed after retries, skipping signal`, err);
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if (this.payloadProposedCache.has(cacheKey)) {
|
|
1083
|
+
this.log.info(`Payload ${payload} was already proposed to governance, stopping signals`);
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
415
1086
|
const cachedLastVote = this.lastActions[signalType];
|
|
416
1087
|
this.lastActions[signalType] = slotNumber;
|
|
417
1088
|
const action = signalType;
|
|
@@ -422,15 +1093,41 @@ export class SequencerPublisher {
|
|
|
422
1093
|
signer: this.l1TxUtils.client.account?.address,
|
|
423
1094
|
lastValidL2Slot: slotNumber
|
|
424
1095
|
});
|
|
1096
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
425
1097
|
try {
|
|
426
1098
|
await this.l1TxUtils.simulate(request, {
|
|
427
1099
|
time: timestamp
|
|
428
|
-
}, [],
|
|
1100
|
+
}, [], mergeAbis([
|
|
1101
|
+
request.abi ?? [],
|
|
1102
|
+
ErrorsAbi
|
|
1103
|
+
]));
|
|
429
1104
|
this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, {
|
|
430
1105
|
request
|
|
431
1106
|
});
|
|
432
1107
|
} catch (err) {
|
|
433
|
-
|
|
1108
|
+
const viemError = formatViemError(err);
|
|
1109
|
+
this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, viemError);
|
|
1110
|
+
this.backupFailedTx({
|
|
1111
|
+
id: keccak256(request.data),
|
|
1112
|
+
failureType: 'simulation',
|
|
1113
|
+
request: {
|
|
1114
|
+
to: request.to,
|
|
1115
|
+
data: request.data,
|
|
1116
|
+
value: request.value?.toString()
|
|
1117
|
+
},
|
|
1118
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
1119
|
+
error: {
|
|
1120
|
+
message: viemError.message,
|
|
1121
|
+
name: viemError.name
|
|
1122
|
+
},
|
|
1123
|
+
context: {
|
|
1124
|
+
actions: [
|
|
1125
|
+
action
|
|
1126
|
+
],
|
|
1127
|
+
slot: slotNumber,
|
|
1128
|
+
sender: this.getSenderAddress().toString()
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
434
1131
|
// Yes, we enqueue the request anyway, in case there was a bug with the simulation itself
|
|
435
1132
|
}
|
|
436
1133
|
// TODO(palla/slash): All votes (governance and slashing) should txTimeoutAt at the end of the slot.
|
|
@@ -450,17 +1147,27 @@ export class SequencerPublisher {
|
|
|
450
1147
|
payload: payload.toString()
|
|
451
1148
|
};
|
|
452
1149
|
if (!success) {
|
|
453
|
-
this.log.error(`Signaling in
|
|
1150
|
+
this.log.error(`Signaling in ${action} for ${payload} at slot ${slotNumber} in round ${round} failed`, logData);
|
|
454
1151
|
this.lastActions[signalType] = cachedLastVote;
|
|
455
1152
|
return false;
|
|
456
1153
|
} else {
|
|
457
|
-
this.log.info(`Signaling in
|
|
1154
|
+
this.log.info(`Signaling in ${action} for ${payload} at slot ${slotNumber} in round ${round} succeeded`, logData);
|
|
458
1155
|
return true;
|
|
459
1156
|
}
|
|
460
1157
|
}
|
|
461
1158
|
});
|
|
462
1159
|
return true;
|
|
463
1160
|
}
|
|
1161
|
+
async isPayloadEmpty(payload) {
|
|
1162
|
+
const key = payload.toString();
|
|
1163
|
+
const cached = this.isPayloadEmptyCache.get(key);
|
|
1164
|
+
if (cached) {
|
|
1165
|
+
return cached;
|
|
1166
|
+
}
|
|
1167
|
+
const isEmpty = !await this.l1TxUtils.getCode(payload);
|
|
1168
|
+
this.isPayloadEmptyCache.set(key, isEmpty);
|
|
1169
|
+
return isEmpty;
|
|
1170
|
+
}
|
|
464
1171
|
/**
|
|
465
1172
|
* Enqueues a governance castSignal transaction to cast a signal for a given slot number.
|
|
466
1173
|
* @param slotNumber - The slot number to cast a signal for.
|
|
@@ -556,23 +1263,17 @@ export class SequencerPublisher {
|
|
|
556
1263
|
}
|
|
557
1264
|
return true;
|
|
558
1265
|
}
|
|
559
|
-
/**
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
564
|
-
*/ async enqueueProposeL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, opts = {}) {
|
|
565
|
-
const checkpointHeader = block.getCheckpointHeader();
|
|
566
|
-
const blobFields = block.getCheckpointBlobFields();
|
|
567
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
1266
|
+
/** Simulates and enqueues a proposal for a checkpoint on L1 */ async enqueueProposeCheckpoint(checkpoint, attestationsAndSigners, attestationsAndSignersSignature, opts = {}) {
|
|
1267
|
+
const checkpointHeader = checkpoint.header;
|
|
1268
|
+
const blobFields = checkpoint.toBlobFields();
|
|
1269
|
+
const blobs = await getBlobsPerL1Block(blobFields);
|
|
568
1270
|
const proposeTxArgs = {
|
|
569
1271
|
header: checkpointHeader,
|
|
570
|
-
archive:
|
|
571
|
-
stateReference: block.header.state,
|
|
572
|
-
body: block.body.toBuffer(),
|
|
1272
|
+
archive: checkpoint.archive.root.toBuffer(),
|
|
573
1273
|
blobs,
|
|
574
1274
|
attestationsAndSigners,
|
|
575
|
-
attestationsAndSignersSignature
|
|
1275
|
+
attestationsAndSignersSignature,
|
|
1276
|
+
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier
|
|
576
1277
|
};
|
|
577
1278
|
let ts;
|
|
578
1279
|
try {
|
|
@@ -581,36 +1282,35 @@ export class SequencerPublisher {
|
|
|
581
1282
|
// By simulation issue, I mean the fact that the block.timestamp is equal to the last block, not the next, which
|
|
582
1283
|
// make time consistency checks break.
|
|
583
1284
|
// TODO(palla): Check whether we're validating twice, once here and once within addProposeTx, since we call simulateProposeTx in both places.
|
|
584
|
-
ts = await this.
|
|
1285
|
+
ts = await this.validateCheckpointForSubmission(checkpoint, attestationsAndSigners, attestationsAndSignersSignature, opts);
|
|
585
1286
|
} catch (err) {
|
|
586
|
-
this.log.error(`
|
|
587
|
-
...
|
|
588
|
-
slotNumber:
|
|
589
|
-
|
|
1287
|
+
this.log.error(`Checkpoint validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
1288
|
+
...checkpoint.getStats(),
|
|
1289
|
+
slotNumber: checkpoint.header.slotNumber,
|
|
1290
|
+
forcePendingCheckpointNumber: opts.forcePendingCheckpointNumber
|
|
590
1291
|
});
|
|
591
1292
|
throw err;
|
|
592
1293
|
}
|
|
593
|
-
this.log.verbose(`Enqueuing
|
|
594
|
-
...
|
|
1294
|
+
this.log.verbose(`Enqueuing checkpoint propose transaction`, {
|
|
1295
|
+
...checkpoint.toCheckpointInfo(),
|
|
595
1296
|
...opts
|
|
596
1297
|
});
|
|
597
|
-
await this.addProposeTx(
|
|
598
|
-
return true;
|
|
1298
|
+
await this.addProposeTx(checkpoint, proposeTxArgs, opts, ts);
|
|
599
1299
|
}
|
|
600
|
-
|
|
1300
|
+
enqueueInvalidateCheckpoint(request, opts = {}) {
|
|
601
1301
|
if (!request) {
|
|
602
1302
|
return;
|
|
603
1303
|
}
|
|
604
1304
|
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
605
1305
|
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil(Number(request.gasUsed) * 64 / 63)));
|
|
606
|
-
const { gasUsed,
|
|
1306
|
+
const { gasUsed, checkpointNumber } = request;
|
|
607
1307
|
const logData = {
|
|
608
1308
|
gasUsed,
|
|
609
|
-
|
|
1309
|
+
checkpointNumber,
|
|
610
1310
|
gasLimit,
|
|
611
1311
|
opts
|
|
612
1312
|
};
|
|
613
|
-
this.log.verbose(`Enqueuing invalidate
|
|
1313
|
+
this.log.verbose(`Enqueuing invalidate checkpoint request`, logData);
|
|
614
1314
|
this.addRequest({
|
|
615
1315
|
action: `invalidate-by-${request.reason}`,
|
|
616
1316
|
request: request.request,
|
|
@@ -618,16 +1318,16 @@ export class SequencerPublisher {
|
|
|
618
1318
|
gasLimit,
|
|
619
1319
|
txTimeoutAt: opts.txTimeoutAt
|
|
620
1320
|
},
|
|
621
|
-
lastValidL2Slot: this.getCurrentL2Slot() +
|
|
1321
|
+
lastValidL2Slot: SlotNumber(this.getCurrentL2Slot() + 2),
|
|
622
1322
|
checkSuccess: (_req, result)=>{
|
|
623
|
-
const success = result && result.receipt && result.receipt.status === 'success' && tryExtractEvent(result.receipt.logs, this.rollupContract.address, RollupAbi, '
|
|
1323
|
+
const success = result && result.receipt && result.receipt.status === 'success' && tryExtractEvent(result.receipt.logs, this.rollupContract.address, RollupAbi, 'CheckpointInvalidated');
|
|
624
1324
|
if (!success) {
|
|
625
|
-
this.log.warn(`Invalidate
|
|
1325
|
+
this.log.warn(`Invalidate checkpoint ${request.checkpointNumber} failed`, {
|
|
626
1326
|
...result,
|
|
627
1327
|
...logData
|
|
628
1328
|
});
|
|
629
1329
|
} else {
|
|
630
|
-
this.log.info(`Invalidate
|
|
1330
|
+
this.log.info(`Invalidate checkpoint ${request.checkpointNumber} succeeded`, {
|
|
631
1331
|
...result,
|
|
632
1332
|
...logData
|
|
633
1333
|
});
|
|
@@ -649,28 +1349,60 @@ export class SequencerPublisher {
|
|
|
649
1349
|
const cachedLastActionSlot = this.lastActions[action];
|
|
650
1350
|
this.lastActions[action] = slotNumber;
|
|
651
1351
|
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
1352
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
652
1353
|
let gasUsed;
|
|
1354
|
+
const simulateAbi = mergeAbis([
|
|
1355
|
+
request.abi ?? [],
|
|
1356
|
+
ErrorsAbi
|
|
1357
|
+
]);
|
|
653
1358
|
try {
|
|
654
1359
|
({ gasUsed } = await this.l1TxUtils.simulate(request, {
|
|
655
1360
|
time: timestamp
|
|
656
|
-
}, [],
|
|
1361
|
+
}, [], simulateAbi)); // TODO(palla/slash): Check the timestamp logic
|
|
657
1362
|
this.log.verbose(`Simulation for ${action} succeeded`, {
|
|
658
1363
|
...logData,
|
|
659
1364
|
request,
|
|
660
1365
|
gasUsed
|
|
661
1366
|
});
|
|
662
1367
|
} catch (err) {
|
|
663
|
-
const viemError = formatViemError(err);
|
|
1368
|
+
const viemError = formatViemError(err, simulateAbi);
|
|
664
1369
|
this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
|
|
1370
|
+
this.backupFailedTx({
|
|
1371
|
+
id: keccak256(request.data),
|
|
1372
|
+
failureType: 'simulation',
|
|
1373
|
+
request: {
|
|
1374
|
+
to: request.to,
|
|
1375
|
+
data: request.data,
|
|
1376
|
+
value: request.value?.toString()
|
|
1377
|
+
},
|
|
1378
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
1379
|
+
error: {
|
|
1380
|
+
message: viemError.message,
|
|
1381
|
+
name: viemError.name
|
|
1382
|
+
},
|
|
1383
|
+
context: {
|
|
1384
|
+
actions: [
|
|
1385
|
+
action
|
|
1386
|
+
],
|
|
1387
|
+
slot: slotNumber,
|
|
1388
|
+
sender: this.getSenderAddress().toString()
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
665
1391
|
return false;
|
|
666
1392
|
}
|
|
667
1393
|
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
668
1394
|
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil(Number(gasUsed) * 64 / 63)));
|
|
669
1395
|
logData.gasLimit = gasLimit;
|
|
1396
|
+
// Store the ABI used for simulation on the request so Multicall3.forward can decode errors
|
|
1397
|
+
// when the tx is sent and a revert is diagnosed via simulation.
|
|
1398
|
+
const requestWithAbi = {
|
|
1399
|
+
...request,
|
|
1400
|
+
abi: simulateAbi
|
|
1401
|
+
};
|
|
670
1402
|
this.log.debug(`Enqueuing ${action}`, logData);
|
|
671
1403
|
this.addRequest({
|
|
672
1404
|
action,
|
|
673
|
-
request,
|
|
1405
|
+
request: requestWithAbi,
|
|
674
1406
|
gasConfig: {
|
|
675
1407
|
gasLimit
|
|
676
1408
|
},
|
|
@@ -713,34 +1445,70 @@ export class SequencerPublisher {
|
|
|
713
1445
|
this.log.debug('Validating blob input', {
|
|
714
1446
|
blobInput
|
|
715
1447
|
});
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
1448
|
+
// Get blob evaluation gas
|
|
1449
|
+
let blobEvaluationGas;
|
|
1450
|
+
if (this.config.fishermanMode) {
|
|
1451
|
+
// In fisherman mode, we can't estimate blob gas because estimateGas doesn't support state overrides
|
|
1452
|
+
// Use a fixed estimate.
|
|
1453
|
+
blobEvaluationGas = BigInt(encodedData.blobs.length) * 21_000n;
|
|
1454
|
+
this.log.debug(`Using fixed blob evaluation gas estimate in fisherman mode: ${blobEvaluationGas}`);
|
|
1455
|
+
} else {
|
|
1456
|
+
// Normal mode - use estimateGas with blob inputs
|
|
1457
|
+
blobEvaluationGas = await this.l1TxUtils.estimateGas(this.getSenderAddress().toString(), {
|
|
1458
|
+
to: this.rollupContract.address,
|
|
1459
|
+
data: encodeFunctionData({
|
|
1460
|
+
abi: RollupAbi,
|
|
1461
|
+
functionName: 'validateBlobs',
|
|
1462
|
+
args: [
|
|
1463
|
+
blobInput
|
|
1464
|
+
]
|
|
1465
|
+
})
|
|
1466
|
+
}, {}, {
|
|
1467
|
+
blobs: encodedData.blobs.map((b)=>b.data),
|
|
1468
|
+
kzg
|
|
1469
|
+
}).catch(async (err)=>{
|
|
1470
|
+
const viemError = formatViemError(err);
|
|
1471
|
+
this.log.error(`Failed to validate blobs`, viemError.message, {
|
|
1472
|
+
metaMessages: viemError.metaMessages
|
|
1473
|
+
});
|
|
1474
|
+
const validateBlobsData = encodeFunctionData({
|
|
1475
|
+
abi: RollupAbi,
|
|
1476
|
+
functionName: 'validateBlobs',
|
|
1477
|
+
args: [
|
|
1478
|
+
blobInput
|
|
1479
|
+
]
|
|
1480
|
+
});
|
|
1481
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1482
|
+
this.backupFailedTx({
|
|
1483
|
+
id: keccak256(validateBlobsData),
|
|
1484
|
+
failureType: 'simulation',
|
|
1485
|
+
request: {
|
|
1486
|
+
to: this.rollupContract.address,
|
|
1487
|
+
data: validateBlobsData
|
|
1488
|
+
},
|
|
1489
|
+
blobData: encodedData.blobs.map((b)=>toHex(b.data)),
|
|
1490
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
1491
|
+
error: {
|
|
1492
|
+
message: viemError.message,
|
|
1493
|
+
name: viemError.name
|
|
1494
|
+
},
|
|
1495
|
+
context: {
|
|
1496
|
+
actions: [
|
|
1497
|
+
'validate-blobs'
|
|
1498
|
+
],
|
|
1499
|
+
sender: this.getSenderAddress().toString()
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
throw new Error('Failed to validate blobs');
|
|
732
1503
|
});
|
|
733
|
-
|
|
734
|
-
});
|
|
1504
|
+
}
|
|
735
1505
|
const signers = encodedData.attestationsAndSigners.getSigners().map((signer)=>signer.toString());
|
|
736
1506
|
const args = [
|
|
737
1507
|
{
|
|
738
1508
|
header: encodedData.header.toViem(),
|
|
739
1509
|
archive: toHex(encodedData.archive),
|
|
740
|
-
stateReference: encodedData.stateReference.toViem(),
|
|
741
1510
|
oracleInput: {
|
|
742
|
-
|
|
743
|
-
feeAssetPriceModifier: 0n
|
|
1511
|
+
feeAssetPriceModifier: encodedData.feeAssetPriceModifier
|
|
744
1512
|
}
|
|
745
1513
|
},
|
|
746
1514
|
encodedData.attestationsAndSigners.getPackedAttestations(),
|
|
@@ -767,18 +1535,9 @@ export class SequencerPublisher {
|
|
|
767
1535
|
functionName: 'propose',
|
|
768
1536
|
args
|
|
769
1537
|
});
|
|
770
|
-
// override the pending
|
|
771
|
-
const
|
|
772
|
-
const
|
|
773
|
-
to: this.rollupContract.address,
|
|
774
|
-
data: rollupData,
|
|
775
|
-
gas: SequencerPublisher.PROPOSE_GAS_GUESS
|
|
776
|
-
}, {
|
|
777
|
-
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
778
|
-
time: timestamp + 1n,
|
|
779
|
-
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
780
|
-
gasLimit: SequencerPublisher.PROPOSE_GAS_GUESS * 2n
|
|
781
|
-
}, [
|
|
1538
|
+
// override the pending checkpoint number if requested
|
|
1539
|
+
const forcePendingCheckpointNumberStateDiff = (options.forcePendingCheckpointNumber !== undefined ? await this.rollupContract.makePendingCheckpointNumberOverride(options.forcePendingCheckpointNumber) : []).flatMap((override)=>override.stateDiff ?? []);
|
|
1540
|
+
const stateOverrides = [
|
|
782
1541
|
{
|
|
783
1542
|
address: this.rollupContract.address,
|
|
784
1543
|
// @note we override checkBlob to false since blobs are not part simulate()
|
|
@@ -787,14 +1546,65 @@ export class SequencerPublisher {
|
|
|
787
1546
|
slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true),
|
|
788
1547
|
value: toPaddedHex(0n, true)
|
|
789
1548
|
},
|
|
790
|
-
...
|
|
1549
|
+
...forcePendingCheckpointNumberStateDiff
|
|
791
1550
|
]
|
|
792
1551
|
}
|
|
793
|
-
]
|
|
1552
|
+
];
|
|
1553
|
+
// In fisherman mode, simulate as the proposer but with sufficient balance
|
|
1554
|
+
if (this.proposerAddressForSimulation) {
|
|
1555
|
+
stateOverrides.push({
|
|
1556
|
+
address: this.proposerAddressForSimulation.toString(),
|
|
1557
|
+
balance: 10n * WEI_CONST * WEI_CONST
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1561
|
+
const simulationResult = await this.l1TxUtils.simulate({
|
|
1562
|
+
to: this.rollupContract.address,
|
|
1563
|
+
data: rollupData,
|
|
1564
|
+
gas: MAX_L1_TX_LIMIT,
|
|
1565
|
+
...this.proposerAddressForSimulation && {
|
|
1566
|
+
from: this.proposerAddressForSimulation.toString()
|
|
1567
|
+
}
|
|
1568
|
+
}, {
|
|
1569
|
+
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
1570
|
+
time: timestamp + 1n,
|
|
1571
|
+
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
1572
|
+
gasLimit: MAX_L1_TX_LIMIT * 2n
|
|
1573
|
+
}, stateOverrides, RollupAbi, {
|
|
794
1574
|
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
795
|
-
fallbackGasEstimate:
|
|
1575
|
+
fallbackGasEstimate: MAX_L1_TX_LIMIT
|
|
796
1576
|
}).catch((err)=>{
|
|
797
|
-
|
|
1577
|
+
// In fisherman mode, we expect ValidatorSelection__MissingProposerSignature since fisherman doesn't have proposer signature
|
|
1578
|
+
const viemError = formatViemError(err);
|
|
1579
|
+
if (this.config.fishermanMode && viemError.message?.includes('ValidatorSelection__MissingProposerSignature')) {
|
|
1580
|
+
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
1581
|
+
// Return a minimal simulation result with the fallback gas estimate
|
|
1582
|
+
return {
|
|
1583
|
+
gasUsed: MAX_L1_TX_LIMIT,
|
|
1584
|
+
logs: []
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
this.log.error(`Failed to simulate propose tx`, viemError);
|
|
1588
|
+
this.backupFailedTx({
|
|
1589
|
+
id: keccak256(rollupData),
|
|
1590
|
+
failureType: 'simulation',
|
|
1591
|
+
request: {
|
|
1592
|
+
to: this.rollupContract.address,
|
|
1593
|
+
data: rollupData
|
|
1594
|
+
},
|
|
1595
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
1596
|
+
error: {
|
|
1597
|
+
message: viemError.message,
|
|
1598
|
+
name: viemError.name
|
|
1599
|
+
},
|
|
1600
|
+
context: {
|
|
1601
|
+
actions: [
|
|
1602
|
+
'propose'
|
|
1603
|
+
],
|
|
1604
|
+
slot: Number(args[0].header.slotNumber),
|
|
1605
|
+
sender: this.getSenderAddress().toString()
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
798
1608
|
throw err;
|
|
799
1609
|
});
|
|
800
1610
|
return {
|
|
@@ -802,24 +1612,25 @@ export class SequencerPublisher {
|
|
|
802
1612
|
simulationResult
|
|
803
1613
|
};
|
|
804
1614
|
}
|
|
805
|
-
async addProposeTx(
|
|
1615
|
+
async addProposeTx(checkpoint, encodedData, opts = {}, timestamp) {
|
|
1616
|
+
const slot = checkpoint.header.slotNumber;
|
|
806
1617
|
const timer = new Timer();
|
|
807
1618
|
const kzg = Blob.getViemKzgInstance();
|
|
808
1619
|
const { rollupData, simulationResult, blobEvaluationGas } = await this.prepareProposeTx(encodedData, timestamp, opts);
|
|
809
1620
|
const startBlock = await this.l1TxUtils.getBlockNumber();
|
|
810
1621
|
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil(Number(simulationResult.gasUsed) * 64 / 63)) + blobEvaluationGas + SequencerPublisher.MULTICALL_OVERHEAD_GAS_GUESS);
|
|
811
|
-
// Send the blobs to the blob
|
|
812
|
-
// tx fails but it does get mined. We make sure that the blobs are sent to the blob
|
|
813
|
-
void this.
|
|
814
|
-
|
|
815
|
-
|
|
1622
|
+
// Send the blobs to the blob client preemptively. This helps in tests where the sequencer mistakingly thinks that the propose
|
|
1623
|
+
// tx fails but it does get mined. We make sure that the blobs are sent to the blob client regardless of the tx outcome.
|
|
1624
|
+
void Promise.resolve().then(()=>this.blobClient.sendBlobsToFilestore(encodedData.blobs).catch((_err)=>{
|
|
1625
|
+
this.log.error('Failed to send blobs to blob client');
|
|
1626
|
+
}));
|
|
816
1627
|
return this.addRequest({
|
|
817
1628
|
action: 'propose',
|
|
818
1629
|
request: {
|
|
819
1630
|
to: this.rollupContract.address,
|
|
820
1631
|
data: rollupData
|
|
821
1632
|
},
|
|
822
|
-
lastValidL2Slot:
|
|
1633
|
+
lastValidL2Slot: checkpoint.header.slotNumber,
|
|
823
1634
|
gasConfig: {
|
|
824
1635
|
...opts,
|
|
825
1636
|
gasLimit
|
|
@@ -833,7 +1644,7 @@ export class SequencerPublisher {
|
|
|
833
1644
|
return false;
|
|
834
1645
|
}
|
|
835
1646
|
const { receipt, stats, errorMsg } = result;
|
|
836
|
-
const success = receipt && receipt.status === 'success' && tryExtractEvent(receipt.logs, this.rollupContract.address, RollupAbi, '
|
|
1647
|
+
const success = receipt && receipt.status === 'success' && tryExtractEvent(receipt.logs, this.rollupContract.address, RollupAbi, 'CheckpointProposed');
|
|
837
1648
|
if (success) {
|
|
838
1649
|
const endBlock = receipt.blockNumber;
|
|
839
1650
|
const inclusionBlocks = Number(endBlock - startBlock);
|
|
@@ -847,25 +1658,23 @@ export class SequencerPublisher {
|
|
|
847
1658
|
calldataGas,
|
|
848
1659
|
calldataSize,
|
|
849
1660
|
sender,
|
|
850
|
-
...
|
|
1661
|
+
...checkpoint.getStats(),
|
|
851
1662
|
eventName: 'rollup-published-to-l1',
|
|
852
1663
|
blobCount: encodedData.blobs.length,
|
|
853
1664
|
inclusionBlocks
|
|
854
1665
|
};
|
|
855
|
-
this.log.info(`Published
|
|
1666
|
+
this.log.info(`Published checkpoint ${checkpoint.number} at slot ${slot} to rollup contract`, {
|
|
856
1667
|
...stats,
|
|
857
|
-
...
|
|
858
|
-
...receipt
|
|
1668
|
+
...checkpoint.getStats(),
|
|
1669
|
+
...pick(receipt, 'transactionHash', 'blockHash')
|
|
859
1670
|
});
|
|
860
1671
|
this.metrics.recordProcessBlockTx(timer.ms(), publishStats);
|
|
861
1672
|
return true;
|
|
862
1673
|
} else {
|
|
863
1674
|
this.metrics.recordFailedTx('process');
|
|
864
|
-
this.log.error(`
|
|
865
|
-
...
|
|
866
|
-
receipt
|
|
867
|
-
txHash: receipt.transactionHash,
|
|
868
|
-
slotNumber: block.header.globalVariables.slotNumber.toBigInt()
|
|
1675
|
+
this.log.error(`Publishing checkpoint at slot ${slot} failed with ${errorMsg ?? 'no error message'}`, undefined, {
|
|
1676
|
+
...checkpoint.getStats(),
|
|
1677
|
+
...receipt
|
|
869
1678
|
});
|
|
870
1679
|
return false;
|
|
871
1680
|
}
|