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

Commit

Permalink
Merge branch 'release/6.0.0' into 8505-align-token-support-methods-lip
Browse files Browse the repository at this point in the history
  • Loading branch information
shuse2 authored Aug 3, 2023
2 parents dfa8c52 + 566c7a6 commit baaf2e6
Show file tree
Hide file tree
Showing 147 changed files with 2,230 additions and 1,331 deletions.
20 changes: 10 additions & 10 deletions commander/package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-commander",
"version": "6.0.0-beta.4",
"version": "6.0.0-beta.5",
"description": "A command line interface for Lisk",
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -101,16 +101,16 @@
"/docs"
],
"dependencies": {
"@liskhq/lisk-api-client": "^6.0.0-beta.3",
"@liskhq/lisk-chain": "^0.4.0-beta.3",
"@liskhq/lisk-client": "^6.0.0-beta.3",
"@liskhq/lisk-codec": "^0.3.0-beta.2",
"@liskhq/lisk-api-client": "^6.0.0-beta.4",
"@liskhq/lisk-chain": "^0.4.0-beta.4",
"@liskhq/lisk-client": "^6.0.0-beta.4",
"@liskhq/lisk-codec": "^0.3.0-beta.3",
"@liskhq/lisk-cryptography": "^4.0.0-beta.2",
"@liskhq/lisk-db": "0.3.6",
"@liskhq/lisk-passphrase": "^4.0.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.2",
"@liskhq/lisk-utils": "^0.3.0-beta.2",
"@liskhq/lisk-validator": "^0.7.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.3",
"@liskhq/lisk-utils": "^0.3.0-beta.3",
"@liskhq/lisk-validator": "^0.7.0-beta.3",
"@oclif/core": "1.20.4",
"@oclif/plugin-autocomplete": "1.3.6",
"@oclif/plugin-help": "5.1.19",
Expand All @@ -121,10 +121,10 @@
"cli-table3": "0.6.0",
"fs-extra": "11.1.0",
"inquirer": "8.2.5",
"lisk-framework": "^0.10.0-beta.4",
"lisk-framework": "^0.10.0-beta.5",
"listr": "0.14.3",
"progress": "2.0.3",
"semver": "7.3.8",
"semver": "7.5.2",
"strip-ansi": "6.0.1",
"tar": "6.1.12",
"ts-morph": "17.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@
}
},
"dependencies": {
"@liskhq/lisk-framework-dashboard-plugin": "0.2.0-beta.4",
"@liskhq/lisk-framework-faucet-plugin": "0.2.0-beta.4",
"@liskhq/lisk-framework-monitor-plugin": "0.3.0-beta.4",
"@liskhq/lisk-framework-forger-plugin": "0.3.0-beta.4",
"@liskhq/lisk-framework-report-misbehavior-plugin": "0.3.0-beta.4",
"@liskhq/lisk-framework-chain-connector-plugin": "0.1.0-beta.4",
"@liskhq/lisk-framework-dashboard-plugin": "0.2.0-beta.5",
"@liskhq/lisk-framework-faucet-plugin": "0.2.0-beta.5",
"@liskhq/lisk-framework-monitor-plugin": "0.3.0-beta.5",
"@liskhq/lisk-framework-forger-plugin": "0.3.0-beta.5",
"@liskhq/lisk-framework-report-misbehavior-plugin": "0.3.0-beta.5",
"@liskhq/lisk-framework-chain-connector-plugin": "0.1.0-beta.5",
"@oclif/core": "1.20.4",
"@oclif/plugin-autocomplete": "1.3.6",
"@oclif/plugin-help": "5.1.19",
"@oclif/plugin-version": "1.1.3",
"axios": "0.21.2",
"fs-extra": "11.1.0",
"inquirer": "8.2.5",
"lisk-commander": "6.0.0-beta.4",
"lisk-sdk": "6.0.0-beta.4",
"lisk-commander": "6.0.0-beta.5",
"lisk-sdk": "6.0.0-beta.5",
"tar": "6.1.11",
"tslib": "2.4.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"build:check": "node -e \"require('./dist-node')\""
},
"dependencies": {
"lisk-sdk": "^6.0.0-beta.4"
"lisk-sdk": "^6.0.0-beta.5"
},
"devDependencies": {
"@types/jest": "26.0.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('generator:export', () => {
defaultEncryptedKeys = {
address: Buffer.from('9cabee3d27426676b852ce6b804cb2fdff7cd0b5', 'hex'),
type: 'encrypted',
data: await encrypt.encryptAES256GCMWithPassword(utils.getRandomBytes(32), defaultPassword, {
data: await encrypt.encryptAES128GCMWithPassword(utils.getRandomBytes(32), defaultPassword, {
kdfparams: {
memorySize: 2048,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('keys:import', () => {
defaultEncryptedKeys = {
address: Buffer.from('9cabee3d27426676b852ce6b804cb2fdff7cd0b5', 'hex'),
type: 'encrypted',
data: await encrypt.encryptAES256GCMWithPassword(
data: await encrypt.encryptAES128GCMWithPassword(
utils.getRandomBytes(32),
defaultPassword,
{
Expand Down
4 changes: 2 additions & 2 deletions commander/test/bootstrapping/commands/keys/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('keys:create command', () => {
memorySize: 2097023,
salt: 'bd25ddc98eba7d8bf60a6738fca3ac23',
},
cipher: cryptography.encrypt.Cipher.AES256GCM,
cipher: cryptography.encrypt.Cipher.AES128GCM,
cipherparams: {
iv: '1933be196b54d01fd0979294',
tag: '11398f4dcfd776d783a35721c326f007',
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('keys:create command', () => {
expect(loggedData.keys[0].encrypted).toHaveProperty('mac');
expect(loggedData.keys[0].encrypted).toHaveProperty('cipherparams');
expect(loggedData.keys[0].encrypted).toHaveProperty('kdfparams');
expect(loggedData.keys[0].encrypted.cipher).toBe('aes-256-gcm');
expect(loggedData.keys[0].encrypted.cipher).toBe('aes-128-gcm');
expect(loggedData.keys[0].encrypted.kdf).toBe('argon2id');
expect(loggedData.keys[0].encrypted.version).toBe('1');
expect(consoleWarnSpy).toHaveBeenCalledTimes(0);
Expand Down
2 changes: 1 addition & 1 deletion commander/test/bootstrapping/commands/keys/encrypt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('keys:encrypt', () => {
memorySize: 2097023,
salt: 'bd25ddc98eba7d8bf60a6738fca3ac23',
},
cipher: encrypt.Cipher.AES256GCM,
cipher: encrypt.Cipher.AES128GCM,
cipherparams: {
iv: '1933be196b54d01fd0979294',
tag: '11398f4dcfd776d783a35721c326f007',
Expand Down
2 changes: 1 addition & 1 deletion commander/test/bootstrapping/commands/keys/export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('keys:export', () => {
defaultEncryptedKeys = {
address: Buffer.from('9cabee3d27426676b852ce6b804cb2fdff7cd0b5', 'hex'),
type: 'encrypted',
data: await encrypt.encryptAES256GCMWithPassword(
data: await encrypt.encryptAES128GCMWithPassword(
codec.encode(plainGeneratorKeysSchema, defaultKeys),
defaultPassword,
{
Expand Down
2 changes: 1 addition & 1 deletion commander/test/bootstrapping/commands/keys/import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('keys:import', () => {
defaultEncryptedKeys = {
address: Buffer.from('9cabee3d27426676b852ce6b804cb2fdff7cd0b5', 'hex'),
type: 'encrypted',
data: await encrypt.encryptAES256GCMWithPassword(
data: await encrypt.encryptAES128GCMWithPassword(
codec.encode(plainGeneratorKeysSchema, defaultKeys),
defaultPassword,
{
Expand Down
8 changes: 4 additions & 4 deletions commander/test/commands/message/decrypt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { Awaited } from '../../types';

describe('message:decrypt', () => {
const defaultEncryptedMessage =
'kdf=argon2id&cipher=aes-256-gcm&version=1&ciphertext=023fd9427f&mac=647457ac72dbc5e567e8f9ca173ddd457909ed2f45aa080daac78078a1293e8e&salt=82c1f80fbd9500aa1421f1e491cd46d4&iv=3265e728a4b6015087616385&tag=86e2bf01ba81c0079345ae8eb5ac1704&iterations=1&parallelism=4&memorySize=2024';
const result = 'hello\n';
const defaultInputs =
'tiny decrease photo key change abuse forward penalty twin foot wish expose';
'kdf=argon2id&cipher=aes-128-gcm&version=1&ciphertext=31b2cec3ca4585d4503b46444f5836b948d875367a5f5fc08bc4ca424db60acb4a86ab98f8dd4dd73f5589ede1b8c5abc16eb73561b48aab422dd6e716b97c91721a781e3e8acfdb39c0a7f41fd23ba8&mac=bfdf26800dab13a8e88ee7fa90fcd6d43459e762fe811b3be3664537df36c026&salt=e3db480467e4e61e&iv=11af231d8cbbe77d09e515f1b3308c57&tag=81b20ab2154678a020412a8459d79554&iterations=1&parallelism=4&memorySize=2024';
const defaultInputs = 'testpassword';
const result =
'target cancel solution recipe vague faint bomb convince pink vendor fresh patrol\n';

let stdout: string[];
let stderr: string[];
Expand Down
2 changes: 1 addition & 1 deletion commander/test/commands/message/encrypt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('message:encrypt', () => {
memorySize: 2097023,
salt: 'bd25ddc98eba7d8bf60a6738fca3ac23',
},
cipher: cryptography.encrypt.Cipher.AES256GCM,
cipher: cryptography.encrypt.Cipher.AES128GCM,
cipherparams: {
iv: '1933be196b54d01fd0979294',
tag: '11398f4dcfd776d783a35721c326f007',
Expand Down
10 changes: 5 additions & 5 deletions elements/lisk-api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liskhq/lisk-api-client",
"version": "6.0.0-beta.3",
"version": "6.0.0-beta.4",
"description": "An API client for the Lisk network",
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -35,16 +35,16 @@
"build:check": "node -e \"require('./dist-node')\""
},
"dependencies": {
"@liskhq/lisk-codec": "^0.3.0-beta.2",
"@liskhq/lisk-codec": "^0.3.0-beta.3",
"@liskhq/lisk-cryptography": "^4.0.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.2",
"@liskhq/lisk-validator": "^0.7.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.3",
"@liskhq/lisk-validator": "^0.7.0-beta.3",
"isomorphic-ws": "4.0.1",
"ws": "8.11.0",
"zeromq": "6.0.0-beta.6"
},
"devDependencies": {
"@liskhq/lisk-chain": "^0.4.0-beta.3",
"@liskhq/lisk-chain": "^0.4.0-beta.4",
"@types/jest": "29.2.3",
"@types/jest-when": "3.5.2",
"@types/node": "18.15.3",
Expand Down
10 changes: 5 additions & 5 deletions elements/lisk-chain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liskhq/lisk-chain",
"version": "0.4.0-beta.3",
"version": "0.4.0-beta.4",
"description": "Blocks and state management implementation that are used for block processing according to the Lisk protocol",
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -35,12 +35,12 @@
"build:check": "node -e \"require('./dist-node')\""
},
"dependencies": {
"@liskhq/lisk-codec": "^0.3.0-beta.2",
"@liskhq/lisk-codec": "^0.3.0-beta.3",
"@liskhq/lisk-cryptography": "^4.0.0-beta.2",
"@liskhq/lisk-db": "0.3.6",
"@liskhq/lisk-tree": "^0.3.0-beta.2",
"@liskhq/lisk-utils": "^0.3.0-beta.2",
"@liskhq/lisk-validator": "^0.7.0-beta.2",
"@liskhq/lisk-tree": "^0.3.0-beta.3",
"@liskhq/lisk-utils": "^0.3.0-beta.3",
"@liskhq/lisk-validator": "^0.7.0-beta.3",
"debug": "4.3.4"
},
"devDependencies": {
Expand Down
17 changes: 15 additions & 2 deletions elements/lisk-chain/src/state_store/state_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ export class StateStore {
private readonly _prefix: Buffer;
private _cache: CacheDB;
private _snapshot: CacheDB | undefined;
private _latestSnapshotId: number;

public constructor(db: DatabaseReader, prefix?: Buffer, cache?: CacheDB) {
this._db = db;
this._prefix = prefix ?? DB_KEY_STATE_STORE;
this._cache = cache ?? new CacheDB();
this._latestSnapshotId = -1;
}

// TODO: Remove accepting number for subStorePrefix
Expand Down Expand Up @@ -222,14 +224,25 @@ export class StateStore {
// createSnapshot follows the same interface as stateDB. However, it does not support multi snapshot.
public createSnapshot(): number {
this._snapshot = this._cache.copy();
return 0;
this._latestSnapshotId += 1;

if (this._latestSnapshotId === Number.MAX_SAFE_INTEGER) {
this._latestSnapshotId = 0;
}

return this._latestSnapshotId;
}

// restoreSnapshot does not support multi-snapshot. Therefore, id is not used.
public restoreSnapshot(_id: number): void {
public restoreSnapshot(id: number): void {
if (id !== this._latestSnapshotId) {
throw new Error('Invalid snapshot ID. Cannot revert to an older snapshot.');
}

if (!this._snapshot) {
throw new Error('Snapshot must be taken first before reverting');
}

this._cache = this._snapshot;
this._snapshot = undefined;
}
Expand Down
24 changes: 24 additions & 0 deletions elements/lisk-chain/test/unit/state_store/state_store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,30 @@ describe('state store', () => {

await expect(subStore.get(Buffer.from([0]))).rejects.toThrow(NotFoundError);
await expect(subStore.get(existingKey)).resolves.toEqual(existingValue);
expect(subStore['_snapshot']).toBeUndefined();
expect(subStore['_latestSnapshotId']).toBe(id);
});

it('should throw an error when restoring with an invalid snapshot ID', () => {
const subStore = stateStore.getStore(moduleID, storePrefix);

expect(() => subStore.restoreSnapshot(100)).toThrow(
'Invalid snapshot ID. Cannot revert to an older snapshot.',
);
});

it('should throw an error when restoring without taking a snapshot first', () => {
const subStore = stateStore.getStore(moduleID, storePrefix);

expect(() => subStore.restoreSnapshot(0)).toThrow(
'Invalid snapshot ID. Cannot revert to an older snapshot.',
);
});

it('should reset the snapshot id to 0 when the limit is reached', () => {
stateStore['_latestSnapshotId'] = Number.MAX_SAFE_INTEGER - 1;
const snapshotId = stateStore.createSnapshot();
expect(snapshotId).toBe(0);
});
});

Expand Down
14 changes: 7 additions & 7 deletions elements/lisk-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liskhq/lisk-client",
"version": "6.0.0-beta.3",
"version": "6.0.0-beta.4",
"description": "A default set of Elements for use by clients of the Lisk network",
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -56,14 +56,14 @@
"build:check": "node -e \"require('./dist-node')\""
},
"dependencies": {
"@liskhq/lisk-api-client": "^6.0.0-beta.3",
"@liskhq/lisk-codec": "^0.3.0-beta.2",
"@liskhq/lisk-api-client": "^6.0.0-beta.4",
"@liskhq/lisk-codec": "^0.3.0-beta.3",
"@liskhq/lisk-cryptography": "^4.0.0-beta.2",
"@liskhq/lisk-passphrase": "^4.0.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.2",
"@liskhq/lisk-tree": "^0.3.0-beta.2",
"@liskhq/lisk-utils": "^0.3.0-beta.2",
"@liskhq/lisk-validator": "^0.7.0-beta.2",
"@liskhq/lisk-transactions": "^6.0.0-beta.3",
"@liskhq/lisk-tree": "^0.3.0-beta.3",
"@liskhq/lisk-utils": "^0.3.0-beta.3",
"@liskhq/lisk-validator": "^0.7.0-beta.3",
"buffer": "6.0.3"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit baaf2e6

Please sign in to comment.