Skip to content

Commit

Permalink
Merge remote-tracking branch 'ArkEcosystem/core/2.6' into add-nonce-t…
Browse files Browse the repository at this point in the history
…o-db

* ArkEcosystem/core/2.6:
  release: 2.5.0-next.10 (#2852)
  fix(core-p2p): ensure payload database exists (#2851)
  release: 2.5.14
  release: 2.5.14 (#2849)
  fix(core-p2p): peer discovery limit (#2850)
  perf(core-p2p): improve transactions endpoint (#2848)
  fix(core-api): internal server error caused by invalid orderBy field (#2847)
  refactor(core-p2p): increase network timeouts (#2828)
  fix(core-api): return data directly if cache is disabled (#2831)
  fix(core-utils): add content-type header (#2840)
  perf(core-database): lookup delegates by key (#2837)
  • Loading branch information
vasild committed Aug 2, 2019
2 parents 7f6b8bd + 2cc09cf commit 284ccf6
Show file tree
Hide file tree
Showing 50 changed files with 434 additions and 184 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.5.14] - 2019-07-30

### Fixed

- Add content-type header for all requests ([#2840])
- Return data directly if cache is disabled in `core-api` ([#2831])
- Internal server error caused by invalid orderBy field in `core-api` ([#2847])
- Peer discovery limit ([#2850])

### Changed

- Lookup delegates by key to improve performance ([#2837])
- Add ntp and google servers for ntpd to docker image ([#2823])
- Improve performance of transactions endpoint in `core-p2p` ([#2848])

## [2.5.7] - 2019-07-16

### Fixed
Expand Down Expand Up @@ -591,6 +606,7 @@ Closed security vulnerabilities:
- Initial Release

[unreleased]: https://github.com/ARKEcosystem/core/compare/master...develop
[2.5.14]: https://github.com/ARKEcosystem/core/compare/2.5.7...2.5.14
[2.5.7]: https://github.com/ARKEcosystem/core/compare/2.5.1...2.5.7
[2.5.1]: https://github.com/ARKEcosystem/core/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/ARKEcosystem/core/compare/2.4.14...2.5.0
Expand Down Expand Up @@ -914,3 +930,10 @@ Closed security vulnerabilities:
[#2808]: https://github.com/ARKEcosystem/core/pull/2808
[#2809]: https://github.com/ARKEcosystem/core/pull/2809
[#2810]: https://github.com/ARKEcosystem/core/pull/2810
[#2840]: https://github.com/ARKEcosystem/core/pull/2840
[#2831]: https://github.com/ARKEcosystem/core/pull/2831
[#2847]: https://github.com/ARKEcosystem/core/pull/2847
[#2837]: https://github.com/ARKEcosystem/core/pull/2837
[#2823]: https://github.com/ARKEcosystem/core/pull/2823
[#2848]: https://github.com/ARKEcosystem/core/pull/2848
[#2850]: https://github.com/ARKEcosystem/core/pull/2850
7 changes: 4 additions & 3 deletions __tests__/integration/core-p2p/socket-server/peer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ describe("Peer socket endpoint", () => {
.withPassphrase("one two three")
.create(15);

// TODO: test makes no sense anymore
await expect(
emit("p2p.peer.postTransactions", {
data: { transactions },
headers,
}),
).rejects.toThrowError("The payload contains invalid transaction.");

).toResolve();
// because our mocking makes all transactions to be invalid (already in cache)
});

Expand All @@ -116,12 +116,13 @@ describe("Peer socket endpoint", () => {
.withPassphrase("one two three")
.create(50);

// TODO: test makes no sense anymore
await expect(
emit("p2p.peer.postTransactions", {
data: { transactions },
headers,
}),
).rejects.toHaveProperty("name", "CoreValidationError");
).toResolve();
});
});
});
Expand Down
32 changes: 32 additions & 0 deletions __tests__/unit/core-p2p/network-monitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,38 @@ describe("NetworkMonitor", () => {

validatePeerIp.mockRestore();
});

it("should only pick up to 50 returned peers from a peer", async () => {
storage.setPeer(
createStubPeer({
ip: "1.2.3.4",
port: 4000,
}),
);

// @ts-ignore
monitor.config = { ignoreMinimumNetworkReach: true };

const mockPeers = [];
for (let i = 0; i < 100; i++) {
mockPeers.push({ ip: `3.3.3.${i + 1}` });
mockPeers.push({ ip: `3.3.${i + 1}.3` });
mockPeers.push({ ip: `3.${i + 1}.3.3` });
mockPeers.push({ ip: `${i + 1}.3.3.3` });
}

communicator.getPeers = jest.fn().mockReturnValue(mockPeers);

const validateAndAcceptPeer = jest.spyOn(processor, "validateAndAcceptPeer");
const validatePeerIp = jest.spyOn(processor, "validatePeerIp").mockReturnValue(true);

await expect(monitor.discoverPeers(true)).resolves.toBeTrue();

expect(validateAndAcceptPeer).toHaveBeenCalledTimes(50);

validateAndAcceptPeer.mockReset();
validatePeerIp.mockRestore();
});
});

describe("getNetworkHeight", () => {
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.5.7"
"version": "2.5.0-next.10"
}
14 changes: 7 additions & 7 deletions packages/core-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-api",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Public API for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -21,12 +21,12 @@
"pretest": "bash ../../scripts/pre-test.sh"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-http-utils": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/core-transaction-pool": "^2.5.7",
"@arkecosystem/core-utils": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@arkecosystem/core-http-utils": "^2.5.0-next.10",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/core-transaction-pool": "^2.5.0-next.10",
"@arkecosystem/core-utils": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"@arkecosystem/utils": "^0.3.0",
"@hapi/boom": "^7.4.2",
"@hapi/joi": "^15.1.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/core-api/src/handlers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { app } from "@arkecosystem/core-container";
import Boom from "@hapi/boom";
import Hapi from "@hapi/hapi";
import { transformerService } from "../services/transformer";
Expand Down Expand Up @@ -30,6 +31,10 @@ export const respondWithCollection = (data, transformer, transform: boolean = tr
};

export const respondWithCache = (data, h): any => {
if (!app.resolveOptions("api").cache.enabled) {
return data;
}

const { value, cached } = data;
const lastModified = cached ? new Date(cached.stored) : new Date();

Expand Down
20 changes: 10 additions & 10 deletions packages/core-blockchain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-blockchain",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Blockchain Manager for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -22,14 +22,14 @@
"pretest": "bash ../../scripts/pre-test.sh"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-database": "^2.5.7",
"@arkecosystem/core-event-emitter": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/core-state": "^2.5.7",
"@arkecosystem/core-transactions": "^2.5.7",
"@arkecosystem/core-utils": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@arkecosystem/core-database": "^2.5.0-next.10",
"@arkecosystem/core-event-emitter": "^2.5.0-next.10",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/core-state": "^2.5.0-next.10",
"@arkecosystem/core-transactions": "^2.5.0-next.10",
"@arkecosystem/core-utils": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"async": "^3.1.0",
"delay": "^4.3.0",
"immutable": "^4.0.0-rc.12",
Expand All @@ -39,7 +39,7 @@
"xstate": "^4.6.7"
},
"devDependencies": {
"@arkecosystem/core-p2p": "^2.5.7",
"@arkecosystem/core-p2p": "^2.5.0-next.10",
"@types/async": "^3.0.0",
"@types/lodash.get": "^4.4.6",
"@types/pluralize": "^0.0.29",
Expand Down
6 changes: 3 additions & 3 deletions packages/core-container/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-container",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Container for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -19,8 +19,8 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"@hapi/hoek": "^8.0.2",
"@hapi/joi": "^15.1.0",
"awilix": "^4.2.2",
Expand Down
16 changes: 8 additions & 8 deletions packages/core-database-postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-database-postgres",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "PostgreSQL integration for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -21,13 +21,13 @@
"pretest": "bash ../../scripts/pre-test.sh"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-database": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/core-state": "^2.5.7",
"@arkecosystem/core-transactions": "^2.5.7",
"@arkecosystem/core-utils": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@arkecosystem/core-database": "^2.5.0-next.10",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/core-state": "^2.5.0-next.10",
"@arkecosystem/core-transactions": "^2.5.0-next.10",
"@arkecosystem/core-utils": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"@arkecosystem/utils": "^0.3.0",
"bluebird": "^3.5.5",
"cpy-cli": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export abstract class Repository implements Database.IRepository {
if (column) {
selectQuery.order(column[o.direction]);
}

selectQuery.order(this.query[o.field][o.direction]);
}
}

Expand Down
16 changes: 8 additions & 8 deletions packages/core-database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-database",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Database Interface for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -22,13 +22,13 @@
"pretest": "bash ../../scripts/pre-test.sh"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-event-emitter": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/core-state": "^2.5.7",
"@arkecosystem/core-transactions": "^2.5.7",
"@arkecosystem/core-utils": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@arkecosystem/core-event-emitter": "^2.5.0-next.10",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/core-state": "^2.5.0-next.10",
"@arkecosystem/core-transactions": "^2.5.0-next.10",
"@arkecosystem/core-utils": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"@arkecosystem/utils": "^0.3.0",
"lodash.clonedeep": "^4.5.0",
"lodash.compact": "^3.0.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/core-elasticsearch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-elasticsearch",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "A powerful Elasticsearch integration for ARK Core",
"license": "MIT",
"contributors": [
Expand All @@ -18,11 +18,11 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-event-emitter": "^2.5.7",
"@arkecosystem/core-http-utils": "^2.5.7",
"@arkecosystem/core-interfaces": "^2.5.7",
"@arkecosystem/crypto": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@arkecosystem/core-event-emitter": "^2.5.0-next.10",
"@arkecosystem/core-http-utils": "^2.5.0-next.10",
"@arkecosystem/core-interfaces": "^2.5.0-next.10",
"@arkecosystem/crypto": "^2.5.0-next.10",
"@elastic/elasticsearch": "^7.2.0",
"@hapi/boom": "^7.4.2",
"@hapi/joi": "^15.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/core-error-tracker-airbrake/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-error-tracker-airbrake",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Airbrake error tracker integration for ARK Core.",
"license": "MIT",
"contributors": [
Expand All @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"airbrake-js": "^1.6.8"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core-error-tracker-bugsnag/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-error-tracker-bugsnag",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Bugsnag error tracker integration for ARK Core.",
"license": "MIT",
"contributors": [
Expand All @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@bugsnag/js": "^6.3.2"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core-error-tracker-raygun/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-error-tracker-raygun",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Raygun error tracker integration for ARK Core.",
"license": "MIT",
"contributors": [
Expand All @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"raygun": "^0.10.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core-error-tracker-rollbar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-error-tracker-rollbar",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Rollbar error tracker integration for ARK Core.",
"license": "MIT",
"contributors": [
Expand All @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"rollbar": "^2.8.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core-error-tracker-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkecosystem/core-error-tracker-sentry",
"version": "2.5.7",
"version": "2.5.0-next.10",
"description": "Sentry error tracker integration for ARK Core.",
"license": "MIT",
"contributors": [
Expand All @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@arkecosystem/core-container": "^2.5.7",
"@arkecosystem/core-container": "^2.5.0-next.10",
"@sentry/node": "^5.5.0"
},
"engines": {
Expand Down
Loading

0 comments on commit 284ccf6

Please sign in to comment.