2021-12-06 14:35:58 +00:00
|
|
|
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"
|
|
|
|
|
2023-01-09 11:31:34 +00:00
|
|
|
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrFrostFS util.Uint160) util.Uint160 {
|
2021-12-06 14:35:58 +00:00
|
|
|
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
|
|
|
|
|
|
|
|
args := make([]interface{}, 1)
|
2023-01-09 11:31:34 +00:00
|
|
|
args[0] = addrFrostFS
|
2021-12-06 14:35:58 +00:00
|
|
|
|
|
|
|
e.DeployContract(t, c, args)
|
|
|
|
return c.Hash
|
|
|
|
}
|
|
|
|
|
|
|
|
func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.Signer) {
|
2023-01-09 11:31:34 +00:00
|
|
|
frostfsInvoker, irMultiAcc, _ := newFrostFSInvoker(t, 2)
|
|
|
|
hash := deployProcessingContract(t, frostfsInvoker.Executor, frostfsInvoker.Hash)
|
2021-12-06 14:35:58 +00:00
|
|
|
|
2023-01-09 11:31:34 +00:00
|
|
|
return frostfsInvoker.CommitteeInvoker(hash), irMultiAcc
|
2021-12-06 14:35:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|