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 | Bin 60744 -> 60744 bytes pkg/innerring/innerring.go | 3 ++- .../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, 23 insertions(+), 18 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index c1383715..3b4f4522 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 7256e6c8..f4181ceb 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 bb730231..a22558e1 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 2ade4a85da3a2c4a2ba64d78c4f63bdd29aa11cf..f41515d103a9db989e3f562df300345b26e5bf68 100644 GIT binary patch delta 277 zcmX?ci}}PY<_(WB-3$#4EDcSJjZBSnlT(b$Q_RiG49!zh6fz90LQD#?N=pKK3$yYf zT>{-Ii;|pE%Z+o~Q@u*ed_9x=D*f`z(}OAu^7YdvPs|aYY@a0{j>EXkX<5%0U5yM) z4Gjz}Ow4u7lZ}i_%`FU!(~ONkRz;QgW*QoXJ4b|v8fGV#Wabv+W|$|Z<~fJ^dFJQk zW@jY(x;mPNrCYjs0EXkX<5%0T@8#4 z49txzjLme-4UG)VEX+*J4b784R;6c~CPk$eg!`vvB)WuodzzLxxnw72MT8UtWqTJU zmw6@`X6ToB#}uc+JlA}nfl`|_aupf?5<*sK diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 7d46498c..ad4db2a9 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 dc5552c2..f5885c46 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 3608b469..15ea9547 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 ab61efde..0d1aed3f 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 404d5463..f4db5ced 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 }