@mainsail/evm-consensus 0.0.1-evm.10
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/LICENSE +623 -0
- package/README.md +19 -0
- package/distribution/deployer.d.ts +10 -0
- package/distribution/deployer.d.ts.map +1 -0
- package/distribution/deployer.js +236 -0
- package/distribution/deployer.js.map +1 -0
- package/distribution/identifiers.d.ts +15 -0
- package/distribution/identifiers.d.ts.map +1 -0
- package/distribution/identifiers.js +15 -0
- package/distribution/identifiers.js.map +1 -0
- package/distribution/index.d.ts +7 -0
- package/distribution/index.d.ts.map +1 -0
- package/distribution/index.js +34 -0
- package/distribution/index.js.map +1 -0
- package/distribution/selector.d.ts +9 -0
- package/distribution/selector.d.ts.map +1 -0
- package/distribution/selector.js +60 -0
- package/distribution/selector.js.map +1 -0
- package/distribution/services/consensus-contract-service.d.ts +12 -0
- package/distribution/services/consensus-contract-service.d.ts.map +1 -0
- package/distribution/services/consensus-contract-service.js +121 -0
- package/distribution/services/consensus-contract-service.js.map +1 -0
- package/distribution/services/rounds-iterator.d.ts +11 -0
- package/distribution/services/rounds-iterator.d.ts.map +1 -0
- package/distribution/services/rounds-iterator.js +104 -0
- package/distribution/services/rounds-iterator.js.map +1 -0
- package/distribution/services/votes-iterator.d.ts +11 -0
- package/distribution/services/votes-iterator.d.ts.map +1 -0
- package/distribution/services/votes-iterator.js +85 -0
- package/distribution/services/votes-iterator.js.map +1 -0
- package/distribution/validator-set.d.ts +14 -0
- package/distribution/validator-set.d.ts.map +1 -0
- package/distribution/validator-set.js +109 -0
- package/distribution/validator-set.js.map +1 -0
- package/package.json +39 -0
@@ -0,0 +1,236 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
14
|
+
};
|
15
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
16
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
19
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
20
|
+
};
|
21
|
+
var _Deployer_instances, _Deployer_nonce, _Deployer_generateTxHash, _Deployer_initialize, _Deployer_getBlockContext, _Deployer_getSpecId, _Deployer_deployConsensusContract, _Deployer_deployConsensusProxy, _Deployer_deployUsernamesContract, _Deployer_deployUsernamesProxy, _Deployer_deployMultiPaymentsContract;
|
22
|
+
import { inject, injectable, tagged } from "@mainsail/container";
|
23
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
24
|
+
import { ConsensusAbi, ERC1967ProxyAbi, MultiPaymentAbi, UsernamesAbi } from "@mainsail/evm-contracts";
|
25
|
+
import { Utils } from "@mainsail/kernel";
|
26
|
+
import { ethers, sha256 } from "ethers";
|
27
|
+
import { Identifiers as EvmConsensusIdentifiers } from "./identifiers.js";
|
28
|
+
// TODO: extract "evm-deployer" package to manage nonce, etc. when deploying protocol contracts.
|
29
|
+
// Also see "evm-development" which this code is originally based on.
|
30
|
+
let Deployer = class Deployer {
|
31
|
+
constructor() {
|
32
|
+
_Deployer_instances.add(this);
|
33
|
+
_Deployer_nonce.set(this, 0);
|
34
|
+
_Deployer_generateTxHash.set(this, () => { var _a, _b; return sha256(Buffer.from(`tx-${this.deployerAddress}-${__classPrivateFieldSet(this, _Deployer_nonce, (_b = __classPrivateFieldGet(this, _Deployer_nonce, "f"), _a = _b++, _b), "f"), _a}`, "utf8")).slice(2); });
|
35
|
+
}
|
36
|
+
async deploy() {
|
37
|
+
await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_initialize).call(this);
|
38
|
+
const consensusContractAddress = await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_deployConsensusContract).call(this);
|
39
|
+
await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_deployConsensusProxy).call(this, consensusContractAddress);
|
40
|
+
const usernamesContractAddress = await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_deployUsernamesContract).call(this);
|
41
|
+
await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_deployUsernamesProxy).call(this, usernamesContractAddress);
|
42
|
+
await __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_deployMultiPaymentsContract).call(this);
|
43
|
+
await this.evm.onCommit({
|
44
|
+
...__classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this).commitKey,
|
45
|
+
getBlock: () => ({ data: { round: BigInt(0) } }),
|
46
|
+
setAccountUpdates: () => ({}),
|
47
|
+
});
|
48
|
+
}
|
49
|
+
};
|
50
|
+
_Deployer_nonce = new WeakMap();
|
51
|
+
_Deployer_generateTxHash = new WeakMap();
|
52
|
+
_Deployer_instances = new WeakSet();
|
53
|
+
_Deployer_initialize = async function _Deployer_initialize() {
|
54
|
+
const genesisBlock = this.app.config("crypto.genesisBlock");
|
55
|
+
Utils.assert.defined(genesisBlock);
|
56
|
+
const genesisInfo = {
|
57
|
+
account: genesisBlock.block.generatorAddress,
|
58
|
+
deployerAccount: this.deployerAddress,
|
59
|
+
initialSupply: Utils.BigNumber.make(genesisBlock.block.totalAmount).toBigInt(),
|
60
|
+
validatorContract: ethers.getCreateAddress({ from: this.deployerAddress, nonce: 1 }), // PROXY Uses nonce 1
|
61
|
+
};
|
62
|
+
await this.evm.initializeGenesis(genesisInfo);
|
63
|
+
this.app.bind(EvmConsensusIdentifiers.Internal.GenesisInfo).toConstantValue(genesisInfo);
|
64
|
+
};
|
65
|
+
_Deployer_getBlockContext = function _Deployer_getBlockContext() {
|
66
|
+
const genesisBlock = this.app.config("crypto.genesisBlock");
|
67
|
+
Utils.assert.defined(genesisBlock);
|
68
|
+
const milestone = this.configuration.getMilestone(0);
|
69
|
+
// Commit Key chosen in a way such that it does not conflict with blocks.
|
70
|
+
return {
|
71
|
+
commitKey: { height: BigInt(2 ** 32 + 1), round: BigInt(0) },
|
72
|
+
gasLimit: BigInt(milestone.block.maxGasLimit),
|
73
|
+
timestamp: BigInt(genesisBlock.block.timestamp),
|
74
|
+
validatorAddress: this.deployerAddress,
|
75
|
+
};
|
76
|
+
};
|
77
|
+
_Deployer_getSpecId = function _Deployer_getSpecId() {
|
78
|
+
const milestone = this.configuration.getMilestone(0);
|
79
|
+
return milestone.evmSpec;
|
80
|
+
};
|
81
|
+
_Deployer_deployConsensusContract = async function _Deployer_deployConsensusContract() {
|
82
|
+
// CONSENSUS
|
83
|
+
const consensusResult = await this.evm.process({
|
84
|
+
blockContext: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this),
|
85
|
+
caller: this.deployerAddress,
|
86
|
+
data: Buffer.concat([Buffer.from(ethers.getBytes(ConsensusAbi.bytecode.object))]),
|
87
|
+
gasLimit: BigInt(10_000_000),
|
88
|
+
nonce: BigInt(0),
|
89
|
+
specId: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getSpecId).call(this),
|
90
|
+
txHash: __classPrivateFieldGet(this, _Deployer_generateTxHash, "f").call(this),
|
91
|
+
value: 0n,
|
92
|
+
});
|
93
|
+
if (!consensusResult.receipt.success) {
|
94
|
+
throw new Error("failed to deploy Consensus contract");
|
95
|
+
}
|
96
|
+
if (consensusResult.receipt.deployedContractAddress !==
|
97
|
+
ethers.getCreateAddress({ from: this.deployerAddress, nonce: 0 })) {
|
98
|
+
throw new Error("Contract address mismatch");
|
99
|
+
}
|
100
|
+
this.logger.info(`Deployed Consensus contract from ${this.deployerAddress} to ${consensusResult.receipt.deployedContractAddress}`);
|
101
|
+
return consensusResult.receipt.deployedContractAddress;
|
102
|
+
};
|
103
|
+
_Deployer_deployConsensusProxy = async function _Deployer_deployConsensusProxy(consensusContractAddress) {
|
104
|
+
// Logic contract initializer function ABI
|
105
|
+
const logicInterface = new ethers.Interface(ConsensusAbi.abi);
|
106
|
+
// Encode the initializer call
|
107
|
+
const initializerCalldata = logicInterface.encodeFunctionData("initialize");
|
108
|
+
// Prepare the constructor arguments for the proxy contract
|
109
|
+
const proxyConstructorArguments = new ethers.AbiCoder()
|
110
|
+
.encode(["address", "bytes"], [consensusContractAddress, initializerCalldata])
|
111
|
+
.slice(2);
|
112
|
+
const proxyResult = await this.evm.process({
|
113
|
+
blockContext: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this),
|
114
|
+
caller: this.deployerAddress,
|
115
|
+
data: Buffer.concat([
|
116
|
+
Buffer.from(ethers.getBytes(ERC1967ProxyAbi.bytecode.object)),
|
117
|
+
Buffer.from(proxyConstructorArguments, "hex"),
|
118
|
+
]),
|
119
|
+
gasLimit: BigInt(10_000_000),
|
120
|
+
nonce: BigInt(1),
|
121
|
+
specId: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getSpecId).call(this),
|
122
|
+
txHash: __classPrivateFieldGet(this, _Deployer_generateTxHash, "f").call(this),
|
123
|
+
value: 0n,
|
124
|
+
});
|
125
|
+
if (!proxyResult.receipt.success) {
|
126
|
+
throw new Error("failed to deploy Consensus PROXY contract");
|
127
|
+
}
|
128
|
+
if (proxyResult.receipt.deployedContractAddress !==
|
129
|
+
ethers.getCreateAddress({ from: this.deployerAddress, nonce: 1 })) {
|
130
|
+
throw new Error("Contract address mismatch");
|
131
|
+
}
|
132
|
+
this.logger.info(`Deployed Consensus PROXY contract from ${this.deployerAddress} to ${proxyResult.receipt.deployedContractAddress}`);
|
133
|
+
this.app
|
134
|
+
.bind(EvmConsensusIdentifiers.Contracts.Addresses.Consensus)
|
135
|
+
.toConstantValue(proxyResult.receipt.deployedContractAddress);
|
136
|
+
};
|
137
|
+
_Deployer_deployUsernamesContract = async function _Deployer_deployUsernamesContract() {
|
138
|
+
const result = await this.evm.process({
|
139
|
+
blockContext: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this),
|
140
|
+
caller: this.deployerAddress,
|
141
|
+
data: Buffer.concat([Buffer.from(ethers.getBytes(UsernamesAbi.bytecode.object))]),
|
142
|
+
gasLimit: BigInt(10_000_000),
|
143
|
+
nonce: BigInt(2),
|
144
|
+
specId: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getSpecId).call(this),
|
145
|
+
txHash: __classPrivateFieldGet(this, _Deployer_generateTxHash, "f").call(this),
|
146
|
+
value: 0n,
|
147
|
+
});
|
148
|
+
if (!result.receipt.success) {
|
149
|
+
throw new Error("failed to deploy Usernames contract");
|
150
|
+
}
|
151
|
+
if (result.receipt.deployedContractAddress !== ethers.getCreateAddress({ from: this.deployerAddress, nonce: 2 })) {
|
152
|
+
throw new Error("Contract address mismatch");
|
153
|
+
}
|
154
|
+
this.logger.info(`Deployed Usernames contract from ${this.deployerAddress} to ${result.receipt.deployedContractAddress}`);
|
155
|
+
return result.receipt.deployedContractAddress;
|
156
|
+
};
|
157
|
+
_Deployer_deployUsernamesProxy = async function _Deployer_deployUsernamesProxy(usernamesContractAddress) {
|
158
|
+
// Logic contract initializer function ABI
|
159
|
+
const logicInterface = new ethers.Interface(UsernamesAbi.abi);
|
160
|
+
// Encode the initializer call
|
161
|
+
const initializerCalldata = logicInterface.encodeFunctionData("initialize");
|
162
|
+
// Prepare the constructor arguments for the proxy contract
|
163
|
+
const proxyConstructorArguments = new ethers.AbiCoder()
|
164
|
+
.encode(["address", "bytes"], [usernamesContractAddress, initializerCalldata])
|
165
|
+
.slice(2);
|
166
|
+
const proxyResult = await this.evm.process({
|
167
|
+
blockContext: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this),
|
168
|
+
caller: this.deployerAddress,
|
169
|
+
data: Buffer.concat([
|
170
|
+
Buffer.from(ethers.getBytes(ERC1967ProxyAbi.bytecode.object)),
|
171
|
+
Buffer.from(proxyConstructorArguments, "hex"),
|
172
|
+
]),
|
173
|
+
gasLimit: BigInt(10_000_000),
|
174
|
+
nonce: BigInt(3),
|
175
|
+
specId: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getSpecId).call(this),
|
176
|
+
txHash: __classPrivateFieldGet(this, _Deployer_generateTxHash, "f").call(this),
|
177
|
+
value: 0n,
|
178
|
+
});
|
179
|
+
if (!proxyResult.receipt.success) {
|
180
|
+
throw new Error("failed to deploy Usernames PROXY contract");
|
181
|
+
}
|
182
|
+
if (proxyResult.receipt.deployedContractAddress !==
|
183
|
+
ethers.getCreateAddress({ from: this.deployerAddress, nonce: 3 })) {
|
184
|
+
throw new Error("Contract address mismatch");
|
185
|
+
}
|
186
|
+
this.logger.info(`Deployed Usernames PROXY contract from ${this.deployerAddress} to ${proxyResult.receipt.deployedContractAddress}`);
|
187
|
+
this.app
|
188
|
+
.bind(EvmConsensusIdentifiers.Contracts.Addresses.Usernames)
|
189
|
+
.toConstantValue(proxyResult.receipt.deployedContractAddress);
|
190
|
+
};
|
191
|
+
_Deployer_deployMultiPaymentsContract = async function _Deployer_deployMultiPaymentsContract() {
|
192
|
+
const result = await this.evm.process({
|
193
|
+
blockContext: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getBlockContext).call(this),
|
194
|
+
caller: this.deployerAddress,
|
195
|
+
data: Buffer.concat([Buffer.from(ethers.getBytes(MultiPaymentAbi.bytecode.object))]),
|
196
|
+
gasLimit: BigInt(10_000_000),
|
197
|
+
nonce: BigInt(4),
|
198
|
+
specId: __classPrivateFieldGet(this, _Deployer_instances, "m", _Deployer_getSpecId).call(this),
|
199
|
+
txHash: __classPrivateFieldGet(this, _Deployer_generateTxHash, "f").call(this),
|
200
|
+
value: 0n,
|
201
|
+
});
|
202
|
+
if (!result.receipt.success) {
|
203
|
+
throw new Error("failed to deploy MultiPayments contract");
|
204
|
+
}
|
205
|
+
if (result.receipt.deployedContractAddress !== ethers.getCreateAddress({ from: this.deployerAddress, nonce: 4 })) {
|
206
|
+
throw new Error("Contract address mismatch");
|
207
|
+
}
|
208
|
+
this.logger.info(`Deployed MultiPayments contract from ${this.deployerAddress} to ${result.receipt.deployedContractAddress}`);
|
209
|
+
return result.receipt.deployedContractAddress;
|
210
|
+
};
|
211
|
+
__decorate([
|
212
|
+
inject(Identifiers.Application.Instance),
|
213
|
+
__metadata("design:type", Object)
|
214
|
+
], Deployer.prototype, "app", void 0);
|
215
|
+
__decorate([
|
216
|
+
inject(Identifiers.Cryptography.Configuration),
|
217
|
+
__metadata("design:type", Object)
|
218
|
+
], Deployer.prototype, "configuration", void 0);
|
219
|
+
__decorate([
|
220
|
+
inject(Identifiers.Services.Log.Service),
|
221
|
+
__metadata("design:type", Object)
|
222
|
+
], Deployer.prototype, "logger", void 0);
|
223
|
+
__decorate([
|
224
|
+
inject(Identifiers.Evm.Instance),
|
225
|
+
tagged("instance", "evm"),
|
226
|
+
__metadata("design:type", Object)
|
227
|
+
], Deployer.prototype, "evm", void 0);
|
228
|
+
__decorate([
|
229
|
+
inject(EvmConsensusIdentifiers.Internal.Addresses.Deployer),
|
230
|
+
__metadata("design:type", String)
|
231
|
+
], Deployer.prototype, "deployerAddress", void 0);
|
232
|
+
Deployer = __decorate([
|
233
|
+
injectable()
|
234
|
+
], Deployer);
|
235
|
+
export { Deployer };
|
236
|
+
//# sourceMappingURL=deployer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deployer.js","sourceRoot":"","sources":["../source/deployer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,gGAAgG;AAChG,qEAAqE;AAG9D,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAAd;;QAiBN,0BAAS,CAAC,EAAC;QACX,mCAAkB,GAAG,EAAE,eAAC,OAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,IAAI,8CAAA,CAAA,uDAAW,EAAX,KAAA,IAAa,IAAA,CAAA,MAAA,IAAA,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,EAAA,EAAC;IAwO7G,CAAC;IAtOO,KAAK,CAAC,MAAM;QAClB,MAAM,uBAAA,IAAI,iDAAY,MAAhB,IAAI,CAAc,CAAC;QAEzB,MAAM,wBAAwB,GAAG,MAAM,uBAAA,IAAI,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,IAAI,CACf,wCAAwC,IAAI,CAAC,eAAe,OAAO,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAC3G,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,uBAAwB,CAAC;AAChD,CAAC;AAvPgB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;qCACW;AAGnC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;+CACiB;AAG/C;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;wCACS;AAIjC;IAFhB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC;;qCACoB;AAG7B;IADhB,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;;iDAClB;AAf9B,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CA0PpB"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare const Identifiers: {
|
2
|
+
Contracts: {
|
3
|
+
Addresses: {
|
4
|
+
Consensus: symbol;
|
5
|
+
Usernames: symbol;
|
6
|
+
};
|
7
|
+
};
|
8
|
+
Internal: {
|
9
|
+
Addresses: {
|
10
|
+
Deployer: symbol;
|
11
|
+
};
|
12
|
+
GenesisInfo: symbol;
|
13
|
+
};
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=identifiers.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export const Identifiers = {
|
2
|
+
Contracts: {
|
3
|
+
Addresses: {
|
4
|
+
Consensus: Symbol.for("Evm.Consensus<Contracts.Addresses.Consensus>"),
|
5
|
+
Usernames: Symbol.for("Evm.Consensus<Contracts.Addresses.Usernames>"),
|
6
|
+
},
|
7
|
+
},
|
8
|
+
Internal: {
|
9
|
+
Addresses: {
|
10
|
+
Deployer: Symbol.for("Evm.Consensus<Internal.Addresses.Deployer>"),
|
11
|
+
},
|
12
|
+
GenesisInfo: Symbol.for("Evm.Consensus<Internal.GenesisInfo>"),
|
13
|
+
},
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=identifiers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,SAAS,EAAE;QACV,SAAS,EAAE;YACV,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC;YACrE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC;SACrE;KACD;IACD,QAAQ,EAAE;QACT,SAAS,EAAE;YACV,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC;SAClE;QACD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC;KAC9D;CACD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAWzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAKlC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { injectable } from "@mainsail/container";
|
8
|
+
import { Identifiers } from "@mainsail/contracts";
|
9
|
+
import { Providers } from "@mainsail/kernel";
|
10
|
+
import { Deployer } from "./deployer.js";
|
11
|
+
import { Identifiers as EvmConsensusIdentifiers } from "./identifiers.js";
|
12
|
+
import { Selector } from "./selector.js";
|
13
|
+
import { ConsensusContractService } from "./services/consensus-contract-service.js";
|
14
|
+
import { ValidatorSet } from "./validator-set.js";
|
15
|
+
export { Identifiers } from "./identifiers.js";
|
16
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
17
|
+
async register() {
|
18
|
+
this.app.bind(Identifiers.ValidatorSet.Service).to(ValidatorSet).inSingletonScope();
|
19
|
+
this.app.bind(Identifiers.Proposer.Selector).to(Selector).inSingletonScope();
|
20
|
+
this.app.bind(Identifiers.Evm.ContractService.Consensus).to(ConsensusContractService);
|
21
|
+
this.app
|
22
|
+
.bind(EvmConsensusIdentifiers.Internal.Addresses.Deployer)
|
23
|
+
.toConstantValue("0x0000000000000000000000000000000000000001");
|
24
|
+
}
|
25
|
+
async boot() {
|
26
|
+
this.app.get(Identifiers.Services.Log.Service).info("Booting EVM Consensus...");
|
27
|
+
await this.app.resolve(Deployer).deploy();
|
28
|
+
}
|
29
|
+
};
|
30
|
+
ServiceProvider = __decorate([
|
31
|
+
injectable()
|
32
|
+
], ServiceProvider);
|
33
|
+
export { ServiceProvider };
|
34
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],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AC,OAAO,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAEzG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3C,CAAC;CACD,CAAA;AAjBY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAiB3B"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Contracts } from "@mainsail/contracts";
|
2
|
+
export declare class Selector implements Contracts.Proposer.Selector {
|
3
|
+
private readonly configuration;
|
4
|
+
private readonly stateStore;
|
5
|
+
private validatorMatrix;
|
6
|
+
onCommit(unit: Contracts.Processor.ProcessableUnit): Promise<void>;
|
7
|
+
getValidatorIndex(round: number): number;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=selector.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../source/selector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAI7D,qBACa,QAAS,YAAW,SAAS,CAAC,QAAQ,CAAC,QAAQ;IAE3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IAEpD,OAAO,CAAC,eAAe,CAAoD;IAE9D,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAgC/C"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { inject, injectable } from "@mainsail/container";
|
11
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
+
import { Utils } from "@mainsail/kernel";
|
13
|
+
// import seedrandom from "seedrandom";
|
14
|
+
let Selector = class Selector {
|
15
|
+
constructor() {
|
16
|
+
this.validatorMatrix = [...Array.from({ length: 53 }).keys()];
|
17
|
+
// #updateValidatorMatrix(unit: Contracts.Processor.ProcessableUnit): void {
|
18
|
+
// const seed = this.#calculateSeed(unit.store);
|
19
|
+
// const rng = seedrandom(seed);
|
20
|
+
// const { activeValidators } = this.configuration.getMilestone();
|
21
|
+
// const matrix = [...Array.from({ length: activeValidators }).keys()];
|
22
|
+
// // Based on https://stackoverflow.com/a/12646864
|
23
|
+
// for (let index = matrix.length - 1; index > 0; index--) {
|
24
|
+
// const index_ = Math.floor(rng() * (index + 1));
|
25
|
+
// [matrix[index], matrix[index_]] = [matrix[index_], matrix[index]];
|
26
|
+
// }
|
27
|
+
// unit.store.setAttribute<string>("validatorMatrix", JSON.stringify(matrix));
|
28
|
+
// }
|
29
|
+
// #calculateSeed(store: Contracts.State.Store): string {
|
30
|
+
// const totalRound = store.getTotalRound();
|
31
|
+
// // TODO: take block id into account
|
32
|
+
// return `${totalRound}`;
|
33
|
+
// }
|
34
|
+
}
|
35
|
+
async onCommit(unit) {
|
36
|
+
// if (Utils.roundCalculator.isNewRound(unit.height + 1, this.configuration)) {
|
37
|
+
// this.#updateValidatorMatrix(unit);
|
38
|
+
// }
|
39
|
+
}
|
40
|
+
getValidatorIndex(round) {
|
41
|
+
const { activeValidators } = this.configuration.getMilestone();
|
42
|
+
const offset = (this.stateStore.getTotalRound() + round) % activeValidators;
|
43
|
+
const result = this.validatorMatrix[offset % activeValidators];
|
44
|
+
Utils.assert.defined(result);
|
45
|
+
return result;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
__decorate([
|
49
|
+
inject(Identifiers.Cryptography.Configuration),
|
50
|
+
__metadata("design:type", Object)
|
51
|
+
], Selector.prototype, "configuration", void 0);
|
52
|
+
__decorate([
|
53
|
+
inject(Identifiers.State.Store),
|
54
|
+
__metadata("design:type", Object)
|
55
|
+
], Selector.prototype, "stateStore", void 0);
|
56
|
+
Selector = __decorate([
|
57
|
+
injectable()
|
58
|
+
], Selector);
|
59
|
+
export { Selector };
|
60
|
+
//# sourceMappingURL=selector.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"selector.js","sourceRoot":"","sources":["../source/selector.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,uCAAuC;AAGhC,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAAd;QAOE,oBAAe,GAAa,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAiB3E,4EAA4E;QAC5E,iDAAiD;QACjD,iCAAiC;QAEjC,mEAAmE;QACnE,wEAAwE;QAExE,oDAAoD;QACpD,6DAA6D;QAC7D,oDAAoD;QACpD,uEAAuE;QACvE,KAAK;QAEL,+EAA+E;QAC/E,IAAI;QAEJ,yDAAyD;QACzD,6CAA6C;QAE7C,uCAAuC;QAEvC,2BAA2B;QAC3B,IAAI;IACL,CAAC;IAtCO,KAAK,CAAC,QAAQ,CAAC,IAAyC;QAC9D,+EAA+E;QAC/E,sCAAsC;QACtC,IAAI;IACL,CAAC;IAEM,iBAAiB,CAAC,KAAa;QACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;QAE/D,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,GAAG,gBAAgB,CAAC;QAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC;QAC/D,KAAK,CAAC,MAAM,CAAC,OAAO,CAAS,MAAM,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC;IACf,CAAC;CAyBD,CAAA;AA7CiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;+CACiB;AAG/C;IADhB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;;4CACoB;AALxC,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CA+CpB"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Contracts } from "@mainsail/contracts";
|
2
|
+
export declare class ConsensusContractService implements Contracts.Evm.ConsensusContractService {
|
3
|
+
private readonly app;
|
4
|
+
private readonly configuration;
|
5
|
+
private readonly evm;
|
6
|
+
getActiveValidators(): Promise<Contracts.State.ValidatorWallet[]>;
|
7
|
+
getAllValidators(): Promise<Contracts.State.ValidatorWallet[]>;
|
8
|
+
getValidatorRounds(): AsyncIterable<Contracts.Evm.ValidatorRound>;
|
9
|
+
getVotesCount(): Promise<number>;
|
10
|
+
getVotes(): AsyncIterable<Contracts.Evm.Vote>;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=consensus-contract-service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"consensus-contract-service.d.ts","sourceRoot":"","sources":["../../source/services/consensus-contract-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAS7D,qBACa,wBAAyB,YAAW,SAAS,CAAC,GAAG,CAAC,wBAAwB;IAEtF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAGpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAIhE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAExC,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAuCjE,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAuCpE,kBAAkB,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;IAI3D,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAwBtC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;CAG7C"}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { inject, injectable, tagged } from "@mainsail/container";
|
11
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
+
import { ConsensusAbi } from "@mainsail/evm-contracts";
|
13
|
+
import { BigNumber } from "@mainsail/utils";
|
14
|
+
import { ethers } from "ethers";
|
15
|
+
import { Identifiers as EvmConsensusIdentifiers } from "../identifiers.js";
|
16
|
+
import { AsyncValidatorRoundsIterator } from "./rounds-iterator.js";
|
17
|
+
import { AsyncVotesIterator } from "./votes-iterator.js";
|
18
|
+
let ConsensusContractService = class ConsensusContractService {
|
19
|
+
async getActiveValidators() {
|
20
|
+
const consensusContractAddress = this.app.get(EvmConsensusIdentifiers.Contracts.Addresses.Consensus);
|
21
|
+
const deployerAddress = this.app.get(EvmConsensusIdentifiers.Internal.Addresses.Deployer);
|
22
|
+
const { evmSpec } = this.configuration.getMilestone();
|
23
|
+
const iface = new ethers.Interface(ConsensusAbi.abi);
|
24
|
+
const data = iface.encodeFunctionData("getActiveValidators").slice(2);
|
25
|
+
const result = await this.evm.view({
|
26
|
+
caller: deployerAddress,
|
27
|
+
data: Buffer.from(data, "hex"),
|
28
|
+
recipient: consensusContractAddress,
|
29
|
+
specId: evmSpec,
|
30
|
+
});
|
31
|
+
if (!result.success) {
|
32
|
+
await this.app.terminate("getActiveValidators failed");
|
33
|
+
}
|
34
|
+
const [validators] = iface.decodeFunctionResult("getActiveValidators", result.output);
|
35
|
+
const validatorWallets = [];
|
36
|
+
for (const [, validator] of validators.entries()) {
|
37
|
+
const [address, [votersCount, voteBalance, isResigned, blsPublicKey]] = validator;
|
38
|
+
const validatorWallet = {
|
39
|
+
address,
|
40
|
+
blsPublicKey: blsPublicKey.slice(2),
|
41
|
+
isResigned,
|
42
|
+
voteBalance: BigNumber.make(voteBalance),
|
43
|
+
votersCount: Number(votersCount),
|
44
|
+
};
|
45
|
+
validatorWallets.push(validatorWallet);
|
46
|
+
}
|
47
|
+
return validatorWallets;
|
48
|
+
}
|
49
|
+
async getAllValidators() {
|
50
|
+
const consensusContractAddress = this.app.get(EvmConsensusIdentifiers.Contracts.Addresses.Consensus);
|
51
|
+
const deployerAddress = this.app.get(EvmConsensusIdentifiers.Internal.Addresses.Deployer);
|
52
|
+
const { evmSpec } = this.configuration.getMilestone();
|
53
|
+
const iface = new ethers.Interface(ConsensusAbi.abi);
|
54
|
+
const data = iface.encodeFunctionData("getAllValidators").slice(2);
|
55
|
+
const result = await this.evm.view({
|
56
|
+
caller: deployerAddress,
|
57
|
+
data: Buffer.from(data, "hex"),
|
58
|
+
recipient: consensusContractAddress,
|
59
|
+
specId: evmSpec,
|
60
|
+
});
|
61
|
+
if (!result.success) {
|
62
|
+
await this.app.terminate("getAllValidators failed");
|
63
|
+
}
|
64
|
+
const [validators] = iface.decodeFunctionResult("getAllValidators", result.output);
|
65
|
+
const validatorWallets = [];
|
66
|
+
for (const [, validator] of validators.entries()) {
|
67
|
+
const [address, [votersCount, voteBalance, isResigned, blsPublicKey]] = validator;
|
68
|
+
const validatorWallet = {
|
69
|
+
address,
|
70
|
+
blsPublicKey: blsPublicKey.slice(2),
|
71
|
+
isResigned,
|
72
|
+
voteBalance: BigNumber.make(voteBalance),
|
73
|
+
votersCount: Number(votersCount),
|
74
|
+
};
|
75
|
+
validatorWallets.push(validatorWallet);
|
76
|
+
}
|
77
|
+
return validatorWallets;
|
78
|
+
}
|
79
|
+
getValidatorRounds() {
|
80
|
+
return this.app.resolve(AsyncValidatorRoundsIterator);
|
81
|
+
}
|
82
|
+
async getVotesCount() {
|
83
|
+
const consensusContractAddress = this.app.get(EvmConsensusIdentifiers.Contracts.Addresses.Consensus);
|
84
|
+
const deployerAddress = this.app.get(EvmConsensusIdentifiers.Internal.Addresses.Deployer);
|
85
|
+
const { evmSpec } = this.configuration.getMilestone();
|
86
|
+
const iface = new ethers.Interface(ConsensusAbi.abi);
|
87
|
+
const data = iface.encodeFunctionData("getVotesCount").slice(2);
|
88
|
+
const result = await this.evm.view({
|
89
|
+
caller: deployerAddress,
|
90
|
+
data: Buffer.from(data, "hex"),
|
91
|
+
recipient: consensusContractAddress,
|
92
|
+
specId: evmSpec,
|
93
|
+
});
|
94
|
+
if (!result.success) {
|
95
|
+
await this.app.terminate("getVotesCount failed");
|
96
|
+
}
|
97
|
+
const [voters] = iface.decodeFunctionResult("getVotesCount", result.output);
|
98
|
+
return Number(voters);
|
99
|
+
}
|
100
|
+
getVotes() {
|
101
|
+
return this.app.resolve(AsyncVotesIterator);
|
102
|
+
}
|
103
|
+
};
|
104
|
+
__decorate([
|
105
|
+
inject(Identifiers.Application.Instance),
|
106
|
+
__metadata("design:type", Object)
|
107
|
+
], ConsensusContractService.prototype, "app", void 0);
|
108
|
+
__decorate([
|
109
|
+
inject(Identifiers.Cryptography.Configuration),
|
110
|
+
__metadata("design:type", Object)
|
111
|
+
], ConsensusContractService.prototype, "configuration", void 0);
|
112
|
+
__decorate([
|
113
|
+
inject(Identifiers.Evm.Instance),
|
114
|
+
tagged("instance", "evm"),
|
115
|
+
__metadata("design:type", Object)
|
116
|
+
], ConsensusContractService.prototype, "evm", void 0);
|
117
|
+
ConsensusContractService = __decorate([
|
118
|
+
injectable()
|
119
|
+
], ConsensusContractService);
|
120
|
+
export { ConsensusContractService };
|
121
|
+
//# sourceMappingURL=consensus-contract-service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"consensus-contract-service.js","sourceRoot":"","sources":["../../source/services/consensus-contract-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGlD,IAAM,w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AC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEhE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;YAC9B,SAAS,EAAE,wBAAwB;YACnC,MAAM,EAAE,OAAO;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,oBAAoB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAO,CAAC,CAAC;QAE7E,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7C,CAAC;CACD,CAAA;AAtHiB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;qDACW;AAGnC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;+DACiB;AAI/C;IAFhB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC;;qDACoB;AATlC,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CAwHpC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Contracts } from "@mainsail/contracts";
|
2
|
+
export declare class AsyncValidatorRoundsIterator implements AsyncIterable<Contracts.Evm.ValidatorRound> {
|
3
|
+
#private;
|
4
|
+
private readonly app;
|
5
|
+
private readonly configuration;
|
6
|
+
private readonly evm;
|
7
|
+
[Symbol.asyncIterator](): AsyncIterator<Contracts.Evm.ValidatorRound>;
|
8
|
+
next(): Promise<IteratorResult<Contracts.Evm.ValidatorRound>>;
|
9
|
+
private getRounds;
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=rounds-iterator.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rounds-iterator.d.ts","sourceRoot":"","sources":["../../source/services/rounds-iterator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAU7D,qBACa,4BAA6B,YAAW,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;;IAE/F,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAGpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAIhE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAM9C,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;IAI/D,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAerD,SAAS;CA4CvB"}
|