@aztec/ethereum 0.0.1-commit.03f7ef2 → 0.0.1-commit.04d373f
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.d.ts +16 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +27 -7
- package/dest/config.d.ts +24 -32
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +63 -62
- package/dest/contracts/chain_state_override.d.ts +78 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +137 -0
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +11 -9
- package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +656 -0
- package/dest/contracts/governance.d.ts +110 -33
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +207 -16
- package/dest/contracts/governance_proposer.d.ts +33 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +438 -10
- package/dest/contracts/inbox.d.ts +22 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +42 -2
- package/dest/contracts/index.d.ts +6 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +5 -2
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +127 -12
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +201 -93
- package/dest/contracts/outbox.d.ts +58 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +109 -0
- package/dest/contracts/registry.d.ts +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +5409 -115
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1027 -189
- package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +3 -4
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +18 -13
- package/dest/deploy_aztec_l1_contracts.d.ts +20 -9
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +113 -37
- package/dest/deploy_l1_contract.js +3 -3
- package/dest/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +18360 -16454
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +61 -65
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +101 -82
- package/dest/l1_reader.d.ts +5 -5
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +9 -7
- package/dest/l1_tx_utils/config.d.ts +7 -1
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +14 -1
- package/dest/l1_tx_utils/constants.d.ts +1 -1
- package/dest/l1_tx_utils/constants.js +2 -2
- package/dest/l1_tx_utils/factory.d.ts +18 -10
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +17 -7
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +3 -2
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/index.js +2 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +2 -12
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +36 -18
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +2 -11
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +37 -19
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +14 -27
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/types.js +0 -21
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +15 -15
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +9 -15
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -3
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/index-blobs.js +2 -2
- package/dest/l1_tx_utils/index.d.ts +2 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +2 -2
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.js +3 -3
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +101 -66
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -5
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +25 -58
- package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +67 -37
- package/dest/publisher_manager.d.ts +21 -6
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +81 -7
- package/dest/queries.d.ts +14 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +74 -7
- package/dest/test/chain_monitor.d.ts +23 -3
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +39 -4
- package/dest/test/eth_cheat_codes.d.ts +24 -4
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +17 -4
- package/dest/test/index.d.ts +1 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -2
- package/dest/test/rollup_cheat_codes.d.ts +34 -3
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +75 -6
- package/dest/test/start_anvil.d.ts +23 -3
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +143 -29
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/utils.d.ts +9 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +81 -12
- package/package.json +9 -10
- package/src/client.ts +28 -2
- package/src/config.ts +81 -63
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +285 -0
- package/src/contracts/governance.ts +279 -13
- package/src/contracts/governance_proposer.ts +58 -2
- package/src/contracts/inbox.ts +62 -2
- package/src/contracts/index.ts +5 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +243 -102
- package/src/contracts/outbox.ts +128 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +728 -148
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +16 -14
- package/src/deploy_aztec_l1_contracts.ts +137 -47
- package/src/deploy_l1_contract.ts +3 -3
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +120 -94
- package/src/l1_reader.ts +17 -10
- package/src/l1_tx_utils/config.ts +20 -0
- package/src/l1_tx_utils/constants.ts +2 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +1 -1
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +46 -42
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +49 -45
- package/src/l1_tx_utils/fee-strategies/types.ts +14 -46
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +43 -54
- package/src/l1_tx_utils/index-blobs.ts +2 -2
- package/src/l1_tx_utils/index.ts +1 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +2 -3
- package/src/l1_tx_utils/l1_tx_utils.ts +99 -48
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +31 -66
- package/src/{test → l1_tx_utils}/tx_delayer.ts +93 -56
- package/src/publisher_manager.ts +107 -10
- package/src/queries.ts +81 -7
- package/src/test/chain_monitor.ts +66 -4
- package/src/test/eth_cheat_codes.ts +16 -4
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +82 -6
- package/src/test/start_anvil.ts +177 -29
- package/src/test/upgrade_utils.ts +2 -2
- package/src/utils.ts +88 -14
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -67
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -209
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
- package/dest/test/delayed_tx_utils.d.ts +0 -13
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -28
- package/dest/test/tx_delayer.d.ts +0 -36
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/src/contracts/empire_slashing_proposer.ts +0 -270
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
|
@@ -1,21 +1,409 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function applyDecs2203RFactory() {
|
|
2
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
3
|
+
return function addInitializer(initializer) {
|
|
4
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
5
|
+
assertCallable(initializer, "An initializer");
|
|
6
|
+
initializers.push(initializer);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
10
|
+
var kindStr;
|
|
11
|
+
switch(kind){
|
|
12
|
+
case 1:
|
|
13
|
+
kindStr = "accessor";
|
|
14
|
+
break;
|
|
15
|
+
case 2:
|
|
16
|
+
kindStr = "method";
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
kindStr = "getter";
|
|
20
|
+
break;
|
|
21
|
+
case 4:
|
|
22
|
+
kindStr = "setter";
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
kindStr = "field";
|
|
26
|
+
}
|
|
27
|
+
var ctx = {
|
|
28
|
+
kind: kindStr,
|
|
29
|
+
name: isPrivate ? "#" + name : name,
|
|
30
|
+
static: isStatic,
|
|
31
|
+
private: isPrivate,
|
|
32
|
+
metadata: metadata
|
|
33
|
+
};
|
|
34
|
+
var decoratorFinishedRef = {
|
|
35
|
+
v: false
|
|
36
|
+
};
|
|
37
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
38
|
+
var get, set;
|
|
39
|
+
if (kind === 0) {
|
|
40
|
+
if (isPrivate) {
|
|
41
|
+
get = desc.get;
|
|
42
|
+
set = desc.set;
|
|
43
|
+
} else {
|
|
44
|
+
get = function() {
|
|
45
|
+
return this[name];
|
|
46
|
+
};
|
|
47
|
+
set = function(v) {
|
|
48
|
+
this[name] = v;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} else if (kind === 2) {
|
|
52
|
+
get = function() {
|
|
53
|
+
return desc.value;
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
if (kind === 1 || kind === 3) {
|
|
57
|
+
get = function() {
|
|
58
|
+
return desc.get.call(this);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (kind === 1 || kind === 4) {
|
|
62
|
+
set = function(v) {
|
|
63
|
+
desc.set.call(this, v);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ctx.access = get && set ? {
|
|
68
|
+
get: get,
|
|
69
|
+
set: set
|
|
70
|
+
} : get ? {
|
|
71
|
+
get: get
|
|
72
|
+
} : {
|
|
73
|
+
set: set
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
return dec(value, ctx);
|
|
77
|
+
} finally{
|
|
78
|
+
decoratorFinishedRef.v = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
82
|
+
if (decoratorFinishedRef.v) {
|
|
83
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertCallable(fn, hint) {
|
|
87
|
+
if (typeof fn !== "function") {
|
|
88
|
+
throw new TypeError(hint + " must be a function");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function assertValidReturnValue(kind, value) {
|
|
92
|
+
var type = typeof value;
|
|
93
|
+
if (kind === 1) {
|
|
94
|
+
if (type !== "object" || value === null) {
|
|
95
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
96
|
+
}
|
|
97
|
+
if (value.get !== undefined) {
|
|
98
|
+
assertCallable(value.get, "accessor.get");
|
|
99
|
+
}
|
|
100
|
+
if (value.set !== undefined) {
|
|
101
|
+
assertCallable(value.set, "accessor.set");
|
|
102
|
+
}
|
|
103
|
+
if (value.init !== undefined) {
|
|
104
|
+
assertCallable(value.init, "accessor.init");
|
|
105
|
+
}
|
|
106
|
+
} else if (type !== "function") {
|
|
107
|
+
var hint;
|
|
108
|
+
if (kind === 0) {
|
|
109
|
+
hint = "field";
|
|
110
|
+
} else if (kind === 10) {
|
|
111
|
+
hint = "class";
|
|
112
|
+
} else {
|
|
113
|
+
hint = "method";
|
|
114
|
+
}
|
|
115
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
119
|
+
var decs = decInfo[0];
|
|
120
|
+
var desc, init, value;
|
|
121
|
+
if (isPrivate) {
|
|
122
|
+
if (kind === 0 || kind === 1) {
|
|
123
|
+
desc = {
|
|
124
|
+
get: decInfo[3],
|
|
125
|
+
set: decInfo[4]
|
|
126
|
+
};
|
|
127
|
+
} else if (kind === 3) {
|
|
128
|
+
desc = {
|
|
129
|
+
get: decInfo[3]
|
|
130
|
+
};
|
|
131
|
+
} else if (kind === 4) {
|
|
132
|
+
desc = {
|
|
133
|
+
set: decInfo[3]
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
desc = {
|
|
137
|
+
value: decInfo[3]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
} else if (kind !== 0) {
|
|
141
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
142
|
+
}
|
|
143
|
+
if (kind === 1) {
|
|
144
|
+
value = {
|
|
145
|
+
get: desc.get,
|
|
146
|
+
set: desc.set
|
|
147
|
+
};
|
|
148
|
+
} else if (kind === 2) {
|
|
149
|
+
value = desc.value;
|
|
150
|
+
} else if (kind === 3) {
|
|
151
|
+
value = desc.get;
|
|
152
|
+
} else if (kind === 4) {
|
|
153
|
+
value = desc.set;
|
|
154
|
+
}
|
|
155
|
+
var newValue, get, set;
|
|
156
|
+
if (typeof decs === "function") {
|
|
157
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
158
|
+
if (newValue !== void 0) {
|
|
159
|
+
assertValidReturnValue(kind, newValue);
|
|
160
|
+
if (kind === 0) {
|
|
161
|
+
init = newValue;
|
|
162
|
+
} else if (kind === 1) {
|
|
163
|
+
init = newValue.init;
|
|
164
|
+
get = newValue.get || value.get;
|
|
165
|
+
set = newValue.set || value.set;
|
|
166
|
+
value = {
|
|
167
|
+
get: get,
|
|
168
|
+
set: set
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
value = newValue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
176
|
+
var dec = decs[i];
|
|
177
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
178
|
+
if (newValue !== void 0) {
|
|
179
|
+
assertValidReturnValue(kind, newValue);
|
|
180
|
+
var newInit;
|
|
181
|
+
if (kind === 0) {
|
|
182
|
+
newInit = newValue;
|
|
183
|
+
} else if (kind === 1) {
|
|
184
|
+
newInit = newValue.init;
|
|
185
|
+
get = newValue.get || value.get;
|
|
186
|
+
set = newValue.set || value.set;
|
|
187
|
+
value = {
|
|
188
|
+
get: get,
|
|
189
|
+
set: set
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
value = newValue;
|
|
193
|
+
}
|
|
194
|
+
if (newInit !== void 0) {
|
|
195
|
+
if (init === void 0) {
|
|
196
|
+
init = newInit;
|
|
197
|
+
} else if (typeof init === "function") {
|
|
198
|
+
init = [
|
|
199
|
+
init,
|
|
200
|
+
newInit
|
|
201
|
+
];
|
|
202
|
+
} else {
|
|
203
|
+
init.push(newInit);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (kind === 0 || kind === 1) {
|
|
210
|
+
if (init === void 0) {
|
|
211
|
+
init = function(instance, init) {
|
|
212
|
+
return init;
|
|
213
|
+
};
|
|
214
|
+
} else if (typeof init !== "function") {
|
|
215
|
+
var ownInitializers = init;
|
|
216
|
+
init = function(instance, init) {
|
|
217
|
+
var value = init;
|
|
218
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
219
|
+
value = ownInitializers[i].call(instance, value);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
var originalInitializer = init;
|
|
225
|
+
init = function(instance, init) {
|
|
226
|
+
return originalInitializer.call(instance, init);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
ret.push(init);
|
|
230
|
+
}
|
|
231
|
+
if (kind !== 0) {
|
|
232
|
+
if (kind === 1) {
|
|
233
|
+
desc.get = value.get;
|
|
234
|
+
desc.set = value.set;
|
|
235
|
+
} else if (kind === 2) {
|
|
236
|
+
desc.value = value;
|
|
237
|
+
} else if (kind === 3) {
|
|
238
|
+
desc.get = value;
|
|
239
|
+
} else if (kind === 4) {
|
|
240
|
+
desc.set = value;
|
|
241
|
+
}
|
|
242
|
+
if (isPrivate) {
|
|
243
|
+
if (kind === 1) {
|
|
244
|
+
ret.push(function(instance, args) {
|
|
245
|
+
return value.get.call(instance, args);
|
|
246
|
+
});
|
|
247
|
+
ret.push(function(instance, args) {
|
|
248
|
+
return value.set.call(instance, args);
|
|
249
|
+
});
|
|
250
|
+
} else if (kind === 2) {
|
|
251
|
+
ret.push(value);
|
|
252
|
+
} else {
|
|
253
|
+
ret.push(function(instance, args) {
|
|
254
|
+
return value.call(instance, args);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
Object.defineProperty(base, name, desc);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
263
|
+
var ret = [];
|
|
264
|
+
var protoInitializers;
|
|
265
|
+
var staticInitializers;
|
|
266
|
+
var existingProtoNonFields = new Map();
|
|
267
|
+
var existingStaticNonFields = new Map();
|
|
268
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
269
|
+
var decInfo = decInfos[i];
|
|
270
|
+
if (!Array.isArray(decInfo)) continue;
|
|
271
|
+
var kind = decInfo[1];
|
|
272
|
+
var name = decInfo[2];
|
|
273
|
+
var isPrivate = decInfo.length > 3;
|
|
274
|
+
var isStatic = kind >= 5;
|
|
275
|
+
var base;
|
|
276
|
+
var initializers;
|
|
277
|
+
if (isStatic) {
|
|
278
|
+
base = Class;
|
|
279
|
+
kind = kind - 5;
|
|
280
|
+
staticInitializers = staticInitializers || [];
|
|
281
|
+
initializers = staticInitializers;
|
|
282
|
+
} else {
|
|
283
|
+
base = Class.prototype;
|
|
284
|
+
protoInitializers = protoInitializers || [];
|
|
285
|
+
initializers = protoInitializers;
|
|
286
|
+
}
|
|
287
|
+
if (kind !== 0 && !isPrivate) {
|
|
288
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
289
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
290
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
291
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
292
|
+
} else if (!existingKind && kind > 2) {
|
|
293
|
+
existingNonFields.set(name, kind);
|
|
294
|
+
} else {
|
|
295
|
+
existingNonFields.set(name, true);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
299
|
+
}
|
|
300
|
+
pushInitializers(ret, protoInitializers);
|
|
301
|
+
pushInitializers(ret, staticInitializers);
|
|
302
|
+
return ret;
|
|
303
|
+
}
|
|
304
|
+
function pushInitializers(ret, initializers) {
|
|
305
|
+
if (initializers) {
|
|
306
|
+
ret.push(function(instance) {
|
|
307
|
+
for(var i = 0; i < initializers.length; i++){
|
|
308
|
+
initializers[i].call(instance);
|
|
309
|
+
}
|
|
310
|
+
return instance;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
315
|
+
if (classDecs.length > 0) {
|
|
316
|
+
var initializers = [];
|
|
317
|
+
var newClass = targetClass;
|
|
318
|
+
var name = targetClass.name;
|
|
319
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
320
|
+
var decoratorFinishedRef = {
|
|
321
|
+
v: false
|
|
322
|
+
};
|
|
323
|
+
try {
|
|
324
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
325
|
+
kind: "class",
|
|
326
|
+
name: name,
|
|
327
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
328
|
+
metadata
|
|
329
|
+
});
|
|
330
|
+
} finally{
|
|
331
|
+
decoratorFinishedRef.v = true;
|
|
332
|
+
}
|
|
333
|
+
if (nextNewClass !== undefined) {
|
|
334
|
+
assertValidReturnValue(10, nextNewClass);
|
|
335
|
+
newClass = nextNewClass;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
defineMetadata(newClass, metadata),
|
|
340
|
+
function() {
|
|
341
|
+
for(var i = 0; i < initializers.length; i++){
|
|
342
|
+
initializers[i].call(newClass);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function defineMetadata(Class, metadata) {
|
|
349
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
350
|
+
configurable: true,
|
|
351
|
+
enumerable: true,
|
|
352
|
+
value: metadata
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
356
|
+
if (parentClass !== void 0) {
|
|
357
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
358
|
+
}
|
|
359
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
360
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
361
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
362
|
+
return {
|
|
363
|
+
e: e,
|
|
364
|
+
get c () {
|
|
365
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
371
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
6
372
|
}
|
|
373
|
+
var _initProto;
|
|
7
374
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
8
375
|
import { memoize } from '@aztec/foundation/decorators';
|
|
9
376
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
377
|
import { GovernanceProposerAbi } from '@aztec/l1-artifacts/GovernanceProposerAbi';
|
|
11
378
|
import { encodeFunctionData, getContract } from 'viem';
|
|
12
379
|
import { encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
13
|
-
import { extractProposalIdFromLogs } from './governance.js';
|
|
380
|
+
import { ReadOnlyGovernanceContract, extractProposalIdFromLogs } from './governance.js';
|
|
14
381
|
export class GovernanceProposerContract {
|
|
15
382
|
client;
|
|
383
|
+
static{
|
|
384
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
385
|
+
[
|
|
386
|
+
memoize,
|
|
387
|
+
2,
|
|
388
|
+
"getRegistryAddress"
|
|
389
|
+
],
|
|
390
|
+
[
|
|
391
|
+
memoize,
|
|
392
|
+
2,
|
|
393
|
+
"getGovernance"
|
|
394
|
+
]
|
|
395
|
+
], []));
|
|
396
|
+
}
|
|
16
397
|
proposer;
|
|
398
|
+
/**
|
|
399
|
+
* Cache of bytecode-existence checks keyed by payload address. The check is stable for a
|
|
400
|
+
* contract's lifetime -- a contract either has code or it does not, and code cannot be removed
|
|
401
|
+
* after deployment (selfdestruct aside, which is not relevant here). Safe to memoize
|
|
402
|
+
* indefinitely for the lifetime of this instance.
|
|
403
|
+
*/ emptyPayloadCache;
|
|
17
404
|
constructor(client, address){
|
|
18
405
|
this.client = client;
|
|
406
|
+
this.emptyPayloadCache = (_initProto(this), new Map());
|
|
19
407
|
if (address instanceof EthAddress) {
|
|
20
408
|
address = address.toString();
|
|
21
409
|
}
|
|
@@ -78,6 +466,7 @@ export class GovernanceProposerContract {
|
|
|
78
466
|
createSignalRequest(payload) {
|
|
79
467
|
return {
|
|
80
468
|
to: this.address.toString(),
|
|
469
|
+
abi: GovernanceProposerAbi,
|
|
81
470
|
data: encodeSignal(payload)
|
|
82
471
|
};
|
|
83
472
|
}
|
|
@@ -85,14 +474,56 @@ export class GovernanceProposerContract {
|
|
|
85
474
|
const signature = await signSignalWithSig(signer, payload, slot, await this.getInstance(), this.address.toString(), chainId);
|
|
86
475
|
return {
|
|
87
476
|
to: this.address.toString(),
|
|
477
|
+
abi: GovernanceProposerAbi,
|
|
88
478
|
data: encodeSignalWithSignature(payload, signature)
|
|
89
479
|
};
|
|
90
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Resolves the Governance contract this proposer submits winners to. Lazily reads
|
|
483
|
+
* `GovernanceProposer.getGovernance()` (which itself looks the address up via the registry) and
|
|
484
|
+
* memoizes the resulting wrapper.
|
|
485
|
+
*/ async getGovernance() {
|
|
486
|
+
const address = await this.proposer.read.getGovernance();
|
|
487
|
+
return new ReadOnlyGovernanceContract(address, this.client);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Returns true iff the given original payload is currently the subject of a live (non-terminal)
|
|
491
|
+
* Governance proposal. Delegates to `ReadOnlyGovernanceContract.hasActiveProposalWithPayload`, which
|
|
492
|
+
* implements the actual sweep against the Governance contract -- this method exists only as a
|
|
493
|
+
* convenience wrapper so callers that already hold a GovernanceProposer reference don't have to
|
|
494
|
+
* resolve the Governance address themselves.
|
|
495
|
+
*/ async hasActiveProposalWithPayload(payload) {
|
|
496
|
+
const governance = await this.getGovernance();
|
|
497
|
+
return governance.hasActiveProposalWithPayload(payload);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Returns true if the given payload address has no deployed bytecode. Used as a cheap
|
|
501
|
+
* pre-flight check before casting a governance signal — voting for a zero-code address
|
|
502
|
+
* is unrecoverable.
|
|
503
|
+
*
|
|
504
|
+
* We only cache the `false` result (address has bytecode). The `true` result is NOT
|
|
505
|
+
* cached because a CREATE2-redeployed address could go from empty to populated, and
|
|
506
|
+
* caching `true` would make us keep skipping a payload that later becomes valid.
|
|
507
|
+
*/ async isPayloadEmpty(payload) {
|
|
508
|
+
const key = payload.toString();
|
|
509
|
+
if (this.emptyPayloadCache.get(key) === false) {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
const code = await this.client.getCode({
|
|
513
|
+
address: key
|
|
514
|
+
});
|
|
515
|
+
const isEmpty = !code || code === '0x';
|
|
516
|
+
if (!isEmpty) {
|
|
517
|
+
this.emptyPayloadCache.set(key, false);
|
|
518
|
+
}
|
|
519
|
+
return isEmpty;
|
|
520
|
+
}
|
|
91
521
|
async submitRoundWinner(round, l1TxUtils) {
|
|
92
522
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
93
523
|
to: this.address.toString(),
|
|
524
|
+
abi: GovernanceProposerAbi,
|
|
94
525
|
data: encodeFunctionData({
|
|
95
|
-
abi:
|
|
526
|
+
abi: GovernanceProposerAbi,
|
|
96
527
|
functionName: 'submitRoundWinner',
|
|
97
528
|
args: [
|
|
98
529
|
round
|
|
@@ -106,6 +537,3 @@ export class GovernanceProposerContract {
|
|
|
106
537
|
};
|
|
107
538
|
}
|
|
108
539
|
}
|
|
109
|
-
_ts_decorate([
|
|
110
|
-
memoize
|
|
111
|
-
], GovernanceProposerContract.prototype, "getRegistryAddress", null);
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Buffer16 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
5
|
import { InboxAbi } from '@aztec/l1-artifacts/InboxAbi';
|
|
4
6
|
import { type BlockTag, type GetContractReturnType, type Hex } from 'viem';
|
|
5
7
|
import type { DeployAztecL1ContractsReturnType } from '../deploy_aztec_l1_contracts.js';
|
|
6
8
|
import type { L1ReaderConfig } from '../l1_reader.js';
|
|
7
9
|
import type { ViemClient } from '../types.js';
|
|
10
|
+
import type { L1EventLog } from './log.js';
|
|
11
|
+
/** Arguments for the MessageSent event. */
|
|
12
|
+
export type MessageSentArgs = {
|
|
13
|
+
index: bigint;
|
|
14
|
+
leaf: Fr;
|
|
15
|
+
checkpointNumber: CheckpointNumber;
|
|
16
|
+
rollingHash: Buffer16;
|
|
17
|
+
};
|
|
18
|
+
/** Log type for MessageSent events. */
|
|
19
|
+
export type MessageSentLog = L1EventLog<MessageSentArgs>;
|
|
8
20
|
export declare class InboxContract {
|
|
9
21
|
readonly client: ViemClient;
|
|
10
22
|
private readonly inbox;
|
|
@@ -13,14 +25,23 @@ export declare class InboxContract {
|
|
|
13
25
|
constructor(client: ViemClient, address: Hex | EthAddress);
|
|
14
26
|
get address(): `0x${string}`;
|
|
15
27
|
getContract(): GetContractReturnType<typeof InboxAbi, ViemClient>;
|
|
28
|
+
getLag(opts?: {
|
|
29
|
+
blockTag?: BlockTag;
|
|
30
|
+
blockNumber?: bigint;
|
|
31
|
+
}): Promise<bigint>;
|
|
16
32
|
getState(opts?: {
|
|
17
33
|
blockTag?: BlockTag;
|
|
18
34
|
blockNumber?: bigint;
|
|
19
35
|
}): Promise<InboxContractState>;
|
|
36
|
+
/** Fetches MessageSent events within the given block range. */
|
|
37
|
+
getMessageSentEvents(fromBlock: bigint, toBlock: bigint): Promise<MessageSentLog[]>;
|
|
38
|
+
/** Fetches MessageSent events for a specific message hash around a specific block. */
|
|
39
|
+
getMessageSentEventByHash(msgHash: Hex, aroundL1BlockNumber: bigint): Promise<MessageSentLog>;
|
|
40
|
+
private mapMessageSentLog;
|
|
20
41
|
}
|
|
21
42
|
export type InboxContractState = {
|
|
22
43
|
totalMessagesInserted: bigint;
|
|
23
44
|
messagesRollingHash: Buffer16;
|
|
24
45
|
treeInProgress: bigint;
|
|
25
46
|
};
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5ib3guZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdHMvaW5ib3gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbkUsT0FBTyxFQUFFLFFBQVEsRUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBQzlELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBRXhELE9BQU8sRUFBRSxLQUFLLFFBQVEsRUFBRSxLQUFLLHFCQUFxQixFQUFFLEtBQUssR0FBRyxFQUFlLE1BQU0sTUFBTSxDQUFDO0FBR3hGLE9BQU8sS0FBSyxFQUFFLGdDQUFnQyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDeEYsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQzlDLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUczQywyQ0FBMkM7QUFDM0MsTUFBTSxNQUFNLGVBQWUsR0FBRztJQUM1QixLQUFLLEVBQUUsTUFBTSxDQUFDO0lBQ2QsSUFBSSxFQUFFLEVBQUUsQ0FBQztJQUNULGdCQUFnQixFQUFFLGdCQUFnQixDQUFDO0lBQ25DLFdBQVcsRUFBRSxRQUFRLENBQUM7Q0FDdkIsQ0FBQztBQUVGLHVDQUF1QztBQUN2QyxNQUFNLE1BQU0sY0FBYyxHQUFHLFVBQVUsQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUV6RCxxQkFBYSxhQUFhO2FBa0JOLE1BQU0sRUFBRSxVQUFVO0lBakJwQyxPQUFPLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBcUQ7SUFFM0UsTUFBTSxDQUFDLHdCQUF3QixDQUFDLHVCQUF1QixFQUFFLGdDQUFnQyxpQkFNeEY7SUFFRCxNQUFNLENBQUMsYUFBYSxDQUFDLE1BQU0sRUFBRSxjQUFjLGlCQUkxQztJQUVELFlBQ2tCLE1BQU0sRUFBRSxVQUFVLEVBQ2xDLE9BQU8sRUFBRSxHQUFHLEdBQUcsVUFBVSxFQU0xQjtJQUVELElBQVcsT0FBTyxrQkFFakI7SUFFTSxXQUFXLElBQUkscUJBQXFCLENBQUMsT0FBTyxRQUFRLEVBQUUsVUFBVSxDQUFDLENBRXZFO0lBRVksTUFBTSxDQUFDLElBQUksR0FBRTtRQUFFLFFBQVEsQ0FBQyxFQUFFLFFBQVEsQ0FBQztRQUFDLFdBQVcsQ0FBQyxFQUFFLE1BQU0sQ0FBQTtLQUFPLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUc3RjtJQUVZLFFBQVEsQ0FBQyxJQUFJLEdBQUU7UUFBRSxRQUFRLENBQUMsRUFBRSxRQUFRLENBQUM7UUFBQyxXQUFXLENBQUMsRUFBRSxNQUFNLENBQUE7S0FBTyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQVEzRztJQUVELCtEQUErRDtJQUN6RCxvQkFBb0IsQ0FBQyxTQUFTLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBS3hGO0lBRUQsc0ZBQXNGO0lBQ2hGLHlCQUF5QixDQUFDLE9BQU8sRUFBRSxHQUFHLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FVbEc7SUFFRCxPQUFPLENBQUMsaUJBQWlCO0NBa0IxQjtBQUVELE1BQU0sTUFBTSxrQkFBa0IsR0FBRztJQUMvQixxQkFBcUIsRUFBRSxNQUFNLENBQUM7SUFDOUIsbUJBQW1CLEVBQUUsUUFBUSxDQUFDO0lBQzlCLGNBQWMsRUFBRSxNQUFNLENBQUM7Q0FDeEIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/contracts/inbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/contracts/inbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,qBAAqB,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAGxF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,EAAE,CAAC;IACT,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,EAAE,QAAQ,CAAC;CACvB,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAEzD,qBAAa,aAAa;aAkBN,MAAM,EAAE,UAAU;IAjBpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqD;IAE3E,MAAM,CAAC,wBAAwB,CAAC,uBAAuB,EAAE,gCAAgC,iBAMxF;IAED,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,iBAI1C;IAED,YACkB,MAAM,EAAE,UAAU,EAClC,OAAO,EAAE,GAAG,GAAG,UAAU,EAM1B;IAED,IAAW,OAAO,kBAEjB;IAEM,WAAW,IAAI,qBAAqB,CAAC,OAAO,QAAQ,EAAE,UAAU,CAAC,CAEvE;IAEY,MAAM,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7F;IAEY,QAAQ,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAQ3G;IAED,+DAA+D;IACzD,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAKxF;IAED,sFAAsF;IAChF,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAUlG;IAED,OAAO,CAAC,iBAAiB;CAkB1B;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,QAAQ,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
package/dest/contracts/inbox.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { maxBigint } from '@aztec/foundation/bigint';
|
|
2
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
6
|
import { InboxAbi } from '@aztec/l1-artifacts/InboxAbi';
|
|
4
7
|
import { getContract } from 'viem';
|
|
@@ -13,7 +16,7 @@ export class InboxContract {
|
|
|
13
16
|
}
|
|
14
17
|
static getFromConfig(config) {
|
|
15
18
|
const client = getPublicClient(config);
|
|
16
|
-
const address = config.
|
|
19
|
+
const address = config.inboxAddress.toString();
|
|
17
20
|
return new InboxContract(client, address);
|
|
18
21
|
}
|
|
19
22
|
constructor(client, address){
|
|
@@ -33,6 +36,10 @@ export class InboxContract {
|
|
|
33
36
|
getContract() {
|
|
34
37
|
return this.inbox;
|
|
35
38
|
}
|
|
39
|
+
async getLag(opts = {}) {
|
|
40
|
+
await checkBlockTag(opts.blockNumber, this.client);
|
|
41
|
+
return await this.inbox.read.LAG(opts);
|
|
42
|
+
}
|
|
36
43
|
async getState(opts = {}) {
|
|
37
44
|
await checkBlockTag(opts.blockNumber, this.client);
|
|
38
45
|
const state = await this.inbox.read.getState(opts);
|
|
@@ -42,4 +49,37 @@ export class InboxContract {
|
|
|
42
49
|
treeInProgress: state.inProgress
|
|
43
50
|
};
|
|
44
51
|
}
|
|
52
|
+
/** Fetches MessageSent events within the given block range. */ async getMessageSentEvents(fromBlock, toBlock) {
|
|
53
|
+
const logs = await this.inbox.getEvents.MessageSent({}, {
|
|
54
|
+
fromBlock,
|
|
55
|
+
toBlock
|
|
56
|
+
});
|
|
57
|
+
return logs.filter((log)=>log.blockNumber >= fromBlock && log.blockNumber <= toBlock).map((log)=>this.mapMessageSentLog(log));
|
|
58
|
+
}
|
|
59
|
+
/** Fetches MessageSent events for a specific message hash around a specific block. */ async getMessageSentEventByHash(msgHash, aroundL1BlockNumber) {
|
|
60
|
+
// We don't use blockHash here because we don't want the query to throw if the L1 block number no longer exists on chain
|
|
61
|
+
// due to an L1 reorg. The use case for this method is usually checking if a message still exists on the Inbox after
|
|
62
|
+
// a reorg, so it's possible the message was moved one block up or down, and that the original L1 block where we
|
|
63
|
+
// saw it no longer exists, rendering the block-by-hash approach invalid.
|
|
64
|
+
const [log] = await this.inbox.getEvents.MessageSent({
|
|
65
|
+
hash: msgHash
|
|
66
|
+
}, {
|
|
67
|
+
fromBlock: maxBigint(aroundL1BlockNumber - 5n, 1n),
|
|
68
|
+
toBlock: aroundL1BlockNumber + 5n
|
|
69
|
+
});
|
|
70
|
+
return log && this.mapMessageSentLog(log);
|
|
71
|
+
}
|
|
72
|
+
mapMessageSentLog(log) {
|
|
73
|
+
return {
|
|
74
|
+
l1BlockNumber: log.blockNumber,
|
|
75
|
+
l1BlockHash: Buffer32.fromString(log.blockHash),
|
|
76
|
+
l1TransactionHash: log.transactionHash,
|
|
77
|
+
args: {
|
|
78
|
+
index: log.args.index,
|
|
79
|
+
leaf: Fr.fromString(log.args.hash),
|
|
80
|
+
checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber),
|
|
81
|
+
rollingHash: Buffer16.fromString(log.args.rollingHash)
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
45
85
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
export * from './chain_state_override.js';
|
|
1
2
|
export * from './empire_base.js';
|
|
2
3
|
export * from './errors.js';
|
|
3
4
|
export * from './fee_asset_handler.js';
|
|
5
|
+
export * from './fee_asset_price_oracle.js';
|
|
4
6
|
export * from './fee_juice.js';
|
|
5
7
|
export * from './governance.js';
|
|
6
8
|
export * from './governance_proposer.js';
|
|
7
9
|
export * from './gse.js';
|
|
8
10
|
export * from './inbox.js';
|
|
11
|
+
export * from './log.js';
|
|
9
12
|
export * from './multicall.js';
|
|
13
|
+
export * from './outbox.js';
|
|
10
14
|
export * from './registry.js';
|
|
11
15
|
export * from './rollup.js';
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './tally_slashing_proposer.js';
|
|
16
|
+
export * from './slashing_proposer.js';
|
|
14
17
|
export * from './slasher_contract.js';
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyw2QkFBNkIsQ0FBQztBQUM1QyxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyx1QkFBdUIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
package/dest/contracts/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
export * from './chain_state_override.js';
|
|
1
2
|
export * from './empire_base.js';
|
|
2
3
|
export * from './errors.js';
|
|
3
4
|
export * from './fee_asset_handler.js';
|
|
5
|
+
export * from './fee_asset_price_oracle.js';
|
|
4
6
|
export * from './fee_juice.js';
|
|
5
7
|
export * from './governance.js';
|
|
6
8
|
export * from './governance_proposer.js';
|
|
7
9
|
export * from './gse.js';
|
|
8
10
|
export * from './inbox.js';
|
|
11
|
+
export * from './log.js';
|
|
9
12
|
export * from './multicall.js';
|
|
13
|
+
export * from './outbox.js';
|
|
10
14
|
export * from './registry.js';
|
|
11
15
|
export * from './rollup.js';
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './tally_slashing_proposer.js';
|
|
16
|
+
export * from './slashing_proposer.js';
|
|
14
17
|
export * from './slasher_contract.js';
|