go-nitro icon indicating copy to clipboard operation
go-nitro copied to clipboard

Implement garbage collection or other mechanism to reduce memory bloat in Channel class

Open geoknee opened this issue 4 years ago • 8 comments

For understanding: this is meant to be sparse? A filecoin provider will expect to have a fair number of channels running with lots of micro-transactions in each.

Originally posted by @NiloCK in https://github.com/statechannels/go-nitro/pull/102#discussion_r767709020

geoknee avatar Dec 13 '21 13:12 geoknee

Whenever we use a durable store, this issue extends beyond "memory bloat" to disk bloat.

We may also be able to save some additional space in the voucher store by e.g. not having the payer store the vouchers.

geoknee avatar Mar 28 '23 13:03 geoknee

I'm going to close this for now as I don't think it's worth optimizing for disk space at this point.

lalexgap avatar Jul 31 '23 17:07 lalexgap

Reopening as it is named under deliverable 1 of the grant https://github.com/filecoin-project/devgrants/issues/1508

geoknee avatar Aug 11 '23 14:08 geoknee

A minimal improvement would be to delete channels when they are defunded.

geoknee avatar Aug 16 '23 16:08 geoknee

Another easy improvement would be to only store the latest voucher (assuming we don't do so already).

geoknee avatar Aug 16 '23 16:08 geoknee

More difficult: delete old states from ledger channels.

geoknee avatar Aug 16 '23 16:08 geoknee

A minimal improvement would be to delete channels when they are defunded.

I think we can remove some data but we at least need to keep track off previous channel Ids we've used. Otherwise when receiving a message we don't know if it's a new channel or a stale message for a deleted channel. I think this could be dangerous as nitro node could be tricked to re-use the same channel id for a virtual channel, which would allow signed states from the defunded channel to be used against the "new" channel.

lalexgap avatar Aug 22 '23 21:08 lalexgap

Yes I think you're right. Somewhat related to https://github.com/statechannels/go-nitro/issues/1116

geoknee avatar Aug 23 '23 09:08 geoknee