Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
be36f41
feat: add logs to get/push config p2p handlers
ndrpp Dec 16, 2025
31447b4
feat: use ERC1271 validation function for smart account calls
ndrpp Dec 16, 2025
bb9a1bb
feat: improve admin validation + add more logs for debugging
ndrpp Dec 16, 2025
fa46ce7
fix: hex the input message in case it's a smart account signature
ndrpp Dec 17, 2025
f06f952
chore: cleanup
ndrpp Dec 17, 2025
c1c1a18
fix: use correct hashing function for smart wallets sig validation
ndrpp Dec 17, 2025
d8eedfd
fix: use correct chainId for validation
ndrpp Dec 17, 2025
f6d91fc
Merge branch 'main' into fix/p2p-get-push-node-config
ndrpp Dec 18, 2025
dbac8fe
feat: pass address from http handlers to p2p | update config on push
ndrpp Dec 19, 2025
1d1e92d
feat: check if node has running jobs before updating config
ndrpp Dec 19, 2025
3221f0e
Merge branch 'main' into fix/p2p-get-push-node-config
ndrpp Jan 7, 2026
0ea6af9
test: add reject push config test when running jobs exist
ndrpp Jan 7, 2026
882abbc
test: add logs
ndrpp Jan 7, 2026
71bbb49
test: properly stop running jobs for push config tests
ndrpp Jan 7, 2026
a57b05c
test: change integration tests order
ndrpp Jan 7, 2026
4707021
test: retry stopping jobs before push config handler test calls
ndrpp Jan 7, 2026
54ba953
Revert "test: retry stopping jobs before push config handler test calls"
ndrpp Jan 7, 2026
84f31f6
Merge branch 'main' into fix/p2p-get-push-node-config
ndrpp Jan 7, 2026
3d639a0
fix: remove redundant check for running jobs on push config
ndrpp Jan 8, 2026
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
10 changes: 10 additions & 0 deletions src/OceanNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ export class OceanNode {
return this.auth
}

public setConfig(config: OceanNodeConfig) {
this.config = config
if (this.config) {
this.escrow = new Escrow(
this.config.supportedNetworks,
this.config.claimDurationTimeout
)
}
}

/**
* Use this method to direct calls to the node as node cannot dial into itself
* @param message command message
Expand Down
14 changes: 12 additions & 2 deletions src/components/core/admin/pushConfigHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export class PushConfigHandler extends AdminCommandHandler {
}

try {
const hasRunningJobs =
(await this.getOceanNode().getDatabase().c2d.getRunningJobs()).length > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have this condition?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to restart the engine to apply the new configuration and I thought this would interfere with existing running jobs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested locally and seems I was solving an issue that did not exist, you were right 😄

if (hasRunningJobs) {
throw new Error('Node has running jobs')
}

const configPath = getConfigFilePath()
const configContent = await fs.promises.readFile(configPath, 'utf-8')
const currentConfig = JSON.parse(configContent)
Expand All @@ -59,13 +65,17 @@ export class PushConfigHandler extends AdminCommandHandler {
await this.saveConfigToFile(mergedConfig)

const newConfig = await getConfiguration(true, false)
newConfig.keys.privateKey = '[*** HIDDEN CONTENT ***]'
this.getOceanNode().setConfig(newConfig)
await this.getOceanNode().addC2DEngines()

const responseConfig = structuredClone(newConfig)
responseConfig.keys.privateKey = '[*** HIDDEN CONTENT ***]'
CORE_LOGGER.logMessage('Configuration reloaded successfully')

return new Promise<P2PCommandResponse>((resolve) => {
resolve({
status: { httpStatus: 200 },
stream: new ReadableString(JSON.stringify(newConfig))
stream: new ReadableString(JSON.stringify(responseConfig))
})
})
} catch (error) {
Expand Down
10 changes: 6 additions & 4 deletions src/components/httpRoutes/adminConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ export const adminConfigRoutes = express.Router()

adminConfigRoutes.get('/api/admin/config', express.json(), async (req, res) => {
try {
const { expiryTimestamp, signature } = req.body
const { expiryTimestamp, signature, address } = req.body

const response = await new FetchConfigHandler(req.oceanNode).handle({
command: PROTOCOL_COMMANDS.FETCH_CONFIG,
expiryTimestamp,
signature
signature,
address
})

if (response.status.httpStatus === 200) {
Expand All @@ -33,13 +34,14 @@ adminConfigRoutes.get('/api/admin/config', express.json(), async (req, res) => {

adminConfigRoutes.post('/api/admin/config/update', express.json(), async (req, res) => {
try {
const { expiryTimestamp, signature, config } = req.body
const { expiryTimestamp, signature, config, address } = req.body

const response = await new PushConfigHandler(req.oceanNode).handle({
command: PROTOCOL_COMMANDS.PUSH_CONFIG,
expiryTimestamp,
signature,
config
config,
address
})

if (response.status.httpStatus === 200) {
Expand Down
Loading