Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

sdk/agent, sdk/state: define a story for persistence #227

Closed
leighmcculloch opened this issue Jul 30, 2021 · 0 comments · Fixed by #273 or #285
Closed

sdk/agent, sdk/state: define a story for persistence #227

leighmcculloch opened this issue Jul 30, 2021 · 0 comments · Fixed by #273 or #285
Assignees

Comments

@leighmcculloch
Copy link
Contributor

We need to decide how the SDK will support persistence.

My preference is we find an elegant way to let the application decide how to persist the state.

I think this would look like:

  • Adding an event handler to the agent that returns a copy of the state whenever is has changed, or for the sake of safety, whenever the agent calls a function on the channel.
  • Moving the changing state of a channel into a type that has all its fields exported so the state of the channel can be easily copied out and is accessible to the caller.
@leighmcculloch leighmcculloch self-assigned this Aug 31, 2021
@leighmcculloch leighmcculloch linked a pull request Aug 31, 2021 that will close this issue
leighmcculloch added a commit that referenced this issue Sep 2, 2021
Store the starting sequence in the open agreement.

The starting sequence is an assumed value that implicitly forms part of the agreement, however it would be better if it was an explicit part of the agreement and stored there rather than store inside the channel as a global value.

As a bonus this lets an escrow account holder to state that the open will occur at some future sequence number. On the surface this might be a cause for concern for the responder but it doesn't really change the security of anything since the initiator could always shift their sequence number after starting the open handshake. This just provides some flexibility and improves the debug-ability in cases that the two participants for some reason think the starting sequence is different.

I didn't plan on doing this now except that was I work on #227 (#273) it is inconvenient that the escrow accounts have their sequence numbers stored and what is stored there is important, so that led me to moving this up.
@leighmcculloch leighmcculloch linked a pull request Sep 2, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.