Skip to content

Remove vault.secrets.get from gateway; add workflow-based secret retrieval and cross-namespace E2E tests#21660

Open
prashantkumar1982 wants to merge 7 commits intodevelopfrom
vault-get-secret-workflow-test
Open

Remove vault.secrets.get from gateway; add workflow-based secret retrieval and cross-namespace E2E tests#21660
prashantkumar1982 wants to merge 7 commits intodevelopfrom
vault-get-secret-workflow-test

Conversation

@prashantkumar1982
Copy link
Contributor

@prashantkumar1982 prashantkumar1982 commented Mar 23, 2026

Summary

  • Remove vault.secrets.get from the gateway surface entirely. The method was conditionally enabled for dev builds via GetSupportedMethods(), but secrets should only be retrieved through workflows calling runtime.GetSecret(). This removes handleSecretsGet(), getEncryptionKeys(), the MethodSecretsGet switch cases in both the node-side and gateway-side handlers, the special-case in the aggregator, and the now-unused capRegistry field from GatewayHandler.
  • Add a WASM workflow (vaultsecret) that calls runtime.GetSecret() to replace the previously commented-out gateway-based get test. The workflow is configured with a secret key, namespace, and an ExpectNotFound flag for negative testing.
  • Add cross-namespace E2E coverage in ExecuteVaultTest: creates two secrets with the same ID in namespaces "main" and "alt", then verifies that create, get (via workflow), update, list, and delete are all scoped to their respective namespace — updating or deleting in one namespace does not affect the other.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

✅ No conflicts with other open PRs targeting develop

@github-actions
Copy link
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@trunk-io
Copy link

trunk-io bot commented Mar 24, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

…etrieval tests

Remove the `vault.secrets.get` method from the gateway surface entirely:
- Remove `GetSupportedMethods()` dev-build conditional that exposed the method
- Remove `handleSecretsGet()` and `getEncryptionKeys()` from the gateway handler
- Remove the `MethodSecretsGet` case from the gateway-side handler and aggregator
- Remove the now-unused `capRegistry` field from `GatewayHandler`

Replace the commented-out gateway-based get test with a WASM workflow that calls
`runtime.GetSecret()`, and add cross-namespace E2E coverage proving that secrets
with the same ID in different namespaces are fully independent (create, get,
update, list, delete all scoped to their namespace).

Made-with: Cursor
- In the vaultsecret WASM workflow, check that the GetSecret error
  specifically contains "key does not exist" instead of accepting any
  error as proof the secret was deleted. This prevents config-propagation,
  transport, or decryption failures from masking real bugs.
- In updateVaultCapabilityConfigInRegistry, replace the fire-and-sleep
  pattern with sethClient.WaitMined + receipt status assertion so a
  reverted or stuck tx fails the test immediately instead of causing
  a downstream workflow flake.

Made-with: Cursor
- Fix goimports import ordering in v2_vault_don_test.go
- Add vaultsecret module to go.md dependency graph
- Fix updateVaultCapabilityConfigInRegistry to dynamically find the DON
  that has vault@1.0.0 instead of hardcoding "workflow-don", which fails
  in the workflow-gateway-capabilities topology where vault lives on
  "capabilities-don"

Made-with: Cursor
…n in multi-DON topology

In the workflow-gateway-capabilities topology, the vault capability runs
on a separate capabilities-don. Without MethodConfigs, the launcher
treats vault as a V1 capability and passes nil transmissionConfig. Since
secrets.go doesn't set Config on the CapabilityRequest, the V1 fallback
path fails with "cannot unwrap nil values.Map" when extracting
transmission config.

Adding RemoteExecutableConfig for the vault.secrets.get method ensures
the V2 Don2Don framework is used, which sets transmissionConfig from the
on-chain registry config rather than requiring it per-request.
@prashantkumar1982 prashantkumar1982 force-pushed the vault-get-secret-workflow-test branch from 652a213 to 4ba906e Compare March 24, 2026 04:20
deployerKey, err := crypto.HexToECDSA(ctfblockchain.DefaultAnvilPrivateKey)
require.NoError(t, err, "failed to parse deployer private key")
deployerOpts, err := bind.NewKeyedTransactorWithChainID(deployerKey, big.NewInt(sethClient.ChainID))
require.NoError(t, err, "failed to create deployer transact opts")
Copy link
Contributor

@Tofel Tofel Mar 24, 2026

Choose a reason for hiding this comment

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

you can delete this and use seth directly, check the comment below


receipt, err := sethClient.WaitMined(t.Context(), testLogger, sethClient.Client, tx)
require.NoError(t, err, "UpdateDONByName tx was not mined")
require.Equal(t, uint64(1), receipt.Status, "UpdateDONByName tx reverted on-chain")
Copy link
Contributor

Choose a reason for hiding this comment

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

you can replace these 5 lines above + deployerOpts with:

_, err = sethClient.Decode(capReg.UpdateDONByName(sethClient.NewTxOpts(), don.Name, updateParams)`

It will return only once tx is mined. if it reverted then err != nil.

Copy link
Contributor

@Tofel Tofel left a comment

Choose a reason for hiding this comment

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

Please parallelise the newly added tests inside that big Vault test. We can't merge as-is, because that test becomes by far the longest running one and goes against our efforts to speed up CI.
Image

…duce sleeps

- Split ExecuteVaultTest into two parallel subtests (basic_crud +
  cross_namespace), each with its own per-test keys, ChIP sink, and
  channels. Follows the same pattern as HTTP Action tests. When
  parallelEnabled && fanoutEnabled, both subtests run concurrently.
- Replace manual deployerKey/deployerOpts + WaitMined + receipt check
  with a deployer seth client and sethClient.Decode() per Tofel's review.
- Remove redundant 30s "Vault DON ready" sleep.
- Reduce registry syncer wait from 30s to 15s (polls every 12s).
- Reduce allowlist sleep from 10s to 6s (polls every 5s).
- Remove unused consensus workflow deployment from vault test setup.
Each subtest creates a new per-test key that hasn't completed the
linkOwner flow on the workflow registry. Call creworkflow.LinkOwner()
explicitly before any allowlistRequest operations.

Made-with: Cursor
@cl-sonarqube-production
Copy link

@Tofel Tofel self-requested a review March 25, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants