Skip to content

Commit

Permalink
Release/v3.0.0 (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
kipliklotrika authored Mar 19, 2019
1 parent 8092bd9 commit 029c230
Show file tree
Hide file tree
Showing 134 changed files with 10,621 additions and 3,338 deletions.
21 changes: 21 additions & 0 deletions .origintrail_noderc.image
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"node_wallet":"0xb664cf668534fde04cf43173e2187b7a9196bfc3",
"node_private_key":"0dbaee2066aacd16d43a9e23649f232913bca244369463320610ffe6ffb0d69d",
"management_wallet":"0x64b592e8e9af51eb0dba5d4c18b817c01e8e75a8",
"initial_deposit_amount": "10000000000000000000000",
"local_network_only":true,
"blockchain":{
"hub_contract_address":"0x0987197628Bb06133B6FA2409eb4cF9FCaFe8d3a",
"rpc_server_url":"http://localhost:7545/"
},
"network":{
"bootstraps":[

],
"hostname":"127.0.0.1",
"remoteWhitelist":[
"0.0.0.0",
"127.0.0.1"
]
}
}
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ node_js:
env:
- NODE_ENV=development ARTIFACTS_DIR=$TRAVIS_BUILD_DIR/artifacts CUCUMBER_ARTIFACTS_DIR=$ARTIFACTS_DIR/cucumber BDD_SECTION=first
- NODE_ENV=development ARTIFACTS_DIR=$TRAVIS_BUILD_DIR/artifacts CUCUMBER_ARTIFACTS_DIR=$ARTIFACTS_DIR/cucumber BDD_SECTION=second
- NODE_ENV=development ARTIFACTS_DIR=$TRAVIS_BUILD_DIR/artifacts CUCUMBER_ARTIFACTS_DIR=$ARTIFACTS_DIR/cucumber BDD_SECTION=third
- NODE_ENV=development ARTIFACTS_DIR=$TRAVIS_BUILD_DIR/artifacts CUCUMBER_ARTIFACTS_DIR=$ARTIFACTS_DIR/cucumber BDD_SECTION=fourth


sudo: enabled
services:
- docker
addons:
apt:
packages:
Expand All @@ -17,32 +22,37 @@ before_script:
- sudo ./setup_arangodb.sh
- cp .origintrail_noderc.travis .origintrail_noderc
- npm run bootstrap
- npm install -g ganache-cli@6.1.5 &> /dev/null
- npm install -g ganache-cli@6.2.5 &> /dev/null
- npm install -g [email protected] &> /dev/null
script:
- npm run lint
- if [ "$TRAVIS_EVENT_TYPE" == "pull_request" ]; then
npm run test:bdd:dryrun;
fi
- if [[ ("$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "first" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "first" ) ]]; then
npm run test:bdd:first -- --world-parameters '{"appDataBaseDir":"$CUCUMBER_ARTIFACTS_DIR","keepFailedArtifacts":true}';
npm run test:bdd -- --tags=@first --world-parameters '{"appDataBaseDir":"$CUCUMBER_ARTIFACTS_DIR","keepFailedArtifacts":true}';
fi
- if [[ ("$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "second" ) ]]; then
npm run test:bdd:second -- --world-parameters '{"appDataBaseDir":"$CUCUMBER_ARTIFACTS_DIR","keepFailedArtifacts":true}';
npm run test:bdd -- --tags=@second --world-parameters '{"appDataBaseDir":"$CUCUMBER_ARTIFACTS_DIR","keepFailedArtifacts":true}';
fi
- if [[ ("$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "third" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "third" ) ]]; then
npm run test:bdd -- --tags=@third --world-parameters '{"appDataBaseDir":"$CUCUMBER_ARTIFACTS_DIR","keepFailedArtifacts":true}';
fi
- if [[ ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "push" && "$BDD_SECTION" == "first" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "first" ) ]]; then
npm test 2> $ARTIFACTS_DIR/mocha-logs.log;
fi
# compile and check Smart Contracts
- ganache-cli -i 5777 -p 7545 -l 10000000 -m "aspect ask story desert profit engage tuition leave fade giraffe exclude brief" &> $ARTIFACTS_DIR/ganache.log &
- ganache-cli -i 5777 -p 7545 -l 10000000 --acctKeys $ARTIFACTS_DIR/acct-keys.log -m "aspect ask story desert profit engage tuition leave fade giraffe exclude brief" &> $ARTIFACTS_DIR/ganache.log &
- cd modules/Blockchain/Ethereum
- if [[ ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "push" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "second" ) ]]; then
truffle test --network test > $ARTIFACTS_DIR/truffle-test.log;
fi
- if [[ ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "push" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "second" ) ]]; then
- if [[ ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "push" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "cron" && "$BDD_SECTION" == "second" ) || ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "third" ) || ( "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "fourth" ) ]]; then
rm -rf build && truffle migrate --reset --compile-all --network ganache > $ARTIFACTS_DIR/truffle-migrate.log;
fi
- cd $TRAVIS_BUILD_DIR
- if [[ "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "fourth" ]]; then ./test/docker/check_image.sh; fi
- if [[ "$TRAVIS_EVENT_TYPE" == "pull_request" && "$BDD_SECTION" == "fourth" ]]; then ./test/docker/cleanup_image.sh; fi
- jobs
- kill -9 %1
after_script:
Expand Down
43 changes: 42 additions & 1 deletion check-updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const umzug_migrations = new Umzug({

storageOptions: {
sequelize: Models.sequelize,
tableName: 'sequelize_meta',
},

migrations: {
Expand All @@ -28,6 +29,47 @@ const umzug_migrations = new Umzug({
});

class AutoUpdate {
/**
* Just checks if update is available and resolves into boolean.
* @param {String} [options.repo] - Github repo name i.e. OriginTrail/ot-node.
* @param {String} [options.branch] - Github repo's branch.
* @returns {Promise.<Boolean>}
*/
static async isUpdateAvailable(options) {
return new Promise(async (resolve) => {
var autoupdater = new AutoUpdater({
pathToJson: '',
repo: options.repo,
branch: options.branch,
autoupdate: false,
checkgit: true,
jsonhost: 'raw.githubusercontent.com',
contenthost: 'codeload.github.com',
progressDebounce: 0,
devmode: false,
});

autoupdater.on('check.out-dated', (v_old, v) => {
log.info(`New version found. Old version ${v_old} - new ${v}`);
resolve(true);
});

autoupdater.on('git-clone', () => {
resolve(false);
});
autoupdater.on('check.up-to-date', (v) => {
resolve(false);
});
autoupdater.on('error', (name, e) => {
log.error(name, e);
resolve(false);
});

// Start check.
autoupdater.fire('check');
});
}

/**
* Check for the update.
* @param {String} [options.repo] - Github repo name i.e. OriginTrail/ot-node.
Expand Down Expand Up @@ -104,7 +146,6 @@ class AutoUpdate {
});
autoupdater.on('end', () => {
log.warn('The app is ready to function');
resolve(true);
});
autoupdater.on('error', (name, e) => {
log.error(name, e);
Expand Down
29 changes: 12 additions & 17 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
"gas_limit": "2000000",
"gas_price": "20000000000",
"hub_contract_address": "0x056f4DA796C00766061158A01cE068D912be9c89",
"rpc_node_host": "https://rinkeby.infura.io/1WRiEqAQ9l4SW6fGdiDt",
"rpc_node_port": "",
"plugins": [
{
"enabled": false,
Expand Down Expand Up @@ -97,7 +95,8 @@
"dh_min_litigation_interval_in_minutes": 5,
"deposit_on_demand": true,
"dc_choose_time": 600000,
"requireApproval": false
"requireApproval": false,
"litigationEnabled": true
},
"staging": {
"identity": null,
Expand Down Expand Up @@ -155,9 +154,7 @@
"network_id": "rinkeby",
"gas_limit": "2000000",
"gas_price": "20000000000",
"hub_contract_address": "0x0A0253150F35D9a766e450D6F749fFFD2B21eEC6",
"rpc_node_host": "https://rinkeby.infura.io/1WRiEqAQ9l4SW6fGdiDt",
"rpc_node_port": "",
"hub_contract_address": "0x16d553B9765b6Aa9fE7C45Dfa1a1839fD88DD7bc",
"plugins": [
{
"enabled": false,
Expand Down Expand Up @@ -197,7 +194,8 @@
"dh_min_litigation_interval_in_minutes": 5,
"deposit_on_demand": false,
"dc_choose_time": 600000,
"requireApproval": false
"requireApproval": false,
"litigationEnabled": true
},
"stable": {
"identity": null,
Expand Down Expand Up @@ -256,8 +254,6 @@
"gas_limit": "2000000",
"gas_price": "20000000000",
"hub_contract_address": "0x6C314872A7e97A6F1dC7De2dc43D28500dd36f22",
"rpc_node_host": "https://rinkeby.infura.io/1WRiEqAQ9l4SW6fGdiDt",
"rpc_node_port": "",
"plugins": [
{
"enabled": false,
Expand Down Expand Up @@ -297,7 +293,8 @@
"dh_min_litigation_interval_in_minutes": 5,
"deposit_on_demand": false,
"dc_choose_time": 600000,
"requireApproval": false
"requireApproval": false,
"litigationEnabled": true
},
"production": {
"identity": null,
Expand Down Expand Up @@ -355,9 +352,7 @@
"network_id": "rinkeby",
"gas_limit": "2000000",
"gas_price": "20000000000",
"hub_contract_address": "0x0e5995FE34BfC9DB7a31fa318f7f1256Cf28FfCa",
"rpc_node_host": "https://rinkeby.infura.io/1WRiEqAQ9l4SW6fGdiDt",
"rpc_node_port": "",
"hub_contract_address": "0x4923435d78caB9cFC370a67705113Ad38923c04b",
"plugins": [
{
"enabled": false,
Expand Down Expand Up @@ -400,7 +395,8 @@
"dh_min_litigation_interval_in_minutes": 5,
"deposit_on_demand": false,
"dc_choose_time": 600000,
"requireApproval": false
"requireApproval": false,
"litigationEnabled": true
},
"mariner": {
"identity": null,
Expand Down Expand Up @@ -459,8 +455,6 @@
"gas_limit": "2000000",
"gas_price": "20000000000",
"hub_contract_address": "0xa287d7134fb40bef071c932286bd2cd01efccf30",
"rpc_node_host": "https://mainnet.infura.io/7c072f60df864d22884e705c5bf3d83f",
"rpc_node_port": "",
"plugins": [
{
"enabled": false,
Expand Down Expand Up @@ -503,6 +497,7 @@
"dh_min_litigation_interval_in_minutes": 5,
"deposit_on_demand": false,
"dc_choose_time": 600000,
"requireApproval": true
"requireApproval": true,
"litigationEnabled": false
}
}
7 changes: 7 additions & 0 deletions config/sequelizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,12 @@ module.exports = {
underscored: true,
timestamps: false,
},
retry: {
match: [
/SQLITE_BUSY/,
],
name: 'query',
max: 5,
},
},
};
51 changes: 51 additions & 0 deletions migrations/201807132333334-create-challenges.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

module.exports = {
up: (queryInterface, Sequelize) => queryInterface.createTable('challenges', {
id: {
allowNull: false,
primaryKey: true,
type: Sequelize.STRING,
},
data_set_id: {
allowNull: false,
type: Sequelize.STRING,
},
dh_id: {
allowNull: false,
type: Sequelize.STRING,
},
dh_identity: {
allowNull: false,
type: Sequelize.STRING,
},
offer_id: {
allowNull: false,
type: Sequelize.STRING,
},
block_id: {
allowNull: false,
type: Sequelize.INTEGER,
},
answer: {
allowNull: true,
type: Sequelize.STRING,
},
expected_answer: {
allowNull: false,
type: Sequelize.STRING,
},
start_time: {
allowNull: false,
type: Sequelize.INTEGER,
},
end_time: {
allowNull: true,
type: Sequelize.INTEGER,
},
status: {
allowNull: false,
type: Sequelize.STRING,
},
}),
down: queryInterface => queryInterface.dropTable('challenges'),
};
37 changes: 37 additions & 0 deletions migrations/201807132333335-alter-miner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('miner_records');

return queryInterface.createTable('miner_tasks', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
offer_id: {
allowNull: false,
type: Sequelize.STRING,
},
difficulty: {
allowNull: false,
type: Sequelize.INTEGER,
},
task: {
allowNull: false,
type: Sequelize.STRING,
},
result: {
type: Sequelize.JSON,
},
status: {
type: Sequelize.STRING,
},
message: {
type: Sequelize.STRING,
},
});
},
down: queryInterface => queryInterface.dropTable('miner_tasks'),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

module.exports = {
up: async (queryInterface, Sequelize) =>
queryInterface.addColumn(
'holding_data',
'litigation_root_hash',
{
type: Sequelize.STRING,
},
),
down: queryInterface => queryInterface.removeColumn('holding_data', 'litigation_root_hash'),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

module.exports = {
up: async (queryInterface, Sequelize) =>
queryInterface.addColumn(
'replicated_data',
'litigation_private_key',
{
type: Sequelize.STRING,
},
),
down: queryInterface => queryInterface.removeColumn('replicated_data', 'litigation_private_key'),
};
12 changes: 12 additions & 0 deletions migrations/201807132333556-offers-add-global-status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

module.exports = {
up: async (queryInterface, Sequelize) =>
queryInterface.addColumn(
'offers',
'global_status',
{
type: Sequelize.STRING,
},
),
down: queryInterface => queryInterface.removeColumn('offers', 'global_status'),
};
Loading

0 comments on commit 029c230

Please sign in to comment.