@mainsail/processor 0.0.1-evm.8 → 0.0.1-rc.1
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/actions/process-block.d.ts.map +1 -1
- package/distribution/actions/process-block.js +13 -2
- package/distribution/actions/process-block.js.map +1 -1
- package/distribution/block-processor.d.ts +3 -1
- package/distribution/block-processor.d.ts.map +1 -1
- package/distribution/block-processor.js +100 -47
- package/distribution/block-processor.js.map +1 -1
- package/distribution/block-verifier.d.ts +1 -1
- package/distribution/block-verifier.d.ts.map +1 -1
- package/distribution/block-verifier.js +8 -12
- package/distribution/block-verifier.js.map +1 -1
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +31 -3
- package/distribution/index.js.map +1 -1
- package/distribution/transaction-processor.d.ts +1 -1
- package/distribution/transaction-processor.d.ts.map +1 -1
- package/distribution/transaction-processor.js +14 -12
- package/distribution/transaction-processor.js.map +1 -1
- package/distribution/verifiers/chained-verifier.d.ts +2 -1
- package/distribution/verifiers/chained-verifier.d.ts.map +1 -1
- package/distribution/verifiers/chained-verifier.js +23 -5
- package/distribution/verifiers/chained-verifier.js.map +1 -1
- package/distribution/verifiers/gas-limit-verifier.d.ts +7 -0
- package/distribution/verifiers/gas-limit-verifier.d.ts.map +1 -0
- package/distribution/verifiers/gas-limit-verifier.js +35 -0
- package/distribution/verifiers/gas-limit-verifier.js.map +1 -0
- package/distribution/verifiers/generator-verifier.d.ts +2 -1
- package/distribution/verifiers/generator-verifier.d.ts.map +1 -1
- package/distribution/verifiers/generator-verifier.js +9 -5
- package/distribution/verifiers/generator-verifier.js.map +1 -1
- package/distribution/verifiers/index.d.ts +8 -1
- package/distribution/verifiers/index.d.ts.map +1 -1
- package/distribution/verifiers/index.js +8 -1
- package/distribution/verifiers/index.js.map +1 -1
- package/distribution/verifiers/legacy-attribute-verifier.d.ts +7 -0
- package/distribution/verifiers/legacy-attribute-verifier.d.ts.map +1 -0
- package/distribution/verifiers/legacy-attribute-verifier.js +44 -0
- package/distribution/verifiers/legacy-attribute-verifier.js.map +1 -0
- package/distribution/verifiers/reward-verifier.d.ts +7 -0
- package/distribution/verifiers/reward-verifier.d.ts.map +1 -0
- package/distribution/verifiers/reward-verifier.js +32 -0
- package/distribution/verifiers/reward-verifier.js.map +1 -0
- package/distribution/verifiers/size-verifier.d.ts +8 -0
- package/distribution/verifiers/size-verifier.d.ts.map +1 -0
- package/distribution/verifiers/size-verifier.js +49 -0
- package/distribution/verifiers/size-verifier.js.map +1 -0
- package/distribution/verifiers/timestamp-verifier.d.ts +2 -1
- package/distribution/verifiers/timestamp-verifier.d.ts.map +1 -1
- package/distribution/verifiers/timestamp-verifier.js +7 -4
- package/distribution/verifiers/timestamp-verifier.js.map +1 -1
- package/distribution/verifiers/transaction-duplicates-verifier.d.ts +6 -0
- package/distribution/verifiers/transaction-duplicates-verifier.d.ts.map +1 -0
- package/distribution/verifiers/transaction-duplicates-verifier.js +32 -0
- package/distribution/verifiers/transaction-duplicates-verifier.js.map +1 -0
- package/distribution/verifiers/{nonce-verifier.d.ts → transaction-length-verifier.d.ts} +2 -2
- package/distribution/verifiers/transaction-length-verifier.d.ts.map +1 -0
- package/distribution/verifiers/transaction-length-verifier.js +28 -0
- package/distribution/verifiers/transaction-length-verifier.js.map +1 -0
- package/distribution/verifiers/transaction-root-verifier.d.ts +7 -0
- package/distribution/verifiers/transaction-root-verifier.d.ts.map +1 -0
- package/distribution/verifiers/transaction-root-verifier.js +37 -0
- package/distribution/verifiers/transaction-root-verifier.js.map +1 -0
- package/distribution/verifiers/version-verifier.d.ts +7 -0
- package/distribution/verifiers/version-verifier.d.ts.map +1 -0
- package/distribution/verifiers/version-verifier.js +32 -0
- package/distribution/verifiers/version-verifier.js.map +1 -0
- package/package.json +9 -7
- package/distribution/verifiers/nonce-verifier.d.ts.map +0 -1
- package/distribution/verifiers/nonce-verifier.js +0 -41
- package/distribution/verifiers/nonce-verifier.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-block.d.ts","sourceRoot":"","sources":["../../source/actions/process-block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-block.d.ts","sourceRoot":"","sources":["../../source/actions/process-block.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qBACa,kBAAmB,SAAQ,QAAQ,CAAC,QAAQ,CAAC,MAAM;IAClD,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC;CAM1G"}
|
|
@@ -1,9 +1,20 @@
|
|
|
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";
|
|
1
8
|
import { Services } from "@mainsail/kernel";
|
|
2
|
-
|
|
9
|
+
let ProcessBlockAction = class ProcessBlockAction extends Services.Triggers.Action {
|
|
3
10
|
async execute(arguments_) {
|
|
4
11
|
const blockProcessor = arguments_.blockProcessor;
|
|
5
12
|
const roundState = arguments_.roundState;
|
|
6
13
|
return blockProcessor.process(roundState);
|
|
7
14
|
}
|
|
8
|
-
}
|
|
15
|
+
};
|
|
16
|
+
ProcessBlockAction = __decorate([
|
|
17
|
+
injectable()
|
|
18
|
+
], ProcessBlockAction);
|
|
19
|
+
export { ProcessBlockAction };
|
|
9
20
|
//# sourceMappingURL=process-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-block.js","sourceRoot":"","sources":["../../source/actions/process-block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-block.js","sourceRoot":"","sources":["../../source/actions/process-block.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAS,MAAM,kBAAkB,CAAC;AAG5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,QAAQ,CAAC,MAAM;IACxD,KAAK,CAAC,OAAO,CAAC,UAAiC;QACrD,MAAM,cAAc,GAAuC,UAAU,CAAC,cAAc,CAAC;QACrF,MAAM,UAAU,GAAmC,UAAU,CAAC,UAAU,CAAC;QAEzE,OAAO,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACD,CAAA;AAPY,kBAAkB;IAD9B,UAAU,EAAE;GACA,kBAAkB,CAO9B"}
|
|
@@ -4,11 +4,11 @@ export declare class BlockProcessor implements Contracts.Processor.BlockProcesso
|
|
|
4
4
|
private readonly stateStore;
|
|
5
5
|
private readonly state;
|
|
6
6
|
private readonly configuration;
|
|
7
|
+
private readonly roundCalculator;
|
|
7
8
|
private readonly databaseService;
|
|
8
9
|
private readonly evm;
|
|
9
10
|
private readonly transactionProcessor;
|
|
10
11
|
private handlerRegistry;
|
|
11
|
-
private readonly proposerSelector;
|
|
12
12
|
private readonly events;
|
|
13
13
|
private readonly logger;
|
|
14
14
|
private readonly validatorSet;
|
|
@@ -16,6 +16,8 @@ export declare class BlockProcessor implements Contracts.Processor.BlockProcesso
|
|
|
16
16
|
private readonly txPoolWorker;
|
|
17
17
|
private readonly evmWorker;
|
|
18
18
|
private readonly apiSync?;
|
|
19
|
+
private readonly snapshotImporter?;
|
|
20
|
+
protected readonly feeCalculator: Contracts.BlockchainUtils.FeeCalculator;
|
|
19
21
|
process(unit: Contracts.Processor.ProcessableUnit): Promise<Contracts.Processor.BlockProcessorResult>;
|
|
20
22
|
commit(unit: Contracts.Processor.ProcessableUnit): Promise<void>;
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-processor.d.ts","sourceRoot":"","sources":["../source/block-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAGrE,qBACa,cAAe,YAAW,SAAS,CAAC,SAAS,CAAC,cAAc;;IAExE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IAGpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAG/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsC;IAItE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAG9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA4C;IAGjF,OAAO,CAAC,eAAe,CAAqD;IAG5E,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"block-processor.d.ts","sourceRoot":"","sources":["../source/block-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAGrE,qBACa,cAAe,YAAW,SAAS,CAAC,SAAS,CAAC,cAAc;;IAExE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IAGpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAG/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6C;IAG7E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsC;IAItE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAG9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA4C;IAGjF,OAAO,CAAC,eAAe,CAAqD;IAG5E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAG3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAGlD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAG/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IAGzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoC;IAGjE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAIlD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAA4B;IAIrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAoC;IAGtE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAG,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC;IAE9D,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC;IA4CrG,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA2L7E"}
|
|
@@ -12,10 +12,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
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
13
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
14
|
};
|
|
15
|
-
var _BlockProcessor_instances, _BlockProcessor_logBlockCommitted, _BlockProcessor_logNewRound, _BlockProcessor_consumeGas, _BlockProcessor_verifyConsumedAllGas,
|
|
15
|
+
var _BlockProcessor_instances, _BlockProcessor_logBlockCommitted, _BlockProcessor_logNewRound, _BlockProcessor_consumeGas, _BlockProcessor_verifyConsumedAllGas, _BlockProcessor_verifyTotalFee, _BlockProcessor_verifyStateRoot, _BlockProcessor_verifyLogsBloom, _BlockProcessor_emitTransactionEvents, _BlockProcessor_updateRewardsAndVotes, _BlockProcessor_calculateRoundValidators, _BlockProcessor_emit;
|
|
16
16
|
import { inject, injectable, optional, tagged } from "@mainsail/container";
|
|
17
17
|
import { Contracts, Events, Identifiers } from "@mainsail/contracts";
|
|
18
|
-
import {
|
|
18
|
+
import { assert, BigNumber, sleep } from "@mainsail/utils";
|
|
19
19
|
let BlockProcessor = class BlockProcessor {
|
|
20
20
|
constructor() {
|
|
21
21
|
_BlockProcessor_instances.add(this);
|
|
@@ -23,24 +23,30 @@ let BlockProcessor = class BlockProcessor {
|
|
|
23
23
|
async process(unit) {
|
|
24
24
|
const processResult = { gasUsed: 0, receipts: new Map(), success: false };
|
|
25
25
|
try {
|
|
26
|
+
await this.verifier.verify(unit);
|
|
26
27
|
const block = unit.getBlock();
|
|
27
28
|
await this.evm.prepareNextCommit({
|
|
28
|
-
commitKey: {
|
|
29
|
+
commitKey: {
|
|
30
|
+
blockHash: block.header.hash,
|
|
31
|
+
blockNumber: BigInt(block.header.number),
|
|
32
|
+
round: BigInt(block.header.round),
|
|
33
|
+
},
|
|
29
34
|
});
|
|
30
|
-
|
|
31
|
-
for (const [index, transaction] of unit.getBlock().transactions.entries()) {
|
|
35
|
+
for (const [index, transaction] of block.transactions.entries()) {
|
|
32
36
|
if (index % 20 === 0) {
|
|
33
|
-
await
|
|
37
|
+
await sleep(0);
|
|
34
38
|
}
|
|
35
39
|
const receipt = await this.transactionProcessor.process(unit, transaction);
|
|
36
|
-
processResult.receipts.set(transaction.
|
|
40
|
+
processResult.receipts.set(transaction.hash, receipt);
|
|
37
41
|
transaction.data.gasUsed = Number(receipt.gasUsed);
|
|
38
42
|
__classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_consumeGas).call(this, block, processResult, Number(receipt.gasUsed));
|
|
39
43
|
}
|
|
40
44
|
__classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_verifyConsumedAllGas).call(this, block, processResult);
|
|
45
|
+
__classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_verifyTotalFee).call(this, block);
|
|
41
46
|
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_updateRewardsAndVotes).call(this, unit);
|
|
42
|
-
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m",
|
|
43
|
-
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m",
|
|
47
|
+
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_calculateRoundValidators).call(this, unit);
|
|
48
|
+
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_verifyStateRoot).call(this, block);
|
|
49
|
+
await __classPrivateFieldGet(this, _BlockProcessor_instances, "m", _BlockProcessor_verifyLogsBloom).call(this, block);
|
|
44
50
|
processResult.success = true;
|
|
45
51
|
}
|
|
46
52
|
catch (error) {
|
|
@@ -50,23 +56,17 @@ let BlockProcessor = class BlockProcessor {
|
|
|
50
56
|
return processResult;
|
|
51
57
|
}
|
|
52
58
|
async commit(unit) {
|
|
53
|
-
if (this.apiSync) {
|
|
59
|
+
if (this.apiSync && unit.blockNumber > this.configuration.getGenesisHeight()) {
|
|
54
60
|
await this.apiSync.beforeCommit();
|
|
55
61
|
}
|
|
56
62
|
const commit = await unit.getCommit();
|
|
57
|
-
if (!this.state.isBootstrap()) {
|
|
58
|
-
this.databaseService.addCommit(commit);
|
|
59
|
-
if (unit.persist) {
|
|
60
|
-
await this.databaseService.persist();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
await this.stateStore.onCommit(unit);
|
|
64
63
|
await this.evm.onCommit(unit);
|
|
64
|
+
await this.stateStore.onCommit(unit);
|
|
65
|
+
await this.databaseService.onCommit(unit);
|
|
65
66
|
await this.validatorSet.onCommit(unit);
|
|
66
|
-
await this.proposerSelector.onCommit(unit);
|
|
67
67
|
await this.txPoolWorker.onCommit(unit);
|
|
68
68
|
await this.evmWorker.onCommit(unit);
|
|
69
|
-
if (this.apiSync) {
|
|
69
|
+
if (this.apiSync && unit.blockNumber > this.configuration.getGenesisHeight()) {
|
|
70
70
|
await this.apiSync.onCommit(unit);
|
|
71
71
|
}
|
|
72
72
|
for (const transaction of unit.getBlock().transactions) {
|
|
@@ -81,39 +81,75 @@ _BlockProcessor_instances = new WeakSet();
|
|
|
81
81
|
_BlockProcessor_logBlockCommitted = function _BlockProcessor_logBlockCommitted(unit) {
|
|
82
82
|
if (!this.state.isBootstrap()) {
|
|
83
83
|
const block = unit.getBlock();
|
|
84
|
-
this.logger.info(`Block ${unit.
|
|
84
|
+
this.logger.info(`Block ${unit.blockNumber.toLocaleString()}/${unit.round.toLocaleString()} with ${block.data.transactionsCount.toLocaleString()} tx(s) committed (gasUsed=${block.data.gasUsed.toLocaleString()})`);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
_BlockProcessor_logNewRound = function _BlockProcessor_logNewRound(unit) {
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const roundInfo =
|
|
88
|
+
const blockNumber = unit.getBlock().data.number;
|
|
89
|
+
if (this.roundCalculator.isNewRound(blockNumber + 1)) {
|
|
90
|
+
const roundInfo = this.roundCalculator.calculateRound(blockNumber + 1);
|
|
91
91
|
if (!this.state.isBootstrap()) {
|
|
92
|
-
this.logger.debug(`Starting validator round ${roundInfo.round} at
|
|
92
|
+
this.logger.debug(`Starting validator round ${roundInfo.round} at block number ${roundInfo.roundHeight} with ${roundInfo.maxValidators} validators`);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
_BlockProcessor_consumeGas = function _BlockProcessor_consumeGas(block, processorResult, gasUsed) {
|
|
97
|
-
const totalGas = block.header.
|
|
97
|
+
const totalGas = block.header.gasUsed;
|
|
98
98
|
if (processorResult.gasUsed + gasUsed > totalGas) {
|
|
99
99
|
throw new Error("Cannot consume more gas");
|
|
100
100
|
}
|
|
101
101
|
processorResult.gasUsed += gasUsed;
|
|
102
102
|
};
|
|
103
103
|
_BlockProcessor_verifyConsumedAllGas = function _BlockProcessor_verifyConsumedAllGas(block, processorResult) {
|
|
104
|
-
const totalGas = block.header.
|
|
104
|
+
const totalGas = block.header.gasUsed;
|
|
105
105
|
if (totalGas !== processorResult.gasUsed) {
|
|
106
106
|
throw new Error(`Block gas ${totalGas} does not match consumed gas ${processorResult.gasUsed}`);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
_BlockProcessor_verifyTotalFee = function _BlockProcessor_verifyTotalFee(block) {
|
|
110
|
+
let totalGas = BigNumber.ZERO;
|
|
111
|
+
for (const transaction of block.transactions) {
|
|
112
|
+
assert.defined(transaction.data.gasUsed);
|
|
113
|
+
totalGas = totalGas.plus(this.feeCalculator.calculateConsumed(transaction.data.gasUsed, transaction.data.gasPrice));
|
|
114
|
+
}
|
|
115
|
+
if (!totalGas.isEqualTo(block.header.fee)) {
|
|
116
|
+
throw new Error(`Block fee ${block.header.fee} does not match consumed fee ${totalGas}`);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
_BlockProcessor_verifyStateRoot = async function _BlockProcessor_verifyStateRoot(block) {
|
|
120
|
+
let previousStateRoot;
|
|
121
|
+
if (block.header.number === this.configuration.getGenesisHeight()) {
|
|
122
|
+
// Assume snapshot is present if the previous block points to a non-zero hash
|
|
123
|
+
if (block.header.parentHash !== "0000000000000000000000000000000000000000000000000000000000000000") {
|
|
124
|
+
assert.defined(this.snapshotImporter);
|
|
125
|
+
assert.defined(this.snapshotImporter.result);
|
|
126
|
+
previousStateRoot = this.snapshotImporter.snapshotHash;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
previousStateRoot = "0000000000000000000000000000000000000000000000000000000000000000";
|
|
130
|
+
}
|
|
112
131
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
132
|
+
else {
|
|
133
|
+
const previousBlock = this.stateStore.getLastBlock();
|
|
134
|
+
previousStateRoot = previousBlock.header.stateRoot;
|
|
135
|
+
}
|
|
136
|
+
const stateRoot = await this.evm.stateRoot({
|
|
137
|
+
blockHash: block.header.hash,
|
|
138
|
+
blockNumber: BigInt(block.header.number),
|
|
139
|
+
round: BigInt(block.header.round),
|
|
140
|
+
}, previousStateRoot);
|
|
141
|
+
if (block.header.stateRoot !== stateRoot) {
|
|
142
|
+
throw new Error(`State root mismatch! ${block.header.stateRoot} != ${stateRoot}`);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
_BlockProcessor_verifyLogsBloom = async function _BlockProcessor_verifyLogsBloom(block) {
|
|
146
|
+
const logsBloom = await this.evm.logsBloom({
|
|
147
|
+
blockHash: block.header.hash,
|
|
148
|
+
blockNumber: BigInt(block.header.number),
|
|
149
|
+
round: BigInt(block.header.round),
|
|
150
|
+
});
|
|
151
|
+
if (block.header.logsBloom !== logsBloom) {
|
|
152
|
+
throw new Error(`Logs bloom mismatch! ${block.header.logsBloom} != ${logsBloom}`);
|
|
117
153
|
}
|
|
118
154
|
};
|
|
119
155
|
_BlockProcessor_emitTransactionEvents = async function _BlockProcessor_emitTransactionEvents(transaction) {
|
|
@@ -128,25 +164,33 @@ _BlockProcessor_updateRewardsAndVotes = async function _BlockProcessor_updateRew
|
|
|
128
164
|
const milestone = this.configuration.getMilestone();
|
|
129
165
|
const block = unit.getBlock();
|
|
130
166
|
await this.evm.updateRewardsAndVotes({
|
|
131
|
-
blockReward:
|
|
132
|
-
commitKey: {
|
|
167
|
+
blockReward: BigNumber.make(milestone.reward).toBigInt(),
|
|
168
|
+
commitKey: {
|
|
169
|
+
blockHash: block.header.hash,
|
|
170
|
+
blockNumber: BigInt(block.header.number),
|
|
171
|
+
round: BigInt(block.header.round),
|
|
172
|
+
},
|
|
133
173
|
specId: milestone.evmSpec,
|
|
134
174
|
timestamp: BigInt(block.header.timestamp),
|
|
135
|
-
validatorAddress: block.header.
|
|
175
|
+
validatorAddress: block.header.proposer,
|
|
136
176
|
});
|
|
137
177
|
};
|
|
138
|
-
|
|
139
|
-
if (!
|
|
178
|
+
_BlockProcessor_calculateRoundValidators = async function _BlockProcessor_calculateRoundValidators(unit) {
|
|
179
|
+
if (!this.roundCalculator.isNewRound(unit.blockNumber + 1)) {
|
|
140
180
|
return;
|
|
141
181
|
}
|
|
142
|
-
const {
|
|
182
|
+
const { roundValidators, evmSpec } = this.configuration.getMilestone(unit.blockNumber + 1);
|
|
143
183
|
const block = unit.getBlock();
|
|
144
|
-
await this.evm.
|
|
145
|
-
|
|
146
|
-
|
|
184
|
+
await this.evm.calculateRoundValidators({
|
|
185
|
+
commitKey: {
|
|
186
|
+
blockHash: block.header.hash,
|
|
187
|
+
blockNumber: BigInt(block.header.number),
|
|
188
|
+
round: BigInt(block.header.round),
|
|
189
|
+
},
|
|
190
|
+
roundValidators: BigNumber.make(roundValidators).toBigInt(),
|
|
147
191
|
specId: evmSpec,
|
|
148
192
|
timestamp: BigInt(block.header.timestamp),
|
|
149
|
-
validatorAddress: block.header.
|
|
193
|
+
validatorAddress: block.header.proposer,
|
|
150
194
|
});
|
|
151
195
|
};
|
|
152
196
|
_BlockProcessor_emit = async function _BlockProcessor_emit(event, data) {
|
|
@@ -167,6 +211,10 @@ __decorate([
|
|
|
167
211
|
inject(Identifiers.Cryptography.Configuration),
|
|
168
212
|
__metadata("design:type", Object)
|
|
169
213
|
], BlockProcessor.prototype, "configuration", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
inject(Identifiers.BlockchainUtils.RoundCalculator),
|
|
216
|
+
__metadata("design:type", Object)
|
|
217
|
+
], BlockProcessor.prototype, "roundCalculator", void 0);
|
|
170
218
|
__decorate([
|
|
171
219
|
inject(Identifiers.Database.Service),
|
|
172
220
|
__metadata("design:type", Object)
|
|
@@ -184,10 +232,6 @@ __decorate([
|
|
|
184
232
|
inject(Identifiers.Transaction.Handler.Registry),
|
|
185
233
|
__metadata("design:type", Object)
|
|
186
234
|
], BlockProcessor.prototype, "handlerRegistry", void 0);
|
|
187
|
-
__decorate([
|
|
188
|
-
inject(Identifiers.Proposer.Selector),
|
|
189
|
-
__metadata("design:type", Object)
|
|
190
|
-
], BlockProcessor.prototype, "proposerSelector", void 0);
|
|
191
235
|
__decorate([
|
|
192
236
|
inject(Identifiers.Services.EventDispatcher.Service),
|
|
193
237
|
__metadata("design:type", Object)
|
|
@@ -217,6 +261,15 @@ __decorate([
|
|
|
217
261
|
optional(),
|
|
218
262
|
__metadata("design:type", Object)
|
|
219
263
|
], BlockProcessor.prototype, "apiSync", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
inject(Identifiers.Snapshot.Legacy.Importer),
|
|
266
|
+
optional(),
|
|
267
|
+
__metadata("design:type", Object)
|
|
268
|
+
], BlockProcessor.prototype, "snapshotImporter", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
inject(Identifiers.BlockchainUtils.FeeCalculator),
|
|
271
|
+
__metadata("design:type", Object)
|
|
272
|
+
], BlockProcessor.prototype, "feeCalculator", void 0);
|
|
220
273
|
BlockProcessor = __decorate([
|
|
221
274
|
injectable()
|
|
222
275
|
], BlockProcessor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-processor.js","sourceRoot":"","sources":["../source/block-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"block-processor.js","sourceRoot":"","sources":["../source/block-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE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AC;;4DAC8B;AAGzE;IADP,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;uDAC2B;AAG3D;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;;8CACM;AAG1C;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;8CACS;AAGjC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC;;oDACsB;AAG9C;IADhB,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC;;gDACa;AAGxC;IADhB,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC;;oDACsB;AAGhD;IADhB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;;iDACmB;AAIjC;IAFhB,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,QAAQ,EAAE;;+CAC0C;AAIpC;IAFhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC5C,QAAQ,EAAE;;wDAC2D;AAGnD;IADlB,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC;;qDACyB;AArD/D,cAAc;IAD1B,UAAU,EAAE;GACA,cAAc,CA8R1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
|
2
2
|
export declare class BlockVerifier implements Contracts.Processor.Verifier {
|
|
3
|
-
|
|
3
|
+
private readonly handlers;
|
|
4
4
|
verify(unit: Contracts.Processor.ProcessableUnit): Promise<void>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=block-verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-verifier.d.ts","sourceRoot":"","sources":["../source/block-verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"block-verifier.d.ts","sourceRoot":"","sources":["../source/block-verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAE7D,qBACa,aAAc,YAAW,SAAS,CAAC,SAAS,CAAC,QAAQ;IAEjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAE7C,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAK7E"}
|
|
@@ -7,23 +7,19 @@ 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
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ChainedVerifier, GeneratorVerifier,
|
|
13
|
-
//NonceVerifier,
|
|
14
|
-
TimestampVerifier, } from "./verifiers/index.js";
|
|
10
|
+
import { injectable, multiInject } from "@mainsail/container";
|
|
11
|
+
import { Identifiers } from "@mainsail/contracts";
|
|
15
12
|
let BlockVerifier = class BlockVerifier {
|
|
16
13
|
async verify(unit) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//await this.app.resolve(NonceVerifier).execute(unit);
|
|
14
|
+
for (const handler of this.handlers) {
|
|
15
|
+
await handler.execute(unit);
|
|
16
|
+
}
|
|
21
17
|
}
|
|
22
18
|
};
|
|
23
19
|
__decorate([
|
|
24
|
-
|
|
25
|
-
__metadata("design:type",
|
|
26
|
-
], BlockVerifier.prototype, "
|
|
20
|
+
multiInject(Identifiers.Processor.BlockVerifierHandlers),
|
|
21
|
+
__metadata("design:type", Array)
|
|
22
|
+
], BlockVerifier.prototype, "handlers", void 0);
|
|
27
23
|
BlockVerifier = __decorate([
|
|
28
24
|
injectable()
|
|
29
25
|
], BlockVerifier);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-verifier.js","sourceRoot":"","sources":["../source/block-verifier.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"block-verifier.js","sourceRoot":"","sources":["../source/block-verifier.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAa,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,aAAa,GAAnB,MAAM,aAAa;IAIlB,KAAK,CAAC,MAAM,CAAC,IAAyC;QAC5D,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;CACD,CAAA;AAPiB;IADhB,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,qBAAqB,CAAC;;+CACC;AAF9C,aAAa;IADzB,UAAU,EAAE;GACA,aAAa,CASzB"}
|
|
@@ -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":"AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAoBvD,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBzB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;CASzC"}
|
package/distribution/index.js
CHANGED
|
@@ -1,22 +1,45 @@
|
|
|
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
|
+
};
|
|
1
7
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
9
|
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");
|
|
4
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
11
|
};
|
|
6
12
|
var _ServiceProvider_instances, _ServiceProvider_registerActions;
|
|
13
|
+
import { injectable } from "@mainsail/container";
|
|
7
14
|
import { Identifiers } from "@mainsail/contracts";
|
|
8
15
|
import { Providers } from "@mainsail/kernel";
|
|
9
16
|
import { ProcessBlockAction } from "./actions/process-block.js";
|
|
10
17
|
import { BlockProcessor } from "./block-processor.js";
|
|
11
18
|
import { BlockVerifier } from "./block-verifier.js";
|
|
12
19
|
import { TransactionProcessor } from "./transaction-processor.js";
|
|
13
|
-
|
|
20
|
+
import { ChainedVerifier, GasLimitVerifier, GeneratorVerifier, LegacyAttributeVerifier, RewardVerifier, SizeVerifier, TimestampVerifier, TransactionDuplicatesVerifier, TransactionLengthVerifier, TransactionsRootVerifier, VersionVerifier, } from "./verifiers/index.js";
|
|
21
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
|
14
22
|
constructor() {
|
|
15
23
|
super(...arguments);
|
|
16
24
|
_ServiceProvider_instances.add(this);
|
|
17
25
|
}
|
|
18
26
|
async register() {
|
|
19
27
|
this.app.bind(Identifiers.Processor.BlockVerifier).to(BlockVerifier).inSingletonScope();
|
|
28
|
+
for (const handler of [
|
|
29
|
+
ChainedVerifier,
|
|
30
|
+
SizeVerifier,
|
|
31
|
+
TimestampVerifier,
|
|
32
|
+
GeneratorVerifier,
|
|
33
|
+
VersionVerifier,
|
|
34
|
+
RewardVerifier,
|
|
35
|
+
TransactionLengthVerifier,
|
|
36
|
+
TransactionDuplicatesVerifier,
|
|
37
|
+
TransactionsRootVerifier,
|
|
38
|
+
GasLimitVerifier,
|
|
39
|
+
LegacyAttributeVerifier,
|
|
40
|
+
]) {
|
|
41
|
+
this.app.bind(Identifiers.Processor.BlockVerifierHandlers).to(handler);
|
|
42
|
+
}
|
|
20
43
|
this.app.bind(Identifiers.Processor.BlockProcessor).to(BlockProcessor).inSingletonScope();
|
|
21
44
|
this.app.bind(Identifiers.Processor.TransactionProcessor).to(TransactionProcessor).inSingletonScope();
|
|
22
45
|
__classPrivateFieldGet(this, _ServiceProvider_instances, "m", _ServiceProvider_registerActions).call(this);
|
|
@@ -24,10 +47,15 @@ export class ServiceProvider extends Providers.ServiceProvider {
|
|
|
24
47
|
async required() {
|
|
25
48
|
return true;
|
|
26
49
|
}
|
|
27
|
-
}
|
|
28
|
-
_ServiceProvider_instances = new WeakSet()
|
|
50
|
+
};
|
|
51
|
+
_ServiceProvider_instances = new WeakSet();
|
|
52
|
+
_ServiceProvider_registerActions = function _ServiceProvider_registerActions() {
|
|
29
53
|
this.app
|
|
30
54
|
.get(Identifiers.Services.Trigger.Service)
|
|
31
55
|
.bind("processBlock", new ProcessBlockAction());
|
|
32
56
|
};
|
|
57
|
+
ServiceProvider = __decorate([
|
|
58
|
+
injectable()
|
|
59
|
+
], ServiceProvider);
|
|
60
|
+
export { ServiceProvider };
|
|
33
61
|
//# 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":"","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,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC1F,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAEtG,uBAAA,IAAI,oEAAiB,MAArB,IAAI,CAAmB,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,QAAQ;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;CAOD,CAAA;;;IAJC,IAAI,CAAC,GAAG;SACN,GAAG,CAA6B,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;SACrE,IAAI,CAAC,cAAc,EAAE,IAAI,kBAAkB,EAAE,CAAC,CAAC;AAClD,CAAC;AAlCW,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAmC3B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
|
2
2
|
export declare class TransactionProcessor implements Contracts.Processor.TransactionProcessor {
|
|
3
3
|
private readonly evm;
|
|
4
|
-
protected readonly gasFeeCalculator: Contracts.Evm.GasFeeCalculator;
|
|
5
4
|
protected readonly logger: Contracts.Kernel.Logger;
|
|
6
5
|
readonly app: Contracts.Kernel.Application;
|
|
7
6
|
private readonly configuration;
|
|
7
|
+
private readonly feeCalculator;
|
|
8
8
|
private readonly handlerRegistry;
|
|
9
9
|
process(unit: Contracts.Processor.ProcessableUnit, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Evm.TransactionReceipt>;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-processor.d.ts","sourceRoot":"","sources":["../source/transaction-processor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-processor.d.ts","sourceRoot":"","sources":["../source/transaction-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAEzE,qBACa,oBAAqB,YAAW,SAAS,CAAC,SAAS,CAAC,oBAAoB;IAGpF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAG9C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;IAEpD,SACgB,GAAG,EAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAGnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2C;IAGzE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqD;IAE/E,OAAO,CACZ,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,EACzC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GACvC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC;CAqC5C"}
|
|
@@ -7,24 +7,26 @@ 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
|
+
import { formatCurrency } from "@mainsail/blockchain-utils";
|
|
10
11
|
import { inject, injectable, tagged } from "@mainsail/container";
|
|
11
12
|
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
|
12
|
-
import { Utils } from "@mainsail/kernel";
|
|
13
13
|
let TransactionProcessor = class TransactionProcessor {
|
|
14
14
|
async process(unit, transaction) {
|
|
15
|
-
const
|
|
15
|
+
const block = unit.getBlock();
|
|
16
|
+
const milestone = this.configuration.getMilestone(block.header.number);
|
|
16
17
|
const transactionHandler = await this.handlerRegistry.getActivatedHandlerForData(transaction.data);
|
|
17
18
|
const commitKey = {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
blockHash: block.header.hash,
|
|
20
|
+
blockNumber: BigInt(block.header.number),
|
|
21
|
+
round: BigInt(block.header.round),
|
|
20
22
|
};
|
|
21
23
|
const transactionHandlerContext = {
|
|
22
24
|
evm: {
|
|
23
25
|
blockContext: {
|
|
24
26
|
commitKey,
|
|
25
27
|
gasLimit: BigInt(milestone.block.maxGasLimit),
|
|
26
|
-
timestamp: BigInt(
|
|
27
|
-
validatorAddress:
|
|
28
|
+
timestamp: BigInt(block.header.timestamp),
|
|
29
|
+
validatorAddress: block.header.proposer,
|
|
28
30
|
},
|
|
29
31
|
instance: this.evm,
|
|
30
32
|
},
|
|
@@ -33,8 +35,8 @@ let TransactionProcessor = class TransactionProcessor {
|
|
|
33
35
|
throw new Exceptions.InvalidSignatureError();
|
|
34
36
|
}
|
|
35
37
|
const receipt = await transactionHandler.apply(transactionHandlerContext, transaction);
|
|
36
|
-
const feeConsumed = this.
|
|
37
|
-
this.logger.debug(`executed EVM call (
|
|
38
|
+
const feeConsumed = this.feeCalculator.calculateConsumed(transaction.data.gasPrice, Number(receipt.gasUsed));
|
|
39
|
+
this.logger.debug(`executed EVM call (status=${receipt.status}, from=${transaction.data.from} to=${transaction.data.to} gasUsed=${receipt.gasUsed} paidNativeFee=${formatCurrency(this.configuration, feeConsumed)} deployed=${receipt.contractAddress})`);
|
|
38
40
|
return receipt;
|
|
39
41
|
}
|
|
40
42
|
};
|
|
@@ -43,10 +45,6 @@ __decorate([
|
|
|
43
45
|
tagged("instance", "evm"),
|
|
44
46
|
__metadata("design:type", Object)
|
|
45
47
|
], TransactionProcessor.prototype, "evm", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
inject(Identifiers.Evm.Gas.FeeCalculator),
|
|
48
|
-
__metadata("design:type", Object)
|
|
49
|
-
], TransactionProcessor.prototype, "gasFeeCalculator", void 0);
|
|
50
48
|
__decorate([
|
|
51
49
|
inject(Identifiers.Services.Log.Service),
|
|
52
50
|
__metadata("design:type", Object)
|
|
@@ -59,6 +57,10 @@ __decorate([
|
|
|
59
57
|
inject(Identifiers.Cryptography.Configuration),
|
|
60
58
|
__metadata("design:type", Object)
|
|
61
59
|
], TransactionProcessor.prototype, "configuration", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
inject(Identifiers.BlockchainUtils.FeeCalculator),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], TransactionProcessor.prototype, "feeCalculator", void 0);
|
|
62
64
|
__decorate([
|
|
63
65
|
inject(Identifiers.Transaction.Handler.Registry),
|
|
64
66
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-processor.js","sourceRoot":"","sources":["../source/transaction-processor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction-processor.js","sourceRoot":"","sources":["../source/transaction-processor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAoBhC,KAAK,CAAC,OAAO,CACZ,IAAyC,EACzC,WAAyC;QAEzC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACvE,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEnG,MAAM,SA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AAzDiB;IAFhB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC;;iDACoB;AAG3B;IADlB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;oDACW;AAGpC;IADf,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;iDACU;AAGlC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;2DACiB;AAG/C;IADhB,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC;;2DACuB;AAGxD;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;6DACoC;AAlBzE,oBAAoB;IADhC,UAAU,EAAE;GACA,oBAAoB,CA4DhC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
|
2
2
|
export declare class ChainedVerifier implements Contracts.Processor.Handler {
|
|
3
3
|
protected readonly app: Contracts.Kernel.Application;
|
|
4
|
-
private readonly
|
|
4
|
+
private readonly configuration;
|
|
5
|
+
private readonly store;
|
|
5
6
|
execute(unit: Contracts.Processor.ProcessableUnit): Promise<void>;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=chained-verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chained-verifier.d.ts","sourceRoot":"","sources":["../../source/verifiers/chained-verifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chained-verifier.d.ts","sourceRoot":"","sources":["../../source/verifiers/chained-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAGzE,qBACa,eAAgB,YAAW,SAAS,CAAC,SAAS,CAAC,OAAO;IAElE,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAGtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAElC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB9E"}
|