@mainsail/crypto-block 0.0.1-evm.5 → 0.0.1-evm.51
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 +23 -3
- package/distribution/block.d.ts.map +1 -1
- package/distribution/block.js +65 -9
- package/distribution/block.js.map +1 -1
- package/distribution/deserializer.d.ts +3 -4
- package/distribution/deserializer.d.ts.map +1 -1
- package/distribution/deserializer.js +47 -104
- package/distribution/deserializer.js.map +1 -1
- package/distribution/factory.d.ts +7 -4
- package/distribution/factory.d.ts.map +1 -1
- package/distribution/factory.js +84 -72
- 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} +11 -9
- package/distribution/hash.factory.js.map +1 -0
- package/distribution/index.d.ts +2 -6
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +2 -22
- 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 +77 -25
- package/distribution/schemas.js.map +1 -1
- package/distribution/serializer-schemas.d.ts +5 -0
- package/distribution/serializer-schemas.d.ts.map +1 -0
- package/distribution/serializer-schemas.js +57 -0
- package/distribution/serializer-schemas.js.map +1 -0
- package/distribution/serializer.d.ts +5 -8
- package/distribution/serializer.d.ts.map +1 -1
- package/distribution/serializer.js +13 -121
- package/distribution/serializer.js.map +1 -1
- package/distribution/service-provider.d.ts +5 -0
- package/distribution/service-provider.d.ts.map +1 -0
- package/distribution/service-provider.js +48 -0
- package/distribution/service-provider.js.map +1 -0
- package/package.json +27 -25
- 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,9 +1,29 @@
|
|
|
1
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
2
2
|
interface BlockArguments {
|
|
3
|
-
data: Contracts.Crypto.
|
|
3
|
+
data: Contracts.Crypto.BlockHeader;
|
|
4
4
|
serialized: string;
|
|
5
5
|
transactions: Contracts.Crypto.Transaction[];
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare class Block implements Contracts.Crypto.Block {
|
|
8
|
+
readonly timestamp: number;
|
|
9
|
+
readonly version: number;
|
|
10
|
+
readonly number: number;
|
|
11
|
+
readonly round: number;
|
|
12
|
+
readonly parentHash: string;
|
|
13
|
+
readonly stateRoot: string;
|
|
14
|
+
readonly logsBloom: string;
|
|
15
|
+
readonly transactionsCount: number;
|
|
16
|
+
readonly gasUsed: number;
|
|
17
|
+
readonly fee: bigint;
|
|
18
|
+
readonly reward: bigint;
|
|
19
|
+
readonly payloadSize: number;
|
|
20
|
+
readonly transactionsRoot: string;
|
|
21
|
+
readonly proposer: string;
|
|
22
|
+
readonly hash: string;
|
|
23
|
+
readonly serialized: string;
|
|
24
|
+
readonly transactions: Contracts.Crypto.BlockTransaction[];
|
|
25
|
+
constructor({ data, serialized, transactions }: BlockArguments);
|
|
26
|
+
toData(): Contracts.Crypto.BlockData;
|
|
27
|
+
}
|
|
8
28
|
export {};
|
|
9
29
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -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;AAIrD,UAAU,cAAc;IACvB,IAAI,E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
|
|
4
|
+
version;
|
|
5
|
+
number;
|
|
6
|
+
round;
|
|
7
|
+
parentHash;
|
|
8
|
+
stateRoot;
|
|
9
|
+
logsBloom;
|
|
10
|
+
transactionsCount;
|
|
11
|
+
gasUsed;
|
|
12
|
+
fee;
|
|
13
|
+
reward;
|
|
14
|
+
payloadSize;
|
|
15
|
+
transactionsRoot;
|
|
16
|
+
proposer;
|
|
17
|
+
hash;
|
|
18
|
+
serialized;
|
|
19
|
+
transactions;
|
|
20
|
+
constructor({ data, serialized, transactions }) {
|
|
21
|
+
this.timestamp = data.timestamp;
|
|
22
|
+
this.version = data.version;
|
|
23
|
+
this.number = data.number;
|
|
24
|
+
this.round = data.round;
|
|
25
|
+
this.parentHash = data.parentHash;
|
|
26
|
+
this.stateRoot = data.stateRoot;
|
|
27
|
+
this.logsBloom = data.logsBloom;
|
|
28
|
+
this.transactionsCount = data.transactionsCount;
|
|
29
|
+
this.gasUsed = data.gasUsed;
|
|
30
|
+
this.fee = data.fee;
|
|
31
|
+
this.reward = data.reward;
|
|
32
|
+
this.payloadSize = data.payloadSize;
|
|
33
|
+
this.transactionsRoot = data.transactionsRoot;
|
|
34
|
+
this.proposer = data.proposer;
|
|
35
|
+
this.hash = data.hash;
|
|
36
|
+
this.serialized = serialized;
|
|
37
|
+
this.transactions = transactions.map((transaction, index) => new BlockTransaction(transaction, transaction.serialized, {
|
|
38
|
+
blockHash: this.hash,
|
|
39
|
+
blockNumber: this.number,
|
|
40
|
+
transactionIndex: index,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
toData() {
|
|
44
|
+
return {
|
|
45
|
+
/* eslint-disable perfectionist/sort-objects */
|
|
46
|
+
timestamp: this.timestamp,
|
|
47
|
+
version: this.version,
|
|
48
|
+
number: this.number,
|
|
49
|
+
round: this.round,
|
|
50
|
+
parentHash: this.parentHash,
|
|
51
|
+
stateRoot: this.stateRoot,
|
|
52
|
+
logsBloom: this.logsBloom,
|
|
53
|
+
transactionsCount: this.transactionsCount,
|
|
54
|
+
gasUsed: this.gasUsed,
|
|
55
|
+
fee: this.fee,
|
|
56
|
+
reward: this.reward,
|
|
57
|
+
payloadSize: this.payloadSize,
|
|
58
|
+
transactionsRoot: this.transactionsRoot,
|
|
59
|
+
proposer: this.proposer,
|
|
60
|
+
hash: this.hash,
|
|
61
|
+
transactions: this.transactions.map((transaction) => transaction.toData()),
|
|
62
|
+
/* eslint-enable perfectionist/sort-objects */
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
10
66
|
//# sourceMappingURL=block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAQhE,MAAM,OAAO,KAAK;IACD,SAAS,CAAS;IAClB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,iBAAiB,CAAS;IAC1B,OAAO,CAAS;IAChB,GAAG,CAAS;IACZ,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,gBAAgB,CAAS;IACzB,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,YAAY,CAAsC;IAElE,YAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAkB;QACpE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QA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,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAC1E,8CAA8C;SAC9C,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,11 +1,10 @@
|
|
|
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;
|
|
7
6
|
private readonly serializer;
|
|
8
|
-
private readonly
|
|
7
|
+
private readonly headerSize;
|
|
9
8
|
deserializeHeader(serialized: Buffer): Promise<Contracts.Crypto.BlockHeader>;
|
|
10
9
|
deserializeWithTransactions(serialized: Buffer): Promise<Contracts.Crypto.BlockWithTransactions>;
|
|
11
10
|
}
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAUrD,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,UAAU,CAAmC;IAG9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAE9B,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;CA8D7G"}
|
|
@@ -7,134 +7,77 @@ 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 _Deserializer_instances, _Deserializer_deserializeBufferHeader, _Deserializer_deserializeTransactions;
|
|
16
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
10
|
+
import { Identifiers } from "@mainsail/constants";
|
|
17
11
|
import { inject, injectable } from "@mainsail/container";
|
|
18
|
-
import {
|
|
19
|
-
import { TransactionFactory } from "@mainsail/crypto-transaction";
|
|
20
|
-
import { Utils as AppUtils } from "@mainsail/kernel";
|
|
12
|
+
import { InvalidBlockBytesError } from "@mainsail/exceptions";
|
|
21
13
|
import { ByteBuffer } from "@mainsail/utils";
|
|
22
|
-
import {
|
|
14
|
+
import { HashFactory } from "./hash.factory.js";
|
|
15
|
+
import { blockHeaderSchema, transactionsSchema } from "./serializer-schemas.js";
|
|
23
16
|
let Deserializer = class Deserializer {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
hashFactory;
|
|
18
|
+
transactionFactory;
|
|
19
|
+
serializer;
|
|
20
|
+
headerSize;
|
|
27
21
|
async deserializeHeader(serialized) {
|
|
28
22
|
const buffer = ByteBuffer.fromBuffer(serialized);
|
|
29
|
-
const header = await
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const header = await this.#deserializeBufferHeader(buffer);
|
|
24
|
+
return {
|
|
25
|
+
...header,
|
|
26
|
+
hash: await this.hashFactory.make(header),
|
|
27
|
+
};
|
|
32
28
|
}
|
|
33
29
|
async deserializeWithTransactions(serialized) {
|
|
34
30
|
const buffer = ByteBuffer.fromBuffer(serialized);
|
|
35
|
-
const
|
|
31
|
+
const header = await this.#deserializeBufferHeader(buffer);
|
|
36
32
|
let transactions = [];
|
|
37
33
|
if (buffer.getRemainderLength() > 0) {
|
|
38
|
-
transactions = await
|
|
34
|
+
transactions = await this.#deserializeTransactions(header, buffer);
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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",
|
|
76
|
-
},
|
|
77
|
-
totalFee: {
|
|
78
|
-
type: "uint256",
|
|
79
|
-
},
|
|
80
|
-
reward: {
|
|
81
|
-
type: "uint256",
|
|
82
|
-
},
|
|
83
|
-
payloadLength: {
|
|
84
|
-
type: "uint32",
|
|
85
|
-
},
|
|
86
|
-
payloadHash: {
|
|
87
|
-
type: "hash",
|
|
88
|
-
},
|
|
89
|
-
generatorAddress: {
|
|
90
|
-
type: "address",
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
return block;
|
|
95
|
-
};
|
|
96
|
-
_Deserializer_deserializeTransactions = async function _Deserializer_deserializeTransactions(block, buf) {
|
|
97
|
-
await this.serializer.deserialize(buf, block, {
|
|
98
|
-
length: block.payloadLength,
|
|
99
|
-
schema: {
|
|
100
|
-
transactions: {
|
|
101
|
-
type: "transactions",
|
|
36
|
+
if (buffer.getRemainderLength() !== 0) {
|
|
37
|
+
throw new InvalidBlockBytesError(`Found trailing bytes of length ${buffer.getRemainderLength()}`);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
data: {
|
|
41
|
+
...header,
|
|
42
|
+
hash: await this.hashFactory.make(header),
|
|
102
43
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (index % 20 === 0) {
|
|
114
|
-
await AppUtils.sleep(0);
|
|
44
|
+
transactions,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async #deserializeBufferHeader(buffer) {
|
|
48
|
+
const header = await this.serializer.deserialize(buffer, {}, {
|
|
49
|
+
length: this.headerSize(),
|
|
50
|
+
schema: blockHeaderSchema,
|
|
51
|
+
});
|
|
52
|
+
if (buffer.getRemainderLength() !== header.payloadSize) {
|
|
53
|
+
throw new InvalidBlockBytesError(`Payload size ${header.payloadSize} does not match actual payload size ${buffer.getRemainderLength()}`);
|
|
115
54
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
55
|
+
return header;
|
|
56
|
+
}
|
|
57
|
+
async #deserializeTransactions(header, buf) {
|
|
58
|
+
const block = await this.serializer.deserialize(buf, { ...header }, {
|
|
59
|
+
length: header.payloadSize,
|
|
60
|
+
schema: transactionsSchema,
|
|
61
|
+
});
|
|
62
|
+
return Promise.all(block.transactions.map(async (serialized) => this.transactionFactory.fromBytes(serialized)));
|
|
119
63
|
}
|
|
120
|
-
return transactions;
|
|
121
64
|
};
|
|
122
65
|
__decorate([
|
|
123
|
-
inject(Identifiers.Cryptography.Block.
|
|
124
|
-
__metadata("design:type",
|
|
125
|
-
], Deserializer.prototype, "
|
|
66
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
|
67
|
+
__metadata("design:type", HashFactory)
|
|
68
|
+
], Deserializer.prototype, "hashFactory", void 0);
|
|
126
69
|
__decorate([
|
|
127
70
|
inject(Identifiers.Cryptography.Transaction.Factory),
|
|
128
|
-
__metadata("design:type",
|
|
71
|
+
__metadata("design:type", Object)
|
|
129
72
|
], Deserializer.prototype, "transactionFactory", void 0);
|
|
130
73
|
__decorate([
|
|
131
74
|
inject(Identifiers.Cryptography.Serializer),
|
|
132
75
|
__metadata("design:type", Object)
|
|
133
76
|
], Deserializer.prototype, "serializer", void 0);
|
|
134
77
|
__decorate([
|
|
135
|
-
inject(Identifiers.Cryptography.Block.
|
|
136
|
-
__metadata("design:type",
|
|
137
|
-
], Deserializer.prototype, "
|
|
78
|
+
inject(Identifiers.Cryptography.Block.HeaderSize),
|
|
79
|
+
__metadata("design:type", Function)
|
|
80
|
+
], Deserializer.prototype, "headerSize", void 0);
|
|
138
81
|
Deserializer = __decorate([
|
|
139
82
|
injectable()
|
|
140
83
|
], 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":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGzE,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEP,WAAW,CAAe;IAG1B,kBAAkB,CAAuC;IAGzD,UAAU,CAAmC;IAG7C,UAAU,CAAgB;IAEpC,KAAK,CAAC,iBAAiB,CAAC,UAAkB;QAChD,MAAM,MAAM,GAAe,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAE7D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAE3D,OAAO;YACN,GAAG,MAAM;YACT,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;SACzC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,2BAA2B,CAAC,UAAkB;QAC1D,MAAM,MAAM,GAAe,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAE7D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAE3D,IAAI,YAAY,GAAmC,EAAE,CAAC;QAEtD,IAAI,MAAM,CAAC,kBAAkB,EAAE,GAAG,CAAC,EAAE,CAAC;YACrC,YAAY,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAA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AApFiB;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,UAAU,CAAC;;gDACkB;AAG7C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;gDACP;AAX/B,YAAY;IADxB,UAAU,EAAE;GACA,YAAY,CAsFxB"}
|
|
@@ -1,14 +1,17 @@
|
|
|
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.BlockHeaderRaw, 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
|
+
fromStorage(header: Contracts.Evm.BlockHeaderStorageData, transactions: Contracts.Evm.TransactionStorageData[]): Promise<Contracts.Crypto.Block>;
|
|
13
|
+
headerFromBytes(serialized: Buffer): Promise<Contracts.Crypto.BlockHeader>;
|
|
14
|
+
headerFromStorage(header: Contracts.Evm.BlockHeaderStorageData): Promise<Contracts.Crypto.BlockHeader>;
|
|
12
15
|
fromJson(json: Contracts.Crypto.BlockJson): Promise<Contracts.Crypto.Block>;
|
|
13
16
|
fromData(data: Contracts.Crypto.BlockData): Promise<Contracts.Crypto.Block>;
|
|
14
17
|
}
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AASrD,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,cAAc,EACrC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,GAC1C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAcrB,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,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;IAkBrB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAO1E,iBAAiB,CAC7B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,sBAAsB,GAC1C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAoB3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAe3E,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;CAiCxF"}
|
package/distribution/factory.js
CHANGED
|
@@ -7,98 +7,106 @@ 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 {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { IDFactory } from "./id.factory.js";
|
|
12
|
+
import { BlockSchemaError } from "@mainsail/exceptions";
|
|
13
|
+
import { Block } from "./block.js";
|
|
14
|
+
import { HashFactory } from "./hash.factory.js";
|
|
21
15
|
let BlockFactory = class BlockFactory {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
serializer;
|
|
17
|
+
deserializer;
|
|
18
|
+
hashFactory;
|
|
19
|
+
transactionFactory;
|
|
20
|
+
validator;
|
|
25
21
|
async make(data, transactions) {
|
|
26
|
-
const block = { ...data,
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const block = { ...data, hash: await this.hashFactory.make(data) };
|
|
23
|
+
await this.#verify("block", { ...block, transactions });
|
|
24
|
+
const serialized = await this.serializer.serializeWithTransactions({ ...data, transactions });
|
|
25
|
+
return new Block({
|
|
29
26
|
data: block,
|
|
30
27
|
serialized: serialized.toString("hex"),
|
|
31
28
|
transactions,
|
|
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);
|
|
36
|
+
}
|
|
37
|
+
async fromStorage(header, transactions) {
|
|
38
|
+
const parsedTransactions = await Promise.all(transactions.map((tx) => this.transactionFactory.fromStorage({ ...tx, blockHash: header.hash })));
|
|
39
|
+
const data = await this.headerFromStorage(header);
|
|
40
|
+
const serialized = await this.serializer.serializeWithTransactions({
|
|
41
|
+
...data,
|
|
42
|
+
transactions: parsedTransactions,
|
|
43
|
+
});
|
|
44
|
+
return new Block({
|
|
45
|
+
data,
|
|
46
|
+
serialized: serialized.toString("hex"),
|
|
47
|
+
transactions: parsedTransactions,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async headerFromBytes(serialized) {
|
|
51
|
+
const blockHeader = await this.deserializer.deserializeHeader(serialized);
|
|
52
|
+
await this.#verify("blockHeader", blockHeader);
|
|
53
|
+
return blockHeader;
|
|
54
|
+
}
|
|
55
|
+
async headerFromStorage(header) {
|
|
56
|
+
return {
|
|
57
|
+
fee: header.fee,
|
|
58
|
+
gasUsed: header.gasUsed,
|
|
59
|
+
hash: header.hash,
|
|
60
|
+
logsBloom: header.logsBloom,
|
|
61
|
+
number: header.number,
|
|
62
|
+
parentHash: header.parentHash,
|
|
63
|
+
payloadSize: header.payloadSize,
|
|
64
|
+
proposer: header.proposer,
|
|
65
|
+
reward: header.reward,
|
|
66
|
+
round: header.round,
|
|
67
|
+
stateRoot: header.stateRoot,
|
|
68
|
+
timestamp: Number(header.timestamp),
|
|
69
|
+
transactionsCount: header.transactionsCount,
|
|
70
|
+
transactionsRoot: header.transactionsRoot,
|
|
71
|
+
version: header.version,
|
|
72
|
+
};
|
|
39
73
|
}
|
|
40
74
|
async fromJson(json) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
75
|
+
const data = {
|
|
76
|
+
...json,
|
|
77
|
+
fee: BigInt(json.fee),
|
|
78
|
+
reward: BigInt(json.reward),
|
|
79
|
+
transactions: json.transactions.map((tx) => ({
|
|
80
|
+
...tx,
|
|
81
|
+
nonce: BigInt(tx.nonce),
|
|
82
|
+
value: BigInt(tx.value),
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
53
85
|
return this.fromData(data);
|
|
54
86
|
}
|
|
55
87
|
async fromData(data) {
|
|
56
|
-
await
|
|
57
|
-
const
|
|
58
|
-
|
|
88
|
+
await this.#verify("block", data);
|
|
89
|
+
const transactions = await Promise.all(data.transactions.map((tx) => this.transactionFactory.fromData(tx, false)));
|
|
90
|
+
const serialized = await this.serializer.serializeWithTransactions({ ...data, transactions });
|
|
91
|
+
return new Block({
|
|
59
92
|
...(await this.deserializer.deserializeWithTransactions(serialized)),
|
|
60
93
|
serialized: serialized.toString("hex"),
|
|
61
94
|
});
|
|
62
95
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
return sealBlock({
|
|
72
|
-
...deserialized,
|
|
73
|
-
serialized: serialized.toString("hex"),
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
_BlockFactory_applySchema = async function _BlockFactory_applySchema(data) {
|
|
77
|
-
const result = this.validator.validate("block", data);
|
|
78
|
-
if (!result.error) {
|
|
79
|
-
return result.value;
|
|
96
|
+
async #fromSerialized(serialized) {
|
|
97
|
+
const deserialized = await this.deserializer.deserializeWithTransactions(serialized);
|
|
98
|
+
await this.#verify("block", { ...deserialized.data, transactions: deserialized.transactions });
|
|
99
|
+
return new Block({
|
|
100
|
+
...deserialized,
|
|
101
|
+
serialized: serialized.toString("hex"),
|
|
102
|
+
});
|
|
80
103
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
fatal = true;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
const txIndex = match[1];
|
|
89
|
-
if (data.transactions) {
|
|
90
|
-
const tx = data.transactions[txIndex];
|
|
91
|
-
if (tx.id === undefined) {
|
|
92
|
-
fatal = true;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (fatal) {
|
|
97
|
-
throw new Exceptions.BlockSchemaError(data.height, `Invalid data${error.instancePath ? " at " + error.instancePath : ""}: ` +
|
|
98
|
-
`${error.message}: ${JSON.stringify(error.data)}`);
|
|
104
|
+
async #verify(schema, data) {
|
|
105
|
+
const { error } = this.validator.validate(schema, data);
|
|
106
|
+
if (error) {
|
|
107
|
+
throw new BlockSchemaError(data.number, error);
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
|
-
return result.value;
|
|
102
110
|
};
|
|
103
111
|
__decorate([
|
|
104
112
|
inject(Identifiers.Cryptography.Block.Serializer),
|
|
@@ -109,9 +117,13 @@ __decorate([
|
|
|
109
117
|
__metadata("design:type", Object)
|
|
110
118
|
], BlockFactory.prototype, "deserializer", void 0);
|
|
111
119
|
__decorate([
|
|
112
|
-
inject(Identifiers.Cryptography.Block.
|
|
113
|
-
__metadata("design:type",
|
|
114
|
-
], BlockFactory.prototype, "
|
|
120
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
|
121
|
+
__metadata("design:type", HashFactory)
|
|
122
|
+
], BlockFactory.prototype, "hashFactory", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
inject(Identifiers.Cryptography.Transaction.Factory),
|
|
125
|
+
__metadata("design:type", Object)
|
|
126
|
+
], BlockFactory.prototype, "transactionFactory", void 0);
|
|
115
127
|
__decorate([
|
|
116
128
|
inject(Identifiers.Cryptography.Validator),
|
|
117
129
|
__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":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,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,IAAqC,EACrC,YAA4C;QAE5C,MAAM,KAAK,GAAiC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAEjG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAExD,MAAM,UAAU,GAAW,MAAM,IAAI,CAAC,UAAU,CAAC,yB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