Skip to content
Draft
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
64 changes: 53 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
IPFS_GATEWAY: http://172.15.0.16:8080/
ARWEAVE_GATEWAY: https://arweave.net/
RPCS: '{ "1": {"rpc": "https://rpc.eth.gateway.fm", "chainId": 1, "network": "mainet", "chunkSize": 100}, "137": {"rpc": "https://polygon.meowrpc.com", "chainId": 137, "network": "polygon", "chunkSize": 100 }, "80001": {"rpc": "https://rpc-mumbai.maticvigil.com","chainId": 80001, "network": "polygon-mumbai", "chunkSize": 100 } }'
DB_TYPE: 'typesense'
DB_URL: 'http://localhost:8108/?apiKey=xyz'
DB_TYPE: 'typesense'
DB_USERNAME: 'elastic'
DB_PASSWORD: 'changeme'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
Expand Down Expand Up @@ -122,9 +122,9 @@ jobs:
if: ${{ env.DOCKERHUB_PASSWORD && env.DOCKERHUB_USERNAME }}
run: |
echo "Login to Docker Hub";echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
run: |
Expand All @@ -145,6 +145,19 @@ jobs:
- name: docker logs
run: docker logs ocean-ocean-contracts-1 && docker logs ocean-typesense-1
if: ${{ failure() }}
- name: Set DOCKER_REGISTRY_AUTHS from Docker Hub secrets
if: env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD
run: |
DOCKER_REGISTRY_AUTHS=$(jq -n \
--arg username "$DOCKERHUB_USERNAME" \
--arg password "$DOCKERHUB_PASSWORD" \
'{ "https://registry-1.docker.io": { "username": $username, "password": $password } }')
echo "DOCKER_REGISTRY_AUTHS<<EOF" >> $GITHUB_ENV
echo "$DOCKER_REGISTRY_AUTHS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: integration tests
run: npm run test:integration:cover
env:
Expand All @@ -156,14 +169,13 @@ jobs:
IPFS_GATEWAY: http://172.15.0.16:8080/
ARWEAVE_GATEWAY: https://arweave.net/
RPCS: '{ "8996": {"rpc": "http://127.0.0.1:8545", "chainId": 8996, "network": "development", "chunkSize": 100}}'
DB_TYPE: 'typesense'
DB_URL: 'http://localhost:8108/?apiKey=xyz'
DB_USERNAME: 'elastic'
DB_PASSWORD: 'changeme'
DB_URL: 'http://localhost:9200'
DB_TYPE: 'elasticsearch'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
FEE_AMOUNT: '{ "amount": 1, "unit": "MB" }'
ASSET_PURGATORY_URL: 'https://raw.githubusercontent.com/oceanprotocol/list-purgatory/main/list-assets.json'
ACCOUNT_PURGATORY_URL: 'https://raw.githubusercontent.com/oceanprotocol/list-purgatory/main/list-accounts.json'
DOCKER_REGISTRY_AUTHS: ${{ env.DOCKER_REGISTRY_AUTHS }}
- name: docker logs
run: docker logs ocean-ocean-contracts-1 && docker logs ocean-typesense-1
if: ${{ failure() }}
Expand Down Expand Up @@ -239,7 +251,19 @@ jobs:
repository: 'OceanProtocolEnterprise/ocean-node'
path: 'ocean-node'
ref: ${{ github.event_name == 'pull_request' && github.head_ref || 'main' }}

- name: Set DOCKER_REGISTRY_AUTHS from Docker Hub secrets
if: env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD
run: |
DOCKER_REGISTRY_AUTHS=$(jq -n \
--arg username "$DOCKERHUB_USERNAME" \
--arg password "$DOCKERHUB_PASSWORD" \
'{ "https://registry-1.docker.io": { "username": $username, "password": $password } }')
echo "DOCKER_REGISTRY_AUTHS<<EOF" >> $GITHUB_ENV
echo "$DOCKER_REGISTRY_AUTHS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Start Ocean Node
working-directory: ${{ github.workspace }}/ocean-node
run: |
Expand All @@ -254,23 +278,24 @@ jobs:
HTTP_API_PORT: 8001
RPCS: '{ "8996": {"rpc": "http://127.0.0.1:8545", "chainId": 8996, "network": "development", "chunkSize": 100} }'
INDEXER_NETWORKS: '[8996]'
DB_URL: 'http://localhost:9200'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
FEE_AMOUNT: '{ "amount": 1, "unit": "MB" }'
AUTHORIZED_DECRYPTERS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
P2P_ENABLE_UPNP: 'false'
P2P_ENABLE_AUTONAT: 'false'
ALLOWED_ADMINS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
DB_TYPE: 'elasticsearch'
DB_URL: 'http://localhost:9200'
DB_USERNAME: 'elastic'
DB_PASSWORD: 'changeme'
MAX_REQ_PER_MINUTE: 320
MAX_CONNECTIONS_PER_MINUTE: 320
DOCKER_COMPUTE_ENVIRONMENTS: '[{"socketPath":"/var/run/docker.sock","resources":[{"id":"disk","total":10}],"storageExpiry":604800,"maxJobDuration":3600,"minJobDuration": 60,"fees":{"8996":[{"prices":[{"id":"cpu","price":1}]}]},"free":{"maxJobDuration":60,"minJobDuration": 10,"maxJobs":3,"resources":[{"id":"cpu","max":1},{"id":"ram","max":1},{"id":"disk","max":1}]}}]'
DOCKER_REGISTRY_AUTHS: ${{ env.DOCKER_REGISTRY_AUTHS }}
- name: Check Ocean Node is running
run: |
for i in $(seq 1 90); do
if curl --output /dev/null --silent --max-time 1 --head --fail "http://localhost:8001"; then
if curl --output /dev/null --silent --head --fail "http://localhost:8001"; then
echo "Ocean Node is up"
exit 0
fi
Expand All @@ -283,10 +308,27 @@ jobs:
with:
repository: 'oceanprotocol/ocean-cli'
path: 'ocean-cli'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'v20.19.0'
- name: Checkout Ocean-js
uses: actions/checkout@v4
with:
repository: 'oceanprotocol/ocean.js'
path: 'ocean.js'
ref: feature/refactor_signatures
- name: Build ocean-js
working-directory: ${{ github.workspace }}/ocean.js
run: |
npm ci
npm run build
npm link
- name: Setup Ocean CLI
working-directory: ${{ github.workspace }}/ocean-cli
run: |
npm ci
npm link @oceanprotocol/lib
npm run build
- name: Run system tests
working-directory: ${{ github.workspace }}/ocean-cli
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@oceanprotocol/contracts": "^2.5.0",
"@oceanprotocol/ddo-js": "^0.2.0",
"aws-sdk": "^2.1693.0",
"axios": "^1.12.0",
"axios": "^1.13.5",
"base58-js": "^2.0.0",
"cors": "^2.8.5",
"datastore-level": "^12.0.2",
Expand All @@ -85,7 +85,7 @@
"dotenv": "^16.3.1",
"eciesjs": "^0.4.5",
"eth-crypto": "^2.6.0",
"ethers": "^6.8.1",
"ethers": "^6.16.0",
"express": "^4.21.1",
"humanhash": "^1.0.4",
"hyperdiff": "^2.0.16",
Expand All @@ -98,7 +98,7 @@
"node-cron": "^3.0.3",
"sqlite3": "^5.1.7",
"stream-concat": "^1.0.0",
"tar": "^7.5.7",
"tar": "^7.5.8",
"uint8arrays": "^4.0.6",
"url-join": "^5.0.0",
"winston": "^3.11.0",
Expand Down
5 changes: 5 additions & 0 deletions src/@types/OceanNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export interface StorageTypes {
url: boolean
}

export interface AddressPerChain {
[chainId: string]: string
}

export interface OceanNodeStatus {
id: string
publicKey: string
Expand All @@ -179,6 +183,7 @@ export interface OceanNodeStatus {
p2p: boolean
provider: OceanNodeProvider[]
indexer: OceanNodeIndexer[]
escrowAddress: AddressPerChain
supportedStorage: StorageTypes
platform: any
uptime?: number // seconds since start
Expand Down
48 changes: 29 additions & 19 deletions src/@types/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export interface FindPeerCommand extends Command {
export interface GetP2PPeersCommand extends Command {}
export interface GetP2PNetworkStatsCommand extends Command {}

export interface AdminCommand extends Command {
expiryTimestamp: number
export interface SignedCommand extends Command {
nonce: string
signature: string
address?: string
address: string
}

export interface AdminCollectFeesHandlerResponse {
Expand Down Expand Up @@ -87,7 +87,6 @@ export interface ValidateDDOCommand extends Command {
publisherAddress?: string
nonce?: string
signature?: string
message?: string
}

export interface StatusCommand extends Command {
Expand Down Expand Up @@ -151,30 +150,49 @@ export interface GetFeesCommand extends Command {
policyServer?: any // object to pass to policyServer
}
// admin commands
export interface AdminStopNodeCommand extends AdminCommand {}
export interface AdminReindexTxCommand extends AdminCommand {
export interface AdminStopNodeCommand extends SignedCommand {}
export interface AdminReindexTxCommand extends SignedCommand {
chainId: number
txId: string
}

export interface AdminCollectFeesCommand extends AdminCommand {
export interface AdminCollectFeesCommand extends SignedCommand {
tokenAddress: string
chainId: number
tokenAmount?: number
destinationAddress: string
}

export interface AdminReindexChainCommand extends AdminCommand {
export interface AdminReindexChainCommand extends SignedCommand {
chainId: number
block?: number
}

export interface AdminFetchConfigCommand extends AdminCommand {}
export interface AdminFetchConfigCommand extends SignedCommand {}

export interface AdminPushConfigCommand extends AdminCommand {
export interface AdminPushConfigCommand extends SignedCommand {
config: Record<string, any>
}

export interface AdminGetLogsCommand extends SignedCommand {
logId?: string
startTime?: string
endTime?: string
maxLogs?: number
moduleName?: string
level?: string
page?: number
}
/* eslint-disable no-unused-vars */
export enum IndexingCommand {
STOP_THREAD = 'STOP_THREAD',
START_THREAD = 'START_THREAD'
}
export interface StartStopIndexingCommand extends SignedCommand {
chainId?: number
action: IndexingCommand
}

export interface ICommandHandler {
handle(command: Command): Promise<P2PCommandResponse>
verifyParamsAndRateLimits(task: Command): Promise<P2PCommandResponse>
Expand All @@ -185,7 +203,7 @@ export interface IValidateCommandHandler extends ICommandHandler {
}

export interface IValidateAdminCommandHandler extends ICommandHandler {
validate(command: AdminCommand): Promise<ValidateParams>
validate(command: SignedCommand): Promise<ValidateParams>
}

export interface ComputeGetEnvironmentsCommand extends Command {
Expand Down Expand Up @@ -276,14 +294,6 @@ export interface JobStatus {
status: CommandStatus
hash: string
}
export enum IndexingCommand {
STOP_THREAD = 'start',
START_THREAD = 'stop'
}
export interface StartStopIndexingCommand extends AdminCommand {
chainId?: number
action: IndexingCommand
}

export interface PolicyServerPassthroughCommand extends Command {
policyServerPassthrough?: any
Expand Down
6 changes: 3 additions & 3 deletions src/components/Auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface AuthValidation {
address?: string
nonce?: string
signature?: string
message?: string
command?: string
chainId?: string | null
}

Expand Down Expand Up @@ -79,7 +79,7 @@ export class Auth {
async validateAuthenticationOrToken(
authValidation: AuthValidation
): Promise<CommonValidation> {
const { token, address, nonce, signature, message, chainId } = authValidation
const { token, address, nonce, signature, command, chainId } = authValidation
try {
if (signature && address && nonce) {
const oceanNode = OceanNode.getInstance()
Expand All @@ -88,7 +88,7 @@ export class Auth {
address,
parseInt(nonce),
signature,
message,
command,
chainId
)

Expand Down
Loading
Loading