Skip to content

Commit

Permalink
Merge pull request #2085 from ArkEcosystem/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Feb 12, 2019
2 parents 90f4014 + 9a6dc91 commit 9a4397b
Show file tree
Hide file tree
Showing 55 changed files with 386 additions and 170 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ jobs:
test-node10-0:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:10-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down Expand Up @@ -113,14 +113,14 @@ jobs:
test-node11-0:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:11-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down Expand Up @@ -223,14 +223,14 @@ jobs:
test-node10-1:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:10-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down Expand Up @@ -343,14 +343,14 @@ jobs:
test-node10-2:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:10-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down Expand Up @@ -458,14 +458,14 @@ jobs:
test-node11-1:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:11-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down Expand Up @@ -578,14 +578,14 @@ jobs:
test-node11-2:
working_directory: ~/core
environment:
CORE_DB_DATABASE: core_development
CORE_DB_DATABASE: core_unitnet
CORE_DB_USERNAME: core
docker:
- image: 'circleci/node:11-browsers'
- image: 'postgres:alpine'
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: core_development
POSTGRES_DB: core_unitnet
POSTGRES_USER: core
steps:
- checkout
Expand Down
8 changes: 4 additions & 4 deletions .circleci/configTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"test-node10-0": {
"working_directory": "~/core",
"environment": {
"CORE_DB_DATABASE": "core_development",
"CORE_DB_DATABASE": "core_unitnet",
"CORE_DB_USERNAME": "core"
},
"docker": [
Expand All @@ -15,7 +15,7 @@
"image": "postgres:alpine",
"environment": {
"POSTGRES_PASSWORD": "password",
"POSTGRES_DB": "core_development",
"POSTGRES_DB": "core_unitnet",
"POSTGRES_USER": "core"
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@
"test-node11-0": {
"working_directory": "~/core",
"environment": {
"CORE_DB_DATABASE": "core_development",
"CORE_DB_DATABASE": "core_unitnet",
"CORE_DB_USERNAME": "core"
},
"docker": [
Expand All @@ -98,7 +98,7 @@
"image": "postgres:alpine",
"environment": {
"POSTGRES_PASSWORD": "password",
"POSTGRES_DB": "core_development",
"POSTGRES_DB": "core_unitnet",
"POSTGRES_USER": "core"
}
}
Expand Down
6 changes: 3 additions & 3 deletions .circleci/rebuild-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ tables='rounds blocks transactions wallets'
for table in $tables
do
dropcmd=$(echo "drop table if exists ${table};")
psql -h localhost -U core -d core_development -c "${dropcmd}"
psql -h localhost -U core -d core_unitnet -c "${dropcmd}"
done

cd ../packages/core-database-postgres/src/migrations/

for sqlFile in ./*.sql
do
sqlcmd=$(cat $sqlFile | sed 's/${schema~}\.//g')
psql -h localhost -U core -d core_development -c "${sqlcmd}"
done
psql -h localhost -U core -d core_unitnet -c "${sqlcmd}"
done
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ docker/development

#Webstorm/Intellij
.idea

# Vagrant
.vagrant
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.1.1] - 2019-02-12

### Fixed

- Configuration endpoint does not show dynamic fees ([#2082])
- Return the correct supply for the legacy API ([#2083])

## [2.1.0] - 2019-02-11

### Added
Expand Down Expand Up @@ -177,7 +184,8 @@ Closed security vulnerabilities:

- Initial Release

[unreleased]: https://github.com/ArkEcosystem/core/compare/2.0.19...develop
[unreleased]: https://github.com/ArkEcosystem/core/compare/2.1.1...develop
[2.1.1]: https://github.com/ArkEcosystem/core/compare/2.1.0..2.1.1
[2.1.0]: https://github.com/ArkEcosystem/core/compare/2.0.19...2.1.0
[2.0.19]: https://github.com/ArkEcosystem/core/compare/2.0.18...2.0.19
[2.0.18]: https://github.com/ArkEcosystem/core/compare/2.0.17...2.0.18
Expand Down Expand Up @@ -270,3 +278,5 @@ Closed security vulnerabilities:
[#2058]: https://github.com/ArkEcosystem/core/pull/2058
[#2061]: https://github.com/ArkEcosystem/core/pull/2061
[#2080]: https://github.com/ArkEcosystem/core/pull/2080
[#2082]: https://github.com/ArkEcosystem/core/pull/2082
[#2083]: https://github.com/ArkEcosystem/core/pull/2083
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @faustbrian @kristjank @supaiku0
78 changes: 1 addition & 77 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/usr/bin/env bash

# -----------------------------------
# TYPOGRAPHY
# -----------------------------------

# Typography
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
Expand All @@ -13,19 +10,9 @@ blue=$(tput setaf 6)
white=$(tput setaf 7)
black=$(tput setaf 8)

bg_red=$(tput setab 1)
bg_green=$(tput setab 2)
bg_yellow=$(tput setab 3)
bg_lila=$(tput setab 4)
bg_pink=$(tput setab 5)
bg_blue=$(tput setab 6)
bg_white=$(tput setab 7)
bg_black=$(tput setab 8)

bold=$(tput bold)
reset=$(tput sgr0)

# Indicators
heading ()
{
echo " ${lila}==>${reset}${bold} $1${reset}"
Expand All @@ -51,69 +38,6 @@ error ()
echo " ${red}==>${reset}${bold} $1${reset}"
}

# Colored Text
text_red ()
{
echo "${red}$1${reset}"
}

text_green ()
{
echo "${green}$1${reset}"
}

text_yellow ()
{
echo "${yellow}$1${reset}"
}

text_lila ()
{
echo "${lila}$1${reset}"
}

text_pink ()
{
echo "${pink}$1${reset}"
}

text_blue ()
{
echo "${blue}$1${reset}"
}

text_white ()
{
echo "${white}$1${reset}"
}

text_black ()
{
echo "${black}$1${reset}"
}

# Styles
text_bold ()
{
echo "${bold}"
}

text_reset ()
{
echo "${reset}"
}

# Helpers
divider ()
{
text_lila " ==============================================================="
}

paragraph ()
{
text_white "$1" | fold -w67 | paste -sd'\n' -
}

# Detect pkg type
DEB=$(which apt-get)
RPM=$(which yum)
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"npmClient": "yarn",
"packages": ["packages/*", "plugins/*"],
"useWorkspaces": true,
"version": "2.1.0"
"version": "2.1.1"
}
14 changes: 13 additions & 1 deletion packages/core-api/__tests__/v2/handlers/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "@arkecosystem/core-test-utils";

import { app } from "@arkecosystem/core-container";
import { setUp, tearDown } from "../../__support__/setup";
import { utils } from "../utils";

Expand Down Expand Up @@ -51,7 +53,7 @@ describe("API 2.0 - Loader", () => {
"using the %s header",
(header, request) => {
it("should GET the node configuration", async () => {
const response = await utils[request]("GET", "node/configuration");
let response = await utils[request]("GET", "node/configuration");
expect(response).toBeSuccessfulResponse();
expect(response.data.data).toBeObject();

Expand All @@ -60,6 +62,16 @@ describe("API 2.0 - Loader", () => {
expect(response.data.data.symbol).toBeString();
expect(response.data.data.explorer).toBeString();
expect(response.data.data.version).toBeNumber();

const dynamicFees = app.resolveOptions("transactionPool").dynamicFees;
expect(response.data.data.transactionPool.dynamicFees).toEqual(dynamicFees);

app.resolveOptions("transactionPool").dynamicFees.enabled = false;

response = await utils[request]("GET", "node/configuration");
expect(response.data.data.transactionPool.dynamicFees).toEqual({ enabled: false });

app.resolveOptions("transactionPool").dynamicFees.enabled = true;
});
},
);
Expand Down
4 changes: 2 additions & 2 deletions packages/core-api/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@arkecosystem/core-api",
"description": "Public API for Ark Core",
"version": "2.1.0",
"version": "2.1.1",
"contributors": [
"Kristjan Košič <[email protected]>",
"Brian Faust <[email protected]>"
Expand All @@ -13,7 +13,7 @@
"dist"
],
"scripts": {
"prepublishOnly": "yarn test && yarn build",
"prepublishOnly": "yarn build",
"pretest": "bash ../../scripts/pre-test.sh",
"compile": "../../node_modules/typescript/bin/tsc",
"build": "yarn clean && yarn compile",
Expand Down
9 changes: 2 additions & 7 deletions packages/core-api/src/versions/1/blocks/controller.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { supplyCalculator } from "@arkecosystem/core-utils";
import { bignumify } from "@arkecosystem/core-utils";
import Boom from "boom";
import Hapi from "hapi";
Expand Down Expand Up @@ -105,14 +106,8 @@ export class BlocksController extends Controller {

public async supply(request: Hapi.Request, h: Hapi.ResponseToolkit) {
try {
const lastBlock = this.blockchain.getLastBlock();
const constants = this.config.getMilestone(lastBlock.data.height);
const rewards = bignumify(constants.reward).times(lastBlock.data.height - constants.height);

return super.respondWith({
supply: +bignumify(this.config.get("genesisBlock.totalAmount"))
.plus(rewards)
.toFixed(),
supply: supplyCalculator.calculate(this.blockchain.getLastBlock().data.height),
});
} catch (error) {
return Boom.badImplementation(error);
Expand Down
2 changes: 2 additions & 0 deletions packages/core-api/src/versions/2/node/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class NodeController extends Controller {
const feeStatisticsData = await transactionsRepository.getFeeStatistics();

const network = this.config.get("network");
const dynamicFees = app.resolveOptions("transactionPool").dynamicFees;

return {
data: {
Expand All @@ -58,6 +59,7 @@ export class NodeController extends Controller {
feeStatistics: super.toCollection(request, feeStatisticsData, "fee-statistics"),
transactionPool: {
maxTransactionAge: app.resolveOptions("transactionPool").maxTransactionAge,
dynamicFees: dynamicFees.enabled ? dynamicFees : { enabled: false },
},
},
};
Expand Down
Loading

0 comments on commit 9a4397b

Please sign in to comment.