Rebrand token symbols: TUTUS->TUT, update display names

Token symbol and display name changes:
- Governance symbol: TUTUS -> TUT (3 chars, King Tut reference)
- Governance display: TutusToken -> Tutus
- Utility display: LubToken -> Lub

Core changes:
- nativenames: TutusToken->Tutus, LubToken->Lub
- native_tutus.go: symbol = "TUT"
- Regenerated nativehashes with new contract hashes
- Updated interop packages with new hashes

Test updates:
- CLI tests: Updated token symbols (TUT, LUB)
- test_contract.yml: Updated permission hash
- examples go.mod: Added replace directives for local modules

Final token lineup:
- TUT: Governance/staking (3 chars)
- LUB: Utility/gas (3 chars)
- VTS: Currency (3 chars)
- VITA: Identity NFT (4 chars)
This commit is contained in:
Tutus Development 2025-12-21 13:03:49 -05:00
parent 54d1dab720
commit 42eb48aa65
28 changed files with 443 additions and 435 deletions

View File

@ -11,8 +11,8 @@ import (
func TestCLIVersion(t *testing.T) {
config.Version = versionutil.TestVersion // Zero-length version string disables '--version' completely.
e := testcli.NewExecutor(t, false)
e.Run(t, "neo-go", "--version")
e.CheckNextLine(t, "^NeoGo")
e.Run(t, "tutus", "--version")
e.CheckNextLine(t, "^Tutus")
e.CheckNextLine(t, "^Version:")
e.CheckNextLine(t, "^GoVersion:")
e.CheckEOF(t)

View File

@ -48,10 +48,10 @@ func TestNEP11Import(t *testing.T) {
nfsContractHash := deployNFSContract(t, e)
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus)
require.NoError(t, err)
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
args := []string{
"neo-go", "wallet", "nep11", "import",
"tutus", "wallet", "nep11", "import",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", walletPath,
}
@ -86,16 +86,16 @@ func TestNEP11Import(t *testing.T) {
}
t.Run("Info", func(t *testing.T) {
t.Run("excessive parameters", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "nep11", "info",
e.RunWithError(t, "tutus", "wallet", "nep11", "info",
"--wallet", walletPath, "--token", nnsContractHash.StringLE(), "qwerty")
})
t.Run("WithToken", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "nep11", "info",
e.Run(t, "tutus", "wallet", "nep11", "info",
"--wallet", walletPath, "--token", nnsContractHash.StringLE())
checkInfo(t, nnsContractHash, "NameService", "NNS", 0)
})
t.Run("NoToken", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "nep11", "info",
e.Run(t, "tutus", "wallet", "nep11", "info",
"--wallet", walletPath)
checkInfo(t, nnsContractHash, "NameService", "NNS", 0)
e.CheckNextLine(t, "")
@ -104,12 +104,12 @@ func TestNEP11Import(t *testing.T) {
})
t.Run("Remove", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "nep11", "remove",
e.RunWithError(t, "tutus", "wallet", "nep11", "remove",
"--wallet", walletPath, "--token", nnsContractHash.StringLE(), "parameter")
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "nep11", "remove",
e.Run(t, "tutus", "wallet", "nep11", "remove",
"--wallet", walletPath, "--token", nnsContractHash.StringLE())
e.Run(t, "neo-go", "wallet", "nep11", "info",
e.Run(t, "tutus", "wallet", "nep11", "info",
"--wallet", walletPath)
checkInfo(t, nfsContractHash, "NeoFS Object NFT", "NFSO", 2)
_, err := e.Out.ReadString('\n')
@ -130,11 +130,11 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// transfer funds to contract owner
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", nftOwnerAddr,
"--token", "GAS",
"--token", "LUB",
"--amount", "10000",
"--force",
"--from", testcli.ValidatorAddr)
@ -146,11 +146,11 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
mint := func(t *testing.T) []byte {
// mint 1 HASHY token by transferring 10 GAS to HASHY contract
e.In.WriteString(nftOwnerPass + "\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wall,
"--to", h.StringLE(),
"--token", "GAS",
"--token", "LUB",
"--amount", "10",
"--force",
"--from", nftOwnerAddr)
@ -173,7 +173,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
var hashBeforeTransfer = e.Chain.CurrentHeaderHash()
// check the balance
cmdCheckBalance := []string{"neo-go", "wallet", "nep11", "balance",
cmdCheckBalance := []string{"tutus", "wallet", "nep11", "balance",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--address", nftOwnerAddr}
@ -203,13 +203,13 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
e.Run(t, append(cmdCheckBalance, "--token", "HASHY")...)
checkBalanceResult(t, nftOwnerAddr, tokenID)
// balance check: excessive parameters
e.RunWithError(t, append(cmdCheckBalance, "--token", h.StringLE(), "neo-go")...)
e.RunWithError(t, append(cmdCheckBalance, "--token", h.StringLE(), "tutus")...)
// balance check: by hash, ok
e.Run(t, append(cmdCheckBalance, "--token", h.StringLE())...)
checkBalanceResult(t, nftOwnerAddr, tokenID)
// import token
e.Run(t, "neo-go", "wallet", "nep11", "import",
e.Run(t, "tutus", "wallet", "nep11", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wall,
"--token", h.StringLE())
@ -219,7 +219,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
checkBalanceResult(t, nftOwnerAddr, tokenID)
// balance check: all accounts
e.Run(t, "neo-go", "wallet", "nep11", "balance",
e.Run(t, "tutus", "wallet", "nep11", "balance",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wall,
"--token", h.StringLE())
@ -227,11 +227,11 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// remove token from wallet
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "nep11", "remove",
e.Run(t, "tutus", "wallet", "nep11", "remove",
"--wallet", wall, "--token", h.StringLE())
// ownerOf: missing contract hash
cmdOwnerOf := []string{"neo-go", "wallet", "nep11", "ownerOf",
cmdOwnerOf := []string{"tutus", "wallet", "nep11", "ownerOf",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdOwnerOf...)
@ -246,7 +246,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
e.CheckNextLine(t, nftOwnerAddr)
// tokensOf: missing contract hash
cmdTokensOf := []string{"neo-go", "wallet", "nep11", "tokensOf",
cmdTokensOf := []string{"tutus", "wallet", "nep11", "tokensOf",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flags "token, address" not set`, cmdTokensOf...)
@ -262,7 +262,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// properties: no contract
cmdProperties := []string{
"neo-go", "wallet", "nep11", "properties",
"tutus", "wallet", "nep11", "properties",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdProperties...)
@ -288,7 +288,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
require.Equal(t, hex.EncodeToString(snd), e.GetNextLine(t))
// tokens: missing contract hash
cmdTokens := []string{"neo-go", "wallet", "nep11", "tokens",
cmdTokens := []string{"tutus", "wallet", "nep11", "tokens",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdTokens...)
@ -306,7 +306,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
checkBalanceResult(t, nftOwnerAddr, tokenID, tokenID1)
cmdTransfer := []string{
"neo-go", "wallet", "nep11", "transfer",
"tutus", "wallet", "nep11", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--to", testcli.ValidatorAddr,
@ -344,7 +344,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// transfer: good, to NEP-11-Payable contract, with data
verifyH := deployVerifyContract(t, e)
cmdTransfer = []string{
"neo-go", "wallet", "nep11", "transfer",
"tutus", "wallet", "nep11", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--to", verifyH.StringLE(),
@ -414,11 +414,11 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
mint := func(t *testing.T, containerID, objectID util.Uint256) []byte {
// mint 1.00 NFSO token by transferring 10 GAS to NFSO contract
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wall,
"--to", h.StringLE(),
"--token", "GAS",
"--token", "LUB",
"--amount", "10",
"--force",
"--from", testcli.ValidatorAddr,
@ -448,7 +448,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
token2ID := mint(t, container2ID, object2ID)
// check properties
e.Run(t, "neo-go", "wallet", "nep11", "properties",
e.Run(t, "tutus", "wallet", "nep11", "properties",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--token", h.StringLE(),
"--id", hex.EncodeToString(token1ID))
@ -465,7 +465,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
}
// check the balance
cmdCheckBalance := []string{"neo-go", "wallet", "nep11", "balance",
cmdCheckBalance := []string{"tutus", "wallet", "nep11", "balance",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--address", testcli.ValidatorAddr}
@ -497,7 +497,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
checkBalanceResult(t, testcli.ValidatorAddr, tokz[1])
// import token
e.Run(t, "neo-go", "wallet", "nep11", "import",
e.Run(t, "tutus", "wallet", "nep11", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wall,
"--token", h.StringLE())
@ -512,11 +512,11 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// remove token from wallet
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "nep11", "remove",
e.Run(t, "tutus", "wallet", "nep11", "remove",
"--wallet", wall, "--token", h.StringLE())
// ownerOfD: missing contract hash
cmdOwnerOf := []string{"neo-go", "wallet", "nep11", "ownerOfD",
cmdOwnerOf := []string{"tutus", "wallet", "nep11", "ownerOfD",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdOwnerOf...)
@ -531,7 +531,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
e.CheckNextLine(t, testcli.ValidatorAddr)
// tokensOf: missing contract hash
cmdTokensOf := []string{"neo-go", "wallet", "nep11", "tokensOf",
cmdTokensOf := []string{"tutus", "wallet", "nep11", "tokensOf",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flags "token, address" not set`, cmdTokensOf...)
@ -549,7 +549,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// properties: no contract
cmdProperties := []string{
"neo-go", "wallet", "nep11", "properties",
"tutus", "wallet", "nep11", "properties",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdProperties...)
@ -582,7 +582,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
require.Equal(t, hex.EncodeToString(snd), e.GetNextLine(t))
// tokens: missing contract hash
cmdTokens := []string{"neo-go", "wallet", "nep11", "tokens",
cmdTokens := []string{"tutus", "wallet", "nep11", "tokens",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
}
e.RunWithErrorCheck(t, `Required flag "token" not set`, cmdTokens...)
@ -598,7 +598,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
checkBalanceResult(t, testcli.ValidatorAddr, tokz...)
cmdTransfer := []string{
"neo-go", "wallet", "nep11", "transfer",
"tutus", "wallet", "nep11", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--to", nftOwnerAddr,
@ -628,7 +628,7 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) {
// transfer: good, 1/4 of the balance, to NEP-11-Payable contract, with data
verifyH := deployVerifyContract(t, e)
cmdTransfer = []string{
"neo-go", "wallet", "nep11", "transfer",
"tutus", "wallet", "nep11", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", wall,
"--to", verifyH.StringLE(),

View File

@ -24,32 +24,32 @@ func TestNEP17Balance(t *testing.T) {
e := testcli.NewExecutor(t, true)
args := []string{
"neo-go", "wallet", "nep17", "multitransfer", "--force",
"tutus", "wallet", "nep17", "multitransfer", "--force",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
"GAS:" + testcli.TestWalletMultiAccount1 + ":1",
"NEO:" + testcli.TestWalletMultiAccount1 + ":10",
"GAS:" + testcli.TestWalletMultiAccount3 + ":3",
"LUB:" + testcli.TestWalletMultiAccount1 + ":1",
"TUT:" + testcli.TestWalletMultiAccount1 + ":10",
"LUB:" + testcli.TestWalletMultiAccount3 + ":3",
}
e.In.WriteString("one\r")
e.Run(t, args...)
e.CheckTxPersisted(t)
var checkAcc1NEO = func(t *testing.T, e *testcli.Executor, line string) {
var checkAcc1Tutus = func(t *testing.T, e *testcli.Executor, line string) {
if line == "" {
line = e.GetNextLine(t)
}
balance, index := e.Chain.GetGoverningTokenBalance(testcli.TestWalletMultiAccount1Hash)
e.CheckLine(t, line, "^\\s*NEO:\\s+NeoToken \\("+e.Chain.GoverningTokenHash().StringLE()+"\\)")
e.CheckLine(t, line, "^\\s*TUT:\\s+Tutus \\("+e.Chain.GoverningTokenHash().StringLE()+"\\)")
e.CheckNextLine(t, "^\\s*Amount\\s*:\\s*"+balance.String()+"$")
e.CheckNextLine(t, "^\\s*Updated\\s*:\\s*"+strconv.FormatUint(uint64(index), 10))
}
var checkAcc1GAS = func(t *testing.T, e *testcli.Executor, line string) {
var checkAcc1Lub = func(t *testing.T, e *testcli.Executor, line string) {
if line == "" {
line = e.GetNextLine(t)
}
e.CheckLine(t, line, "^\\s*GAS:\\s+GasToken \\("+e.Chain.UtilityTokenHash().StringLE()+"\\)")
e.CheckLine(t, line, "^\\s*LUB:\\s+Lub \\("+e.Chain.UtilityTokenHash().StringLE()+"\\)")
balance := e.Chain.GetUtilityTokenBalance(testcli.TestWalletMultiAccount1Hash)
e.CheckNextLine(t, "^\\s*Amount\\s*:\\s*"+fixedn.Fixed8(balance.Int64()).String()+"$")
e.CheckNextLine(t, "^\\s*Updated:")
@ -59,16 +59,16 @@ func TestNEP17Balance(t *testing.T) {
// The order of assets is undefined.
for range 2 {
line := e.GetNextLine(t)
if strings.Contains(line, "GAS") {
checkAcc1GAS(t, e, line)
if strings.Contains(line, "LUB") {
checkAcc1Lub(t, e, line)
} else {
checkAcc1NEO(t, e, line)
checkAcc1Tutus(t, e, line)
}
}
}
var (
cmdbase = []string{"neo-go", "wallet", "nep17", "balance", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
cmdbase = []string{"tutus", "wallet", "nep17", "balance", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
addrparams = []string{"--address", testcli.TestWalletMultiAccount1}
walletparams = []string{"--wallet", testcli.TestWalletMultiPath}
)
@ -96,17 +96,17 @@ func TestNEP17Balance(t *testing.T) {
e.CheckEOF(t)
})
t.Run("excessive parameters", func(t *testing.T) {
e.RunWithError(t, append(cmd, "--token", "NEO", "gas")...)
e.RunWithError(t, append(cmd, "--token", "TUT", "gas")...)
})
})
t.Run("NEO", func(t *testing.T) {
t.Run("TUT", func(t *testing.T) {
checkResult := func(t *testing.T) {
e.CheckNextLine(t, "^\\s*Account\\s+"+testcli.TestWalletMultiAccount1)
checkAcc1NEO(t, e, "")
checkAcc1Tutus(t, e, "")
e.CheckEOF(t)
}
t.Run("Alias", func(t *testing.T) {
e.Run(t, append(cmd, "--token", "NEO")...)
e.Run(t, append(cmd, "--token", "TUT")...)
checkResult(t)
})
t.Run("Hash", func(t *testing.T) {
@ -114,10 +114,10 @@ func TestNEP17Balance(t *testing.T) {
checkResult(t)
})
})
t.Run("GAS", func(t *testing.T) {
e.Run(t, append(cmd, "--token", "GAS")...)
t.Run("LUB", func(t *testing.T) {
e.Run(t, append(cmd, "--token", "LUB")...)
e.CheckNextLine(t, "^\\s*Account\\s+"+testcli.TestWalletMultiAccount1)
checkAcc1GAS(t, e, "")
checkAcc1Lub(t, e, "")
})
t.Run("Bad token", func(t *testing.T) {
e.Run(t, append(cmd, "--token", "kek")...)
@ -131,9 +131,9 @@ func TestNEP17Balance(t *testing.T) {
e.RunWithError(t, append(cmd, "--address", "NSPCCpw8YmgNDYWiBfXJHRfz38NDjv6WW3")...)
})
t.Run("zero balance of known token", func(t *testing.T) {
e.Run(t, append(cmdbase, []string{"--token", "NEO", "--address", testcli.TestWalletMultiAccount2}...)...)
e.Run(t, append(cmdbase, []string{"--token", "TUT", "--address", testcli.TestWalletMultiAccount2}...)...)
e.CheckNextLine(t, "^Account "+testcli.TestWalletMultiAccount2)
e.CheckNextLine(t, "^\\s*NEO:\\s+NeoToken \\("+e.Chain.GoverningTokenHash().StringLE()+"\\)")
e.CheckNextLine(t, "^\\s*TUT:\\s+Tutus \\("+e.Chain.GoverningTokenHash().StringLE()+"\\)")
e.CheckNextLine(t, "^\\s*Amount\\s*:\\s*"+fixedn.Fixed8(0).String()+"$")
e.CheckNextLine(t, "^\\s*Updated:")
e.CheckEOF(t)
@ -148,7 +148,7 @@ func TestNEP17Balance(t *testing.T) {
e.CheckNextLine(t, "^\\s*$")
e.CheckNextLine(t, "^Account "+testcli.TestWalletMultiAccount3)
e.CheckNextLine(t, "^\\s*GAS:\\s+GasToken \\("+e.Chain.UtilityTokenHash().StringLE()+"\\)")
e.CheckNextLine(t, "^\\s*LUB:\\s+Lub \\("+e.Chain.UtilityTokenHash().StringLE()+"\\)")
balance := e.Chain.GetUtilityTokenBalance(testcli.TestWalletMultiAccount3Hash)
e.CheckNextLine(t, "^\\s*Amount\\s*:\\s*"+fixedn.Fixed8(balance.Int64()).String()+"$")
e.CheckNextLine(t, "^\\s*Updated:")
@ -162,11 +162,11 @@ func TestNEP17Transfer(t *testing.T) {
e := testcli.NewExecutor(t, true)
args := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", w.Accounts[0].Address,
"--token", "NEO",
"--token", "TUT",
"--amount", "1",
"--from", testcli.ValidatorAddr,
}
@ -221,13 +221,13 @@ func TestNEP17Transfer(t *testing.T) {
t.Run("default address", func(t *testing.T) {
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
"--force",
"NEO:"+validatorDefault+":42",
"GAS:"+validatorDefault+":7")
"TUT:"+validatorDefault+":42",
"LUB:"+validatorDefault+":7")
e.CheckTxPersisted(t)
args := args[:len(args)-2] // cut '--from' argument
@ -247,23 +247,23 @@ func TestNEP17Transfer(t *testing.T) {
t.Run("with signers", func(t *testing.T) {
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
"--force",
"NEO:"+validatorDefault+":42",
"GAS:"+validatorDefault+":7",
"TUT:"+validatorDefault+":42",
"LUB:"+validatorDefault+":7",
"--", testcli.ValidatorAddr+":Global")
e.CheckTxPersisted(t)
})
validTil := e.Chain.BlockHeight() + 100
cmd := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--token", "GAS",
"--token", "LUB",
"--amount", "1",
"--force",
"--from", testcli.ValidatorAddr}
@ -308,13 +308,13 @@ func TestNEP17MultiTransfer(t *testing.T) {
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus)
require.NoError(t, err)
args := []string{
"neo-go", "wallet", "nep17", "multitransfer",
"tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
"--force",
"NEO:" + privs[0].Address() + ":42",
"GAS:" + privs[1].Address() + ":7",
"TUT:" + privs[0].Address() + ":42",
"LUB:" + privs[1].Address() + ":7",
neoContractHash.StringLE() + ":" + privs[2].Address() + ":13",
}
hVerify := deployVerifyContract(t, e)
@ -361,73 +361,73 @@ func TestNEP17ImportToken(t *testing.T) {
gasContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Lub)
require.NoError(t, err)
nnsContractHash := deployNNSContract(t, e)
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
// missing token hash
e.RunWithErrorCheck(t, `Required flag "token" not set`, "neo-go", "wallet", "nep17", "import",
e.RunWithErrorCheck(t, `Required flag "token" not set`, "tutus", "wallet", "nep17", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath)
// additional parameter
e.RunWithError(t, "neo-go", "wallet", "nep17", "import",
e.RunWithError(t, "tutus", "wallet", "nep17", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath,
"--token", gasContractHash.StringLE(), "useless")
e.Run(t, "neo-go", "wallet", "nep17", "import",
e.Run(t, "tutus", "wallet", "nep17", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath,
"--token", gasContractHash.StringLE())
e.Run(t, "neo-go", "wallet", "nep17", "import",
e.Run(t, "tutus", "wallet", "nep17", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath,
"--token", address.Uint160ToString(neoContractHash)) // try address instead of sh
// not a NEP-17 token
e.RunWithError(t, "neo-go", "wallet", "nep17", "import",
e.RunWithError(t, "tutus", "wallet", "nep17", "import",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath,
"--token", nnsContractHash.StringLE())
t.Run("Info", func(t *testing.T) {
checkGASInfo := func(t *testing.T) {
e.CheckNextLine(t, "^Name:\\s*GasToken")
e.CheckNextLine(t, "^Symbol:\\s*GAS")
checkLubInfo := func(t *testing.T) {
e.CheckNextLine(t, "^Name:\\s*Lub")
e.CheckNextLine(t, "^Symbol:\\s*LUB")
e.CheckNextLine(t, "^Hash:\\s*"+gasContractHash.StringLE())
e.CheckNextLine(t, "^Decimals:\\s*8")
e.CheckNextLine(t, "^Address:\\s*"+address.Uint160ToString(gasContractHash))
e.CheckNextLine(t, "^Standard:\\s*"+string(manifest.NEP17StandardName))
}
t.Run("excessive parameters", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "nep17", "info",
e.RunWithError(t, "tutus", "wallet", "nep17", "info",
"--wallet", walletPath, "--token", gasContractHash.StringLE(), "parameter")
})
t.Run("WithToken", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "nep17", "info",
e.Run(t, "tutus", "wallet", "nep17", "info",
"--wallet", walletPath, "--token", gasContractHash.StringLE())
checkGASInfo(t)
checkLubInfo(t)
})
t.Run("NoToken", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "nep17", "info",
e.Run(t, "tutus", "wallet", "nep17", "info",
"--wallet", walletPath)
checkGASInfo(t)
checkLubInfo(t)
_, err := e.Out.ReadString('\n')
require.NoError(t, err)
e.CheckNextLine(t, "^Name:\\s*NeoToken")
e.CheckNextLine(t, "^Symbol:\\s*NEO")
e.CheckNextLine(t, "^Name:\\s*Tutus")
e.CheckNextLine(t, "^Symbol:\\s*TUT")
e.CheckNextLine(t, "^Hash:\\s*"+neoContractHash.StringLE())
e.CheckNextLine(t, "^Decimals:\\s*0")
e.CheckNextLine(t, "^Address:\\s*"+address.Uint160ToString(neoContractHash))
e.CheckNextLine(t, "^Standard:\\s*"+string(manifest.NEP17StandardName))
})
t.Run("Remove", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "nep17", "remove",
e.RunWithError(t, "tutus", "wallet", "nep17", "remove",
"--wallet", walletPath, "--token", neoContractHash.StringLE(), "add")
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "nep17", "remove",
e.Run(t, "tutus", "wallet", "nep17", "remove",
"--wallet", walletPath, "--token", neoContractHash.StringLE())
e.Run(t, "neo-go", "wallet", "nep17", "info",
e.Run(t, "tutus", "wallet", "nep17", "info",
"--wallet", walletPath)
checkGASInfo(t)
checkLubInfo(t)
_, err := e.Out.ReadString('\n')
require.Equal(t, err, io.EOF)
})

View File

@ -40,7 +40,7 @@ func TestQueryTx(t *testing.T) {
require.NoError(t, err)
transferArgs := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", w.Accounts[0].Address,
@ -58,7 +58,7 @@ func TestQueryTx(t *testing.T) {
tx, ok := e.Chain.GetMemPool().TryGetValue(txHash)
require.True(t, ok)
args := []string{"neo-go", "query", "tx", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
args := []string{"tutus", "query", "tx", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
e.Run(t, append(args, txHash.StringLE())...)
e.CheckNextLine(t, `Hash:\s+`+txHash.StringLE())
e.CheckNextLine(t, `OnChain:\s+false`)
@ -84,7 +84,7 @@ func TestQueryTx(t *testing.T) {
t.Run("FAULT", func(t *testing.T) {
e.In.WriteString("one\r")
e.Run(t, "neo-go", "contract", "invokefunction",
e.Run(t, "tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.ValidatorAddr,
@ -170,7 +170,7 @@ func compareQueryTxVerbose(t *testing.T, e *testcli.Executor, tx *transaction.Tr
func TestQueryHeight(t *testing.T) {
e := testcli.NewExecutor(t, true)
args := []string{"neo-go", "query", "height", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
args := []string{"tutus", "query", "height", "--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
e.Run(t, args...)
e.CheckNextLine(t, `^Latest block: [0-9]+$`)
e.CheckNextLine(t, `^Validated state: [0-9]+$`)
@ -195,7 +195,7 @@ func TestQueryNotaryPool(t *testing.T) {
// Transfer some GAS to the account.
transferArgs := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", acc.Address,
@ -238,12 +238,12 @@ func TestQueryNotaryPool(t *testing.T) {
},
}, acc)
require.NoError(t, err)
tx, err := ntr.MakeCall(nativehashes.LubToken, "transfer", acc.ScriptHash(), acc.ScriptHash(), big.NewInt(1), nil)
tx, err := ntr.MakeCall(nativehashes.Lub, "transfer", acc.ScriptHash(), acc.ScriptHash(), big.NewInt(1), nil)
mainH, _, vub, err := ntr.Notarize(tx, err)
require.NoError(t, err)
// Check the notary pool.
args := []string{"neo-go", "query", "notarypool", "--rpc-endpoint", endpoint}
args := []string{"tutus", "query", "notarypool", "--rpc-endpoint", endpoint}
t.Run("silent", func(t *testing.T) {
e.Run(t, args...)
e.CheckNextLine(t, `Current height:\s+(\d|\.)+`)

View File

@ -38,7 +38,7 @@ func TestDBRestoreDump(t *testing.T) {
e := testcli.NewExecutor(t, false)
stateDump := filepath.Join(tmpDir, "neogo.teststate")
baseArgs := []string{"neo-go", "db", "restore", "--unittest",
baseArgs := []string{"tutus", "db", "restore", "--unittest",
"--config-path", tmpDir, "--in", inDump, "--dump", stateDump}
t.Run("excessive restore parameters", func(t *testing.T) {
@ -61,7 +61,7 @@ func TestDBRestoreDump(t *testing.T) {
incDumpPath := filepath.Join(tmpDir, "testincdump.acc")
t.Run("missing config", func(t *testing.T) {
e.RunWithError(t, "neo-go", "db", "dump", "--privnet",
e.RunWithError(t, "tutus", "db", "dump", "--privnet",
"--config-path", tmpDir, "--out", dumpPath)
})
t.Run("bad logger config", func(t *testing.T) {
@ -76,7 +76,7 @@ func TestDBRestoreDump(t *testing.T) {
cfgPath = filepath.Join(badConfigDir, "protocol.unit_testnet.yml")
require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm))
e.RunWithError(t, "neo-go", "db", "dump", "--unittest",
e.RunWithError(t, "tutus", "db", "dump", "--unittest",
"--config-path", badConfigDir, "--out", dumpPath)
})
t.Run("bad storage config", func(t *testing.T) {
@ -91,11 +91,11 @@ func TestDBRestoreDump(t *testing.T) {
cfgPath = filepath.Join(badConfigDir, "protocol.unit_testnet.yml")
require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm))
e.RunWithError(t, "neo-go", "db", "dump", "--unittest",
e.RunWithError(t, "tutus", "db", "dump", "--unittest",
"--config-path", badConfigDir, "--out", dumpPath)
})
baseCmd := []string{"neo-go", "db", "dump", "--unittest",
baseCmd := []string{"tutus", "db", "dump", "--unittest",
"--config-path", tmpDir, "--out", dumpPath}
t.Run("invalid start/count", func(t *testing.T) {
@ -137,10 +137,10 @@ func TestDBDumpRestoreIncremental(t *testing.T) {
e := testcli.NewExecutor(t, false)
// Create DB from dump.
e.Run(t, "neo-go", "db", "restore", "--unittest", "--config-path", tmpDir, "--in", inDump)
e.Run(t, "tutus", "db", "restore", "--unittest", "--config-path", tmpDir, "--in", inDump)
// Create two dumps: non-incremental and incremental.
dumpBaseArgs := []string{"neo-go", "db", "dump", "--unittest",
dumpBaseArgs := []string{"tutus", "db", "dump", "--unittest",
"--config-path", tmpDir}
// Dump first 15 blocks to a non-incremental dump.
@ -153,7 +153,7 @@ func TestDBDumpRestoreIncremental(t *testing.T) {
require.NoError(t, os.RemoveAll(chainPath))
// Restore chain from two dumps.
restoreBaseArgs := []string{"neo-go", "db", "restore", "--unittest", "--config-path", tmpDir}
restoreBaseArgs := []string{"tutus", "db", "restore", "--unittest", "--config-path", tmpDir}
// Restore first 15 blocks from non-incremental dump.
e.Run(t, append(restoreBaseArgs, "--in", nonincDump)...)

View File

@ -40,7 +40,7 @@ func TestServerStart(t *testing.T) {
return cfgPath
}
baseCmd := []string{"neo-go", "node", "--unittest", "--config-path", tmpDir}
baseCmd := []string{"tutus", "node", "--unittest", "--config-path", tmpDir}
e := testcli.NewExecutor(t, false)
t.Run("invalid config path", func(t *testing.T) {

View File

@ -34,19 +34,19 @@ func TestDumpBin(t *testing.T) {
e := testcli.NewExecutor(t, false)
restoreArgs := []string{"neo-go", "db", "restore",
restoreArgs := []string{"tutus", "db", "restore",
"--config-file", cfgPath, "--in", inDump}
e.Run(t, restoreArgs...)
t.Run("missing output directory", func(t *testing.T) {
args := []string{"neo-go", "db", "dump-bin",
args := []string{"tutus", "db", "dump-bin",
"--config-file", cfgPath, "--out", ""}
e.RunWithErrorCheck(t, "output directory is not specified", args...)
})
t.Run("successful dump", func(t *testing.T) {
outDir := filepath.Join(tmpDir, "blocks")
args := []string{"neo-go", "db", "dump-bin",
args := []string{"tutus", "db", "dump-bin",
"--config-file", cfgPath, "--out", outDir, "--count", "5", "--start", "0"}
e.Run(t, args...)
@ -61,7 +61,7 @@ func TestDumpBin(t *testing.T) {
t.Run("invalid block range", func(t *testing.T) {
outDir := filepath.Join(tmpDir, "invalid-blocks")
args := []string{"neo-go", "db", "dump-bin",
args := []string{"tutus", "db", "dump-bin",
"--config-file", cfgPath, "--out", outDir, "--count", "1000", "--start", "0"}
e.RunWithError(t, args...)
@ -69,7 +69,7 @@ func TestDumpBin(t *testing.T) {
t.Run("zero blocks (full chain dump)", func(t *testing.T) {
outDir := filepath.Join(tmpDir, "full-dump")
args := []string{"neo-go", "db", "dump-bin",
args := []string{"tutus", "db", "dump-bin",
"--config-file", cfgPath, "--out", outDir}
e.Run(t, args...)
@ -83,7 +83,7 @@ func TestDumpBin(t *testing.T) {
t.Run("invalid config file", func(t *testing.T) {
outDir := filepath.Join(tmpDir, "blocks")
args := []string{"neo-go", "db", "dump-bin",
args := []string{"tutus", "db", "dump-bin",
"--config-file", "invalid-config-path", "--out", outDir}
e.RunWithError(t, args...)

View File

@ -56,7 +56,7 @@ func TestCalcHash(t *testing.T) {
require.NoError(t, err)
sender := random.Uint160()
cmd := []string{"neo-go", "contract", "calc-hash"}
cmd := []string{"tutus", "contract", "calc-hash"}
t.Run("no sender", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "sender" not set`, append(cmd, "--in", nefPath, "--manifest", manifestPath)...)
})
@ -112,7 +112,7 @@ func TestContractBindings(t *testing.T) {
e := testcli.NewExecutor(t, false)
ctrPath := filepath.Join(tmpDir, "testcontract")
e.Run(t, "neo-go", "contract", "init", "--name", ctrPath)
e.Run(t, "tutus", "contract", "init", "--name", ctrPath)
srcPath := filepath.Join(ctrPath, "main.go")
require.NoError(t, os.WriteFile(srcPath, []byte(`package testcontract
@ -143,7 +143,7 @@ func Blocks() []*alias.Block {
cfgPath := filepath.Join(ctrPath, "neo-go.yml")
manifestPath := filepath.Join(tmpDir, "manifest.json")
bindingsPath := filepath.Join(tmpDir, "bindings.yml")
cmd := []string{"neo-go", "contract", "compile"}
cmd := []string{"tutus", "contract", "compile"}
cmd = append(cmd, "--in", ctrPath, "--bindings", bindingsPath)
@ -162,7 +162,7 @@ func Blocks() []*alias.Block {
require.FileExists(t, bindingsPath)
outPath := filepath.Join(t.TempDir(), "binding.go")
e.Run(t, "neo-go", "contract", "generate-wrapper",
e.Run(t, "tutus", "contract", "generate-wrapper",
"--config", bindingsPath, "--manifest", manifestPath,
"--out", outPath, "--hash", "0x0123456789987654321001234567899876543210")
@ -260,20 +260,20 @@ func CallVerifyContract(h interop.Hash160) bool{
}`
helperDir := filepath.Join(tmpDir, "helper")
e.Run(t, "neo-go", "contract", "init", "--name", helperDir)
e.Run(t, "tutus", "contract", "init", "--name", helperDir)
require.NoError(t, updateGoMod(helperDir, "myimport.com/testcontract", "../../pkg/interop"))
require.NoError(t, os.WriteFile(filepath.Join(helperDir, "main.go"), []byte(helperContract), os.ModePerm))
require.NoError(t, os.Mkdir(filepath.Join(helperDir, "bindings"), os.ModePerm))
e.Run(t, "neo-go", "contract", "generate-wrapper",
e.Run(t, "tutus", "contract", "generate-wrapper",
"--config", filepath.Join(ctrPath, "verify.bindings.yml"), "--manifest", filepath.Join(ctrPath, "verify.manifest.json"),
"--out", filepath.Join(helperDir, "bindings", "testdata.go"))
e.Run(t, "neo-go", "contract", "compile", "--in", filepath.Join(helperDir, "main.go"), "--config", filepath.Join(helperDir, "neo-go.yml"))
e.Run(t, "tutus", "contract", "compile", "--in", filepath.Join(helperDir, "main.go"), "--config", filepath.Join(helperDir, "neo-go.yml"))
helperHash := testcli.DeployContract(t, e, filepath.Join(helperDir, "main.go"), filepath.Join(helperDir, "neo-go.yml"), testcli.ValidatorWallet, testcli.ValidatorAddr, testcli.ValidatorPass)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "contract", "invokefunction",
e.Run(t, "tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr, "--force", "--await", helperHash.StringLE(), "callVerifyContract", verifyHash.StringLE())
@ -291,21 +291,21 @@ func TestContractInitAndCompile(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("no path is provided", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "name" not set`, "neo-go", "contract", "init")
e.RunWithErrorCheck(t, `Required flag "name" not set`, "tutus", "contract", "init")
})
t.Run("invalid path", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "init", "--name", "\x00")
e.RunWithError(t, "tutus", "contract", "init", "--name", "\x00")
})
ctrPath := filepath.Join(tmpDir, "testcontract")
t.Run("excessive parameters", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "init", "--name", ctrPath, "something")
e.RunWithError(t, "tutus", "contract", "init", "--name", ctrPath, "something")
})
e.Run(t, "neo-go", "contract", "init", "--name", ctrPath)
e.Run(t, "tutus", "contract", "init", "--name", ctrPath)
t.Run("don't rewrite existing directory", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "init", "--name", ctrPath)
e.RunWithError(t, "tutus", "contract", "init", "--name", ctrPath)
})
ctrRootPath := filepath.Join(ctrPath, "main")
@ -313,7 +313,7 @@ func TestContractInitAndCompile(t *testing.T) {
cfgPath := filepath.Join(ctrPath, "neo-go.yml")
nefPath := filepath.Join(tmpDir, "testcontract.nef")
manifestPath := filepath.Join(tmpDir, "testcontract.manifest.json")
cmd := []string{"neo-go", "contract", "compile"}
cmd := []string{"tutus", "contract", "compile"}
t.Run("missing source", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "in" not set`, cmd...)
})
@ -357,7 +357,7 @@ func TestContractInitAndCompile(t *testing.T) {
cfg, err := os.ReadFile(cfgPath)
require.NoError(t, err)
require.NoError(t, os.WriteFile(filepath.Join(ctrPath, "main.yml"), cfg, os.ModePerm))
e.Run(t, "neo-go", "contract", "compile", "--in", srcPath)
e.Run(t, "tutus", "contract", "compile", "--in", srcPath)
defaultNefPath := ctrRootPath + ".nef"
defaultManifestPath := ctrRootPath + ".manifest.json"
defaultBindingsPath := ctrRootPath + ".bindings.yml"
@ -377,13 +377,13 @@ func TestDeployBigContract(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go", // compile single file
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
e.In.WriteString(testcli.ValidatorPass + "\r")
e.RunWithError(t, "neo-go", "contract", "deploy",
e.RunWithError(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName)
@ -395,7 +395,7 @@ func TestContractDeployWithData(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
eCompile.Run(t, "neo-go", "contract", "compile",
eCompile.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go", // compile single file
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
@ -403,7 +403,7 @@ func TestContractDeployWithData(t *testing.T) {
deployContract := func(t *testing.T, haveData bool, scope string, await bool) {
e := testcli.NewExecutor(t, true)
cmd := []string{
"neo-go", "contract", "deploy",
"tutus", "contract", "deploy",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
@ -441,7 +441,7 @@ func TestContractDeployWithData(t *testing.T) {
h, err := util.Uint160DecodeStringLE(line)
require.NoError(t, err)
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
h.StringLE(),
"getValueWithKey", "key1",
@ -453,7 +453,7 @@ func TestContractDeployWithData(t *testing.T) {
require.Len(t, res.Stack, 1)
require.Equal(t, []byte{12}, res.Stack[0].Value())
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
h.StringLE(),
"getValueWithKey", "key2",
@ -480,52 +480,52 @@ func TestDeployWithSigners(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go",
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
t.Run("missing nef", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "deploy",
e.RunWithError(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName)
})
t.Run("missing manifest", func(t *testing.T) {
e.RunWithErrorCheck(t, "required flag --manifest is empty", "neo-go", "contract", "deploy",
e.RunWithErrorCheck(t, "required flag --manifest is empty", "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", "")
})
t.Run("corrupted data", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "deploy",
e.RunWithError(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
"[", "str1")
})
t.Run("invalid data", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "deploy",
e.RunWithError(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
"str1", "str2")
})
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "deploy",
e.RunWithError(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
"[", "str1", "str2", "]")
})
t.Run("missing RPC", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "neo-go", "contract", "deploy",
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "tutus", "contract", "deploy",
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
"[", "str1", "str2", "]")
})
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "deploy",
e.Run(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName,
@ -543,18 +543,18 @@ func TestContractUpdate(t *testing.T) {
mfB := filepath.Join(tmp, "b.manifest.json")
e := testcli.NewExecutor(t, true)
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go",
"--config", "testdata/deploy/neo-go.yml",
"--out", nefA, "--manifest", mfA)
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/updated.go",
"--config", "testdata/deploy/neo-go.yml",
"--out", nefB, "--manifest", mfB)
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "deploy",
e.Run(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.ValidatorAddr,
@ -568,7 +568,7 @@ func TestContractUpdate(t *testing.T) {
hash, err := util.Uint160DecodeStringLE(line)
require.NoError(t, err)
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
hash.StringLE(),
"getValue",
@ -581,7 +581,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("missing hash", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "no smart contract hash was provided, specify one as the first argument",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefA, "--manifest", mfA,
)
@ -589,7 +589,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("invalid hash", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "invalid contract hash",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefA, "--manifest", mfA,
"badhex",
@ -598,7 +598,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("missing nef and manifest files", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "either manifest or .nef required",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
)
@ -606,7 +606,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("malformed data param", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "unable to parse 'data' parameter: ",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefA, "--manifest", mfA,
testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
@ -616,7 +616,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("too many data params", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "'data' should be represented as a single parameter",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefA, "--manifest", mfA,
testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
@ -626,7 +626,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "can't get sender address: ",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefA, "--manifest", mfA,
testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
@ -636,7 +636,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("invalid signer", func(t *testing.T) {
e.In.WriteString(testcli.ValidatorPass + "\r")
e.RunWithErrorCheckExit(t, "failed to parse signer",
"neo-go", "contract", "update",
"tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--in", nefB, "--manifest", mfB,
@ -648,7 +648,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("good with only manifest", func(t *testing.T) {
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "update",
e.Run(t, "tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--manifest", "testdata/deploy/update.manifest.json",
@ -657,7 +657,7 @@ func TestContractUpdate(t *testing.T) {
)
_, _ = e.CheckAwaitableTxPersisted(t)
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
hash.StringLE(),
"getValueUpdated",
@ -674,7 +674,7 @@ func TestContractUpdate(t *testing.T) {
t.Run("good", func(t *testing.T) {
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "update",
e.Run(t, "tutus", "contract", "update",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--in", nefB, "--manifest", mfB,
@ -684,7 +684,7 @@ func TestContractUpdate(t *testing.T) {
_, _ = e.CheckAwaitableTxPersisted(t)
require.NoError(t, err)
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
hash.StringLE(),
"newMethod",
@ -703,14 +703,14 @@ func TestContractDestroy(t *testing.T) {
nefName := filepath.Join(tmpDir, "destroy.nef")
manifestName := filepath.Join(tmpDir, "destroy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go",
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName,
)
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "deploy",
e.Run(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.ValidatorAddr,
@ -725,7 +725,7 @@ func TestContractDestroy(t *testing.T) {
hash, err := util.Uint160DecodeStringLE(line)
require.NoError(t, err)
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
hash.StringLE(),
"getValue",
@ -739,7 +739,7 @@ func TestContractDestroy(t *testing.T) {
t.Run("missing hash", func(t *testing.T) {
e.RunWithErrorCheckExit(t,
"no smart contract hash was provided, specify one as the first argument",
"neo-go", "contract", "destroy",
"tutus", "contract", "destroy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
)
})
@ -747,7 +747,7 @@ func TestContractDestroy(t *testing.T) {
t.Run("invalid hash", func(t *testing.T) {
e.RunWithErrorCheckExit(t,
"invalid contract hash",
"neo-go", "contract", "destroy",
"tutus", "contract", "destroy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"badhex",
)
@ -756,7 +756,7 @@ func TestContractDestroy(t *testing.T) {
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheckExit(t,
"can't get sender address:",
"neo-go", "contract", "destroy",
"tutus", "contract", "destroy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
)
@ -766,7 +766,7 @@ func TestContractDestroy(t *testing.T) {
e.In.WriteString(testcli.ValidatorPass + "\r")
e.RunWithErrorCheckExit(t,
"failed to parse signer",
"neo-go", "contract", "destroy",
"tutus", "contract", "destroy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--force",
@ -778,7 +778,7 @@ func TestContractDestroy(t *testing.T) {
t.Run("good", func(t *testing.T) {
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "destroy",
e.Run(t, "tutus", "contract", "destroy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--force", "--await",
@ -790,7 +790,7 @@ func TestContractDestroy(t *testing.T) {
e.RunWithErrorCheckExit(t,
fmt.Sprintf("System.Contract.Call failed: called contract %s not found: key not found", hash.StringLE()),
"neo-go", "contract", "testinvokefunction",
"tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
hash.StringLE(), "getValue",
)
@ -806,38 +806,38 @@ func TestContractManifestGroups(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go", // compile single file
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flags "sender, address, nef, manifest" not set`, "neo-go", "contract", "manifest", "add-group")
e.RunWithErrorCheck(t, `Required flags "sender, address, nef, manifest" not set`, "tutus", "contract", "manifest", "add-group")
})
t.Run("invalid wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", t.TempDir(), "--sender", testcli.TestWalletAccount, "--address", testcli.TestWalletAccount,
"--nef", nefName, "--manifest", manifestName)
})
t.Run("invalid sender", func(t *testing.T) {
e.RunWithErrorCheck(t, `invalid value "not-a-sender" for flag -sender: invalid base58 digit ('-')`, "neo-go", "contract", "manifest", "add-group",
e.RunWithErrorCheck(t, `invalid value "not-a-sender" for flag -sender: invalid base58 digit ('-')`, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", testcli.TestWalletAccount,
"--sender", "not-a-sender", "--nef", nefName, "--manifest", manifestName)
})
t.Run("invalid NEF file", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", testcli.TestWalletAccount,
"--sender", testcli.TestWalletAccount, "--nef", tmpDir, "--manifest", manifestName)
})
t.Run("corrupted NEF file", func(t *testing.T) {
f := filepath.Join(tmpDir, "invalid.nef")
require.NoError(t, os.WriteFile(f, []byte{1, 2, 3}, os.ModePerm))
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", testcli.TestWalletAccount,
"--sender", testcli.TestWalletAccount, "--nef", f, "--manifest", manifestName)
})
t.Run("invalid manifest file", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", testcli.TestWalletAccount,
"--sender", testcli.TestWalletAccount, "--nef", nefName,
"--manifest", tmpDir)
@ -845,18 +845,18 @@ func TestContractManifestGroups(t *testing.T) {
t.Run("corrupted manifest file", func(t *testing.T) {
f := filepath.Join(tmpDir, "invalid.manifest.json")
require.NoError(t, os.WriteFile(f, []byte{1, 2, 3}, os.ModePerm))
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", testcli.TestWalletAccount,
"--sender", testcli.TestWalletAccount, "--nef", nefName,
"--manifest", f)
})
t.Run("unknown account", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "manifest", "add-group",
e.RunWithError(t, "tutus", "contract", "manifest", "add-group",
"--wallet", testcli.TestWalletPath, "--address", util.Uint160{}.StringLE(),
"--sender", testcli.TestWalletAccount, "--nef", nefName,
"--manifest", manifestName)
})
cmd := []string{"neo-go", "contract", "manifest", "add-group",
cmd := []string{"tutus", "contract", "manifest", "add-group",
"--nef", nefName, "--manifest", manifestName}
t.Run("excessive parameters", func(t *testing.T) {
@ -872,7 +872,7 @@ func TestContractManifestGroups(t *testing.T) {
"--sender", testcli.ValidatorAddr, "--address", testcli.TestWalletAccount)...)
e.In.WriteString(testcli.ValidatorPass + "\r")
e.Run(t, "neo-go", "contract", "deploy",
e.Run(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", nefName, "--manifest", manifestName,
"--force",
@ -889,73 +889,73 @@ func TestContract_TestInvokeScript(t *testing.T) {
badNef := filepath.Join(tmpDir, "invalid.nef")
goodNef := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go", // compile single file
"--config", "testdata/deploy/neo-go.yml",
"--out", goodNef, "--manifest", manifestName)
t.Run("missing in", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "in" not set`, "neo-go", "contract", "testinvokescript",
e.RunWithErrorCheck(t, `Required flag "in" not set`, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
t.Run("empty in", func(t *testing.T) {
e.RunWithErrorCheck(t, "required flag --in is empty", "neo-go", "contract", "testinvokescript", "-i", "",
e.RunWithErrorCheck(t, "required flag --in is empty", "tutus", "contract", "testinvokescript", "-i", "",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
t.Run("empty rpc", func(t *testing.T) {
e.RunWithErrorCheck(t, "required flag --rpc-endpoint is empty", "neo-go", "contract", "testinvokescript", "-i", goodNef,
e.RunWithErrorCheck(t, "required flag --rpc-endpoint is empty", "tutus", "contract", "testinvokescript", "-i", goodNef,
"--rpc-endpoint", "")
})
t.Run("unexisting in", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "testinvokescript",
e.RunWithError(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", badNef)
})
t.Run("invalid nef", func(t *testing.T) {
require.NoError(t, os.WriteFile(badNef, []byte("qwer"), os.ModePerm))
e.RunWithError(t, "neo-go", "contract", "testinvokescript",
e.RunWithError(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", badNef)
})
t.Run("invalid signers", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "testinvokescript",
e.RunWithError(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", goodNef, "--", "not-a-valid-signer")
})
t.Run("no RPC endpoint", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "testinvokescript",
e.RunWithError(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://123456789",
"--in", goodNef)
})
t.Run("good", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokescript",
e.Run(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", goodNef)
})
t.Run("good with hashed signer", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokescript",
e.Run(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", goodNef, "--", util.Uint160{1, 2, 3}.StringLE())
})
t.Run("good with addressed signer", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokescript",
e.Run(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--in", goodNef, "--", address.Uint160ToString(util.Uint160{1, 2, 3}))
})
t.Run("historic, invalid", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "testinvokescript",
e.RunWithError(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", "bad",
"--in", goodNef)
})
t.Run("historic, index", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokescript",
e.Run(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", "0",
"--in", goodNef)
})
t.Run("historic, hash", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokescript",
e.Run(t, "tutus", "contract", "testinvokescript",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", e.Chain.GetHeaderHash(0).StringLE(),
"--in", goodNef)
@ -968,7 +968,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", "testdata/deploy/main.go", // compile single file
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
@ -982,7 +982,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
yml, err := yaml.Marshal(cfg)
require.NoError(t, err)
require.NoError(t, os.WriteFile(configPath, yml, 0666))
e.Run(t, "neo-go", "contract", "deploy",
e.Run(t, "tutus", "contract", "deploy",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0], "--force",
"--wallet-config", configPath, "--address", testcli.ValidatorAddr,
"--in", nefName, "--manifest", manifestName)
@ -996,17 +996,17 @@ func TestComlileAndInvokeFunction(t *testing.T) {
t.Run("check calc hash", func(t *testing.T) {
// missing sender
e.RunWithErrorCheck(t, `Required flag "sender" not set`, "neo-go", "contract", "calc-hash",
e.RunWithErrorCheck(t, `Required flag "sender" not set`, "tutus", "contract", "calc-hash",
"--in", nefName,
"--manifest", manifestName)
e.Run(t, "neo-go", "contract", "calc-hash",
e.Run(t, "tutus", "contract", "calc-hash",
"--sender", testcli.ValidatorAddr, "--in", nefName,
"--manifest", manifestName)
e.CheckNextLine(t, h.StringLE())
})
cmd := []string{"neo-go", "contract", "testinvokefunction",
cmd := []string{"tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
t.Run("missing hash", func(t *testing.T) {
e.RunWithError(t, cmd...)
@ -1028,7 +1028,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
e.RunWithError(t, append(cmd, "--", "notahash")...)
})
t.Run("missing RPC address", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "neo-go", "contract", "testinvokefunction",
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "tutus", "contract", "testinvokefunction",
h.StringLE(), "getValue")
})
@ -1047,7 +1047,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
hVerify := deployVerifyContract(t, e)
t.Run("real invoke", func(t *testing.T) {
cmd := []string{"neo-go", "contract", "invokefunction",
cmd := []string{"tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0]}
t.Run("missing wallet", func(t *testing.T) {
cmd := append(cmd, h.StringLE(), "getValue")
@ -1127,7 +1127,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
t.Run("real invoke and save tx", func(t *testing.T) {
txout := filepath.Join(tmpDir, "test_contract_tx.json")
cmd = []string{"neo-go", "contract", "invokefunction",
cmd = []string{"tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--out", txout,
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
@ -1186,7 +1186,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
})
t.Run("test Storage.Find", func(t *testing.T) {
cmd := []string{"neo-go", "contract", "testinvokefunction",
cmd := []string{"tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
h.StringLE(), "testFind"}
@ -1229,7 +1229,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
t.Run("Update", func(t *testing.T) {
nefName := filepath.Join(tmpDir, "updated.nef")
manifestName := filepath.Join(tmpDir, "updated.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--config", "testdata/deploy/neo-go.yml",
"--in", "testdata/deploy/", // compile all files in dir
"--out", nefName, "--manifest", manifestName)
@ -1250,7 +1250,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
require.NoError(t, err)
stateBeforeUpdate = mptBeforeUpdate.Root
e.In.WriteString("one\r")
e.Run(t, "neo-go", "contract", "invokefunction",
e.Run(t, "tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--force",
@ -1263,14 +1263,14 @@ func TestComlileAndInvokeFunction(t *testing.T) {
indexAfterUpdate = e.Chain.BlockHeight()
e.In.WriteString("one\r")
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
h.StringLE(), "getValue")
checkGetValueOut("on update|sub update")
})
t.Run("historic", func(t *testing.T) {
t.Run("bad ref", func(t *testing.T) {
e.RunWithError(t, "neo-go", "contract", "testinvokefunction",
e.RunWithError(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", "bad",
h.StringLE(), "getValue")
@ -1281,7 +1281,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
"by state hash": stateBeforeUpdate.StringLE(),
} {
t.Run(name, func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", ref,
h.StringLE(), "getValue")
@ -1289,7 +1289,7 @@ func TestComlileAndInvokeFunction(t *testing.T) {
checkGetValueOut("on create|sub create")
}
t.Run("updated historic", func(t *testing.T) {
e.Run(t, "neo-go", "contract", "testinvokefunction",
e.Run(t, "tutus", "contract", "testinvokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--historic", strconv.FormatUint(uint64(indexAfterUpdate), 10),
h.StringLE(), "getValue")
@ -1305,12 +1305,12 @@ func TestContractInspect(t *testing.T) {
nefName := filepath.Join(tmpDir, "deploy.nef")
manifestName := filepath.Join(tmpDir, "deploy.manifest.json")
e.Run(t, "neo-go", "contract", "compile",
e.Run(t, "tutus", "contract", "compile",
"--in", srcPath,
"--config", "testdata/deploy/neo-go.yml",
"--out", nefName, "--manifest", manifestName)
cmd := []string{"neo-go", "contract", "inspect"}
cmd := []string{"tutus", "contract", "inspect"}
t.Run("missing input", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "in" not set`, cmd...)
})
@ -1359,7 +1359,7 @@ func TestCompileExamples(t *testing.T) {
cfgName := filterFilename(infos, ".yml")
opts := []string{
"neo-go", "contract", "compile",
"tutus", "contract", "compile",
"--in", filepath.Join(examplePath, info.Name()),
"--out", outF,
"--manifest", manifestF,
@ -1383,12 +1383,12 @@ func TestCompileExamples(t *testing.T) {
require.NotNil(t, m.ABI.GetMethod("put", 1))
require.NotNil(t, m.ABI.GetMethod("put", 2))
}
e.Run(t, "neo-go", "contract", "generate-wrapper",
e.Run(t, "tutus", "contract", "generate-wrapper",
"--manifest", manifestF,
"--config", bindingF,
"--out", wrapperF,
"--hash", "0x00112233445566778899aabbccddeeff00112233")
e.Run(t, "neo-go", "contract", "generate-rpcwrapper",
e.Run(t, "tutus", "contract", "generate-rpcwrapper",
"--manifest", manifestF,
"--config", bindingF,
"--out", rpcWrapperF,
@ -1401,7 +1401,7 @@ func TestCompileExamples(t *testing.T) {
for _, name := range []string{"invalid1", "invalid2", "invalid3", "invalid4"} {
outF := filepath.Join(tmpDir, name+".nef")
manifestF := filepath.Join(tmpDir, name+".manifest.json")
e.RunWithError(t, "neo-go", "contract", "compile",
e.RunWithError(t, "tutus", "contract", "compile",
"--in", filepath.Join(dir, name),
"--out", outF,
"--manifest", manifestF,
@ -1443,6 +1443,6 @@ func TestContractCompile_NEFSizeCheck(t *testing.T) {
require.NoError(t, os.WriteFile(cfg, []byte("name: main"), os.ModePerm))
require.NoError(t, os.WriteFile(in, []byte(fmt.Sprintf(src, data)), os.ModePerm))
e.RunWithError(t, "neo-go", "contract", "compile", "--in", in)
e.RunWithError(t, "tutus", "contract", "compile", "--in", in)
require.NoFileExists(t, filepath.Join(tmpDir, "main.nef"))
}

View File

@ -560,7 +560,7 @@ func TestAssistedRPCBindings(t *testing.T) {
func TestGenerate_Errors(t *testing.T) {
e := testcli.NewExecutor(t, false)
args := []string{"neo-go", "contract", "generate-wrapper"}
args := []string{"tutus", "contract", "generate-wrapper"}
t.Run("invalid hash", func(t *testing.T) {
e.RunWithErrorCheckExit(t, "invalid contract hash", append(args, "--hash", "xxx", "--manifest", "yyy", "--out", "zzz")...)

View File

@ -20,7 +20,7 @@ func TestUtilConvert(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("from uint160", func(t *testing.T) {
e.Run(t, "neo-go", "util", "convert", util.Uint160{1, 2, 3}.StringLE())
e.Run(t, "tutus", "util", "convert", util.Uint160{1, 2, 3}.StringLE())
e.CheckNextLine(t, "f975") // int to hex
e.CheckNextLine(t, "\\+XU=") // int to base64
@ -37,7 +37,7 @@ func TestUtilConvert(t *testing.T) {
})
t.Run("from base64", func(t *testing.T) {
e.Run(t, "neo-go", "util", "convert", "AzAsKhDGXY3es9Sud1UZHlNuaIUeA8RP5L525bksW2X1")
e.Run(t, "tutus", "util", "convert", "AzAsKhDGXY3es9Sud1UZHlNuaIUeA8RP5L525bksW2X1")
e.CheckNextLine(t, "Base64 to String") // base64 to string
e.CheckNextLine(t, "-1227868292132078655324003980891682359404043535734663719936387278487080867713021") // base64 to bigint
@ -51,7 +51,7 @@ func TestUtilConvert(t *testing.T) {
})
t.Run("from hex", func(t *testing.T) {
e.Run(t, "neo-go", "util", "convert", "03302c2a10c65d8ddeb3d4ae7755191e536e68851e03c44fe4be76e5b92c5b65f5")
e.Run(t, "tutus", "util", "convert", "03302c2a10c65d8ddeb3d4ae7755191e536e68851e03c44fe4be76e5b92c5b65f5")
e.CheckNextLine(t, "AzAsKhDGXY3es9Sud1UZHlNuaIUeA8RP5L525bksW2X1") // public key to base64
e.CheckNextLine(t, "102b75c0f23919fa69a0f920239a720f211755fd") // public key to BE script hash
@ -78,27 +78,27 @@ func TestUtilOps(t *testing.T) {
e.CheckEOF(t)
}
e.Run(t, "neo-go", "util", "ops", base64Str) // base64
e.Run(t, "tutus", "util", "ops", base64Str) // base64
check(t)
e.Run(t, "neo-go", "util", "ops", hexStr) // base64 is checked firstly by default, but it's invalid script if decoded from base64
e.Run(t, "tutus", "util", "ops", hexStr) // base64 is checked firstly by default, but it's invalid script if decoded from base64
e.CheckNextLine(t, "INDEX.*OPCODE.*PARAMETER")
e.CheckNextLine(t, ".*ERROR: incorrect opcode")
e.CheckEOF(t)
e.Run(t, "neo-go", "util", "ops", "--hex", hexStr) // explicitly specify hex encoding
e.Run(t, "tutus", "util", "ops", "--hex", hexStr) // explicitly specify hex encoding
check(t)
e.RunWithError(t, "neo-go", "util", "ops", "%&~*") // unknown encoding
e.RunWithError(t, "tutus", "util", "ops", "%&~*") // unknown encoding
tmp := filepath.Join(t.TempDir(), "script_base64.txt")
require.NoError(t, os.WriteFile(tmp, []byte(base64Str), os.ModePerm))
e.Run(t, "neo-go", "util", "ops", "--in", tmp) // base64 from file
e.Run(t, "tutus", "util", "ops", "--in", tmp) // base64 from file
check(t)
tmp = filepath.Join(t.TempDir(), "script_hex.txt")
require.NoError(t, os.WriteFile(tmp, []byte(hexStr), os.ModePerm))
e.Run(t, "neo-go", "util", "ops", "--hex", "--in", tmp) // hex from file
e.Run(t, "tutus", "util", "ops", "--hex", "--in", tmp) // hex from file
check(t)
}
@ -109,7 +109,7 @@ func TestUtilCancelTx(t *testing.T) {
require.NoError(t, err)
transferArgs := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", w.Accounts[0].Address,
@ -117,7 +117,7 @@ func TestUtilCancelTx(t *testing.T) {
"--from", testcli.ValidatorAddr,
"--force",
}
args := []string{"neo-go", "util", "canceltx",
args := []string{"tutus", "util", "canceltx",
"-r", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.ValidatorAddr}
@ -143,14 +143,14 @@ func TestUtilCancelTx(t *testing.T) {
})
t.Run("not signed by main signer", func(t *testing.T) {
e.In.WriteString("one\r")
e.RunWithError(t, "neo-go", "util", "canceltx",
e.RunWithError(t, "tutus", "util", "canceltx",
"-r", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.MultisigAddr, txHash.StringLE())
})
t.Run("wrong rpc endpoint", func(t *testing.T) {
e.In.WriteString("one\r")
e.RunWithError(t, "neo-go", "util", "canceltx",
e.RunWithError(t, "tutus", "util", "canceltx",
"-r", "http://localhost:20331",
"--wallet", testcli.ValidatorWallet, txHash.StringLE())
})
@ -179,7 +179,7 @@ func TestAwaitUtilCancelTx(t *testing.T) {
require.NoError(t, err)
transferArgs := []string{
"neo-go", "wallet", "nep17", "transfer",
"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--to", w.Accounts[0].Address,
@ -187,7 +187,7 @@ func TestAwaitUtilCancelTx(t *testing.T) {
"--from", testcli.ValidatorAddr,
"--force",
}
args := []string{"neo-go", "util", "canceltx",
args := []string{"tutus", "util", "canceltx",
"-r", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", testcli.ValidatorAddr,
@ -226,7 +226,7 @@ func TestAwaitUtilCancelTx(t *testing.T) {
func TestUploadBin(t *testing.T) {
e := testcli.NewExecutor(t, true)
args := []string{
"neo-go", "util", "upload-bin",
"tutus", "util", "upload-bin",
"--cid", "test",
"--wallet", "./not-exist.json",
"--block-attribute", "block",

View File

@ -25,7 +25,7 @@ func TestRegisterCandidate(t *testing.T) {
validatorHex := validatorPublic.StringCompressed()
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
@ -34,42 +34,42 @@ func TestRegisterCandidate(t *testing.T) {
"GAS:"+validatorAddress+":10000")
e.CheckTxPersisted(t)
e.Run(t, "neo-go", "query", "committee",
e.Run(t, "tutus", "query", "committee",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.CheckNextLine(t, "^\\s*"+validatorHex)
e.Run(t, "neo-go", "query", "candidates",
e.Run(t, "tutus", "query", "candidates",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.CheckNextLine(t, "^\\s*Key.+$") // Header.
e.CheckEOF(t)
// missing address
e.RunWithErrorCheck(t, `Required flag "address" not set`, "neo-go", "wallet", "candidate", "register",
e.RunWithErrorCheck(t, `Required flag "address" not set`, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet)
// additional parameter
e.RunWithError(t, "neo-go", "wallet", "candidate", "register",
e.RunWithError(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
"error")
// missing wallet
e.RunWithError(t, "neo-go", "wallet", "candidate", "register",
e.RunWithError(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--address", validatorAddress,
"--force")
// invalid rpc-endpoint
e.RunWithError(t, "neo-go", "wallet", "candidate", "register",
e.RunWithError(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://invalidRPCendpoint",
"--address", validatorAddress,
"--wallet", testcli.ValidatorWallet,
"--force")
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "register",
e.Run(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -84,14 +84,14 @@ func TestRegisterCandidate(t *testing.T) {
t.Run("VoteUnvote", func(t *testing.T) {
// positional instead of a flag.
e.RunWithError(t, "neo-go", "wallet", "candidate", "vote",
e.RunWithError(t, "tutus", "wallet", "candidate", "vote",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
validatorHex) // not "--candidate hex", but "hex".
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "vote",
e.Run(t, "tutus", "wallet", "candidate", "vote",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -105,18 +105,18 @@ func TestRegisterCandidate(t *testing.T) {
b, _ := e.Chain.GetGoverningTokenBalance(testcli.ValidatorPriv.GetScriptHash())
require.Equal(t, b, vs[0].Votes)
e.Run(t, "neo-go", "query", "committee",
e.Run(t, "tutus", "query", "committee",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.CheckNextLine(t, "^\\s*"+validatorHex)
e.Run(t, "neo-go", "query", "candidates",
e.Run(t, "tutus", "query", "candidates",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.CheckNextLine(t, "^\\s*Key.+$") // Header.
e.CheckNextLine(t, "^\\s*"+validatorHex+"\\s*"+b.String()+"\\s*true\\s*true$")
e.CheckEOF(t)
// check state
e.Run(t, "neo-go", "query", "voter",
e.Run(t, "tutus", "query", "voter",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
validatorAddress)
e.CheckNextLine(t, "^\\s*Voted:\\s+"+validatorHex+"\\s+\\("+validatorAddress+"\\)$")
@ -126,7 +126,7 @@ func TestRegisterCandidate(t *testing.T) {
// unvote
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "vote",
e.Run(t, "tutus", "wallet", "candidate", "vote",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -139,7 +139,7 @@ func TestRegisterCandidate(t *testing.T) {
require.Equal(t, big.NewInt(0), vs[0].Votes)
// check state
e.Run(t, "neo-go", "query", "voter",
e.Run(t, "tutus", "query", "voter",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
validatorAddress)
e.CheckNextLine(t, "^\\s*Voted:\\s+"+"null") // no vote.
@ -149,18 +149,18 @@ func TestRegisterCandidate(t *testing.T) {
})
// missing address
e.RunWithErrorCheck(t, `Required flag "address" not set`, "neo-go", "wallet", "candidate", "unregister",
e.RunWithErrorCheck(t, `Required flag "address" not set`, "tutus", "wallet", "candidate", "unregister",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet)
// additional argument
e.RunWithError(t, "neo-go", "wallet", "candidate", "unregister",
e.RunWithError(t, "tutus", "wallet", "candidate", "unregister",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
"argument")
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "unregister",
e.Run(t, "tutus", "wallet", "candidate", "unregister",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -171,15 +171,15 @@ func TestRegisterCandidate(t *testing.T) {
require.Equal(t, 0, len(vs))
// query voter: missing address
e.RunWithError(t, "neo-go", "query", "voter", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.RunWithError(t, "tutus", "query", "voter", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
// Excessive parameters.
e.RunWithError(t, "neo-go", "query", "voter", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], validatorAddress, validatorAddress)
e.RunWithError(t, "neo-go", "query", "committee", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], "something")
e.RunWithError(t, "neo-go", "query", "candidates", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], "something")
e.RunWithError(t, "tutus", "query", "voter", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], validatorAddress, validatorAddress)
e.RunWithError(t, "tutus", "query", "committee", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], "something")
e.RunWithError(t, "tutus", "query", "candidates", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0], "something")
t.Run("VoteUnvote await", func(t *testing.T) {
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "register",
e.Run(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -187,7 +187,7 @@ func TestRegisterCandidate(t *testing.T) {
e.CheckAwaitableTxPersisted(t)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "vote",
e.Run(t, "tutus", "wallet", "candidate", "vote",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -200,7 +200,7 @@ func TestRegisterCandidate(t *testing.T) {
// unvote
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "vote",
e.Run(t, "tutus", "wallet", "candidate", "vote",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -213,7 +213,7 @@ func TestRegisterCandidate(t *testing.T) {
require.Equal(t, big.NewInt(0), vs[0].Votes)
// check state
e.Run(t, "neo-go", "query", "voter",
e.Run(t, "tutus", "query", "voter",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
validatorAddress)
e.CheckNextLine(t, "^\\s*Voted:\\s+"+"null") // no vote.
@ -223,7 +223,7 @@ func TestRegisterCandidate(t *testing.T) {
})
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "unregister",
e.Run(t, "tutus", "wallet", "candidate", "unregister",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -242,7 +242,7 @@ func TestRegisterCandidateCompat(t *testing.T) {
validatorPublic := testcli.ValidatorPriv.PublicKey()
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
@ -252,7 +252,7 @@ func TestRegisterCandidateCompat(t *testing.T) {
e.CheckTxPersisted(t)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "register",
e.Run(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -266,7 +266,7 @@ func TestRegisterCandidateCompat(t *testing.T) {
require.Equal(t, big.NewInt(0), vs[0].Votes)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "unregister",
e.Run(t, "tutus", "wallet", "candidate", "unregister",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,
@ -274,7 +274,7 @@ func TestRegisterCandidateCompat(t *testing.T) {
e.CheckTxPersisted(t)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "candidate", "register",
e.Run(t, "tutus", "wallet", "candidate", "register",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--address", validatorAddress,

View File

@ -38,9 +38,9 @@ func TestSignMultisigTx(t *testing.T) {
wallet2Path := filepath.Join(tmpDir, "multiWallet2.json")
addAccount := func(w string, wif string) {
e.Run(t, "neo-go", "wallet", "init", "--wallet", w)
e.Run(t, "tutus", "wallet", "init", "--wallet", w)
e.In.WriteString("acc\rpass\rpass\r")
e.Run(t, "neo-go", "wallet", "import-multisig",
e.Run(t, "tutus", "wallet", "import-multisig",
"--wallet", w,
"--wif", wif,
"--min", "2",
@ -53,7 +53,7 @@ func TestSignMultisigTx(t *testing.T) {
// Transfer funds to the multisig.
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
@ -72,39 +72,39 @@ func TestSignMultisigTx(t *testing.T) {
os.Remove(txPath)
})
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet1Path, "--from", multisigAddr,
"--to", priv.Address(), "--token", "NEO", "--amount", "1",
"--out", txPath)
// missing wallet
e.RunWithErrorCheck(t, `Required flag "in" not set`, "neo-go", "wallet", "sign")
e.RunWithErrorCheck(t, `Required flag "in" not set`, "tutus", "wallet", "sign")
// missing in
e.RunWithErrorCheck(t, `Required flag "in" not set`, "neo-go", "wallet", "sign",
e.RunWithErrorCheck(t, `Required flag "in" not set`, "tutus", "wallet", "sign",
"--wallet", wallet2Path)
// missing address
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--wallet", wallet2Path,
"--in", txPath)
// invalid address
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--wallet", wallet2Path, "--address", util.Uint160{}.StringLE(),
"--in", txPath)
// invalid out
e.In.WriteString("pass\r")
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath, "--out", t.TempDir())
// invalid RPC endpoint
e.In.WriteString("pass\r")
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://not-an-address",
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath)
@ -116,7 +116,7 @@ func TestSignMultisigTx(t *testing.T) {
os.Remove(txPath)
})
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet1Path, "--from", multisigAddr,
"--to", priv.Address(), "--token", "NEO", "--amount", "1",
@ -126,12 +126,12 @@ func TestSignMultisigTx(t *testing.T) {
require.NoError(t, err)
{ // Simple signer, not in signers.
e.In.WriteString("acc\rpass\rpass\r")
e.Run(t, "neo-go", "wallet", "import",
e.Run(t, "tutus", "wallet", "import",
"--wallet", wallet1Path,
"--wif", simplePriv.WIF())
t.Run("sign with missing signer", func(t *testing.T) {
e.In.WriteString("pass\r")
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--wallet", wallet1Path, "--address", simplePriv.Address(),
"--in", txPath, "--out", txPath)
})
@ -139,22 +139,22 @@ func TestSignMultisigTx(t *testing.T) {
t.Run("test invoke", func(t *testing.T) {
t.Run("missing file", func(t *testing.T) {
e.RunWithError(t, "neo-go", "util", "txdump")
e.RunWithError(t, "tutus", "util", "txdump")
fmt.Println(e.Out.String())
})
t.Run("no invoke", func(t *testing.T) {
e.Run(t, "neo-go", "util", "txdump", txPath)
e.Run(t, "tutus", "util", "txdump", txPath)
e.CheckTxTestInvokeOutput(t, 11)
e.CheckEOF(t)
})
t.Run("excessive parameters", func(t *testing.T) {
e.RunWithError(t, "neo-go", "util", "txdump",
e.RunWithError(t, "tutus", "util", "txdump",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
txPath, "garbage")
})
e.Run(t, "neo-go", "util", "txdump",
e.Run(t, "tutus", "util", "txdump",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
txPath)
e.CheckTxTestInvokeOutput(t, 11)
@ -167,7 +167,7 @@ func TestSignMultisigTx(t *testing.T) {
oldIn, err := os.ReadFile(txPath)
require.NoError(t, err)
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath)
newIn, err := os.ReadFile(txPath)
@ -192,7 +192,7 @@ func TestSignMultisigTx(t *testing.T) {
t.Run("sign, save and send", func(t *testing.T) {
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath, "--out", txPath)
@ -200,7 +200,7 @@ func TestSignMultisigTx(t *testing.T) {
})
t.Run("double-sign", func(t *testing.T) {
e.In.WriteString("pass\r")
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath, "--out", txPath)
@ -215,13 +215,13 @@ func TestSignMultisigTx(t *testing.T) {
h := deployVerifyContract(t, e)
e.In.WriteString("acc\rpass\rpass\r")
e.Run(t, "neo-go", "wallet", "import-deployed",
e.Run(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet1Path, "--wif", simplePriv.WIF(),
"--contract", h.StringLE())
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "contract", "invokefunction",
e.Run(t, "tutus", "contract", "invokefunction",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet1Path, "--address", multisigHash.StringLE(), // test with scripthash instead of address
"--out", txPath,
@ -235,19 +235,19 @@ func TestSignMultisigTx(t *testing.T) {
)
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath, "--out", txPath)
// Simple signer, not in signers.
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", wallet1Path, "--address", simplePriv.Address(),
"--in", txPath, "--out", txPath)
// Contract.
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", wallet1Path, "--address", address.Uint160ToString(h),
"--in", txPath, "--out", txPath)

View File

@ -113,7 +113,7 @@ func handleRegister(ctx *cli.Context) error {
}
return gasT.TransferUnsigned(
acc.ScriptHash(),
nativehashes.TutusToken,
nativehashes.Tutus,
big.NewInt(regPrice),
acc.PublicKey().Bytes(),
)

View File

@ -29,38 +29,38 @@ func TestWalletAccountRemove(t *testing.T) {
e.In.WriteString("acc1\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
e.In.WriteString("acc2\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "create", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "create", "--wallet", walletPath)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "address" not set`, "neo-go", "wallet", "remove")
e.RunWithErrorCheck(t, `Required flag "address" not set`, "tutus", "wallet", "remove")
})
t.Run("missing address", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "address" not set`, "neo-go", "wallet", "remove", "--wallet", walletPath)
e.RunWithErrorCheck(t, `Required flag "address" not set`, "tutus", "wallet", "remove", "--wallet", walletPath)
})
t.Run("invalid address", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "remove", "--wallet", walletPath,
e.RunWithError(t, "tutus", "wallet", "remove", "--wallet", walletPath,
"--address", util.Uint160{}.StringLE())
})
addr := w.Accounts[0].Address
t.Run("askForConsent > no", func(t *testing.T) {
e.In.WriteString("no")
e.Run(t, "neo-go", "wallet", "remove", "--wallet", walletPath,
e.Run(t, "tutus", "wallet", "remove", "--wallet", walletPath,
"--address", addr)
actual, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Equal(t, w, actual)
})
e.Run(t, "neo-go", "wallet", "remove", "--wallet", walletPath,
e.Run(t, "tutus", "wallet", "remove", "--wallet", walletPath,
"--address", addr, "--force")
actual, err := wallet.NewWalletFromFile(walletPath)
@ -77,12 +77,12 @@ func TestWalletChangePassword(t *testing.T) {
e.In.WriteString("acc1\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
e.In.WriteString("acc2\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "create", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "create", "--wallet", walletPath)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
@ -90,54 +90,54 @@ func TestWalletChangePassword(t *testing.T) {
addr1 := w.Accounts[0].Address
addr2 := w.Accounts[1].Address
t.Run("missing wallet path", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "change-password")
e.RunWithError(t, "tutus", "wallet", "change-password")
})
t.Run("EOF reading old password", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "change-password", "--wallet", walletPath)
e.RunWithError(t, "tutus", "wallet", "change-password", "--wallet", walletPath)
})
t.Run("bad old password", func(t *testing.T) {
e.In.WriteString("ssap\r")
e.In.WriteString("aaa\r") // Pretend for the password to be fine.
e.In.WriteString("aaa\r")
e.RunWithError(t, "neo-go", "wallet", "change-password", "--wallet", walletPath)
e.RunWithError(t, "tutus", "wallet", "change-password", "--wallet", walletPath)
})
t.Run("no account", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "change-password", "--wallet", walletPath, "--address", "NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq")
e.RunWithError(t, "tutus", "wallet", "change-password", "--wallet", walletPath, "--address", "NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq")
})
t.Run("bad new password, multiaccount", func(t *testing.T) {
e.In.WriteString("pass\r")
e.In.WriteString("pass1\r")
e.In.WriteString("pass2\r")
e.RunWithError(t, "neo-go", "wallet", "change-password", "--wallet", walletPath, "--address", addr1)
e.RunWithError(t, "tutus", "wallet", "change-password", "--wallet", walletPath, "--address", addr1)
})
t.Run("good, multiaccount", func(t *testing.T) {
e.In.WriteString("pass\r")
e.In.WriteString("asdf\r")
e.In.WriteString("asdf\r")
e.Run(t, "neo-go", "wallet", "change-password", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "change-password", "--wallet", walletPath)
})
t.Run("good, single account", func(t *testing.T) {
e.In.WriteString("asdf\r")
e.In.WriteString("jkl\r")
e.In.WriteString("jkl\r")
e.Run(t, "neo-go", "wallet", "change-password", "--wallet", walletPath, "--address", addr1)
e.Run(t, "tutus", "wallet", "change-password", "--wallet", walletPath, "--address", addr1)
})
t.Run("bad, different passwords", func(t *testing.T) {
e.In.WriteString("jkl\r")
e.RunWithError(t, "neo-go", "wallet", "change-password", "--wallet", walletPath)
e.RunWithError(t, "tutus", "wallet", "change-password", "--wallet", walletPath)
})
t.Run("good, second account", func(t *testing.T) {
e.In.WriteString("asdf\r")
e.In.WriteString("jkl\r")
e.In.WriteString("jkl\r")
e.Run(t, "neo-go", "wallet", "change-password", "--wallet", walletPath, "--address", addr2)
e.Run(t, "tutus", "wallet", "change-password", "--wallet", walletPath, "--address", addr2)
})
t.Run("good, second multiaccount", func(t *testing.T) {
e.In.WriteString("jkl\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "change-password", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "change-password", "--wallet", walletPath)
})
}
@ -145,14 +145,14 @@ func TestWalletInit(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("missing path", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "init")
e.RunWithError(t, "tutus", "wallet", "init")
})
t.Run("invalid path", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "init", "--wallet", t.TempDir())
e.RunWithError(t, "tutus", "wallet", "init", "--wallet", t.TempDir())
})
t.Run("good: no account", func(t *testing.T) {
walletPath := filepath.Join(t.TempDir(), "wallet.json")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Equal(t, 0, len(w.Accounts))
@ -160,21 +160,21 @@ func TestWalletInit(t *testing.T) {
t.Run("with account", func(t *testing.T) {
walletPath := filepath.Join(t.TempDir(), "wallet.json")
t.Run("missing acc name", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.RunWithError(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
})
t.Run("missing pass", func(t *testing.T) {
e.In.WriteString("acc\r")
e.RunWithError(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.RunWithError(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
})
t.Run("missing second pass", func(t *testing.T) {
e.In.WriteString("acc\r")
e.In.WriteString("pass\r")
e.RunWithError(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.RunWithError(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
})
e.In.WriteString("acc\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Equal(t, 1, len(w.Accounts))
@ -191,7 +191,7 @@ func TestWalletInit(t *testing.T) {
res, err := yaml.Marshal(cfg)
require.NoError(t, err)
require.NoError(t, os.WriteFile(configPath, res, 0666))
e.Run(t, "neo-go", "wallet", "init", "--wallet-config", configPath, "--account")
e.Run(t, "tutus", "wallet", "init", "--wallet-config", configPath, "--account")
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Equal(t, 1, len(w.Accounts))
@ -200,7 +200,7 @@ func TestWalletInit(t *testing.T) {
tmpDir := t.TempDir()
walletPath := filepath.Join(tmpDir, "wallet.json")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
t.Run("terminal escape codes", func(t *testing.T) {
walletPath := filepath.Join(tmpDir, "walletrussian.json")
@ -213,7 +213,7 @@ func TestWalletInit(t *testing.T) {
"andmore\r")
e.In.WriteString("пароу" + bksp + "ль\r")
e.In.WriteString("пароль\r")
e.Run(t, "neo-go", "wallet", "init", "--account",
e.Run(t, "tutus", "wallet", "init", "--account",
"--wallet", walletPath)
w, err := wallet.NewWalletFromFile(walletPath)
@ -225,18 +225,18 @@ func TestWalletInit(t *testing.T) {
t.Run("CreateAccount", func(t *testing.T) {
t.Run("stdin", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "create", "--wallet", "-")
e.RunWithError(t, "tutus", "wallet", "create", "--wallet", "-")
})
t.Run("passwords mismatch", func(t *testing.T) {
e.In.WriteString("testname\r")
e.In.WriteString("testpass\r")
e.In.WriteString("badpass\r")
e.RunWithError(t, "neo-go", "wallet", "create", "--wallet", walletPath)
e.RunWithError(t, "tutus", "wallet", "create", "--wallet", walletPath)
})
e.In.WriteString("testname\r")
e.In.WriteString("testpass\r")
e.In.WriteString("testpass\r")
e.Run(t, "neo-go", "wallet", "create", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "create", "--wallet", walletPath)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
@ -248,7 +248,7 @@ func TestWalletInit(t *testing.T) {
sh := w.Accounts[0].Contract.ScriptHash()
addr := w.Accounts[0].Address
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "remove",
e.Run(t, "tutus", "wallet", "remove",
"--wallet", walletPath, "--address", addr)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
@ -259,14 +259,14 @@ func TestWalletInit(t *testing.T) {
t.Run("Import", func(t *testing.T) {
t.Run("WIF", func(t *testing.T) {
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "import")
e.RunWithError(t, "tutus", "wallet", "import")
})
priv, err := keys.NewPrivateKey()
require.NoError(t, err)
e.In.WriteString("test_account\r")
e.In.WriteString("qwerty\r")
e.In.WriteString("qwerty\r")
e.Run(t, "neo-go", "wallet", "import", "--wallet", walletPath,
e.Run(t, "tutus", "wallet", "import", "--wallet", walletPath,
"--wif", priv.WIF())
w, err := wallet.NewWalletFromFile(walletPath)
@ -280,7 +280,7 @@ func TestWalletInit(t *testing.T) {
e.In.WriteString("test_account_2\r")
e.In.WriteString("qwerty2\r")
e.In.WriteString("qwerty2\r")
e.RunWithError(t, "neo-go", "wallet", "import",
e.RunWithError(t, "tutus", "wallet", "import",
"--wallet", walletPath, "--wif", priv.WIF())
})
@ -292,7 +292,7 @@ func TestWalletInit(t *testing.T) {
e.In.WriteString("test_account_3\r")
e.In.WriteString("qwerty\r")
e.In.WriteString("qwerty\r")
e.RunWithError(t, "neo-go", "wallet", "import",
e.RunWithError(t, "tutus", "wallet", "import",
"--wallet", walletPath, "--wif", priv.WIF(), "--contract", "not-a-hex")
})
check := func(t *testing.T, expectedLabel string, pass string) {
@ -307,7 +307,7 @@ func TestWalletInit(t *testing.T) {
e.In.WriteString("test_account_3\r")
e.In.WriteString("qwerty\r")
e.In.WriteString("qwerty\r")
e.Run(t, "neo-go", "wallet", "import",
e.Run(t, "tutus", "wallet", "import",
"--wallet", walletPath, "--wif", priv.WIF(), "--contract", "0a0b0c")
check(t, "test_account_3", "qwerty")
})
@ -325,7 +325,7 @@ func TestWalletInit(t *testing.T) {
priv, err = keys.NewPrivateKey()
require.NoError(t, err)
e.In.WriteString("test_account_4\r")
e.Run(t, "neo-go", "wallet", "import",
e.Run(t, "tutus", "wallet", "import",
"--wallet-config", configPath, "--wif", priv.WIF(), "--contract", "0a0b0c0d")
check(t, "test_account_4", "qwerty")
})
@ -341,7 +341,7 @@ func TestWalletInit(t *testing.T) {
require.NoError(t, os.WriteFile(configPath, res, 0666))
priv, err = keys.NewPrivateKey()
require.NoError(t, err)
e.Run(t, "neo-go", "wallet", "import",
e.Run(t, "tutus", "wallet", "import",
"--wallet-config", configPath, "--wif", priv.WIF(), "--contract", "0a0b0c0d", "--name", "test_account_5")
check(t, "test_account_5", "qwerty")
})
@ -354,12 +354,12 @@ func TestWalletInit(t *testing.T) {
t.Run("InvalidPassword", func(t *testing.T) {
e.In.WriteString("password1\r")
e.RunWithError(t, "neo-go", "wallet", "import", "--wallet", walletPath,
e.RunWithError(t, "tutus", "wallet", "import", "--wallet", walletPath,
"--wif", acc.EncryptedWIF, "--name", "acc1")
})
e.In.WriteString("somepass\r")
e.Run(t, "neo-go", "wallet", "import", "--wallet", walletPath,
e.Run(t, "tutus", "wallet", "import", "--wallet", walletPath,
"--wif", acc.EncryptedWIF, "--name", "acc1")
w, err := wallet.NewWalletFromFile(walletPath)
@ -376,7 +376,7 @@ func TestWalletInit(t *testing.T) {
e.In.WriteString("acc2\r")
e.In.WriteString("somepass\r")
e.Run(t, "neo-go", "wallet", "import", "--wallet", walletPath,
e.Run(t, "tutus", "wallet", "import", "--wallet", walletPath,
"--wif", acc.EncryptedWIF)
w, err := wallet.NewWalletFromFile(walletPath)
@ -404,7 +404,7 @@ func TestWalletInit(t *testing.T) {
if needUserPass {
e.In.WriteString(pass + "\r")
}
e.Run(t, "neo-go", "wallet", "import", "--wallet-config", configPath,
e.Run(t, "tutus", "wallet", "import", "--wallet-config", configPath,
"--wif", acc.EncryptedWIF, "--name", "acc3"+configPass)
w, err := wallet.NewWalletFromFile(walletPath)
@ -424,15 +424,15 @@ func TestWalletInit(t *testing.T) {
})
t.Run("Multisig", func(t *testing.T) {
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "import-multisig")
e.RunWithError(t, "tutus", "wallet", "import-multisig")
})
t.Run("insufficient pubs", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "import-multisig",
e.RunWithError(t, "tutus", "wallet", "import-multisig",
"--wallet", walletPath,
"--min", "2")
})
privs, pubs := testcli.GenerateKeys(t, 4)
cmd := []string{"neo-go", "wallet", "import-multisig",
cmd := []string{"tutus", "wallet", "import-multisig",
"--wallet", walletPath,
"--min", "2"}
t.Run("invalid pub encoding", func(t *testing.T) {
@ -491,9 +491,9 @@ func TestWalletInit(t *testing.T) {
script, err = smartcontract.CreateMultiSigRedeemScript(2, pubs)
require.NoError(t, err)
// Create a wallet and import a standard account
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
e.In.WriteString("standardacc\rstdpass\rstdpass\r")
e.Run(t, "neo-go", "wallet", "import",
e.Run(t, "tutus", "wallet", "import",
"--wallet", walletPath,
"--wif", privs[0].WIF())
w, err = wallet.NewWalletFromFile(walletPath)
@ -504,7 +504,7 @@ func TestWalletInit(t *testing.T) {
// Test when a public key of an already imported account is present
t.Run("existing account public key, no WIF", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "import-multisig",
e.Run(t, "tutus", "wallet", "import-multisig",
"--wallet", walletPath,
"--min", "2",
pubs[0].StringCompressed(), // Public key of the already imported account
@ -526,7 +526,7 @@ func TestWalletInit(t *testing.T) {
scriptNew, err := smartcontract.CreateMultiSigRedeemScript(2, pubsNew)
require.NoError(t, err)
e.RunWithError(t, "neo-go", "wallet", "import-multisig",
e.RunWithError(t, "tutus", "wallet", "import-multisig",
"--wallet", walletPath,
"--min", "2",
pubsNew[0].StringCompressed(),
@ -546,14 +546,14 @@ func TestWalletExport(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "export")
e.RunWithError(t, "tutus", "wallet", "export")
})
t.Run("invalid address", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "export",
e.RunWithError(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, "not-an-address")
})
t.Run("Encrypted", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "export",
e.Run(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, testcli.ValidatorAddr)
line, err := e.Out.ReadString('\n')
require.NoError(t, err)
@ -563,20 +563,20 @@ func TestWalletExport(t *testing.T) {
})
t.Run("Decrypted", func(t *testing.T) {
t.Run("NoAddress", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "export",
e.RunWithError(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, "--decrypt")
})
t.Run("EOF reading password", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "export",
e.RunWithError(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, "--decrypt", testcli.ValidatorAddr)
})
t.Run("invalid password", func(t *testing.T) {
e.In.WriteString("invalid_pass\r")
e.RunWithError(t, "neo-go", "wallet", "export",
e.RunWithError(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, "--decrypt", testcli.ValidatorAddr)
})
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "export",
e.Run(t, "tutus", "wallet", "export",
"--wallet", testcli.ValidatorWallet, "--decrypt", testcli.ValidatorAddr)
line, err := e.Out.ReadString('\n')
require.NoError(t, err)
@ -588,37 +588,37 @@ func TestWalletClaimGas(t *testing.T) {
e := testcli.NewExecutor(t, true)
t.Run("missing wallet path", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "claim",
e.RunWithError(t, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--address", testcli.TestWalletAccount)
})
t.Run("missing address", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "address" not set`, "neo-go", "wallet", "claim",
e.RunWithErrorCheck(t, `Required flag "address" not set`, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.TestWalletPath)
})
t.Run("invalid address", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "claim",
e.RunWithError(t, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.TestWalletPath,
"--address", util.Uint160{}.StringLE())
})
t.Run("missing endpoint", func(t *testing.T) {
e.In.WriteString("testpass\r")
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "neo-go", "wallet", "claim",
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "tutus", "wallet", "claim",
"--wallet", testcli.TestWalletPath,
"--address", testcli.TestWalletAccount)
})
t.Run("insufficient funds", func(t *testing.T) {
e.In.WriteString("testpass\r")
e.RunWithError(t, "neo-go", "wallet", "claim",
e.RunWithError(t, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.TestWalletPath,
"--address", testcli.TestWalletAccount)
})
args := []string{
"neo-go", "wallet", "nep17", "multitransfer",
"tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr,
@ -640,7 +640,7 @@ func TestWalletClaimGas(t *testing.T) {
require.True(t, cl.Sign() > 0)
e.In.WriteString("testpass\r")
e.Run(t, "neo-go", "wallet", "claim",
e.Run(t, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.TestWalletPath,
"--address", testcli.TestWalletAccount,
@ -658,7 +658,7 @@ func TestWalletClaimGas(t *testing.T) {
}
t.Run("await", func(t *testing.T) {
args := []string{
"neo-go", "wallet", "nep17", "multitransfer",
"tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet,
"--from", testcli.ValidatorAddr, "--await",
@ -680,7 +680,7 @@ func TestWalletClaimGas(t *testing.T) {
require.True(t, cl.Sign() > 0)
e.In.WriteString("testpass\r")
e.Run(t, "neo-go", "wallet", "claim",
e.Run(t, "tutus", "wallet", "claim",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.TestWalletPath,
"--address", testcli.TestWalletAccount,
@ -705,31 +705,31 @@ func TestWalletImportDeployed(t *testing.T) {
h := deployVerifyContract(t, e)
walletPath := filepath.Join(tmpDir, "wallet.json")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath)
priv, err := keys.NewPrivateKey()
require.NoError(t, err)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "contract" not set`, "neo-go", "wallet", "import-deployed", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
e.RunWithErrorCheck(t, `Required flag "contract" not set`, "tutus", "wallet", "import-deployed", "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
t.Run("missing contract sh", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "contract" not set`, "neo-go", "wallet", "import-deployed",
e.RunWithErrorCheck(t, `Required flag "contract" not set`, "tutus", "wallet", "import-deployed",
"--wallet", walletPath, "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
t.Run("missing WIF", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "import-deployed",
e.RunWithError(t, "tutus", "wallet", "import-deployed",
"--wallet", walletPath, "--contract", h.StringLE(), "--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
t.Run("missing endpoint", func(t *testing.T) {
e.In.WriteString("acc\rpass\rpass\r")
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "neo-go", "wallet", "import-deployed",
e.RunWithErrorCheck(t, `Required flag "rpc-endpoint" not set`, "tutus", "wallet", "import-deployed",
"--wallet", walletPath, "--contract", h.StringLE(),
"--wif", priv.WIF())
})
t.Run("unknown contract", func(t *testing.T) {
e.In.WriteString("acc\rpass\rpass\r")
e.RunWithError(t, "neo-go", "wallet", "import-deployed",
e.RunWithError(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--contract", util.Uint160{}.StringLE(),
"--wif", priv.WIF())
@ -737,14 +737,14 @@ func TestWalletImportDeployed(t *testing.T) {
t.Run("no `verify` method", func(t *testing.T) {
badH := deployNNSContract(t, e) // wrong contract with no `verify` method
e.In.WriteString("acc\rpass\rpass\r")
e.RunWithError(t, "neo-go", "wallet", "import-deployed",
e.RunWithError(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--contract", badH.StringLE(),
"--wif", priv.WIF())
})
e.In.WriteString("acc\rpass\rpass\r")
e.Run(t, "neo-go", "wallet", "import-deployed",
e.Run(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--wif", priv.WIF(),
"--contract", h.StringLE())
@ -762,7 +762,7 @@ func TestWalletImportDeployed(t *testing.T) {
t.Run("re-importing", func(t *testing.T) {
e.In.WriteString("acc\rpass\rpass\r")
e.RunWithError(t, "neo-go", "wallet", "import-deployed",
e.RunWithError(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--wif", priv.WIF(),
"--contract", h.StringLE())
@ -770,7 +770,7 @@ func TestWalletImportDeployed(t *testing.T) {
t.Run("Sign", func(t *testing.T) {
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "nep17", "multitransfer",
e.Run(t, "tutus", "wallet", "nep17", "multitransfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", testcli.ValidatorWallet, "--from", testcli.ValidatorAddr,
"--force",
@ -782,7 +782,7 @@ func TestWalletImportDeployed(t *testing.T) {
require.NoError(t, err)
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "nep17", "transfer",
e.Run(t, "tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--from", contractAddr,
"--force",
@ -796,10 +796,10 @@ func TestWalletImportDeployed(t *testing.T) {
})
t.Run("import with name argument", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "remove",
e.Run(t, "tutus", "wallet", "remove",
"--wallet", walletPath, "--address", address.Uint160ToString(h), "--force")
e.In.WriteString("pass\rpass\r")
e.Run(t, "neo-go", "wallet", "import-deployed",
e.Run(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--wif", priv.WIF(),
"--contract", h.StringLE(), "--name", "acc")
@ -807,7 +807,7 @@ func TestWalletImportDeployed(t *testing.T) {
})
t.Run("import with name argument and wallet config", func(t *testing.T) {
e.Run(t, "neo-go", "wallet", "remove",
e.Run(t, "tutus", "wallet", "remove",
"--wallet", walletPath, "--address", address.Uint160ToString(h), "--force")
configPath := filepath.Join(t.TempDir(), "wallet-config.yaml")
cfg := &config.Wallet{
@ -817,7 +817,7 @@ func TestWalletImportDeployed(t *testing.T) {
bytes, err := yaml.Marshal(cfg)
require.NoError(t, err)
require.NoError(t, os.WriteFile(configPath, bytes, os.ModePerm))
e.Run(t, "neo-go", "wallet", "import-deployed",
e.Run(t, "tutus", "wallet", "import-deployed",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet-config", configPath, "--wif", priv.WIF(),
"--contract", h.StringLE(), "--name", "acc")
@ -832,22 +832,22 @@ func TestStripKeys(t *testing.T) {
e.In.WriteString("acc1\r")
e.In.WriteString("pass\r")
e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath, "--account")
e.Run(t, "tutus", "wallet", "init", "--wallet", walletPath, "--account")
w1, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
e.RunWithError(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath, "something")
e.RunWithError(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath+".bad")
e.RunWithError(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath, "something")
e.RunWithError(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath+".bad")
e.In.WriteString("no")
e.Run(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath)
w2, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Equal(t, w1, w2)
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath)
e.Run(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath, "--force") // Does nothing effectively, but tests the force flag.
e.Run(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath)
e.Run(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath, "--force") // Does nothing effectively, but tests the force flag.
w3, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
for _, a := range w3.Accounts {
@ -869,10 +869,10 @@ func TestOfflineSigning(t *testing.T) {
require.NoError(t, os.WriteFile(walletPath, jOut, 0644))
// And remove keys from it.
e.Run(t, "neo-go", "wallet", "strip-keys", "--wallet", walletPath, "--force")
e.Run(t, "tutus", "wallet", "strip-keys", "--wallet", walletPath, "--force")
t.Run("1/1 multisig", func(t *testing.T) {
args := []string{"neo-go", "wallet", "nep17", "transfer",
args := []string{"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", walletPath,
"--from", testcli.ValidatorAddr,
@ -886,29 +886,29 @@ func TestOfflineSigning(t *testing.T) {
// But can be saved.
e.Run(t, append(args, "--out", txPath)...)
// It can't be signed with the original wallet.
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--wallet", walletPath, "--address", testcli.ValidatorAddr,
"--in", txPath, "--out", txPath)
t.Run("sendtx", func(t *testing.T) {
// And it can't be sent.
e.RunWithError(t, "neo-go", "util", "sendtx",
e.RunWithError(t, "tutus", "util", "sendtx",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
txPath)
// Even with too many arguments.
e.RunWithError(t, "neo-go", "util", "sendtx",
e.RunWithError(t, "tutus", "util", "sendtx",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
txPath, txPath)
// Or no arguments at all.
e.RunWithError(t, "neo-go", "util", "sendtx",
e.RunWithError(t, "tutus", "util", "sendtx",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0])
})
// But it can be signed with a proper wallet.
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", txPath, "--out", txPath)
// And then anyone can send (even via wallet sign).
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--address", testcli.ValidatorAddr,
"--in", txPath)
@ -916,7 +916,7 @@ func TestOfflineSigning(t *testing.T) {
e.CheckTxPersisted(t)
t.Run("await 1/1 multisig", func(t *testing.T) {
args := []string{"neo-go", "wallet", "nep17", "transfer",
args := []string{"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", walletPath,
"--from", testcli.ValidatorAddr,
@ -928,11 +928,11 @@ func TestOfflineSigning(t *testing.T) {
e.Run(t, append(args, "--out", txPath)...)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", testcli.ValidatorWallet, "--address", testcli.ValidatorAddr,
"--in", txPath, "--out", txPath)
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--wallet", walletPath, "--address", testcli.ValidatorAddr,
"--in", txPath, "--await")
@ -941,7 +941,7 @@ func TestOfflineSigning(t *testing.T) {
t.Run("simple signature", func(t *testing.T) {
simpleAddr := w.Accounts[0].Address
args := []string{"neo-go", "wallet", "nep17", "transfer",
args := []string{"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", walletPath,
"--from", simpleAddr,
@ -955,25 +955,25 @@ func TestOfflineSigning(t *testing.T) {
// But can be saved.
e.Run(t, append(args, "--out", txPath)...)
// It can't be signed with the original wallet.
e.RunWithError(t, "neo-go", "wallet", "sign",
e.RunWithError(t, "tutus", "wallet", "sign",
"--wallet", walletPath, "--address", simpleAddr,
"--in", txPath, "--out", txPath)
// But can be with a proper one.
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", testcli.ValidatorWallet, "--address", simpleAddr,
"--in", txPath, "--out", txPath)
// Sending without an RPC node is not likely to succeed.
e.RunWithError(t, "neo-go", "util", "sendtx", txPath)
e.RunWithError(t, "tutus", "util", "sendtx", txPath)
// But it requires no wallet at all.
e.Run(t, "neo-go", "util", "sendtx",
e.Run(t, "tutus", "util", "sendtx",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
txPath)
})
t.Run("await simple signature", func(t *testing.T) {
simpleAddr := w.Accounts[0].Address
args := []string{"neo-go", "wallet", "nep17", "transfer",
args := []string{"tutus", "wallet", "nep17", "transfer",
"--rpc-endpoint", "http://" + e.RPC.Addresses()[0],
"--wallet", walletPath,
"--from", simpleAddr,
@ -986,11 +986,11 @@ func TestOfflineSigning(t *testing.T) {
e.Run(t, append(args, "--out", txPath)...)
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "sign",
e.Run(t, "tutus", "wallet", "sign",
"--wallet", testcli.ValidatorWallet, "--address", simpleAddr,
"--in", txPath, "--out", txPath)
e.Run(t, "neo-go", "util", "sendtx",
e.Run(t, "tutus", "util", "sendtx",
"--rpc-endpoint", "http://"+e.RPC.Addresses()[0],
"--await", txPath)
e.CheckAwaitableTxPersisted(t)
@ -1001,9 +1001,9 @@ func TestWalletDump(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "dump")
e.RunWithError(t, "tutus", "wallet", "dump")
})
cmd := []string{"neo-go", "wallet", "dump", "--wallet", testcli.TestWalletPath}
cmd := []string{"tutus", "wallet", "dump", "--wallet", testcli.TestWalletPath}
e.Run(t, cmd...)
rawStr := strings.TrimSpace(e.Out.String())
w := new(wallet.Wallet)
@ -1039,7 +1039,7 @@ func TestWalletDump(t *testing.T) {
res, err := yaml.Marshal(cfg)
require.NoError(t, err)
require.NoError(t, os.WriteFile(configPath, res, 0666))
e.Run(t, "neo-go", "wallet", "dump", "--wallet-config", configPath)
e.Run(t, "tutus", "wallet", "dump", "--wallet-config", configPath)
rawStr := strings.TrimSpace(e.Out.String())
w := new(wallet.Wallet)
require.NoError(t, json.Unmarshal([]byte(rawStr), w))
@ -1052,9 +1052,9 @@ func TestWalletDump(t *testing.T) {
func TestWalletDumpKeys(t *testing.T) {
e := testcli.NewExecutor(t, false)
t.Run("missing wallet", func(t *testing.T) {
e.RunWithError(t, "neo-go", "wallet", "dump-keys")
e.RunWithError(t, "tutus", "wallet", "dump-keys")
})
cmd := []string{"neo-go", "wallet", "dump-keys", "--wallet", testcli.ValidatorWallet}
cmd := []string{"tutus", "wallet", "dump-keys", "--wallet", testcli.ValidatorWallet}
pubRegex := "^0[23][a-hA-H0-9]{64}$"
t.Run("all", func(t *testing.T) {
e.Run(t, cmd...)
@ -1105,7 +1105,7 @@ func TestWalletConvert(t *testing.T) {
e := testcli.NewExecutor(t, false)
outPath := filepath.Join(tmpDir, "wallet.json")
cmd := []string{"neo-go", "wallet", "convert"}
cmd := []string{"tutus", "wallet", "convert"}
t.Run("missing wallet", func(t *testing.T) {
e.RunWithErrorCheck(t, `Required flag "out" not set`, cmd...)
})
@ -1130,7 +1130,7 @@ func TestWalletConvert(t *testing.T) {
// 2 accounts.
e.In.WriteString("one\r")
e.In.WriteString("one\r")
e.Run(t, "neo-go", "wallet", "convert",
e.Run(t, "tutus", "wallet", "convert",
"--wallet", "testdata/testwallet_NEO2.json",
"--out", outPath)

View File

@ -3,11 +3,15 @@ module github.com/tutus-one/tutus-chain/examples/nft-nd-nns
go 1.24.0
require (
github.com/tutus-one/tutus-chain v0.113.1-0.20251010141927-ac58bbb39350
github.com/tutus-one/tutus-chain/pkg/interop v0.0.0-20251217090505-857f951d81a9
github.com/tutus-one/tutus-chain v0.0.0
github.com/tutus-one/tutus-chain/pkg/interop v0.0.0
github.com/stretchr/testify v1.11.1
)
replace github.com/tutus-one/tutus-chain => ../..
replace github.com/tutus-one/tutus-chain/pkg/interop => ../../pkg/interop
require (
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect

View File

@ -5,10 +5,14 @@ go 1.24.0
require (
github.com/consensys/gnark v0.14.0
github.com/consensys/gnark-crypto v0.19.1
github.com/tutus-one/tutus-chain v0.106.3
github.com/tutus-one/tutus-chain v0.0.0
github.com/stretchr/testify v1.10.0
)
replace github.com/tutus-one/tutus-chain => ../../..
replace github.com/tutus-one/tutus-chain/pkg/interop => ../../../pkg/interop
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.24.0 // indirect
@ -29,7 +33,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2 // indirect
github.com/tutus-one/tutus-chain/pkg/interop v0.0.0-20251217090505-857f951d81a9 // indirect
github.com/tutus-one/tutus-chain/pkg/interop v0.0.0 // indirect
github.com/nspcc-dev/rfc6979 v0.2.1 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect

View File

@ -12,6 +12,6 @@ events:
- name: amount
type: Integer
permissions:
- hash: 2d2dcf3c8b6b96793f6ecfd5856bb39d536f1d89
- hash: 7a8123a18fcbd51f9eba5d50c3bf88bf8f13da88
methods: ["transfer", "balanceOf"]
- methods: ["onNEP17Payment"]

View File

@ -439,14 +439,14 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger, newN
if bc.tutus == native.ITutus(nil) {
return nil, errors.New("native TutusToken implementation is required")
}
if err := validateNative(bc.tutus, nativeids.Tutus, nativenames.Tutus, nativehashes.TutusToken); err != nil {
if err := validateNative(bc.tutus, nativeids.Tutus, nativenames.Tutus, nativehashes.Tutus); err != nil {
return nil, err
}
bc.lub = bc.contracts.Lub()
if bc.lub == native.ILub(nil) {
return nil, errors.New("native LubToken implementation is required")
}
if err := validateNative(bc.lub, nativeids.Lub, nativenames.Lub, nativehashes.LubToken); err != nil {
if err := validateNative(bc.lub, nativeids.Lub, nativenames.Lub, nativehashes.Lub); err != nil {
return nil, err
}
bc.policy = bc.contracts.Policy()
@ -3526,12 +3526,12 @@ func (bc *Blockchain) verifyHeaderWitnesses(currHeader, prevHeader *block.Header
// GoverningTokenHash returns the governing token (Tutus) native contract hash.
func (bc *Blockchain) GoverningTokenHash() util.Uint160 {
return nativehashes.TutusToken
return nativehashes.Tutus
}
// UtilityTokenHash returns the utility token (Lub) native contract hash.
func (bc *Blockchain) UtilityTokenHash() util.Uint160 {
return nativehashes.LubToken
return nativehashes.Lub
}
// ManagementContractHash returns management contract's hash.

View File

@ -2798,7 +2798,7 @@ func TestBlockchain_GenesisTransactionExtension(t *testing.T) {
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
emit.Bytes(script.BinWriter, to.BytesBE())
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
emit.AppCall(script.BinWriter, nativehashes.TutusToken, "transfer", callflag.All, from, to, amount, nil)
emit.AppCall(script.BinWriter, nativehashes.Tutus, "transfer", callflag.All, from, to, amount, nil)
emit.Opcodes(script.BinWriter, opcode.ASSERT)
var sysFee int64 = 1_0000_0000

View File

@ -275,7 +275,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
continue
case nativenames.Lub:
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.LubToken,
ScriptHash: nativehashes.Lub,
Name: "Transfer",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Null{},
@ -285,7 +285,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
})
case nativenames.Tutus:
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.TutusToken,
ScriptHash: nativehashes.Tutus,
Name: "Transfer",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Null{},
@ -332,7 +332,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(aer))
expected = expected[:0]
for _, h := range []util.Uint160{nativehashes.ContractManagement, nativehashes.StdLib, nativehashes.CryptoLib, nativehashes.TutusToken, nativehashes.PolicyContract, nativehashes.RoleManagement} {
for _, h := range []util.Uint160{nativehashes.ContractManagement, nativehashes.StdLib, nativehashes.CryptoLib, nativehashes.Tutus, nativehashes.PolicyContract, nativehashes.RoleManagement} {
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.ContractManagement,
Name: "Update",
@ -662,8 +662,8 @@ func TestManagement_ContractCache(t *testing.T) {
nativehashes.StdLib,
nativehashes.CryptoLib,
nativehashes.LedgerContract,
nativehashes.TutusToken,
nativehashes.LubToken,
nativehashes.Tutus,
nativehashes.Lub,
nativehashes.PolicyContract,
nativehashes.RoleManagement,
nativehashes.OracleContract,

View File

@ -384,17 +384,17 @@ func TestPolicy_BlockedAccounts(t *testing.T) {
e.CheckHalt(t, tx.Hash())
// Register a candidate and vote.
g := c.NewInvoker(nativehashes.LubToken, acc, candidate)
n := c.NewInvoker(nativehashes.TutusToken, acc)
nCommittee := c.NewInvoker(nativehashes.TutusToken, e.Committee)
g.Invoke(t, true, "transfer", acc.ScriptHash(), nativehashes.TutusToken, 1000*native.LubFactor, pub.Bytes())
g := c.NewInvoker(nativehashes.Lub, acc, candidate)
n := c.NewInvoker(nativehashes.Tutus, acc)
nCommittee := c.NewInvoker(nativehashes.Tutus, e.Committee)
g.Invoke(t, true, "transfer", acc.ScriptHash(), nativehashes.Tutus, 1000*native.LubFactor, pub.Bytes())
n.Invoke(t, true, "vote", acc.ScriptHash(), pub.Bytes())
n.Invoke(t, 1_000, "getCandidateVote", pub.Bytes())
// Block the account and check notification and revoked votes.
h := committeeInvoker.Invoke(t, true, "blockAccount", acc.ScriptHash())
e.CheckTxNotificationEvent(t, h, 0, state.NotificationEvent{
ScriptHash: nativehashes.TutusToken,
ScriptHash: nativehashes.Tutus,
Name: "Vote",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Make(acc.ScriptHash()),

View File

@ -175,7 +175,7 @@ func newTutus(cfg config.ProtocolConfiguration) *Tutus {
m.SupportedStandards = append(m.SupportedStandards, manifest.NEP27StandardName)
}
})
nep17.symbol = "TUTUS"
nep17.symbol = "TUT"
nep17.decimals = 0
nep17.factor = 1
nep17.incBalance = n.increaseBalance

View File

@ -17,10 +17,10 @@ var (
CryptoLib = util.Uint160{0x1b, 0xf5, 0x75, 0xab, 0x11, 0x89, 0x68, 0x84, 0x13, 0x61, 0xa, 0x35, 0xa1, 0x28, 0x86, 0xcd, 0xe0, 0xb6, 0x6c, 0x72}
// LedgerContract is a hash of native LedgerContract contract.
LedgerContract = util.Uint160{0xbe, 0xf2, 0x4, 0x31, 0x40, 0x36, 0x2a, 0x77, 0xc1, 0x50, 0x99, 0xc7, 0xe6, 0x4c, 0x12, 0xf7, 0x0, 0xb6, 0x65, 0xda}
// TutusToken is a hash of native TutusToken contract.
TutusToken = util.Uint160{0x89, 0x1d, 0x6f, 0x53, 0x9d, 0xb3, 0x6b, 0x85, 0xd5, 0xcf, 0x6e, 0x3f, 0x79, 0x96, 0x6b, 0x8b, 0x3c, 0xcf, 0x2d, 0x2d}
// LubToken is a hash of native LubToken contract.
LubToken = util.Uint160{0x69, 0xe8, 0x15, 0x86, 0x5e, 0xaa, 0x14, 0x6f, 0xdd, 0x64, 0x79, 0xd4, 0xa3, 0x57, 0xf0, 0x70, 0x93, 0xbb, 0x95, 0xe8}
// Tutus is a hash of native Tutus contract.
Tutus = util.Uint160{0x88, 0xda, 0x13, 0x8f, 0xbf, 0x88, 0xbf, 0xc3, 0x50, 0x5d, 0xba, 0x9e, 0x1f, 0xd5, 0xcb, 0x8f, 0xa1, 0x23, 0x81, 0x7a}
// Lub is a hash of native Lub contract.
Lub = util.Uint160{0x38, 0x72, 0xea, 0xf3, 0x9d, 0x7f, 0x9b, 0x39, 0xe5, 0xbe, 0x30, 0xaf, 0x3e, 0xbe, 0xd8, 0x0, 0x6f, 0xfe, 0xb3, 0x8a}
// PolicyContract is a hash of native PolicyContract contract.
PolicyContract = util.Uint160{0x7b, 0xc6, 0x81, 0xc0, 0xa1, 0xf7, 0x1d, 0x54, 0x34, 0x57, 0xb6, 0x8b, 0xba, 0x8d, 0x5f, 0x9f, 0xdd, 0x4e, 0x5e, 0xcc}
// RoleManagement is a hash of native RoleManagement contract.

View File

@ -4,8 +4,8 @@ package nativenames
const (
Management = "ContractManagement"
Ledger = "LedgerContract"
Tutus = "TutusToken"
Lub = "LubToken"
Tutus = "Tutus"
Lub = "Lub"
Policy = "PolicyContract"
Oracle = "OracleContract"
Designation = "RoleManagement"

View File

@ -1,5 +1,5 @@
/*
Package lub provides interface to LubToken native contract.
Package lub provides interface to Lub native contract.
It implements regular NEP-17 functions for Lub token.
*/
package lub
@ -11,7 +11,7 @@ import (
)
// Hash represents Lub contract hash.
const Hash = "\x69\xe8\x15\x86\x5e\xaa\x14\x6f\xdd\x64\x79\xd4\xa3\x57\xf0\x70\x93\xbb\x95\xe8"
const Hash = "\x38\x72\xea\xf3\x9d\x7f\x9b\x39\xe5\xbe\x30\xaf\x3e\xbe\xd8\x00\x6f\xfe\xb3\x8a"
// Symbol represents `symbol` method of Lub native contract.
func Symbol() string {

View File

@ -1,5 +1,5 @@
/*
Package tutus provides an interface to TutusToken native contract.
Package tutus provides an interface to Tutus native contract.
Tutus token is special, it's not just a regular NEP-17 contract, it also
provides access to chain-specific settings and implements committee
voting system.
@ -22,7 +22,7 @@ type AccountState struct {
}
// Hash represents Tutus contract hash.
const Hash = "\x89\x1d\x6f\x53\x9d\xb3\x6b\x85\xd5\xcf\x6e\x3f\x79\x96\x6b\x8b\x3c\xcf\x2d\x2d"
const Hash = "\x88\xda\x13\x8f\xbf\x88\xbf\xc3\x50\x5d\xba\x9e\x1f\xd5\xcb\x8f\xa1\x23\x81\x7a"
// Symbol represents `symbol` method of Tutus native contract.
func Symbol() string {

View File

@ -13,7 +13,7 @@ import (
)
// Hash stores the hash of the native GAS contract.
var Hash = nativehashes.LubToken
var Hash = nativehashes.Lub
// NewReader creates a NEP-17 reader for the GAS contract.
func NewReader(invoker nep17.Invoker) *nep17.TokenReader {

View File

@ -97,7 +97,7 @@ type ValidatorIterator struct {
}
// Hash stores the hash of the native NEOToken contract.
var Hash = nativehashes.TutusToken
var Hash = nativehashes.Tutus
// NewReader creates an instance of ContractReader to get data from the NEO
// contract.