Fix remaining Neo/Gas references to Tutus/Lub in test files
Update test files that still referenced nativenames.Neo, nativenames.Gas, nativehashes.NeoToken, and nativehashes.GasToken: - cli/nep_test/nep11_test.go - cli/nep_test/nep17_test.go - cli/query/query_test.go - internal/contracts/contracts_test.go - pkg/core/bench_test.go - pkg/core/blockchain_neotest_test.go - pkg/core/custom_native_test.go - pkg/core/interop/runtime/ext_test.go - pkg/core/native/invocation_test.go - pkg/services/notary/core_test.go - pkg/services/rpcsrv/server_test.go - pkg/services/stateroot/service_test.go Note: Some tests (TestNEO_*, TestManagement_GenesisNativeState) still fail due to hardcoded contract hashes from the original NEO codebase. These tests would require updating the expected hashes or the test contracts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a2bf6a95df
commit
cdce375348
|
|
@ -46,7 +46,7 @@ func TestNEP11Import(t *testing.T) {
|
||||||
nnsContractHash := deployNNSContract(t, e)
|
nnsContractHash := deployNNSContract(t, e)
|
||||||
// deploy NFT-D NeoFS Object contract
|
// deploy NFT-D NeoFS Object contract
|
||||||
nfsContractHash := deployNFSContract(t, e)
|
nfsContractHash := deployNFSContract(t, e)
|
||||||
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo)
|
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
|
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ func TestNEP17MultiTransfer(t *testing.T) {
|
||||||
privs, _ := testcli.GenerateKeys(t, 3)
|
privs, _ := testcli.GenerateKeys(t, 3)
|
||||||
|
|
||||||
e := testcli.NewExecutor(t, true)
|
e := testcli.NewExecutor(t, true)
|
||||||
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo)
|
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
args := []string{
|
args := []string{
|
||||||
"neo-go", "wallet", "nep17", "multitransfer",
|
"neo-go", "wallet", "nep17", "multitransfer",
|
||||||
|
|
@ -356,9 +356,9 @@ func TestNEP17ImportToken(t *testing.T) {
|
||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
walletPath := filepath.Join(tmpDir, "walletForImport.json")
|
walletPath := filepath.Join(tmpDir, "walletForImport.json")
|
||||||
|
|
||||||
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo)
|
neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
gasContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Gas)
|
gasContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Lub)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
nnsContractHash := deployNNSContract(t, e)
|
nnsContractHash := deployNNSContract(t, e)
|
||||||
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
|
e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath)
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ func TestQueryNotaryPool(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, acc)
|
}, acc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tx, err := ntr.MakeCall(nativehashes.GasToken, "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)
|
mainH, _, vub, err := ntr.Notarize(tx, err)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ func generateManagementHelperContracts(t *testing.T, saveState bool) {
|
||||||
|
|
||||||
mgmtHash := e.NativeHash(t, nativenames.Management)
|
mgmtHash := e.NativeHash(t, nativenames.Management)
|
||||||
stdHash := e.NativeHash(t, nativenames.StdLib)
|
stdHash := e.NativeHash(t, nativenames.StdLib)
|
||||||
neoHash := e.NativeHash(t, nativenames.Neo)
|
neoHash := e.NativeHash(t, nativenames.Tutus)
|
||||||
singleChainValidatorAcc := e.Validator.(neotest.MultiSigner).Single(2).Account() // priv0
|
singleChainValidatorAcc := e.Validator.(neotest.MultiSigner).Single(2).Account() // priv0
|
||||||
require.NoError(t, singleChainValidatorAcc.ConvertMultisig(1, keys.PublicKeys{singleChainValidatorAcc.PublicKey()}))
|
require.NoError(t, singleChainValidatorAcc.ConvertMultisig(1, keys.PublicKeys{singleChainValidatorAcc.PublicKey()}))
|
||||||
singleChainValidatorHash := singleChainValidatorAcc.Contract.ScriptHash()
|
singleChainValidatorHash := singleChainValidatorAcc.Contract.ScriptHash()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
func BenchmarkBlockchain_VerifyWitness(t *testing.B) {
|
func BenchmarkBlockchain_VerifyWitness(t *testing.B) {
|
||||||
bc, acc := chain.NewSingle(t)
|
bc, acc := chain.NewSingle(t)
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
tx := e.NewTx(t, []neotest.Signer{acc}, e.NativeHash(t, nativenames.Gas), "transfer", acc.ScriptHash(), acc.Script(), 1, nil)
|
tx := e.NewTx(t, []neotest.Signer{acc}, e.NativeHash(t, nativenames.Lub), "transfer", acc.ScriptHash(), acc.Script(), 1, nil)
|
||||||
|
|
||||||
for t.Loop() {
|
for t.Loop() {
|
||||||
_, err := bc.VerifyWitness(tx.Signers[0].Account, tx, &tx.Scripts[0], 100000000)
|
_, err := bc.VerifyWitness(tx.Signers[0].Account, tx, &tx.Scripts[0], 100000000)
|
||||||
|
|
@ -86,7 +86,7 @@ func benchmarkForEachNEP17Transfer(t *testing.B, ps storage.Store, startFromBloc
|
||||||
bc, validators, committee := chain.NewMultiWithCustomConfigAndStore(t, nil, ps, true)
|
bc, validators, committee := chain.NewMultiWithCustomConfigAndStore(t, nil, ps, true)
|
||||||
|
|
||||||
e := neotest.NewExecutor(t, bc, validators, committee)
|
e := neotest.NewExecutor(t, bc, validators, committee)
|
||||||
gasHash := e.NativeHash(t, nativenames.Gas)
|
gasHash := e.NativeHash(t, nativenames.Lub)
|
||||||
|
|
||||||
acc := random.Uint160()
|
acc := random.Uint160()
|
||||||
from := e.Validator.ScriptHash()
|
from := e.Validator.ScriptHash()
|
||||||
|
|
@ -152,8 +152,8 @@ func benchmarkGasPerVote(t *testing.B, ps storage.Store, nRewardRecords int, rew
|
||||||
cfg := bc.GetConfig()
|
cfg := bc.GetConfig()
|
||||||
|
|
||||||
e := neotest.NewExecutor(t, bc, validators, committee)
|
e := neotest.NewExecutor(t, bc, validators, committee)
|
||||||
neoHash := e.NativeHash(t, nativenames.Neo)
|
neoHash := e.NativeHash(t, nativenames.Tutus)
|
||||||
gasHash := e.NativeHash(t, nativenames.Gas)
|
gasHash := e.NativeHash(t, nativenames.Lub)
|
||||||
neoSuperInvoker := e.NewInvoker(neoHash, validators, committee)
|
neoSuperInvoker := e.NewInvoker(neoHash, validators, committee)
|
||||||
neoValidatorsInvoker := e.ValidatorInvoker(neoHash)
|
neoValidatorsInvoker := e.ValidatorInvoker(neoHash)
|
||||||
gasValidatorsInvoker := e.ValidatorInvoker(gasHash)
|
gasValidatorsInvoker := e.ValidatorInvoker(gasHash)
|
||||||
|
|
|
||||||
|
|
@ -470,7 +470,7 @@ func TestBlockchain_InitializeNeoCache_Bug3181(t *testing.T) {
|
||||||
|
|
||||||
// Add at least one registered candidate to enable candidates Policy check.
|
// Add at least one registered candidate to enable candidates Policy check.
|
||||||
acc := e.NewAccount(t, 10000_0000_0000) // block #1
|
acc := e.NewAccount(t, 10000_0000_0000) // block #1
|
||||||
neo := e.NewInvoker(e.NativeHash(t, nativenames.Neo), acc)
|
neo := e.NewInvoker(e.NativeHash(t, nativenames.Tutus), acc)
|
||||||
neo.Invoke(t, true, "registerCandidate", acc.(neotest.SingleSigner).Account().PublicKey().Bytes()) // block #2
|
neo.Invoke(t, true, "registerCandidate", acc.(neotest.SingleSigner).Account().PublicKey().Bytes()) // block #2
|
||||||
|
|
||||||
// Put some empty blocks to reach N-1 block height, so that newEpoch cached
|
// Put some empty blocks to reach N-1 block height, so that newEpoch cached
|
||||||
|
|
@ -516,8 +516,8 @@ func TestBlockchain_InitializeNeoCache_Bug3424(t *testing.T) {
|
||||||
require.Equal(t, standBySorted, keys.PublicKeys(pubs))
|
require.Equal(t, standBySorted, keys.PublicKeys(pubs))
|
||||||
|
|
||||||
// Move from stand by committee to the elected nodes.
|
// Move from stand by committee to the elected nodes.
|
||||||
e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, 100_0000_0000, nil)
|
e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, 100_0000_0000, nil)
|
||||||
neoCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Neo))
|
neoCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Tutus))
|
||||||
neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator)
|
neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator)
|
||||||
policyInvoker := neoCommitteeInvoker.CommitteeInvoker(neoCommitteeInvoker.NativeHash(t, nativenames.Policy))
|
policyInvoker := neoCommitteeInvoker.CommitteeInvoker(neoCommitteeInvoker.NativeHash(t, nativenames.Policy))
|
||||||
|
|
||||||
|
|
@ -590,8 +590,8 @@ func TestBlockchain_InitializeNativeCacheWrtNativeActivations(t *testing.T) {
|
||||||
c.P2PSigExtensions = true
|
c.P2PSigExtensions = true
|
||||||
c.NativeUpdateHistories = make(map[string][]uint32)
|
c.NativeUpdateHistories = make(map[string][]uint32)
|
||||||
for _, n := range []string{
|
for _, n := range []string{
|
||||||
nativenames.Neo,
|
nativenames.Tutus,
|
||||||
nativenames.Gas,
|
nativenames.Lub,
|
||||||
nativenames.Designation,
|
nativenames.Designation,
|
||||||
nativenames.Management,
|
nativenames.Management,
|
||||||
nativenames.CryptoLib,
|
nativenames.CryptoLib,
|
||||||
|
|
@ -767,7 +767,7 @@ func TestBlockchain_AddBadBlock(t *testing.T) {
|
||||||
}
|
}
|
||||||
bc, acc := chain.NewSingle(t)
|
bc, acc := chain.NewSingle(t)
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
neoHash := e.NativeHash(t, nativenames.Neo)
|
neoHash := e.NativeHash(t, nativenames.Tutus)
|
||||||
|
|
||||||
tx := e.NewUnsignedTx(t, neoHash, "transfer", acc.ScriptHash(), util.Uint160{1, 2, 3}, 1, nil)
|
tx := e.NewUnsignedTx(t, neoHash, "transfer", acc.ScriptHash(), util.Uint160{1, 2, 3}, 1, nil)
|
||||||
tx.ValidUntilBlock = 0 // Intentionally make the transaction invalid.
|
tx.ValidUntilBlock = 0 // Intentionally make the transaction invalid.
|
||||||
|
|
@ -830,7 +830,7 @@ func TestBlockchain_GetBlock(t *testing.T) {
|
||||||
bc, acc := chain.NewSingle(t)
|
bc, acc := chain.NewSingle(t)
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
blocks := e.GenerateNewBlocks(t, 10)
|
blocks := e.GenerateNewBlocks(t, 10)
|
||||||
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Neo))
|
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Tutus))
|
||||||
|
|
||||||
for i := range blocks {
|
for i := range blocks {
|
||||||
block, err := bc.GetBlock(blocks[i].Hash())
|
block, err := bc.GetBlock(blocks[i].Hash())
|
||||||
|
|
@ -1131,7 +1131,7 @@ func TestBlockchain_Subscriptions(t *testing.T) {
|
||||||
|
|
||||||
bc, acc := chain.NewSingle(t)
|
bc, acc := chain.NewSingle(t)
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
nativeGASHash := e.NativeHash(t, nativenames.Gas)
|
nativeGASHash := e.NativeHash(t, nativenames.Lub)
|
||||||
bc.SubscribeForBlocks(blockCh)
|
bc.SubscribeForBlocks(blockCh)
|
||||||
bc.SubscribeForTransactions(txCh)
|
bc.SubscribeForTransactions(txCh)
|
||||||
bc.SubscribeForNotifications(notificationCh)
|
bc.SubscribeForNotifications(notificationCh)
|
||||||
|
|
@ -1282,7 +1282,7 @@ func TestBlockchain_RemoveUntraceable(t *testing.T) {
|
||||||
c.RemoveUntraceableBlocks = true
|
c.RemoveUntraceableBlocks = true
|
||||||
})
|
})
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Neo))
|
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Tutus))
|
||||||
|
|
||||||
// Fill in the first batch of header hashes up to 2000 so that they are persisted to disk
|
// Fill in the first batch of header hashes up to 2000 so that they are persisted to disk
|
||||||
// to enable untraceable blocks removal.
|
// to enable untraceable blocks removal.
|
||||||
|
|
@ -1339,7 +1339,7 @@ func TestBlockchain_RemoveUntraceable(t *testing.T) {
|
||||||
c.StateRootInHeader = true
|
c.StateRootInHeader = true
|
||||||
})
|
})
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Neo))
|
neoValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Tutus))
|
||||||
|
|
||||||
// Fill in the first batch of header hashes up to 2000 so that they are persisted to disk
|
// Fill in the first batch of header hashes up to 2000 so that they are persisted to disk
|
||||||
// to enable untraceable blocks removal.
|
// to enable untraceable blocks removal.
|
||||||
|
|
@ -1484,8 +1484,8 @@ func TestBlockchain_VerifyTx(t *testing.T) {
|
||||||
oraclePubs := keys.PublicKeys{oracleAcc.PublicKey()}
|
oraclePubs := keys.PublicKeys{oracleAcc.PublicKey()}
|
||||||
require.NoError(t, oracleAcc.ConvertMultisig(1, oraclePubs))
|
require.NoError(t, oracleAcc.ConvertMultisig(1, oraclePubs))
|
||||||
|
|
||||||
neoHash := e.NativeHash(t, nativenames.Neo)
|
neoHash := e.NativeHash(t, nativenames.Tutus)
|
||||||
gasHash := e.NativeHash(t, nativenames.Gas)
|
gasHash := e.NativeHash(t, nativenames.Lub)
|
||||||
policyHash := e.NativeHash(t, nativenames.Policy)
|
policyHash := e.NativeHash(t, nativenames.Policy)
|
||||||
designateHash := e.NativeHash(t, nativenames.Designation)
|
designateHash := e.NativeHash(t, nativenames.Designation)
|
||||||
notaryHash := e.NativeHash(t, nativenames.Notary)
|
notaryHash := e.NativeHash(t, nativenames.Notary)
|
||||||
|
|
@ -2630,10 +2630,10 @@ func TestBlockchain_ResetState(t *testing.T) {
|
||||||
rublesH := e.ContractHash(t, basicchain.RublesContractID)
|
rublesH := e.ContractHash(t, basicchain.RublesContractID)
|
||||||
nnsH := e.ContractHash(t, basicchain.NNSContractID)
|
nnsH := e.ContractHash(t, basicchain.NNSContractID)
|
||||||
staleH := e.ContractHash(t, staleID)
|
staleH := e.ContractHash(t, staleID)
|
||||||
gasH := e.NativeHash(t, nativenames.Gas)
|
gasH := e.NativeHash(t, nativenames.Lub)
|
||||||
neoH := e.NativeHash(t, nativenames.Neo)
|
neoH := e.NativeHash(t, nativenames.Tutus)
|
||||||
gasID := e.NativeID(t, nativenames.Gas)
|
gasID := e.NativeID(t, nativenames.Lub)
|
||||||
neoID := e.NativeID(t, nativenames.Neo)
|
neoID := e.NativeID(t, nativenames.Tutus)
|
||||||
resetBlockHash := bc.GetHeaderHash(resetBlockIndex)
|
resetBlockHash := bc.GetHeaderHash(resetBlockIndex)
|
||||||
resetBlockHeader, err := bc.GetHeader(resetBlockHash)
|
resetBlockHeader, err := bc.GetHeader(resetBlockHash)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -2798,7 +2798,7 @@ func TestBlockchain_GenesisTransactionExtension(t *testing.T) {
|
||||||
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
||||||
emit.Bytes(script.BinWriter, to.BytesBE())
|
emit.Bytes(script.BinWriter, to.BytesBE())
|
||||||
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
||||||
emit.AppCall(script.BinWriter, nativehashes.NeoToken, "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)
|
emit.Opcodes(script.BinWriter, opcode.ASSERT)
|
||||||
|
|
||||||
var sysFee int64 = 1_0000_0000
|
var sysFee int64 = 1_0000_0000
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func newGAS() *gas {
|
||||||
defer g.BuildHFSpecificMD(nil) // obligatory call to properly initialize MD cache.
|
defer g.BuildHFSpecificMD(nil) // obligatory call to properly initialize MD cache.
|
||||||
|
|
||||||
g.ContractMD = *interop.NewContractMD( // obligatory call for proper allocate MD cache.
|
g.ContractMD = *interop.NewContractMD( // obligatory call for proper allocate MD cache.
|
||||||
nativenames.Gas, // obligatory name for proper Blockchain functioning.
|
nativenames.Lub, // obligatory name for proper Blockchain functioning.
|
||||||
nativeids.GasToken, // obligatory ID even if some default native contracts are missing.
|
nativeids.GasToken, // obligatory ID even if some default native contracts are missing.
|
||||||
func(m *manifest.Manifest, hf config.Hardfork) {
|
func(m *manifest.Manifest, hf config.Hardfork) {
|
||||||
m.SupportedStandards = []string{manifest.NEP17StandardName} // not really for this stub, but let's pretend to show how to setup standards.
|
m.SupportedStandards = []string{manifest.NEP17StandardName} // not really for this stub, but let's pretend to show how to setup standards.
|
||||||
|
|
@ -114,7 +114,7 @@ func newNEO(validator *keys.PublicKey) *neo {
|
||||||
}
|
}
|
||||||
defer n.BuildHFSpecificMD(nil)
|
defer n.BuildHFSpecificMD(nil)
|
||||||
|
|
||||||
n.ContractMD = *interop.NewContractMD(nativenames.Neo, nativeids.NeoToken)
|
n.ContractMD = *interop.NewContractMD(nativenames.Tutus, nativeids.NeoToken)
|
||||||
|
|
||||||
desc := native.NewDescriptor("getBool", smartcontract.BoolType)
|
desc := native.NewDescriptor("getBool", smartcontract.BoolType)
|
||||||
md := native.NewMethodAndPrice(n.getBool, 1<<10, callflag.ReadStates)
|
md := native.NewMethodAndPrice(n.getBool, 1<<10, callflag.ReadStates)
|
||||||
|
|
|
||||||
|
|
@ -437,19 +437,19 @@ func TestLoadScript(t *testing.T) {
|
||||||
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "ABORT")
|
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "ABORT")
|
||||||
})
|
})
|
||||||
t.Run("internal call", func(t *testing.T) {
|
t.Run("internal call", func(t *testing.T) {
|
||||||
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Gas), "decimals")
|
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Lub), "decimals")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
script = wrapDynamicScript(t, script, callflag.ReadOnly)
|
script = wrapDynamicScript(t, script, callflag.ReadOnly)
|
||||||
e.InvokeScriptCheckHALT(t, script, []neotest.Signer{acc}, stackitem.Make(8))
|
e.InvokeScriptCheckHALT(t, script, []neotest.Signer{acc}, stackitem.Make(8))
|
||||||
})
|
})
|
||||||
t.Run("forbidden internal call", func(t *testing.T) {
|
t.Run("forbidden internal call", func(t *testing.T) {
|
||||||
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Neo), "decimals")
|
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Tutus), "decimals")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
script = wrapDynamicScript(t, script, callflag.ReadStates)
|
script = wrapDynamicScript(t, script, callflag.ReadStates)
|
||||||
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags")
|
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags")
|
||||||
})
|
})
|
||||||
t.Run("internal state-changing call", func(t *testing.T) {
|
t.Run("internal state-changing call", func(t *testing.T) {
|
||||||
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Neo), "transfer", acc.ScriptHash(), acc.ScriptHash(), 1, nil)
|
script, err := smartcontract.CreateCallScript(e.NativeHash(t, nativenames.Tutus), "transfer", acc.ScriptHash(), acc.ScriptHash(), 1, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
script = wrapDynamicScript(t, script, callflag.All)
|
script = wrapDynamicScript(t, script, callflag.All)
|
||||||
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags")
|
e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags")
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func TestNativeContract_InvokeInternal(t *testing.T) {
|
||||||
bcBad, validatorBad, committeeBad := chain.NewMultiWithCustomConfig(t, func(c *config.Blockchain) {
|
bcBad, validatorBad, committeeBad := chain.NewMultiWithCustomConfig(t, func(c *config.Blockchain) {
|
||||||
c.NativeUpdateHistories = map[string][]uint32{
|
c.NativeUpdateHistories = map[string][]uint32{
|
||||||
nativenames.Policy: {0},
|
nativenames.Policy: {0},
|
||||||
nativenames.Neo: {0},
|
nativenames.Tutus: {0},
|
||||||
nativenames.Lub: {0},
|
nativenames.Lub: {0},
|
||||||
nativenames.Designation: {0},
|
nativenames.Designation: {0},
|
||||||
nativenames.StdLib: {0},
|
nativenames.StdLib: {0},
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func TestNotary(t *testing.T) {
|
||||||
e := neotest.NewExecutor(t, bc, validators, committee)
|
e := neotest.NewExecutor(t, bc, validators, committee)
|
||||||
notaryHash := e.NativeHash(t, nativenames.Notary)
|
notaryHash := e.NativeHash(t, nativenames.Notary)
|
||||||
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validators, committee)
|
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validators, committee)
|
||||||
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
|
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
|
||||||
|
|
||||||
var (
|
var (
|
||||||
nonce uint32
|
nonce uint32
|
||||||
|
|
|
||||||
|
|
@ -2311,14 +2311,14 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive with filter",
|
name: "positive with filter",
|
||||||
params: `["` + genesisBlockHash + `", {"contract":"` + nativehashes.NeoToken.StringLE() + `", "name":"Transfer"}]`,
|
params: `["` + genesisBlockHash + `", {"contract":"` + nativehashes.Tutus.StringLE() + `", "name":"Transfer"}]`,
|
||||||
result: func(e *executor) any { return &result.BlockNotifications{} },
|
result: func(e *executor) any { return &result.BlockNotifications{} },
|
||||||
check: func(t *testing.T, e *executor, acc any) {
|
check: func(t *testing.T, e *executor, acc any) {
|
||||||
res, ok := acc.(*result.BlockNotifications)
|
res, ok := acc.(*result.BlockNotifications)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
require.NotNil(t, res)
|
require.NotNil(t, res)
|
||||||
for _, ne := range res.Application {
|
for _, ne := range res.Application {
|
||||||
require.Equal(t, nativehashes.NeoToken, ne.ScriptHash)
|
require.Equal(t, nativehashes.Tutus, ne.ScriptHash)
|
||||||
require.Equal(t, "Transfer", ne.Name)
|
require.Equal(t, "Transfer", ne.Name)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ func TestStateRoot(t *testing.T) {
|
||||||
bc, validator, committee := chain.NewMulti(t)
|
bc, validator, committee := chain.NewMulti(t)
|
||||||
e := neotest.NewExecutor(t, bc, validator, committee)
|
e := neotest.NewExecutor(t, bc, validator, committee)
|
||||||
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
||||||
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
|
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
|
||||||
|
|
||||||
h, pubs, accs := newMajorityMultisigWithGAS(t, 2)
|
h, pubs, accs := newMajorityMultisigWithGAS(t, 2)
|
||||||
validatorNodes := []any{pubs[0].Bytes(), pubs[1].Bytes()}
|
validatorNodes := []any{pubs[0].Bytes(), pubs[1].Bytes()}
|
||||||
|
|
@ -182,7 +182,7 @@ func TestStateRootInitNonZeroHeight(t *testing.T) {
|
||||||
bc, validator, committee := chain.NewMultiWithCustomConfigAndStore(t, nil, st, true)
|
bc, validator, committee := chain.NewMultiWithCustomConfigAndStore(t, nil, st, true)
|
||||||
e := neotest.NewExecutor(t, bc, validator, committee)
|
e := neotest.NewExecutor(t, bc, validator, committee)
|
||||||
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
||||||
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
|
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
|
||||||
|
|
||||||
validatorNodes := []any{pubs[0].Bytes(), pubs[1].Bytes()}
|
validatorNodes := []any{pubs[0].Bytes(), pubs[1].Bytes()}
|
||||||
designationSuperInvoker.Invoke(t, stackitem.Null{}, "designateAsRole",
|
designationSuperInvoker.Invoke(t, stackitem.Null{}, "designateAsRole",
|
||||||
|
|
@ -233,7 +233,7 @@ func TestStateRootFull(t *testing.T) {
|
||||||
bc, validator, committee := chain.NewMulti(t)
|
bc, validator, committee := chain.NewMulti(t)
|
||||||
e := neotest.NewExecutor(t, bc, validator, committee)
|
e := neotest.NewExecutor(t, bc, validator, committee)
|
||||||
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
designationSuperInvoker := e.NewInvoker(e.NativeHash(t, nativenames.Designation), validator, committee)
|
||||||
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
|
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
|
||||||
|
|
||||||
getDesignatedByRole := func(t *testing.T, h uint32) keys.PublicKeys {
|
getDesignatedByRole := func(t *testing.T, h uint32) keys.PublicKeys {
|
||||||
res, err := designationSuperInvoker.TestInvoke(t, "getDesignatedByRole", int64(noderoles.StateValidator), h)
|
res, err := designationSuperInvoker.TestInvoke(t, "getDesignatedByRole", int64(noderoles.StateValidator), h)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue