nervosnetwork / nervosnetwork/fiber

[shutdown_channel]Non-final channels cannot be shut down.

Open
#293 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
59
Forks
31
Avg merge
3d 5h
Merged PRs (30d)
18

Description

Bug Report

Current Behavior

Non-final channels cannot be shut down.

{"jsonrpc":"2.0","error":{"code":-32000,"message":"Invalid state: Trying to send shutdown message while in invalid state SigningCommitment(SigningCommitmentFlags(OUR_COMMITMENT_SIGNED_SENT))","data":{"channel_id":"0x4a8005b38889afa484fb0527e85ecaa39c01a8b2020257a58d2feb9f3f1a3d74","close_script":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x1731fdaaf19200d0f278a84bfb09de751449e101"},"force":null,"fee_rate":"0x3fc"}},"id":42}Closing channel_id: 0x0bf33a8529b95345e759e47f7978522aa863a5ee99518aac6c6adef0bd055e97
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Invalid state: Trying to send shutdown message while in invalid state CollaboratingFundingTx(CollaboratingFundingTxFlags(AWAITING_REMOTE_TX_COLLABORATION_MSG))","data":{"channel_id":"0x0bf33a8529b95345e759e47f7978522aa863a5ee99518aac6c6adef0bd055e97","close_script":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x1731fdaaf19200d0f278a84bfb09de751449e101"},"force":null,"fee_rate":"0x3fc"}},"id":42}Closing channel_id: 0xc3887d17c51a8306e1ca034f3117d4e830de29922c49c8f29718b1e67252a1e8
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Invalid state: Trying to send shutdown message while in invalid state NegotiatingFunding(NegotiatingFundingFlags(OUR_INIT_SENT | THEIR_INIT_SENT))","data":{"channel_id":"0xc3887d17c51a8306e1ca034f3117d4e830de29922c49c8f29718b1e67252a1e8","close_script":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x1731fdaaf19200d0f278a84bfb09de751449e101"},"force":null,"fee_rate":"0x3fc"}},"id":42}
Expected Behavior

Non-final channels can be shut down.

Environment
  • fiber version: fnn 0.1.0
  • Ckb Chain: testnet
  • Operating system: Ubuntu 20.04
  • Arch: Linux ip-172-31-100-41 6.8.0-1016-aws #17-Ubuntu SMP Mon Sep 2 13:48:07 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Installation: Built from source
Additional context/Screenshots
2024-10-25T07:47:36.689055Z ERROR fnn::fiber::channel: Error while processing channel command: InvalidState("Trying to send shutdown message while in invalid state SigningCommitment(SigningCommitmentFlags(OUR_COMMITMENT_SIGNED_SENT))")
    at src/fiber/channel.rs:1599
    in ractor::actor::Actor with id: "0.104", name: "Channel-95 QmbkDSCvXe1f6ofaBcC9TiuNQBGAThzMUpJWduqqfETgkr <-> QmRErF9SRUUb4XdABffAM3yA1pgGdTKnKZrRa5a7bjfB2d"

  2024-10-25T07:47:36.689232Z ERROR fnn::rpc::channel: channel request params ShutdownChannelParams { channel_id: Hash256(0xfc682003f6dcccadf190cb0b76b7e68e1b2a18804aad41d643714a38af5cb9f1), close_script: Script { code_hash: H256 ( [ 0x9b, 0xd7, 0xe0, 0x6f, 0x3e, 0xcf, 0x4b, 0xe0, 0xf2, 0xfc, 0xd2, 0x18, 0x8b, 0x23, 0xf1, 0xb9, 0xfc, 0xc8, 0x8e, 0x5d, 0x4b, 0x65, 0xa8, 0x63, 0x7b, 0x17, 0x72, 0x3b, 0xbd, 0xa3, 0xcc, 0xe8 ] ), hash_type: Type, args: JsonBytes(b"\x171\xfd\xaa\xf1\x92\0\xd0\xf2x\xa8K\xfb\t\xdeu\x14I\xe1\x01") }, force: None, fee_rate: 1020 } => error: "Invalid state: Trying to send shutdown message while in invalid state SigningCommitment(SigningCommitmentFlags(OUR_COMMITMENT_SIGNED_SENT))"
    at src/rpc/channel.rs:453 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the shutdown handling reported in src/fiber/channel.rs:1599 and the RPC entry point at src/rpc/channel.rs:453. Reproduce shutdown requests for channels in the listed SigningCommitment, CollaboratingFundingTx, and NegotiatingFunding states, then trace their state handling. Done means non-final channels can be shut down without the reported InvalidState errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.