@aztec/ethereum 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/account.d.ts +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +2 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +6 -2
- package/dest/config.d.ts +18 -46
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +40 -285
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +8 -6
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +8 -6
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +18 -3
- package/dest/contracts/errors.d.ts +1 -1
- package/dest/contracts/errors.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +4 -4
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +16 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +7 -3
- package/dest/contracts/governance_proposer.d.ts +7 -6
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +400 -12
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +7 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +4 -0
- package/dest/contracts/index.d.ts +1 -1
- package/dest/contracts/multicall.d.ts +5 -7
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +6 -4
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +169 -118
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +714 -243
- package/dest/contracts/slasher_contract.d.ts +11 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/slasher_contract.js +18 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +15 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +15 -5
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +247 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +336 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- package/dest/eth-signer/eth-signer.d.ts +1 -1
- package/dest/eth-signer/index.d.ts +1 -1
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/l1_artifacts.d.ts +17733 -6280
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +10 -5
- package/dest/l1_contract_addresses.d.ts +8 -4
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +5 -4
- package/dest/l1_reader.d.ts +4 -2
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +7 -1
- package/dest/l1_tx_utils/config.d.ts +59 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +96 -0
- package/dest/l1_tx_utils/constants.d.ts +12 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +39 -0
- package/dest/l1_tx_utils/factory.d.ts +24 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +12 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +12 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +94 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +623 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +83 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +323 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/l1_types.d.ts +1 -1
- package/dest/publisher_manager.d.ts +8 -3
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +36 -8
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +20 -14
- package/dest/test/chain_monitor.d.ts +29 -22
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +81 -38
- package/dest/test/delayed_tx_utils.d.ts +3 -3
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +2 -2
- package/dest/test/eth_cheat_codes.d.ts +36 -14
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +126 -31
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -1
- package/dest/test/rollup_cheat_codes.d.ts +23 -20
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +82 -43
- package/dest/test/start_anvil.d.ts +4 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +2 -1
- package/dest/test/tx_delayer.d.ts +1 -1
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +4 -3
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +3 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +15 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +28 -161
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/dest/zkPassportVerifierAddress.js +1 -1
- package/package.json +33 -14
- package/src/client.ts +3 -3
- package/src/config.ts +49 -358
- package/src/contracts/empire_base.ts +7 -6
- package/src/contracts/empire_slashing_proposer.ts +23 -8
- package/src/contracts/fee_asset_handler.ts +1 -1
- package/src/contracts/governance.ts +3 -3
- package/src/contracts/governance_proposer.ts +19 -9
- package/src/contracts/inbox.ts +7 -2
- package/src/contracts/multicall.ts +12 -10
- package/src/contracts/rollup.ts +374 -236
- package/src/contracts/slasher_contract.ts +22 -0
- package/src/contracts/tally_slashing_proposer.ts +21 -9
- package/src/deploy_aztec_l1_contracts.ts +557 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/l1_artifacts.ts +14 -6
- package/src/l1_contract_addresses.ts +24 -20
- package/src/l1_reader.ts +10 -2
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +161 -0
- package/src/l1_tx_utils/constants.ts +29 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +14 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +738 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +419 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/publisher_manager.ts +51 -9
- package/src/queries.ts +24 -10
- package/src/test/chain_monitor.ts +102 -44
- package/src/test/delayed_tx_utils.ts +2 -2
- package/src/test/eth_cheat_codes.ts +150 -31
- package/src/test/rollup_cheat_codes.ts +95 -53
- package/src/test/start_anvil.ts +4 -0
- package/src/test/tx_delayer.ts +5 -3
- package/src/test/upgrade_utils.ts +3 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +41 -184
- package/src/zkPassportVerifierAddress.ts +1 -1
- package/dest/deploy_l1_contracts.d.ts +0 -211
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1267
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/dest/l1_tx_utils.d.ts +0 -250
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -826
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -19
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -85
- package/src/deploy_l1_contracts.ts +0 -1596
- package/src/index.ts +0 -17
- package/src/l1_tx_utils.ts +0 -1105
- package/src/l1_tx_utils_with_blobs.ts +0 -144
package/dest/contracts/rollup.js
CHANGED
|
@@ -1,16 +1,386 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function applyDecs2203RFactory() {
|
|
2
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
3
|
+
return function addInitializer(initializer) {
|
|
4
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
5
|
+
assertCallable(initializer, "An initializer");
|
|
6
|
+
initializers.push(initializer);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
10
|
+
var kindStr;
|
|
11
|
+
switch(kind){
|
|
12
|
+
case 1:
|
|
13
|
+
kindStr = "accessor";
|
|
14
|
+
break;
|
|
15
|
+
case 2:
|
|
16
|
+
kindStr = "method";
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
kindStr = "getter";
|
|
20
|
+
break;
|
|
21
|
+
case 4:
|
|
22
|
+
kindStr = "setter";
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
kindStr = "field";
|
|
26
|
+
}
|
|
27
|
+
var ctx = {
|
|
28
|
+
kind: kindStr,
|
|
29
|
+
name: isPrivate ? "#" + name : name,
|
|
30
|
+
static: isStatic,
|
|
31
|
+
private: isPrivate,
|
|
32
|
+
metadata: metadata
|
|
33
|
+
};
|
|
34
|
+
var decoratorFinishedRef = {
|
|
35
|
+
v: false
|
|
36
|
+
};
|
|
37
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
38
|
+
var get, set;
|
|
39
|
+
if (kind === 0) {
|
|
40
|
+
if (isPrivate) {
|
|
41
|
+
get = desc.get;
|
|
42
|
+
set = desc.set;
|
|
43
|
+
} else {
|
|
44
|
+
get = function() {
|
|
45
|
+
return this[name];
|
|
46
|
+
};
|
|
47
|
+
set = function(v) {
|
|
48
|
+
this[name] = v;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} else if (kind === 2) {
|
|
52
|
+
get = function() {
|
|
53
|
+
return desc.value;
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
if (kind === 1 || kind === 3) {
|
|
57
|
+
get = function() {
|
|
58
|
+
return desc.get.call(this);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (kind === 1 || kind === 4) {
|
|
62
|
+
set = function(v) {
|
|
63
|
+
desc.set.call(this, v);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ctx.access = get && set ? {
|
|
68
|
+
get: get,
|
|
69
|
+
set: set
|
|
70
|
+
} : get ? {
|
|
71
|
+
get: get
|
|
72
|
+
} : {
|
|
73
|
+
set: set
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
return dec(value, ctx);
|
|
77
|
+
} finally{
|
|
78
|
+
decoratorFinishedRef.v = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
82
|
+
if (decoratorFinishedRef.v) {
|
|
83
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertCallable(fn, hint) {
|
|
87
|
+
if (typeof fn !== "function") {
|
|
88
|
+
throw new TypeError(hint + " must be a function");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function assertValidReturnValue(kind, value) {
|
|
92
|
+
var type = typeof value;
|
|
93
|
+
if (kind === 1) {
|
|
94
|
+
if (type !== "object" || value === null) {
|
|
95
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
96
|
+
}
|
|
97
|
+
if (value.get !== undefined) {
|
|
98
|
+
assertCallable(value.get, "accessor.get");
|
|
99
|
+
}
|
|
100
|
+
if (value.set !== undefined) {
|
|
101
|
+
assertCallable(value.set, "accessor.set");
|
|
102
|
+
}
|
|
103
|
+
if (value.init !== undefined) {
|
|
104
|
+
assertCallable(value.init, "accessor.init");
|
|
105
|
+
}
|
|
106
|
+
} else if (type !== "function") {
|
|
107
|
+
var hint;
|
|
108
|
+
if (kind === 0) {
|
|
109
|
+
hint = "field";
|
|
110
|
+
} else if (kind === 10) {
|
|
111
|
+
hint = "class";
|
|
112
|
+
} else {
|
|
113
|
+
hint = "method";
|
|
114
|
+
}
|
|
115
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
119
|
+
var decs = decInfo[0];
|
|
120
|
+
var desc, init, value;
|
|
121
|
+
if (isPrivate) {
|
|
122
|
+
if (kind === 0 || kind === 1) {
|
|
123
|
+
desc = {
|
|
124
|
+
get: decInfo[3],
|
|
125
|
+
set: decInfo[4]
|
|
126
|
+
};
|
|
127
|
+
} else if (kind === 3) {
|
|
128
|
+
desc = {
|
|
129
|
+
get: decInfo[3]
|
|
130
|
+
};
|
|
131
|
+
} else if (kind === 4) {
|
|
132
|
+
desc = {
|
|
133
|
+
set: decInfo[3]
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
desc = {
|
|
137
|
+
value: decInfo[3]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
} else if (kind !== 0) {
|
|
141
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
142
|
+
}
|
|
143
|
+
if (kind === 1) {
|
|
144
|
+
value = {
|
|
145
|
+
get: desc.get,
|
|
146
|
+
set: desc.set
|
|
147
|
+
};
|
|
148
|
+
} else if (kind === 2) {
|
|
149
|
+
value = desc.value;
|
|
150
|
+
} else if (kind === 3) {
|
|
151
|
+
value = desc.get;
|
|
152
|
+
} else if (kind === 4) {
|
|
153
|
+
value = desc.set;
|
|
154
|
+
}
|
|
155
|
+
var newValue, get, set;
|
|
156
|
+
if (typeof decs === "function") {
|
|
157
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
158
|
+
if (newValue !== void 0) {
|
|
159
|
+
assertValidReturnValue(kind, newValue);
|
|
160
|
+
if (kind === 0) {
|
|
161
|
+
init = newValue;
|
|
162
|
+
} else if (kind === 1) {
|
|
163
|
+
init = newValue.init;
|
|
164
|
+
get = newValue.get || value.get;
|
|
165
|
+
set = newValue.set || value.set;
|
|
166
|
+
value = {
|
|
167
|
+
get: get,
|
|
168
|
+
set: set
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
value = newValue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
176
|
+
var dec = decs[i];
|
|
177
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
178
|
+
if (newValue !== void 0) {
|
|
179
|
+
assertValidReturnValue(kind, newValue);
|
|
180
|
+
var newInit;
|
|
181
|
+
if (kind === 0) {
|
|
182
|
+
newInit = newValue;
|
|
183
|
+
} else if (kind === 1) {
|
|
184
|
+
newInit = newValue.init;
|
|
185
|
+
get = newValue.get || value.get;
|
|
186
|
+
set = newValue.set || value.set;
|
|
187
|
+
value = {
|
|
188
|
+
get: get,
|
|
189
|
+
set: set
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
value = newValue;
|
|
193
|
+
}
|
|
194
|
+
if (newInit !== void 0) {
|
|
195
|
+
if (init === void 0) {
|
|
196
|
+
init = newInit;
|
|
197
|
+
} else if (typeof init === "function") {
|
|
198
|
+
init = [
|
|
199
|
+
init,
|
|
200
|
+
newInit
|
|
201
|
+
];
|
|
202
|
+
} else {
|
|
203
|
+
init.push(newInit);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (kind === 0 || kind === 1) {
|
|
210
|
+
if (init === void 0) {
|
|
211
|
+
init = function(instance, init) {
|
|
212
|
+
return init;
|
|
213
|
+
};
|
|
214
|
+
} else if (typeof init !== "function") {
|
|
215
|
+
var ownInitializers = init;
|
|
216
|
+
init = function(instance, init) {
|
|
217
|
+
var value = init;
|
|
218
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
219
|
+
value = ownInitializers[i].call(instance, value);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
var originalInitializer = init;
|
|
225
|
+
init = function(instance, init) {
|
|
226
|
+
return originalInitializer.call(instance, init);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
ret.push(init);
|
|
230
|
+
}
|
|
231
|
+
if (kind !== 0) {
|
|
232
|
+
if (kind === 1) {
|
|
233
|
+
desc.get = value.get;
|
|
234
|
+
desc.set = value.set;
|
|
235
|
+
} else if (kind === 2) {
|
|
236
|
+
desc.value = value;
|
|
237
|
+
} else if (kind === 3) {
|
|
238
|
+
desc.get = value;
|
|
239
|
+
} else if (kind === 4) {
|
|
240
|
+
desc.set = value;
|
|
241
|
+
}
|
|
242
|
+
if (isPrivate) {
|
|
243
|
+
if (kind === 1) {
|
|
244
|
+
ret.push(function(instance, args) {
|
|
245
|
+
return value.get.call(instance, args);
|
|
246
|
+
});
|
|
247
|
+
ret.push(function(instance, args) {
|
|
248
|
+
return value.set.call(instance, args);
|
|
249
|
+
});
|
|
250
|
+
} else if (kind === 2) {
|
|
251
|
+
ret.push(value);
|
|
252
|
+
} else {
|
|
253
|
+
ret.push(function(instance, args) {
|
|
254
|
+
return value.call(instance, args);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
Object.defineProperty(base, name, desc);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
263
|
+
var ret = [];
|
|
264
|
+
var protoInitializers;
|
|
265
|
+
var staticInitializers;
|
|
266
|
+
var existingProtoNonFields = new Map();
|
|
267
|
+
var existingStaticNonFields = new Map();
|
|
268
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
269
|
+
var decInfo = decInfos[i];
|
|
270
|
+
if (!Array.isArray(decInfo)) continue;
|
|
271
|
+
var kind = decInfo[1];
|
|
272
|
+
var name = decInfo[2];
|
|
273
|
+
var isPrivate = decInfo.length > 3;
|
|
274
|
+
var isStatic = kind >= 5;
|
|
275
|
+
var base;
|
|
276
|
+
var initializers;
|
|
277
|
+
if (isStatic) {
|
|
278
|
+
base = Class;
|
|
279
|
+
kind = kind - 5;
|
|
280
|
+
staticInitializers = staticInitializers || [];
|
|
281
|
+
initializers = staticInitializers;
|
|
282
|
+
} else {
|
|
283
|
+
base = Class.prototype;
|
|
284
|
+
protoInitializers = protoInitializers || [];
|
|
285
|
+
initializers = protoInitializers;
|
|
286
|
+
}
|
|
287
|
+
if (kind !== 0 && !isPrivate) {
|
|
288
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
289
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
290
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
291
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
292
|
+
} else if (!existingKind && kind > 2) {
|
|
293
|
+
existingNonFields.set(name, kind);
|
|
294
|
+
} else {
|
|
295
|
+
existingNonFields.set(name, true);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
299
|
+
}
|
|
300
|
+
pushInitializers(ret, protoInitializers);
|
|
301
|
+
pushInitializers(ret, staticInitializers);
|
|
302
|
+
return ret;
|
|
303
|
+
}
|
|
304
|
+
function pushInitializers(ret, initializers) {
|
|
305
|
+
if (initializers) {
|
|
306
|
+
ret.push(function(instance) {
|
|
307
|
+
for(var i = 0; i < initializers.length; i++){
|
|
308
|
+
initializers[i].call(instance);
|
|
309
|
+
}
|
|
310
|
+
return instance;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
315
|
+
if (classDecs.length > 0) {
|
|
316
|
+
var initializers = [];
|
|
317
|
+
var newClass = targetClass;
|
|
318
|
+
var name = targetClass.name;
|
|
319
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
320
|
+
var decoratorFinishedRef = {
|
|
321
|
+
v: false
|
|
322
|
+
};
|
|
323
|
+
try {
|
|
324
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
325
|
+
kind: "class",
|
|
326
|
+
name: name,
|
|
327
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
328
|
+
metadata
|
|
329
|
+
});
|
|
330
|
+
} finally{
|
|
331
|
+
decoratorFinishedRef.v = true;
|
|
332
|
+
}
|
|
333
|
+
if (nextNewClass !== undefined) {
|
|
334
|
+
assertValidReturnValue(10, nextNewClass);
|
|
335
|
+
newClass = nextNewClass;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
defineMetadata(newClass, metadata),
|
|
340
|
+
function() {
|
|
341
|
+
for(var i = 0; i < initializers.length; i++){
|
|
342
|
+
initializers[i].call(newClass);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function defineMetadata(Class, metadata) {
|
|
349
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
350
|
+
configurable: true,
|
|
351
|
+
enumerable: true,
|
|
352
|
+
value: metadata
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
356
|
+
if (parentClass !== void 0) {
|
|
357
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
358
|
+
}
|
|
359
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
360
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
361
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
362
|
+
return {
|
|
363
|
+
e: e,
|
|
364
|
+
get c () {
|
|
365
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
371
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
6
372
|
}
|
|
373
|
+
var _initProto;
|
|
374
|
+
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
375
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
376
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
377
|
import { memoize } from '@aztec/foundation/decorators';
|
|
8
378
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
379
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
9
380
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
10
381
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
11
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
12
382
|
import chunk from 'lodash.chunk';
|
|
13
|
-
import { encodeFunctionData,
|
|
383
|
+
import { encodeFunctionData, getContract, hexToBigInt, keccak256 } from 'viem';
|
|
14
384
|
import { getPublicClient } from '../client.js';
|
|
15
385
|
import { formatViemError } from '../utils.js';
|
|
16
386
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
@@ -24,8 +394,117 @@ export var SlashingProposerType = /*#__PURE__*/ function(SlashingProposerType) {
|
|
|
24
394
|
SlashingProposerType[SlashingProposerType["Empire"] = 2] = "Empire";
|
|
25
395
|
return SlashingProposerType;
|
|
26
396
|
}({});
|
|
397
|
+
/**
|
|
398
|
+
* Status of a validator/attester in the staking system.
|
|
399
|
+
* Matches the Status enum in StakingLib.sol
|
|
400
|
+
*/ export var AttesterStatus = /*#__PURE__*/ function(AttesterStatus) {
|
|
401
|
+
AttesterStatus[AttesterStatus["NONE"] = 0] = "NONE";
|
|
402
|
+
AttesterStatus[AttesterStatus["VALIDATING"] = 1] = "VALIDATING";
|
|
403
|
+
AttesterStatus[AttesterStatus["ZOMBIE"] = 2] = "ZOMBIE";
|
|
404
|
+
AttesterStatus[AttesterStatus["EXITING"] = 3] = "EXITING";
|
|
405
|
+
return AttesterStatus;
|
|
406
|
+
}({});
|
|
27
407
|
export class RollupContract {
|
|
28
408
|
client;
|
|
409
|
+
static{
|
|
410
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
411
|
+
[
|
|
412
|
+
memoize,
|
|
413
|
+
2,
|
|
414
|
+
"getL1StartBlock"
|
|
415
|
+
],
|
|
416
|
+
[
|
|
417
|
+
memoize,
|
|
418
|
+
2,
|
|
419
|
+
"getL1GenesisTime"
|
|
420
|
+
],
|
|
421
|
+
[
|
|
422
|
+
memoize,
|
|
423
|
+
2,
|
|
424
|
+
"getProofSubmissionEpochs"
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
memoize,
|
|
428
|
+
2,
|
|
429
|
+
"getEpochDuration"
|
|
430
|
+
],
|
|
431
|
+
[
|
|
432
|
+
memoize,
|
|
433
|
+
2,
|
|
434
|
+
"getSlotDuration"
|
|
435
|
+
],
|
|
436
|
+
[
|
|
437
|
+
memoize,
|
|
438
|
+
2,
|
|
439
|
+
"getTargetCommitteeSize"
|
|
440
|
+
],
|
|
441
|
+
[
|
|
442
|
+
memoize,
|
|
443
|
+
2,
|
|
444
|
+
"getEjectionThreshold"
|
|
445
|
+
],
|
|
446
|
+
[
|
|
447
|
+
memoize,
|
|
448
|
+
2,
|
|
449
|
+
"getLocalEjectionThreshold"
|
|
450
|
+
],
|
|
451
|
+
[
|
|
452
|
+
memoize,
|
|
453
|
+
2,
|
|
454
|
+
"getLagInEpochsForValidatorSet"
|
|
455
|
+
],
|
|
456
|
+
[
|
|
457
|
+
memoize,
|
|
458
|
+
2,
|
|
459
|
+
"getLagInEpochsForRandao"
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
memoize,
|
|
463
|
+
2,
|
|
464
|
+
"getActivationThreshold"
|
|
465
|
+
],
|
|
466
|
+
[
|
|
467
|
+
memoize,
|
|
468
|
+
2,
|
|
469
|
+
"getExitDelay"
|
|
470
|
+
],
|
|
471
|
+
[
|
|
472
|
+
memoize,
|
|
473
|
+
2,
|
|
474
|
+
"getManaTarget"
|
|
475
|
+
],
|
|
476
|
+
[
|
|
477
|
+
memoize,
|
|
478
|
+
2,
|
|
479
|
+
"getProvingCostPerMana"
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
memoize,
|
|
483
|
+
2,
|
|
484
|
+
"getProvingCostPerManaInFeeAsset"
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
memoize,
|
|
488
|
+
2,
|
|
489
|
+
"getManaLimit"
|
|
490
|
+
],
|
|
491
|
+
[
|
|
492
|
+
memoize,
|
|
493
|
+
2,
|
|
494
|
+
"getVersion"
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
memoize,
|
|
498
|
+
2,
|
|
499
|
+
"getGenesisArchiveTreeRoot"
|
|
500
|
+
],
|
|
501
|
+
[
|
|
502
|
+
memoize,
|
|
503
|
+
2,
|
|
504
|
+
"getRollupConstants"
|
|
505
|
+
]
|
|
506
|
+
], []));
|
|
507
|
+
}
|
|
29
508
|
rollup;
|
|
30
509
|
static cachedStfStorageSlot;
|
|
31
510
|
static get checkBlobStorageSlot() {
|
|
@@ -49,6 +528,7 @@ export class RollupContract {
|
|
|
49
528
|
}
|
|
50
529
|
constructor(client, address){
|
|
51
530
|
this.client = client;
|
|
531
|
+
_initProto(this);
|
|
52
532
|
if (address instanceof EthAddress) {
|
|
53
533
|
address = address.toString();
|
|
54
534
|
}
|
|
@@ -58,8 +538,8 @@ export class RollupContract {
|
|
|
58
538
|
client
|
|
59
539
|
});
|
|
60
540
|
}
|
|
61
|
-
getGSE() {
|
|
62
|
-
return this.rollup.read.getGSE();
|
|
541
|
+
async getGSE() {
|
|
542
|
+
return EthAddress.fromString(await this.rollup.read.getGSE());
|
|
63
543
|
}
|
|
64
544
|
get address() {
|
|
65
545
|
return this.rollup.address;
|
|
@@ -68,16 +548,11 @@ export class RollupContract {
|
|
|
68
548
|
return this.rollup;
|
|
69
549
|
}
|
|
70
550
|
async getSlashingProposer() {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
551
|
+
const slasher = await this.getSlasherContract();
|
|
552
|
+
if (!slasher) {
|
|
73
553
|
return undefined;
|
|
74
554
|
}
|
|
75
|
-
const
|
|
76
|
-
address: slasherAddress,
|
|
77
|
-
abi: SlasherAbi,
|
|
78
|
-
client: this.client
|
|
79
|
-
});
|
|
80
|
-
const proposerAddress = await slasher.read.PROPOSER();
|
|
555
|
+
const proposerAddress = await slasher.getProposer();
|
|
81
556
|
const proposerAbi = [
|
|
82
557
|
{
|
|
83
558
|
type: 'function',
|
|
@@ -94,7 +569,7 @@ export class RollupContract {
|
|
|
94
569
|
}
|
|
95
570
|
];
|
|
96
571
|
const proposer = getContract({
|
|
97
|
-
address: proposerAddress,
|
|
572
|
+
address: proposerAddress.toString(),
|
|
98
573
|
abi: proposerAbi,
|
|
99
574
|
client: this.client
|
|
100
575
|
});
|
|
@@ -113,26 +588,35 @@ export class RollupContract {
|
|
|
113
588
|
getL1GenesisTime() {
|
|
114
589
|
return this.rollup.read.getGenesisTime();
|
|
115
590
|
}
|
|
116
|
-
getProofSubmissionEpochs() {
|
|
117
|
-
return this.rollup.read.getProofSubmissionEpochs();
|
|
591
|
+
async getProofSubmissionEpochs() {
|
|
592
|
+
return Number(await this.rollup.read.getProofSubmissionEpochs());
|
|
118
593
|
}
|
|
119
|
-
getEpochDuration() {
|
|
120
|
-
return this.rollup.read.getEpochDuration();
|
|
594
|
+
async getEpochDuration() {
|
|
595
|
+
return Number(await this.rollup.read.getEpochDuration());
|
|
121
596
|
}
|
|
122
|
-
getSlotDuration() {
|
|
123
|
-
return this.rollup.read.getSlotDuration();
|
|
597
|
+
async getSlotDuration() {
|
|
598
|
+
return Number(await this.rollup.read.getSlotDuration());
|
|
124
599
|
}
|
|
125
|
-
getTargetCommitteeSize() {
|
|
126
|
-
return this.rollup.read.getTargetCommitteeSize();
|
|
600
|
+
async getTargetCommitteeSize() {
|
|
601
|
+
return Number(await this.rollup.read.getTargetCommitteeSize());
|
|
127
602
|
}
|
|
128
603
|
getEjectionThreshold() {
|
|
129
604
|
return this.rollup.read.getEjectionThreshold();
|
|
130
605
|
}
|
|
606
|
+
getLocalEjectionThreshold() {
|
|
607
|
+
return this.rollup.read.getLocalEjectionThreshold();
|
|
608
|
+
}
|
|
609
|
+
async getLagInEpochsForValidatorSet() {
|
|
610
|
+
return Number(await this.rollup.read.getLagInEpochsForValidatorSet());
|
|
611
|
+
}
|
|
612
|
+
async getLagInEpochsForRandao() {
|
|
613
|
+
return Number(await this.rollup.read.getLagInEpochsForRandao());
|
|
614
|
+
}
|
|
131
615
|
getActivationThreshold() {
|
|
132
616
|
return this.rollup.read.getActivationThreshold();
|
|
133
617
|
}
|
|
134
|
-
getExitDelay() {
|
|
135
|
-
return this.rollup.read.getExitDelay();
|
|
618
|
+
async getExitDelay() {
|
|
619
|
+
return Number(await this.rollup.read.getExitDelay());
|
|
136
620
|
}
|
|
137
621
|
getManaTarget() {
|
|
138
622
|
return this.rollup.read.getManaTarget();
|
|
@@ -150,10 +634,9 @@ export class RollupContract {
|
|
|
150
634
|
return this.rollup.read.getVersion();
|
|
151
635
|
}
|
|
152
636
|
async getGenesisArchiveTreeRoot() {
|
|
153
|
-
|
|
637
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
154
638
|
0n
|
|
155
|
-
]);
|
|
156
|
-
return block.archive;
|
|
639
|
+
]));
|
|
157
640
|
}
|
|
158
641
|
/**
|
|
159
642
|
* Returns rollup constants used for epoch queries.
|
|
@@ -170,51 +653,56 @@ export class RollupContract {
|
|
|
170
653
|
return {
|
|
171
654
|
l1StartBlock,
|
|
172
655
|
l1GenesisTime,
|
|
173
|
-
slotDuration
|
|
656
|
+
slotDuration,
|
|
174
657
|
epochDuration: Number(epochDuration),
|
|
175
658
|
proofSubmissionEpochs: Number(proofSubmissionEpochs)
|
|
176
659
|
};
|
|
177
660
|
}
|
|
178
|
-
|
|
179
|
-
return this.rollup.read.getSlasher();
|
|
661
|
+
async getSlasherAddress() {
|
|
662
|
+
return EthAddress.fromString(await this.rollup.read.getSlasher());
|
|
180
663
|
}
|
|
181
664
|
/**
|
|
182
665
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
183
666
|
*/ async getSlasherContract() {
|
|
184
|
-
const slasherAddress = await this.
|
|
185
|
-
|
|
667
|
+
const slasherAddress = await this.getSlasherAddress();
|
|
668
|
+
if (slasherAddress.isZero()) {
|
|
669
|
+
return undefined;
|
|
670
|
+
}
|
|
671
|
+
return new SlasherContract(this.client, slasherAddress);
|
|
186
672
|
}
|
|
187
|
-
getOwner() {
|
|
188
|
-
return this.rollup.read.owner();
|
|
673
|
+
async getOwner() {
|
|
674
|
+
return EthAddress.fromString(await this.rollup.read.owner());
|
|
189
675
|
}
|
|
190
|
-
getActiveAttesterCount() {
|
|
191
|
-
return this.rollup.read.getActiveAttesterCount();
|
|
676
|
+
async getActiveAttesterCount() {
|
|
677
|
+
return Number(await this.rollup.read.getActiveAttesterCount());
|
|
192
678
|
}
|
|
193
679
|
async getSlashingProposerAddress() {
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
return EthAddress.fromString(await slasher.read.PROPOSER());
|
|
680
|
+
const slasher = await this.getSlasherContract();
|
|
681
|
+
if (!slasher) {
|
|
682
|
+
return EthAddress.ZERO;
|
|
683
|
+
}
|
|
684
|
+
return await slasher.getProposer();
|
|
201
685
|
}
|
|
202
|
-
|
|
203
|
-
return this.rollup.read.
|
|
686
|
+
getCheckpointReward() {
|
|
687
|
+
return this.rollup.read.getCheckpointReward();
|
|
204
688
|
}
|
|
205
|
-
|
|
206
|
-
return this.rollup.read.
|
|
689
|
+
async getCheckpointNumber() {
|
|
690
|
+
return CheckpointNumber.fromBigInt(await this.rollup.read.getPendingCheckpointNumber());
|
|
207
691
|
}
|
|
208
|
-
|
|
209
|
-
return this.rollup.read.
|
|
692
|
+
async getProvenCheckpointNumber() {
|
|
693
|
+
return CheckpointNumber.fromBigInt(await this.rollup.read.getProvenCheckpointNumber());
|
|
210
694
|
}
|
|
211
|
-
getSlotNumber() {
|
|
212
|
-
return this.rollup.read.getCurrentSlot();
|
|
695
|
+
async getSlotNumber() {
|
|
696
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
213
697
|
}
|
|
214
|
-
getL1FeesAt(timestamp) {
|
|
215
|
-
|
|
698
|
+
async getL1FeesAt(timestamp) {
|
|
699
|
+
const result = await this.rollup.read.getL1FeesAt([
|
|
216
700
|
timestamp
|
|
217
701
|
]);
|
|
702
|
+
return {
|
|
703
|
+
baseFee: result.baseFee,
|
|
704
|
+
blobFee: result.blobFee
|
|
705
|
+
};
|
|
218
706
|
}
|
|
219
707
|
getFeeAssetPerEth() {
|
|
220
708
|
return this.rollup.read.getFeeAssetPerEth();
|
|
@@ -235,18 +723,18 @@ export class RollupContract {
|
|
|
235
723
|
}
|
|
236
724
|
throw e;
|
|
237
725
|
});
|
|
238
|
-
return result;
|
|
726
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
239
727
|
}
|
|
240
|
-
getSampleSeedAt(timestamp) {
|
|
241
|
-
return this.rollup.read.getSampleSeedAt([
|
|
728
|
+
async getSampleSeedAt(timestamp) {
|
|
729
|
+
return Buffer32.fromBigInt(await this.rollup.read.getSampleSeedAt([
|
|
242
730
|
timestamp
|
|
243
|
-
]);
|
|
731
|
+
]));
|
|
244
732
|
}
|
|
245
|
-
getCurrentSampleSeed() {
|
|
246
|
-
return this.rollup.read.getCurrentSampleSeed();
|
|
733
|
+
async getCurrentSampleSeed() {
|
|
734
|
+
return Buffer32.fromBigInt(await this.rollup.read.getCurrentSampleSeed());
|
|
247
735
|
}
|
|
248
|
-
getCurrentEpoch() {
|
|
249
|
-
return this.rollup.read.getCurrentEpoch();
|
|
736
|
+
async getCurrentEpoch() {
|
|
737
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
250
738
|
}
|
|
251
739
|
async getCurrentEpochCommittee() {
|
|
252
740
|
const { result } = await this.client.simulateContract({
|
|
@@ -262,7 +750,7 @@ export class RollupContract {
|
|
|
262
750
|
}
|
|
263
751
|
throw e;
|
|
264
752
|
});
|
|
265
|
-
return result;
|
|
753
|
+
return result ? result.map((addr)=>EthAddress.fromString(addr)) : undefined;
|
|
266
754
|
}
|
|
267
755
|
async getCurrentProposer() {
|
|
268
756
|
const { result } = await this.client.simulateContract({
|
|
@@ -271,7 +759,7 @@ export class RollupContract {
|
|
|
271
759
|
functionName: 'getCurrentProposer',
|
|
272
760
|
args: []
|
|
273
761
|
});
|
|
274
|
-
return result;
|
|
762
|
+
return EthAddress.fromString(result);
|
|
275
763
|
}
|
|
276
764
|
async getProposerAt(timestamp) {
|
|
277
765
|
const { result } = await this.client.simulateContract({
|
|
@@ -282,29 +770,69 @@ export class RollupContract {
|
|
|
282
770
|
timestamp
|
|
283
771
|
]
|
|
284
772
|
});
|
|
285
|
-
return result;
|
|
773
|
+
return EthAddress.fromString(result);
|
|
286
774
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
775
|
+
async getCheckpoint(checkpointNumber) {
|
|
776
|
+
const result = await this.rollup.read.getCheckpoint([
|
|
777
|
+
BigInt(checkpointNumber)
|
|
290
778
|
]);
|
|
779
|
+
return {
|
|
780
|
+
archive: Fr.fromString(result.archive),
|
|
781
|
+
headerHash: Buffer32.fromString(result.headerHash),
|
|
782
|
+
blobCommitmentsHash: Buffer32.fromString(result.blobCommitmentsHash),
|
|
783
|
+
attestationsHash: Buffer32.fromString(result.attestationsHash),
|
|
784
|
+
payloadDigest: Buffer32.fromString(result.payloadDigest),
|
|
785
|
+
slotNumber: SlotNumber.fromBigInt(result.slotNumber),
|
|
786
|
+
feeHeader: {
|
|
787
|
+
excessMana: result.feeHeader.excessMana,
|
|
788
|
+
manaUsed: result.feeHeader.manaUsed,
|
|
789
|
+
feeAssetPriceNumerator: result.feeHeader.feeAssetPriceNumerator,
|
|
790
|
+
congestionCost: result.feeHeader.congestionCost,
|
|
791
|
+
proverCost: result.feeHeader.proverCost
|
|
792
|
+
}
|
|
793
|
+
};
|
|
291
794
|
}
|
|
292
|
-
|
|
293
|
-
|
|
795
|
+
/** Returns the pending checkpoint from the rollup contract */ getPendingCheckpoint() {
|
|
796
|
+
// We retry because of race conditions during prunes: we may get a pending checkpoint number which is immediately
|
|
797
|
+
// reorged out due to a prune happening, causing the subsequent getCheckpoint call to fail. So we try again in that case.
|
|
798
|
+
return retry(async ()=>{
|
|
799
|
+
const pendingCheckpointNumber = await this.getCheckpointNumber();
|
|
800
|
+
const pendingCheckpoint = await this.getCheckpoint(pendingCheckpointNumber);
|
|
801
|
+
return pendingCheckpoint;
|
|
802
|
+
}, 'getting pending checkpoint', makeBackoff([
|
|
803
|
+
0.5,
|
|
804
|
+
0.5,
|
|
805
|
+
0.5
|
|
806
|
+
]));
|
|
807
|
+
}
|
|
808
|
+
async getTips() {
|
|
809
|
+
const { pending, proven } = await this.rollup.read.getTips();
|
|
810
|
+
return {
|
|
811
|
+
pending: CheckpointNumber.fromBigInt(pending),
|
|
812
|
+
proven: CheckpointNumber.fromBigInt(proven)
|
|
813
|
+
};
|
|
294
814
|
}
|
|
295
815
|
getTimestampForSlot(slot) {
|
|
296
816
|
return this.rollup.read.getTimestampForSlot([
|
|
297
|
-
slot
|
|
817
|
+
BigInt(slot)
|
|
298
818
|
]);
|
|
299
819
|
}
|
|
300
|
-
getEntryQueueLength() {
|
|
301
|
-
return this.rollup.read.getEntryQueueLength();
|
|
820
|
+
async getEntryQueueLength() {
|
|
821
|
+
return Number(await this.rollup.read.getEntryQueueLength());
|
|
302
822
|
}
|
|
303
|
-
async
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
823
|
+
async getAvailableValidatorFlushes() {
|
|
824
|
+
return Number(await this.rollup.read.getAvailableValidatorFlushes());
|
|
825
|
+
}
|
|
826
|
+
async getNextFlushableEpoch() {
|
|
827
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getNextFlushableEpoch());
|
|
828
|
+
}
|
|
829
|
+
async getCurrentEpochNumber() {
|
|
830
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
831
|
+
}
|
|
832
|
+
async getEpochNumberForCheckpoint(checkpointNumber) {
|
|
833
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getEpochForCheckpoint([
|
|
834
|
+
BigInt(checkpointNumber)
|
|
835
|
+
]));
|
|
308
836
|
}
|
|
309
837
|
async getRollupAddresses() {
|
|
310
838
|
const [inboxAddress, outboxAddress, feeJuicePortalAddress, rewardDistributorAddress, feeJuiceAddress, stakingAssetAddress, gseAddress] = (await Promise.all([
|
|
@@ -331,12 +859,13 @@ export class RollupContract {
|
|
|
331
859
|
return EthAddress.fromString(await this.rollup.read.getFeeAssetPortal());
|
|
332
860
|
}
|
|
333
861
|
async getEpochNumberForSlotNumber(slotNumber) {
|
|
334
|
-
return await this.rollup.read.getEpochAtSlot([
|
|
335
|
-
slotNumber
|
|
336
|
-
]);
|
|
862
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([
|
|
863
|
+
BigInt(slotNumber)
|
|
864
|
+
]));
|
|
337
865
|
}
|
|
338
|
-
getEpochProofPublicInputs(args) {
|
|
339
|
-
|
|
866
|
+
async getEpochProofPublicInputs(args) {
|
|
867
|
+
const result = await this.rollup.read.getEpochProofPublicInputs(args);
|
|
868
|
+
return result.map(Fr.fromString);
|
|
340
869
|
}
|
|
341
870
|
async validateHeader(args, account) {
|
|
342
871
|
try {
|
|
@@ -352,80 +881,20 @@ export class RollupContract {
|
|
|
352
881
|
}
|
|
353
882
|
}
|
|
354
883
|
/**
|
|
355
|
-
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
356
|
-
*
|
|
357
|
-
* @param attestations - Array of committee attestations with addresses and signatures
|
|
358
|
-
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
359
|
-
*/ static packAttestations(attestations) {
|
|
360
|
-
const length = attestations.length;
|
|
361
|
-
// Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
|
|
362
|
-
const bitmapSize = Math.ceil(length / 8);
|
|
363
|
-
const signatureIndices = new Uint8Array(bitmapSize);
|
|
364
|
-
// Calculate total data size needed
|
|
365
|
-
let totalDataSize = 0;
|
|
366
|
-
for(let i = 0; i < length; i++){
|
|
367
|
-
const signature = attestations[i].signature;
|
|
368
|
-
// Check if signature is empty (v = 0)
|
|
369
|
-
const isEmpty = signature.v === 0;
|
|
370
|
-
if (!isEmpty) {
|
|
371
|
-
totalDataSize += 65; // v (1) + r (32) + s (32)
|
|
372
|
-
} else {
|
|
373
|
-
totalDataSize += 20; // address only
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
const signaturesOrAddresses = new Uint8Array(totalDataSize);
|
|
377
|
-
let dataIndex = 0;
|
|
378
|
-
// Pack the data
|
|
379
|
-
for(let i = 0; i < length; i++){
|
|
380
|
-
const attestation = attestations[i];
|
|
381
|
-
const signature = attestation.signature;
|
|
382
|
-
// Check if signature is empty
|
|
383
|
-
const isEmpty = signature.v === 0;
|
|
384
|
-
if (!isEmpty) {
|
|
385
|
-
// Set bit in bitmap (bit 7-0 in each byte, left to right)
|
|
386
|
-
const byteIndex = Math.floor(i / 8);
|
|
387
|
-
const bitIndex = 7 - i % 8;
|
|
388
|
-
signatureIndices[byteIndex] |= 1 << bitIndex;
|
|
389
|
-
// Pack signature: v + r + s
|
|
390
|
-
signaturesOrAddresses[dataIndex] = signature.v;
|
|
391
|
-
dataIndex++;
|
|
392
|
-
// Pack r (32 bytes)
|
|
393
|
-
const rBytes = Buffer.from(signature.r.slice(2), 'hex');
|
|
394
|
-
signaturesOrAddresses.set(rBytes, dataIndex);
|
|
395
|
-
dataIndex += 32;
|
|
396
|
-
// Pack s (32 bytes)
|
|
397
|
-
const sBytes = Buffer.from(signature.s.slice(2), 'hex');
|
|
398
|
-
signaturesOrAddresses.set(sBytes, dataIndex);
|
|
399
|
-
dataIndex += 32;
|
|
400
|
-
} else {
|
|
401
|
-
// Pack address only (20 bytes)
|
|
402
|
-
const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
|
|
403
|
-
signaturesOrAddresses.set(addrBytes, dataIndex);
|
|
404
|
-
dataIndex += 20;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return {
|
|
408
|
-
signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
|
|
409
|
-
signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
884
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
414
885
|
*
|
|
415
886
|
* @dev Throws if unable to propose
|
|
416
887
|
*
|
|
417
888
|
* @param archive - The archive that we expect to be current state
|
|
418
|
-
* @return [slot,
|
|
889
|
+
* @return [slot, checkpointNumber, timeOfNextL1Slot] - If you can propose, the L2 slot number, checkpoint number and
|
|
890
|
+
* timestamp of the next L1 block
|
|
419
891
|
* @throws otherwise
|
|
420
892
|
*/ async canProposeAtNextEthBlock(archive, account, slotDuration, opts = {}) {
|
|
421
|
-
if (typeof slotDuration === 'number') {
|
|
422
|
-
slotDuration = BigInt(slotDuration);
|
|
423
|
-
}
|
|
424
893
|
const latestBlock = await this.client.getBlock();
|
|
425
|
-
const timeOfNextL1Slot = latestBlock.timestamp + slotDuration;
|
|
894
|
+
const timeOfNextL1Slot = latestBlock.timestamp + BigInt(slotDuration);
|
|
426
895
|
const who = typeof account === 'string' ? account : account.address;
|
|
427
896
|
try {
|
|
428
|
-
const { result: [slot,
|
|
897
|
+
const { result: [slot, checkpointNumber] } = await this.client.simulateContract({
|
|
429
898
|
address: this.address,
|
|
430
899
|
abi: RollupAbi,
|
|
431
900
|
functionName: 'canProposeAtTime',
|
|
@@ -435,11 +904,11 @@ export class RollupContract {
|
|
|
435
904
|
who
|
|
436
905
|
],
|
|
437
906
|
account,
|
|
438
|
-
stateOverride: await this.
|
|
907
|
+
stateOverride: await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber)
|
|
439
908
|
});
|
|
440
909
|
return {
|
|
441
|
-
slot,
|
|
442
|
-
|
|
910
|
+
slot: SlotNumber.fromBigInt(slot),
|
|
911
|
+
checkpointNumber: CheckpointNumber.fromBigInt(checkpointNumber),
|
|
443
912
|
timeOfNextL1Slot
|
|
444
913
|
};
|
|
445
914
|
} catch (err) {
|
|
@@ -447,11 +916,11 @@ export class RollupContract {
|
|
|
447
916
|
}
|
|
448
917
|
}
|
|
449
918
|
/**
|
|
450
|
-
* Returns a state override that sets the pending
|
|
451
|
-
* Requires querying the current state of the contract to get the current proven
|
|
919
|
+
* Returns a state override that sets the pending checkpoint number to the specified value. Useful for simulations.
|
|
920
|
+
* Requires querying the current state of the contract to get the current proven checkpoint number, as they are both
|
|
452
921
|
* stored in the same slot. If the argument is undefined, it returns an empty override.
|
|
453
|
-
*/ async
|
|
454
|
-
if (
|
|
922
|
+
*/ async makePendingCheckpointNumberOverride(forcePendingCheckpointNumber) {
|
|
923
|
+
if (forcePendingCheckpointNumber === undefined) {
|
|
455
924
|
return [];
|
|
456
925
|
}
|
|
457
926
|
const slot = RollupContract.stfStorageSlot;
|
|
@@ -459,8 +928,8 @@ export class RollupContract {
|
|
|
459
928
|
address: this.address,
|
|
460
929
|
slot
|
|
461
930
|
});
|
|
462
|
-
const
|
|
463
|
-
const newValue = BigInt(
|
|
931
|
+
const currentProvenCheckpointNumber = currentValue ? hexToBigInt(currentValue) & (1n << 128n) - 1n : 0n;
|
|
932
|
+
const newValue = BigInt(forcePendingCheckpointNumber) << 128n | currentProvenCheckpointNumber;
|
|
464
933
|
return [
|
|
465
934
|
{
|
|
466
935
|
address: this.address,
|
|
@@ -473,61 +942,68 @@ export class RollupContract {
|
|
|
473
942
|
}
|
|
474
943
|
];
|
|
475
944
|
}
|
|
476
|
-
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(
|
|
945
|
+
/** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */ buildInvalidateBadAttestationRequest(checkpointNumber, attestationsAndSigners, committee, invalidIndex) {
|
|
477
946
|
return {
|
|
478
947
|
to: this.address,
|
|
479
948
|
data: encodeFunctionData({
|
|
480
949
|
abi: RollupAbi,
|
|
481
950
|
functionName: 'invalidateBadAttestation',
|
|
482
951
|
args: [
|
|
483
|
-
BigInt(
|
|
484
|
-
|
|
952
|
+
BigInt(checkpointNumber),
|
|
953
|
+
attestationsAndSigners,
|
|
485
954
|
committee.map((addr)=>addr.toString()),
|
|
486
955
|
BigInt(invalidIndex)
|
|
487
956
|
]
|
|
488
957
|
})
|
|
489
958
|
};
|
|
490
959
|
}
|
|
491
|
-
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(
|
|
960
|
+
/** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */ buildInvalidateInsufficientAttestationsRequest(checkpointNumber, attestationsAndSigners, committee) {
|
|
492
961
|
return {
|
|
493
962
|
to: this.address,
|
|
494
963
|
data: encodeFunctionData({
|
|
495
964
|
abi: RollupAbi,
|
|
496
965
|
functionName: 'invalidateInsufficientAttestations',
|
|
497
966
|
args: [
|
|
498
|
-
BigInt(
|
|
499
|
-
|
|
967
|
+
BigInt(checkpointNumber),
|
|
968
|
+
attestationsAndSigners,
|
|
500
969
|
committee.map((addr)=>addr.toString())
|
|
501
970
|
]
|
|
502
971
|
})
|
|
503
972
|
};
|
|
504
973
|
}
|
|
505
|
-
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */ getHasSubmittedProof(epochNumber,
|
|
974
|
+
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */ getHasSubmittedProof(epochNumber, numberOfCheckpointsInEpoch, prover) {
|
|
506
975
|
if (prover instanceof EthAddress) {
|
|
507
976
|
prover = prover.toString();
|
|
508
977
|
}
|
|
509
978
|
return this.rollup.read.getHasSubmitted([
|
|
510
979
|
BigInt(epochNumber),
|
|
511
|
-
BigInt(
|
|
980
|
+
BigInt(numberOfCheckpointsInEpoch),
|
|
512
981
|
prover
|
|
513
982
|
]);
|
|
514
983
|
}
|
|
515
|
-
|
|
516
|
-
return this.rollup.read.
|
|
984
|
+
getManaMinFeeAt(timestamp, inFeeAsset) {
|
|
985
|
+
return this.rollup.read.getManaMinFeeAt([
|
|
517
986
|
timestamp,
|
|
518
987
|
inFeeAsset
|
|
519
988
|
]);
|
|
520
989
|
}
|
|
521
|
-
getSlotAt(timestamp) {
|
|
522
|
-
return this.rollup.read.getSlotAt([
|
|
990
|
+
async getSlotAt(timestamp) {
|
|
991
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([
|
|
523
992
|
timestamp
|
|
524
|
-
]);
|
|
993
|
+
]));
|
|
525
994
|
}
|
|
526
|
-
async status(
|
|
995
|
+
async status(checkpointNumber, options) {
|
|
527
996
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
528
|
-
|
|
529
|
-
|
|
997
|
+
const result = await this.rollup.read.status([
|
|
998
|
+
BigInt(checkpointNumber)
|
|
530
999
|
], options);
|
|
1000
|
+
return {
|
|
1001
|
+
provenCheckpointNumber: CheckpointNumber.fromBigInt(result[0]),
|
|
1002
|
+
provenArchive: Fr.fromString(result[1]),
|
|
1003
|
+
pendingCheckpointNumber: CheckpointNumber.fromBigInt(result[2]),
|
|
1004
|
+
pendingArchive: Fr.fromString(result[3]),
|
|
1005
|
+
archiveOfMyCheckpoint: Fr.fromString(result[4])
|
|
1006
|
+
};
|
|
531
1007
|
}
|
|
532
1008
|
async canPruneAtTime(timestamp, options) {
|
|
533
1009
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
@@ -535,13 +1011,13 @@ export class RollupContract {
|
|
|
535
1011
|
timestamp
|
|
536
1012
|
], options);
|
|
537
1013
|
}
|
|
538
|
-
archive() {
|
|
539
|
-
return this.rollup.read.archive();
|
|
1014
|
+
async archive() {
|
|
1015
|
+
return Fr.fromString(await this.rollup.read.archive());
|
|
540
1016
|
}
|
|
541
|
-
archiveAt(
|
|
542
|
-
return this.rollup.read.archiveAt([
|
|
543
|
-
|
|
544
|
-
]);
|
|
1017
|
+
async archiveAt(checkpointNumber) {
|
|
1018
|
+
return Fr.fromString(await this.rollup.read.archiveAt([
|
|
1019
|
+
BigInt(checkpointNumber)
|
|
1020
|
+
]));
|
|
545
1021
|
}
|
|
546
1022
|
getSequencerRewards(address) {
|
|
547
1023
|
if (address instanceof EthAddress) {
|
|
@@ -565,37 +1041,66 @@ export class RollupContract {
|
|
|
565
1041
|
const gse = new GSEContract(this.client, await this.getGSE());
|
|
566
1042
|
const ts = (await this.client.getBlock()).timestamp;
|
|
567
1043
|
const indices = Array.from({
|
|
568
|
-
length:
|
|
1044
|
+
length: attesterSize
|
|
569
1045
|
}, (_, i)=>BigInt(i));
|
|
570
1046
|
const chunks = chunk(indices, 1000);
|
|
571
|
-
|
|
1047
|
+
const results = await Promise.all(chunks.map((chunk)=>gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)));
|
|
1048
|
+
return results.flat().map((addr)=>EthAddress.fromString(addr));
|
|
572
1049
|
}
|
|
573
|
-
getAttesterView(address) {
|
|
1050
|
+
async getAttesterView(address) {
|
|
574
1051
|
if (address instanceof EthAddress) {
|
|
575
1052
|
address = address.toString();
|
|
576
1053
|
}
|
|
577
|
-
|
|
1054
|
+
const result = await this.rollup.read.getAttesterView([
|
|
578
1055
|
address
|
|
579
1056
|
]);
|
|
1057
|
+
return {
|
|
1058
|
+
status: result.status,
|
|
1059
|
+
effectiveBalance: result.effectiveBalance,
|
|
1060
|
+
exit: {
|
|
1061
|
+
withdrawalId: result.exit.withdrawalId,
|
|
1062
|
+
amount: result.exit.amount,
|
|
1063
|
+
exitableAt: result.exit.exitableAt,
|
|
1064
|
+
recipientOrWithdrawer: EthAddress.fromString(result.exit.recipientOrWithdrawer),
|
|
1065
|
+
isRecipient: result.exit.isRecipient,
|
|
1066
|
+
exists: result.exit.exists
|
|
1067
|
+
},
|
|
1068
|
+
config: {
|
|
1069
|
+
publicKey: {
|
|
1070
|
+
x: result.config.publicKey.x,
|
|
1071
|
+
y: result.config.publicKey.y
|
|
1072
|
+
},
|
|
1073
|
+
withdrawer: EthAddress.fromString(result.config.withdrawer)
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
580
1076
|
}
|
|
581
|
-
getStatus(address) {
|
|
1077
|
+
async getStatus(address) {
|
|
582
1078
|
if (address instanceof EthAddress) {
|
|
583
1079
|
address = address.toString();
|
|
584
1080
|
}
|
|
585
|
-
return this.rollup.read.getStatus([
|
|
1081
|
+
return await this.rollup.read.getStatus([
|
|
586
1082
|
address
|
|
587
1083
|
]);
|
|
588
1084
|
}
|
|
589
|
-
getBlobCommitmentsHash(
|
|
590
|
-
return this.rollup.read.getBlobCommitmentsHash([
|
|
591
|
-
|
|
592
|
-
]);
|
|
1085
|
+
async getBlobCommitmentsHash(checkpointNumber) {
|
|
1086
|
+
return Buffer32.fromString(await this.rollup.read.getBlobCommitmentsHash([
|
|
1087
|
+
BigInt(checkpointNumber)
|
|
1088
|
+
]));
|
|
593
1089
|
}
|
|
594
|
-
getCurrentBlobCommitmentsHash() {
|
|
595
|
-
return this.rollup.read.getCurrentBlobCommitmentsHash();
|
|
1090
|
+
async getCurrentBlobCommitmentsHash() {
|
|
1091
|
+
return Buffer32.fromString(await this.rollup.read.getCurrentBlobCommitmentsHash());
|
|
596
1092
|
}
|
|
597
|
-
getStakingAsset() {
|
|
598
|
-
return this.rollup.read.getStakingAsset();
|
|
1093
|
+
async getStakingAsset() {
|
|
1094
|
+
return EthAddress.fromString(await this.rollup.read.getStakingAsset());
|
|
1095
|
+
}
|
|
1096
|
+
async getRewardConfig() {
|
|
1097
|
+
const result = await this.rollup.read.getRewardConfig();
|
|
1098
|
+
return {
|
|
1099
|
+
rewardDistributor: EthAddress.fromString(result.rewardDistributor),
|
|
1100
|
+
sequencerBps: BigInt(result.sequencerBps),
|
|
1101
|
+
booster: EthAddress.fromString(result.booster),
|
|
1102
|
+
checkpointReward: result.checkpointReward
|
|
1103
|
+
};
|
|
599
1104
|
}
|
|
600
1105
|
setupEpoch(l1TxUtils) {
|
|
601
1106
|
return l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -631,6 +1136,20 @@ export class RollupContract {
|
|
|
631
1136
|
}
|
|
632
1137
|
});
|
|
633
1138
|
}
|
|
1139
|
+
listenToCheckpointInvalidated(callback) {
|
|
1140
|
+
return this.rollup.watchEvent.CheckpointInvalidated({}, {
|
|
1141
|
+
onLogs: (logs)=>{
|
|
1142
|
+
for (const log of logs){
|
|
1143
|
+
const args = log.args;
|
|
1144
|
+
if (args.checkpointNumber !== undefined) {
|
|
1145
|
+
callback({
|
|
1146
|
+
checkpointNumber: CheckpointNumber.fromBigInt(args.checkpointNumber)
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
634
1153
|
async getSlashEvents(l1BlockHash) {
|
|
635
1154
|
const events = await this.rollup.getEvents.Slashed({}, {
|
|
636
1155
|
blockHash: l1BlockHash,
|
|
@@ -656,51 +1175,3 @@ export class RollupContract {
|
|
|
656
1175
|
});
|
|
657
1176
|
}
|
|
658
1177
|
}
|
|
659
|
-
_ts_decorate([
|
|
660
|
-
memoize
|
|
661
|
-
], RollupContract.prototype, "getL1StartBlock", null);
|
|
662
|
-
_ts_decorate([
|
|
663
|
-
memoize
|
|
664
|
-
], RollupContract.prototype, "getL1GenesisTime", null);
|
|
665
|
-
_ts_decorate([
|
|
666
|
-
memoize
|
|
667
|
-
], RollupContract.prototype, "getProofSubmissionEpochs", null);
|
|
668
|
-
_ts_decorate([
|
|
669
|
-
memoize
|
|
670
|
-
], RollupContract.prototype, "getEpochDuration", null);
|
|
671
|
-
_ts_decorate([
|
|
672
|
-
memoize
|
|
673
|
-
], RollupContract.prototype, "getSlotDuration", null);
|
|
674
|
-
_ts_decorate([
|
|
675
|
-
memoize
|
|
676
|
-
], RollupContract.prototype, "getTargetCommitteeSize", null);
|
|
677
|
-
_ts_decorate([
|
|
678
|
-
memoize
|
|
679
|
-
], RollupContract.prototype, "getEjectionThreshold", null);
|
|
680
|
-
_ts_decorate([
|
|
681
|
-
memoize
|
|
682
|
-
], RollupContract.prototype, "getActivationThreshold", null);
|
|
683
|
-
_ts_decorate([
|
|
684
|
-
memoize
|
|
685
|
-
], RollupContract.prototype, "getExitDelay", null);
|
|
686
|
-
_ts_decorate([
|
|
687
|
-
memoize
|
|
688
|
-
], RollupContract.prototype, "getManaTarget", null);
|
|
689
|
-
_ts_decorate([
|
|
690
|
-
memoize
|
|
691
|
-
], RollupContract.prototype, "getProvingCostPerMana", null);
|
|
692
|
-
_ts_decorate([
|
|
693
|
-
memoize
|
|
694
|
-
], RollupContract.prototype, "getProvingCostPerManaInFeeAsset", null);
|
|
695
|
-
_ts_decorate([
|
|
696
|
-
memoize
|
|
697
|
-
], RollupContract.prototype, "getManaLimit", null);
|
|
698
|
-
_ts_decorate([
|
|
699
|
-
memoize
|
|
700
|
-
], RollupContract.prototype, "getVersion", null);
|
|
701
|
-
_ts_decorate([
|
|
702
|
-
memoize
|
|
703
|
-
], RollupContract.prototype, "getGenesisArchiveTreeRoot", null);
|
|
704
|
-
_ts_decorate([
|
|
705
|
-
memoize
|
|
706
|
-
], RollupContract.prototype, "getRollupConstants", null);
|