diff --git a/pkg/morph/client/audit/get_result.go b/pkg/morph/client/audit/get_result.go index f4df9488c..7eef6542f 100644 --- a/pkg/morph/client/audit/get_result.go +++ b/pkg/morph/client/audit/get_result.go @@ -31,10 +31,12 @@ func (v *GetAuditResultValue) Result() []byte { // GetAuditResult invokes the call of "get audit result" method // of NeoFS Audit contract. func (c *Client) GetAuditResult(args GetAuditResultArgs) (*GetAuditResultValue, error) { - prms, err := c.client.TestInvoke( - c.getResultMethod, - args.id, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.getResultMethod) + invokePrm.SetArgs(args.id) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getResultMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/audit/list_results.go b/pkg/morph/client/audit/list_results.go index bafbb513f..54271aa75 100644 --- a/pkg/morph/client/audit/list_results.go +++ b/pkg/morph/client/audit/list_results.go @@ -63,9 +63,11 @@ func (v *ListResultsByNodeArgs) SetNodeKey(key []byte) { // ListAuditResults performs the test invoke of "list all audit result IDs" // method of NeoFS Audit contract. func (c *Client) ListAuditResults(args ListResultsArgs) (*ListResultsValues, error) { - items, err := c.client.TestInvoke( - c.listResultsMethod, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listResultsMethod) + + items, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listResultsMethod, err) } @@ -76,10 +78,12 @@ func (c *Client) ListAuditResults(args ListResultsArgs) (*ListResultsValues, err // ListAuditResultsByEpoch performs the test invoke of "list audit result IDs // by epoch" method of NeoFS Audit contract. func (c *Client) ListAuditResultsByEpoch(args ListResultsByEpochArgs) (*ListResultsValues, error) { - items, err := c.client.TestInvoke( - c.listByEpochResultsMethod, - args.epoch, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listByEpochResultsMethod) + invokePrm.SetArgs(args.epoch) + + items, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByEpochResultsMethod, err) } @@ -90,11 +94,12 @@ func (c *Client) ListAuditResultsByEpoch(args ListResultsByEpochArgs) (*ListResu // ListAuditResultsByCID performs the test invoke of "list audit result IDs // by epoch and CID" method of NeoFS Audit contract. func (c *Client) ListAuditResultsByCID(args ListResultsByCIDArgs) (*ListResultsValues, error) { - items, err := c.client.TestInvoke( - c.listByCIDResultsMethod, - args.epoch, - args.cid, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listByCIDResultsMethod) + invokePrm.SetArgs(args.epoch, args.cid) + + items, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByCIDResultsMethod, err) } @@ -105,12 +110,12 @@ func (c *Client) ListAuditResultsByCID(args ListResultsByCIDArgs) (*ListResultsV // ListAuditResultsByNode performs the test invoke of "list audit result IDs // by epoch, CID, and node key" method of NeoFS Audit contract. func (c *Client) ListAuditResultsByNode(args ListResultsByNodeArgs) (*ListResultsValues, error) { - items, err := c.client.TestInvoke( - c.listByNodeResultsMethod, - args.epoch, - args.cid, - args.nodeKey, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listByNodeResultsMethod) + invokePrm.SetArgs(args.epoch, args.cid, args.nodeKey) + + items, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByNodeResultsMethod, err) } diff --git a/pkg/morph/client/audit/put_result.go b/pkg/morph/client/audit/put_result.go index 0c4f5710a..feab50b12 100644 --- a/pkg/morph/client/audit/put_result.go +++ b/pkg/morph/client/audit/put_result.go @@ -2,6 +2,8 @@ package audit import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // PutAuditResultArgs groups the arguments @@ -19,10 +21,12 @@ func (g *PutAuditResultArgs) SetRawResult(v []byte) { // PutAuditResult invokes the call of "put audit result" method // of NeoFS Audit contract. func (c *Client) PutAuditResult(args PutAuditResultArgs) error { - err := c.client.Invoke( - c.putResultMethod, - args.rawResult, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.putResultMethod) + prm.SetArgs(args.rawResult) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.putResultMethod, err) diff --git a/pkg/morph/client/balance/balanceOf.go b/pkg/morph/client/balance/balanceOf.go index d1e1a026a..3f904a689 100644 --- a/pkg/morph/client/balance/balanceOf.go +++ b/pkg/morph/client/balance/balanceOf.go @@ -33,10 +33,12 @@ func (g *GetBalanceOfValues) Amount() *big.Int { // BalanceOf performs the test invoke of "balance of" // method of NeoFS Balance contract. func (c *Client) BalanceOf(args GetBalanceOfArgs) (*GetBalanceOfValues, error) { - prms, err := c.client.TestInvoke( - c.balanceOfMethod, - args.wallet, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.balanceOfMethod) + invokePrm.SetArgs(args.wallet) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.balanceOfMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/balance/decimals.go b/pkg/morph/client/balance/decimals.go index 522d299fe..6fa4633e0 100644 --- a/pkg/morph/client/balance/decimals.go +++ b/pkg/morph/client/balance/decimals.go @@ -25,9 +25,11 @@ func (d *DecimalsValues) Decimals() int64 { // Decimals performs the test invoke of decimals // method of NeoFS Balance contract. func (c *Client) Decimals(args DecimalsArgs) (*DecimalsValues, error) { - prms, err := c.client.TestInvoke( - c.decimalsMethod, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.decimalsMethod) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.decimalsMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/balance/transfer.go b/pkg/morph/client/balance/transfer.go index 6f6094e8b..b753eede8 100644 --- a/pkg/morph/client/balance/transfer.go +++ b/pkg/morph/client/balance/transfer.go @@ -2,6 +2,8 @@ package balance import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // TransferXArgs groups the arguments @@ -43,13 +45,12 @@ func (t *TransferXArgs) SetDetails(v []byte) { // TransferX directly invokes the call of "transferX" method // of NeoFS Balance contract. func (c *Client) TransferX(args TransferXArgs) error { - err := c.client.Invoke( - c.transferXMethod, - args.sender, - args.recipient, - args.amount, - args.details, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.transferXMethod) + prm.SetArgs(args.sender, args.recipient, args.amount, args.details) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.transferXMethod, err) } @@ -59,15 +60,30 @@ func (c *Client) TransferX(args TransferXArgs) error { // Mint invokes `mint` method of the balance contract. func (c *Client) Mint(to []byte, amount int64, id []byte) error { - return c.client.Invoke(c.mintMethod, to, amount, id) + prm := client.InvokePrm{} + + prm.SetMethod(c.mintMethod) + prm.SetArgs(to, amount, id) + + return c.client.Invoke(prm) } // Burn invokes `burn` method of the balance contract. func (c *Client) Burn(to []byte, amount int64, id []byte) error { - return c.client.Invoke(c.burnMethod, to, amount, id) + prm := client.InvokePrm{} + + prm.SetMethod(c.burnMethod) + prm.SetArgs(to, amount, id) + + return c.client.Invoke(prm) } // Lock invokes `lock` method of the balance contract. func (c *Client) Lock(id, user, lock []byte, amount, dueEpoch int64) error { - return c.client.Invoke(c.lockMethod, id, user, lock, amount, dueEpoch) + prm := client.InvokePrm{} + + prm.SetMethod(c.lockMethod) + prm.SetArgs(id, user, lock, amount, dueEpoch) + + return c.client.Invoke(prm) } diff --git a/pkg/morph/client/container/delete.go b/pkg/morph/client/container/delete.go index f6c4e7869..429251e3d 100644 --- a/pkg/morph/client/container/delete.go +++ b/pkg/morph/client/container/delete.go @@ -2,6 +2,8 @@ package container import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // DeleteArgs groups the arguments @@ -36,12 +38,12 @@ func (p *DeleteArgs) SetSessionToken(v []byte) { // Delete invokes the call of delete container // method of NeoFS Container contract. func (c *Client) Delete(args DeleteArgs) error { - err := c.client.Invoke( - c.deleteMethod, - args.cid, - args.sig, - args.token, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.deleteMethod) + prm.SetArgs(args.cid, args.sig, args.token) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.deleteMethod, err) diff --git a/pkg/morph/client/container/eacl.go b/pkg/morph/client/container/eacl.go index 4ec76d394..65ceeb8b0 100644 --- a/pkg/morph/client/container/eacl.go +++ b/pkg/morph/client/container/eacl.go @@ -55,10 +55,12 @@ func (g *EACLValues) SessionToken() []byte { // EACL performs the test invoke of get eACL // method of NeoFS Container contract. func (c *Client) EACL(args EACLArgs) (*EACLValues, error) { - prms, err := c.client.TestInvoke( - c.eaclMethod, - args.cid, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.eaclMethod) + invokePrm.SetArgs(args.cid) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.eaclMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/container/eacl_set.go b/pkg/morph/client/container/eacl_set.go index cb90e7cf9..c9929d794 100644 --- a/pkg/morph/client/container/eacl_set.go +++ b/pkg/morph/client/container/eacl_set.go @@ -2,6 +2,8 @@ package container import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // SetEACLArgs groups the arguments @@ -44,13 +46,12 @@ func (p *SetEACLArgs) SetSessionToken(v []byte) { // SetEACL invokes the call of set eACL method // of NeoFS Container contract. func (c *Client) SetEACL(args SetEACLArgs) error { - err := c.client.Invoke( - c.setEACLMethod, - args.eacl, - args.sig, - args.pubkey, - args.token, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.setEACLMethod) + prm.SetArgs(args.eacl, args.sig, args.pubkey, args.token) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.setEACLMethod, err) diff --git a/pkg/morph/client/container/estimations.go b/pkg/morph/client/container/estimations.go index 45eadbb06..9681cbed1 100644 --- a/pkg/morph/client/container/estimations.go +++ b/pkg/morph/client/container/estimations.go @@ -2,6 +2,8 @@ package container import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) type StartEstimation struct { @@ -21,14 +23,24 @@ func (e *StopEstimation) SetEpoch(v int64) { } func (c *Client) StartEstimation(args StartEstimation) error { - if err := c.client.Invoke(c.startEstimation, args.epoch); err != nil { + prm := client.InvokePrm{} + + prm.SetMethod(c.startEstimation) + prm.SetArgs(args.epoch) + + if err := c.client.Invoke(prm); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err) } return nil } func (c *Client) StopEstimation(args StopEstimation) error { - if err := c.client.Invoke(c.stopEstimation, args.epoch); err != nil { + prm := client.InvokePrm{} + + prm.SetMethod(c.stopEstimation) + prm.SetArgs(args.epoch) + + if err := c.client.Invoke(prm); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err) } return nil diff --git a/pkg/morph/client/container/get.go b/pkg/morph/client/container/get.go index c4355f719..7a348ca14 100644 --- a/pkg/morph/client/container/get.go +++ b/pkg/morph/client/container/get.go @@ -55,10 +55,12 @@ func (g *GetValues) SessionToken() []byte { // Get performs the test invoke of get container // method of NeoFS Container contract. func (c *Client) Get(args GetArgs) (*GetValues, error) { - prms, err := c.client.TestInvoke( - c.getMethod, - args.cid, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.getMethod) + invokePrm.SetArgs(args.cid) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/container/list.go b/pkg/morph/client/container/list.go index abec061ae..02c1523f6 100644 --- a/pkg/morph/client/container/list.go +++ b/pkg/morph/client/container/list.go @@ -33,14 +33,12 @@ func (l *ListValues) CIDList() [][]byte { // List performs the test invoke of list container // method of NeoFS Container contract. func (c *Client) List(args ListArgs) (*ListValues, error) { - invokeArgs := make([]interface{}, 0, 1) + invokePrm := client.TestInvokePrm{} - invokeArgs = append(invokeArgs, args.ownerID) + invokePrm.SetMethod(c.listMethod) + invokePrm.SetArgs(args.ownerID) - prms, err := c.client.TestInvoke( - c.listMethod, - invokeArgs..., - ) + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/container/load.go b/pkg/morph/client/container/load.go index 2c588987a..7a9d18623 100644 --- a/pkg/morph/client/container/load.go +++ b/pkg/morph/client/container/load.go @@ -44,13 +44,12 @@ func (p *PutSizeArgs) SetReporterKey(v []byte) { // PutSize invokes the call of put container size method // of NeoFS Container contract. func (c *Client) PutSize(args PutSizeArgs) error { - err := c.client.Invoke( - c.putSizeMethod, - args.epoch, - args.cid, - args.size, - args.reporterKey, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.putSizeMethod) + prm.SetArgs(args.epoch, args.cid, args.size, args.reporterKey) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.putSizeMethod, err) @@ -76,19 +75,21 @@ type ListSizesValues struct { ids [][]byte } -// Announcements returns list of identifiers of the +// IDList returns list of identifiers of the // container load estimations. func (v *ListSizesValues) IDList() [][]byte { return v.ids } -// List performs the test invoke of "list container sizes" +// ListSizes performs the test invoke of "list container sizes" // method of NeoFS Container contract. func (c *Client) ListSizes(args ListSizesArgs) (*ListSizesValues, error) { - prms, err := c.client.TestInvoke( - c.listSizesMethod, - args.epoch, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listSizesMethod) + invokePrm.SetArgs(args.epoch) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listSizesMethod, err) } else if ln := len(prms); ln != 1 { @@ -153,10 +154,12 @@ func (v *GetSizeValues) Estimations() Estimations { // GetContainerSize performs the test invoke of "get container size" // method of NeoFS Container contract. func (c *Client) GetContainerSize(args GetSizeArgs) (*GetSizeValues, error) { - prms, err := c.client.TestInvoke( - c.getSizeMethod, - args.id, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.getSizeMethod) + invokePrm.SetArgs(args.id) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getSizeMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/container/put.go b/pkg/morph/client/container/put.go index 85cd1828b..cd89e89bd 100644 --- a/pkg/morph/client/container/put.go +++ b/pkg/morph/client/container/put.go @@ -2,6 +2,8 @@ package container import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // PutArgs groups the arguments @@ -52,34 +54,23 @@ func (p *PutArgs) SetNativeNameWithZone(name, zone string) { // of NeoFS Container contract. func (c *Client) Put(args PutArgs) error { var ( - err error method string + prm client.InvokePrm ) if args.name != "" { - err = c.client.Invoke( - c.putNamedMethod, - args.cnr, - args.sig, - args.publicKey, - args.token, - args.name, - args.zone, - ) - method = c.putNamedMethod - } else { - err = c.client.Invoke( - c.putMethod, - args.cnr, - args.sig, - args.publicKey, - args.token, - ) + prm.SetArgs(args.cnr, args.sig, args.publicKey, args.token, args.name, args.zone) + } else { method = c.putMethod + + prm.SetArgs(args.cnr, args.sig, args.publicKey, args.token) } + prm.SetMethod(method) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", method, err) } diff --git a/pkg/morph/client/neofs/bind.go b/pkg/morph/client/neofs/bind.go index 646e4ce6b..8f3757189 100644 --- a/pkg/morph/client/neofs/bind.go +++ b/pkg/morph/client/neofs/bind.go @@ -2,6 +2,8 @@ package neofscontract import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // BindKeysArgs groups the arguments @@ -35,11 +37,12 @@ func (x *commonBindArgs) SetKeys(v [][]byte) { // BindKeys invokes the call of key binding method // of NeoFS contract. func (x *Client) BindKeys(args BindKeysArgs) error { - err := x.client.Invoke( - x.bindKeysMethod, - args.scriptHash, - args.keys, - ) + prm := client.InvokePrm{} + + prm.SetMethod(x.bindKeysMethod) + prm.SetArgs(args.scriptHash, args.keys) + + err := x.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", x.bindKeysMethod, err) } @@ -50,11 +53,12 @@ func (x *Client) BindKeys(args BindKeysArgs) error { // UnbindKeys invokes the call of key unbinding method // of NeoFS contract. func (x *Client) UnbindKeys(args UnbindKeysArgs) error { - err := x.client.Invoke( - x.unbindKeysMethod, - args.scriptHash, - args.keys, - ) + prm := client.InvokePrm{} + + prm.SetMethod(x.unbindKeysMethod) + prm.SetArgs(args.scriptHash, args.keys) + + err := x.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", x.unbindKeysMethod, err) } diff --git a/pkg/morph/client/neofs/cheque.go b/pkg/morph/client/neofs/cheque.go index 6d844cb53..a2fa03697 100644 --- a/pkg/morph/client/neofs/cheque.go +++ b/pkg/morph/client/neofs/cheque.go @@ -3,14 +3,25 @@ package neofscontract import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // Cheque invokes `cheque` method of NeoFS contract. func (x *Client) Cheque(id []byte, user util.Uint160, amount int64, lock util.Uint160) error { - return x.client.Invoke(x.chequeMethod, id, user.BytesBE(), amount, lock.BytesBE()) + prm := client.InvokePrm{} + + prm.SetMethod(x.chequeMethod) + prm.SetArgs(id, user.BytesBE(), amount, lock.BytesBE()) + + return x.client.Invoke(prm) } // AlphabetUpdate update list of alphabet nodes. func (x *Client) AlphabetUpdate(id []byte, pubs keys.PublicKeys) error { - return x.client.Invoke(x.alphabetUpdateMethod, id, pubs) + prm := client.InvokePrm{} + + prm.SetMethod(x.alphabetUpdateMethod) + prm.SetArgs(id, pubs) + + return x.client.Invoke(prm) } diff --git a/pkg/morph/client/neofsid/addrm_keys.go b/pkg/morph/client/neofsid/addrm_keys.go index a7d7e3ef8..4c5976e84 100644 --- a/pkg/morph/client/neofsid/addrm_keys.go +++ b/pkg/morph/client/neofsid/addrm_keys.go @@ -2,6 +2,8 @@ package neofsid import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // AddKeysArgs groups the arguments @@ -35,11 +37,12 @@ func (x *commonBindArgs) SetKeys(v [][]byte) { // AddKeys invokes the call of key adding method // of NeoFS contract. func (x *Client) AddKeys(args AddKeysArgs) error { - err := x.client.Invoke( - x.addKeysMethod, - args.ownerID, - args.keys, - ) + prm := client.InvokePrm{} + + prm.SetMethod(x.addKeysMethod) + prm.SetArgs(args.ownerID, args.keys) + + err := x.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", x.addKeysMethod, err) } @@ -50,11 +53,12 @@ func (x *Client) AddKeys(args AddKeysArgs) error { // RemoveKeys invokes the call of key removing method // of NeoFS contract. func (x *Client) RemoveKeys(args RemoveKeysArgs) error { - err := x.client.Invoke( - x.removeKeysMethod, - args.ownerID, - args.keys, - ) + prm := client.InvokePrm{} + + prm.SetMethod(x.removeKeysMethod) + prm.SetArgs(args.ownerID, args.keys) + + err := x.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", x.removeKeysMethod, err) } diff --git a/pkg/morph/client/neofsid/keys.go b/pkg/morph/client/neofsid/keys.go index 414352a00..da15271cd 100644 --- a/pkg/morph/client/neofsid/keys.go +++ b/pkg/morph/client/neofsid/keys.go @@ -33,14 +33,12 @@ func (l *KeyListingValues) Keys() [][]byte { // AccountKeys requests public keys of NeoFS account // through method of NeoFS ID contract. func (x *Client) AccountKeys(args KeyListingArgs) (*KeyListingValues, error) { - invokeArgs := make([]interface{}, 0, 1) + invokePrm := client.TestInvokePrm{} - invokeArgs = append(invokeArgs, args.ownerID) + invokePrm.SetMethod(x.keyListingMethod) + invokePrm.SetArgs(args.ownerID) - items, err := x.client.TestInvoke( - x.keyListingMethod, - invokeArgs..., - ) + items, err := x.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", x.keyListingMethod, err) } else if ln := len(items); ln != 1 { diff --git a/pkg/morph/client/netmap/add_peer.go b/pkg/morph/client/netmap/add_peer.go index 6da371703..64c65396f 100644 --- a/pkg/morph/client/netmap/add_peer.go +++ b/pkg/morph/client/netmap/add_peer.go @@ -2,6 +2,8 @@ package netmap import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // AddPeerArgs groups the arguments @@ -18,7 +20,12 @@ func (a *AddPeerArgs) SetInfo(v []byte) { // AddPeer invokes the call of add peer method // of NeoFS Netmap contract. func (c *Client) AddPeer(args AddPeerArgs) error { - if err := c.client.Invoke(c.addPeerMethod, args.info); err != nil { + prm := client.InvokePrm{} + + prm.SetMethod(c.addPeerMethod) + prm.SetArgs(args.info) + + if err := c.client.Invoke(prm); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.addPeerMethod, err) } return nil diff --git a/pkg/morph/client/netmap/config.go b/pkg/morph/client/netmap/config.go index e6962adfa..43187356f 100644 --- a/pkg/morph/client/netmap/config.go +++ b/pkg/morph/client/netmap/config.go @@ -32,10 +32,12 @@ func (c ConfigValues) Value() interface{} { // Config performs the test invoke of get config value // method of NeoFS Netmap contract. func (c *Client) Config(args ConfigArgs, assert func(stackitem.Item) (interface{}, error)) (*ConfigValues, error) { - items, err := c.client.TestInvoke( - c.configMethod, - args.key, - ) + prm := client.TestInvokePrm{} + + prm.SetMethod(c.configMethod) + prm.SetArgs(args.key) + + items, err := c.client.TestInvoke(prm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.configMethod, err) @@ -58,7 +60,12 @@ func (c *Client) Config(args ConfigArgs, assert func(stackitem.Item) (interface{ // SetConfig invokes `setConfig` method of NeoFS Netmap contract. func (c *Client) SetConfig(id, key []byte, value interface{}) error { - return c.client.Invoke(c.setConfigMethod, id, key, value) + prm := client.InvokePrm{} + + prm.SetMethod(c.setConfigMethod) + prm.SetArgs(id, key, value) + + return c.client.Invoke(prm) } func IntegerAssert(item stackitem.Item) (interface{}, error) { @@ -74,7 +81,7 @@ func StringAssert(item stackitem.Item) (interface{}, error) { type ListConfigArgs struct { } -// ConfigValues groups the stack parameters +// ListConfigValues groups the stack parameters // returned by config listing test invoke. type ListConfigValues struct { rs []stackitem.Item @@ -114,9 +121,11 @@ func (x ListConfigValues) IterateRecords(f func(key, value []byte) error) error // ListConfig performs the test invoke of config listing method of NeoFS Netmap contract. func (c *Client) ListConfig(args ListConfigArgs) (*ListConfigValues, error) { - items, err := c.client.TestInvoke( - c.configListMethod, - ) + prm := client.TestInvokePrm{} + + prm.SetMethod(c.configListMethod) + + items, err := c.client.TestInvoke(prm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.configListMethod, err) diff --git a/pkg/morph/client/netmap/epoch.go b/pkg/morph/client/netmap/epoch.go index 0aad4192d..03a96e10f 100644 --- a/pkg/morph/client/netmap/epoch.go +++ b/pkg/morph/client/netmap/epoch.go @@ -41,9 +41,10 @@ func (e EpochBlockValues) Block() int64 { // Epoch performs the test invoke of get epoch number // method of NeoFS Netmap contract. func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) { - items, err := c.client.TestInvoke( - c.epochMethod, - ) + prm := client.TestInvokePrm{} + prm.SetMethod(c.epochMethod) + + items, err := c.client.TestInvoke(prm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.epochMethod, err) @@ -67,7 +68,10 @@ func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) { // LastEpochBlock performs the test invoke of get epoch block number // method of NeoFS Netmap contract. func (c *Client) LastEpochBlock(_ EpochBlockArgs) (*EpochBlockValues, error) { - items, err := c.client.TestInvoke(c.lastEpochBlockMethod) + prm := client.TestInvokePrm{} + prm.SetMethod(c.lastEpochBlockMethod) + + items, err := c.client.TestInvoke(prm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.lastEpochBlockMethod, err) diff --git a/pkg/morph/client/netmap/innerring.go b/pkg/morph/client/netmap/innerring.go index 622c2a664..bc2547a36 100644 --- a/pkg/morph/client/netmap/innerring.go +++ b/pkg/morph/client/netmap/innerring.go @@ -16,15 +16,21 @@ func (c *Client) UpdateInnerRing(keys keys.PublicKeys) error { args[i] = keys[i].Bytes() } - return c.client.Invoke(c.updateInnerRing, args) + prm := client.InvokePrm{} + + prm.SetMethod(c.updateInnerRing) + prm.SetArgs(args) + + return c.client.Invoke(prm) } // InnerRingList returns public keys of inner ring members in // netmap contract. func (c *Client) InnerRingList() (keys.PublicKeys, error) { - prms, err := c.client.TestInvoke( - c.innerRingList, - ) + invokePrm := client.TestInvokePrm{} + invokePrm.SetMethod(c.innerRingList) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.innerRingList, err) } diff --git a/pkg/morph/client/netmap/netmap.go b/pkg/morph/client/netmap/netmap.go index 4e7662da9..5f9d894a9 100644 --- a/pkg/morph/client/netmap/netmap.go +++ b/pkg/morph/client/netmap/netmap.go @@ -106,9 +106,10 @@ func (g GetNetMapValues) Peers() [][]byte { // NetMap performs the test invoke of get network map // method of NeoFS Netmap contract. func (c *Client) NetMap(_ GetNetMapArgs) (*GetNetMapValues, error) { - prms, err := c.client.TestInvoke( - c.netMapMethod, - ) + invokePrm := client.TestInvokePrm{} + invokePrm.SetMethod(c.netMapMethod) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.netMapMethod, err) @@ -121,10 +122,12 @@ func (c *Client) NetMap(_ GetNetMapArgs) (*GetNetMapValues, error) { // from NeoFS Netmap contract. Contract saves only one previous epoch, // so all invokes with diff > 1 return error. func (c *Client) Snapshot(a GetSnapshotArgs) (*GetNetMapValues, error) { - prms, err := c.client.TestInvoke( - c.snapshotMethod, - int64(a.diff), - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.snapshotMethod) + invokePrm.SetArgs(int64(a.diff)) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.netMapMethod, err) @@ -136,10 +139,12 @@ func (c *Client) Snapshot(a GetSnapshotArgs) (*GetNetMapValues, error) { // EpochSnapshot performs the test invoke of get snapshot of network map by epoch // from NeoFS Netmap contract. func (c *Client) EpochSnapshot(args EpochSnapshotArgs) (*EpochSnapshotValues, error) { - prms, err := c.client.TestInvoke( - c.epochSnapshotMethod, - int64(args.epoch), - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.epochSnapshotMethod) + invokePrm.SetArgs(int64(args.epoch)) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.epochSnapshotMethod, err) @@ -156,9 +161,10 @@ func (c *Client) EpochSnapshot(args EpochSnapshotArgs) (*EpochSnapshotValues, er } func (c *Client) Candidates(_ GetNetMapCandidatesArgs) (*GetNetMapCandidatesValues, error) { - prms, err := c.client.TestInvoke( - c.netMapCandidatesMethod, - ) + invokePrm := client.TestInvokePrm{} + invokePrm.SetMethod(c.netMapCandidatesMethod) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.netMapCandidatesMethod, err) } diff --git a/pkg/morph/client/netmap/new_epoch.go b/pkg/morph/client/netmap/new_epoch.go index d87388dce..906463ee6 100644 --- a/pkg/morph/client/netmap/new_epoch.go +++ b/pkg/morph/client/netmap/new_epoch.go @@ -2,6 +2,8 @@ package netmap import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // NewEpochArgs groups the arguments @@ -18,7 +20,12 @@ func (a *NewEpochArgs) SetEpochNumber(v int64) { // NewEpoch invokes the call of new epoch method // of NeoFS Netmap contract. func (c *Client) NewEpoch(args NewEpochArgs) error { - if err := c.client.Invoke(c.newEpochMethod, args.number); err != nil { + prm := client.InvokePrm{} + + prm.SetMethod(c.newEpochMethod) + prm.SetArgs(args.number) + + if err := c.client.Invoke(prm); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.newEpochMethod, err) } return nil diff --git a/pkg/morph/client/netmap/update_state.go b/pkg/morph/client/netmap/update_state.go index 0045a0ce6..a432125f0 100644 --- a/pkg/morph/client/netmap/update_state.go +++ b/pkg/morph/client/netmap/update_state.go @@ -2,6 +2,8 @@ package netmap import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // UpdateStateArgs groups the arguments @@ -26,11 +28,12 @@ func (u *UpdateStateArgs) SetState(v int64) { // UpdateState invokes the call of update state method // of NeoFS Netmap contract. func (c *Client) UpdateState(args UpdateStateArgs) error { - err := c.client.Invoke( - c.updateStateMethod, - args.state, - args.key, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.updateStateMethod) + prm.SetArgs(args.state, args.key) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.updateStateMethod, err) diff --git a/pkg/morph/client/reputation/get.go b/pkg/morph/client/reputation/get.go index 37606bd25..5e087e016 100644 --- a/pkg/morph/client/reputation/get.go +++ b/pkg/morph/client/reputation/get.go @@ -47,11 +47,12 @@ func (g GetResult) Reputations() [][]byte { // Get invokes the call of "get reputation value" method of reputation contract. func (c *Client) Get(args GetArgs) (*GetResult, error) { - prms, err := c.client.TestInvoke( - c.getMethod, - int64(args.epoch), - args.peerID, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.getMethod) + invokePrm.SetArgs(int64(args.epoch), args.peerID) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getMethod, err) } @@ -62,10 +63,12 @@ func (c *Client) Get(args GetArgs) (*GetResult, error) { // GetByID invokes the call of "get reputation value by reputation id" method // of reputation contract. func (c *Client) GetByID(args GetByIDArgs) (*GetResult, error) { - prms, err := c.client.TestInvoke( - c.getByIDMethod, - args.id, - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.getByIDMethod) + invokePrm.SetArgs(args.id) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getByIDMethod, err) } diff --git a/pkg/morph/client/reputation/list.go b/pkg/morph/client/reputation/list.go index 53704f5e6..ec05196c4 100644 --- a/pkg/morph/client/reputation/list.go +++ b/pkg/morph/client/reputation/list.go @@ -31,10 +31,12 @@ func (l ListByEpochResult) IDs() [][]byte { // ListByEpoch invokes the call of "list reputation ids by epoch" method of // reputation contract. func (c *Client) ListByEpoch(args ListByEpochArgs) (*ListByEpochResult, error) { - prms, err := c.client.TestInvoke( - c.listByEpochMethod, - int64(args.epoch), - ) + invokePrm := client.TestInvokePrm{} + + invokePrm.SetMethod(c.listByEpochMethod) + invokePrm.SetArgs(int64(args.epoch)) + + prms, err := c.client.TestInvoke(invokePrm) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByEpochMethod, err) } else if ln := len(prms); ln != 1 { diff --git a/pkg/morph/client/reputation/put.go b/pkg/morph/client/reputation/put.go index 9d05b2097..33ab42508 100644 --- a/pkg/morph/client/reputation/put.go +++ b/pkg/morph/client/reputation/put.go @@ -2,6 +2,8 @@ package reputation import ( "fmt" + + "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) // PutArgs groups the arguments of "put reputation value" invocation call. @@ -28,12 +30,12 @@ func (p *PutArgs) SetValue(v []byte) { // Put invokes direct call of "put reputation value" method of reputation contract. func (c *Client) Put(args PutArgs) error { - err := c.client.Invoke( - c.putMethod, - int64(args.epoch), - args.peerID, - args.value, - ) + prm := client.InvokePrm{} + + prm.SetMethod(c.putMethod) + prm.SetArgs(int64(args.epoch), args.peerID, args.value) + + err := c.client.Invoke(prm) if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.putMethod, err)