[#254] Update neo-go to preview4 compatible version

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-11 11:33:27 +03:00 committed by Alex Vanin
parent c539657567
commit feec559e47
9 changed files with 27 additions and 22 deletions

View file

@ -71,7 +71,7 @@ func defaultConfiguration(cfg *viper.Viper) {
cfg.SetDefault("contracts.alphabet.jest", "") cfg.SetDefault("contracts.alphabet.jest", "")
cfg.SetDefault("contracts.alphabet.zhivete", "") cfg.SetDefault("contracts.alphabet.zhivete", "")
// gas native contract in LE // gas native contract in LE
cfg.SetDefault("contracts.gas", "668e0c1f9d7b70a99dd9e06eadd4c784d641afbc") cfg.SetDefault("contracts.gas", "b5df804bbadefea726afb5d3f4e8a6f6d32d2a20")
cfg.SetDefault("timers.epoch", "5s") cfg.SetDefault("timers.epoch", "5s")
cfg.SetDefault("timers.emit", "30s") cfg.SetDefault("timers.emit", "30s")

View file

@ -11,6 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/netmap"
@ -197,20 +198,20 @@ type cfgMorph struct {
type cfgAccounting struct { type cfgAccounting struct {
scriptHash util.Uint160 scriptHash util.Uint160
fee util.Fixed8 fee fixedn.Fixed8
} }
type cfgContainer struct { type cfgContainer struct {
scriptHash util.Uint160 scriptHash util.Uint160
fee util.Fixed8 fee fixedn.Fixed8
} }
type cfgNetmap struct { type cfgNetmap struct {
scriptHash util.Uint160 scriptHash util.Uint160
wrapper *nmwrapper.Wrapper wrapper *nmwrapper.Wrapper
fee util.Fixed8 fee fixedn.Fixed8
parsers map[event.Type]event.Parser parsers map[event.Type]event.Parser
@ -299,15 +300,15 @@ func initCfg(path string) *cfg {
apiVersion: pkg.SDKVersion(), apiVersion: pkg.SDKVersion(),
cfgAccounting: cfgAccounting{ cfgAccounting: cfgAccounting{
scriptHash: u160Accounting, scriptHash: u160Accounting,
fee: util.Fixed8(viperCfg.GetInt(cfgAccountingFee)), fee: fixedn.Fixed8(viperCfg.GetInt(cfgAccountingFee)),
}, },
cfgContainer: cfgContainer{ cfgContainer: cfgContainer{
scriptHash: u160Container, scriptHash: u160Container,
fee: util.Fixed8(viperCfg.GetInt(cfgContainerFee)), fee: fixedn.Fixed8(viperCfg.GetInt(cfgContainerFee)),
}, },
cfgNetmap: cfgNetmap{ cfgNetmap: cfgNetmap{
scriptHash: u160Netmap, scriptHash: u160Netmap,
fee: util.Fixed8(viperCfg.GetInt(cfgNetmapFee)), fee: fixedn.Fixed8(viperCfg.GetInt(cfgNetmapFee)),
state: state, state: state,
reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval),
reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled), reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled),

2
go.mod
View file

@ -16,7 +16,7 @@ require (
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2 github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2
github.com/multiformats/go-multihash v0.0.13 // indirect github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201215101847-7c2257803f32
github.com/nspcc-dev/neofs-api-go v1.21.2 github.com/nspcc-dev/neofs-api-go v1.21.2
github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0

8
go.sum
View file

@ -276,14 +276,14 @@ github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxx
github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ=
github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570 h1:EHBwlOyd2m06C3dnxhpPokpYqlNg7u5ZX/uPBhjYuZ4= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570 h1:EHBwlOyd2m06C3dnxhpPokpYqlNg7u5ZX/uPBhjYuZ4=
github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E=
github.com/nspcc-dev/dbft v0.0.0-20200925163137-8f3b9ab3b720 h1:e/lFQUIPnWErf2yiHjp2HyPhf0nyo3lp4hMm8IlQX1U= github.com/nspcc-dev/dbft v0.0.0-20201109143252-cd27d76617ed h1:T4qjutPMqjnYDQFyrbCew3lGeJt6MIbNyNn7gRx0o/g=
github.com/nspcc-dev/dbft v0.0.0-20200925163137-8f3b9ab3b720/go.mod h1:I5D0W3tu3epdt2RMCTxS//HDr4S+OHRqajouQTOAHI8= github.com/nspcc-dev/dbft v0.0.0-20201109143252-cd27d76617ed/go.mod h1:I5D0W3tu3epdt2RMCTxS//HDr4S+OHRqajouQTOAHI8=
github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y=
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc=
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b h1:gk5bZgpWOehaDVKI5vBDkcjXTpRkKqcvIb1h/vHnBH4= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201215101847-7c2257803f32 h1:ZtMi11WCXWU1kctimpmh7cenCWNIonmkhcMEA7Vg9EI=
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b/go.mod h1:9s7LNp2lMgf0caH2t0sam4+WT2SIauXozwP0AdBqnEo= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201215101847-7c2257803f32/go.mod h1:FKxIACIW0+Fp0HvMV0AKB1oTlxGBdWZTdC+hNlepie0=
github.com/nspcc-dev/neofs-api-go v1.21.2 h1:JoL105ICxI/UlyGV8F7ysNyrR5uDU6y609FTq5tRFVk= github.com/nspcc-dev/neofs-api-go v1.21.2 h1:JoL105ICxI/UlyGV8F7ysNyrR5uDU6y609FTq5tRFVk=
github.com/nspcc-dev/neofs-api-go v1.21.2/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.21.2/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=

View file

@ -5,6 +5,7 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
"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/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
crypto "github.com/nspcc-dev/neofs-crypto" crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
@ -258,7 +259,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
Converter: &server.precision, Converter: &server.precision,
MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"),
MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"), MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"),
MintEmitValue: util.Fixed8(cfg.GetInt64("emit.mint.value")), MintEmitValue: fixedn.Fixed8(cfg.GetInt64("emit.mint.value")),
}) })
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -4,7 +4,7 @@ import (
"crypto/elliptic" "crypto/elliptic"
"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/util" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -50,7 +50,7 @@ func (np *Processor) processEmit() {
return return
} }
gasPerNode := util.Fixed8(np.storageEmission / uint64(ln)) gasPerNode := fixedn.Fixed8(np.storageEmission / uint64(ln))
for i := range networkMap.Nodes { for i := range networkMap.Nodes {
keyBytes := networkMap.Nodes[i].PublicKey() keyBytes := networkMap.Nodes[i].PublicKey()

View file

@ -4,6 +4,7 @@ import (
"sync" "sync"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event"
@ -43,7 +44,7 @@ type (
mintEmitLock *sync.Mutex mintEmitLock *sync.Mutex
mintEmitCache *lru.Cache mintEmitCache *lru.Cache
mintEmitThreshold uint64 mintEmitThreshold uint64
mintEmitValue util.Fixed8 mintEmitValue fixedn.Fixed8
} }
// Params of the processor constructor. // Params of the processor constructor.
@ -59,7 +60,7 @@ type (
Converter PrecisionConverter Converter PrecisionConverter
MintEmitCacheSize int MintEmitCacheSize int
MintEmitThreshold uint64 // in epochs MintEmitThreshold uint64 // in epochs
MintEmitValue util.Fixed8 MintEmitValue fixedn.Fixed8
} }
) )

View file

@ -2,6 +2,7 @@ package client
import ( import (
"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/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/rpc/client"
sc "github.com/nspcc-dev/neo-go/pkg/smartcontract" sc "github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
@ -42,7 +43,7 @@ var errScriptDecode = errors.New("could not decode invocation script from neo no
// Invoke invokes contract method by sending transaction into blockchain. // Invoke invokes contract method by sending transaction into blockchain.
// Supported args types: int64, string, util.Uint160, []byte and bool. // Supported args types: int64, string, util.Uint160, []byte and bool.
func (c *Client) Invoke(contract util.Uint160, fee util.Fixed8, method string, args ...interface{}) error { func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
params := make([]sc.Parameter, 0, len(args)) params := make([]sc.Parameter, 0, len(args))
for i := range args { for i := range args {
@ -120,8 +121,8 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf
} }
// TransferGas to the receiver from local wallet // TransferGas to the receiver from local wallet
func (c *Client) TransferGas(receiver util.Uint160, amount util.Fixed8) error { func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error {
txHash, err := c.client.TransferNEP5(c.acc, receiver, c.gas, int64(amount), 0) txHash, err := c.client.TransferNEP17(c.acc, receiver, c.gas, int64(amount), 0)
if err != nil { if err != nil {
return err return err
} }

View file

@ -3,6 +3,7 @@ package client
import ( import (
"errors" "errors"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
) )
@ -19,7 +20,7 @@ type StaticClient struct {
scScriptHash util.Uint160 // contract script-hash scScriptHash util.Uint160 // contract script-hash
fee util.Fixed8 // invocation fee fee fixedn.Fixed8 // invocation fee
} }
// ErrNilStaticClient is returned by functions that expect // ErrNilStaticClient is returned by functions that expect
@ -29,7 +30,7 @@ var ErrNilStaticClient = errors.New("static client is nil")
// NewStatic creates, initializes and returns the StaticClient instance. // NewStatic creates, initializes and returns the StaticClient instance.
// //
// If provided Client instance is nil, ErrNilClient is returned. // If provided Client instance is nil, ErrNilClient is returned.
func NewStatic(client *Client, scriptHash util.Uint160, fee util.Fixed8) (*StaticClient, error) { func NewStatic(client *Client, scriptHash util.Uint160, fee fixedn.Fixed8) (*StaticClient, error) {
if client == nil { if client == nil {
return nil, ErrNilClient return nil, ErrNilClient
} }