feat: Fast upgrades: upgrade permit protocol types - #11548
frankdavid wants to merge 11 commits into
Conversation
First step of the Phase-2 rolling-reboot consensus protocol, which adds the data types and the artifact mechanism. * Add `UpgradePermitAction` (`Request` / `Authorize` / `Return`). `UpgradePermitAuthorizationRequest` is the signed content, `UpgradePermitAuthorizationShare` is the gossiped artifact. * Add the in-memory `UpgradePermitAuthPoolImpl` which is modeled after other pools. * Add the `ic-consensus-upgrade` crate with `UpgradePermitAuthPoolManager`. It signs shares for requests in finalized blocks and validates gossiped shares. * Register the new proto file with the generator and add `UpgradePermitAuthorizationRequest` (signing) and `UpgradePermitAuthorizationShare` (pool-ID hashing) domain separators.
|
✅ No security or compliance issues detected. Reviewed everything up to 9ade04f. Security OverviewDetected Code Changes
|
There was a problem hiding this comment.
🟡 Changes recommended
Consensus hash incompatibility, incomplete payload validation and production wiring, and incorrect retry and share-validation behavior are blocking issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Introduces Phase-2 upgrade-permit types, protobuf encoding, cryptographic domains, artifact pooling, and authorization-share management.
Changes:
- Adds upgrade request, authorization, return, and signature-share types.
- Adds payload serialization, artifact IDs, pool interfaces, and an in-memory pool.
- Adds a pool manager for signing, validating, gossiping, and expiring shares.
File summaries
| File | Description |
|---|---|
rs/types/types/src/crypto/sign.rs |
Adds request signing domain. |
rs/types/types/src/crypto/hash/tests.rs |
Updates consensus hash vectors. |
rs/types/types/src/crypto/hash/domain_separator.rs |
Adds upgrade domains. |
rs/types/types/src/crypto/hash.rs |
Adds request/share hash domains. |
rs/types/types/src/consensus/upgrade.rs |
Defines permit actions. |
rs/types/types/src/consensus.rs |
Adds request/share types and protobuf conversion. |
rs/types/types/src/batch/upgrade.rs |
Encodes and decodes upgrade payloads. |
rs/types/types/src/batch.rs |
Extends batch payloads and messages. |
rs/types/types/src/artifact.rs |
Defines authorization-share IDs. |
rs/test_utilities/types/src/batch/payload.rs |
Initializes test payload field. |
rs/state_machine_tests/src/lib.rs |
Initializes delivered upgrade actions. |
rs/protobuf/src/gen/types/types.v1.rs |
Regenerates protobuf bindings. |
rs/protobuf/generator/src/lib.rs |
Registers upgrade protobuf generation. |
rs/protobuf/def/types/v1/upgrade.proto |
Defines upgrade wire messages. |
rs/protobuf/def/types/v1/consensus.proto |
Adds block upgrade bytes. |
rs/protobuf/def/types/v1/artifact.proto |
Adds upgrade artifact IDs. |
rs/interfaces/src/upgrade.rs |
Adds pool and validation interfaces. |
rs/interfaces/src/p2p/consensus.rs |
Corrects documentation spelling. |
rs/interfaces/src/lib.rs |
Exports upgrade interfaces. |
rs/interfaces/src/crypto.rs |
Extends the crypto interface. |
rs/interfaces/src/consensus.rs |
Adds upgrade validation errors. |
rs/interfaces/mocks/src/crypto.rs |
Adds upgrade crypto mocks. |
rs/consensus/utils/src/crypto.rs |
Extends consensus crypto bounds. |
rs/consensus/upgrade/src/pool_manager.rs |
Implements share lifecycle management. |
rs/consensus/upgrade/src/lib.rs |
Implements membership and share validation. |
rs/consensus/upgrade/Cargo.toml |
Defines the new crate. |
rs/consensus/upgrade/BUILD.bazel |
Adds Bazel targets. |
rs/consensus/src/consensus/payload_builder.rs |
Initializes upgrade test payloads. |
rs/consensus/mocks/src/lib.rs |
Adds the pool to test dependencies. |
rs/artifact_pool/src/upgrade_permit_auth_pool.rs |
Implements the in-memory pool. |
rs/artifact_pool/src/lib.rs |
Exports the pool module. |
Cargo.toml |
Registers the workspace crate. |
Cargo.lock |
Locks the new crate dependencies. |
Review details
Suppressed comments (2)
rs/consensus/upgrade/src/pool_manager.rs:77
- Advancing
last_scannedto the tip before processing makes every skipped or failed request permanent. In particular, a transient signing failure logged below is never retried on later polls, so this node may never contribute its required authorization share. Advance the cursor only past successfully processed work, or retain failed requests for retry.
*last = tip;
rs/consensus/upgrade/src/lib.rs:77
- This maps every signature-verification failure to
AuthorizeInvalidShare, including transient crypto errors. The manager then permanently removes the share; established consensus code instead defers non-reproducible errors (for examplers/consensus/idkg/src/pre_signer.rs:834-845). Preserve the crypto error classification so only reproducible failures invalidate the artifact and transient failures are retried.
.map_err(|_| InvalidUpgradePayloadReason::AuthorizeInvalidShare { signer })?;
- Files reviewed: 32/33 changed files
- Comments generated: 9
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
The first version of this PR was way too big, I simplified it. I'll send out the block changes and the pool manager separately. |
First step of the Phase-2 rolling-reboot consensus protocol: the wire format, Rust types, and interfaces for upgrade permits.
UpgradePermitAction(Request/Authorize/Return).UpgradePermitAuthorizationRequestis the signed content,UpgradePermitAuthorizationShareis the gossiped artifact.Cryptotrait andMockCryptowith signing/verification ofUpgradePermitAuthorizationRequest.UpgradePermitAuthorizationRequest(signing) andUpgradePermitAuthorizationShare(pool-ID hashing) domain separators.