Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Dec 16, 2020
2 parents db9ba2b + 76a3674 commit d74df5e
Show file tree
Hide file tree
Showing 316 changed files with 14,796 additions and 11,622 deletions.
22 changes: 12 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '168', artifactNumToKeepStr: '5'))
}
environment {
LISK_CORE_VERSION = '2.1.3'
}
parameters {
booleanParam(name: 'SKIP_PERCY', defaultValue: false, description: 'Skip running percy.')
string(name: 'LISK_CORE_VERSION', defaultValue: 'release/3.0.0-beta.1', description: 'Use lisk-core branch.', )
string(name: 'LISK_CORE_IMAGE_VERSION', defaultValue: '3.0.0-beta.1-a7842d112d5136d9462501763c4cb2895096e900', description: 'Use lisk-core docker image.', )
}
stages {
stage('Install npm dependencies') {
steps {
nvm(getNodejsVersion()) {
sh 'npm install --registry https://npm.lisk.io'
sh 'npm install --registry https://npm.lisk.io --no-optional'
}
}
}
Expand Down Expand Up @@ -67,6 +66,9 @@ pipeline {
}
}
stage('Run tests') {
environment {
LISK_CORE_IMAGE_VERSION = "${params.LISK_CORE_IMAGE_VERSION}"
}
steps {
parallel (
"jest": {
Expand All @@ -89,7 +91,7 @@ pipeline {
"cypress": {
dir('lisk') {
checkout([$class: 'GitSCM',
tags: [[name: "v${env.LISK_CORE_VERSION}" ]],
branches: [[name: "${params.LISK_CORE_VERSION}" ]],
userRemoteConfigs: [[url: 'https://github.com/LiskHQ/lisk-core']]])
}
withCredentials([string(credentialsId: 'lisk-hub-testnet-passphrase', variable: 'TESTNET_PASSPHRASE')]) {
Expand All @@ -105,7 +107,7 @@ pipeline {
cp $WORKSPACE/test/dev_blockchain.db.gz $WORKSPACE/$BRANCH_NAME/dev_blockchain.db.gz
cd $WORKSPACE/$BRANCH_NAME
cp .env.development .env
sed -i -r -e "s/ENV_LISK_VERSION=.*$/ENV_LISK_VERSION=$LISK_CORE_VERSION/" .env
sed -i -r -e "s/ENV_LISK_VERSION=.*$/ENV_LISK_VERSION=$LISK_CORE_IMAGE_VERSION/" .env
sed -i -r -e '/ports:/,+2d' docker-compose.yml
# random port assignment
Expand All @@ -119,12 +121,12 @@ services:
- \\${ENV_LISK_WS_PORT}
EOF
ENV_LISK_VERSION="$LISK_CORE_VERSION" make coldstart
export CYPRESS_baseUrl=http://127.0.0.1:300$N/#/
ENV_LISK_VERSION="$LISK_CORE_IMAGE_VERSION" make coldstart
export CYPRESS_baseUrl=http://127.0.0.1:565$N/#/
export CYPRESS_coreUrl=http://127.0.0.1:$( docker-compose port lisk 4000 |cut -d ":" -f 2 )
cd -
npm run serve -- $WORKSPACE/app/build -p 300$N -a 127.0.0.1 &>server.log &
npm run serve -- $WORKSPACE/app/build -p 565$N -a 127.0.0.1 &>server.log &
set +e
set -o pipefail
npm run cypress:run |tee cypress.log
Expand Down Expand Up @@ -196,7 +198,7 @@ EOF
}
cleanup {
ansiColor('xterm') {
sh '( cd $WORKSPACE/$BRANCH_NAME && make mrproper || true ) || true'
sh '( cd $WORKSPACE/$BRANCH_NAME && docker-compose logs && make mrproper || true ) || true'
}
cleanWs()
}
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-desktop",
"version": "1.27.1",
"version": "2.0.0-beta.0",
"productName": "Lisk",
"description": "Lisk",
"main": "./build/main.js",
Expand Down
2 changes: 1 addition & 1 deletion app/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ipcMain } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies
import Lisk from '@liskhq/lisk-client-old'; // eslint-disable-line
import Lisk from '@liskhq/lisk-client'; // eslint-disable-line

export const createCommand = (command, fn) => {
ipcMain.on(`${command}.request`, (event, ...args) => {
Expand Down
28 changes: 13 additions & 15 deletions config/liskSdkFix.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
const find = require('findit'); // eslint-disable-line
const fs = require('fs');

const finder = find('./node_modules/@liskhq');
const fix = "console.log('monkey patch');";
const buffer = './node_modules/node-libs-browser/node_modules/buffer/index.js';
const fix = './config/readBigUInt64BE.js';

finder.on('file', (file) => {
if (file.match(/\.js/)) {
fs.readFile(file, 'utf8', (err, data) => {
fs.readFile(buffer, (bufferErr, bufferCode) => {
if (bufferErr) throw bufferErr;

fs.readFile(fix, (fixErr, fixCode) => {
if (fixErr) throw fixErr;

fs.writeFile(buffer, bufferCode + fixCode, 'utf8', (err) => {
if (err) throw err;
let newData = '';
if (data.match(/process\.env\.NACL_FAST\s=\s'disable';/)) {
newData = data
.replace(/process.env.NACL_FAST = 'disable';/, fix);
/* eslint-disable-next-line no-console */
console.log(`Fix the LiskSDK bug in ${file} `);
fs.writeFileSync(file, newData, { encoding: 'utf8', flag: 'w' });
}

// eslint-disable-next-line no-console
console.log('Successfully added readBigUInt64BE to Buffer.');
});
}
});
});
126 changes: 126 additions & 0 deletions config/readBigUInt64BE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* eslint-disable */
Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset = 0) {
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}

const hi = first * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
this[++offset]

const lo = this[++offset] * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
last

return (BigInt(hi) << 32n) + BigInt(lo)
})

Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, 0n, 0xffffffffffffffffn)
})

function wrtBigUInt64BE (buf, value, offset, min, max) {
checkIntBI(value, min, max, buf, offset, 7)

let lo = Number(value & 0xffffffffn)
buf[offset + 7] = lo
lo = lo >> 8
buf[offset + 6] = lo
lo = lo >> 8
buf[offset + 5] = lo
lo = lo >> 8
buf[offset + 4] = lo
let hi = Number(value >> 32n & 0xffffffffn)
buf[offset + 3] = hi
hi = hi >> 8
buf[offset + 2] = hi
hi = hi >> 8
buf[offset + 1] = hi
hi = hi >> 8
buf[offset] = hi
return offset + 8
}

function checkBounds (buf, offset, byteLength) {
validateNumber(offset, 'offset')
if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
boundsError(offset, buf.length - (byteLength + 1))
}
}

function checkIntBI (value, min, max, buf, offset, byteLength) {
if (value > max || value < min) {
const n = typeof min === 'bigint' ? 'n' : ''
let range
if (byteLength > 3) {
if (min === 0 || min === 0n) {
range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
} else {
range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
`${(byteLength + 1) * 8 - 1}${n}`
}
} else {
range = `>= ${min}${n} and <= ${max}${n}`
}
throw new errors.ERR_OUT_OF_RANGE('value', range, value)
}
checkBounds(buf, offset, byteLength)
}

function defineBigIntMethod (fn) {
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
}

function BufferBigIntNotDefined () {
throw new Error('BigInt not supported')
}

function validateNumber (value, name) {
if (typeof value !== 'number') {
throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
}
}

function boundsError (value, length, type) {
if (Math.floor(value) !== value) {
validateNumber(value, type)
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
}

if (length < 0) {
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
}

throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
`>= ${type ? 1 : 0} and <= ${length}`,
value)
}

Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, -0x8000000000000000n, 0x7fffffffffffffffn)
})

Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset = 0) {
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}

const val = (first << 24) + // Overflow
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
this[++offset]

return (BigInt(val) << 32n) +
BigInt(this[++offset] * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
last)
})
2 changes: 1 addition & 1 deletion docs/REDUX_ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ and every 10 seconds dispatches [`newBlockCreated`](https://github.com/LiskHQ/li
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`updateAccountData`](https://github.com/LiskHQ/lisk-desktop/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L21)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`updateTransactions`](https://github.com/LiskHQ/lisk-desktop/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L97)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↪️ Account Middleware<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`loadVotes`](https://github.com/LiskHQ/lisk-desktop/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L156) (sometimes)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`votesRetrieved`](https://github.com/LiskHQ/lisk-desktop/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L156) (sometimes)<br/>

## Local Storage
All data saved in localStorage should be saved in Subscribers files
Expand Down
Loading

0 comments on commit d74df5e

Please sign in to comment.