Skip to content

Commit

Permalink
ir: Clarify context of scope setup errors
Browse files Browse the repository at this point in the history
These errors are user-facing. For example, when NNS contract is missing,
from:
```
could not create RPC client: scope setup: InferHash: Unknown contract (-102)
```
to:
```
could not create RPC client: scope setup: resolve NNS contract address: Unknown contract (-102)
```

Other contracts' errors also made clearer.

Refs #2650.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Dec 20, 2023
1 parent ad8a8f8 commit d671151
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/morph/client/nns.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,26 @@ func (c *Client) InitSidechainScope() error {
func autoSidechainScope(ws *rpcclient.WSClient, conf *cfg) error {
nnsHash, err := nns.InferHash(ws)
if err != nil {
return fmt.Errorf("InferHash: %w", err)
return fmt.Errorf("resolve NNS contract address: %w", err)
}

var nnsReader = nns.NewReader(invoker.New(ws, nil), nnsHash)

balanceHash, err := nnsReader.ResolveFSContract(nns.NameBalance)
if err != nil {
return fmt.Errorf("resolving balance: %w", err)
return fmt.Errorf("resolve Balance contract address by NNS domain name %q: %w", nns.NameBalance, err)
}
cntHash, err := nnsReader.ResolveFSContract(nns.NameContainer)
if err != nil {
return fmt.Errorf("resolving container: %w", err)
return fmt.Errorf("resolve Container contract address by NNS domain name %q: %w", nns.NameContainer, err)
}
netmapHash, err := nnsReader.ResolveFSContract(nns.NameNetmap)
if err != nil {
return fmt.Errorf("resolving netmap: %w", err)
return fmt.Errorf("resolve Netmap contract address by NNS domain name %q: %w", nns.NameNetmap, err)
}
neofsIDHash, err := nnsReader.ResolveFSContract(nns.NameNeoFSID)
if err != nil {
return fmt.Errorf("resolving neofsid: %w", err)
return fmt.Errorf("resolve NeoFS ID contract address by NNS domain name %q: %w", nns.NameNeoFSID, err)
}

conf.signer = GetUniversalSignerScope(nnsHash, balanceHash, cntHash, netmapHash, neofsIDHash)
Expand Down

0 comments on commit d671151

Please sign in to comment.