Skip to content

Commit

Permalink
Merge latest Lisk Server Version 0.7.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
curvesy committed Oct 9, 2023
1 parent ec3ad00 commit 86606e5
Show file tree
Hide file tree
Showing 78 changed files with 14,479 additions and 2,738 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Every microservice is independently managed and placed in a separate directory u
- The default installation method is based on Docker.
- Some token conversion rates in the Market service require their API keys.
- For the events information to be always available in the API, please set `system.keepEventsForHeights: -1` in the Lisk application node config.
- It is highly recommended to *NOT* enable any plugins on the Lisk application node when running Lisk Service against it.
- It is highly recommended to *NOT* enable any plugins on the Lisk application node when running Lisk Service against it. Enabling them can cause performance issues in Lisk Service.

## Architecture Diagram

Expand Down Expand Up @@ -178,7 +178,7 @@ https://github.com/muzikie/streamer/graphs/contributors

## License

Copyright 2016-2023 Lisk Foundation
Copyright 2016-2024 Lisk Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 4 additions & 2 deletions docs/antora/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ It allows all services to share a similar interface and design pattern.
The objective of the Template service is to reduce code duplication and increase consistency between each service, hence simplifying code maintenance and testing.
|===

==== Remarks

[NOTE]
====
* Lisk Service by default attempts to connect to a local node via WebSocket on port `7887` or IPC on `~/.lisk/lisk-core` by default.
* The default installation method is based on Docker.
* Please note that certain token conversion rates in the Market service require their API keys.
* For the events information to be always available in the API, please set the `system.keepEventsForHeights: -1` in the Lisk application node config.
* It is highly recommended *NOT* to enable any plugins on the Lisk application node when running Lisk Service against it. Enabling them can cause performance issues in Lisk Service.
====

The following diagram below depicts an overview of the microservice architecture.
The inter-microservice communications are enabled with a message broker.
Expand Down
20 changes: 20 additions & 0 deletions docs/antora/modules/ROOT/pages/setup/docker.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ It is strongly recommended to synchronize your blockchain node with the network

=== Prerequisites

==== Requirements

Supported Platforms::
* Ubuntu 20.04 (LTS) x86_64
* Ubuntu 22.04 (LTS) x86_64
* MacOS x86_64

Node.js::
* 18

The following system requirements are recommended:

Memory::
* Machines with a minimum of 8 GB RAM for the Mainnet.

* Machines with a minimum of 8 GB RAM for the Testnet.

Storage::
* Machines with a minimum of 40 GB HDD.

The following dependencies are required to install and run Lisk Service with Docker.

==== Development tools
Expand Down
21 changes: 20 additions & 1 deletion docs/antora/modules/ROOT/pages/setup/source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Mona Bärenfänger <[email protected]>
:url_management_pm2: management/source.adoc
:url_references_config: configuration/index.adoc


TIP: Install from source code if you want to customize the codebase of Lisk Service, e.g. if you want to adjust the API to be fully compatible with your blockchain application.

As an alternative to the Docker image setup, it is also possible to install Lisk Service from source code.
Expand All @@ -39,6 +38,26 @@ This setup requires more steps than the Docker image installation, however this

The following dependencies are required to install and run Lisk Service from Source.

=== Requirements

Supported Platforms::
* Ubuntu 20.04 (LTS) x86_64
* Ubuntu 22.04 (LTS) x86_64
* MacOS x86_64

Node.js::
* 18

The following system requirements are recommended:

Memory::
* Machines with a minimum of 8 GB RAM for the Mainnet.

* Machines with a minimum of 8 GB RAM for the Testnet.

Storage::
* Machines with a minimum of 40 GB HDD.

=== Update packages

[tabs]
Expand Down
18 changes: 16 additions & 2 deletions docs/api/version3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ _Supports pagination._
| Parameter | Type | Validation | Default | Comment |
| --------- | ---- | ---------- | ------- | ------- |
| ip | String | `/^(?:(?:25[0-5]\|2[0-4][0-9]\|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]\|2[0-4][0-9]\|[01]?[0-9][0-9]?)$/` | *(empty)* | |
| networkVersion | String | `/^(0\|[1-9]\d*)\.(0\|[1-9]\d*)\.(0\|[1-9]\d*)(-(0\|[1-9]\d*\|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0\|[1-9]\d*\|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(.\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/` | *(empty)* | |
| networkVersion | String | `/^\d+\.\d+((\.\d+)?(?:-[a-zA-Z\d]+(?:\.\d+)?)?)?(?:\+[a-zA-Z\d]+)?$/` | *(empty)* | |
| state | String | `["connected", "disconnected", "any"]` | any | |
| height | Number | `[0,Inf)` | *(empty)* | |
| limit | Number | `[1,100]` | 10 | |
Expand Down Expand Up @@ -5657,7 +5657,14 @@ _Supports pagination._
"status": "activated",
"address": "lskdwsyfmcko6mcd357446yatromr9vzgu7eb8y99",
"lastCertificateHeight": 160,
"lastUpdated": 1616008148
"lastUpdated": 1616008148,
"escrowedLSK": "50000000000",
"escrow": [
{
"tokenID": "0000000000000000",
"amount": "50000000000"
}
]
}
],
"meta": {
Expand Down Expand Up @@ -5867,6 +5874,13 @@ Proxy request to directly invoke application endpoint. Returns endpoint response
}
```

503 Service Unavailable
```jsonc
{
"error": true,
"message": "Service is not ready yet."
}

#### Examples

Get legacy account details by publicKey
Expand Down
Binary file added framework/dist/lisk-service-framework-1.5.0.tgz
Binary file not shown.
Binary file added framework/dist/lisk-service-framework-1.5.1.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-service-framework",
"version": "1.4.23",
"version": "1.5.1",
"description": "Lisk Service Framework",
"keywords": [
"lisk",
Expand Down
2 changes: 2 additions & 0 deletions framework/src/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ const request = async (url, params = {}) => {
response = { data, headers, status, statusText };

if (key) cache.set(key, response, params.cacheTTL);
} else {
response = httpResponse;
}
}

Expand Down
96 changes: 96 additions & 0 deletions framework/tests/functional/database/mysql/mysql.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ describe('Test MySQL', () => {
expect(result[0].height).toBeGreaterThanOrEqual(result[1].height);
});

it('should order the rows in ascending order based on their height using raw query', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const result = await blocksTable.find({ orderByRaw: ['height asc'] });
expect(result).toBeInstanceOf(Array);
expect(result.length).toBe(2);
expect(result[1].height).toBeGreaterThanOrEqual(result[0].height);
});

it('should order the rows in descending order based on their height using raw query', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const result = await blocksTable.find({ orderByRaw: ['height desc'] });
expect(result).toBeInstanceOf(Array);
expect(result.length).toBe(2);
expect(result[0].height).toBeGreaterThanOrEqual(result[1].height);
});

it('should get row count', async () => {
const count = await blocksTable.count();
expect(count).toBe(2);
Expand Down Expand Up @@ -234,6 +250,45 @@ describe('Test MySQL', () => {
expect(result).toBe(2);
});

it('should get row count using whereNot', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const params = {
whereNot: {
column: 'id',
value: emptyBlock.id,
},
};
const result = await blocksTable.count(params);
expect(result).toBe(1);
});

it('should get row count using whereNotIn', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const params = {
whereNotIn: {
column: 'id',
values: [emptyBlock.id, nonEmptyBlock.id],
},
};
const result = await blocksTable.count(params);
expect(result).toBe(0);
});

it('should get row count using whereBetween', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const params = {
whereBetween: {
column: 'id',
values: [
Math.min(emptyBlock.id, nonEmptyBlock.id),
Math.max(emptyBlock.id, nonEmptyBlock.id),
],
},
};
const result = await blocksTable.count(params);
expect(result).toBe(2);
});

it('should get row count using whereIn and whereNull', async () => {
await blocksTable.upsert([emptyBlock, nonEmptyBlock]);
const params = {
Expand Down Expand Up @@ -335,6 +390,13 @@ describe('Test MySQL', () => {
expect(result.length).toBeGreaterThan(distinctResult.length);
});

it('should execute group by query', async () => {
await blocksTable.upsert([emptyBlock, { ...nonEmptyBlock, id: emptyBlock.id }]);
const result = await blocksTable.find();
const groupByResult = await blocksTable.find({ groupBy: 'id' }, 'id');
expect(result.length).toBeGreaterThan(groupByResult.length);
});

it('should execute update method', async () => {
const [retrievedBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']);
expect(retrievedBlock.timestamp).toBe(emptyBlock.timestamp);
Expand Down Expand Up @@ -807,6 +869,30 @@ describe('Test MySQL', () => {
expect(result[0].height).toBeGreaterThanOrEqual(result[1].height);
});

it('should order the rows in ascending order based on their height using orderByRaw query', async () => {
const connection = await getDBConnection();
const trx = await startDBTransaction(connection);
await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx);
await commitDBTransaction(trx);

const result = await blocksTable.find({ orderByRaw: ['height asc'] });
expect(result).toBeInstanceOf(Array);
expect(result.length).toBe(2);
expect(result[1].height).toBeGreaterThanOrEqual(result[0].height);
});

it('should order the rows in descending order based on their height', async () => {
const connection = await getDBConnection();
const trx = await startDBTransaction(connection);
await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx);
await commitDBTransaction(trx);

const result = await blocksTable.find({ orderByRaw: ['height desc'] });
expect(result).toBeInstanceOf(Array);
expect(result.length).toBe(2);
expect(result[0].height).toBeGreaterThanOrEqual(result[1].height);
});

it('should get row count', async () => {
const count = await blocksTable.count();
expect(count).toBe(2);
Expand Down Expand Up @@ -968,6 +1054,16 @@ describe('Test MySQL', () => {
expect(result.length).toBeGreaterThan(distinctResult.length);
});

it('should perform group by query', async () => {
const connection = await getDBConnection();
const trx = await startDBTransaction(connection);
await blocksTable.upsert([emptyBlock, { ...nonEmptyBlock, id: emptyBlock.id }], trx);
await commitDBTransaction(trx);
const result = await blocksTable.find();
const groupByResult = await blocksTable.find({ groupBy: 'id' }, 'id');
expect(result.length).toBeGreaterThan(groupByResult.length);
});

it('should perform update method', async () => {
const [retrievedBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']);
expect(retrievedBlock.timestamp).toBe(emptyBlock.timestamp);
Expand Down
Loading

0 comments on commit 86606e5

Please sign in to comment.