From 76f1af4e61d8d3a53ace5b62445035a39f18c675 Mon Sep 17 00:00:00 2001 From: Tutus Development Date: Mon, 22 Dec 2025 11:03:17 -0500 Subject: [PATCH] Fix more server_test.go values for block shifts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Additional fixes after .one TLD addition at block 14: - Update nnsToken1ID reference in getnep11properties test - Fix expiration timestamp: lhbLRl0B -> lxbLRl0B - Update getstateroot test from block 20 to 21 - Update findstates GetStateRoot calls: 16 -> 17, 20 -> 21 - Update block comment: "at block #16" -> "at block #17" Test progress: 92 failures -> 32 failures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- pkg/services/rpcsrv/server_test.go | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index 7102f76..0b12a5d 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -406,11 +406,11 @@ var rpcTestCases = map[string][]rpcTestCase{ }, { name: "positive", - params: `["` + nnsContractHash + `", "6e656f2e636f6d"]`, + params: `["` + nnsContractHash + `", "` + nnsToken1ID + `"]`, result: func(e *executor) any { return &map[string]any{ "name": "tutus.one", - "expiration": "lhbLRl0B", + "expiration": "lxbLRl0B", "admin": nil, } }, @@ -2791,8 +2791,8 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] } t.Run("ByHeight", func(t *testing.T) { testRoot(t, strconv.FormatInt(5, 10)) }) t.Run("ByHash", func(t *testing.T) { testRoot(t, `"`+chain.GetHeaderHash(5).StringLE()+`"`) }) - t.Run("20", func(t *testing.T) { - rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getstateroot", "params": [20]}` + t.Run("21", func(t *testing.T) { + rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getstateroot", "params": [21]}` body := doRPCCall(rpc, httpSrv.URL, t) rawRes := checkErrGetResult(t, body, false, 0) @@ -2827,9 +2827,9 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] checkErrGetResult(t, body, true, tutusrpc.InvalidParamsCode) }) t.Run("good: fresh state", func(t *testing.T) { - root, err := e.chain.GetStateModule().GetStateRoot(16) + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) - // `testkey`-`newtestvalue` pair was put to the contract storage at block #16 + // `testkey`-`newtestvalue` pair was put to the contract storage at block #17 params := fmt.Sprintf(`"%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("testkey"))) testGetState(t, params, base64.StdEncoding.EncodeToString([]byte("newtestvalue"))) }) @@ -2862,8 +2862,8 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] require.Equal(t, expected.Truncated, actual.Truncated) } t.Run("good: no prefix, no limit", func(t *testing.T) { - // pairs for this test where put to the contract storage at block #16 - root, err := e.chain.GetStateModule().GetStateRoot(16) + // pairs for this test where put to the contract storage at block #17 + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) params := fmt.Sprintf(`"%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))) testFindStates(t, params, root.Root, result.FindStates{ @@ -2877,7 +2877,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] }) t.Run("good: empty prefix, no limit", func(t *testing.T) { // empty prefix should be considered as no prefix specified. - root, err := e.chain.GetStateModule().GetStateRoot(16) + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) params := fmt.Sprintf(`"%s", "%s", "%s", ""`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))) testFindStates(t, params, root.Root, result.FindStates{ @@ -2891,7 +2891,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] }) t.Run("good: empty prefix, no limit, no data", func(t *testing.T) { // empty prefix should be considered as no prefix specified. - root, err := e.chain.GetStateModule().GetStateRoot(20) + root, err := e.chain.GetStateModule().GetStateRoot(21) require.NoError(t, err) stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib) // It has no data. params := fmt.Sprintf(`"%s", "%s", ""`, root.Root.StringLE(), stdHash.StringLE()) @@ -2901,8 +2901,8 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] }) }) t.Run("good: with prefix, no limit", func(t *testing.T) { - // pairs for this test where put to the contract storage at block #16 - root, err := e.chain.GetStateModule().GetStateRoot(16) + // pairs for this test where put to the contract storage at block #17 + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) params := fmt.Sprintf(`"%s", "%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")), base64.StdEncoding.EncodeToString([]byte("aa10"))) testFindStates(t, params, root.Root, result.FindStates{ @@ -2914,8 +2914,8 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] }) t.Run("good: empty prefix, with limit", func(t *testing.T) { for limit := 2; limit < 5; limit++ { - // pairs for this test where put to the contract storage at block #16 - root, err := e.chain.GetStateModule().GetStateRoot(16) + // pairs for this test where put to the contract storage at block #17 + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) params := fmt.Sprintf(`"%s", "%s", "%s", "", %d`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")), limit) expected := result.FindStates{ @@ -2932,8 +2932,8 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] } }) t.Run("good: with prefix, with limit", func(t *testing.T) { - // pairs for this test where put to the contract storage at block #16 - root, err := e.chain.GetStateModule().GetStateRoot(16) + // pairs for this test where put to the contract storage at block #17 + root, err := e.chain.GetStateModule().GetStateRoot(17) require.NoError(t, err) params := fmt.Sprintf(`"%s", "%s", "%s", "%s", %d`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")), base64.StdEncoding.EncodeToString([]byte("aa00")), 1) testFindStates(t, params, root.Root, result.FindStates{