Open yyforyongyu opened 1 week ago
[!IMPORTANT]
Review skipped
Auto reviews are limited to specific labels.
:label: Labels to auto review (1)
* llm-reviewPlease check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Stats of the last 30 days for lnd: | User | Total reviews | Time to review | Total comments | |
---|---|---|---|---|---|
guggero 🥇 |
25 ▀▀▀▀ |
15h 44m)) |
30 ▀▀ |
||
yyforyongyu 🥈 |
12 ▀▀ |
1d 8h 24m)) ▀ |
33 ▀▀▀ |
||
ellemouton 🥉 |
8 ▀ |
16h 51m)) |
21 ▀▀ |
||
ziggie1984 |
5 ▀ |
16h 15m)) |
9 ▀ |
||
ProofOfKeags |
4 ▀ |
5d 4h 23m)) ▀▀ |
14 ▀ |
||
bhandras |
3 |
1d 14h 22m)) ▀ |
2 |
||
dstadulis |
3 |
1h 26m)) |
5 |
||
Roasbeef |
2 |
4d 13h 56m)) ▀▀ |
9 ▀ |
||
ViktorTigerstrom |
2 |
2d 14h 26m)) ▀ |
5 |
||
alexbosworth |
1 |
4d 11h 58m)) ▀▀ |
1 |
||
ffranr |
1 |
2h 9m)) |
0 |
||
bitromortac |
1 |
16h 16m)) |
0 |
||
saubyk |
1 |
17h 10m)) |
0 |
IMO if we can remove the inheritance pattern used in contest resolver -> time/success resolver and manage to transform resolvers in channel arbitrator, we can further remove those two block subscriptions. As for now, we can leave them there as they have little impact on the block consumption order enforced by the blockbeat.
Minor point, it it isn't inheritance, it's composition, with the inner resolver replacing the outer one. Go technically doesn't have inheritance at all.
why dees Resolve need to split up in order to be incorporated into the new blockbeat architecture?
So we split it into two steps, step one is Launch
, which offers the inputs to the sweeper once triggered by block X, and before that block X is sent to the sweeper. This way we can ensure if block X closes a channel, its contract resolutions will offer these inputs to the sweeper, before the sweeper thinks there is nothing to be swept in block X.
Step two is then then waiting for the sweeping tx to be confirmed.
Is that that since we don't know which ones will be launched ahead of time, we can't set up the blockbeat consumer DAG upfront?
Yeah this part too - so these sub-consumers, like chain watcher and channel arbitrator, are ephemeral and are not managed by the blockbeat dispatcher. Some previous discussion can be found here. Basically it's easier to let the chainArb
to manage the channelArb
and chainArb
here.
Depends on
8894
NOTE: itest is fixed in the final PR
9260
Turns out mounting
blockbeat
inChannelArbitrator
can be quite challenging (unit tests, itest, etc). This PR attempts to implement it in hopefully the least disruptive way - onlychainWatcher
implementsConsumer
, and the contract resolvers are kept stateless (in terms of blocks). The main changes are,Resolve
method is broken into two steps: 1)Launch
the resolver, which handles sending the sweep request, and 2)Resolve
the resolver, which handles monitoring the spending of the output.chainWatcher
implementsConsumer
in the following PR.Alternatives
The original attempt is to make the resolvers subscribe to a blockbeat chan, as implemented in #8717. The second attempt is to make the resolvers also blockbeat
Consumer
, as implemented here.This third approach is chosen as 1) it greatly limits the scope otherwise a bigger refactor of channel arbitrator may be needed, and 2) the resolvers can be made stateless in terms of blocks, and be fully managed by the channel arbitrator. In other words, when a new block arrives, the channel arbitrator decides whether to launch the resolvers or not, so the resolvers themselves don't need this block info.
In fact, there are only two resolvers that subscribe to blocks, the incoming contest resolver, which uses block height to decide whether to give up resolving an expired incoming htlc; and the outgoing contest resolver, which uses the block height to choose to transform itself into a timeout resolver. IMO if we can remove the inheritance pattern used in
contest resolver -> time/success resolver
and manage to transform resolvers in channel arbitrator, we can further remove those two block subscriptions. As for now, we can leave them there as they have little impact on the block consumption order enforced by the blockbeat.