@mainsail/evm-consensus 0.0.1-evm.5 → 0.0.1-evm.50
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/distribution/deployer.d.ts +12 -1
- package/distribution/deployer.d.ts.map +1 -1
- package/distribution/deployer.js +261 -65
- package/distribution/deployer.js.map +1 -1
- package/distribution/identifiers.d.ts +3 -0
- package/distribution/identifiers.d.ts.map +1 -1
- package/distribution/identifiers.js +3 -0
- package/distribution/identifiers.js.map +1 -1
- package/distribution/index.d.ts +2 -6
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +2 -27
- package/distribution/index.js.map +1 -1
- package/distribution/service-provider.d.ts +8 -0
- package/distribution/service-provider.d.ts.map +1 -0
- package/distribution/service-provider.js +49 -0
- package/distribution/service-provider.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 +146 -0
- package/distribution/services/consensus-contract-service.js.map +1 -0
- package/distribution/services/rounds-iterator.d.ts +12 -0
- package/distribution/services/rounds-iterator.d.ts.map +1 -0
- package/distribution/services/rounds-iterator.js +101 -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 +80 -0
- package/distribution/services/votes-iterator.js.map +1 -0
- package/distribution/validator-set.d.ts +5 -4
- package/distribution/validator-set.d.ts.map +1 -1
- package/distribution/validator-set.js +57 -129
- package/distribution/validator-set.js.map +1 -1
- package/package.json +15 -12
- package/distribution/selector.d.ts +0 -9
- package/distribution/selector.d.ts.map +0 -1
- package/distribution/selector.js +0 -60
- package/distribution/selector.js.map +0 -1
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
2
|
+
export interface GenesisBlockInfo {
|
|
3
|
+
readonly timestamp: number;
|
|
4
|
+
readonly initialSupply: string;
|
|
5
|
+
readonly generatorAddress: string;
|
|
6
|
+
readonly initialBlockNumber: number;
|
|
7
|
+
}
|
|
1
8
|
export declare class Deployer {
|
|
2
9
|
#private;
|
|
3
10
|
private readonly app;
|
|
4
11
|
private readonly configuration;
|
|
12
|
+
private readonly events;
|
|
5
13
|
private readonly logger;
|
|
6
14
|
private readonly evm;
|
|
7
|
-
|
|
15
|
+
private readonly deployerAddress;
|
|
16
|
+
private readonly hashFactory;
|
|
17
|
+
deploy(genesisBlockInfo: GenesisBlockInfo): Promise<void>;
|
|
18
|
+
getDeploymentEvents(): Contracts.Evm.DeployerContract[];
|
|
8
19
|
}
|
|
9
20
|
//# sourceMappingURL=deployer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../source/deployer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../source/deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAUrD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACpC;AAED,qBACa,QAAQ;;IAEpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAGpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAG3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAIlD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAG9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAW;IAG3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAU/C,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsS/D,mBAAmB,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB,EAAE;CAsB9D"}
|
package/distribution/deployer.js
CHANGED
|
@@ -7,91 +7,275 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
|
|
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_deployerAddress, _Deployer_nonce, _Deployer_generateTxHash;
|
|
10
|
+
import { Events, Identifiers } from "@mainsail/constants";
|
|
22
11
|
import { inject, injectable, tagged } from "@mainsail/container";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { ethers, sha256 } from "ethers";
|
|
12
|
+
import { ConsensusAbi, ERC1967ProxyAbi, MultiPaymentAbi, UsernamesAbi } from "@mainsail/evm-contracts";
|
|
13
|
+
import { assert } from "@mainsail/utils";
|
|
14
|
+
import { encodeDeployData, encodeFunctionData, getCreateAddress, toBytes } from "viem";
|
|
27
15
|
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
16
|
let Deployer = class Deployer {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
app;
|
|
18
|
+
configuration;
|
|
19
|
+
events;
|
|
20
|
+
logger;
|
|
21
|
+
evm;
|
|
22
|
+
deployerAddress;
|
|
23
|
+
hashFactory;
|
|
24
|
+
#genesisBlockInfo;
|
|
25
|
+
#nonce = 0;
|
|
26
|
+
#needsCommit = false;
|
|
27
|
+
#generateTxHash = () => this.hashFactory.sha256(Buffer.from(`tx-${this.deployerAddress}-${this.#nonce++}`, "utf8")).toString("hex");
|
|
28
|
+
async deploy(genesisBlockInfo) {
|
|
29
|
+
this.#genesisBlockInfo = genesisBlockInfo;
|
|
30
|
+
const { commitKey } = this.#getBlockContext();
|
|
31
|
+
await this.#initialize(commitKey);
|
|
32
|
+
const consensusContractAddress = await this.#deployConsensusContract();
|
|
33
|
+
await this.#deployConsensusProxy(consensusContractAddress);
|
|
34
|
+
const usernamesContractAddress = await this.#deployUsernamesContract();
|
|
35
|
+
await this.#deployUsernamesProxy(usernamesContractAddress);
|
|
36
|
+
const multiPaymentContractAddress = await this.#deployMultiPaymentContract();
|
|
37
|
+
await this.#deployMultiPaymentProxy(multiPaymentContractAddress);
|
|
38
|
+
if (this.#needsCommit) {
|
|
39
|
+
await this.evm.onCommit({
|
|
40
|
+
commitKey,
|
|
41
|
+
getBlock: () => ({ ...commitKey, number: commitKey.blockNumber }),
|
|
42
|
+
setAccountUpdates: () => ({}),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
36
45
|
}
|
|
37
|
-
async
|
|
38
|
-
|
|
39
|
-
Utils.assert.defined(genesisBlock);
|
|
40
|
-
const validatorContractAddress = ethers.getCreateAddress({ from: __classPrivateFieldGet(this, _Deployer_deployerAddress, "f"), nonce: 0 });
|
|
46
|
+
async #initialize(commitKey) {
|
|
47
|
+
assert.defined(this.#genesisBlockInfo);
|
|
41
48
|
const genesisInfo = {
|
|
42
|
-
account:
|
|
43
|
-
deployerAccount:
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
account: this.#genesisBlockInfo.generatorAddress,
|
|
50
|
+
deployerAccount: this.deployerAddress,
|
|
51
|
+
initialBlockNumber: BigInt(this.#genesisBlockInfo.initialBlockNumber),
|
|
52
|
+
initialSupply: BigInt(this.#genesisBlockInfo.initialSupply),
|
|
53
|
+
usernameContract: getCreateAddress({ from: this.deployerAddress, nonce: 3n }), // PROXY Uses nonce 3
|
|
54
|
+
validatorContract: getCreateAddress({ from: this.deployerAddress, nonce: 1n }), // PROXY Uses nonce 1
|
|
46
55
|
};
|
|
56
|
+
await this.evm.prepareNextCommit({ commitKey });
|
|
47
57
|
await this.evm.initializeGenesis(genesisInfo);
|
|
48
|
-
|
|
58
|
+
this.app.bind(EvmConsensusIdentifiers.Internal.GenesisInfo).toConstantValue(genesisInfo);
|
|
59
|
+
}
|
|
60
|
+
#getBlockContext() {
|
|
61
|
+
const milestone = this.configuration.getMilestone();
|
|
49
62
|
// Commit Key chosen in a way such that it does not conflict with blocks.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
commitKey,
|
|
63
|
+
return {
|
|
64
|
+
commitKey: { blockNumber: BigInt(2 ** 32 + 1), round: BigInt(0) },
|
|
53
65
|
gasLimit: BigInt(milestone.block.maxGasLimit),
|
|
54
|
-
timestamp: BigInt(
|
|
55
|
-
validatorAddress:
|
|
66
|
+
timestamp: BigInt(this.#genesisBlockInfo.timestamp),
|
|
67
|
+
validatorAddress: this.deployerAddress,
|
|
56
68
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
}
|
|
70
|
+
#getSpecId() {
|
|
71
|
+
const milestone = this.configuration.getMilestone();
|
|
72
|
+
return milestone.evmSpec;
|
|
73
|
+
}
|
|
74
|
+
async #deployConsensusContract() {
|
|
75
|
+
// CONSENSUS
|
|
76
|
+
const receipt = await this.#processTransaction({
|
|
77
|
+
blockContext: this.#getBlockContext(),
|
|
78
|
+
data: Buffer.from(toBytes(ConsensusAbi.bytecode.object)),
|
|
79
|
+
from: this.deployerAddress,
|
|
67
80
|
gasLimit: BigInt(10_000_000),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
gasPrice: BigInt(0),
|
|
82
|
+
nonce: BigInt(0),
|
|
83
|
+
specId: this.#getSpecId(),
|
|
84
|
+
txHash: this.#generateTxHash(),
|
|
71
85
|
value: 0n,
|
|
72
86
|
});
|
|
73
|
-
if (!
|
|
87
|
+
if (!receipt.status) {
|
|
74
88
|
throw new Error("failed to deploy Consensus contract");
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
if (result.receipt.deployedContractAddress !== validatorContractAddress) {
|
|
90
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 0n })) {
|
|
78
91
|
throw new Error("Contract address mismatch");
|
|
79
92
|
}
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
this.logger.info(`Deployed Consensus contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
94
|
+
return receipt.contractAddress;
|
|
95
|
+
}
|
|
96
|
+
async #deployConsensusProxy(consensusContractAddress) {
|
|
97
|
+
const milestone = this.configuration.getMilestone();
|
|
98
|
+
// Encode the initializer call
|
|
99
|
+
const initializerCalldata = encodeFunctionData({
|
|
100
|
+
abi: ConsensusAbi.abi,
|
|
101
|
+
args: [milestone.validatorRegistrationFee],
|
|
102
|
+
functionName: "initialize",
|
|
103
|
+
});
|
|
104
|
+
// Prepare the constructor arguments for the proxy contract
|
|
105
|
+
const deployData = encodeDeployData({
|
|
106
|
+
abi: ERC1967ProxyAbi.abi,
|
|
107
|
+
args: [consensusContractAddress, initializerCalldata],
|
|
108
|
+
bytecode: ERC1967ProxyAbi.bytecode.object,
|
|
109
|
+
});
|
|
110
|
+
const receipt = await this.#processTransaction({
|
|
111
|
+
blockContext: this.#getBlockContext(),
|
|
112
|
+
data: Buffer.from(toBytes(deployData)),
|
|
113
|
+
from: this.deployerAddress,
|
|
114
|
+
gasLimit: BigInt(10_000_000),
|
|
115
|
+
gasPrice: BigInt(0),
|
|
116
|
+
nonce: BigInt(1),
|
|
117
|
+
specId: this.#getSpecId(),
|
|
118
|
+
txHash: this.#generateTxHash(),
|
|
119
|
+
value: 0n,
|
|
120
|
+
});
|
|
121
|
+
if (!receipt.status) {
|
|
122
|
+
throw new Error("failed to deploy Consensus PROXY contract");
|
|
123
|
+
}
|
|
124
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 1n })) {
|
|
125
|
+
throw new Error("Contract address mismatch");
|
|
126
|
+
}
|
|
127
|
+
this.logger.info(`Deployed Consensus PROXY contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
128
|
+
this.#emitContractDeployed({
|
|
129
|
+
activeImplementation: consensusContractAddress,
|
|
130
|
+
address: receipt.contractAddress,
|
|
131
|
+
implementations: [{ abi: ConsensusAbi.abi, address: consensusContractAddress }],
|
|
132
|
+
name: "consensus",
|
|
133
|
+
proxy: "UUPS",
|
|
134
|
+
});
|
|
135
|
+
this.app.bind(EvmConsensusIdentifiers.Contracts.Addresses.Consensus).toConstantValue(receipt.contractAddress);
|
|
136
|
+
}
|
|
137
|
+
async #deployUsernamesContract() {
|
|
138
|
+
const receipt = await this.#processTransaction({
|
|
139
|
+
blockContext: this.#getBlockContext(),
|
|
140
|
+
data: Buffer.from(toBytes(UsernamesAbi.bytecode.object)),
|
|
141
|
+
from: this.deployerAddress,
|
|
142
|
+
gasLimit: BigInt(10_000_000),
|
|
143
|
+
gasPrice: BigInt(0),
|
|
144
|
+
nonce: BigInt(2),
|
|
145
|
+
specId: this.#getSpecId(),
|
|
146
|
+
txHash: this.#generateTxHash(),
|
|
147
|
+
value: 0n,
|
|
148
|
+
});
|
|
149
|
+
if (!receipt.status) {
|
|
150
|
+
throw new Error("failed to deploy Usernames contract");
|
|
151
|
+
}
|
|
152
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 2n })) {
|
|
153
|
+
throw new Error("Contract address mismatch");
|
|
154
|
+
}
|
|
155
|
+
this.logger.info(`Deployed Usernames contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
156
|
+
return receipt.contractAddress;
|
|
157
|
+
}
|
|
158
|
+
async #deployUsernamesProxy(usernamesContractAddress) {
|
|
159
|
+
// Encode the initializer call
|
|
160
|
+
const initializerCalldata = encodeFunctionData({
|
|
161
|
+
abi: UsernamesAbi.abi,
|
|
162
|
+
args: undefined,
|
|
163
|
+
functionName: "initialize",
|
|
164
|
+
});
|
|
165
|
+
// Prepare the constructor arguments for the proxy contract
|
|
166
|
+
const deployData = encodeDeployData({
|
|
167
|
+
abi: ERC1967ProxyAbi.abi,
|
|
168
|
+
args: [usernamesContractAddress, initializerCalldata],
|
|
169
|
+
bytecode: ERC1967ProxyAbi.bytecode.object,
|
|
170
|
+
});
|
|
171
|
+
const receipt = await this.#processTransaction({
|
|
172
|
+
blockContext: this.#getBlockContext(),
|
|
173
|
+
data: Buffer.from(toBytes(deployData)),
|
|
174
|
+
from: this.deployerAddress,
|
|
175
|
+
gasLimit: BigInt(10_000_000),
|
|
176
|
+
gasPrice: BigInt(0),
|
|
177
|
+
nonce: BigInt(3),
|
|
178
|
+
specId: this.#getSpecId(),
|
|
179
|
+
txHash: this.#generateTxHash(),
|
|
180
|
+
value: 0n,
|
|
89
181
|
});
|
|
182
|
+
if (!receipt.status) {
|
|
183
|
+
throw new Error("failed to deploy Usernames PROXY contract");
|
|
184
|
+
}
|
|
185
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 3n })) {
|
|
186
|
+
throw new Error("Contract address mismatch");
|
|
187
|
+
}
|
|
188
|
+
this.logger.info(`Deployed Usernames PROXY contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
189
|
+
this.#emitContractDeployed({
|
|
190
|
+
activeImplementation: usernamesContractAddress,
|
|
191
|
+
address: receipt.contractAddress,
|
|
192
|
+
implementations: [{ abi: UsernamesAbi.abi, address: usernamesContractAddress }],
|
|
193
|
+
name: "usernames",
|
|
194
|
+
proxy: "UUPS",
|
|
195
|
+
});
|
|
196
|
+
this.app.bind(EvmConsensusIdentifiers.Contracts.Addresses.Usernames).toConstantValue(receipt.contractAddress);
|
|
197
|
+
}
|
|
198
|
+
async #deployMultiPaymentContract() {
|
|
199
|
+
const receipt = await this.#processTransaction({
|
|
200
|
+
blockContext: this.#getBlockContext(),
|
|
201
|
+
data: Buffer.concat([Buffer.from(toBytes(MultiPaymentAbi.bytecode.object))]),
|
|
202
|
+
from: this.deployerAddress,
|
|
203
|
+
gasLimit: BigInt(10_000_000),
|
|
204
|
+
gasPrice: BigInt(0),
|
|
205
|
+
nonce: BigInt(4),
|
|
206
|
+
specId: this.#getSpecId(),
|
|
207
|
+
txHash: this.#generateTxHash(),
|
|
208
|
+
value: 0n,
|
|
209
|
+
});
|
|
210
|
+
if (!receipt.status) {
|
|
211
|
+
throw new Error("failed to deploy MultiPayment contract");
|
|
212
|
+
}
|
|
213
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 4n })) {
|
|
214
|
+
throw new Error("Contract address mismatch");
|
|
215
|
+
}
|
|
216
|
+
this.logger.info(`Deployed MultiPayment contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
217
|
+
return receipt.contractAddress;
|
|
218
|
+
}
|
|
219
|
+
async #deployMultiPaymentProxy(multiPaymentAddress) {
|
|
220
|
+
// Encode the initializer call
|
|
221
|
+
const initializerCalldata = encodeFunctionData({
|
|
222
|
+
abi: MultiPaymentAbi.abi,
|
|
223
|
+
args: undefined,
|
|
224
|
+
functionName: "initialize",
|
|
225
|
+
});
|
|
226
|
+
// Prepare the constructor arguments for the proxy contract
|
|
227
|
+
const deployData = encodeDeployData({
|
|
228
|
+
abi: ERC1967ProxyAbi.abi,
|
|
229
|
+
args: [multiPaymentAddress, initializerCalldata],
|
|
230
|
+
bytecode: ERC1967ProxyAbi.bytecode.object,
|
|
231
|
+
});
|
|
232
|
+
const receipt = await this.#processTransaction({
|
|
233
|
+
blockContext: this.#getBlockContext(),
|
|
234
|
+
data: Buffer.from(toBytes(deployData)),
|
|
235
|
+
from: this.deployerAddress,
|
|
236
|
+
gasLimit: BigInt(10_000_000),
|
|
237
|
+
gasPrice: BigInt(0),
|
|
238
|
+
nonce: BigInt(5),
|
|
239
|
+
specId: this.#getSpecId(),
|
|
240
|
+
txHash: this.#generateTxHash(),
|
|
241
|
+
value: 0n,
|
|
242
|
+
});
|
|
243
|
+
if (!receipt.status) {
|
|
244
|
+
throw new Error("failed to deploy MultiPayment PROXY contract");
|
|
245
|
+
}
|
|
246
|
+
if (receipt.contractAddress !== getCreateAddress({ from: this.deployerAddress, nonce: 5n })) {
|
|
247
|
+
throw new Error("Contract address mismatch");
|
|
248
|
+
}
|
|
249
|
+
this.logger.info(`Deployed MultiPayment PROXY contract from ${this.deployerAddress} to ${receipt.contractAddress}`);
|
|
250
|
+
this.#emitContractDeployed({
|
|
251
|
+
activeImplementation: multiPaymentAddress,
|
|
252
|
+
address: receipt.contractAddress,
|
|
253
|
+
implementations: [{ abi: MultiPaymentAbi.abi, address: multiPaymentAddress }],
|
|
254
|
+
name: "multi-payments",
|
|
255
|
+
proxy: "UUPS",
|
|
256
|
+
});
|
|
257
|
+
this.app
|
|
258
|
+
.bind(EvmConsensusIdentifiers.Contracts.Addresses.MultiPayment)
|
|
259
|
+
.toConstantValue(receipt.contractAddress);
|
|
260
|
+
}
|
|
261
|
+
getDeploymentEvents() {
|
|
262
|
+
return this.#deploymentEvents;
|
|
263
|
+
}
|
|
264
|
+
#deploymentEvents = [];
|
|
265
|
+
#emitContractDeployed(event) {
|
|
266
|
+
this.#deploymentEvents.push(event);
|
|
267
|
+
void this.events.dispatch(Events.DeployerEvent.ContractCreated, event);
|
|
268
|
+
}
|
|
269
|
+
async #processTransaction(context) {
|
|
270
|
+
const { receipt } = await this.evm.getReceipt(context.blockContext.commitKey.blockNumber, context.txHash);
|
|
271
|
+
if (receipt) {
|
|
272
|
+
return receipt;
|
|
273
|
+
}
|
|
274
|
+
const result = await this.evm.process(context);
|
|
275
|
+
this.#needsCommit = true;
|
|
276
|
+
return result.receipt;
|
|
90
277
|
}
|
|
91
278
|
};
|
|
92
|
-
_Deployer_deployerAddress = new WeakMap();
|
|
93
|
-
_Deployer_nonce = new WeakMap();
|
|
94
|
-
_Deployer_generateTxHash = new WeakMap();
|
|
95
279
|
__decorate([
|
|
96
280
|
inject(Identifiers.Application.Instance),
|
|
97
281
|
__metadata("design:type", Object)
|
|
@@ -100,6 +284,10 @@ __decorate([
|
|
|
100
284
|
inject(Identifiers.Cryptography.Configuration),
|
|
101
285
|
__metadata("design:type", Object)
|
|
102
286
|
], Deployer.prototype, "configuration", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
inject(Identifiers.Services.EventDispatcher.Service),
|
|
289
|
+
__metadata("design:type", Object)
|
|
290
|
+
], Deployer.prototype, "events", void 0);
|
|
103
291
|
__decorate([
|
|
104
292
|
inject(Identifiers.Services.Log.Service),
|
|
105
293
|
__metadata("design:type", Object)
|
|
@@ -109,6 +297,14 @@ __decorate([
|
|
|
109
297
|
tagged("instance", "evm"),
|
|
110
298
|
__metadata("design:type", Object)
|
|
111
299
|
], Deployer.prototype, "evm", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
inject(EvmConsensusIdentifiers.Internal.Addresses.Deployer),
|
|
302
|
+
__metadata("design:type", String)
|
|
303
|
+
], Deployer.prototype, "deployerAddress", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
inject(Identifiers.Cryptography.Hash.Factory),
|
|
306
|
+
__metadata("design:type", Object)
|
|
307
|
+
], Deployer.prototype, "hashFactory", void 0);
|
|
112
308
|
Deployer = __decorate([
|
|
113
309
|
injectable()
|
|
114
310
|
], Deployer);
|
|
@@ -1 +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,MAAM,yBAAyB,CAAC;AACvD,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;QAcN,+DAA+D;QAC/D,oCAAmB,4CAA4C,EAAC;QA0EhE,0BAAS,CAAC,EAAC;QACX,mCAAkB,GAAG,EAAE,eAAC,OAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,uBAAA,IAAI,iCAAiB,IAAI,8CAAA,CAAA,uDAAW,EAAX,KAAA,IAAa,IAAA,CAAA,MAAA,IAAA,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,EAAA,EAAC;IAC9G,CAAC;IA1EO,KAAK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AAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;;wCACM;AAG1C;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;;iDACjB;AAG1B;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;6CACc;AArBhD,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CA2VpB"}
|
|
@@ -2,12 +2,15 @@ export declare const Identifiers: {
|
|
|
2
2
|
Contracts: {
|
|
3
3
|
Addresses: {
|
|
4
4
|
Consensus: symbol;
|
|
5
|
+
MultiPayment: symbol;
|
|
6
|
+
Usernames: symbol;
|
|
5
7
|
};
|
|
6
8
|
};
|
|
7
9
|
Internal: {
|
|
8
10
|
Addresses: {
|
|
9
11
|
Deployer: symbol;
|
|
10
12
|
};
|
|
13
|
+
Deployer: symbol;
|
|
11
14
|
GenesisInfo: symbol;
|
|
12
15
|
};
|
|
13
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CAevB,CAAC"}
|
|
@@ -2,12 +2,15 @@ export const Identifiers = {
|
|
|
2
2
|
Contracts: {
|
|
3
3
|
Addresses: {
|
|
4
4
|
Consensus: Symbol.for("Evm.Consensus<Contracts.Addresses.Consensus>"),
|
|
5
|
+
MultiPayment: Symbol.for("Evm.Consensus<Contracts.Addresses.MultiPayment>"),
|
|
6
|
+
Usernames: Symbol.for("Evm.Consensus<Contracts.Addresses.Usernames>"),
|
|
5
7
|
},
|
|
6
8
|
},
|
|
7
9
|
Internal: {
|
|
8
10
|
Addresses: {
|
|
9
11
|
Deployer: Symbol.for("Evm.Consensus<Internal.Addresses.Deployer>"),
|
|
10
12
|
},
|
|
13
|
+
Deployer: Symbol.for("Evm.Consensus<Internal.Deployer>"),
|
|
11
14
|
GenesisInfo: Symbol.for("Evm.Consensus<Internal.GenesisInfo>"),
|
|
12
15
|
},
|
|
13
16
|
};
|
|
@@ -1 +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;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"}
|
|
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,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC;YAC3E,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,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC;QACxD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC;KAC9D;CACD,CAAC"}
|
package/distribution/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare class ServiceProvider extends Providers.ServiceProvider {
|
|
4
|
-
register(): Promise<void>;
|
|
5
|
-
boot(): Promise<void>;
|
|
6
|
-
}
|
|
1
|
+
export * from "./identifiers.js";
|
|
2
|
+
export * from "./service-provider.js";
|
|
7
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
package/distribution/index.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { Selector } from "./selector.js";
|
|
12
|
-
import { ValidatorSet } from "./validator-set.js";
|
|
13
|
-
export { Identifiers } from "./identifiers.js";
|
|
14
|
-
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
|
15
|
-
async register() {
|
|
16
|
-
this.app.bind(Identifiers.ValidatorSet.Service).to(ValidatorSet).inSingletonScope();
|
|
17
|
-
this.app.bind(Identifiers.Proposer.Selector).to(Selector).inSingletonScope();
|
|
18
|
-
}
|
|
19
|
-
async boot() {
|
|
20
|
-
this.app.get(Identifiers.Services.Log.Service).info("Booting EVM Consensus...");
|
|
21
|
-
await this.app.resolve(Deployer).deploy();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
ServiceProvider = __decorate([
|
|
25
|
-
injectable()
|
|
26
|
-
], ServiceProvider);
|
|
27
|
-
export { ServiceProvider };
|
|
1
|
+
export * from "./identifiers.js";
|
|
2
|
+
export * from "./service-provider.js";
|
|
28
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Providers } from "@mainsail/kernel";
|
|
2
|
+
export declare class ServiceProvider extends Providers.ServiceProvider {
|
|
3
|
+
#private;
|
|
4
|
+
register(): Promise<void>;
|
|
5
|
+
boot(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export { Deployer } from "./deployer.js";
|
|
8
|
+
//# sourceMappingURL=service-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IASzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBlC;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { Identifiers } from "@mainsail/constants";
|
|
8
|
+
import { injectable } from "@mainsail/container";
|
|
9
|
+
import { Providers } from "@mainsail/kernel";
|
|
10
|
+
import { assert } from "@mainsail/utils";
|
|
11
|
+
import { Deployer } from "./deployer.js";
|
|
12
|
+
import { Identifiers as EvmConsensusIdentifiers } from "./identifiers.js";
|
|
13
|
+
import { ConsensusContractService } from "./services/consensus-contract-service.js";
|
|
14
|
+
import { ValidatorSet } from "./validator-set.js";
|
|
15
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
|
16
|
+
async register() {
|
|
17
|
+
this.app.bind(Identifiers.ValidatorSet.Service).to(ValidatorSet).inSingletonScope();
|
|
18
|
+
this.app.bind(Identifiers.Evm.ContractService.Consensus).to(ConsensusContractService);
|
|
19
|
+
this.app.bind(EvmConsensusIdentifiers.Internal.Deployer).to(Deployer).inSingletonScope();
|
|
20
|
+
this.app
|
|
21
|
+
.bind(EvmConsensusIdentifiers.Internal.Addresses.Deployer)
|
|
22
|
+
.toConstantValue("0x0000000000000000000000000000000000000001");
|
|
23
|
+
}
|
|
24
|
+
async boot() {
|
|
25
|
+
this.app.get(Identifiers.Services.Log.Service).info("Booting EVM Consensus...");
|
|
26
|
+
const genesisBlock = this.app.config("crypto.genesisBlock");
|
|
27
|
+
assert.defined(genesisBlock);
|
|
28
|
+
await this.app.get(EvmConsensusIdentifiers.Internal.Deployer).deploy({
|
|
29
|
+
generatorAddress: genesisBlock.block.proposer,
|
|
30
|
+
initialBlockNumber: genesisBlock.block.number,
|
|
31
|
+
initialSupply: this.#calculateInitialSupply(genesisBlock),
|
|
32
|
+
timestamp: genesisBlock.block.timestamp,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
#calculateInitialSupply(genesisBlock) {
|
|
36
|
+
const generatorAddress = genesisBlock.block.proposer;
|
|
37
|
+
let supply = 0n;
|
|
38
|
+
for (const transaction of genesisBlock.block.transactions.filter((tx) => tx.from === generatorAddress)) {
|
|
39
|
+
supply += BigInt(transaction.value);
|
|
40
|
+
}
|
|
41
|
+
return supply.toString();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
ServiceProvider = __decorate([
|
|
45
|
+
injectable()
|
|
46
|
+
], ServiceProvider);
|
|
47
|
+
export { ServiceProvider };
|
|
48
|
+
export { Deployer } from "./deployer.js";
|
|
49
|
+
//# sourceMappingURL=service-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,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,CAAC,KAAK,CAAC,SAAS;SACvC,CAAC,CAAC;IACJ,CAAC;IAED,uBAAuB,CAAC,YAAyC;QAChE,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC;QAErD,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,KAAK,MAAM,WAAW,IAAI,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,gBAAgB,CAAC,EAAE,CAAC;YACxG,MAAM,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACD,CAAA;AAnCY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAmC3B;;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { 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
|
+
getRoundValidators(): 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":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAsBrD,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,kBAAkB,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAkDhE,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAkDpE,kBAAkB,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;IAI3D,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IA+BtC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;CAG7C"}
|