diff --git a/tests/neofs_test.go b/tests/neofs_test.go index 9a063bb..0d09bde 100644 --- a/tests/neofs_test.go +++ b/tests/neofs_test.go @@ -38,7 +38,7 @@ func deployNeoFSContract(t *testing.T, e *neotest.Executor, addrProc util.Uint16 return c.Hash } -func newNeoFSInvoker(t *testing.T, n int, config ...interface{}) (*neotest.ContractInvoker, keys.PublicKeys) { +func newNeoFSInvoker(t *testing.T, n int, config ...interface{}) (*neotest.ContractInvoker, neotest.Signer, keys.PublicKeys) { e := newExecutor(t) accounts := make([]*wallet.Account, n) @@ -76,13 +76,13 @@ func newNeoFSInvoker(t *testing.T, n int, config ...interface{}) (*neotest.Contr e.Validator.ScriptHash(), alphabet.ScriptHash(), int64(10_0000_0000), nil) - return e.CommitteeInvoker(h).WithSigners(alphabet), pubs + return e.CommitteeInvoker(h).WithSigners(alphabet), alphabet, pubs } func TestNeoFS_AlphabetList(t *testing.T) { const alphabetSize = 4 - e, pubs := newNeoFSInvoker(t, alphabetSize) + e, _, pubs := newNeoFSInvoker(t, alphabetSize) arr := make([]stackitem.Item, len(pubs)) for i := range arr { arr[i] = stackitem.NewStruct([]stackitem.Item{ @@ -94,7 +94,7 @@ func TestNeoFS_AlphabetList(t *testing.T) { } func TestNeoFS_InnerRingCandidate(t *testing.T) { - e, _ := newNeoFSInvoker(t, 4, neofs.CandidateFeeConfigKey, int64(10)) + e, _, _ := newNeoFSInvoker(t, 4, neofs.CandidateFeeConfigKey, int64(10)) const candidateCount = 3 diff --git a/tests/processing_test.go b/tests/processing_test.go new file mode 100644 index 0000000..248eef8 --- /dev/null +++ b/tests/processing_test.go @@ -0,0 +1,40 @@ +package tests + +import ( + "path" + "testing" + + "github.com/nspcc-dev/neo-go/pkg/neotest" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" +) + +const processingPath = "../processing" + +func deployProcessingContract(t *testing.T, e *neotest.Executor, addrNeoFS util.Uint160) util.Uint160 { + c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml")) + + args := make([]interface{}, 1) + args[0] = addrNeoFS + + e.DeployContract(t, c, args) + return c.Hash +} + +func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.Signer) { + neofsInvoker, irMultiAcc, _ := newNeoFSInvoker(t, 2) + hash := deployProcessingContract(t, neofsInvoker.Executor, neofsInvoker.Hash) + + return neofsInvoker.CommitteeInvoker(hash), irMultiAcc +} + +func TestVerify_Processing(t *testing.T) { + c, irMultiAcc := newProcessingInvoker(t) + + const method = "verify" + + cIR := c.WithSigners(irMultiAcc) + + cIR.Invoke(t, stackitem.NewBool(true), method) + c.Invoke(t, stackitem.NewBool(false), method) +}