Skip to content

Commit

Permalink
Re track catapult-server main (#745)
Browse files Browse the repository at this point in the history
* Re track catapult-server main

* - Added minFeeMultipler
- Updated version
- Updated change log

* privatetest network update
  • Loading branch information
rg911 authored Jan 14, 2021
1 parent 1693f2e commit c1464c0
Show file tree
Hide file tree
Showing 72 changed files with 360 additions and 922 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.

The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.23.0] - 14-Jan-2021

**Milestone**: Catapult-server main(0.10.0.5)
Package | Version | Link
---|---|---
SDK Core| v0.23.0 | [symbol-sdk](https://www.npmjs.com/package/symbol-sdk)
Catbuffer | v0.1.1 | [catbuffer-typescript](https://www.npmjs.com/package/catbuffer-typescript)
Client Library | v0.11.1 | [symbol-openapi-typescript-fetch-client](https://www.npmjs.com/package/symbol-openapi-typescript-fetch-client)

- **Re track to catapult-server main branch**
- **All entity versions reset to v1 for Symbol mainnet release**
- **[BREAKING CHANGE]** Finalization proof modle removed `messageGroup.schemaVersion` and `BMTreeSignaure.top`
- **[BREAKING CHANGE]** Removed `VotingKeyLinkV1Transaction`.
- **[BREAKING CHANGE]** `PrivateTest` network type changed from `0x80` to `0xA8`.
- Added **Node** specific property: `minFeeMultipler` in transactionFees.
- Removed padding buffer in account state serialization.
- Voting key length set to 32 bytes.

## [0.22.2] - 12-Dec-2020

**Milestone**: Catapult-server finality(0.10.0.4)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ The Symbol SDK for TypeScript / JavaScript allows you to develop web, mobile, an

## Important Notes

### _Catapult-Server_ Network Compatibility ([email protected].1)
### _Catapult-Server_ Network Compatibility ([email protected].4)

Due to a network upgrade with [catapult-server](https://github.com/nemtech/catapult-server/releases/tag/v0.10.0.1) version, **it is recommended to use this package's 0.21.0 version and upwards to use this package with Fushicho versioned networks**.
Due to a network upgrade with [catapult-server](https://github.com/nemtech/catapult-server/releases/tag/v0.10.0.4) version, **it is recommended to use this package's 0.23.0 version and upwards to use this package with Fushicho versioned networks**.

The upgrade to this package's [version v0.21.0](https://github.com/nemtech/symbol-sdk-typescript-javascript/releases/tag/v0.21.0) is mandatory for the latest **_Catapult-Server_ compatibility**.
The upgrade to this package's [version v0.23.0](https://github.com/nemtech/symbol-sdk-typescript-javascript/releases/tag/v0.23.0) is mandatory for the latest **_Catapult-Server_ compatibility**.

Find the complete release notes [here](CHANGELOG.md).

Expand Down
30 changes: 3 additions & 27 deletions e2e/infrastructure/TransactionHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
TransactionStatusRepository,
} from '../../src/infrastructure';
import { TransactionPaginationStreamer } from '../../src/infrastructure/paginationStreamer';
import { TransactionVersion, UInt64, VotingKeyLinkV1Transaction } from '../../src/model';
import { TransactionVersion, UInt64 } from '../../src/model';
import { Account } from '../../src/model/account';
import { LockHashAlgorithm } from '../../src/model/lock';
import { PlainMessage } from '../../src/model/message';
Expand Down Expand Up @@ -737,7 +737,7 @@ describe('TransactionHttp', () => {
300,
LinkAction.Link,
networkType,
TransactionVersion.VOTING_KEY_LINK_V2,
TransactionVersion.VOTING_KEY_LINK,
helper.maxFee,
);
const signedTransaction = votingLinkTransaction.signWith(account, generationHash);
Expand All @@ -753,30 +753,6 @@ describe('TransactionHttp', () => {
});
});

describe('VotingKeyLinkV1Transaction', () => {
it('standalone', () => {
const votingLinkTransaction = VotingKeyLinkV1Transaction.create(
Deadline.create(helper.epochAdjustment),
votingKeyV1,
100,
300,
LinkAction.Link,
networkType,
helper.maxFee,
);
const signedTransaction = votingLinkTransaction.signWith(account, generationHash);

console.log(signedTransaction.payload);

return helper.announce(signedTransaction).then((transaction: VotingKeyLinkV1Transaction) => {
expect(transaction.linkedPublicKey, 'LinkedPublicKey').not.to.be.undefined;
expect(transaction.startEpoch, 'startEpoch').not.to.be.undefined;
expect(transaction.endEpoch, 'endEpoch').not.to.be.undefined;
expect(transaction.linkAction, 'LinkAction').not.to.be.undefined;
return signedTransaction;
});
});
});
describe('VotingKeyLinkTransaction', () => {
it('aggregate', () => {
const votingLinkTransaction = VotingKeyLinkTransaction.create(
Expand All @@ -786,7 +762,7 @@ describe('TransactionHttp', () => {
300,
LinkAction.Unlink,
networkType,
TransactionVersion.VOTING_KEY_LINK_V2,
TransactionVersion.VOTING_KEY_LINK,
helper.maxFee,
);
const aggregateTransaction = AggregateTransaction.createComplete(
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "symbol-sdk",
"version": "0.22.3",
"version": "0.23.0",
"description": "Reactive symbol sdk for typescript and javascript",
"scripts": {
"pretest": "npm run build",
Expand Down Expand Up @@ -99,7 +99,7 @@
"dependencies": {
"@js-joda/core": "^3.2.0",
"bluebird": "^3.7.2",
"catbuffer-typescript": "0.0.25",
"catbuffer-typescript": "0.1.1",
"crypto-js": "^4.0.0",
"diff": "^4.0.2",
"futoin-hkdf": "^1.3.2",
Expand All @@ -113,7 +113,7 @@
"ripemd160": "^2.0.2",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.6.3",
"symbol-openapi-typescript-fetch-client": "0.10.5-1",
"symbol-openapi-typescript-fetch-client": "0.11.1",
"tweetnacl": "^1.0.3",
"ws": "^7.3.1"
},
Expand Down
2 changes: 0 additions & 2 deletions src/infrastructure/FinalizationHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ export class FinalizationHttp extends Http implements FinalizationRepository {
new BmTreeSignature(
new ParentPublicKeySignaturePair(s.root.parentPublicKey, s.root.signature),
new ParentPublicKeySignaturePair(s.bottom.parentPublicKey, s.bottom.signature),
s.top ? new ParentPublicKeySignaturePair(s.top.parentPublicKey, s.top.signature) : undefined,
),
),
mg.signatureSchema,
),
),
);
Expand Down
1 change: 1 addition & 0 deletions src/infrastructure/NetworkHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class NetworkHttp extends Http implements NetworkRepository {
body.medianFeeMultiplier,
body.highestFeeMultiplier,
body.lowestFeeMultiplier,
body.minFeeMultiplier,
),
);
}
Expand Down
20 changes: 2 additions & 18 deletions src/infrastructure/transaction/CreateTransactionFromDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import { Convert as convert } from '../../core/format';
import { UnresolvedMapping } from '../../core/utils';
import { MessageFactory, TransactionVersion, UInt64, VotingKeyLinkV1Transaction } from '../../model';
import { MessageFactory, TransactionVersion, UInt64 } from '../../model';
import { Address, PublicAccount } from '../../model/account';
import { Mosaic, MosaicFlags, MosaicId, MosaicNonce } from '../../model/mosaic';
import { NamespaceId } from '../../model/namespace';
Expand Down Expand Up @@ -473,7 +473,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo, isE
: undefined,
transactionInfo,
).setPayloadSize(transactionDTO.size);
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V2) {
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK) {
return new VotingKeyLinkTransaction(
transactionDTO.network,
version,
Expand All @@ -489,22 +489,6 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo, isE
: undefined,
transactionInfo,
).setPayloadSize(transactionDTO.size);
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V1) {
return new VotingKeyLinkV1Transaction(
transactionDTO.network,
version,
deadline,
maxFee,
transactionDTO.linkedPublicKey,
transactionDTO.startEpoch,
transactionDTO.endEpoch,
transactionDTO.linkAction,
signature,
transactionDTO.signerPublicKey
? PublicAccount.createFromPublicKey(transactionDTO.signerPublicKey, transactionDTO.network)
: undefined,
transactionInfo,
).setPayloadSize(transactionDTO.size);
}
throw new Error(`Unimplemented transaction with type ${type} for version ${version}`);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
TransactionVersion,
TransferTransaction,
VotingKeyLinkTransaction,
VotingKeyLinkV1Transaction,
VrfKeyLinkTransaction,
} from '../../model/transaction';

Expand Down Expand Up @@ -102,9 +101,7 @@ export const CreateTransactionFromPayload = (payload: string, isEmbedded = false
return VrfKeyLinkTransaction.createFromPayload(payload, isEmbedded);
} else if (type === TransactionType.NODE_KEY_LINK) {
return NodeKeyLinkTransaction.createFromPayload(payload, isEmbedded);
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V1) {
return VotingKeyLinkV1Transaction.createFromPayload(payload, isEmbedded);
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V2) {
} else if (type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK) {
return VotingKeyLinkTransaction.createFromPayload(payload, isEmbedded);
} else if (type === TransactionType.AGGREGATE_COMPLETE || type === TransactionType.AGGREGATE_BONDED) {
return AggregateTransaction.createFromPayload(payload);
Expand Down
11 changes: 1 addition & 10 deletions src/infrastructure/transaction/SerializeTransactionToJSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
TransactionVersion,
TransferTransaction,
VotingKeyLinkTransaction,
VotingKeyLinkV1Transaction,
VrfKeyLinkTransaction,
} from '../../model/transaction';

Expand Down Expand Up @@ -273,22 +272,14 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
linkedPublicKey: nodeKeyLinkTx.linkedPublicKey,
linkAction: nodeKeyLinkTx.linkAction,
};
} else if (transaction.type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V2) {
} else if (transaction.type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK) {
const votingKeyLinkTx = transaction as VotingKeyLinkTransaction;
return {
linkedPublicKey: votingKeyLinkTx.linkedPublicKey,
startEpoch: votingKeyLinkTx.startEpoch,
endEpoch: votingKeyLinkTx.endEpoch,
linkAction: votingKeyLinkTx.linkAction,
};
} else if (transaction.type === TransactionType.VOTING_KEY_LINK && version == TransactionVersion.VOTING_KEY_LINK_V1) {
const votingKeyLinkTx = transaction as VotingKeyLinkV1Transaction;
return {
linkedPublicKey: votingKeyLinkTx.linkedPublicKey,
startEpoch: votingKeyLinkTx.startEpoch,
endEpoch: votingKeyLinkTx.endEpoch,
linkAction: votingKeyLinkTx.linkAction,
};
} else {
throw new Error(`Transaction type ${transaction.type} not implemented yet for version ${version}.`);
}
Expand Down
3 changes: 1 addition & 2 deletions src/model/account/AccountInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
PinnedVotingKeyBuilder,
VotingKeyDto,
} from 'catbuffer-typescript';
import { VotingKeyPaddingDto } from 'catbuffer-typescript/dist/VotingKeyPaddingDto';
import { Convert } from '../../core/format';
import { Mosaic, MosaicId } from '../mosaic';
import { UInt64 } from '../UInt64';
Expand Down Expand Up @@ -183,7 +182,7 @@ export class AccountInfo {
const votingKeyDto = new VotingKeyDto(Convert.hexToUint8(key.publicKey).slice(0, 32));
const startEpoch: FinalizationEpochDto = new FinalizationEpochDto(key.startEpoch);
const endEpoch: FinalizationEpochDto = new FinalizationEpochDto(key.endEpoch);
return new PinnedVotingKeyBuilder(votingKeyDto, new VotingKeyPaddingDto(new Uint8Array(16)), startEpoch, endEpoch);
return new PinnedVotingKeyBuilder(votingKeyDto, startEpoch, endEpoch);
}

private static toMosaicBuilder(m: Mosaic): MosaicBuilder {
Expand Down
4 changes: 2 additions & 2 deletions src/model/account/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Address {
networkType = NetworkType.MAIN_NET;
} else if (addressTrimAndUpperCase.charAt(0) === 'P') {
networkType = NetworkType.PRIVATE;
} else if (addressTrimAndUpperCase.charAt(0) === 'Q') {
} else if (addressTrimAndUpperCase.charAt(0) === 'V') {
networkType = NetworkType.PRIVATE_TEST;
} else {
throw new Error('Address Network unsupported');
Expand All @@ -74,7 +74,7 @@ export class Address {

/**
* Determines the validity of an raw address string.
* @param {string} rawAddress The raw address string. Expected format QATNE7Q5BITMUTRRN6IB4I7FLSDRDWZA367I6OQ
* @param {string} rawAddress The raw address string. Expected format VATNE7Q5BITMUTRRN6IB4I7FLSDRDWZA35C4KNQ
* @returns {boolean} true if the raw address string is valid, false otherwise.
*/
public static isValidRawAddress = (rawAddress: string): boolean => {
Expand Down
4 changes: 0 additions & 4 deletions src/model/finalization/BmTreeSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ export class BmTreeSignature {
* Bottom.
*/
public readonly bottom: ParentPublicKeySignaturePair,
/**
* top (for testnet/3 V1 schema only).
*/
public readonly top?: ParentPublicKeySignaturePair,
) {}
}
4 changes: 0 additions & 4 deletions src/model/finalization/MessageGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,5 @@ export class MessageGroup {
* Signatures.
*/
public readonly signatures: BmTreeSignature[],
/**
* Signature schema (optional)
*/
public readonly signatureSchema?: number,
) {}
}
2 changes: 1 addition & 1 deletion src/model/network/NetworkType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ export enum NetworkType {
* Private test net network
* @type {number}
*/
PRIVATE_TEST = 0x80,
PRIVATE_TEST = 0xa8,
}
2 changes: 2 additions & 0 deletions src/model/network/TransactionFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ export class TransactionFees {
* @param medianFeeMultiplier - Median fee multiplier over the last \"numBlocksTransactionFeeStats\".
* @param highestFeeMultiplier - Highest fee multiplier over the last "numBlocksTransactionFeeStats".
* @param lowestFeeMultiplier - Lowest fee multiplier over the last "numBlocksTransactionFeeStats".
* @param minFeeMultiplier - Node specific. Minimal fee multiplier on the current selected node.
*/
constructor(
public readonly averageFeeMultiplier: number,
public readonly medianFeeMultiplier: number,
public readonly highestFeeMultiplier: number,
public readonly lowestFeeMultiplier: number,
public readonly minFeeMultiplier: number,
) {}
}
8 changes: 1 addition & 7 deletions src/model/transaction/TransactionVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,7 @@ export class TransactionVersion {
* Voting key link transaction version.
* @type {number}
*/
public static readonly VOTING_KEY_LINK_V1 = 1;

/**
* Voting key link transaction version.
* @type {number}
*/
public static readonly VOTING_KEY_LINK_V2 = 2;
public static readonly VOTING_KEY_LINK = 1;

/**
* Node key link transaction version.
Expand Down
Loading

0 comments on commit c1464c0

Please sign in to comment.