Closed geoknee closed 11 months ago
HI @geoknee, thank you for your patience! We have an interest in moving forward with this proposal. Can you confirm the grant total required to complete this work?
That's great to hear @ErinOCon! I have sent you the total via slack.
Hi @geoknee, I have closed this item as the proposal is no longer under consideration. Should you have questions for our team in the future, please feel welcome to connect at grants@fil.org.
Open grant proposal: go-nitro Hardening
Name of Project: go-nitro Hardening
Proposal Category:
integration-adoption
Proposer: @geoknee
(Optional) Technical Sponsor: @patrickwoodhead
Do you agree to open source all work you do on behalf of this RFP and dual-license under MIT or APACHE2 licenses?: Yes
Project Description
The ultimate goal of the
go-nitro
project is to integrate our flavour of state channel micropayments with the Filecoin retrieval market — be that directly with storage providers and/or secondary services such as Saturn. Before that can happen, we need to de-risk integrations such as with Lotus (a critical piece of Filecoin infrastructure controlling real funds) by comprehensively handling sad-path scenarios.This proposal builds on the work completed during previous go-nitro grants https://github.com/filecoin-project/devgrants/issues/348, https://github.com/filecoin-project/devgrants/issues/936. The aim of this follow-on grant is
The guarantee offered will be: “your
go-nitro
client will ensure that, as long as you remain sufficiently online and are able to submit blockchain transactions, you will be able to recover your funds in a finite amount of time irrespective of the actions of others. Moreover,go-nitro
will help you do this efficiently without wasting gas fees”.The grant is proposed to START on 24 April 2022. The deliverable dates are based on an estimate of the scale of the work (in developer days) and the number of developers assigned to that milestone.
Value
The importance of using multi-hop payments in the Filecoin retrieval market is clearly laid out in the retrieval market roadmap. Multihop channels leverage existing channels between peers in a payment network, and do not require new connections to be setup on chain. Virtual channel constructions (Nitro protocol’s killer feature) offer a key advantage over the HTLC multihop construct present (but unused) in Filecoin payment channels; once Alice & Bob construct a virtual channel through an intermediary Ingrid, Alice can pay Bob without involvement from Ingrid. We’ve proved out the “happy path” of virtual channels in our previous grants.
Virtual channels are safe by construction, but only if users and intermediaries have the software to help them recover from things going wrong. Therefore the value of this grant will be to implement new features and off-chain protocols to allow users to recover their funds in the case of a loss of power, data or communications — by falling back to transacting on the blockchain. Even beyond these unhappy cases, we will build a “watchtower” module to protect users from a narrow range of anticipated malicious activity by counterparties. We will to demonstrate these capabilities in our testing environment.
The risk of not having these functionalities built out is severe, and includes situations where funds locked in the state channel network could be stolen or double-spent.
We have designed our core protocol and engineering roadmap with this body of work in mind, so we perceive there to be a relatively low risk from the point of view of successfully implementing the grant. For more information please see the Sad path part of our docs website.
Deliverables
Implementing a durable store for valuable off-chain data.
go-nitro
will be able to recover from a loss of power on the machine it runs on.Adding a “re-sync” module.
go-nitro
will be able to recover from dropped messages.Adding a “challenge” module.
go-nitro
will be able to recover from long-term peer inactivity.Adding a “watchtower” module.
go-nitro
will be able to recover from peer malice / arbitrary misbehaviour.Subjecting on and off chain components to an internal security audit. The
go-nitro
will undergo a thorough code review, with the results published on our docs website.Development Roadmap
1. Implementing a durable store
In state/payment channel protocols, funds are locked on chain and can only be unlocked with data held by off-chain parties.
go-nitro
currently has only a non-durable store for off chain messages, which we call theMemStore
. This means that closing the process which runsgo-nitro
(as could happen during a loss of power or system crash, or simply by the user shutting down their computer) results in data loss and therefore the potential for loss of funds.Deliverables:
store
implementation which replaces the existingMemStore
.go-nitro
client can be restarted at any moment andWe will aim to complete this milestone by START + (4 weeks) = May 22nd 2023
This milestone will be owned by @lalexgap.
Unknowns:
2. Re-sync module
Even with a durable
store
, it is possible for clients to become “out of sync”. In this context, that means thatgo-nitro
peers are still online, still wishing to cooperate but unable to due to corrupt or missing data. That might be due to an imperfectly durable store, an imperfect messaging transport or a short period of dropped network access. The re-sync module will serve as the first step to try and resolve the situation and get off chain protocols going again.Deliverables:
go-nitro
clients who have suffered from data loss. It will consist of a protocol for requesting latest information from peers and kickstarting any protocols that may have stalled.We will aim to complete this milestone by START + (6 weeks) = June 5th 2023
This milestone will be owned by @kerzhner.
3. Challenge module
In the current version of
go-nitro
peer inactivity is not detected and results in funds being locked in a channel. We will fix this so that after some timeout or user signal,go-nitro
kicks into action to recover funds on chain.Importantly, we will optimize for a threat model which assumes it is much more likely that a virtual channel peer would become inactive than it is for an intermediary. Intermediaries have higher incentives to stay online (e.g. their reputation) , and will likely run in data centers with high uptime. Clients will use their good relationship with their intermediary to reduce the amount of on-chain transactions required to recover.
Deliverables:
We will aim to complete this milestone by START + (8 weeks) = 19th June 2023
This milestone will be owned by @geoknee.
Unknowns:
4. Watchtower module
The on-chain
challenge
method (and associated go-nitro module in Milestone 3) gives power to participants to “take each other to court”.This is an important protection, but one that invites malicious / false claims. Although the protocol will swiftly reject any challenge that does not have sufficient “support” — for example, a unanimous round of signatures from all parties — there is still a risk. A malicious or faulty peer can submit stale challenges (meaning for a “supported state” which has been superseded by more recent agreements) and thereby lay claim to funds “already spent” off-chain.
We will enhance the
go-nitro
client to detect challenges on chain and respond with a proof of the newer agreement. This will lead to the stale challenge being cancelled (”thrown out of court”).Deliverables:
defend
which is spawned automatically bygo-nitro
when:go-nitro
client responding appropriately to a malicious challengeWe will aim to complete this milestone by START + (4 weeks) = May 22nd 2023
This milestone will be owned by @lalexgap.
5. Internal audit
We want to increase the confidence we have in both our abstract protocol and in our implementation of it. So we will put what we have done through some of the following tests:
Deliverables:
The audits may make use of tools such as MythX and Pyrometer. We will make the most of our good relationship with the Consensys Diligence team and the results (report available on demand) of a full external audit they performed for us on an older implementation of our protocol.
We will aim to complete this milestone by START + (8 weeks) = 3 July 2023
This milestone will be owned by @niloCK.
Total Budget Requested
M1: 20 developer days
M2: 30 developer days
M3: 40 developer days
M4: 20 developer days
M5: 40 developer days
Total: 150 developer days
A developer day is costed at our usual rate (see previous grants).
Maintenance and Upgrade Plans
Team
Team Members
George Knee @geoknee
Colin Kennedy @nilock
Alex Gap @lalexgap
Mike Kerzhner @kerzhner
Team Website
Magmo Website
Relevant Experience
Collectively, Magmo has more than 15 years of experience thinking about state channels! As mentioned above, we successfully shipped a virtual funding protocol implementation in Typescript (powering Web3Torrent) and have already successfully built out most of our Golang implementation in a previous Filecoin Grant. We have some experience building some of these features into previous versions of our software (in other languages). We also have experience in stress testing our protocol for security — see https://blog.statechannels.org/breaking-state-channels/ ; as well as smart contract audits and fuzzing campaigns.
Our team has a healthy mix of academic backgrounds as well as software engineering backgrounds. We've successfully delivered two Open Grants with the Filecoin Foundation, and have multiple touchpoints with the wider Protocol Labs network (Filecoin Virtual Machine Early Builder Cohort members, libp2p users, testground users and contributors).
Team code repositories
https://github.com/statechannels