-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: store spec template/guideline #14020
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e161303
first draft store-spec-standard
angbrav 301045d
minor changes
angbrav b84edd4
generalize
angbrav bf5d4f5
Merge branch 'main' into manuel/store-spec-standard
tac0turtle 24dee46
Update store/SPEC_STANDARD.md
tac0turtle e603194
Update store/SPEC_STANDARD.md
tac0turtle 4fe864e
move and write golang
tac0turtle 0978f5d
Update docs/spec/SPEC_STANDARD.md
tac0turtle 83e6e9d
Merge branch 'main' into manuel/store-spec-standard
tac0turtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
## What is an SDK standard? | ||
|
||
An SDK standard is a design document describing a particular protocol, standard, or feature expected to be used by the Cosmos SDK. A SDK standard should list the desired properties of the standard, explain the design rationale, and provide a concise but comprehensive technical specification. The primary author is responsible for pushing the proposal through the standardization process, soliciting input and support from the community, and communicating with relevant stakeholders to ensure (social) consensus. | ||
|
||
## Sections | ||
|
||
A SDK standard consists of: | ||
- a synopsis, | ||
- overview and basic concepts, | ||
- technical specification, | ||
- history log, and | ||
- copyright notice. | ||
|
||
All top-level sections are required. References should be included inline as links, or tabulated at the bottom of the section if necessary. Included sub-sections should be listed in the order specified below. | ||
tac0turtle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Table Of Contents | ||
|
||
> Provide a table of contents at the top of the file to assist readers. | ||
|
||
### Synopsis | ||
|
||
The document should include a brief (~200 word) synopsis providing a high-level description of and rationale for the specification. | ||
|
||
### Overview and basic concepts | ||
|
||
This section should include a motivation sub-section and a definitions sub-section if required: | ||
|
||
- *Motivation* - A rationale for the existence of the proposed feature, or the proposed changes to an existing feature. | ||
- *Definitions* - A list of new terms or concepts utilized in the document or required to understand it. | ||
|
||
### System model and properties | ||
|
||
This section should include an assumptions sub-section if any, the mandatory properties sub-section, and a dependencies sub-section. Note that the first two sub-section are are tightly coupled: how to enforce a property will depend directly on the assumptions made. This sub-section is important to capture the interactions of the specified feature with the "rest-of-the-world", i.e., with other features of the ecosystem. | ||
|
||
- *Assumptions* - A list of any assumptions made by the feature designer. It should capture which features are used by the feature under specification, and what do we expect from them. | ||
- *Properties* - A list of the desired properties or characteristics of the feature specified, and expected effects or failures when the properties are violated. In case it is relevant, it can also include a list of properties that the feature does not guarantee. | ||
- *Dependencies* - A list of the features that use the feature under specification and how. | ||
|
||
### Technical specification | ||
|
||
This is the main section of the document, and should contain protocol documentation, design rationale, required references, and technical details where appropriate. | ||
The section may have any or all of the following sub-sections, as appropriate to the particular specification. The API sub-section is especially encouraged when appropriate. | ||
|
||
- *API* - A detailed description of the features's API. | ||
- *Technical Specification* - All technical details including syntax, diagrams, semantics, protocols, data structures, algorithms, and pseudocode as appropriate. The technical specification should be detailed enough such that separate correct implementations of the specification without knowledge of each other are compatible. | ||
- *Backwards Compatibility* - A discussion of compatibility (or lack thereof) with previous feature or protocol versions. | ||
- *Known Issues* - A list of known issues. This sub-section is specially important for specifications of already in-use features. | ||
- *Example Implementation* - A concrete example implementation or description of an expected implementation to serve as the primary reference for implementers. | ||
|
||
### History | ||
|
||
A specification should include a history section, listing any inspiring documents and a plaintext log of significant changes. | ||
|
||
See an example history section [below](#history-1). | ||
|
||
### Copyright | ||
|
||
A specification should include a copyright section waiving rights via [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). | ||
|
||
## Formatting | ||
|
||
### General | ||
|
||
Specifications must be written in GitHub-flavoured Markdown. | ||
|
||
For a GitHub-flavoured Markdown cheat sheet, see [here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). For a local Markdown renderer, see [here](https://github.com/joeyespo/grip). | ||
|
||
### Language | ||
|
||
Specifications should be written in Simple English, avoiding obscure terminology and unnecessary jargon. For excellent examples of Simple English, please see the [Simple English Wikipedia](https://simple.wikipedia.org/wiki/Main_Page). | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in specifications are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). | ||
|
||
### Pseudocode | ||
|
||
Pseudocode in specifications should be language-agnostic and formatted in a simple imperative standard, with line numbers, variables, simple conditional blocks, for loops, and | ||
English fragments where necessary to explain further functionality such as scheduling timeouts. LaTeX images should be avoided because they are difficult to review in diff form. | ||
|
||
Pseudocode for structs can be written in a simple langauge like Typescript or golang, as interfaces. | ||
|
||
Example Typescript pseudocode struct: | ||
|
||
```typescript | ||
interface CacheKVStore { | ||
cache: Map<Key, Value> | ||
parent: KVStore | ||
deleted: Key | ||
} | ||
``` | ||
|
||
Pseudocode for algorithms should be written in simple Typescript, as functions. | ||
|
||
Example pseudocode algorithm: | ||
|
||
```typescript | ||
function get( | ||
store: CacheKVStore, | ||
key: Key): Value { | ||
|
||
value = store.cache.get(Key) | ||
if (value !== null) { | ||
return value | ||
} else { | ||
value = store.parent.get(key) | ||
store.cache.set(key, value) | ||
return value | ||
} | ||
} | ||
``` | ||
|
||
## History | ||
|
||
This specification was significantly inspired by and derived from IBC's [ICS](https://github.com/cosmos/ibc/blob/main/spec/ics-001-ics-standard/README.md), which | ||
was in turn derived from Ethereum's [EIP 1](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1.md). | ||
|
||
Nov 24, 2022 - Initial draft finished and submitted as a PR | ||
|
||
## Copyright | ||
|
||
All content herein is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A table a content is as well handy.