linera-protocol icon indicating copy to clipboard operation
linera-protocol copied to clipboard

Add a close_chain endpoint for contracts.

Open afck opened this issue 2 years ago • 2 comments

Applications should be given the opportunity to clean up, e.g. unsubscribe from everything, when a chain is closed.

afck avatar Mar 28 '23 16:03 afck

I'm not convinced anymore that a close_chain endpoint on the contract is a good idea: What if running all the close_chain calls on all installed applications takes too much gas for a single block?

Maybe it should rather be an uninstall endpoint that allows deregistering apps from chains. CloseChain would then fail if there are any applications left—and have a flag to override this and close the chain anyway.

Or each application can optionally provide custom cleanup functions, and have a flag recognized by the system whether it's okay to deregister it. Applications that do require cleanup can set this flag to false until cleanup has been performed.

afck avatar Mar 30 '23 13:03 afck

Another use case is for e.g. the fungible or non-fungible applications to move all assets elsewhere before closing a chain.

afck avatar Mar 19 '24 14:03 afck

Done in https://github.com/linera-io/linera-protocol/pull/1746.

afck avatar Aug 21 '24 10:08 afck