Skip to content
Permalink
Browse files

Merge pull request #3657 from LiskHQ/merge-release-into-development-2…

…0190517

Merge release into development 20190517
  • Loading branch information...
MaciejBaj committed May 17, 2019
2 parents 7c31c9d + f372278 commit 9f60bbe118343b538cb75e32caa4e33aec1c74c3
Showing with 4,563 additions and 16,358 deletions.
  1. +1 βˆ’1 commander/package.json
  2. +1 βˆ’1 elements/lisk-client/package.json
  3. +2 βˆ’2 elements/lisk-elements/package.json
  4. +1 βˆ’1 elements/lisk-p2p/package.json
  5. +4 βˆ’6 elements/lisk-p2p/src/p2p.ts
  6. +1 βˆ’1 elements/lisk-p2p/test/integration/p2p.ts
  7. +1 βˆ’1 elements/lisk-transactions/package.json
  8. +12 βˆ’0 elements/lisk-transactions/src/0_transfer_transaction.ts
  9. +13 βˆ’0 elements/lisk-transactions/src/1_second_signature_transaction.ts
  10. +14 βˆ’0 elements/lisk-transactions/src/2_delegate_transaction.ts
  11. +11 βˆ’1 elements/lisk-transactions/src/3_vote_transaction.ts
  12. +18 βˆ’0 elements/lisk-transactions/src/4_multisignature_transaction.ts
  13. +18 βˆ’0 elements/lisk-transactions/src/5_dapp_transaction.ts
  14. +36 βˆ’0 elements/lisk-transactions/src/base_transaction.ts
  15. +1 βˆ’0 elements/lisk-transactions/src/transaction_types.ts
  16. +0 βˆ’1 elements/lisk-transactions/src/utils/validation/schema.ts
  17. +4 βˆ’0 elements/lisk-transactions/test/helpers/test_transaction_class.ts
  18. +1 βˆ’1 framework/package-lock.json
  19. +3 βˆ’3 framework/package.json
  20. +8 βˆ’3 framework/src/components/README.md
  21. +0 βˆ’1 framework/src/components/storage/entities/block.js
  22. +4 βˆ’1 framework/src/components/storage/entities/transaction.js
  23. +1 βˆ’1 framework/src/controller/application.js
  24. +13 βˆ’5 framework/src/modules/README.md
  25. +1 βˆ’4 framework/src/modules/chain/init_steps/init_logic_structs.js
  26. +0 βˆ’585 framework/src/modules/chain/logic/dapp.js
  27. +10 βˆ’144 framework/src/modules/chain/logic/init_transaction.js
  28. +24 βˆ’2 framework/src/modules/chain/logic/transaction_pool.js
  29. +2 βˆ’1 framework/src/modules/chain/submodules/blocks/chain.js
  30. +4 βˆ’1 framework/src/modules/chain/submodules/blocks/utils.js
  31. +14 βˆ’6 framework/src/modules/chain/submodules/peers.js
  32. +46 βˆ’10 framework/src/modules/chain/submodules/transactions.js
  33. +25 βˆ’15 framework/src/modules/http_api/schema/swagger.yml
  34. +9 βˆ’3 framework/src/modules/network/filter_peers.js
  35. +0 βˆ’1 framework/test/mocha/common/application.js
  36. +7 βˆ’7 framework/test/mocha/common/helpers/api.js
  37. +53 βˆ’55 framework/test/mocha/functional/http/get/node/{transactions_unsigned.js β†’ transactions_pending.js}
  38. +75 βˆ’93 framework/test/mocha/functional/http/get/node/{transactions_unconfirmed.js β†’ transactions_ready.js}
  39. +77 βˆ’87 ...work/test/mocha/functional/http/get/node/{transactions_unprocessed.js β†’ transactions_verified.js}
  40. +1 βˆ’1 framework/test/mocha/functional/http/get/transactions.js
  41. +2 βˆ’2 framework/test/mocha/integration/common.js
  42. +2 βˆ’2 framework/test/mocha/unit/modules/chain/logic/transaction_pool.js
  43. +3 βˆ’1 framework/test/mocha/unit/modules/chain/submodules/peers.js
  44. +4,037 βˆ’15,305 package-lock.json
  45. +3 βˆ’3 sdk/package.json
@@ -103,7 +103,7 @@
"@liskhq/lisk-constants": "1.2.0",
"@liskhq/lisk-cryptography": "2.1.0-alpha.1",
"@liskhq/lisk-passphrase": "2.0.0",
"@liskhq/lisk-transactions": "2.1.0-alpha.9",
"@liskhq/lisk-transactions": "2.1.0-alpha.11",
"@oclif/command": "1.5.6",
"@oclif/config": "1.9.0",
"@oclif/errors": "1.2.2",
@@ -63,7 +63,7 @@
"@liskhq/lisk-constants": "1.2.0",
"@liskhq/lisk-cryptography": "2.1.0-alpha.1",
"@liskhq/lisk-passphrase": "2.0.0",
"@liskhq/lisk-transactions": "2.1.0-alpha.9",
"@liskhq/lisk-transactions": "2.1.0-alpha.11",
"@types/node": "10.12.21"
},
"devDependencies": {
@@ -1,6 +1,6 @@
{
"name": "lisk-elements",
"version": "2.1.0-alpha.1",
"version": "2.1.0-alpha.3",
"description": "Elements for building blockchain applications in the Lisk network",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
@@ -63,7 +63,7 @@
"@liskhq/lisk-constants": "1.2.0",
"@liskhq/lisk-cryptography": "2.1.0-alpha.1",
"@liskhq/lisk-passphrase": "2.0.0",
"@liskhq/lisk-transactions": "2.1.0-alpha.9",
"@liskhq/lisk-transactions": "2.1.0-alpha.11",
"@types/node": "10.12.21"
},
"devDependencies": {
@@ -1,6 +1,6 @@
{
"name": "@liskhq/lisk-p2p",
"version": "0.1.0-alpha.9",
"version": "0.1.0-alpha.10",
"description": "Unstructured P2P library for use with Lisk-related software",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
@@ -552,17 +552,15 @@ export class P2P extends EventEmitter {
this._peerPool.selectPeersAndConnect([...this._newPeers.values()]);
}

private async _startDiscovery(
knownPeers: ReadonlyArray<P2PDiscoveredPeerInfo> = [],
): Promise<void> {
private async _startDiscovery(): Promise<void> {
if (this._discoveryIntervalId) {
throw new Error('Discovery is already running');
}
this._discoveryIntervalId = setInterval(async () => {
await this._discoverPeers(knownPeers);
await this._discoverPeers([...this._triedPeers.values()]);
}, this._discoveryInterval);

await this._discoverPeers(knownPeers);
await this._discoverPeers([...this._triedPeers.values()]);
}

private _stopDiscovery(): void {
@@ -643,7 +641,7 @@ export class P2P extends EventEmitter {
}
});

await this._startDiscovery(seedPeerInfos);
await this._startDiscovery();
}

public async stop(): Promise<void> {
@@ -136,7 +136,7 @@ describe('Integration tests for P2P library', () => {
describe('Peer discovery', () => {
it('should discover all peers in the network after a few cycles of discovery', async () => {
// Wait for a few cycles of discovery.
await wait(DISCOVERY_INTERVAL * 5);
await wait(DISCOVERY_INTERVAL * 7);

p2pNodeList.forEach(p2p => {
const { connectedPeers } = p2p.getNetworkStatus();
@@ -1,6 +1,6 @@
{
"name": "@liskhq/lisk-transactions",
"version": "2.1.0-alpha.9",
"version": "2.1.0-alpha.11",
"description": "Everything related to transactions according to the Lisk protocol",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
@@ -260,4 +260,16 @@ export class TransferTransaction extends BaseTransaction {

return errors;
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (raw.tf_data) {
// This line will throw if there is an error
const data = raw.tf_data.toString('utf8');

return { data };
}

return undefined;
}
}
@@ -210,4 +210,17 @@ export class SecondSignatureTransaction extends BaseTransaction {
this._signature = signData(hash(this.getBytes()), passphrase);
this._id = getId(this.getBytes());
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (!raw.s_publicKey) {
return undefined;
}
const signature = {
transactionId: raw.t_id,
publicKey: raw.s_publicKey,
};

return { signature };
}
}
@@ -220,4 +220,18 @@ export class DelegateTransaction extends BaseTransaction {

return [];
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (!raw.d_username) {
return undefined;
}
const delegate = {
username: raw.d_username,
publicKey: raw.t_senderPublicKey,
address: raw.t_senderId,
};

return { delegate };
}
}
@@ -89,7 +89,6 @@ export class VoteTransaction extends BaseTransaction {
publicKey,
};
});

const filterArray = [
{
address: this.senderId,
@@ -342,6 +341,7 @@ export class VoteTransaction extends BaseTransaction {
),
);
}

const updatedSender = {
...sender,
balance: updatedSenderBalance.toString(),
@@ -351,4 +351,14 @@ export class VoteTransaction extends BaseTransaction {

return errors;
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (!raw.v_votes) {
return undefined;
}
const votes = raw.v_votes.split(',');

return { votes };
}
}
@@ -388,4 +388,22 @@ export class MultisignatureTransaction extends BaseTransaction {

return createResponse(this.id, errors);
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (!raw.m_keysgroup) {
return undefined;
}
const multisignature = {
min: raw.m_min,
lifetime: raw.m_lifetime,
keysgroup: [],
};

if (typeof raw.m_keysgroup === 'string') {
multisignature.keysgroup = raw.m_keysgroup.split(',');
}

return { multisignature };
}
}
@@ -358,4 +358,22 @@ export class DappTransaction extends BaseTransaction {
protected undoAsset(_: StateStore): ReadonlyArray<TransactionError> {
return [];
}

// tslint:disable:next-line: prefer-function-over-method no-any
protected assetFromSync(raw: any): object | undefined {
if (!raw.dapp_name) {
return undefined;
}
const dapp = {
name: raw.dapp_name,
description: raw.dapp_description,
tags: raw.dapp_tags,
type: raw.dapp_type,
link: raw.dapp_link,
category: raw.dapp_category,
icon: raw.dapp_icon,
};

return { dapp };
}
}
@@ -133,6 +133,8 @@ export abstract class BaseTransaction {
protected abstract verifyAgainstTransactions(
transactions: ReadonlyArray<TransactionJSON>,
): ReadonlyArray<TransactionError>;
// tslint:disable-next-line no-any
protected abstract assetFromSync(raw: any): object | undefined;

// tslint:disable-next-line cyclomatic-complexity
public constructor(rawTransaction: unknown) {
@@ -170,6 +172,7 @@ export abstract class BaseTransaction {
this.blockId = tx.blockId;
this.height = tx.height;
this.receivedAt = tx.receivedAt ? new Date(tx.receivedAt) : undefined;
this.relays = typeof tx.relays === 'number' ? tx.relays : undefined;
}

public get id(): string {
@@ -456,6 +459,39 @@ export abstract class BaseTransaction {
this._id = getId(this.getBytes());
}

/* tslint:disable:next-line: no-any no-null-keyword */
public fromSync(raw: any): TransactionJSON | null {
const transactionJSON: TransactionJSON & {
readonly requesterPublicKey: string;
readonly [key: string]: string | number | object | null;
} = {
id: raw.t_id,
height: raw.b_height,
blockId: raw.b_id || raw.t_blockId,
type: parseInt(raw.t_type, 10),
timestamp: parseInt(raw.t_timestamp, 10),
senderPublicKey: raw.t_senderPublicKey,
requesterPublicKey: raw.t_requesterPublicKey,
senderId: raw.t_senderId,
recipientId: raw.t_recipientId,
recipientPublicKey: raw.m_recipientPublicKey || null,
amount: raw.t_amount,
fee: raw.t_fee,
signature: raw.t_signature,
signSignature: raw.t_signSignature,
signatures: raw.t_signatures ? raw.t_signatures.split(',') : [],
confirmations: parseInt(raw.confirmations || 0, 10),
asset: {},
};

const transaction = {
...transactionJSON,
asset: this.assetFromSync(raw) || {},
};

return transaction;
}

protected getBasicBytes(): Buffer {
const transactionType = Buffer.alloc(BYTESIZES.TYPE, this.type);
const transactionTimestamp = Buffer.alloc(BYTESIZES.TIMESTAMP);
@@ -52,6 +52,7 @@ export interface TransactionJSON {
readonly timestamp: number;
readonly type: number;
readonly receivedAt?: string;
readonly relays?: number;
}

export interface IsValidResponse {
@@ -108,7 +108,6 @@ export const baseTransaction = {
type: {
type: 'integer',
minimum: 0,
maximum: 7,
},
timestamp: {
type: 'integer',
@@ -48,4 +48,8 @@ export class TestTransaction extends BaseTransaction {

return [];
}

public assetFromSync(raw: any) {
return { data: raw };
}
}

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
{
"name": "lisk-framework",
"version": "0.1.0-alpha.5",
"version": "0.1.0-alpha.8",
"description": "Lisk blockchain application platform",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
@@ -49,9 +49,9 @@
},
"dependencies": {
"@liskhq/lisk-cryptography": "2.1.0-alpha.1",
"@liskhq/lisk-p2p": "0.1.0-alpha.9",
"@liskhq/lisk-p2p": "0.1.0-alpha.10",
"@liskhq/lisk-transaction-pool": "0.1.0-alpha.2",
"@liskhq/lisk-transactions": "2.1.0-alpha.9",
"@liskhq/lisk-transactions": "2.1.0-alpha.11",
"ajv": "6.7.0",
"async": "2.6.1",
"bignumber.js": "8.0.2",
@@ -22,8 +22,13 @@ It exposes an interface with specific features for getting or setting particular

Find more details about the storage component in the dedicated [LIP](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0011.md).

### System
## Configuration

The system component provides per-module system information. Each module is responsible for keeping the information up-to-date.
Configuration options for each component are located in `framework/src/component/<component-name>/defaults/config.js`.

It holds the variables and constants critical for the whole application, possibly affecting other modules. For now, those are: "os", "version", "wsPort", "httpPort", "minVersion", "protocolVersion", "height", "nethash", "broadhash" and "nonce".
Each `config.js` file consists of 2 parts:

1. JSON-schema specification for all available config options.
2. Default values for the available config options for this specific compoment.

Please don't change the default values in these files directly as they will be overwritten on software updates, instead define the custom configuration options inside your blockchain application.
@@ -369,7 +369,6 @@ class Block extends BaseEntity {
trxOptions,
tx
);

result.forEach(block => {
block.transactions = transactions.filter(
({ blockId }) => blockId === block.id
@@ -403,7 +403,10 @@ class Transaction extends BaseEntity {

// TODO: improve this logic
parsedSort = parsedSort.replace('"rowId"', 'trs."rowId"');
parsedSort = parsedSort.replace('"dapp_name"', "asset->'dapp'->>'name'");
parsedSort = parsedSort.replace(
'"dapp_name"',
"trs.asset->'dapp'->>'name'"
);

const params = {
limit: parsedOptions.limit,
@@ -43,7 +43,7 @@ const __private = {
};

const registerProcessHooks = app => {
process.title = `${app.label}`;
process.title = `${app.config.app.label}(${app.config.app.version})`;

process.on('uncaughtException', err => {
// Handle error safely

0 comments on commit 9f60bbe

Please sign in to comment.
You can’t perform that action at this time.