From a8029c71cdc1adef627b679e22e9b27c8baf51f8 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 10 May 2023 11:19:19 +0300 Subject: [PATCH] [#21] Document contract storage schemes Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- alphabet/doc.go | 11 +++++++++++ audit/doc.go | 8 ++++++++ balance/doc.go | 9 +++++++++ container/doc.go | 17 +++++++++++++++++ frostfs/doc.go | 10 ++++++++++ frostfsid/doc.go | 9 +++++++++ netmap/doc.go | 13 +++++++++++++ nns/doc.go | 17 +++++++++++++++++ processing/doc.go | 7 +++++++ proxy/doc.go | 5 +++++ reputation/doc.go | 8 ++++++++ 11 files changed, 114 insertions(+) create mode 100644 nns/doc.go diff --git a/alphabet/doc.go b/alphabet/doc.go index 2571e6b..fc7228b 100644 --- a/alphabet/doc.go +++ b/alphabet/doc.go @@ -17,5 +17,16 @@ for each alphabet contract. # Contract notifications Alphabet contract does not produce notifications to process. + +# Contract storage scheme + + | Key | Value | Description | + |--------------------|------------|-------------------------------------------------| + | `netmapScriptHash` | Hash160 | netmap contract hash | + | `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 diff --git a/audit/doc.go b/audit/doc.go index 97acfee..15d7039 100644 --- a/audit/doc.go +++ b/audit/doc.go @@ -18,5 +18,13 @@ they make a list and get these AuditResultStructures from the audit contract. # Contract notifications 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 diff --git a/balance/doc.go b/balance/doc.go index 3879048..d869926 100644 --- a/balance/doc.go +++ b/balance/doc.go @@ -74,5 +74,14 @@ when FrostFS contract has transferred GAS assets back to the user. type: Hash160 - name: amount 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 | + */ package balance diff --git a/container/doc.go b/container/doc.go index 0636b0f..a664234 100644 --- a/container/doc.go +++ b/container/doc.go @@ -64,5 +64,22 @@ it in Container contract. StopEstimation: - name: epoch 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 diff --git a/frostfs/doc.go b/frostfs/doc.go index 8a312be..35b1e0e 100644 --- a/frostfs/doc.go +++ b/frostfs/doc.go @@ -80,5 +80,15 @@ FrostFS network configuration value. type: ByteArray - name: value 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 diff --git a/frostfsid/doc.go b/frostfsid/doc.go index e15832d..1f6a836 100644 --- a/frostfsid/doc.go +++ b/frostfsid/doc.go @@ -16,5 +16,14 @@ contract. # Contract notifications 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 diff --git a/netmap/doc.go b/netmap/doc.go index c352699..88233c1 100644 --- a/netmap/doc.go +++ b/netmap/doc.go @@ -29,5 +29,18 @@ in the network by invoking NewEpoch method. NewEpoch - name: epoch type: Integer + +# Contract storage scheme + + | Key | Value | Description | + |-----------------------------|------------|-----------------------------------| + | `snapshotCount` | int | snapshot count | + | `snapshotEpoch` | int | snapshot epoch | + | `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 diff --git a/nns/doc.go b/nns/doc.go new file mode 100644 index 0000000..fcce7fb --- /dev/null +++ b/nns/doc.go @@ -0,0 +1,17 @@ +/* + +# Contract storage scheme + + | 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 diff --git a/processing/doc.go b/processing/doc.go index f6a4979..586b967 100644 --- a/processing/doc.go +++ b/processing/doc.go @@ -18,5 +18,12 @@ execution. # Contract notifications Processing contract does not produce notifications to process. + +# Contract storage scheme + + | Key | Value | Description | + |-----------------------------|------------|----------------------------------| + | `frostfsScriptHash` | Hash160 | frostFS contract hash | + */ package processing diff --git a/proxy/doc.go b/proxy/doc.go index 3201a92..c138cb9 100644 --- a/proxy/doc.go +++ b/proxy/doc.go @@ -17,5 +17,10 @@ verified, Proxy contract pays for the execution. # Contract notifications Proxy contract does not produce notifications to process. + +# Contract storage scheme + +Proxy contract does not use storage + */ package proxy diff --git a/reputation/doc.go b/reputation/doc.go index ad253af..891e084 100644 --- a/reputation/doc.go +++ b/reputation/doc.go @@ -13,5 +13,13 @@ Inner Ring nodes if data audit succeeds. # Contract notifications 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 -- 2.45.2