Skip to content

Commit

Permalink
reputation: drop copy/paste garbage from the doc, fix #331 (#369)
Browse files Browse the repository at this point in the history
Maybe it's not perfect, but at least it's better than the old one.
  • Loading branch information
roman-khimov authored Nov 23, 2023
2 parents 3f566f8 + 55eebe5 commit beb9293
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
11 changes: 3 additions & 8 deletions reputation/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
Package reputation contains implementation of Reputation contract deployed in NeoFS
sidechain.
Inner Ring nodes produce data audit for each container during each epoch. In the end,
nodes produce DataAuditResult structure that contains information about audit
progress. Reputation contract provides storage for such structures and simple
interface to iterate over available DataAuditResults on specified epoch.
During settlement process, Alphabet nodes fetch all DataAuditResult structures
from the epoch and execute balance transfers from data owners to Storage and
Inner Ring nodes if data audit succeeds.
Storage nodes collect reputation data while communicating with other nodes.
This data is exchanged and the end result (global trust values) is stored in
the contract as opaque data.
# Contract notifications
Expand Down
14 changes: 7 additions & 7 deletions reputation/reputation_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func Update(script []byte, manifest []byte, data any) {
runtime.Log("reputation contract updated")
}

// Put method saves DataAuditResult in contract storage. It can be invoked only by
// Put method saves global trust data in contract storage. It can be invoked only by
// storage nodes with Alphabet assistance (multisignature witness).
//
// Epoch is the epoch number when DataAuditResult structure was generated.
// PeerID contains public keys of the Inner Ring node that has produced DataAuditResult.
// Value contains a stable marshaled structure of DataAuditResult.
// Epoch is the epoch number when GlobalTrust structure was generated.
// PeerID contains public key of the storage node that is the subject of the GlobalTrust.
// Value contains a stable marshaled structure of GlobalTrust.
func Put(epoch int, peerID []byte, value []byte) {
ctx := storage.GetContext()

Expand All @@ -112,14 +112,14 @@ func Put(epoch int, peerID []byte, value []byte) {
storage.Put(ctx, key, value)
}

// Get method returns a list of all stable marshaled DataAuditResult structures
// produced by the specified Inner Ring node during the specified epoch.
// Get method returns a list of all stable marshaled GlobalTrust structures
// known for the given peer during the specified epoch.
func Get(epoch int, peerID []byte) [][]byte {
id := storageID(epoch, peerID)
return GetByID(id)
}

// GetByID method returns a list of all stable marshaled DataAuditResult with
// GetByID method returns a list of all stable marshaled GlobalTrust with
// the specified id. Use ListByEpoch method to obtain the id.
func GetByID(id []byte) [][]byte {
ctx := storage.GetReadOnlyContext()
Expand Down

0 comments on commit beb9293

Please sign in to comment.