Skip to content

Allow core resources to update validator network addresses - #442

Closed
davidiw wants to merge 2 commits into
mainfrom
feat/core-resource-network-addresses-main
Closed

davidiw wants to merge 2 commits into
mainfrom
feat/core-resource-network-addresses-main

Conversation

@davidiw

@davidiw davidiw commented Oct 29, 2026 •

Copy link
Copy Markdown

Superseded by #443, which targets the active public development branch, m1.

Description

Adds stake::update_network_and_fullnode_addresses_by_core_resources(&signer, address, vector<u8>, vector<u8>) as an entry function. It uses system_addresses::assert_core_resource, preserves the operator path's reconfiguration and resource checks, and shares the existing address mutation/event implementation by passing the validated mutable StakePool reference into the helper. The current validator set retains its addresses until the next epoch.

Adds an offline host-swap helper using canonical BCS Vec<NetworkAddress> decoding. It changes one selected host while retaining the TCP port, Noise IK public key, handshake version and other addresses. Usage is documented in the example. Generated stake documentation and SDK bindings include the new entry function.

How Has This Been Tested?

  • Seven Move unit tests pass on this branch: core-resources authorization, rejection of operator/framework/unrelated signers, missing pools, reconfiguration, other-field preservation, both event formats, empty fullnode bytes and next-epoch activation.
  • pre-commit on affected source files and git diff --check pass.
  • Three host-helper tests pass against this public base under Rust 1.89, including BCS roundtrip, preserved protocol fields/other addresses and rejected malformed inputs.
  • Two existing operator/delegation Move regressions pass.
  • Independent security/correctness review completed on e296d877b2b04b4593301b0ec2c1ded44382d499 with no blockers.
  • Full regression suites, formal verification and public-base signed-transaction E2E were not run. CI is pending.

Key Areas to Review

The new entry must grant only core resources access while keeping the existing operator authorization checks. The reconfiguration guard covers the asynchronous DKG interval, which can span transactions; the existence check preserves the explicit missing-pool error before borrowing. The shared mutation changes only the two address fields and existing event state; active validator discovery changes at the next epoch. Helper output is encoded address bytes for review and does not submit a transaction.

Type of Change

  • New feature
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Aptos Framework
  • Aptos CLI/SDK

Comment on lines +956 to +979
update_network_and_fullnode_addresses_internal(stake_pool, pool_address, new_network_addresses, new_fullnode_addresses);
}

/// Update validator addresses using core resources. This only takes effect in the next epoch.
/// Address bytes use the same encoding as the operator entry function.
public entry fun update_network_and_fullnode_addresses_by_core_resources(
core_resources: &signer,
pool_address: address,
new_network_addresses: vector<u8>,
new_fullnode_addresses: vector<u8>,
) acquires StakePool, ValidatorConfig {
system_addresses::assert_core_resource(core_resources);
assert_reconfig_not_in_progress();
assert_stake_pool_exists(pool_address);
let stake_pool = borrow_global_mut<StakePool>(pool_address);
update_network_and_fullnode_addresses_internal(stake_pool, pool_address, new_network_addresses, new_fullnode_addresses);
}

fun update_network_and_fullnode_addresses_internal(
stake_pool: &mut StakePool,
pool_address: address,
new_network_addresses: vector<u8>,
new_fullnode_addresses: vector<u8>,
) acquires ValidatorConfig {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is the core change, the rest is tests

@davidiw davidiw closed this Oct 29, 2026
davidiw added a commit that referenced this pull request Oct 29, 2026
## Description

Adds
`stake::update_network_and_fullnode_addresses_by_core_resources(&signer,
address, vector<u8>, vector<u8>)` as an entry function. It uses the
canonical core-resources guard, including decommission enforcement, and
shares the operator's mutation/events. Both entry functions pass the
validated `&mut StakePool` into the helper. Authorization, resource
errors and reconfiguration guards retain their existing ordering;
validator-set activation remains at the next epoch.

Adds an offline host-swap helper using canonical BCS
`Vec<NetworkAddress>` decoding. It changes one selected host while
preserving its port, Noise IK key, handshake version and other
addresses. Generated SDK bindings and documentation include the new
entry function.

Targets the public repository's active development branch, `m1`, and
supersedes #442. This branch contains one feature commit directly on
public `m1`; it includes no deployment changes.

## How Has This Been Tested?

- Eight new Move tests pass on this base: caller restriction,
decommissioning, missing pool, reconfiguration, other-field
preservation, both event formats, empty fullnode bytes and next-epoch
activation.
- Affected-source `pre-commit` and `git diff --check` pass.
- Three host-helper tests and two existing operator/delegation Move
regressions pass.
- The signed-entry regression passes with both allowlists enabled and
empty membership lists.
- Independent security/correctness review completed on
`7f93558674213c0d54e3d377a03699cdb2a9dbaf` with no blockers.
- CI is pending.
- Full regression suites and formal verification have not been run.

## Key Areas to Review

Only core resources may use the new entry; the existing operator path
keeps its permission and operator-address checks. Shared mutation
receives the pool reference and changes only the two address fields and
existing event state. The reconfiguration guard covers the asynchronous
DKG interval, which can span transactions. The host helper never signs
or submits transactions.

## Type of Change

- [x] New feature
- [x] Documentation update
- [x] Tests

## Which Components or Systems Does This Change Impact?

- [x] Aptos Framework
- [x] Aptos CLI/SDK
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.

1 participant