From cdce3753489cc41565032e2d5ec55a196f3813b1 Mon Sep 17 00:00:00 2001 From: Tutus Development Date: Sun, 21 Dec 2025 02:43:45 +0000 Subject: [PATCH] Fix remaining Neo/Gas references to Tutus/Lub in test files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cli/nep_test/nep11_test.go | 2 +- cli/nep_test/nep17_test.go | 6 ++--- cli/query/query_test.go | 2 +- internal/contracts/contracts_test.go | 2 +- pkg/core/bench_test.go | 8 +++--- pkg/core/blockchain_neotest_test.go | 34 +++++++++++++------------- pkg/core/custom_native_test.go | 4 +-- pkg/core/interop/runtime/ext_test.go | 6 ++--- pkg/core/native/invocation_test.go | 2 +- pkg/services/notary/core_test.go | 2 +- pkg/services/rpcsrv/server_test.go | 4 +-- pkg/services/stateroot/service_test.go | 6 ++--- 12 files changed, 39 insertions(+), 39 deletions(-) diff --git a/cli/nep_test/nep11_test.go b/cli/nep_test/nep11_test.go index 6b0ed57..6eecfa7 100644 --- a/cli/nep_test/nep11_test.go +++ b/cli/nep_test/nep11_test.go @@ -46,7 +46,7 @@ func TestNEP11Import(t *testing.T) { nnsContractHash := deployNNSContract(t, e) // deploy NFT-D NeoFS Object contract nfsContractHash := deployNFSContract(t, e) - neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo) + neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus) require.NoError(t, err) e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath) diff --git a/cli/nep_test/nep17_test.go b/cli/nep_test/nep17_test.go index 92d8a78..78f1d29 100644 --- a/cli/nep_test/nep17_test.go +++ b/cli/nep_test/nep17_test.go @@ -305,7 +305,7 @@ func TestNEP17MultiTransfer(t *testing.T) { privs, _ := testcli.GenerateKeys(t, 3) e := testcli.NewExecutor(t, true) - neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo) + neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus) require.NoError(t, err) args := []string{ "neo-go", "wallet", "nep17", "multitransfer", @@ -356,9 +356,9 @@ func TestNEP17ImportToken(t *testing.T) { tmpDir := t.TempDir() walletPath := filepath.Join(tmpDir, "walletForImport.json") - neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Neo) + neoContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Tutus) require.NoError(t, err) - gasContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Gas) + gasContractHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Lub) require.NoError(t, err) nnsContractHash := deployNNSContract(t, e) e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath) diff --git a/cli/query/query_test.go b/cli/query/query_test.go index 9d58bff..486f3c1 100644 --- a/cli/query/query_test.go +++ b/cli/query/query_test.go @@ -238,7 +238,7 @@ func TestQueryNotaryPool(t *testing.T) { }, }, acc) 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) require.NoError(t, err) diff --git a/internal/contracts/contracts_test.go b/internal/contracts/contracts_test.go index f1a19f5..f3358a7 100644 --- a/internal/contracts/contracts_test.go +++ b/internal/contracts/contracts_test.go @@ -69,7 +69,7 @@ func generateManagementHelperContracts(t *testing.T, saveState bool) { mgmtHash := e.NativeHash(t, nativenames.Management) 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 require.NoError(t, singleChainValidatorAcc.ConvertMultisig(1, keys.PublicKeys{singleChainValidatorAcc.PublicKey()})) singleChainValidatorHash := singleChainValidatorAcc.Contract.ScriptHash() diff --git a/pkg/core/bench_test.go b/pkg/core/bench_test.go index fb6b0d9..9fcf7fa 100644 --- a/pkg/core/bench_test.go +++ b/pkg/core/bench_test.go @@ -24,7 +24,7 @@ import ( func BenchmarkBlockchain_VerifyWitness(t *testing.B) { bc, acc := chain.NewSingle(t) 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() { _, 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) e := neotest.NewExecutor(t, bc, validators, committee) - gasHash := e.NativeHash(t, nativenames.Gas) + gasHash := e.NativeHash(t, nativenames.Lub) acc := random.Uint160() from := e.Validator.ScriptHash() @@ -152,8 +152,8 @@ func benchmarkGasPerVote(t *testing.B, ps storage.Store, nRewardRecords int, rew cfg := bc.GetConfig() e := neotest.NewExecutor(t, bc, validators, committee) - neoHash := e.NativeHash(t, nativenames.Neo) - gasHash := e.NativeHash(t, nativenames.Gas) + neoHash := e.NativeHash(t, nativenames.Tutus) + gasHash := e.NativeHash(t, nativenames.Lub) neoSuperInvoker := e.NewInvoker(neoHash, validators, committee) neoValidatorsInvoker := e.ValidatorInvoker(neoHash) gasValidatorsInvoker := e.ValidatorInvoker(gasHash) diff --git a/pkg/core/blockchain_neotest_test.go b/pkg/core/blockchain_neotest_test.go index cc0189f..2435a2b 100644 --- a/pkg/core/blockchain_neotest_test.go +++ b/pkg/core/blockchain_neotest_test.go @@ -470,7 +470,7 @@ func TestBlockchain_InitializeNeoCache_Bug3181(t *testing.T) { // Add at least one registered candidate to enable candidates Policy check. 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 // 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)) // 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) - neoCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Neo)) + 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.Tutus)) neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator) policyInvoker := neoCommitteeInvoker.CommitteeInvoker(neoCommitteeInvoker.NativeHash(t, nativenames.Policy)) @@ -590,8 +590,8 @@ func TestBlockchain_InitializeNativeCacheWrtNativeActivations(t *testing.T) { c.P2PSigExtensions = true c.NativeUpdateHistories = make(map[string][]uint32) for _, n := range []string{ - nativenames.Neo, - nativenames.Gas, + nativenames.Tutus, + nativenames.Lub, nativenames.Designation, nativenames.Management, nativenames.CryptoLib, @@ -767,7 +767,7 @@ func TestBlockchain_AddBadBlock(t *testing.T) { } bc, acc := chain.NewSingle(t) 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.ValidUntilBlock = 0 // Intentionally make the transaction invalid. @@ -830,7 +830,7 @@ func TestBlockchain_GetBlock(t *testing.T) { bc, acc := chain.NewSingle(t) e := neotest.NewExecutor(t, bc, acc, acc) 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 { block, err := bc.GetBlock(blocks[i].Hash()) @@ -1131,7 +1131,7 @@ func TestBlockchain_Subscriptions(t *testing.T) { bc, acc := chain.NewSingle(t) e := neotest.NewExecutor(t, bc, acc, acc) - nativeGASHash := e.NativeHash(t, nativenames.Gas) + nativeGASHash := e.NativeHash(t, nativenames.Lub) bc.SubscribeForBlocks(blockCh) bc.SubscribeForTransactions(txCh) bc.SubscribeForNotifications(notificationCh) @@ -1282,7 +1282,7 @@ func TestBlockchain_RemoveUntraceable(t *testing.T) { c.RemoveUntraceableBlocks = true }) 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 // to enable untraceable blocks removal. @@ -1339,7 +1339,7 @@ func TestBlockchain_RemoveUntraceable(t *testing.T) { c.StateRootInHeader = true }) 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 // to enable untraceable blocks removal. @@ -1484,8 +1484,8 @@ func TestBlockchain_VerifyTx(t *testing.T) { oraclePubs := keys.PublicKeys{oracleAcc.PublicKey()} require.NoError(t, oracleAcc.ConvertMultisig(1, oraclePubs)) - neoHash := e.NativeHash(t, nativenames.Neo) - gasHash := e.NativeHash(t, nativenames.Gas) + neoHash := e.NativeHash(t, nativenames.Tutus) + gasHash := e.NativeHash(t, nativenames.Lub) policyHash := e.NativeHash(t, nativenames.Policy) designateHash := e.NativeHash(t, nativenames.Designation) notaryHash := e.NativeHash(t, nativenames.Notary) @@ -2630,10 +2630,10 @@ func TestBlockchain_ResetState(t *testing.T) { rublesH := e.ContractHash(t, basicchain.RublesContractID) nnsH := e.ContractHash(t, basicchain.NNSContractID) staleH := e.ContractHash(t, staleID) - gasH := e.NativeHash(t, nativenames.Gas) - neoH := e.NativeHash(t, nativenames.Neo) - gasID := e.NativeID(t, nativenames.Gas) - neoID := e.NativeID(t, nativenames.Neo) + gasH := e.NativeHash(t, nativenames.Lub) + neoH := e.NativeHash(t, nativenames.Tutus) + gasID := e.NativeID(t, nativenames.Lub) + neoID := e.NativeID(t, nativenames.Tutus) resetBlockHash := bc.GetHeaderHash(resetBlockIndex) resetBlockHeader, err := bc.GetHeader(resetBlockHash) require.NoError(t, err) @@ -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.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) var sysFee int64 = 1_0000_0000 diff --git a/pkg/core/custom_native_test.go b/pkg/core/custom_native_test.go index c1f772a..a378072 100644 --- a/pkg/core/custom_native_test.go +++ b/pkg/core/custom_native_test.go @@ -58,7 +58,7 @@ func newGAS() *gas { defer g.BuildHFSpecificMD(nil) // obligatory call to properly initialize 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. 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. @@ -114,7 +114,7 @@ func newNEO(validator *keys.PublicKey) *neo { } 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) md := native.NewMethodAndPrice(n.getBool, 1<<10, callflag.ReadStates) diff --git a/pkg/core/interop/runtime/ext_test.go b/pkg/core/interop/runtime/ext_test.go index 47fa20a..5337c04 100644 --- a/pkg/core/interop/runtime/ext_test.go +++ b/pkg/core/interop/runtime/ext_test.go @@ -437,19 +437,19 @@ func TestLoadScript(t *testing.T) { e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "ABORT") }) 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) script = wrapDynamicScript(t, script, callflag.ReadOnly) e.InvokeScriptCheckHALT(t, script, []neotest.Signer{acc}, stackitem.Make(8)) }) 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) script = wrapDynamicScript(t, script, callflag.ReadStates) e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags") }) 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) script = wrapDynamicScript(t, script, callflag.All) e.InvokeScriptCheckFAULT(t, script, []neotest.Signer{acc}, "missing call flags") diff --git a/pkg/core/native/invocation_test.go b/pkg/core/native/invocation_test.go index b47b558..8ed77f6 100644 --- a/pkg/core/native/invocation_test.go +++ b/pkg/core/native/invocation_test.go @@ -95,7 +95,7 @@ func TestNativeContract_InvokeInternal(t *testing.T) { bcBad, validatorBad, committeeBad := chain.NewMultiWithCustomConfig(t, func(c *config.Blockchain) { c.NativeUpdateHistories = map[string][]uint32{ nativenames.Policy: {0}, - nativenames.Neo: {0}, + nativenames.Tutus: {0}, nativenames.Lub: {0}, nativenames.Designation: {0}, nativenames.StdLib: {0}, diff --git a/pkg/services/notary/core_test.go b/pkg/services/notary/core_test.go index 15caa01..c4f4e51 100644 --- a/pkg/services/notary/core_test.go +++ b/pkg/services/notary/core_test.go @@ -75,7 +75,7 @@ func TestNotary(t *testing.T) { e := neotest.NewExecutor(t, bc, validators, committee) notaryHash := e.NativeHash(t, nativenames.Notary) 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 ( nonce uint32 diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index d49d405..b2e5f4c 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -2311,14 +2311,14 @@ var rpcTestCases = map[string][]rpcTestCase{ }, { 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{} }, check: func(t *testing.T, e *executor, acc any) { res, ok := acc.(*result.BlockNotifications) require.True(t, ok) require.NotNil(t, res) 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) } }, diff --git a/pkg/services/stateroot/service_test.go b/pkg/services/stateroot/service_test.go index cbacbb3..f11ae3c 100644 --- a/pkg/services/stateroot/service_test.go +++ b/pkg/services/stateroot/service_test.go @@ -81,7 +81,7 @@ func TestStateRoot(t *testing.T) { bc, validator, committee := chain.NewMulti(t) e := neotest.NewExecutor(t, bc, 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) 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) e := neotest.NewExecutor(t, bc, 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()} designationSuperInvoker.Invoke(t, stackitem.Null{}, "designateAsRole", @@ -233,7 +233,7 @@ func TestStateRootFull(t *testing.T) { bc, validator, committee := chain.NewMulti(t) e := neotest.NewExecutor(t, bc, 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 { res, err := designationSuperInvoker.TestInvoke(t, "getDesignatedByRole", int64(noderoles.StateValidator), h)