Fix more server_test.go values for block shifts
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 <noreply@anthropic.com>
This commit is contained in:
parent
1cfc42ba06
commit
76f1af4e61
|
|
@ -406,11 +406,11 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive",
|
name: "positive",
|
||||||
params: `["` + nnsContractHash + `", "6e656f2e636f6d"]`,
|
params: `["` + nnsContractHash + `", "` + nnsToken1ID + `"]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
return &map[string]any{
|
return &map[string]any{
|
||||||
"name": "tutus.one",
|
"name": "tutus.one",
|
||||||
"expiration": "lhbLRl0B",
|
"expiration": "lxbLRl0B",
|
||||||
"admin": nil,
|
"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("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("ByHash", func(t *testing.T) { testRoot(t, `"`+chain.GetHeaderHash(5).StringLE()+`"`) })
|
||||||
t.Run("20", func(t *testing.T) {
|
t.Run("21", func(t *testing.T) {
|
||||||
rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getstateroot", "params": [20]}`
|
rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getstateroot", "params": [21]}`
|
||||||
body := doRPCCall(rpc, httpSrv.URL, t)
|
body := doRPCCall(rpc, httpSrv.URL, t)
|
||||||
rawRes := checkErrGetResult(t, body, false, 0)
|
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)
|
checkErrGetResult(t, body, true, tutusrpc.InvalidParamsCode)
|
||||||
})
|
})
|
||||||
t.Run("good: fresh state", func(t *testing.T) {
|
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)
|
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")))
|
params := fmt.Sprintf(`"%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("testkey")))
|
||||||
testGetState(t, params, base64.StdEncoding.EncodeToString([]byte("newtestvalue")))
|
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)
|
require.Equal(t, expected.Truncated, actual.Truncated)
|
||||||
}
|
}
|
||||||
t.Run("good: no prefix, no limit", func(t *testing.T) {
|
t.Run("good: no prefix, no limit", func(t *testing.T) {
|
||||||
// pairs for this test where put to the contract storage at block #16
|
// pairs for this test where put to the contract storage at block #17
|
||||||
root, err := e.chain.GetStateModule().GetStateRoot(16)
|
root, err := e.chain.GetStateModule().GetStateRoot(17)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
params := fmt.Sprintf(`"%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")))
|
params := fmt.Sprintf(`"%s", "%s", "%s"`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")))
|
||||||
testFindStates(t, params, root.Root, result.FindStates{
|
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) {
|
t.Run("good: empty prefix, no limit", func(t *testing.T) {
|
||||||
// empty prefix should be considered as no prefix specified.
|
// 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)
|
require.NoError(t, err)
|
||||||
params := fmt.Sprintf(`"%s", "%s", "%s", ""`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")))
|
params := fmt.Sprintf(`"%s", "%s", "%s", ""`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")))
|
||||||
testFindStates(t, params, root.Root, result.FindStates{
|
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) {
|
t.Run("good: empty prefix, no limit, no data", func(t *testing.T) {
|
||||||
// empty prefix should be considered as no prefix specified.
|
// 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)
|
require.NoError(t, err)
|
||||||
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib) // It has no data.
|
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib) // It has no data.
|
||||||
params := fmt.Sprintf(`"%s", "%s", ""`, root.Root.StringLE(), stdHash.StringLE())
|
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) {
|
t.Run("good: with prefix, no limit", func(t *testing.T) {
|
||||||
// pairs for this test where put to the contract storage at block #16
|
// pairs for this test where put to the contract storage at block #17
|
||||||
root, err := e.chain.GetStateModule().GetStateRoot(16)
|
root, err := e.chain.GetStateModule().GetStateRoot(17)
|
||||||
require.NoError(t, err)
|
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")))
|
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{
|
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) {
|
t.Run("good: empty prefix, with limit", func(t *testing.T) {
|
||||||
for limit := 2; limit < 5; limit++ {
|
for limit := 2; limit < 5; limit++ {
|
||||||
// pairs for this test where put to the contract storage at block #16
|
// pairs for this test where put to the contract storage at block #17
|
||||||
root, err := e.chain.GetStateModule().GetStateRoot(16)
|
root, err := e.chain.GetStateModule().GetStateRoot(17)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
params := fmt.Sprintf(`"%s", "%s", "%s", "", %d`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")), limit)
|
params := fmt.Sprintf(`"%s", "%s", "%s", "", %d`, root.Root.StringLE(), testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa")), limit)
|
||||||
expected := result.FindStates{
|
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) {
|
t.Run("good: with prefix, with limit", func(t *testing.T) {
|
||||||
// pairs for this test where put to the contract storage at block #16
|
// pairs for this test where put to the contract storage at block #17
|
||||||
root, err := e.chain.GetStateModule().GetStateRoot(16)
|
root, err := e.chain.GetStateModule().GetStateRoot(17)
|
||||||
require.NoError(t, err)
|
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)
|
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{
|
testFindStates(t, params, root.Root, result.FindStates{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue