@mainsail/crypto-block 0.0.1-evm.2 → 0.0.1-evm.20
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.map +1 -1
- package/distribution/block.js +1 -1
- package/distribution/block.js.map +1 -1
- package/distribution/deserializer.d.ts +2 -3
- package/distribution/deserializer.d.ts.map +1 -1
- package/distribution/deserializer.js +27 -27
- package/distribution/deserializer.js.map +1 -1
- package/distribution/factory.d.ts +1 -2
- package/distribution/factory.d.ts.map +1 -1
- package/distribution/factory.js +8 -10
- package/distribution/factory.js.map +1 -1
- package/distribution/{id.factory.d.ts → hash.factory.d.ts} +2 -2
- package/distribution/hash.factory.d.ts.map +1 -0
- package/distribution/{id.factory.js → hash.factory.js} +7 -7
- 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 +34 -8
- package/distribution/index.js.map +1 -1
- package/distribution/schemas.d.ts +1 -1
- 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 +1 -4
- package/distribution/serializer.d.ts.map +1 -1
- package/distribution/serializer.js +31 -53
- package/distribution/serializer.js.map +1 -1
- package/package.json +25 -24
- 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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,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,
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,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,KAS7F,CAAC"}
|
package/distribution/block.js
CHANGED
@@ -3,7 +3,7 @@ export const sealBlock = ({ data, serialized, transactions }) => Object.seal({
|
|
3
3
|
header: data,
|
4
4
|
serialized,
|
5
5
|
transactions: transactions.map((transaction, index) => {
|
6
|
-
transaction.data.
|
6
|
+
transaction.data.transactionIndex = index;
|
7
7
|
return transaction;
|
8
8
|
}),
|
9
9
|
});
|
@@ -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,CACvG,MAAM,CAAC,IAAI,CAAC;IACX,IAAI;IACJ,MAAM,EAAE,IAAI;IACZ,UAAU;IACV,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACrD,WAAW,CAAC,IAAI,CAAC,
|
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,CACvG,MAAM,CAAC,IAAI,CAAC;IACX,IAAI;IACJ,MAAM,EAAE,IAAI;IACZ,UAAU;IACV,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACrD,WAAW,CAAC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC1C,OAAO,WAAW,CAAC;IACpB,CAAC,CAAC;CACF,CAAC,CAAC"}
|
@@ -1,11 +1,10 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
1
|
import { 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":"AAEA,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AAMpE,qBACa,YAAa,YAAW,SAAS,CAAC,MAAM,CAAC,iBAAiB;;IAEtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAG3C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IAGzD,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;IAU5E,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC;CA0G7G"}
|
@@ -17,9 +17,8 @@ var _Deserializer_instances, _Deserializer_deserializeBufferHeader, _Deserialize
|
|
17
17
|
import { inject, injectable } from "@mainsail/container";
|
18
18
|
import { Contracts, Identifiers } from "@mainsail/contracts";
|
19
19
|
import { TransactionFactory } from "@mainsail/crypto-transaction";
|
20
|
-
import {
|
21
|
-
import {
|
22
|
-
import { IDFactory } from "./id.factory.js";
|
20
|
+
import { ByteBuffer, sleep } from "@mainsail/utils";
|
21
|
+
import { HashFactory } from "./hash.factory.js";
|
23
22
|
let Deserializer = class Deserializer {
|
24
23
|
constructor() {
|
25
24
|
_Deserializer_instances.add(this);
|
@@ -27,7 +26,7 @@ let Deserializer = class Deserializer {
|
|
27
26
|
async deserializeHeader(serialized) {
|
28
27
|
const buffer = ByteBuffer.fromBuffer(serialized);
|
29
28
|
const header = await __classPrivateFieldGet(this, _Deserializer_instances, "m", _Deserializer_deserializeBufferHeader).call(this, buffer);
|
30
|
-
header.
|
29
|
+
header.hash = await this.hashFactory.make(header);
|
31
30
|
return header;
|
32
31
|
}
|
33
32
|
async deserializeWithTransactions(serialized) {
|
@@ -37,7 +36,7 @@ let Deserializer = class Deserializer {
|
|
37
36
|
if (buffer.getRemainderLength() > 0) {
|
38
37
|
transactions = await __classPrivateFieldGet(this, _Deserializer_instances, "m", _Deserializer_deserializeTransactions).call(this, block, buffer);
|
39
38
|
}
|
40
|
-
block.
|
39
|
+
block.hash = await this.hashFactory.make(block);
|
41
40
|
return { data: block, transactions };
|
42
41
|
}
|
43
42
|
};
|
@@ -45,7 +44,7 @@ _Deserializer_instances = new WeakSet();
|
|
45
44
|
_Deserializer_deserializeBufferHeader = async function _Deserializer_deserializeBufferHeader(buffer) {
|
46
45
|
const block = {};
|
47
46
|
await this.serializer.deserialize(buffer, block, {
|
48
|
-
length: this.
|
47
|
+
length: this.headerSize(),
|
49
48
|
schema: {
|
50
49
|
version: {
|
51
50
|
type: "uint8",
|
@@ -53,41 +52,42 @@ _Deserializer_deserializeBufferHeader = async function _Deserializer_deserialize
|
|
53
52
|
timestamp: {
|
54
53
|
type: "uint48",
|
55
54
|
},
|
56
|
-
|
55
|
+
number: {
|
57
56
|
type: "uint32",
|
58
57
|
},
|
59
58
|
round: {
|
60
59
|
type: "uint32",
|
61
60
|
},
|
62
|
-
|
61
|
+
parentHash: {
|
63
62
|
type: "hash",
|
64
63
|
},
|
65
|
-
|
64
|
+
stateRoot: {
|
66
65
|
type: "hash",
|
67
66
|
},
|
68
|
-
|
67
|
+
logsBloom: {
|
68
|
+
type: "hash",
|
69
|
+
size: 256,
|
70
|
+
},
|
71
|
+
transactionsCount: {
|
69
72
|
type: "uint16",
|
70
73
|
},
|
71
|
-
|
74
|
+
gasUsed: {
|
72
75
|
type: "uint32",
|
73
76
|
},
|
74
|
-
|
75
|
-
type: "uint256",
|
76
|
-
},
|
77
|
-
totalFee: {
|
77
|
+
fee: {
|
78
78
|
type: "uint256",
|
79
79
|
},
|
80
80
|
reward: {
|
81
81
|
type: "uint256",
|
82
82
|
},
|
83
|
-
|
83
|
+
payloadSize: {
|
84
84
|
type: "uint32",
|
85
85
|
},
|
86
|
-
|
86
|
+
transactionsRoot: {
|
87
87
|
type: "hash",
|
88
88
|
},
|
89
|
-
|
90
|
-
type: "
|
89
|
+
proposer: {
|
90
|
+
type: "address",
|
91
91
|
},
|
92
92
|
},
|
93
93
|
});
|
@@ -95,7 +95,7 @@ _Deserializer_deserializeBufferHeader = async function _Deserializer_deserialize
|
|
95
95
|
};
|
96
96
|
_Deserializer_deserializeTransactions = async function _Deserializer_deserializeTransactions(block, buf) {
|
97
97
|
await this.serializer.deserialize(buf, block, {
|
98
|
-
length: block.
|
98
|
+
length: block.payloadSize,
|
99
99
|
schema: {
|
100
100
|
transactions: {
|
101
101
|
type: "transactions",
|
@@ -111,7 +111,7 @@ _Deserializer_deserializeTransactions = async function _Deserializer_deserialize
|
|
111
111
|
const transactions = [];
|
112
112
|
for (let index = 0; index < block.transactions.length; index++) {
|
113
113
|
if (index % 20 === 0) {
|
114
|
-
await
|
114
|
+
await sleep(0);
|
115
115
|
}
|
116
116
|
const transaction = await this.transactionFactory.fromBytes(block.transactions[index]);
|
117
117
|
transactions.push(transaction);
|
@@ -120,9 +120,9 @@ _Deserializer_deserializeTransactions = async function _Deserializer_deserialize
|
|
120
120
|
return transactions;
|
121
121
|
};
|
122
122
|
__decorate([
|
123
|
-
inject(Identifiers.Cryptography.Block.
|
124
|
-
__metadata("design:type",
|
125
|
-
], Deserializer.prototype, "
|
123
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
124
|
+
__metadata("design:type", HashFactory)
|
125
|
+
], Deserializer.prototype, "hashFactory", void 0);
|
126
126
|
__decorate([
|
127
127
|
inject(Identifiers.Cryptography.Transaction.Factory),
|
128
128
|
__metadata("design:type", TransactionFactory)
|
@@ -132,9 +132,9 @@ __decorate([
|
|
132
132
|
__metadata("design:type", Object)
|
133
133
|
], Deserializer.prototype, "serializer", void 0);
|
134
134
|
__decorate([
|
135
|
-
inject(Identifiers.Cryptography.Block.
|
136
|
-
__metadata("design:type",
|
137
|
-
], Deserializer.prototype, "
|
135
|
+
inject(Identifiers.Cryptography.Block.HeaderSize),
|
136
|
+
__metadata("design:type", Function)
|
137
|
+
], Deserializer.prototype, "headerSize", void 0);
|
138
138
|
Deserializer = __decorate([
|
139
139
|
injectable()
|
140
140
|
], Deserializer);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,kB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E,KAAK,EAAE;QACzE,MAAM,EAAE,KAAK,CAAC,WAAW;QACzB,MAAM,EAAE;YACP,YAAY,EAAE;gBACb,IAAI,EAAE,cAAc;aACpB;SACD;KACD,CAAC,CAAC;IAEH;;;;;OAKG;IACH,MAAM,YAAY,GAAmC,EAAE,CAAC;IAExD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChE,IAAI,KAAK,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAQ,CAAC,CAAC;QAE9F,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAE/B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC;IAC9C,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AA9HgB;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;8BACf,kBAAkB;wDAAC;AAGxC;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,CAiIxB"}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
1
|
import { Contracts, Utils } 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;
|
8
7
|
private readonly validator;
|
9
8
|
make(data: Utils.Mutable<Contracts.Crypto.BlockDataSerializable>, transactions: Contracts.Crypto.Transaction[]): Promise<Contracts.Crypto.Block>;
|
10
9
|
fromHex(hex: string): Promise<Contracts.Crypto.Block>;
|
@@ -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":"AACA,OAAO,EAAE,SAAS,EAA2B,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAMhF,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,SAAS,CAA8B;IAE3C,IAAI,CAChB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAC3D,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;CA8DxF"}
|
package/distribution/factory.js
CHANGED
@@ -17,13 +17,13 @@ import { inject, injectable } from "@mainsail/container";
|
|
17
17
|
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
18
18
|
import { BigNumber } from "@mainsail/utils";
|
19
19
|
import { sealBlock } from "./block.js";
|
20
|
-
import {
|
20
|
+
import { HashFactory } from "./hash.factory.js";
|
21
21
|
let BlockFactory = class BlockFactory {
|
22
22
|
constructor() {
|
23
23
|
_BlockFactory_instances.add(this);
|
24
24
|
}
|
25
25
|
async make(data, transactions) {
|
26
|
-
const block = { ...data,
|
26
|
+
const block = { ...data, hash: await this.hashFactory.make(data) };
|
27
27
|
const serialized = await this.serializer.serializeWithTransactions(data);
|
28
28
|
return sealBlock({
|
29
29
|
data: block,
|
@@ -40,13 +40,11 @@ let BlockFactory = class BlockFactory {
|
|
40
40
|
async fromJson(json) {
|
41
41
|
// @ts-ignore
|
42
42
|
const data = { ...json };
|
43
|
-
data.
|
44
|
-
data.totalFee = BigNumber.make(data.totalFee);
|
43
|
+
data.fee = BigNumber.make(data.fee);
|
45
44
|
data.reward = BigNumber.make(data.reward);
|
46
45
|
if (data.transactions) {
|
47
46
|
for (const transaction of data.transactions) {
|
48
|
-
transaction.
|
49
|
-
transaction.fee = BigNumber.make(transaction.fee);
|
47
|
+
transaction.value = BigNumber.make(transaction.value);
|
50
48
|
transaction.nonce = BigNumber.make(transaction.nonce);
|
51
49
|
}
|
52
50
|
}
|
@@ -94,7 +92,7 @@ _BlockFactory_applySchema = async function _BlockFactory_applySchema(data) {
|
|
94
92
|
}
|
95
93
|
}
|
96
94
|
if (fatal) {
|
97
|
-
throw new Exceptions.BlockSchemaError(data.
|
95
|
+
throw new Exceptions.BlockSchemaError(data.number, `Invalid data${error.instancePath ? " at " + error.instancePath : ""}: ` +
|
98
96
|
`${error.message}: ${JSON.stringify(error.data)}`);
|
99
97
|
}
|
100
98
|
}
|
@@ -109,9 +107,9 @@ __decorate([
|
|
109
107
|
__metadata("design:type", Object)
|
110
108
|
], BlockFactory.prototype, "deserializer", void 0);
|
111
109
|
__decorate([
|
112
|
-
inject(Identifiers.Cryptography.Block.
|
113
|
-
__metadata("design:type",
|
114
|
-
], BlockFactory.prototype, "
|
110
|
+
inject(Identifiers.Cryptography.Block.HashFactory),
|
111
|
+
__metadata("design:type", HashFactory)
|
112
|
+
], BlockFactory.prototype, "hashFactory", void 0);
|
115
113
|
__decorate([
|
116
114
|
inject(Identifiers.Cryptography.Validator),
|
117
115
|
__metadata("design:type", Object)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AAChF,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;IAAlB;;IA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kHxB"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
2
|
-
export declare class
|
2
|
+
export declare class HashFactory {
|
3
3
|
private readonly hashFactory;
|
4
4
|
private readonly serializer;
|
5
5
|
make(data: Contracts.Crypto.BlockDataSerializable): Promise<string>;
|
6
6
|
}
|
7
|
-
//# sourceMappingURL=
|
7
|
+
//# sourceMappingURL=hash.factory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hash.factory.d.ts","sourceRoot":"","sources":["../source/hash.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAE7D,qBACa,WAAW;IAEvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAG5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAElD,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;CAGhF"}
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { inject, injectable } from "@mainsail/container";
|
11
11
|
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
-
let
|
12
|
+
let HashFactory = class HashFactory {
|
13
13
|
async make(data) {
|
14
14
|
return (await this.hashFactory.sha256(await this.serializer.serializeHeader(data))).toString("hex");
|
15
15
|
}
|
@@ -17,13 +17,13 @@ let IDFactory = class IDFactory {
|
|
17
17
|
__decorate([
|
18
18
|
inject(Identifiers.Cryptography.Hash.Factory),
|
19
19
|
__metadata("design:type", Object)
|
20
|
-
],
|
20
|
+
], HashFactory.prototype, "hashFactory", void 0);
|
21
21
|
__decorate([
|
22
22
|
inject(Identifiers.Cryptography.Block.Serializer),
|
23
23
|
__metadata("design:type", Object)
|
24
|
-
],
|
25
|
-
|
24
|
+
], HashFactory.prototype, "serializer", void 0);
|
25
|
+
HashFactory = __decorate([
|
26
26
|
injectable()
|
27
|
-
],
|
28
|
-
export {
|
29
|
-
//# sourceMappingURL=
|
27
|
+
], HashFactory);
|
28
|
+
export { HashFactory };
|
29
|
+
//# sourceMappingURL=hash.factory.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hash.factory.js","sourceRoot":"","sources":["../source/hash.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,WAAW,GAAjB,MAAM,WAAW;IAOhB,KAAK,CAAC,IAAI,CAAC,IAA4C;QAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,CAAC;CACD,CAAA;AARiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;gDACc;AAG3C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;+CACa;AALnD,WAAW;IADvB,UAAU,EAAE;GACA,WAAW,CAUvB"}
|
package/distribution/index.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import { Providers } from "@mainsail/kernel";
|
2
2
|
export * from "./deserializer.js";
|
3
3
|
export * from "./factory.js";
|
4
|
-
export * from "./
|
4
|
+
export * from "./hash.factory.js";
|
5
5
|
export * from "./schemas.js";
|
6
6
|
export * from "./serializer.js";
|
7
|
-
export * from "./verifier.js";
|
8
7
|
export declare class ServiceProvider extends Providers.ServiceProvider {
|
9
8
|
register(): Promise<void>;
|
10
9
|
}
|
@@ -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,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAEhC,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAgCtC"}
|
package/distribution/index.js
CHANGED
@@ -1,27 +1,53 @@
|
|
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 { Identifiers } from "@mainsail/contracts";
|
2
9
|
import { Providers } from "@mainsail/kernel";
|
3
10
|
import { Deserializer } from "./deserializer.js";
|
4
11
|
import { BlockFactory } from "./factory.js";
|
5
|
-
import {
|
12
|
+
import { HashFactory } from "./hash.factory.js";
|
6
13
|
import { schemas } from "./schemas.js";
|
7
14
|
import { Serializer } from "./serializer.js";
|
8
|
-
import { Verifier } from "./verifier.js";
|
9
15
|
export * from "./deserializer.js";
|
10
16
|
export * from "./factory.js";
|
11
|
-
export * from "./
|
17
|
+
export * from "./hash.factory.js";
|
12
18
|
export * from "./schemas.js";
|
13
19
|
export * from "./serializer.js";
|
14
|
-
|
15
|
-
export class ServiceProvider extends Providers.ServiceProvider {
|
20
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
16
21
|
async register() {
|
22
|
+
this.app.bind(Identifiers.Cryptography.Block.HeaderSize).toConstantValue(() => {
|
23
|
+
const hashByteLength = this.app.get(Identifiers.Cryptography.Hash.Size.SHA256);
|
24
|
+
const generatorAddressByteLength = this.app.get(Identifiers.Cryptography.Identity.Address.Size);
|
25
|
+
return (1 + // version
|
26
|
+
6 + // timestamp
|
27
|
+
4 + // height
|
28
|
+
4 + // round
|
29
|
+
hashByteLength + // previousBlock
|
30
|
+
hashByteLength + // stateRoot
|
31
|
+
256 + // logsBloom
|
32
|
+
2 + // transactionsCount
|
33
|
+
4 + // totalGasUsed
|
34
|
+
32 + // totalFee
|
35
|
+
32 + // reward
|
36
|
+
4 + // payloadLength
|
37
|
+
hashByteLength + // payloadHash
|
38
|
+
generatorAddressByteLength);
|
39
|
+
});
|
17
40
|
this.app.bind(Identifiers.Cryptography.Block.Deserializer).to(Deserializer).inSingletonScope();
|
18
41
|
this.app.bind(Identifiers.Cryptography.Block.Factory).to(BlockFactory).inSingletonScope();
|
19
|
-
this.app.bind(Identifiers.Cryptography.Block.
|
42
|
+
this.app.bind(Identifiers.Cryptography.Block.HashFactory).to(HashFactory).inSingletonScope();
|
20
43
|
this.app.bind(Identifiers.Cryptography.Block.Serializer).to(Serializer).inSingletonScope();
|
21
|
-
this.app.bind(Identifiers.Cryptography.Block.Verifier).to(Verifier).inSingletonScope();
|
22
44
|
for (const schema of Object.values(schemas)) {
|
23
45
|
this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
|
24
46
|
}
|
25
47
|
}
|
26
|
-
}
|
48
|
+
};
|
49
|
+
ServiceProvider = __decorate([
|
50
|
+
injectable()
|
51
|
+
], ServiceProvider);
|
52
|
+
export { ServiceProvider };
|
27
53
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":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AAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChG,CAAC;IACF,CAAC;CACD,CAAA;AAjCY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAiC3B"}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { AnySchemaObject } from "ajv";
|
2
|
-
export declare const schemas: Record<"block" | "
|
2
|
+
export declare const schemas: Record<"block" | "blockHash" | "prefixedBlockHash" | "blockHeader" | "logsBloom", AnySchemaObject>;
|
3
3
|
//# sourceMappingURL=schemas.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,MAAM,CAC3B,OAAO,GAAG,WAAW,GAAG,mBAAmB,GAAG,aAAa,GAAG,WAAW,EACzE,eAAe,CAoFf,CAAC"}
|
package/distribution/schemas.js
CHANGED
@@ -5,52 +5,78 @@ export const schemas = {
|
|
5
5
|
properties: {
|
6
6
|
transactions: {
|
7
7
|
$ref: "transactions",
|
8
|
-
maxItems: { $data: "1/
|
9
|
-
minItems: { $data: "1/
|
8
|
+
maxItems: { $data: "1/transactionsCount" },
|
9
|
+
minItems: { $data: "1/transactionsCount" },
|
10
10
|
type: "array",
|
11
11
|
},
|
12
12
|
},
|
13
13
|
type: "object",
|
14
14
|
},
|
15
|
+
blockHash: {
|
16
|
+
$id: "blockHash",
|
17
|
+
allOf: [
|
18
|
+
{
|
19
|
+
$ref: "hex",
|
20
|
+
maxLength: 64,
|
21
|
+
minLength: 64,
|
22
|
+
},
|
23
|
+
],
|
24
|
+
type: "string",
|
25
|
+
},
|
15
26
|
blockHeader: {
|
16
27
|
$id: "blockHeader",
|
17
28
|
properties: {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
29
|
+
fee: { bignumber: { minimum: 0 } },
|
30
|
+
gasUsed: { minimum: 0, type: "integer" },
|
31
|
+
hash: { $ref: "blockHash" },
|
32
|
+
logsBloom: { $ref: "logsBloom" },
|
33
|
+
number: { minimum: 0, type: "integer" },
|
34
|
+
parentHash: { $ref: "blockHash" },
|
35
|
+
payloadSize: { minimum: 0, type: "integer" },
|
36
|
+
proposer: { $ref: "address" },
|
25
37
|
reward: { bignumber: { minimum: 0 } },
|
26
|
-
|
38
|
+
stateRoot: { $ref: "hex" },
|
27
39
|
timestamp: { maximum: 2 ** 48 - 1, minimum: 0, type: "integer" },
|
28
|
-
|
29
|
-
|
30
|
-
totalGasUsed: { minimum: 0, type: "integer" },
|
40
|
+
transactionsCount: { minimum: 0, type: "integer" },
|
41
|
+
transactionsRoot: { $ref: "hex" },
|
31
42
|
version: { enum: [1] },
|
32
43
|
},
|
33
44
|
required: [
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
45
|
+
"fee",
|
46
|
+
"gasUsed",
|
47
|
+
"hash",
|
48
|
+
"logsBloom",
|
49
|
+
"number",
|
50
|
+
"parentHash",
|
51
|
+
"payloadSize",
|
52
|
+
"proposer",
|
42
53
|
"reward",
|
43
|
-
"
|
54
|
+
"stateRoot",
|
55
|
+
"timestamp",
|
56
|
+
"transactionsCount",
|
57
|
+
"transactionsRoot",
|
58
|
+
"version",
|
44
59
|
],
|
45
60
|
type: "object",
|
46
61
|
},
|
47
|
-
|
48
|
-
$id: "
|
62
|
+
logsBloom: {
|
63
|
+
$id: "logsBloom",
|
49
64
|
allOf: [
|
50
65
|
{
|
51
66
|
$ref: "hex",
|
52
|
-
maxLength:
|
53
|
-
minLength:
|
67
|
+
maxLength: 512,
|
68
|
+
minLength: 512,
|
69
|
+
},
|
70
|
+
],
|
71
|
+
type: "string",
|
72
|
+
},
|
73
|
+
prefixedBlockHash: {
|
74
|
+
$id: "prefixedBlockHash",
|
75
|
+
allOf: [
|
76
|
+
{
|
77
|
+
$ref: "prefixedQuantityHex",
|
78
|
+
maxLength: 66,
|
79
|
+
minLength: 66,
|
54
80
|
},
|
55
81
|
],
|
56
82
|
type: "string",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAGhB;IACH,KAAK,EAAE;QACN,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE;YACX,YAAY,EAAE;gBACb,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE;gBAC1C,QAAQ,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE;gBAC1C,IAAI,EAAE,OAAO;aACb;SACD;QACD,IAAI,EAAE,QAAQ;KACd;IACD,SAAS,EAAE;QACV,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE;YACN;gBACC,IAAI,EAAE,KAAK;gBACX,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;aACb;SACD;QACD,IAAI,EAAE,QAAQ;KACd;IACD,WAAW,EAAE;QACZ,GAAG,EAAE,aAAa;QAClB,UAAU,EAAE;YACX,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;YAClC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;YACxC,IAAI,EAAE,EAAE,IAAI,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3B,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;aACb;SACD;QACD,IAAI,EAAE,QAAQ;KACd;CACD,CAAC"}
|
@@ -1,10 +1,7 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
1
|
import { Contracts } from "@mainsail/contracts";
|
3
2
|
export declare class Serializer implements Contracts.Crypto.BlockSerializer {
|
4
3
|
private readonly serializer;
|
5
|
-
private readonly
|
6
|
-
private readonly generatorPublicKeyByteLength;
|
7
|
-
headerSize(): number;
|
4
|
+
private readonly headerSize;
|
8
5
|
totalSize(block: Contracts.Crypto.BlockDataSerializable): number;
|
9
6
|
serializeHeader(block: Contracts.Crypto.BlockDataSerializable): Promise<Buffer>;
|
10
7
|
serializeWithTransactions(block: Contracts.Crypto.BlockDataSerializable): Promise<Buffer>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAE7D,qBACa,UAAW,YAAW,SAAS,CAAC,MAAM,CAAC,eAAe;IAElE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAG9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAEpC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,GAAG,MAAM;IAI1D,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAmD/E,yBAAyB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;CAqDtG"}
|
@@ -8,27 +8,11 @@ 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
10
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
11
|
-
import { inject, injectable
|
11
|
+
import { inject, injectable } from "@mainsail/container";
|
12
12
|
import { Contracts, Identifiers } from "@mainsail/contracts";
|
13
13
|
let Serializer = class Serializer {
|
14
|
-
headerSize() {
|
15
|
-
return (1 + // version
|
16
|
-
6 + // timestamp
|
17
|
-
4 + // height
|
18
|
-
4 + // round
|
19
|
-
this.hashByteLength + // previousBlock
|
20
|
-
this.hashByteLength + // stateHash
|
21
|
-
2 + // numberOfTransactions
|
22
|
-
4 + // totalGasUsed
|
23
|
-
32 + // totalAmount
|
24
|
-
32 + // totalFee
|
25
|
-
32 + // reward
|
26
|
-
4 + // payloadLength
|
27
|
-
this.hashByteLength + // payloadHash
|
28
|
-
this.generatorPublicKeyByteLength);
|
29
|
-
}
|
30
14
|
totalSize(block) {
|
31
|
-
return this.headerSize() + block.
|
15
|
+
return this.headerSize() + block.payloadSize;
|
32
16
|
}
|
33
17
|
async serializeHeader(block) {
|
34
18
|
return this.serializer.serialize(block, {
|
@@ -41,41 +25,41 @@ let Serializer = class Serializer {
|
|
41
25
|
timestamp: {
|
42
26
|
type: "uint48",
|
43
27
|
},
|
44
|
-
|
28
|
+
number: {
|
45
29
|
type: "uint32",
|
46
30
|
},
|
47
31
|
round: {
|
48
32
|
type: "uint32",
|
49
33
|
},
|
50
|
-
|
34
|
+
parentHash: {
|
35
|
+
type: "hash",
|
36
|
+
},
|
37
|
+
stateRoot: {
|
51
38
|
type: "hash",
|
52
39
|
},
|
53
|
-
|
40
|
+
logsBloom: {
|
54
41
|
type: "hash",
|
55
42
|
},
|
56
|
-
|
43
|
+
transactionsCount: {
|
57
44
|
type: "uint16",
|
58
45
|
},
|
59
|
-
|
46
|
+
gasUsed: {
|
60
47
|
type: "uint32",
|
61
48
|
},
|
62
|
-
|
63
|
-
type: "uint256",
|
64
|
-
},
|
65
|
-
totalFee: {
|
49
|
+
fee: {
|
66
50
|
type: "uint256",
|
67
51
|
},
|
68
52
|
reward: {
|
69
53
|
type: "uint256",
|
70
54
|
},
|
71
|
-
|
55
|
+
payloadSize: {
|
72
56
|
type: "uint32",
|
73
57
|
},
|
74
|
-
|
58
|
+
transactionsRoot: {
|
75
59
|
type: "hash",
|
76
60
|
},
|
77
|
-
|
78
|
-
type: "
|
61
|
+
proposer: {
|
62
|
+
type: "address",
|
79
63
|
},
|
80
64
|
},
|
81
65
|
});
|
@@ -91,41 +75,41 @@ let Serializer = class Serializer {
|
|
91
75
|
timestamp: {
|
92
76
|
type: "uint48",
|
93
77
|
},
|
94
|
-
|
78
|
+
number: {
|
95
79
|
type: "uint32",
|
96
80
|
},
|
97
81
|
round: {
|
98
82
|
type: "uint32",
|
99
83
|
},
|
100
|
-
|
84
|
+
parentHash: {
|
101
85
|
type: "hash",
|
102
86
|
},
|
103
|
-
|
87
|
+
stateRoot: {
|
104
88
|
type: "hash",
|
105
89
|
},
|
106
|
-
|
90
|
+
logsBloom: {
|
91
|
+
type: "hash",
|
92
|
+
},
|
93
|
+
transactionsCount: {
|
107
94
|
type: "uint16",
|
108
95
|
},
|
109
|
-
|
96
|
+
gasUsed: {
|
110
97
|
type: "uint32",
|
111
98
|
},
|
112
|
-
|
113
|
-
type: "uint256",
|
114
|
-
},
|
115
|
-
totalFee: {
|
99
|
+
fee: {
|
116
100
|
type: "uint256",
|
117
101
|
},
|
118
102
|
reward: {
|
119
103
|
type: "uint256",
|
120
104
|
},
|
121
|
-
|
105
|
+
payloadSize: {
|
122
106
|
type: "uint32",
|
123
107
|
},
|
124
|
-
|
108
|
+
transactionsRoot: {
|
125
109
|
type: "hash",
|
126
110
|
},
|
127
|
-
|
128
|
-
type: "
|
111
|
+
proposer: {
|
112
|
+
type: "address",
|
129
113
|
},
|
130
114
|
transactions: {
|
131
115
|
type: "transactions",
|
@@ -136,18 +120,12 @@ let Serializer = class Serializer {
|
|
136
120
|
};
|
137
121
|
__decorate([
|
138
122
|
inject(Identifiers.Cryptography.Serializer),
|
139
|
-
tagged("type", "wallet"),
|
140
123
|
__metadata("design:type", Object)
|
141
124
|
], Serializer.prototype, "serializer", void 0);
|
142
125
|
__decorate([
|
143
|
-
inject(Identifiers.Cryptography.
|
144
|
-
__metadata("design:type",
|
145
|
-
], Serializer.prototype, "
|
146
|
-
__decorate([
|
147
|
-
inject(Identifiers.Cryptography.Identity.PublicKey.Size),
|
148
|
-
tagged("type", "wallet"),
|
149
|
-
__metadata("design:type", Number)
|
150
|
-
], Serializer.prototype, "generatorPublicKeyByteLength", void 0);
|
126
|
+
inject(Identifiers.Cryptography.Block.HeaderSize),
|
127
|
+
__metadata("design:type", Function)
|
128
|
+
], Serializer.prototype, "headerSize", void 0);
|
151
129
|
Serializer = __decorate([
|
152
130
|
injectable()
|
153
131
|
], Serializer);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAOf,SAAS,CAAC,KAA6C;QAC7D,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,KAA6C;QACzE,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAyC,KAAK,EAAE;YAC/E,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE;YACzB,IAAI,EAAE,CAAC;Y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iBACZ;gBACD,SAAS,EAAE;oBACV,IAAI,EAAE,MAAM;iBACZ;gBACD,iBAAiB,EAAE;oBAClB,IAAI,EAAE,QAAQ;iBACd;gBACD,OAAO,EAAE;oBACR,IAAI,EAAE,QAAQ;iBACd;gBACD,GAAG,EAAE;oBACJ,IAAI,EAAE,SAAS;iBACf;gBACD,MAAM,EAAE;oBACP,IAAI,EAAE,SAAS;iBACf;gBACD,WAAW,EAAE;oBACZ,IAAI,EAAE,QAAQ;iBACd;gBACD,gBAAgB,EAAE;oBACjB,IAAI,EAAE,MAAM;iBACZ;gBACD,QAAQ,EAAE;oBACT,IAAI,EAAE,SAAS;iBACf;gBACD,YAAY,EAAE;oBACb,IAAI,EAAE,cAAc;iBACpB;aACD;SACD,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAjHiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC;;8CACkB;AAG7C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;8CACP;AAL/B,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAmHtB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/crypto-block",
|
3
|
-
"version": "0.0.1-evm.
|
3
|
+
"version": "0.0.1-evm.20",
|
4
4
|
"description": "Block utilities for the Mainsail blockchain",
|
5
5
|
"license": "GPL-3.0-only",
|
6
6
|
"contributors": [],
|
@@ -11,30 +11,31 @@
|
|
11
11
|
"/distribution"
|
12
12
|
],
|
13
13
|
"dependencies": {
|
14
|
-
"ajv": "8.
|
15
|
-
"@mainsail/
|
16
|
-
"@mainsail/crypto-transaction": "0.0.1-evm.
|
17
|
-
"@mainsail/
|
18
|
-
"@mainsail/kernel": "0.0.1-evm.
|
19
|
-
"@mainsail/
|
14
|
+
"ajv": "8.17.1",
|
15
|
+
"@mainsail/container": "0.0.1-evm.20",
|
16
|
+
"@mainsail/crypto-transaction": "0.0.1-evm.20",
|
17
|
+
"@mainsail/contracts": "0.0.1-evm.20",
|
18
|
+
"@mainsail/kernel": "0.0.1-evm.20",
|
19
|
+
"@mainsail/utils": "0.0.1-evm.20"
|
20
20
|
},
|
21
21
|
"devDependencies": {
|
22
|
-
"@types/lodash.clone": "
|
23
|
-
"lodash.
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"@mainsail/crypto-
|
28
|
-
"@mainsail/crypto-
|
29
|
-
"@mainsail/crypto-
|
30
|
-
"@mainsail/crypto-
|
31
|
-
"@mainsail/crypto-
|
32
|
-
"@mainsail/crypto-
|
33
|
-
"@mainsail/crypto-
|
34
|
-
"@mainsail/
|
35
|
-
"@mainsail/
|
36
|
-
"@mainsail/validation": "0.0.1-evm.
|
37
|
-
"@mainsail/serializer": "0.0.1-evm.
|
22
|
+
"@types/lodash.clone": "4.5.9",
|
23
|
+
"@types/lodash.clonedeep": "4.5.9",
|
24
|
+
"lodash.clone": "4.5.0",
|
25
|
+
"lodash.clonedeep": "4.5.0",
|
26
|
+
"uvu": "0.5.6",
|
27
|
+
"@mainsail/crypto-address-keccak256": "0.0.1-evm.20",
|
28
|
+
"@mainsail/crypto-address-base58": "0.0.1-evm.20",
|
29
|
+
"@mainsail/crypto-config": "0.0.1-evm.20",
|
30
|
+
"@mainsail/crypto-consensus-bls12-381": "0.0.1-evm.20",
|
31
|
+
"@mainsail/crypto-key-pair-ecdsa": "0.0.1-evm.20",
|
32
|
+
"@mainsail/crypto-hash-bcrypto": "0.0.1-evm.20",
|
33
|
+
"@mainsail/crypto-signature-ecdsa": "0.0.1-evm.20",
|
34
|
+
"@mainsail/crypto-transaction-evm-call": "0.0.1-evm.20",
|
35
|
+
"@mainsail/crypto-wif": "0.0.1-evm.20",
|
36
|
+
"@mainsail/crypto-validation": "0.0.1-evm.20",
|
37
|
+
"@mainsail/serializer": "0.0.1-evm.20",
|
38
|
+
"@mainsail/validation": "0.0.1-evm.20"
|
38
39
|
},
|
39
40
|
"engines": {
|
40
41
|
"node": ">=20.x"
|
@@ -45,7 +46,7 @@
|
|
45
46
|
"clean": "del distribution",
|
46
47
|
"release": "pnpm publish --access public",
|
47
48
|
"test": "pnpm run uvu source .test.ts",
|
48
|
-
"test:coverage": "c8 pnpm run test",
|
49
|
+
"test:coverage": "c8 -r=text -r=lcov --all pnpm run test",
|
49
50
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
50
51
|
"test:file": "pnpm run uvu source",
|
51
52
|
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"id.factory.d.ts","sourceRoot":"","sources":["../source/id.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAE7D,qBACa,SAAS;IAErB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAG5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAElD,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;CAGhF"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"id.factory.js","sourceRoot":"","sources":["../source/id.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,SAAS,GAAf,MAAM,SAAS;IAOd,KAAK,CAAC,IAAI,CAAC,IAA4C;QAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,CAAC;CACD,CAAA;AARiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;8CACc;AAG3C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;6CACa;AALnD,SAAS;IADrB,UAAU,EAAE;GACA,SAAS,CAUrB"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { Contracts } from "@mainsail/contracts";
|
2
|
-
export declare class Verifier implements Contracts.Crypto.BlockVerifier {
|
3
|
-
private readonly configuration;
|
4
|
-
private readonly serializer;
|
5
|
-
private readonly hashFactory;
|
6
|
-
verify(block: Contracts.Crypto.Block): Promise<Contracts.Crypto.BlockVerification>;
|
7
|
-
}
|
8
|
-
//# sourceMappingURL=verifier.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../source/verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AAGpE,qBACa,QAAS,YAAW,SAAS,CAAC,MAAM,CAAC,aAAa;IAE9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAGhE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAG/D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAE/C,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC;CAsH/F"}
|
package/distribution/verifier.js
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
-
};
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
-
};
|
10
|
-
import { inject, injectable } from "@mainsail/container";
|
11
|
-
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
-
import { BigNumber } from "@mainsail/utils";
|
13
|
-
let Verifier = class Verifier {
|
14
|
-
async verify(block) {
|
15
|
-
const blockData = block.data;
|
16
|
-
const result = {
|
17
|
-
containsMultiSignatures: false,
|
18
|
-
errors: [],
|
19
|
-
verified: false,
|
20
|
-
};
|
21
|
-
try {
|
22
|
-
const constants = this.configuration.getMilestone(blockData.height);
|
23
|
-
if (blockData.height === 0 &&
|
24
|
-
blockData.previousBlock !== "0000000000000000000000000000000000000000000000000000000000000000") {
|
25
|
-
result.errors.push("Genesis block has invalid previous block");
|
26
|
-
}
|
27
|
-
if (blockData.height !== 0 && !blockData.previousBlock) {
|
28
|
-
result.errors.push("Invalid previous block");
|
29
|
-
}
|
30
|
-
if (!blockData.reward.isEqualTo(constants.reward)) {
|
31
|
-
result.errors.push(["Invalid block reward:", blockData.reward, "expected:", constants.reward].join(" "));
|
32
|
-
}
|
33
|
-
if (blockData.version !== constants.block.version) {
|
34
|
-
result.errors.push("Invalid block version");
|
35
|
-
}
|
36
|
-
const headerSize = this.serializer.headerSize();
|
37
|
-
const totalSize = headerSize + block.header.payloadLength;
|
38
|
-
if (totalSize > constants.block.maxPayload) {
|
39
|
-
result.errors.push(`Payload is too large: ${totalSize} > ${constants.block.maxPayload}`);
|
40
|
-
}
|
41
|
-
if (totalSize !== Buffer.byteLength(block.serialized, "hex")) {
|
42
|
-
result.errors.push("Serialized payload size mismatch");
|
43
|
-
}
|
44
|
-
if (blockData.totalGasUsed > constants.block.maxGasLimit && blockData.height > 0) {
|
45
|
-
result.errors.push(`Total gas used ${blockData.totalGasUsed} exceeds max gas limit ${constants.block.maxGasLimit}`);
|
46
|
-
}
|
47
|
-
if (block.transactions.length !== blockData.numberOfTransactions) {
|
48
|
-
result.errors.push("Invalid number of transactions");
|
49
|
-
}
|
50
|
-
if (block.transactions.length > constants.block.maxTransactions && blockData.height > 0) {
|
51
|
-
result.errors.push("Transactions length is too high");
|
52
|
-
}
|
53
|
-
// Checking if transactions of the block adds up to block values.
|
54
|
-
const appliedTransactions = {};
|
55
|
-
let totalAmount = BigNumber.ZERO;
|
56
|
-
let totalFee = BigNumber.ZERO;
|
57
|
-
// The initial payload length takes the overhead for each serialized transaction into account
|
58
|
-
// which is a uint16 per transaction to store the individual length.
|
59
|
-
let totalPayloadLength = block.transactions.length * 2;
|
60
|
-
const payloadBuffers = [];
|
61
|
-
for (const transaction of block.transactions) {
|
62
|
-
if (!transaction || !transaction.id) {
|
63
|
-
throw new Error();
|
64
|
-
}
|
65
|
-
const bytes = Buffer.from(transaction.id, "hex");
|
66
|
-
if (appliedTransactions[transaction.id]) {
|
67
|
-
result.errors.push(`Encountered duplicate transaction: ${transaction.id}`);
|
68
|
-
}
|
69
|
-
if (transaction.data.expiration &&
|
70
|
-
transaction.data.expiration > 0 &&
|
71
|
-
transaction.data.expiration <= blockData.height) {
|
72
|
-
result.errors.push(`Encountered expired transaction: ${transaction.id}`);
|
73
|
-
}
|
74
|
-
appliedTransactions[transaction.id] = transaction.data;
|
75
|
-
totalAmount = totalAmount.plus(transaction.data.amount);
|
76
|
-
totalFee = totalFee.plus(transaction.data.fee);
|
77
|
-
totalPayloadLength += transaction.serialized.byteLength;
|
78
|
-
payloadBuffers.push(bytes);
|
79
|
-
}
|
80
|
-
if (!totalAmount.isEqualTo(blockData.totalAmount)) {
|
81
|
-
result.errors.push("Invalid total amount");
|
82
|
-
}
|
83
|
-
if (!totalFee.isEqualTo(blockData.totalFee)) {
|
84
|
-
result.errors.push("Invalid total fee");
|
85
|
-
}
|
86
|
-
if (totalPayloadLength !== blockData.payloadLength) {
|
87
|
-
result.errors.push("Invalid payload length");
|
88
|
-
}
|
89
|
-
if ((await this.hashFactory.sha256(payloadBuffers)).toString("hex") !== blockData.payloadHash) {
|
90
|
-
result.errors.push("Invalid payload hash");
|
91
|
-
}
|
92
|
-
}
|
93
|
-
catch (error) {
|
94
|
-
result.errors.push(error);
|
95
|
-
}
|
96
|
-
result.verified = result.errors.length === 0;
|
97
|
-
return result;
|
98
|
-
}
|
99
|
-
};
|
100
|
-
__decorate([
|
101
|
-
inject(Identifiers.Cryptography.Configuration),
|
102
|
-
__metadata("design:type", Object)
|
103
|
-
], Verifier.prototype, "configuration", void 0);
|
104
|
-
__decorate([
|
105
|
-
inject(Identifiers.Cryptography.Block.Serializer),
|
106
|
-
__metadata("design:type", Object)
|
107
|
-
], Verifier.prototype, "serializer", void 0);
|
108
|
-
__decorate([
|
109
|
-
inject(Identifiers.Cryptography.Hash.Factory),
|
110
|
-
__metadata("design:type", Object)
|
111
|
-
], Verifier.prototype, "hashFactory", void 0);
|
112
|
-
Verifier = __decorate([
|
113
|
-
injectable()
|
114
|
-
], Verifier);
|
115
|
-
export { Verifier };
|
116
|
-
//# sourceMappingURL=verifier.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../source/verifier.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAUb,KAAK,CAAC,MAAM,CAAC,KAA6B;QAChD,MAAM,SAAS,GAA+B,KAAK,CAAC,IAAI,CAAC;QACzD,MAAM,MAAM,GAAsD;YACjE,uBAAuB,EAAE,KA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