Skip to content

Commit

Permalink
Merge branch 'main' into feature/new-ddo-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Dec 17, 2024
2 parents fd0686a + cb3bcb1 commit ed870c8
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 7 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,54 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.2.1](https://github.com/oceanprotocol/ocean-node/compare/v0.2.0...v0.2.1)

- have bootstrap config var [`#782`](https://github.com/oceanprotocol/ocean-node/pull/782)
- Removing unused express dependency from dashboard [`#761`](https://github.com/oceanprotocol/ocean-node/pull/761)
- check if rpcs and indexer_networks are aligned, log [`#750`](https://github.com/oceanprotocol/ocean-node/pull/750)
- remove node 16 image references [`#759`](https://github.com/oceanprotocol/ocean-node/pull/759)
- try debug and fix randomly logs failing test [`#752`](https://github.com/oceanprotocol/ocean-node/pull/752)
- fix dashboard hash out of sync [`#744`](https://github.com/oceanprotocol/ocean-node/pull/744)
- improve reindex command, optional block, also check if thread is running [`#747`](https://github.com/oceanprotocol/ocean-node/pull/747)
- Add cleaner logging when idexing and getting/updating block info from db [`#743`](https://github.com/oceanprotocol/ocean-node/pull/743)
- Add INDEXER_NETWORKS env var within CI job. [`#734`](https://github.com/oceanprotocol/ocean-node/pull/734)
- fix system tests. Running old version of node? [`#733`](https://github.com/oceanprotocol/ocean-node/pull/733)
- rm console.logs [`#731`](https://github.com/oceanprotocol/ocean-node/pull/731)
- fix wrong block for log [`#727`](https://github.com/oceanprotocol/ocean-node/pull/727)
- nonce db sql lite [`#723`](https://github.com/oceanprotocol/ocean-node/pull/723)
- Bump version axios 1.6.0 -> 1.7.4. [`#716`](https://github.com/oceanprotocol/ocean-node/pull/716)
- Bump version express 4.18.2 -> 4.21.0. [`#717`](https://github.com/oceanprotocol/ocean-node/pull/717)
- Feature/ add Elasticsearch database alternative for typesense [`#599`](https://github.com/oceanprotocol/ocean-node/pull/599)
- Database tests 2db [`#707`](https://github.com/oceanprotocol/ocean-node/pull/707)
- add credentials at service level, on schemas [`#710`](https://github.com/oceanprotocol/ocean-node/pull/710)
- Bump micromatch from 4.0.5 to 4.0.8 in /dashboard [`#649`](https://github.com/oceanprotocol/ocean-node/pull/649)
- Bump undici from 5.27.0 to 5.28.4 [`#610`](https://github.com/oceanprotocol/ocean-node/pull/610)
- testing changes [`#718`](https://github.com/oceanprotocol/ocean-node/pull/718)
- Policy Server [`#694`](https://github.com/oceanprotocol/ocean-node/pull/694)
- fix missing/invalid db_url log message, put warn at startup [`#654`](https://github.com/oceanprotocol/ocean-node/pull/654)
- move c2d engines under OceanNode class [`#702`](https://github.com/oceanprotocol/ocean-node/pull/702)
- improve error message, transfer fees and tweak node response [`#701`](https://github.com/oceanprotocol/ocean-node/pull/701)
- fix default filtered p2p ip list (non routable ips that should not be announced) [`#699`](https://github.com/oceanprotocol/ocean-node/pull/699)
- chore: add datatokenaddress in order table [`#700`](https://github.com/oceanprotocol/ocean-node/pull/700)
- fixing tests [`#703`](https://github.com/oceanprotocol/ocean-node/pull/703)
- Updating deprecated actions [`#681`](https://github.com/oceanprotocol/ocean-node/pull/681)
- add access control to service level [`#698`](https://github.com/oceanprotocol/ocean-node/pull/698)
- customize boostrap params [`#696`](https://github.com/oceanprotocol/ocean-node/pull/696)
- Issue 668 oasis decryption [`#679`](https://github.com/oceanprotocol/ocean-node/pull/679)
- Add max ram memory in node start cmd [`#697`](https://github.com/oceanprotocol/ocean-node/pull/697)
- Feature/add elasticdb search [`#695`](https://github.com/oceanprotocol/ocean-node/pull/695)
- fix: search and nonce [`#688`](https://github.com/oceanprotocol/ocean-node/pull/688)
- Issue 501 - C2D getJobStatus - did vs documentId vs agreementId [`#502`](https://github.com/oceanprotocol/ocean-node/pull/502)
- Feature/add elasticdb tvl [`#677`](https://github.com/oceanprotocol/ocean-node/pull/677)
- Renaming dashboard as Control Panel [`#674`](https://github.com/oceanprotocol/ocean-node/pull/674)
- add new schema + tests [`a648cb3`](https://github.com/oceanprotocol/ocean-node/commit/a648cb38df2dea537ca28e67ae4bf1113c9b287d)
- normalize responses [`584b6c0`](https://github.com/oceanprotocol/ocean-node/commit/584b6c09c67fb66fee7d0d01cca51693ea2a3723)
- first draft [`b3afc02`](https://github.com/oceanprotocol/ocean-node/commit/b3afc02219233af4026c43b886bf97c0a2edb323)

#### [v0.2.0](https://github.com/oceanprotocol/ocean-node/compare/v0.1.0...v0.2.0)

> 9 September 2024
- Downgrade indexer errors [`#675`](https://github.com/oceanprotocol/ocean-node/pull/675)
- Update system requirements: change iOS to macOS [`#673`](https://github.com/oceanprotocol/ocean-node/pull/673)
- Fix crash on connection reset - P2P streams [`#659`](https://github.com/oceanprotocol/ocean-node/pull/659)
Expand Down
1 change: 1 addition & 0 deletions docs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Environmental variables are also tracked in `ENVIRONMENT_VARIABLES` within `src/
- `RATE_DENY_LIST`: Blocked list of IPs and peer IDs. Example: `"{ \"peers\": [\"16Uiu2HAkuYfgjXoGcSSLSpRPD6XtUgV71t5RqmTmcqdbmrWY9MJo\"], \"ips\": [\"127.0.0.1\"] }"`
- `MAX_REQ_PER_SECOND`: Number of requests per second allowed by the same client. Example: `3`
- `MAX_CHECKSUM_LENGTH`: Define the maximum length for a file if checksum is required (Mb). Example: `10`
- `IS_BOOTSTRAP`: Is this node to be used as bootstrap node or not. Default is `false`.

## Logs

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ocean-node",
"version": "0.2.0",
"version": "0.2.1",
"description": "Ocean Node is used to run all core services in the Ocean stack",
"author": "Ocean Protocol Foundation",
"license": "Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions src/@types/OceanNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface OceanNodeConfig {
rateLimit?: number
denyList?: DenyList
unsafeURLs?: string[]
isBootstrap?: boolean
}

export interface P2PStatusResponse {
Expand Down
8 changes: 6 additions & 2 deletions src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ export class OceanP2P extends EventEmitter {
this._protocol = '/ocean/nodes/1.0.0'

// this._interval = setInterval(this._pollPeers.bind(this), this._options.pollInterval)
this._libp2p.handle(this._protocol, handleProtocolCommands.bind(this))

// only enable handling of commands if not bootstrap node
if (!this._config.isBootstrap) {
this._libp2p.handle(this._protocol, handleProtocolCommands.bind(this))
}

setInterval(this.republishStoredDDOS.bind(this), REPUBLISH_INTERVAL_HOURS)

Expand Down Expand Up @@ -775,7 +779,7 @@ export class OceanP2P extends EventEmitter {
// related: https://github.com/libp2p/go-libp2p-kad-dht/issues/323
async republishStoredDDOS() {
try {
if (!this.db) {
if (!this.db || !this.db.ddo) {
P2P_LOGGER.logMessage(
`republishStoredDDOS() attempt aborted because there is no database!`,
true
Expand Down
14 changes: 12 additions & 2 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { C2DClusterType } from '../@types/C2D.js'
import { createFromPrivKey } from '@libp2p/peer-id-factory'
import { keys } from '@libp2p/crypto'
import {
computeCodebaseHash,
DEFAULT_RATE_LIMIT_PER_SECOND,
ENVIRONMENT_VARIABLES,
EnvVariable,
Expand All @@ -26,6 +27,8 @@ import {
} from '../utils/address.js'
import { CONFIG_LOGGER } from './logging/common.js'
import { create256Hash } from './crypt.js'
import { fileURLToPath } from 'url'
import path from 'path'

// usefull for lazy loading and avoid boilerplate on other places
let previousConfiguration: OceanNodeConfig = null
Expand Down Expand Up @@ -475,6 +478,12 @@ export async function getConfiguration(
if (!previousConfiguration || forceReload) {
previousConfiguration = await getEnvConfig(isStartup)
}
if (!previousConfiguration.codeHash) {
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename.replace('utils/', ''))
previousConfiguration.codeHash = await computeCodebaseHash(__dirname)
}

return previousConfiguration
}

Expand Down Expand Up @@ -549,7 +558,7 @@ async function getEnvConfig(isStartup?: boolean): Promise<OceanNodeConfig> {
),
dhtMaxInboundStreams: getIntEnvValue(process.env.P2P_dhtMaxInboundStreams, 500),
dhtMaxOutboundStreams: getIntEnvValue(process.env.P2P_dhtMaxOutboundStreams, 500),
enableDHTServer: getBoolEnvValue(process.env.P2P_ENABLE_DHT_SERVER, false),
enableDHTServer: getBoolEnvValue('P2P_ENABLE_DHT_SERVER', false),
mDNSInterval: getIntEnvValue(process.env.P2P_mDNSInterval, 20e3), // 20 seconds
connectionsMaxParallelDials: getIntEnvValue(
process.env.P2P_connectionsMaxParallelDials,
Expand Down Expand Up @@ -616,7 +625,8 @@ async function getEnvConfig(isStartup?: boolean): Promise<OceanNodeConfig> {
ENVIRONMENT_VARIABLES.UNSAFE_URLS,
isStartup,
knownUnsafeURLs
)
),
isBootstrap: getBoolEnvValue('IS_BOOTSTRAP', false)
}

if (!previousConfiguration) {
Expand Down
5 changes: 5 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ export const ENVIRONMENT_VARIABLES: Record<any, EnvVariable> = {
name: 'DB_TYPE',
value: process.env.DB_TYPE,
required: false
},
IS_BOOTSTRAP: {
name: 'IS_BOOTSTRAP',
value: process.env.IS_BOOTSTRAP,
required: false
}
}

Expand Down

0 comments on commit ed870c8

Please sign in to comment.