Failure to reject `open_channel` where funder cannot pay commitment fee
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- c
- 領域
- networking
調査の方向性
open_channel の処理パスから始め、common/initial_commit_tx.c と、特にリンク先の行にある既存の手数料チェックとのバリデーションのタイミングを比較してください。再現手順の test_open_channel_funder_cannot_afford_fee を実行し、funding_created の前に peer が WIRE_WARNING または WIRE_ERROR を受信することを確認してください。push_msat によって commitment fee に対する資金が不足する場合、チャネルは拒否されなければなりません。
索引モデルが issue の本文から書いたものです。
説明
BOLT 2 requires the receiver of open_channel to fail the channel when the funder's amount cannot cover the initial commitment fee:
The receiving node MUST fail the channel if:
- the funder's amount for the initial commitment transaction is not sufficient for full [fee payment](03-transactions.md#fee-payment).
CLN implements the rule, but too late. The channel isn't rejected until later in the flow, after receiving funding_created.
Impact
A peer can set a push_msat for the channel that leaves insufficient funds to pay the initial commitment fees. CLN initially accepts such channels and responds with accept_channel, even though it will inevitably reject them one roundtrip later in the funding flow (after receiving funding_created). This is entirely a spec compliance issue.
Reproduction
@pytest.mark.openchannel('v1')
def test_open_channel_funder_cannot_afford_fee(node_factory, bitcoind):
"""A funder left short of the commitment fee must be rejected.
BOLT 2: the receiving node MUST fail the channel if the funder's amount for
the initial commitment transaction is not sufficient for full fee payment.
CLN only notices in initial_commit_tx(), after accept_channel has gone out.
"""
l1 = node_factory.get_node()
chain_hash = bytes.fromhex(bitcoind.rpc.getblockhash(0))[::-1]
# Use the node's own opening feerate, so we're inside its accepted range.
feerate = l1.rpc.feerates('perkw')['perkw']['opening']
funding_sat = 16777216
# The funder pays the commitment fee out of its own balance, so pushing the
# balance away leaves it with nothing to pay from.
push_msat = funding_sat * 1000
lconn, channel_type = raw_peer_connect(l1)
temp_chan_id = os.urandom(32)
send_open_channel(lconn, chain_hash, temp_chan_id, funding_sat,
push_msat, feerate, channel_type)
mtype = read_channel_reply(lconn)
assert mtype in (WIRE_WARNING, WIRE_ERROR), \
"funder left with {} sat to pay the commitment fee was not rejected (got msgtype {})".format(
funding_sat - push_msat // 1000, mtype)
If we continue to flow to funding_created, the initial_commit_tx check rejects the channel:
UNUSUAL 034f355b...-openingd-chan#1: Funder cannot afford fee on initial commitment transaction
Suggested fix
Apply the same check that already exists in initial_commit_tx immediately after receiving accept_channel.
Discovery
Found while fuzzing the v1 funding protocol with smite.
- 主要言語
- C
- スター
- 3.1k
- フォーク
- 1k
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 40
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ElementsProject/lightning のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/lightning#9593 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ElementsProject/lightning#9322 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ElementsProject/lightning#9206 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ElementsProject/lightning#9187 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
QA
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
ElementsProject/lightning#9117 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
ElementsProject/lightning の issue をすべて見る
似ている issue
-
[P2] Workspace updates silently ignore forbidden assignments while staging the row対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
メンテナーはふだん 4 日以内に返信
-
category:port-update
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/vcpkg#54338 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
area:http-gateway good first issue priority:low type:docs
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
crazy-goat/php-fpm-ng#828 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
SunDevilRocketry/Flight-Computer-Firmware#347 ·
メンテナーはふだん 3 日以内に返信