diff --git a/config/config_embed.go b/config/config_embed.go index c1f66676f0..5e1a04874e 100644 --- a/config/config_embed.go +++ b/config/config_embed.go @@ -30,3 +30,8 @@ var MainNetNeoFS []byte // //go:embed protocol.testnet.neofs.yml var TestNetNeoFS []byte + +// UnitTestNet is the unit test network configuration. +// +//go:embed protocol.unit_testnet.yml +var UnitTestNet []byte diff --git a/pkg/config/config.go b/pkg/config/config.go index 0278614333..ac8bc5d7be 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -137,6 +137,8 @@ func getEmbeddedConfig(configPath string) ([]byte, error) { return config.MainNetNeoFS, nil case fmt.Sprintf("%s/protocol.%s.yml", DefaultConfigPath, netmode.TestNetNeoFS): return config.TestNetNeoFS, nil + case fmt.Sprintf("%s/protocol.%s.yml", DefaultConfigPath, netmode.UnitTestNet): + return config.UnitTestNet, nil default: return nil, fmt.Errorf("config '%s' doesn't exist and no matching embedded config was found", configPath) } diff --git a/pkg/core/blockchain_neotest_test.go b/pkg/core/blockchain_neotest_test.go index 79490f8386..981ef7d26e 100644 --- a/pkg/core/blockchain_neotest_test.go +++ b/pkg/core/blockchain_neotest_test.go @@ -272,7 +272,7 @@ func TestBlockchain_StartFromExistingDB(t *testing.T) { _, _, _, err = chain.NewMultiWithCustomConfigAndStoreNoCheck(t, customConfig, cache) require.Error(t, err) - require.True(t, strings.Contains(err.Error(), fmt.Sprintf("native %s: version mismatch for the latest hardfork Echidna (stored contract state differs from autogenerated one)", nativenames.CryptoLib)), err) + require.True(t, strings.Contains(err.Error(), fmt.Sprintf("native %s: version mismatch for the latest hardfork Default (stored contract state differs from autogenerated one)", nativenames.CryptoLib)), err) }) t.Run("good", func(t *testing.T) { diff --git a/pkg/neotest/chain/chain.go b/pkg/neotest/chain/chain.go index ad5b0ecfb4..4f5f48494e 100644 --- a/pkg/neotest/chain/chain.go +++ b/pkg/neotest/chain/chain.go @@ -258,18 +258,13 @@ func NewMultiWithOptionsNoCheck(t testing.TB, options *Options) (*core.Blockchai options = &Options{} } - cfg := config.Blockchain{ - ProtocolConfiguration: config.ProtocolConfiguration{ - Magic: netmode.UnitTestNet, - MaxTraceableBlocks: MaxTraceableBlocks, - TimePerBlock: TimePerBlock, - StandbyCommittee: standByCommittee, - ValidatorsCount: 4, - VerifyTransactions: true, - }, + cfg, err := config.Load(config.DefaultConfigPath, netmode.UnitTestNet) + if err != nil { + return nil, nil, nil, err } + bcfg := cfg.Blockchain() if options.BlockchainConfigHook != nil { - options.BlockchainConfigHook(&cfg) + options.BlockchainConfigHook(&bcfg) } store := options.Store @@ -282,7 +277,7 @@ func NewMultiWithOptionsNoCheck(t testing.TB, options *Options) (*core.Blockchai logger = zaptest.NewLogger(t) } - bc, err := core.NewBlockchain(store, cfg, logger) + bc, err := core.NewBlockchain(store, bcfg, logger) if err == nil && !options.SkipRun { go bc.Run() t.Cleanup(bc.Close) diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index 5041b44bca..3a7e4393c9 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -121,7 +121,7 @@ const ( // not yet deployed to the testing basic chain. invokescriptContractAVM = "VwIADBQBDAMOBQYMDQIODw0DDgcJAAAAAErZMCQE2zBwaEH4J+yMqiYEEUAMFA0PAwIJAAIBAwcDBAUCAQAOBgwJStkwJATbMHFpQfgn7IyqJgQSQBNA" // block20StateRootLE is an LE stateroot of block #20 of basic testing chain. - block20StateRootLE = "394e20adf99a6ba160df7351770dfb193ee8af174b7b3ed45f4e2ae8c43694e8" + block20StateRootLE = "c6d742ddd1db4e966a03d02d7d3d08364cff2406c150e1cdf561c64774ed7612" ) var ( @@ -1354,22 +1354,22 @@ var rpcTestCases = map[string][]rpcTestCase{ return &[]result.Validator{} }, /* preview3 doesn't return any validators until there is a vote - check: func(t *testing.T, e *executor, validators any) { - var expected []result.Validator - sBValidators := e.chain.GetStandByValidators() - for _, sbValidator := range sBValidators { - expected = append(expected, result.Validator{ - PublicKey: *sbValidator, - Votes: 0, - Active: true, - }) - } - - actual, ok := validators.(*[]result.Validator) - require.True(t, ok) - - assert.ElementsMatch(t, expected, *actual) - }, + check: func(t *testing.T, e *executor, validators any) { + var expected []result.Validator + sBValidators := e.chain.GetStandByValidators() + for _, sbValidator := range sBValidators { + expected = append(expected, result.Validator{ + PublicKey: *sbValidator, + Votes: 0, + Active: true, + }) + } + + actual, ok := validators.(*[]result.Validator) + require.True(t, ok) + + assert.ElementsMatch(t, expected, *actual) + }, */ }, }, @@ -1456,7 +1456,7 @@ var rpcTestCases = map[string][]rpcTestCase{ chg := []dboper.Operation{{ State: "Changed", Key: []byte{0xfa, 0xff, 0xff, 0xff, 0xb}, - Value: []byte{0xba, 0xaa, 0x3d, 0x19, 0x5e, 0x79, 0x12}, + Value: []byte{0xba, 0x8c, 0x97, 0x19, 0x5e, 0x79, 0x12}, }, { State: "Added", Key: []byte{0xfb, 0xff, 0xff, 0xff, 0x14, 0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0xb}, diff --git a/pkg/services/rpcsrv/testdata/testblocks.acc b/pkg/services/rpcsrv/testdata/testblocks.acc index accf2c4abf..0ad1543274 100644 Binary files a/pkg/services/rpcsrv/testdata/testblocks.acc and b/pkg/services/rpcsrv/testdata/testblocks.acc differ