Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ jobs:
INDEXER_NETWORKS: '[8996]'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
FEE_AMOUNT: '{ "amount": 1, "unit": "MB" }'
SKIP_FEE_TOKEN_VALIDATION: 'true'
AUTHORIZED_DECRYPTERS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
P2P_ENABLE_UPNP: 'false'
P2P_ENABLE_AUTONAT: 'false'
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": "3.0.3",
"version": "3.0.31",
"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 @@ -138,6 +138,7 @@ export interface OceanNodeConfig {
unsafeURLs?: string[]
isBootstrap?: boolean
validateUnsignedDDO?: boolean
skipFeeTokenValidation?: boolean
jwtSecret?: string
httpCertPath?: string
httpKeyPath?: string
Expand Down
14 changes: 9 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@
// KeyManager will determine provider type from config.keys.type and initialize in constructor
const keyManager = new KeyManager(config)
const blockchainRegistry = new BlockchainRegistry(keyManager, config)
try {
await assertFeeTokensSupportedByOec(config, blockchainRegistry)
} catch (error) {
OCEAN_NODE_LOGGER.error(error instanceof Error ? error.message : String(error))
process.exit(1)
if (config.skipFeeTokenValidation) {
OCEAN_NODE_LOGGER.warn('Skipping FEE_TOKENS validation against OEC contracts')
} else {
try {
await assertFeeTokensSupportedByOec(config, blockchainRegistry)
} catch (error) {
OCEAN_NODE_LOGGER.error(error instanceof Error ? error.message : String(error))
process.exit(1)
}
}

if (config.hasP2P) {
Expand Down Expand Up @@ -160,7 +164,7 @@
if (config.httpCertPath && config.httpKeyPath) {
try {
const options = {
cert: fs.readFileSync(config.httpCertPath),

Check warning on line 167 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Found readFileSync from package "fs" with non literal argument at index 0
key: fs.readFileSync(config.httpKeyPath)
}
https.createServer(options, app).listen(config.httpPort, () => {
Expand Down
1 change: 1 addition & 0 deletions src/test/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ SECRET_ACCESS_KEY_S3=x87PklXIyyboglsDoZdOGt7YNvPWMpIjO3lOszv43sI
ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json
LOG_LEVEL=debug
DB_TYPE=elasticsearch
SKIP_FEE_TOKEN_VALIDATION=true
1 change: 1 addition & 0 deletions src/test/.env.test2
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PRIVATE_KEY='0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58'
CONFIG_PATH="$HOME/config.json"
SKIP_FEE_TOKEN_VALIDATION=true
1 change: 1 addition & 0 deletions src/utils/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const ENV_TO_CONFIG_MAPPING = {
DB_TYPE: 'DB_TYPE',
FEE_AMOUNT: 'FEE_AMOUNT',
FEE_TOKENS: 'FEE_TOKENS',
SKIP_FEE_TOKEN_VALIDATION: 'skipFeeTokenValidation',
HTTP_API_PORT: 'httpPort',
RPCS: 'supportedNetworks',
IPFS_GATEWAY: 'ipfsGateway',
Expand Down
1 change: 1 addition & 0 deletions src/utils/config/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ export const OceanNodeConfigSchema = z
FEE_AMOUNT: z.string().optional(),
FEE_TOKENS: z.string().optional(),
feeStrategy: FeeStrategySchema.optional(),
skipFeeTokenValidation: booleanFromString.optional().default(false),

httpPort: z.coerce.number().optional().default(3000),
rateLimit: z.coerce.number().optional().default(DEFAULT_RATE_LIMIT_PER_MINUTE),
Expand Down
5 changes: 5 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ export const ENVIRONMENT_VARIABLES: Record<any, EnvVariable> = {
},
FEE_TOKENS: { name: 'FEE_TOKENS', value: process.env.FEE_TOKENS, required: false },
FEE_AMOUNT: { name: 'FEE_AMOUNT', value: process.env.FEE_AMOUNT, required: false },
SKIP_FEE_TOKEN_VALIDATION: {
name: 'SKIP_FEE_TOKEN_VALIDATION',
value: process.env.SKIP_FEE_TOKEN_VALIDATION,
required: false
},
ADDRESS_FILE: {
name: 'ADDRESS_FILE',
value: process.env.ADDRESS_FILE,
Expand Down
Loading