From feec559e47ac7b2cd959f3d965afa73ebeca2377 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Dec 2020 11:33:27 +0300 Subject: [PATCH] [#254] Update neo-go to preview4 compatible version Signed-off-by: Alex Vanin --- cmd/neofs-ir/defaults.go | 2 +- cmd/neofs-node/config.go | 13 +++++++------ go.mod | 2 +- go.sum | 8 ++++---- pkg/innerring/innerring.go | 3 ++- pkg/innerring/processors/alphabet/process_emit.go | 4 ++-- pkg/innerring/processors/neofs/processor.go | 5 +++-- pkg/morph/client/client.go | 7 ++++--- pkg/morph/client/static.go | 5 +++-- 9 files changed, 27 insertions(+), 22 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index c1383715c..3b4f45228 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -71,7 +71,7 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("contracts.alphabet.jest", "") cfg.SetDefault("contracts.alphabet.zhivete", "") // gas native contract in LE - cfg.SetDefault("contracts.gas", "668e0c1f9d7b70a99dd9e06eadd4c784d641afbc") + cfg.SetDefault("contracts.gas", "b5df804bbadefea726afb5d3f4e8a6f6d32d2a20") cfg.SetDefault("timers.epoch", "5s") cfg.SetDefault("timers.emit", "30s") diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 7256e6c82..f4181ceb3 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -11,6 +11,7 @@ import ( "sync" "time" + "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -197,20 +198,20 @@ type cfgMorph struct { type cfgAccounting struct { scriptHash util.Uint160 - fee util.Fixed8 + fee fixedn.Fixed8 } type cfgContainer struct { scriptHash util.Uint160 - fee util.Fixed8 + fee fixedn.Fixed8 } type cfgNetmap struct { scriptHash util.Uint160 wrapper *nmwrapper.Wrapper - fee util.Fixed8 + fee fixedn.Fixed8 parsers map[event.Type]event.Parser @@ -299,15 +300,15 @@ func initCfg(path string) *cfg { apiVersion: pkg.SDKVersion(), cfgAccounting: cfgAccounting{ scriptHash: u160Accounting, - fee: util.Fixed8(viperCfg.GetInt(cfgAccountingFee)), + fee: fixedn.Fixed8(viperCfg.GetInt(cfgAccountingFee)), }, cfgContainer: cfgContainer{ scriptHash: u160Container, - fee: util.Fixed8(viperCfg.GetInt(cfgContainerFee)), + fee: fixedn.Fixed8(viperCfg.GetInt(cfgContainerFee)), }, cfgNetmap: cfgNetmap{ scriptHash: u160Netmap, - fee: util.Fixed8(viperCfg.GetInt(cfgNetmapFee)), + fee: fixedn.Fixed8(viperCfg.GetInt(cfgNetmapFee)), state: state, reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled), diff --git a/go.mod b/go.mod index bb7302316..a22558e12 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( 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/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-crypto v0.3.0 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index 2ade4a85d..f41515d10 100644 --- a/go.sum +++ b/go.sum @@ -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-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-20200925163137-8f3b9ab3b720 h1:e/lFQUIPnWErf2yiHjp2HyPhf0nyo3lp4hMm8IlQX1U= -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 h1:T4qjutPMqjnYDQFyrbCew3lGeJt6MIbNyNn7gRx0o/g= +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/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.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.20201030072836-71216865717b/go.mod h1:9s7LNp2lMgf0caH2t0sam4+WT2SIauXozwP0AdBqnEo= +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.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/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 7d46498c8..ad4db2a9c 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -5,6 +5,7 @@ import ( "crypto/ecdsa" "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" crypto "github.com/nspcc-dev/neofs-crypto" "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, MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), 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 { return nil, err diff --git a/pkg/innerring/processors/alphabet/process_emit.go b/pkg/innerring/processors/alphabet/process_emit.go index dc5552c28..f5885c46b 100644 --- a/pkg/innerring/processors/alphabet/process_emit.go +++ b/pkg/innerring/processors/alphabet/process_emit.go @@ -4,7 +4,7 @@ import ( "crypto/elliptic" "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" "go.uber.org/zap" ) @@ -50,7 +50,7 @@ func (np *Processor) processEmit() { return } - gasPerNode := util.Fixed8(np.storageEmission / uint64(ln)) + gasPerNode := fixedn.Fixed8(np.storageEmission / uint64(ln)) for i := range networkMap.Nodes { keyBytes := networkMap.Nodes[i].PublicKey() diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index 3608b4695..15ea9547c 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -4,6 +4,7 @@ import ( "sync" 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/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -43,7 +44,7 @@ type ( mintEmitLock *sync.Mutex mintEmitCache *lru.Cache mintEmitThreshold uint64 - mintEmitValue util.Fixed8 + mintEmitValue fixedn.Fixed8 } // Params of the processor constructor. @@ -59,7 +60,7 @@ type ( Converter PrecisionConverter MintEmitCacheSize int MintEmitThreshold uint64 // in epochs - MintEmitValue util.Fixed8 + MintEmitValue fixedn.Fixed8 } ) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index ab61efde8..0d1aed3f6 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -2,6 +2,7 @@ package client import ( "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" sc "github.com/nspcc-dev/neo-go/pkg/smartcontract" "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. // 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)) 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 -func (c *Client) TransferGas(receiver util.Uint160, amount util.Fixed8) error { - txHash, err := c.client.TransferNEP5(c.acc, receiver, c.gas, int64(amount), 0) +func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error { + txHash, err := c.client.TransferNEP17(c.acc, receiver, c.gas, int64(amount), 0) if err != nil { return err } diff --git a/pkg/morph/client/static.go b/pkg/morph/client/static.go index 404d54632..f4db5cedf 100644 --- a/pkg/morph/client/static.go +++ b/pkg/morph/client/static.go @@ -3,6 +3,7 @@ package client import ( "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/vm/stackitem" ) @@ -19,7 +20,7 @@ type StaticClient struct { scScriptHash util.Uint160 // contract script-hash - fee util.Fixed8 // invocation fee + fee fixedn.Fixed8 // invocation fee } // 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. // // 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 { return nil, ErrNilClient }