@mainsail/crypto-block 0.0.1-evm.4 → 0.0.1-evm.41
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/block.d.ts +1 -1
- package/distribution/block.d.ts.map +1 -1
- package/distribution/block.js +12 -9
- package/distribution/block.js.map +1 -1
- package/distribution/deserializer.d.ts +5 -4
- package/distribution/deserializer.d.ts.map +1 -1
- package/distribution/deserializer.js +131 -102
- package/distribution/deserializer.js.map +1 -1
- package/distribution/factory.d.ts +5 -4
- package/distribution/factory.d.ts.map +1 -1
- package/distribution/factory.js +77 -54
- package/distribution/factory.js.map +1 -1
- package/distribution/hash.factory.d.ts +7 -0
- package/distribution/hash.factory.d.ts.map +1 -0
- package/distribution/{id.factory.js → hash.factory.js} +12 -9
- package/distribution/hash.factory.js.map +1 -0
- package/distribution/index.d.ts +1 -2
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +35 -9
- package/distribution/index.js.map +1 -1
- package/distribution/schemas.d.ts +2 -2
- package/distribution/schemas.d.ts.map +1 -1
- package/distribution/schemas.js +52 -26
- package/distribution/schemas.js.map +1 -1
- package/distribution/serializer.d.ts +3 -6
- package/distribution/serializer.d.ts.map +1 -1
- package/distribution/serializer.js +34 -53
- package/distribution/serializer.js.map +1 -1
- package/package.json +27 -24
- package/distribution/id.factory.d.ts +0 -7
- package/distribution/id.factory.d.ts.map +0 -1
- package/distribution/id.factory.js.map +0 -1
- package/distribution/verifier.d.ts +0 -8
- package/distribution/verifier.d.ts.map +0 -1
- package/distribution/verifier.js +0 -116
- package/distribution/verifier.js.map +0 -1
package/distribution/block.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,UAAU,cAAc;IACvB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;CAC7C;AAED,eAAO,MAAM,SAAS,GAAI,oCAAoC,cAAc,KAAG,SAAS,CAAC,MAAM,CAAC,KAY/F,CAAC"}
|
package/distribution/block.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
export const sealBlock = ({ data, serialized, transactions }) =>
|
|
2
|
-
data
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export const sealBlock = ({ data, serialized, transactions }) => {
|
|
2
|
+
const { transactions: _, ...blockHeader } = data;
|
|
3
|
+
return Object.seal({
|
|
4
|
+
data,
|
|
5
|
+
header: blockHeader,
|
|
6
|
+
serialized,
|
|
7
|
+
transactions: transactions.map((transaction, index) => {
|
|
8
|
+
transaction.data.transactionIndex = index;
|
|
9
|
+
return transaction;
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
};
|
|
10
13
|
//# sourceMappingURL=block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAkB,EAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAkB,EAA0B,EAAE;IACvG,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;IAEjD,OAAO,MAAM,CAAC,IAAI,CAAC;QAClB,IAAI;QACJ,MAAM,EAAE,WAAW;QACnB,UAAU;QACV,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;YACrD,WAAW,CAAC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;YAC1C,OAAO,WAAW,CAAC;QACpB,CAAC,CAAC;KACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
3
2
|
export declare class Deserializer implements Contracts.Crypto.BlockDeserializer {
|
|
4
3
|
#private;
|
|
5
|
-
private readonly
|
|
4
|
+
private readonly hashFactory;
|
|
6
5
|
private readonly transactionFactory;
|
|
6
|
+
private readonly transactionDeserializer;
|
|
7
7
|
private readonly serializer;
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly headerSize;
|
|
9
|
+
private readonly workerPool;
|
|
9
10
|
deserializeHeader(serialized: Buffer): Promise<Contracts.Crypto.BlockHeader>;
|
|
10
11
|
deserializeWithTransactions(serialized: Buffer): Promise<Contracts.Crypto.BlockWithTransactions>;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMrD,qBACa,YAAa,YAAW,SAAS,CAAC,MAAM,CAAC,iBAAiB;;IAEtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAG3C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuC;IAG1E,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA4C;IAGpF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAG9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAI3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IAExD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAW5E,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC;CA4I7G"}
|
|
@@ -7,134 +7,163 @@ 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
|
-
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 _Deserializer_instances, _Deserializer_deserializeBufferHeader, _Deserializer_deserializeTransactions;
|
|
16
10
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { IDFactory } from "./id.factory.js";
|
|
11
|
+
import { Identifiers } from "@mainsail/constants";
|
|
12
|
+
import { inject, injectable, optional } from "@mainsail/container";
|
|
13
|
+
import { TransactionSchemaError } from "@mainsail/exceptions";
|
|
14
|
+
import { ByteBuffer, sleep } from "@mainsail/utils";
|
|
15
|
+
import { HashFactory } from "./hash.factory.js";
|
|
23
16
|
let Deserializer = class Deserializer {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
hashFactory;
|
|
18
|
+
transactionFactory;
|
|
19
|
+
transactionDeserializer;
|
|
20
|
+
serializer;
|
|
21
|
+
headerSize;
|
|
22
|
+
workerPool;
|
|
27
23
|
async deserializeHeader(serialized) {
|
|
28
24
|
const buffer = ByteBuffer.fromBuffer(serialized);
|
|
29
|
-
const header = await
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
const header = await this.#deserializeBufferHeader(buffer);
|
|
26
|
+
return {
|
|
27
|
+
...header,
|
|
28
|
+
hash: await this.hashFactory.make(header),
|
|
29
|
+
};
|
|
32
30
|
}
|
|
33
31
|
async deserializeWithTransactions(serialized) {
|
|
34
32
|
const buffer = ByteBuffer.fromBuffer(serialized);
|
|
35
|
-
const
|
|
33
|
+
const header = await this.#deserializeBufferHeader(buffer);
|
|
36
34
|
let transactions = [];
|
|
37
35
|
if (buffer.getRemainderLength() > 0) {
|
|
38
|
-
transactions = await
|
|
36
|
+
transactions = await this.#deserializeTransactions(header, buffer);
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_Deserializer_deserializeBufferHeader = async function _Deserializer_deserializeBufferHeader(buffer) {
|
|
46
|
-
const block = {};
|
|
47
|
-
await this.serializer.deserialize(buffer, block, {
|
|
48
|
-
length: this.blockSerializer.headerSize(),
|
|
49
|
-
schema: {
|
|
50
|
-
version: {
|
|
51
|
-
type: "uint8",
|
|
52
|
-
},
|
|
53
|
-
timestamp: {
|
|
54
|
-
type: "uint48",
|
|
55
|
-
},
|
|
56
|
-
height: {
|
|
57
|
-
type: "uint32",
|
|
58
|
-
},
|
|
59
|
-
round: {
|
|
60
|
-
type: "uint32",
|
|
61
|
-
},
|
|
62
|
-
previousBlock: {
|
|
63
|
-
type: "hash",
|
|
64
|
-
},
|
|
65
|
-
stateHash: {
|
|
66
|
-
type: "hash",
|
|
67
|
-
},
|
|
68
|
-
numberOfTransactions: {
|
|
69
|
-
type: "uint16",
|
|
70
|
-
},
|
|
71
|
-
totalGasUsed: {
|
|
72
|
-
type: "uint32",
|
|
73
|
-
},
|
|
74
|
-
totalAmount: {
|
|
75
|
-
type: "uint256",
|
|
38
|
+
return {
|
|
39
|
+
data: {
|
|
40
|
+
...header,
|
|
41
|
+
hash: await this.hashFactory.make(header),
|
|
42
|
+
transactions: transactions.map((tx) => tx.data),
|
|
76
43
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
44
|
+
transactions,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async #deserializeBufferHeader(buffer) {
|
|
48
|
+
return await this.serializer.deserialize(buffer, {}, {
|
|
49
|
+
length: this.headerSize(),
|
|
50
|
+
schema: {
|
|
51
|
+
version: {
|
|
52
|
+
type: "uint8",
|
|
53
|
+
},
|
|
54
|
+
timestamp: {
|
|
55
|
+
type: "uint48",
|
|
56
|
+
},
|
|
57
|
+
number: {
|
|
58
|
+
type: "uint32",
|
|
59
|
+
},
|
|
60
|
+
round: {
|
|
61
|
+
type: "uint32",
|
|
62
|
+
},
|
|
63
|
+
parentHash: {
|
|
64
|
+
type: "hash",
|
|
65
|
+
},
|
|
66
|
+
stateRoot: {
|
|
67
|
+
type: "hash",
|
|
68
|
+
},
|
|
69
|
+
logsBloom: {
|
|
70
|
+
type: "hash",
|
|
71
|
+
size: 256,
|
|
72
|
+
},
|
|
73
|
+
transactionsCount: {
|
|
74
|
+
type: "uint16",
|
|
75
|
+
},
|
|
76
|
+
gasUsed: {
|
|
77
|
+
type: "uint32",
|
|
78
|
+
},
|
|
79
|
+
fee: {
|
|
80
|
+
type: "uint256",
|
|
81
|
+
},
|
|
82
|
+
reward: {
|
|
83
|
+
type: "uint256",
|
|
84
|
+
},
|
|
85
|
+
payloadSize: {
|
|
86
|
+
type: "uint32",
|
|
87
|
+
},
|
|
88
|
+
transactionsRoot: {
|
|
89
|
+
type: "hash",
|
|
90
|
+
},
|
|
91
|
+
proposer: {
|
|
92
|
+
type: "address",
|
|
93
|
+
},
|
|
91
94
|
},
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
type: "transactions",
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async #deserializeTransactions(header, buf) {
|
|
98
|
+
const block = await this.serializer.deserialize(buf, { ...header }, {
|
|
99
|
+
length: header.payloadSize,
|
|
100
|
+
schema: {
|
|
101
|
+
transactions: {
|
|
102
|
+
type: "transactions",
|
|
103
|
+
},
|
|
102
104
|
},
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* After unpacking we need to turn the transactions into DTOs!
|
|
108
|
+
*
|
|
109
|
+
* We keep this behavior out of the (de)serializer because it
|
|
110
|
+
* is very specific to this bit of code in this specific class.
|
|
111
|
+
*/
|
|
112
|
+
const transactions = Array.from({ length: block.transactionsCount });
|
|
113
|
+
await Promise.all(block.transactions.map(async (serialized, index) => {
|
|
114
|
+
const transaction = await this.transactionDeserializer.deserialize(serialized);
|
|
115
|
+
if (index % 20 === 0) {
|
|
116
|
+
await sleep(0);
|
|
117
|
+
}
|
|
118
|
+
const computed = await this.#computeCryptoData(transaction.data);
|
|
119
|
+
if (computed.schemaError) {
|
|
120
|
+
throw new TransactionSchemaError(computed.schemaError);
|
|
121
|
+
}
|
|
122
|
+
transaction.data.data = transaction.data.data.startsWith("0x")
|
|
123
|
+
? transaction.data.data.slice(2)
|
|
124
|
+
: transaction.data.data;
|
|
125
|
+
transaction.data.hash = computed.hash;
|
|
126
|
+
transaction.data.from = computed.address;
|
|
127
|
+
transaction.data.senderPublicKey = computed.publicKey;
|
|
128
|
+
transaction.data.senderLegacyAddress = computed.legacyAddress;
|
|
129
|
+
transactions[index] = transaction;
|
|
130
|
+
block.transactions[index] = transaction.data;
|
|
131
|
+
}));
|
|
132
|
+
return transactions;
|
|
133
|
+
}
|
|
134
|
+
async #computeCryptoData(transaction) {
|
|
135
|
+
if (this.workerPool) {
|
|
136
|
+
const worker = await this.workerPool.getWorker();
|
|
137
|
+
return worker.transactionFactory("computeCryptoData", transaction);
|
|
115
138
|
}
|
|
116
|
-
|
|
117
|
-
transactions.push(transaction);
|
|
118
|
-
block.transactions[index] = transaction.data;
|
|
139
|
+
return this.transactionFactory.computeCryptoData(transaction);
|
|
119
140
|
}
|
|
120
|
-
return transactions;
|
|
121
141
|
};
|
|
122
142
|
__decorate([
|
|
123
|
-
inject(Identifiers.Cryptography.Block.
|
|
124
|
-
__metadata("design:type",
|
|
125
|
-
], Deserializer.prototype, "
|
|
143
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
|
144
|
+
__metadata("design:type", HashFactory)
|
|
145
|
+
], Deserializer.prototype, "hashFactory", void 0);
|
|
126
146
|
__decorate([
|
|
127
147
|
inject(Identifiers.Cryptography.Transaction.Factory),
|
|
128
|
-
__metadata("design:type",
|
|
148
|
+
__metadata("design:type", Object)
|
|
129
149
|
], Deserializer.prototype, "transactionFactory", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
inject(Identifiers.Cryptography.Transaction.Deserializer),
|
|
152
|
+
__metadata("design:type", Object)
|
|
153
|
+
], Deserializer.prototype, "transactionDeserializer", void 0);
|
|
130
154
|
__decorate([
|
|
131
155
|
inject(Identifiers.Cryptography.Serializer),
|
|
132
156
|
__metadata("design:type", Object)
|
|
133
157
|
], Deserializer.prototype, "serializer", void 0);
|
|
134
158
|
__decorate([
|
|
135
|
-
inject(Identifiers.Cryptography.Block.
|
|
159
|
+
inject(Identifiers.Cryptography.Block.HeaderSize),
|
|
160
|
+
__metadata("design:type", Function)
|
|
161
|
+
], Deserializer.prototype, "headerSize", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
inject(Identifiers.CryptoWorker.WorkerPool),
|
|
164
|
+
optional(),
|
|
136
165
|
__metadata("design:type", Object)
|
|
137
|
-
], Deserializer.prototype, "
|
|
166
|
+
], Deserializer.prototype, "workerPool", void 0);
|
|
138
167
|
Deserializer = __decorate([
|
|
139
168
|
injectable()
|
|
140
169
|
], Deserializer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEP,WAAW,CAAe;IAG1B,kBAAkB,CAAuC;IAGzD,uBAAuB,CAA4C;IAGnE,UAAU,CAAmC;IAG7C,UAAU,CAAgB;IAI1B,UAAU,CAA0C;IAE9D,KAAK,CAAC,iBAAiB,CAAC,UAAkB;QAChD,MAAM,MAAM,GAAe,UAAU,CAAC,UAAU,CAAC,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AC,CAAC;IAC/D,CAAC;CACD,CAAA;AAzKiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC;8BACpB,WAAW;iDAAC;AAG1B;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;;wDACqB;AAGzD;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC;;6DAC0B;AAGnE;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC;;gDACkB;AAG7C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;gDACP;AAI1B;IAFhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC;IAC3C,QAAQ,EAAE;;gDAC0D;AAlBzD,YAAY;IADxB,UAAU,EAAE;GACA,YAAY,CA2KxB"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contracts, Utils } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
3
2
|
export declare class BlockFactory implements Contracts.Crypto.BlockFactory {
|
|
4
3
|
#private;
|
|
5
4
|
private readonly serializer;
|
|
6
5
|
private readonly deserializer;
|
|
7
|
-
private readonly
|
|
6
|
+
private readonly hashFactory;
|
|
7
|
+
private readonly transactionFactory;
|
|
8
8
|
private readonly validator;
|
|
9
|
-
make(data:
|
|
9
|
+
make(data: Contracts.Crypto.BlockDataSerializable, transactions: Contracts.Crypto.Transaction[]): Promise<Contracts.Crypto.Block>;
|
|
10
10
|
fromHex(hex: string): Promise<Contracts.Crypto.Block>;
|
|
11
11
|
fromBytes(buff: Buffer): Promise<Contracts.Crypto.Block>;
|
|
12
12
|
fromJson(json: Contracts.Crypto.BlockJson): Promise<Contracts.Crypto.Block>;
|
|
13
13
|
fromData(data: Contracts.Crypto.BlockData): Promise<Contracts.Crypto.Block>;
|
|
14
|
+
fromStorage(header: Contracts.Evm.BlockHeaderStorageData, transactions: Contracts.Evm.TransactionStorageData[]): Promise<Contracts.Crypto.Block>;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAO5D,qBACa,YAAa,YAAW,SAAS,CAAC,MAAM,CAAC,YAAY;;IAEjE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAG/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsC;IAGnE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAG3C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuC;IAG1E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;IAE3C,IAAI,CAChB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,EAC5C,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,GAC1C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAYrB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAIrD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAIxD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAgB3E,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAW3E,WAAW,CACvB,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,sBAAsB,EAC5C,YAAY,EAAE,SAAS,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAClD,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;CA6ElC"}
|
package/distribution/factory.js
CHANGED
|
@@ -7,23 +7,20 @@ 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 _BlockFactory_instances, _BlockFactory_fromSerialized, _BlockFactory_applySchema;
|
|
10
|
+
import { Identifiers } from "@mainsail/constants";
|
|
16
11
|
import { inject, injectable } from "@mainsail/container";
|
|
17
|
-
import {
|
|
12
|
+
import { BlockSchemaError } from "@mainsail/exceptions";
|
|
18
13
|
import { BigNumber } from "@mainsail/utils";
|
|
19
14
|
import { sealBlock } from "./block.js";
|
|
20
|
-
import {
|
|
15
|
+
import { HashFactory } from "./hash.factory.js";
|
|
21
16
|
let BlockFactory = class BlockFactory {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
serializer;
|
|
18
|
+
deserializer;
|
|
19
|
+
hashFactory;
|
|
20
|
+
transactionFactory;
|
|
21
|
+
validator;
|
|
25
22
|
async make(data, transactions) {
|
|
26
|
-
const block = { ...data,
|
|
23
|
+
const block = { ...data, hash: await this.hashFactory.make(data) };
|
|
27
24
|
const serialized = await this.serializer.serializeWithTransactions(data);
|
|
28
25
|
return sealBlock({
|
|
29
26
|
data: block,
|
|
@@ -32,73 +29,95 @@ let BlockFactory = class BlockFactory {
|
|
|
32
29
|
});
|
|
33
30
|
}
|
|
34
31
|
async fromHex(hex) {
|
|
35
|
-
return
|
|
32
|
+
return this.#fromSerialized(Buffer.from(hex, "hex"));
|
|
36
33
|
}
|
|
37
34
|
async fromBytes(buff) {
|
|
38
|
-
return
|
|
35
|
+
return this.#fromSerialized(buff);
|
|
39
36
|
}
|
|
40
37
|
async fromJson(json) {
|
|
41
38
|
// @ts-ignore
|
|
42
39
|
const data = { ...json };
|
|
43
|
-
data.
|
|
44
|
-
data.totalFee = BigNumber.make(data.totalFee);
|
|
40
|
+
data.fee = BigNumber.make(data.fee);
|
|
45
41
|
data.reward = BigNumber.make(data.reward);
|
|
46
42
|
if (data.transactions) {
|
|
47
43
|
for (const transaction of data.transactions) {
|
|
48
|
-
transaction.
|
|
49
|
-
transaction.fee = BigNumber.make(transaction.fee);
|
|
44
|
+
transaction.value = BigNumber.make(transaction.value);
|
|
50
45
|
transaction.nonce = BigNumber.make(transaction.nonce);
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
return this.fromData(data);
|
|
54
49
|
}
|
|
55
50
|
async fromData(data) {
|
|
56
|
-
await
|
|
51
|
+
await this.#applySchema(data);
|
|
57
52
|
const serialized = await this.serializer.serializeWithTransactions(data);
|
|
58
53
|
return sealBlock({
|
|
59
54
|
...(await this.deserializer.deserializeWithTransactions(serialized)),
|
|
60
55
|
serialized: serialized.toString("hex"),
|
|
61
56
|
});
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
async fromStorage(header, transactions) {
|
|
59
|
+
const parsedTransactions = await Promise.all(transactions.map((tx) => this.transactionFactory.fromStorage(tx)));
|
|
60
|
+
return sealBlock({
|
|
61
|
+
data: {
|
|
62
|
+
fee: BigNumber.make(header.fee),
|
|
63
|
+
gasUsed: header.gasUsed,
|
|
64
|
+
hash: header.hash,
|
|
65
|
+
logsBloom: header.logsBloom,
|
|
66
|
+
number: header.number,
|
|
67
|
+
parentHash: header.parentHash,
|
|
68
|
+
payloadSize: header.payloadSize,
|
|
69
|
+
proposer: header.proposer,
|
|
70
|
+
reward: BigNumber.make(header.reward),
|
|
71
|
+
round: header.round,
|
|
72
|
+
stateRoot: header.stateRoot,
|
|
73
|
+
timestamp: Number(header.timestamp),
|
|
74
|
+
transactions: parsedTransactions.map((tx) => tx.data),
|
|
75
|
+
transactionsCount: header.transactionsCount,
|
|
76
|
+
transactionsRoot: header.transactionsRoot,
|
|
77
|
+
version: header.version,
|
|
78
|
+
},
|
|
79
|
+
serialized: "",
|
|
80
|
+
transactions: parsedTransactions,
|
|
81
|
+
});
|
|
70
82
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
async #fromSerialized(serialized) {
|
|
84
|
+
const deserialized = await this.deserializer.deserializeWithTransactions(serialized);
|
|
85
|
+
const validated = await this.#applySchema(deserialized.data);
|
|
86
|
+
if (validated) {
|
|
87
|
+
deserialized.data = validated;
|
|
88
|
+
}
|
|
89
|
+
return sealBlock({
|
|
90
|
+
...deserialized,
|
|
91
|
+
serialized: serialized.toString("hex"),
|
|
92
|
+
});
|
|
80
93
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
fatal = true;
|
|
94
|
+
async #applySchema(data) {
|
|
95
|
+
const result = this.validator.validate("block", data);
|
|
96
|
+
if (!result.error) {
|
|
97
|
+
return result.value;
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
for (const error of result.errors ?? []) {
|
|
100
|
+
let fatal = false;
|
|
101
|
+
const match = error.instancePath.match(/\.transactions\[(\d+)]/);
|
|
102
|
+
if (match === null) {
|
|
103
|
+
fatal = true;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (data.transactions) {
|
|
107
|
+
const txIndex = Number(match[1]);
|
|
108
|
+
const tx = data.transactions[txIndex];
|
|
109
|
+
if (tx.hash === undefined) {
|
|
110
|
+
fatal = true;
|
|
111
|
+
}
|
|
93
112
|
}
|
|
94
113
|
}
|
|
114
|
+
if (fatal) {
|
|
115
|
+
throw new BlockSchemaError(data.number, `Invalid data${error.instancePath ? " at " + error.instancePath : ""}: ` +
|
|
116
|
+
`${error.message}: ${JSON.stringify(error.data)}`);
|
|
117
|
+
}
|
|
95
118
|
}
|
|
96
|
-
|
|
97
|
-
throw new Exceptions.BlockSchemaError(data.height, `Invalid data${error.instancePath ? " at " + error.instancePath : ""}: ` +
|
|
98
|
-
`${error.message}: ${JSON.stringify(error.data)}`);
|
|
99
|
-
}
|
|
119
|
+
return result.value;
|
|
100
120
|
}
|
|
101
|
-
return result.value;
|
|
102
121
|
};
|
|
103
122
|
__decorate([
|
|
104
123
|
inject(Identifiers.Cryptography.Block.Serializer),
|
|
@@ -109,9 +128,13 @@ __decorate([
|
|
|
109
128
|
__metadata("design:type", Object)
|
|
110
129
|
], BlockFactory.prototype, "deserializer", void 0);
|
|
111
130
|
__decorate([
|
|
112
|
-
inject(Identifiers.Cryptography.Block.
|
|
113
|
-
__metadata("design:type",
|
|
114
|
-
], BlockFactory.prototype, "
|
|
131
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
|
132
|
+
__metadata("design:type", HashFactory)
|
|
133
|
+
], BlockFactory.prototype, "hashFactory", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
inject(Identifiers.Cryptography.Transaction.Factory),
|
|
136
|
+
__metadata("design:type", Object)
|
|
137
|
+
], BlockFactory.prototype, "transactionFactory", void 0);
|
|
115
138
|
__decorate([
|
|
116
139
|
inject(Identifiers.Cryptography.Validator),
|
|
117
140
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEP,UAAU,CAAoC;IAG9C,YAAY,CAAsC;IAGlD,WAAW,CAAe;IAG1B,kBAAkB,CAAuC;IAGzD,SAAS,CAA8B;IAEjD,KAAK,CAAC,IAAI,CAChB,IAA4C,EAC5C,YAA4C;QAE5C,MAAM,KAAK,GAA+B,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAE/F,MAAM,UAAU,GAAW,MAAM,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAEjF,OAAO,SAAS,CAAC;YAChB,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;YACtC,YAAY;SACZ,CAAC,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,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