Should SEPs define a storage model? #1991
Replies: 3 comments 3 replies
|
Events are just log files. In classical backend systems you would only use logs as a way to reconcile state between some actions and your DB. But you would never consider the log be the source of truth for the DB state. So yes I think storage layout is part of the public "contract". |
|
To get a more complete understanding of the problem(s) this discussion is solving for:
Can you expand on what you're seeing, and examples?
What events are missing? Which state cannot be recreated from them? |
There is nothing limiting a SEP from stating that an implementation must implement specific storage, but it has big tradeoffs. Standards that lock developers to specific storage layouts will:
I suspect the problems described in the original post can be solved in other ways that do not share these tradeoffs. e.g. Better events? Better indexing? I've asked some questions at https://github.com/orgs/stellar/discussions/1991#discussioncomment-17875653 to better capture the problems. Standards benefit from avoiding over-specification, and being written with a minimum necessary philosophy, only specifying what's required for interoperability. Internal storage isn't needed for on-chain interoperability. |
Uh oh!
There was an error while loading. Please reload this page.
Today, most SEPs that aim to enshrine a class of contract or protocol do this by defining an interface for a Soroban contract and briefly describing the responsibility of each method. This allows for a lot of flexibility within a class of contract, for example SEP-41 contracts can model their balances as a simple sum of transfers or they can do something more exotic like implement a yield bearing token where your current balance has to be derived from several pieces of internal state. Both of these contracts can be compliant with SEP-41 today.
Downstream systems, like indexers, can rely on the stored contract code in order to classify a contract by parsing the contract code and matching the schema against the interface in question(SEP-41, SEP-50, etc). In order to index state associated to a protocol, the system can only rely on the SEPs interface in order to get that state. For example, you cannot reliably use a SEP-41 contracts events to derive the balance state for an account, you must invoke
balanceon the contract.The impact of this is that systems that want to classify contracts and track state cannot use data emitted by core, like events. The Stellar docs state that
Events are the mechanism that applications off-chain can use to monitor movement of value of any Stellar operation, as well as custom events in contracts on-chain.but I don't see this as being true because there is no guarantee at the standards level that you can recreate state from a set of events.Sources:
https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/events
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0041.md
All reactions