[#1170] go.mod: Update neo-go

github.com/nspcc-dev/neo-go v0.98.0 => v0.98.2

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-03-27 20:30:08 +03:00 committed by Alex Vanin
parent fdf1338d65
commit 424cc6d495
9 changed files with 38 additions and 13 deletions

View file

@ -8,7 +8,6 @@ import (
"fmt" "fmt"
"text/tabwriter" "text/tabwriter"
nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns"
"github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract"
@ -17,6 +16,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/vm" "github.com/nspcc-dev/neo-go/pkg/vm"
"github.com/nspcc-dev/neo-go/pkg/vm/emit" "github.com/nspcc-dev/neo-go/pkg/vm/emit"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-contract/nns"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )

View file

@ -7,7 +7,6 @@ import (
"strconv" "strconv"
"strings" "strings"
nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns"
"github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/core/native"
"github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/state"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
@ -20,6 +19,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/vm/emit" "github.com/nspcc-dev/neo-go/pkg/vm/emit"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode" "github.com/nspcc-dev/neo-go/pkg/vm/opcode"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-contract/nns"
morphClient "github.com/nspcc-dev/neofs-node/pkg/morph/client" morphClient "github.com/nspcc-dev/neofs-node/pkg/morph/client"
) )

View file

@ -91,7 +91,12 @@ func (c *initializeContext) multiSignAndSend(tx *transaction.Transaction, accTyp
} }
func (c *initializeContext) multiSign(tx *transaction.Transaction, accType string) error { func (c *initializeContext) multiSign(tx *transaction.Transaction, accType string) error {
network := c.Client.GetNetwork() network, err := c.Client.GetNetwork()
if err != nil {
// error appears only if client
// has not been initialized
panic(err)
}
// Use parameter context to avoid dealing with signature order. // Use parameter context to avoid dealing with signature order.
pc := scContext.NewParameterContext("", network, tx) pc := scContext.NewParameterContext("", network, tx)

View file

@ -124,7 +124,14 @@ func depositNotary(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("can't create tx: %w", err) return fmt.Errorf("can't create tx: %w", err)
} }
err = acc.SignTx(c.GetNetwork(), tx) mn, err := c.GetNetwork()
if err != nil {
// error appears only if client
// has not been initialized
panic(err)
}
err = acc.SignTx(mn, tx)
if err != nil { if err != nil {
return fmt.Errorf("can't sign tx: %w", err) return fmt.Errorf("can't sign tx: %w", err)
} }

3
go.mod
View file

@ -15,7 +15,8 @@ require (
github.com/multiformats/go-multiaddr v0.4.0 github.com/multiformats/go-multiaddr v0.4.0
github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.98.0 github.com/nspcc-dev/neo-go v0.98.2
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220321144137-d5a9af5860af // indirect
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1 github.com/nspcc-dev/neofs-api-go/v2 v2.12.1
github.com/nspcc-dev/neofs-contract v0.14.2 github.com/nspcc-dev/neofs-contract v0.14.2
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220316141620-a55ffa47966a github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220316141620-a55ffa47966a

BIN
go.sum

Binary file not shown.

View file

@ -468,9 +468,7 @@ func toStackParameter(value interface{}) (sc.Parameter, error) {
// MagicNumber returns the magic number of the network // MagicNumber returns the magic number of the network
// to which the underlying RPC node client is connected. // to which the underlying RPC node client is connected.
// func (c *Client) MagicNumber() (uint64, error) {
// Returns 0 in case of connection problems.
func (c *Client) MagicNumber() (res uint64, err error) {
c.switchLock.RLock() c.switchLock.RLock()
defer c.switchLock.RUnlock() defer c.switchLock.RUnlock()
@ -478,7 +476,14 @@ func (c *Client) MagicNumber() (res uint64, err error) {
return 0, ErrConnectionLost return 0, ErrConnectionLost
} }
return uint64(c.client.GetNetwork()), nil mNum, err := c.client.GetNetwork()
if err != nil {
// error appears only if client
// has not been initialized
panic(err)
}
return uint64(mNum), nil
} }
// BlockCount returns block count of the network // BlockCount returns block count of the network

View file

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"strconv" "strconv"
nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns"
"github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/rpc/client"
@ -13,6 +12,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm" "github.com/nspcc-dev/neo-go/pkg/vm"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-contract/nns"
) )
const ( const (

View file

@ -380,11 +380,16 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
return err return err
} }
// error appears only if client
// is in inactive mode; that has
// been already checked above
magicNumber, _ := c.MagicNumber()
// mainTX is expected to be pre-validated: second witness must exist and be empty // mainTX is expected to be pre-validated: second witness must exist and be empty
mainTx.Scripts[1].VerificationScript = multiaddrAccount.GetVerificationScript() mainTx.Scripts[1].VerificationScript = multiaddrAccount.GetVerificationScript()
mainTx.Scripts[1].InvocationScript = append( mainTx.Scripts[1].InvocationScript = append(
[]byte{byte(opcode.PUSHDATA1), 64}, []byte{byte(opcode.PUSHDATA1), 64},
multiaddrAccount.PrivateKey().SignHashable(uint32(c.client.GetNetwork()), mainTx)..., multiaddrAccount.PrivateKey().SignHashable(uint32(magicNumber), mainTx)...,
) )
resp, err := c.client.SignAndPushP2PNotaryRequest(mainTx, resp, err := c.client.SignAndPushP2PNotaryRequest(mainTx,
@ -618,10 +623,12 @@ func (c *Client) notaryWitnesses(invokedByAlpha bool, multiaddr *wallet.Account,
// to pass Notary module verification // to pass Notary module verification
var invokeScript []byte var invokeScript []byte
magicNumber, _ := c.MagicNumber()
if invokedByAlpha { if invokedByAlpha {
invokeScript = append( invokeScript = append(
[]byte{byte(opcode.PUSHDATA1), 64}, []byte{byte(opcode.PUSHDATA1), 64},
multiaddr.PrivateKey().SignHashable(uint32(c.client.GetNetwork()), tx)..., multiaddr.PrivateKey().SignHashable(uint32(magicNumber), tx)...,
) )
} else { } else {
// we can't provide alphabet node signature // we can't provide alphabet node signature
@ -643,7 +650,7 @@ func (c *Client) notaryWitnesses(invokedByAlpha bool, multiaddr *wallet.Account,
// then we have invoker witness // then we have invoker witness
invokeScript = append( invokeScript = append(
[]byte{byte(opcode.PUSHDATA1), 64}, []byte{byte(opcode.PUSHDATA1), 64},
c.acc.PrivateKey().SignHashable(uint32(c.client.GetNetwork()), tx)..., c.acc.PrivateKey().SignHashable(uint32(magicNumber), tx)...,
) )
w = append(w, transaction.Witness{ w = append(w, transaction.Witness{