Skip to content

Rename types and cch fields #1211

Merged
quake merged 6 commits intonervosnetwork:developfrom
chenyukang:yukang-fix-rpc-ret
Mar 23, 2026
Merged

Rename types and cch fields #1211
quake merged 6 commits intonervosnetwork:developfrom
chenyukang:yukang-fix-rpc-ret

Conversation

@chenyukang
Copy link
Copy Markdown
Collaborator

Maintain consistent naming styles.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates naming conventions across the CCH order status types and channel state_flags string representations to be consistent across Rust types, JSON-RPC types/docs, and e2e/tests.

Changes:

  • Renamed CchOrderStatus variants (OutgoingSucceededOutgoingSuccess, SucceededSuccess) and updated state machine/actions/tests accordingly.
  • Standardized RPC state_flags output/expectations to SCREAMING_SNAKE_CASE (e.g., COOPERATIVE, WAITING_COMMITMENT_CONFIRMATION).
  • Updated JSON-RPC docs/schema helpers and Bruno e2e tests to match the new naming.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/bruno/e2e/open-use-close-a-channel/21-list-channel-with-closed-status-NODE1.bru Update expected state_flags string for ShuttingDown state.
tests/bruno/e2e/open-use-close-a-channel/23-list-channel-with-closed-status-NODE1.bru Update expected state_flags string for Closed state.
crates/fiber-types/src/sample/cch.rs Update CCH status samples to renamed variants.
crates/fiber-types/src/cch.rs Rename CchOrderStatus variants and adjust mappings/finality check.
crates/fiber-lib/src/store/.schema.json Update stored schema hash entry for CchOrderStatus.
crates/fiber-lib/src/rpc/README.md Update RPC docs for renamed CCH status values.
crates/fiber-lib/src/fiber/tests/rpc.rs Align test expectations/comments with SCREAMING_SNAKE_CASE flags.
crates/fiber-lib/src/cch/tests/state_machine_tests.rs Update expected statuses and rename some tests for new status names.
crates/fiber-lib/src/cch/tests/scheduler_tests.rs Update final-status test cases to Success.
crates/fiber-lib/src/cch/tests/event_tests.rs Update status mapping expectations to renamed variants.
crates/fiber-lib/src/cch/tests/dispatcher_tests.rs Update dispatcher tests to renamed variants.
crates/fiber-lib/src/cch/tests/actor_tests.rs Update flow docs and assertions to renamed variants.
crates/fiber-lib/src/cch/order/state_machine.rs Update allowed transitions for renamed variants.
crates/fiber-lib/src/cch/actions/settle_incoming_invoice.rs Update dispatch predicate to renamed outgoing status.
crates/fiber-lib/src/cch/actions/mod.rs Update action selection logic to renamed variants.
crates/fiber-json-types/src/serde_utils.rs Change RPC flags serialization/deserialization to SCREAMING_SNAKE_CASE and pipe-separated format.
crates/fiber-json-types/src/convert.rs Update conversion mapping to renamed JSON CCH status variants.
crates/fiber-json-types/src/cch.rs Rename JSON-RPC CchOrderStatus variants.
Comments suppressed due to low confidence (1)

crates/fiber-json-types/src/serde_utils.rs:492

  • define_rpc_flags deserialization now only accepts SCREAMING_SNAKE_CASE names separated by |. This is a breaking change from the previous behavior (PascalCase + comma-separated) and will reject any existing client input using the old format. Consider accepting both separators (, and |) and optionally mapping legacy PascalCase to the new SCREAMING_SNAKE_CASE during parsing to preserve backward compatibility.
            fn from_string(s: &str) -> Option<Self> {
                let mut flags: $ty = 0;
                for name in s.split('|') {
                    let name = name.trim();
                    match name {
                        $(stringify!($flag_name) => flags |= Self::$flag_name,)*
                        _ => return None,
                    }
                }

Comment thread crates/fiber-json-types/src/serde_utils.rs
Comment thread crates/fiber-lib/src/cch/tests/state_machine_tests.rs Outdated
Comment thread crates/fiber-lib/src/cch/tests/event_tests.rs Outdated
Comment thread crates/fiber-lib/src/cch/tests/scheduler_tests.rs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread crates/fiber-json-types/src/serde_utils.rs Outdated
@quake quake merged commit 4c1fde7 into nervosnetwork:develop Mar 23, 2026
36 of 37 checks passed
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.

4 participants