diff --git a/README.md b/README.md index e28aeeaf9..e30a82cca 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,21 @@ yarn test yarn bootstrap-stop ``` +## Testnet + +Another alternative, is having bootstrap creating a Testnet node without rest that you can run from code: + +``` +yarn bootstrap-start-testnet +``` + +In another terminal + +``` +yarn start:dev +``` + + ## Usage Please refer to the [documentation](https://nemtech.github.io/api.html) for more information. diff --git a/catapult-sdk/src/model/ModelSchemaBuilder.js b/catapult-sdk/src/model/ModelSchemaBuilder.js index e8d24eeb9..fd92cc34f 100644 --- a/catapult-sdk/src/model/ModelSchemaBuilder.js +++ b/catapult-sdk/src/model/ModelSchemaBuilder.js @@ -103,6 +103,7 @@ class ModelSchemaBuilder { messageGroups: { type: ModelType.array, schemaName: 'messageGroup' } }, messageGroup: { + signatureSchema: ModelType.uint16, stage: ModelType.uint32, height: ModelType.uint64, hashes: { type: ModelType.array, schemaName: ModelType.binary }, @@ -110,7 +111,6 @@ class ModelSchemaBuilder { }, bmTreeSignature: { root: { type: ModelType.object, schemaName: 'parentPublicKeySignaturePair' }, - top: { type: ModelType.object, schemaName: 'parentPublicKeySignaturePair' }, bottom: { type: ModelType.object, schemaName: 'parentPublicKeySignaturePair' } }, parentPublicKeySignaturePair: { diff --git a/catapult-sdk/test/model/ModelSchemaBuilder_spec.js b/catapult-sdk/test/model/ModelSchemaBuilder_spec.js index 3901b5fc7..c0abc8b98 100644 --- a/catapult-sdk/test/model/ModelSchemaBuilder_spec.js +++ b/catapult-sdk/test/model/ModelSchemaBuilder_spec.js @@ -163,7 +163,6 @@ describe('model schema builder', () => { 'blockHeaderWithMetadata.block', 'bmTreeSignature.root', - 'bmTreeSignature.top', 'bmTreeSignature.bottom', 'transactionWithMetadata.meta', diff --git a/rest/bootstrap-preset-testnet.yml b/rest/bootstrap-preset-testnet.yml new file mode 100644 index 000000000..37bfeb937 --- /dev/null +++ b/rest/bootstrap-preset-testnet.yml @@ -0,0 +1,20 @@ +#nodeEqualityStrategy: public-key +logLevel: 'Debug' +throttlingBurst: 35 +throttlingRate: 1000 +databases: + - name: db + openPort: true +nodes: + - trustedHosts: '127.0.0.1, 172.20.0.25, 172.20.0.1' + localNetworks: '127.0.0.1, 172.20.0.25, 172.20.0.1' + openPort: true + brokerOpenPort: 7902 +gateways: + - excludeDockerService: true + name: rest + apiNodeConfigPath: target/gateways/rest/api-node-config + restLoggingFilename: target/rest.log + databaseHost: localhost + apiNodeHost: localhost + diff --git a/rest/bootstrap-preset.yml b/rest/bootstrap-preset.yml index c28f70781..3778c583e 100644 --- a/rest/bootstrap-preset.yml +++ b/rest/bootstrap-preset.yml @@ -2,6 +2,9 @@ logLevel: 'Debug' throttlingBurst: 35 throttlingRate: 1000 +#votingKeyLinkV2: 360000 +#importanceBlock: 360000 +#accountRestrictionsV2: 360000 nodes: - repeat: 0 - trustedHosts: '127.0.0.1, 172.20.0.25, 172.20.0.1' diff --git a/rest/package.json b/rest/package.json index 47111ab00..f0951b6df 100644 --- a/rest/package.json +++ b/rest/package.json @@ -19,6 +19,7 @@ "lint:jenkins": "eslint -o tests.catapult.lint.xml -f junit src test || exit 0", "bootstrap-clean": "symbol-bootstrap clean", "bootstrap-start": "symbol-bootstrap start -a light -c bootstrap-preset.yml --healthCheck", + "bootstrap-start-testnet": "symbol-bootstrap start -p testnet -a dual -c bootstrap-preset-testnet.yml --healthCheck", "bootstrap-start-detached": "symbol-bootstrap start -a light -c bootstrap-preset.yml --detached --healthCheck", "bootstrap-stop": "symbol-bootstrap stop", "bootstrap-run": "symbol-bootstrap run", @@ -46,7 +47,7 @@ "nodemon": "^2.0.6", "rimraf": "^2.6.3", "sinon": "^7.3.2", - "symbol-bootstrap": "0.3.0-alpha-202011301515" + "symbol-bootstrap": "0.3.0-alpha-202012011317" }, "dependencies": { "catapult-sdk": "link:../catapult-sdk", diff --git a/rest/src/sockets/finalizationProofCodec.js b/rest/src/sockets/finalizationProofCodec.js index 44ecc2bc5..fc0924805 100644 --- a/rest/src/sockets/finalizationProofCodec.js +++ b/rest/src/sockets/finalizationProofCodec.js @@ -52,8 +52,9 @@ const finalizationProofCodec = { while (0 !== sizeLeft) { const messageGroupSize = parser.uint32(); const hashCount = parser.uint32(); - const signatureCount = parser.uint32(); + const signatureCount = parser.uint16(); const messageGroup = { + signatureSchema: parser.uint16(), stage: parser.uint32(), height: parser.uint64(), hashes: [], @@ -62,17 +63,12 @@ const finalizationProofCodec = { for (let i = 0; i < hashCount; i++) messageGroup.hashes.push(parser.buffer(sizes.hash256)); - for (let i = 0; i < signatureCount; i++) { const signature = { root: { parentPublicKey: parser.buffer(sizes.signerPublicKey), signature: parser.buffer(sizes.signature) }, - top: { - parentPublicKey: parser.buffer(sizes.signerPublicKey), - signature: parser.buffer(sizes.signature) - }, bottom: { parentPublicKey: parser.buffer(sizes.signerPublicKey), signature: parser.buffer(sizes.signature) @@ -80,7 +76,6 @@ const finalizationProofCodec = { }; messageGroup.signatures.push(signature); } - proof.messageGroups.push(messageGroup); sizeLeft -= messageGroupSize; } diff --git a/rest/test/sockets/finalizationProofCodec_spec.js b/rest/test/sockets/finalizationProofCodec_spec.js index 7a1c9302f..4b3f1b2ac 100644 --- a/rest/test/sockets/finalizationProofCodec_spec.js +++ b/rest/test/sockets/finalizationProofCodec_spec.js @@ -49,14 +49,11 @@ describe('deserialize', () => { const createSignature = () => { const rootParentPublicKey = testPublicKey; const rootSignature = testInnerSignature; - const topParentPublicKey = testPublicKey; - const topSignature = testInnerSignature; const bottomParentPublicKey = testPublicKey; const bottomSignature = testInnerSignature; const signature = [ rootParentPublicKey, rootSignature, - topParentPublicKey, topSignature, bottomParentPublicKey, bottomSignature ]; @@ -66,12 +63,14 @@ describe('deserialize', () => { const createMessageGroup = (hashCount, signatureCount) => { const messageGroupSize = Buffer.from([0x00, 0x00, 0x00, 0x00]); // 4b const messageGrouphashCount = Buffer.from([0x00, 0x00, 0x00, 0x00]); // 4b - const messageGroupsignatureCount = Buffer.from([0x00, 0x00, 0x00, 0x00]); // 4b + const messageGroupsignatureCount = Buffer.from([0x00, 0x00]); // 2b + const messageGroupsignatureSchema = Buffer.from([0x01, 0x00]); // 2b const messageGroupStage = Buffer.from([0x01, 0x00, 0x00, 0x00]); // 4b const messageGroupHeight = Buffer.from([0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); // 8b const messageGroup = [ - messageGroupSize, messageGrouphashCount, messageGroupsignatureCount, messageGroupStage, messageGroupHeight + messageGroupSize, messageGrouphashCount, messageGroupsignatureCount, + messageGroupsignatureSchema, messageGroupStage, messageGroupHeight ]; for (let i = 0; i < hashCount; ++i) @@ -83,7 +82,7 @@ describe('deserialize', () => { const messageGroupBuffer = Buffer.concat(messageGroup); messageGroupBuffer.writeInt32LE(messageGroupBuffer.length, 0); messageGroupBuffer.writeInt32LE(hashCount, 4); - messageGroupBuffer.writeInt32LE(signatureCount, 8); + messageGroupBuffer.writeInt16LE(signatureCount, 8); return messageGroupBuffer; }; @@ -102,10 +101,6 @@ describe('deserialize', () => { parentPublicKey: testPublicKey, signature: testInnerSignature }, - top: { - parentPublicKey: testPublicKey, - signature: testInnerSignature - }, bottom: { parentPublicKey: testPublicKey, signature: testInnerSignature @@ -121,6 +116,7 @@ describe('deserialize', () => { for (let i = 0; i < messageGroupsCount; ++i) { finalizationProof.push(createMessageGroup(hashCount, signatureCount)); expectedMessageGroups.push({ + signatureSchema: 1, stage: 1, height: [1, 0], hashes: expectedHashes, diff --git a/rest/yarn.lock b/rest/yarn.lock index 3445b3068..a351c7c37 100644 --- a/rest/yarn.lock +++ b/rest/yarn.lock @@ -5900,10 +5900,10 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -symbol-bootstrap@0.3.0-alpha-202011301515: - version "0.3.0-alpha-202011301515" - resolved "https://registry.yarnpkg.com/symbol-bootstrap/-/symbol-bootstrap-0.3.0-alpha-202011301515.tgz#737c6b9556afba4f087d6ac5ba6bbabbd4922a0f" - integrity sha512-FBWXSrMrQE3BOUmIYMgVCI+RLlwVg6eh5aJ+HHhKNuuts+Glpid9xE12J+MxDLEzFEx9N/qvUVT/tLx2fO9+vQ== +symbol-bootstrap@0.3.0-alpha-202012011317: + version "0.3.0-alpha-202012011317" + resolved "https://registry.yarnpkg.com/symbol-bootstrap/-/symbol-bootstrap-0.3.0-alpha-202012011317.tgz#3a04060cf09b78a3b31818f8e44761c252ef1c41" + integrity sha512-nLYQy+3VpyTi6wgq7Hrtg1JXXD+olZ4u+/tlYHwnjq/mpTyfVQAeWKJWq9z5buyPvuZQdUgcxG5IRytWx/uaSg== dependencies: "@oclif/command" "^1.7.0" "@oclif/config" "^1.16.0"