Skip to content

fix(dashmate): local nodes missing envs after group reset#839

Closed
pshenmic wants to merge 8 commits into
v0.24-devfrom
fix/dashmate-group-reset
Closed

fix(dashmate): local nodes missing envs after group reset#839
pshenmic wants to merge 8 commits into
v0.24-devfrom
fix/dashmate-group-reset

Conversation

@pshenmic

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

After dashmate group reset, nodes fails to start due some contracts private key is missing

#785

What was done?

Moved contracts private keys generation in the separate factory and used it in the setup and reset phases

How Has This Been Tested?

Locally

Breaking Changes

No

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@pshenmic
pshenmic changed the base branch from v0.24-dev to master March 21, 2023 13:13
* @param {generateHDPrivateKeys} generateHDPrivateKeys
* @return {configureTenderdashTask}
*/
function configureContractsPrivateKeysTaskFactory(generateHDPrivateKeys) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

generateSystemDataContractKeysTask

config.set('platform.featureFlags', baseConfig.platform.featureFlags);
config.set('platform.masternodeRewardShares', baseConfig.platform.masternodeRewardShares);

subTasks.unshift({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why so?

@pshenmic
pshenmic changed the base branch from master to v0.24-dev April 18, 2023 19:05
…up-reset

# Conflicts:
#	packages/dashmate/src/commands/group/reset.js
#	packages/dashmate/src/createDIContainer.js
#	packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
Comment on lines +66 to +76
// eslint-disable-next-line no-param-reassign
task.output = `DPNS Private Key: ${dpnsPrivateKey.toString()}`;

// eslint-disable-next-line no-param-reassign
task.output = `Feature Flags Private Key: ${featureFlagsPrivateKey.toString()}`;

// eslint-disable-next-line no-param-reassign
task.output = `Dashpay Private Key: ${dashpayPrivateKey.toString()}`;

// eslint-disable-next-line no-param-reassign
task.output = `Masternode Reward Shares Private Key: ${masternodeRewardSharesPrivateKey.toString()}`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we don't need this anymore

const subTasks = ctx.configGroup.map((config, i) => (
{
title: `Create ${config.getName()} config`,
// eslint-disable-next-line consistent-return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Bad idea

task: () => generateSystemDataContractKeysTask(config, config.get('network')),
},
{
task: () => resetNodeTask(config),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Didn't we reset config there?

task: () => resetNodeTask(config),
},
{
task: () => generateSystemDataContractKeysTask(config, config.get('network')),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did you test it? I think it won't work because all configs will have different keys now so init chain won't be deterministic. If you see how it worked before. We generated it once on setup and set to all configs. You should do the same

@pshenmic
pshenmic marked this pull request as draft April 20, 2023 14:11
@pshenmic

pshenmic commented May 1, 2023

Copy link
Copy Markdown
Collaborator Author

Fixed in #991

@pshenmic pshenmic closed this May 1, 2023
@shumkov
shumkov deleted the fix/dashmate-group-reset branch August 25, 2024 08:51
shumkov added a commit that referenced this pull request Jul 4, 2026
Bring the branch up to v4.1-dev, which bumps rust-dashcore to afcff156:
key-wallet now impls `Zeroize` + `Drop` on `ExtendedPrivKey`, and
`extended_public_key` moved into the new `ExtendedPubKeySigner` subtrait.

Conflicts resolved (take base's rust-dashcore, afcff156):
- Cargo.toml / Cargo.lock: base's afcff156 rev.
- packages/rs-sdk-ffi/src/mnemonic_resolver_core_signer.rs: reconcile the
  derive-sign-destroy zeroization with the upstream change.
  - `WipingXprv` REMOVED — it was a local workaround for `ExtendedPrivKey`
    having no `Drop`, which key-wallet now provides (dashcore PR #833, added
    specifically for this signer). The bare value self-wipes on every path.
  - `WipingSecretKey` KEPT — the `secp256k1::SecretKey` copy at the two sign
    sites is the one key intermediate #833 cannot cover (`SecretKey` is an
    upstream type with no `Zeroize`, only `non_secure_erase()`), so the RAII
    guard remains the only way to close its `?`-early-return / panic leak
    window. Preserves the "no key bytes survive the trait boundary" invariant.
  - `extended_public_key` moved into an `impl ExtendedPubKeySigner` block
    (dashcore #839).

Bump ripple + follow-through:
- packages/rs-platform-wallet-ffi/src/dashpay.rs: import `ExtendedPubKeySigner`
  for `receiving_xpub` (the method moved off `Signer`).
- packages/rs-platform-wallet-ffi/src/sign_with_mnemonic_resolver.rs: drop its
  own now-redundant `WipingXprv`, relying on `ExtendedPrivKey`'s upstream Drop.

rs-sdk-ffi + platform-wallet-ffi build; 300 + 8 tests pass (incl. the 12
resolver-signer tests); full-workspace build green; fmt + clippy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shumkov added a commit that referenced this pull request Jul 4, 2026
…endedPubKeySigner

The v4.1-dev merge bumped rust-dashcore to afcff156, which (dashcore #839)
moved `extended_public_key` out of `key_wallet::signer::Signer` into the new
`ExtendedPubKeySigner: Signer` subtrait. Production callers were migrated in the
merge, but four test-code signer impls still declared the method on `Signer` /
`KwSigner`, so the workspace test build failed with `error[E0407]: method
extended_public_key is not a member of trait ...` (dpp + platform-wallet lib
tests). A plain `cargo build --workspace` compiles no test targets, which is
why the merge's build looked clean; `cargo check --workspace --all-targets`
surfaces it.

Move the method into a separate `impl ExtendedPubKeySigner` block for each test
signer (FixedKeySigner ×3, SeedSigner ×1); bodies are byte-for-byte identical
(`ExtendedPubKeySigner: Signer` inherits the associated Error), so this is a
pure trait-membership move, no behavior change. `cargo check --workspace
--all-targets` clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants