[#21] Document contract storage schemes #22

Merged
fyrchik merged 1 commit from aarifullin/frostfs-contract:feature/document_contract_storage_schemes into master 2023-05-12 12:46:53 +00:00
11 changed files with 114 additions and 0 deletions

View file

@ -17,5 +17,16 @@ for each alphabet contract.
# Contract notifications # Contract notifications
Alphabet contract does not produce notifications to process. Alphabet contract does not produce notifications to process.
# Contract storage scheme
| Key | Value | Description |
|--------------------|------------|-------------------------------------------------|
| `netmapScriptHash` | Hash160 | netmap contract hash |
fyrchik marked this conversation as resolved Outdated

Can we use markdown syntax for tables?

| Key | Value | Desc |
|-----|-------|------|
| a   | b     | c    |
| x   | y     | z    |

It is easier to copy in md doc, takes less space and is somewhat widely accepted.

I've searched a bit -- it seems godoc has no support for tables, so markdown is a safe choice.
Also, pre-formatted text should be indented (goimports does this, but we have no pre-commit here).

Can we use markdown syntax for tables? ``` | Key | Value | Desc | |-----|-------|------| | a | b | c | | x | y | z | ``` It is easier to copy in md doc, takes less space and is somewhat widely accepted. I've searched a bit -- it seems `godoc` has no support for tables, so markdown is a safe choice. Also, pre-formatted text should be indented (goimports does this, but we have no pre-commit here).
| `proxyScriptHash` | Hash160 | proxy contract hash |
| `name` | string | assigned glagolitic letter |
| `index` | int | the index of deployed alphabet contract |
| `threshold` | int | the total number of deployed alphabet contracts |
*/ */
package alphabet package alphabet

View file

@ -18,5 +18,13 @@ they make a list and get these AuditResultStructures from the audit contract.
# Contract notifications # Contract notifications
Audit contract does not produce notifications to process. Audit contract does not produce notifications to process.
# Contract storage scheme
| Key | Value | Description |
|--------------------|------------|-----------------------------------------------------------|
| `netmapScriptHash` | Hash160 | netmap contract hash |
| auditID | ByteArray | serialized DataAuditResult structure |
*/ */
package audit package audit

View file

@ -74,5 +74,14 @@ when FrostFS contract has transferred GAS assets back to the user.
type: Hash160 type: Hash160
- name: amount - name: amount
type: Integer type: Integer
# Contract storage scheme
| Key | Value | Description |
|-----------------------|------------|----------------------------------|
| `netmapScriptHash` | Hash160 | netmap contract hash |
| `containerScriptHash` | Hash160 | container contract hash |
| circulationKey | int | the token circulation key value |
fyrchik marked this conversation as resolved
Review

Is it variable length?

Is it variable length?
Review

Right, it's non-const

Right, it's non-`const`
*/ */
package balance package balance

View file

@ -64,5 +64,22 @@ it in Container contract.
StopEstimation: StopEstimation:
- name: epoch - name: epoch
type: Integer type: Integer
# Contract storage scheme
| Key | Value | Description |
|-----------------------------------------------------------------------------------------------------|
| `netmapScriptHash` | Hash160 | netmap contract hash |
| `balanceScriptHash` | Hash160 | balance contract hash |
| `identityScriptHash` | Hash160 | frostfsID contract hash |
| `nnsContractKey` | Hash160 | nns contract hash |
| `nnsRoot` | string | default value for domain zone |
| `cnr` + epoch + containerID + publicKeyHash[:10] | ByteArray | estimated container size |
| `est` + containerID + publicKeyHash | ByteArray | serialized epochs array |
| `o` + ownerID + containerID | ByteArray | container ID |
| `x` + containerID | ByteArray | serialized container struct |
| `nnsHasAlias` + containerID | string | domain name |
*/ */
package container package container

View file

@ -80,5 +80,15 @@ FrostFS network configuration value.
type: ByteArray type: ByteArray
- name: value - name: value
type: ByteArray type: ByteArray
# Contract storage scheme
| Key | Value | Description |
|-----------------------------------------------------------------------------|
| `processingScriptHash` | Hash160 | processing contract hash |
| `candidates` + candidateKey | ByteArray | it flags inner ring candidate |
| `config` + postfix | ByteArray | serialized config data |
*/ */
package frostfs package frostfs

View file

@ -16,5 +16,14 @@ contract.
# Contract notifications # Contract notifications
FrostFSID contract does not produce notifications to process. FrostFSID contract does not produce notifications to process.
# Contract storage scheme
| Key | Value | Description |
|-----------------------------|------------|----------------------------------|
| `processingScriptHash` | Hash160 | netmap contract hash |
| `containerScriptHash` | Hash160 | container contract hash |
| `o` + ownerID + publicKey | ByteArray | it flags owner's public key |
*/ */
package frostfsid package frostfsid

View file

@ -29,5 +29,18 @@ in the network by invoking NewEpoch method.
NewEpoch NewEpoch
- name: epoch - name: epoch
type: Integer type: Integer
# Contract storage scheme
| Key | Value | Description |
|-----------------------------|------------|-----------------------------------|
| `snapshotCount` | int | snapshot count |
| `snapshotEpoch` | int | snapshot epoch |
dstepanov-yadro marked this conversation as resolved Outdated

' should be replaced with ` ?

`'` should be replaced with ` ?

Thanks!

Thanks!
| `snapshotBlock` | int | snapshot block |
| `snapshot_` + snapshotNum | ByteArray | serialized '[]Node' array |
| `snapshotCurrent` | int | current snapshot |
| `balanceScriptHash` | Hash160 | balance contract hash |
| `containerScriptHash` | Hash160 | container contract hash |
*/ */
package netmap package netmap

17
nns/doc.go Normal file
View file

@ -0,0 +1,17 @@
/*
# Contract storage scheme
fyrchik marked this conversation as resolved Outdated

Let's use a package comment everywhere (like in the netmap contract) -- before the package keyword.

Let's use a package comment everywhere (like in the netmap contract) -- before the `package` keyword.
| Key | Value | Description |
|--------------------------------------|------------|-----------------------------------|
| 0x0 | int | total supply of minted domains |
| 0x1 + accountAddr | int | account's balance |
| 0x2 + accountAddr + tokenKey | ByteArray | token ID |
| 0x10 | int | price for domain registration |
| 0x20 | int | set of roots |
| 0x21 + tokenKey | ByteArray | serialized NameState struct |
| 0x22 + tokenKey + Hash160(tokenName) | Hash160 | container contract hash |
*/
package nns

View file

@ -18,5 +18,12 @@ execution.
# Contract notifications # Contract notifications
Processing contract does not produce notifications to process. Processing contract does not produce notifications to process.
# Contract storage scheme
| Key | Value | Description |
|-----------------------------|------------|----------------------------------|
| `frostfsScriptHash` | Hash160 | frostFS contract hash |
*/ */
package processing package processing

View file

@ -17,5 +17,10 @@ verified, Proxy contract pays for the execution.
# Contract notifications # Contract notifications
Proxy contract does not produce notifications to process. Proxy contract does not produce notifications to process.
# Contract storage scheme
Proxy contract does not use storage
*/ */
package proxy package proxy

View file

@ -13,5 +13,13 @@ Inner Ring nodes if data audit succeeds.
# Contract notifications # Contract notifications
Reputation contract does not produce notifications to process. Reputation contract does not produce notifications to process.
# Contract storage scheme
| Key | Value | Description |
|-----------------------------|------------|-----------------------------------|
| `c` + epoch + peerID | int | peer reputation count |
| `r` + count | ByteArray | serialized DataAuditResult struct |
*/ */
package reputation package reputation