Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
State version (#536)
Browse files Browse the repository at this point in the history
* Added version to states

* Updated bootstrap
  • Loading branch information
fboucquez authored Nov 30, 2020
1 parent 905ed34 commit 998c75d
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 21 deletions.
1 change: 1 addition & 0 deletions catapult-sdk/src/model/ModelSchemaBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class ModelSchemaBuilder {
account: { type: ModelType.object, schemaName: 'account' }
},
account: {
version: ModelType.uint16,
address: ModelType.binary,
addressHeight: ModelType.uint64,
publicKey: ModelType.binary,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/lockHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const lockHashPlugin = {
lock: { type: ModelType.object, schemaName: 'hashLockInfo.lock' }
});
builder.addSchema('hashLockInfo.lock', {
version: ModelType.uint16,
ownerAddress: ModelType.binary,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/lockSecret.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const lockSecretPlugin = {
lock: { type: ModelType.object, schemaName: 'secretLockInfo.lock' }
});
builder.addSchema('secretLockInfo.lock', {
version: ModelType.uint16,
ownerAddress: ModelType.binary,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const metadataPlugin = {
});

builder.addSchema('metadataEntry', {
version: ModelType.uint16,
compositeHash: ModelType.binary,
sourceAddress: ModelType.binary,
targetAddress: ModelType.binary,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/mosaic.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const mosaicPlugin = {
});

builder.addSchema('mosaicDescriptor.mosaic', {
version: ModelType.uint16,
id: ModelType.uint64HexIdentifier,
supply: ModelType.uint64,
startHeight: ModelType.uint64,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/multisig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const multisigPlugin = {
multisig: { type: ModelType.object, schemaName: 'multisigEntry.multisig' }
});
builder.addSchema('multisigEntry.multisig', {
version: ModelType.uint16,
accountAddress: ModelType.binary,
minApproval: ModelType.int,
minRemoval: ModelType.int,
Expand Down
1 change: 1 addition & 0 deletions catapult-sdk/src/plugins/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const namespacePlugin = {
});

builder.addSchema('namespaceDescriptor.namespace', {
version: ModelType.uint16,
registrationType: ModelType.uint8,
depth: ModelType.uint8,
level0: ModelType.uint64HexIdentifier,
Expand Down
2 changes: 2 additions & 0 deletions catapult-sdk/src/plugins/restrictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const restrictionsPlugin = {
accountRestrictions: { type: ModelType.object, schemaName: 'accountRestriction.restrictions' }
});
builder.addSchema('accountRestriction.restrictions', {
version: ModelType.uint16,
address: ModelType.binary,
restrictions: {
type: ModelType.array,
Expand Down Expand Up @@ -169,6 +170,7 @@ const restrictionsPlugin = {
mosaicRestrictionEntry: { type: ModelType.object, schemaName: 'mosaicRestrictions.entry' }
});
builder.addSchema('mosaicRestrictions.entry', {
version: ModelType.uint16,
compositeHash: ModelType.binary,
entryType: ModelType.uint32,
mosaicId: ModelType.uint64HexIdentifier,
Expand Down
4 changes: 2 additions & 2 deletions catapult-sdk/test/plugins/lockHash_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ describe('lock hash plugin', () => {

// - hash lock infos
assertSchema(modelSchema.hashLockInfo, 2, 'id', 'lock');
assertSchema(modelSchema['hashLockInfo.lock'], 6,
'ownerAddress', 'mosaicId', 'amount', 'endHeight', 'status', 'hash');
assertSchema(modelSchema['hashLockInfo.lock'], 7,
'version', 'ownerAddress', 'mosaicId', 'amount', 'endHeight', 'status', 'hash');

// - hash lock transaction
const transactionSchemaSize = Object.keys(modelSchema.transaction).length;
Expand Down
4 changes: 2 additions & 2 deletions catapult-sdk/test/plugins/lockSecret_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('lock secret plugin', () => {
assertSchema(modelSchema.secretLockInfo, 2, 'id', 'lock');

// - secret lock infos
assertSchema(modelSchema['secretLockInfo.lock'], 9,
'ownerAddress', 'mosaicId', 'amount', 'endHeight', 'secret',
assertSchema(modelSchema['secretLockInfo.lock'], 10,
'version', 'ownerAddress', 'mosaicId', 'amount', 'endHeight', 'secret',
'status', 'hashAlgorithm', 'recipientAddress', 'compositeHash');

// - secret lock transactions
Expand Down
3 changes: 2 additions & 1 deletion catapult-sdk/test/plugins/metadata_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ describe('metadata plugin', () => {
expect(modelSchema.metadata).to.contain.all.keys(['metadataEntry', 'id']);

// - metadataEntry
expect(Object.keys(modelSchema.metadataEntry).length).to.equal(8);
expect(Object.keys(modelSchema.metadataEntry).length).to.equal(9);
expect(modelSchema.metadataEntry).to.contain.all.keys([
'version',
'compositeHash',
'sourceAddress',
'targetAddress',
Expand Down
4 changes: 2 additions & 2 deletions catapult-sdk/test/plugins/mosaic_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ describe('mosaic plugin', () => {
expect(modelSchema.mosaicDescriptor).to.contain.all.keys(['id', 'mosaic']);

// - mosaic descriptor mosaic
expect(Object.keys(modelSchema['mosaicDescriptor.mosaic']).length).to.equal(8);
expect(Object.keys(modelSchema['mosaicDescriptor.mosaic']).length).to.equal(9);
expect(modelSchema['mosaicDescriptor.mosaic']).to.contain.all.keys([
'id', 'supply', 'startHeight', 'ownerAddress', 'revision', 'flags', 'divisibility', 'duration'
'version', 'id', 'supply', 'startHeight', 'ownerAddress', 'revision', 'flags', 'divisibility', 'duration'
]);
});
});
Expand Down
5 changes: 3 additions & 2 deletions catapult-sdk/test/plugins/multisig_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ describe('multisig plugin', () => {
expect(Object.keys(modelSchema.multisigEntry).length).to.equal(1);
expect(modelSchema.multisigEntry).to.contain.all.keys(['multisig']);

expect(Object.keys(modelSchema['multisigEntry.multisig']).length).to.equal(5);
expect(Object.keys(modelSchema['multisigEntry.multisig']).length).to.equal(6);
expect(modelSchema['multisigEntry.multisig'])
.to.contain.all.keys(['accountAddress', 'minApproval', 'minRemoval', 'multisigAddresses', 'cosignatoryAddresses']);
.to.contain.all.keys(['version', 'accountAddress', 'minApproval',
'minRemoval', 'multisigAddresses', 'cosignatoryAddresses']);

// - multisig graph
expect(Object.keys(modelSchema.multisigGraph).length).to.equal(2);
Expand Down
5 changes: 3 additions & 2 deletions catapult-sdk/test/plugins/namespace_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ describe('namespace plugin', () => {
expect(modelSchema['namespaceDescriptor.meta']).to.contain.all.keys(['active', 'index']);

// - namespaceDescriptor.namespace
expect(Object.keys(modelSchema['namespaceDescriptor.namespace']).length).to.equal(10);
expect(Object.keys(modelSchema['namespaceDescriptor.namespace']).length).to.equal(11);
expect(modelSchema['namespaceDescriptor.namespace']).to.contain.all.keys([
'registrationType', 'depth', 'level0', 'level1', 'level2', 'alias', 'parentId', 'ownerAddress', 'startHeight', 'endHeight'
'version', 'registrationType', 'depth', 'level0', 'level1', 'level2',
'alias', 'parentId', 'ownerAddress', 'startHeight', 'endHeight'
]);

// - namespaceDescriptor.alias.mosaic
Expand Down
10 changes: 5 additions & 5 deletions catapult-sdk/test/plugins/restrictions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('restrictions plugin', () => {
// - accountRestrictionAddress
expect(Object.keys(modelSchema.accountRestrictionAddress).length).to.equal(Object.keys(modelSchema.transaction).length + 3);
expect(modelSchema.accountRestrictionAddress).to.contain.all.keys([
'restrictionFlags', 'restrictionAdditions', 'restrictionDeletions'
'version', 'restrictionFlags', 'restrictionAdditions', 'restrictionDeletions'
]);

// - accountRestrictionMosaic
Expand All @@ -96,8 +96,8 @@ describe('restrictions plugin', () => {
expect(modelSchema.accountRestrictions).to.contain.all.keys(['accountRestrictions']);

// - accountRestriction.restrictions
expect(Object.keys(modelSchema['accountRestriction.restrictions']).length).to.equal(2);
expect(modelSchema['accountRestriction.restrictions']).to.contain.all.keys(['address', 'restrictions']);
expect(Object.keys(modelSchema['accountRestriction.restrictions']).length).to.equal(3);
expect(modelSchema['accountRestriction.restrictions']).to.contain.all.keys(['version', 'address', 'restrictions']);

// - accountRestriction address, mosaic, and operation restrictions
accountRestrictionSchemas.forEach(schema => {
Expand Down Expand Up @@ -155,9 +155,9 @@ describe('restrictions plugin', () => {
expect(modelSchema.mosaicRestrictions).to.contain.all.keys(['id', 'mosaicRestrictionEntry']);

// - mosaicRestriction.entry
expect(Object.keys(modelSchema['mosaicRestrictions.entry']).length).to.equal(5);
expect(Object.keys(modelSchema['mosaicRestrictions.entry']).length).to.equal(6);
expect(modelSchema['mosaicRestrictions.entry']).to.contain.all.keys([
'compositeHash', 'entryType', 'mosaicId', 'targetAddress', 'restrictions'
'version', 'compositeHash', 'entryType', 'mosaicId', 'targetAddress', 'restrictions'
]);

// - mosaicRestrictions.entry.restrictions
Expand Down
2 changes: 1 addition & 1 deletion rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"nodemon": "^2.0.6",
"rimraf": "^2.6.3",
"sinon": "^7.3.2",
"symbol-bootstrap": "0.3.0-alpha-202011220136"
"symbol-bootstrap": "0.3.0-alpha-202011301515"
},
"dependencies": {
"catapult-sdk": "link:../catapult-sdk",
Expand Down
8 changes: 4 additions & 4 deletions rest/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5900,10 +5900,10 @@ supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"

[email protected]202011220136:
version "0.3.0-alpha-202011220136"
resolved "https://registry.yarnpkg.com/symbol-bootstrap/-/symbol-bootstrap-0.3.0-alpha-202011220136.tgz#a0cb7bc42f325aafaf5409ec7cb6d28c55c97dc8"
integrity sha512-XBmpAlZzMezqogoN7xpsqSNrO6qX3fwTg9d+Sfj73f6yBUb9gjsltuzoECAIvaOoNQyb9577+BBL/6SUWvGRHA==
[email protected]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==
dependencies:
"@oclif/command" "^1.7.0"
"@oclif/config" "^1.16.0"
Expand Down

0 comments on commit 998c75d

Please sign in to comment.