Add .one TLD registration and update test expected values
- Add .one TLD registration to NNS at block #14 - Change domain from neo.com to tutus.one - Update all block indices after #14 (+1) - Update stateroot hash for block #21 - Update faultedTxHashLE and deploymentTxHash - Update nnsToken1ID to hex of tutus.one - Replace neo.com with tutus.one in all test parameters - Update VM script byte arrays for new domain length - Regenerate testblocks.acc 🤖 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
5a810b3508
commit
a74ae1ddd4
|
|
@ -220,64 +220,67 @@ func Init(t *testing.T, rootpath string, e *tutustest.Executor) {
|
||||||
// Block #13: add `.com` root to NNS.
|
// Block #13: add `.com` root to NNS.
|
||||||
nsCommitteeInvoker.Invoke(t, stackitem.Null{}, "addRoot", "com") // block #13
|
nsCommitteeInvoker.Invoke(t, stackitem.Null{}, "addRoot", "com") // block #13
|
||||||
|
|
||||||
// Block #14: register `neo.com` via NNS.
|
// Block #14: add `.one` root to NNS.
|
||||||
|
nsCommitteeInvoker.Invoke(t, stackitem.Null{}, "addRoot", "one") // block #14
|
||||||
|
|
||||||
|
// Block #15: register `tutus.one` via NNS.
|
||||||
registerTxH := nsPriv0Invoker.Invoke(t, true, "register",
|
registerTxH := nsPriv0Invoker.Invoke(t, true, "register",
|
||||||
"neo.com", priv0ScriptHash) // block #14
|
"tutus.one", priv0ScriptHash) // block #15
|
||||||
res := e.GetTxExecResult(t, registerTxH)
|
res := e.GetTxExecResult(t, registerTxH)
|
||||||
require.Equal(t, 1, len(res.Events)) // transfer
|
require.Equal(t, 1, len(res.Events)) // transfer
|
||||||
tokenID, err := res.Events[0].Item.Value().([]stackitem.Item)[3].TryBytes()
|
tokenID, err := res.Events[0].Item.Value().([]stackitem.Item)[3].TryBytes()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
t.Logf("NNS token #1 ID (hex): %s", hex.EncodeToString(tokenID))
|
t.Logf("NNS token #1 ID (hex): %s", hex.EncodeToString(tokenID))
|
||||||
|
|
||||||
// Block #15: set A record type with priv0 owner via NNS.
|
// Block #16: set A record type with priv0 owner via NNS.
|
||||||
nsPriv0Invoker.Invoke(t, stackitem.Null{}, "setRecord", "neo.com", int64(nns.A), "1.2.3.4") // block #15
|
nsPriv0Invoker.Invoke(t, stackitem.Null{}, "setRecord", "tutus.one", int64(nns.A), "1.2.3.4") // block #16
|
||||||
|
|
||||||
// Block #16: invoke `test_contract.go`: put new value with the same key to check `getstate` RPC call
|
// Block #17: invoke `test_contract.go`: put new value with the same key to check `getstate` RPC call
|
||||||
txPutNewValue := rublPriv0Invoker.PrepareInvoke(t, "putValue", "testkey", RublesNewTestvalue) // tx1
|
txPutNewValue := rublPriv0Invoker.PrepareInvoke(t, "putValue", "testkey", RublesNewTestvalue) // tx1
|
||||||
// Invoke `test_contract.go`: put values to check `findstates` RPC call.
|
// Invoke `test_contract.go`: put values to check `findstates` RPC call.
|
||||||
txPut1 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa", "v1") // tx2
|
txPut1 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa", "v1") // tx2
|
||||||
txPut2 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa10", "v2") // tx3
|
txPut2 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa10", "v2") // tx3
|
||||||
txPut3 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa50", "v3") // tx4
|
txPut3 := rublPriv0Invoker.PrepareInvoke(t, "putValue", "aa50", "v3") // tx4
|
||||||
e.AddNewBlock(t, txPutNewValue, txPut1, txPut2, txPut3) // block #16
|
e.AddNewBlock(t, txPutNewValue, txPut1, txPut2, txPut3) // block #17
|
||||||
e.CheckHalt(t, txPutNewValue.Hash(), stackitem.NewBool(true))
|
e.CheckHalt(t, txPutNewValue.Hash(), stackitem.NewBool(true))
|
||||||
e.CheckHalt(t, txPut1.Hash(), stackitem.NewBool(true))
|
e.CheckHalt(t, txPut1.Hash(), stackitem.NewBool(true))
|
||||||
e.CheckHalt(t, txPut2.Hash(), stackitem.NewBool(true))
|
e.CheckHalt(t, txPut2.Hash(), stackitem.NewBool(true))
|
||||||
e.CheckHalt(t, txPut3.Hash(), stackitem.NewBool(true))
|
e.CheckHalt(t, txPut3.Hash(), stackitem.NewBool(true))
|
||||||
|
|
||||||
// Block #17: deploy NeoFS Object contract (NEP11-Divisible).
|
// Block #18: deploy NeoFS Object contract (NEP11-Divisible).
|
||||||
nfsPath := filepath.Join(examplesPrefix, "nft-d")
|
nfsPath := filepath.Join(examplesPrefix, "nft-d")
|
||||||
nfsConfigPath := filepath.Join(nfsPath, "nft.yml")
|
nfsConfigPath := filepath.Join(nfsPath, "nft.yml")
|
||||||
_, _, nfsHash := deployContractFromPriv0(t, nfsPath, nfsPath, nfsConfigPath, NFSOContractID) // block #17
|
_, _, nfsHash := deployContractFromPriv0(t, nfsPath, nfsPath, nfsConfigPath, NFSOContractID) // block #18
|
||||||
nfsPriv0Invoker := e.NewInvoker(nfsHash, acc0)
|
nfsPriv0Invoker := e.NewInvoker(nfsHash, acc0)
|
||||||
nfsPriv1Invoker := e.NewInvoker(nfsHash, acc1)
|
nfsPriv1Invoker := e.NewInvoker(nfsHash, acc1)
|
||||||
|
|
||||||
// Block #18: mint 1.00 NFSO token by transferring 10 GAS to NFSO contract.
|
// Block #19: mint 1.00 NFSO token by transferring 10 GAS to NFSO contract.
|
||||||
containerID := util.Uint256{1, 2, 3}
|
containerID := util.Uint256{1, 2, 3}
|
||||||
objectID := util.Uint256{4, 5, 6}
|
objectID := util.Uint256{4, 5, 6}
|
||||||
txGas0toNFSH := gasPriv0Invoker.Invoke(t, true, "transfer",
|
txGas0toNFSH := gasPriv0Invoker.Invoke(t, true, "transfer",
|
||||||
priv0ScriptHash, nfsHash, 10_0000_0000, []any{containerID.BytesBE(), objectID.BytesBE()}) // block #18
|
priv0ScriptHash, nfsHash, 10_0000_0000, []any{containerID.BytesBE(), objectID.BytesBE()}) // block #19
|
||||||
res = e.GetTxExecResult(t, txGas0toNFSH)
|
res = e.GetTxExecResult(t, txGas0toNFSH)
|
||||||
require.Equal(t, 2, len(res.Events)) // GAS transfer + NFSO transfer
|
require.Equal(t, 2, len(res.Events)) // GAS transfer + NFSO transfer
|
||||||
tokenID, err = res.Events[1].Item.Value().([]stackitem.Item)[3].TryBytes()
|
tokenID, err = res.Events[1].Item.Value().([]stackitem.Item)[3].TryBytes()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
t.Logf("NFSO token #1 ID (hex): %s", hex.EncodeToString(tokenID))
|
t.Logf("NFSO token #1 ID (hex): %s", hex.EncodeToString(tokenID))
|
||||||
|
|
||||||
// Block #19: transfer 0.25 NFSO from priv0 to priv1.
|
// Block #20: transfer 0.25 NFSO from priv0 to priv1.
|
||||||
nfsPriv0Invoker.Invoke(t, true, "transfer", priv0ScriptHash, priv1ScriptHash, 25, tokenID, nil) // block #19
|
nfsPriv0Invoker.Invoke(t, true, "transfer", priv0ScriptHash, priv1ScriptHash, 25, tokenID, nil) // block #20
|
||||||
|
|
||||||
// Block #20: transfer 1000 GAS to priv1.
|
// Block #21: transfer 1000 GAS to priv1.
|
||||||
gasValidatorInvoker.Invoke(t, true, "transfer", e.Validator.ScriptHash(),
|
gasValidatorInvoker.Invoke(t, true, "transfer", e.Validator.ScriptHash(),
|
||||||
priv1ScriptHash, int64(fixedn.Fixed8FromInt64(1000)), nil) // block #20
|
priv1ScriptHash, int64(fixedn.Fixed8FromInt64(1000)), nil) // block #21
|
||||||
|
|
||||||
// Block #21: transfer 0.05 NFSO from priv1 back to priv0.
|
// Block #22: transfer 0.05 NFSO from priv1 back to priv0.
|
||||||
nfsPriv1Invoker.Invoke(t, true, "transfer", priv1ScriptHash, priv0ScriptHash, 5, tokenID, nil) // block #21
|
nfsPriv1Invoker.Invoke(t, true, "transfer", priv1ScriptHash, priv0ScriptHash, 5, tokenID, nil) // block #22
|
||||||
|
|
||||||
// Block #22: deploy storage_contract (Storage contract for `traverseiterator` and `terminatesession` RPC calls test).
|
// Block #23: deploy storage_contract (Storage contract for `traverseiterator` and `terminatesession` RPC calls test).
|
||||||
storagePath := filepath.Join(testDataPrefix, "storage", "storage_contract.go")
|
storagePath := filepath.Join(testDataPrefix, "storage", "storage_contract.go")
|
||||||
storageCfg := filepath.Join(testDataPrefix, "storage", "storage_contract.yml")
|
storageCfg := filepath.Join(testDataPrefix, "storage", "storage_contract.yml")
|
||||||
_, _, _ = deployContractFromPriv0(t, storagePath, "Storage", storageCfg, StorageContractID)
|
_, _, _ = deployContractFromPriv0(t, storagePath, "Storage", storageCfg, StorageContractID)
|
||||||
|
|
||||||
// Block #23: add FAULTed transaction to check WSClient waitloops.
|
// Block #24: add FAULTed transaction to check WSClient waitloops.
|
||||||
faultedTx := e.PrepareInvocationNoSign(t, []byte{byte(opcode.ABORT)}, e.Chain.BlockHeight()+2) // use larger VUB for TestClient_Wait.
|
faultedTx := e.PrepareInvocationNoSign(t, []byte{byte(opcode.ABORT)}, e.Chain.BlockHeight()+2) // use larger VUB for TestClient_Wait.
|
||||||
e.SignTx(t, faultedTx, -1, acc0)
|
e.SignTx(t, faultedTx, -1, acc0)
|
||||||
e.AddNewBlock(t, faultedTx)
|
e.AddNewBlock(t, faultedTx)
|
||||||
|
|
@ -295,9 +298,9 @@ func Init(t *testing.T, rootpath string, e *tutustest.Executor) {
|
||||||
txSendRaw.EncodeBinary(bw.BinWriter)
|
txSendRaw.EncodeBinary(bw.BinWriter)
|
||||||
t.Logf("sendrawtransaction: \n\tbase64: %s\n\tHash LE: %s", base64.StdEncoding.EncodeToString(bw.Bytes()), txSendRaw.Hash().StringLE())
|
t.Logf("sendrawtransaction: \n\tbase64: %s\n\tHash LE: %s", base64.StdEncoding.EncodeToString(bw.Bytes()), txSendRaw.Hash().StringLE())
|
||||||
|
|
||||||
sr20, err := e.Chain.GetStateModule().GetStateRoot(20)
|
sr21, err := e.Chain.GetStateModule().GetStateRoot(21)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
t.Logf("Block #20 stateroot LE: %s", sr20.Root.StringLE())
|
t.Logf("Block #21 stateroot LE: %s", sr21.Root.StringLE())
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDeployTx(t *testing.T, e *tutustest.Executor, sender tutustest.Signer, sourcePath, configPath string, deploy bool) (util.Uint256, util.Uint160) {
|
func newDeployTx(t *testing.T, e *tutustest.Executor, sender tutustest.Signer, sourcePath, configPath string, deploy bool) (util.Uint256, util.Uint160) {
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ func TestClientNEOContract(t *testing.T) {
|
||||||
|
|
||||||
sym, err := neoR.Symbol()
|
sym, err := neoR.Symbol()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, "NEO", sym)
|
require.Equal(t, "TUT", sym)
|
||||||
|
|
||||||
dec, err := neoR.Decimals()
|
dec, err := neoR.Decimals()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -452,7 +452,7 @@ func TestClientNEOContract(t *testing.T) {
|
||||||
acc0 := testchain.PrivateKey(0).PublicKey().GetScriptHash()
|
acc0 := testchain.PrivateKey(0).PublicKey().GetScriptHash()
|
||||||
uncl, err := neoR.UnclaimedGas(acc0, chain.BlockHeight()+1)
|
uncl, err := neoR.UnclaimedGas(acc0, chain.BlockHeight()+1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, big.NewInt(10000), uncl)
|
require.Equal(t, big.NewInt(10500), uncl)
|
||||||
|
|
||||||
accState, err := neoR.GetAccountState(acc0)
|
accState, err := neoR.GetAccountState(acc0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -1309,7 +1309,7 @@ func TestClient_NEP11_ND(t *testing.T) {
|
||||||
t.Run("TotalSupply", func(t *testing.T) {
|
t.Run("TotalSupply", func(t *testing.T) {
|
||||||
s, err := n11.TotalSupply()
|
s, err := n11.TotalSupply()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.EqualValues(t, big.NewInt(1), s) // the only `tutus.com` of acc0
|
require.EqualValues(t, big.NewInt(1), s) // the only `tutus.one` of acc0
|
||||||
})
|
})
|
||||||
t.Run("Symbol", func(t *testing.T) {
|
t.Run("Symbol", func(t *testing.T) {
|
||||||
sym, err := n11.Symbol()
|
sym, err := n11.Symbol()
|
||||||
|
|
@ -1333,7 +1333,7 @@ func TestClient_NEP11_ND(t *testing.T) {
|
||||||
require.EqualValues(t, big.NewInt(1), b)
|
require.EqualValues(t, big.NewInt(1), b)
|
||||||
})
|
})
|
||||||
t.Run("OwnerOf", func(t *testing.T) {
|
t.Run("OwnerOf", func(t *testing.T) {
|
||||||
b, err := n11.OwnerOf([]byte("tutus.com"))
|
b, err := n11.OwnerOf([]byte("tutus.one"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.EqualValues(t, acc, b)
|
require.EqualValues(t, acc, b)
|
||||||
})
|
})
|
||||||
|
|
@ -1343,28 +1343,28 @@ func TestClient_NEP11_ND(t *testing.T) {
|
||||||
items, err := iter.Next(config.DefaultMaxIteratorResultItems)
|
items, err := iter.Next(config.DefaultMaxIteratorResultItems)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(items))
|
require.Equal(t, 1, len(items))
|
||||||
require.Equal(t, [][]byte{[]byte("tutus.com")}, items)
|
require.Equal(t, [][]byte{[]byte("tutus.one")}, items)
|
||||||
require.NoError(t, iter.Terminate())
|
require.NoError(t, iter.Terminate())
|
||||||
})
|
})
|
||||||
t.Run("TokensExpanded", func(t *testing.T) {
|
t.Run("TokensExpanded", func(t *testing.T) {
|
||||||
items, err := n11.TokensExpanded(config.DefaultMaxIteratorResultItems)
|
items, err := n11.TokensExpanded(config.DefaultMaxIteratorResultItems)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, [][]byte{[]byte("tutus.com")}, items)
|
require.Equal(t, [][]byte{[]byte("tutus.one")}, items)
|
||||||
})
|
})
|
||||||
t.Run("Properties", func(t *testing.T) {
|
t.Run("Properties", func(t *testing.T) {
|
||||||
p, err := n11.Properties([]byte("tutus.com"))
|
p, err := n11.Properties([]byte("tutus.one"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
blockRegisterDomain, err := chain.GetBlock(chain.GetHeaderHash(14)) // `tutus.com` domain was registered in 14th block
|
blockRegisterDomain, err := chain.GetBlock(chain.GetHeaderHash(15)) // `tutus.one` domain was registered in 14th block
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(blockRegisterDomain.Transactions))
|
require.Equal(t, 1, len(blockRegisterDomain.Transactions))
|
||||||
expected := stackitem.NewMap()
|
expected := stackitem.NewMap()
|
||||||
expected.Add(stackitem.Make([]byte("name")), stackitem.Make([]byte("tutus.com")))
|
expected.Add(stackitem.Make([]byte("name")), stackitem.Make([]byte("tutus.one")))
|
||||||
expected.Add(stackitem.Make([]byte("expiration")), stackitem.Make(blockRegisterDomain.Timestamp+365*24*3600*1000)) // expiration formula
|
expected.Add(stackitem.Make([]byte("expiration")), stackitem.Make(blockRegisterDomain.Timestamp+365*24*3600*1000)) // expiration formula
|
||||||
expected.Add(stackitem.Make([]byte("admin")), stackitem.Null{})
|
expected.Add(stackitem.Make([]byte("admin")), stackitem.Null{})
|
||||||
require.EqualValues(t, expected, p)
|
require.EqualValues(t, expected, p)
|
||||||
})
|
})
|
||||||
t.Run("Transfer", func(t *testing.T) {
|
t.Run("Transfer", func(t *testing.T) {
|
||||||
_, _, err := n11.Transfer(testchain.PrivateKeyByID(1).GetScriptHash(), []byte("tutus.com"), nil)
|
_, _, err := n11.Transfer(testchain.PrivateKeyByID(1).GetScriptHash(), []byte("tutus.one"), nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1462,7 +1462,7 @@ func TestClient_NNS(t *testing.T) {
|
||||||
nnc := nns.NewReader(invoker.New(c, nil), nnsHash)
|
nnc := nns.NewReader(invoker.New(c, nil), nnsHash)
|
||||||
|
|
||||||
t.Run("IsAvailable, false", func(t *testing.T) {
|
t.Run("IsAvailable, false", func(t *testing.T) {
|
||||||
b, err := nnc.IsAvailable("tutus.com")
|
b, err := nnc.IsAvailable("tutus.one")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, false, b)
|
require.Equal(t, false, b)
|
||||||
})
|
})
|
||||||
|
|
@ -1472,7 +1472,7 @@ func TestClient_NNS(t *testing.T) {
|
||||||
require.Equal(t, true, b)
|
require.Equal(t, true, b)
|
||||||
})
|
})
|
||||||
t.Run("Resolve, good", func(t *testing.T) {
|
t.Run("Resolve, good", func(t *testing.T) {
|
||||||
b, err := nnc.Resolve("tutus.com", nns.A)
|
b, err := nnc.Resolve("tutus.one", nns.A)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, "1.2.3.4", b)
|
require.Equal(t, "1.2.3.4", b)
|
||||||
})
|
})
|
||||||
|
|
@ -1485,23 +1485,23 @@ func TestClient_NNS(t *testing.T) {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
})
|
})
|
||||||
t.Run("GetAllRecords, good", func(t *testing.T) {
|
t.Run("GetAllRecords, good", func(t *testing.T) {
|
||||||
iter, err := nnc.GetAllRecords("tutus.com")
|
iter, err := nnc.GetAllRecords("tutus.one")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
arr, err := iter.Next(config.DefaultMaxIteratorResultItems)
|
arr, err := iter.Next(config.DefaultMaxIteratorResultItems)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(arr))
|
require.Equal(t, 1, len(arr))
|
||||||
require.Equal(t, nns.RecordState{
|
require.Equal(t, nns.RecordState{
|
||||||
Name: "tutus.com",
|
Name: "tutus.one",
|
||||||
Type: nns.A,
|
Type: nns.A,
|
||||||
Data: "1.2.3.4",
|
Data: "1.2.3.4",
|
||||||
}, arr[0])
|
}, arr[0])
|
||||||
})
|
})
|
||||||
t.Run("GetAllRecordsExpanded, good", func(t *testing.T) {
|
t.Run("GetAllRecordsExpanded, good", func(t *testing.T) {
|
||||||
rss, err := nnc.GetAllRecordsExpanded("tutus.com", 42)
|
rss, err := nnc.GetAllRecordsExpanded("tutus.one", 42)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, []nns.RecordState{
|
require.Equal(t, []nns.RecordState{
|
||||||
{
|
{
|
||||||
Name: "tutus.com",
|
Name: "tutus.one",
|
||||||
Type: nns.A,
|
Type: nns.A,
|
||||||
Data: "1.2.3.4",
|
Data: "1.2.3.4",
|
||||||
},
|
},
|
||||||
|
|
@ -1880,7 +1880,7 @@ func TestClient_Wait(t *testing.T) {
|
||||||
b1, err := chain.GetBlock(chain.GetHeaderHash(1))
|
b1, err := chain.GetBlock(chain.GetHeaderHash(1))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, len(b1.Transactions) > 0)
|
require.True(t, len(b1.Transactions) > 0)
|
||||||
b23, err := chain.GetBlock(chain.GetHeaderHash(23)) // block with faulted tx and extended VUB.
|
b23, err := chain.GetBlock(chain.GetHeaderHash(24)) // block with faulted tx and extended VUB.
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, len(b23.Transactions) > 0)
|
require.True(t, len(b23.Transactions) > 0)
|
||||||
|
|
||||||
|
|
@ -2452,7 +2452,7 @@ func TestClient_FindStorageHistoric(t *testing.T) {
|
||||||
t.Cleanup(c.Close)
|
t.Cleanup(c.Close)
|
||||||
require.NoError(t, c.Init())
|
require.NoError(t, c.Init())
|
||||||
|
|
||||||
root, err := util.Uint256DecodeStringLE(block20StateRootLE)
|
root, err := util.Uint256DecodeStringLE(block21StateRootLE)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
h, err := util.Uint160DecodeStringLE(testContractHashLE)
|
h, err := util.Uint160DecodeStringLE(testContractHashLE)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -2521,7 +2521,7 @@ func TestClient_GetStorageHistoric(t *testing.T) {
|
||||||
t.Cleanup(c.Close)
|
t.Cleanup(c.Close)
|
||||||
require.NoError(t, c.Init())
|
require.NoError(t, c.Init())
|
||||||
|
|
||||||
root, err := util.Uint256DecodeStringLE(block20StateRootLE)
|
root, err := util.Uint256DecodeStringLE(block21StateRootLE)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
h, err := util.Uint160DecodeStringLE(testContractHashLE)
|
h, err := util.Uint160DecodeStringLE(testContractHashLE)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ const (
|
||||||
testContractHashLE = "4ae8b123905cf5f17c56c7ba03c3e49dd4de6602"
|
testContractHashLE = "4ae8b123905cf5f17c56c7ba03c3e49dd4de6602"
|
||||||
// deploymentTxHash is an LE hash of transaction that deploys NEP-17 "Rubl"
|
// deploymentTxHash is an LE hash of transaction that deploys NEP-17 "Rubl"
|
||||||
// contract at block #2 of basic testing chain.
|
// contract at block #2 of basic testing chain.
|
||||||
deploymentTxHash = "48cd6fcacde126cef88900fd2ca254eafc25cae8152cb343ef7c18352e141356"
|
deploymentTxHash = "372dbbbb097ec67171c979f218668854cc91dcb4b73f6f00f69a9b709b67b16b"
|
||||||
// verifyContractHash is an LE hash of "Verify" contract deployed at block #7 of
|
// verifyContractHash is an LE hash of "Verify" contract deployed at block #7 of
|
||||||
// basic testing chain.
|
// basic testing chain.
|
||||||
verifyContractHash = "41ea4991de3c83011ad040c5e0837f4f47d088a4"
|
verifyContractHash = "41ea4991de3c83011ad040c5e0837f4f47d088a4"
|
||||||
|
|
@ -100,29 +100,29 @@ const (
|
||||||
// contract deployed at block #11 of basic testing chain.
|
// contract deployed at block #11 of basic testing chain.
|
||||||
nnsContractHash = "9e78165b94215c954e3db4897f8fad0eec57eee5"
|
nnsContractHash = "9e78165b94215c954e3db4897f8fad0eec57eee5"
|
||||||
// nnsToken1ID is a hex-encoded ID of the first NEP-11 NNS token minted at block
|
// nnsToken1ID is a hex-encoded ID of the first NEP-11 NNS token minted at block
|
||||||
// #14 of basic testing chain.
|
// #15 of basic testing chain.
|
||||||
nnsToken1ID = "6e656f2e636f6d"
|
nnsToken1ID = "74757475732e6f6e65"
|
||||||
// nfsoContractHash is an LE hash of NEP-11 divisible "examples/nft-d" ("NeoFS
|
// nfsoContractHash is an LE hash of NEP-11 divisible "examples/nft-d" ("NeoFS
|
||||||
// Object") contract deployed at block #17 of basic testing chain.
|
// Object") contract deployed at block #18 of basic testing chain.
|
||||||
nfsoContractHash = "01ad70f110f3a42196927b90bd29cda89285e047"
|
nfsoContractHash = "01ad70f110f3a42196927b90bd29cda89285e047"
|
||||||
// nfsoToken1ID is a hex-encoded ID of the first NEP-11 NFSO token minted at
|
// nfsoToken1ID is a hex-encoded ID of the first NEP-11 NFSO token minted at
|
||||||
// block #18 of basic testing chain.
|
// block #19 of basic testing chain.
|
||||||
nfsoToken1ID = "7e244ffd6aa85fb1579d2ed22e9b761ab62e3486"
|
nfsoToken1ID = "7e244ffd6aa85fb1579d2ed22e9b761ab62e3486"
|
||||||
// storageContractHash is an LE hash of "Storage" contract deployed at block #22
|
// storageContractHash is an LE hash of "Storage" contract deployed at block #23
|
||||||
// of basic testing chain.
|
// of basic testing chain.
|
||||||
storageContractHash = "4fc98af155564b1540d990346ec793f429827ad8"
|
storageContractHash = "4fc98af155564b1540d990346ec793f429827ad8"
|
||||||
// faultedTxHashLE is an LE hash of FAULTed transaction accepted at block #23 of
|
// faultedTxHashLE is an LE hash of FAULTed transaction accepted at block #24 of
|
||||||
// basic testing chain.
|
// basic testing chain.
|
||||||
faultedTxHashLE = "c8d69b83f085eb2608da555016c0debe4e8e6a6e8a78bfa30d3491b910d1a33b"
|
faultedTxHashLE = "82f9a502799c13b3ced6fdb83f0eec0fee5814b7c59868beca2e39b38c6527d3"
|
||||||
// faultedTxBlock is the number of block of basic testing chain that contains
|
// faultedTxBlock is the number of block of basic testing chain that contains
|
||||||
// FAULTed transaction.
|
// FAULTed transaction.
|
||||||
faultedTxBlock uint32 = 23
|
faultedTxBlock uint32 = 24
|
||||||
// invokescriptContractAVM is a base64-encoded AVM of
|
// invokescriptContractAVM is a base64-encoded AVM of
|
||||||
// "pkg/internal/basicchain/testdata/invokescript_contract.go" contract that is
|
// "pkg/internal/basicchain/testdata/invokescript_contract.go" contract that is
|
||||||
// not yet deployed to the testing basic chain.
|
// not yet deployed to the testing basic chain.
|
||||||
invokescriptContractAVM = "VwIADBQBDAMOBQYMDQIODw0DDgcJAAAAAErZMCQE2zBwaEH4J+yMqiYEEUAMFA0PAwIJAAIBAwcDBAUCAQAOBgwJStkwJATbMHFpQfgn7IyqJgQSQBNA"
|
invokescriptContractAVM = "VwIADBQBDAMOBQYMDQIODw0DDgcJAAAAAErZMCQE2zBwaEH4J+yMqiYEEUAMFA0PAwIJAAIBAwcDBAUCAQAOBgwJStkwJATbMHFpQfgn7IyqJgQSQBNA"
|
||||||
// block20StateRootLE is an LE stateroot of block #20 of basic testing chain.
|
// block21StateRootLE is an LE stateroot of block #21 of basic testing chain.
|
||||||
block20StateRootLE = "c08e1d5ea1da9aa8058044fc9f0b5cd8e1997e6c7cf7ee5cec8de58fd2c19192"
|
block21StateRootLE = "81404d5b7bcd88eae9990ce7d80ba963f28e765faa3039d2dcf87dc9a67ea212"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -176,7 +176,7 @@ var rpcFunctionsWithUnsupportedStatesTestCases = map[string][]rpcTestCase{
|
||||||
"findstates": {
|
"findstates": {
|
||||||
{
|
{
|
||||||
name: "unsupported state",
|
name: "unsupported state",
|
||||||
params: `["` + block20StateRootLE + `", "0xabcdef"]`,
|
params: `["` + block21StateRootLE + `", "0xabcdef"]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.ErrUnsupportedStateCode,
|
errCode: tutusrpc.ErrUnsupportedStateCode,
|
||||||
},
|
},
|
||||||
|
|
@ -184,7 +184,7 @@ var rpcFunctionsWithUnsupportedStatesTestCases = map[string][]rpcTestCase{
|
||||||
"findstoragehistoric": {
|
"findstoragehistoric": {
|
||||||
{
|
{
|
||||||
name: "unsupported state",
|
name: "unsupported state",
|
||||||
params: `["` + block20StateRootLE + `", "0xabcdef"]`,
|
params: `["` + block21StateRootLE + `", "0xabcdef"]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.ErrUnsupportedStateCode,
|
errCode: tutusrpc.ErrUnsupportedStateCode,
|
||||||
},
|
},
|
||||||
|
|
@ -409,7 +409,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
params: `["` + nnsContractHash + `", "6e656f2e636f6d"]`,
|
params: `["` + nnsContractHash + `", "6e656f2e636f6d"]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
return &map[string]any{
|
return &map[string]any{
|
||||||
"name": "neo.com",
|
"name": "tutus.one",
|
||||||
"expiration": "lhbLRl0B",
|
"expiration": "lhbLRl0B",
|
||||||
"admin": nil,
|
"admin": nil,
|
||||||
}
|
}
|
||||||
|
|
@ -621,25 +621,25 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid contract",
|
name: "invalid contract",
|
||||||
params: `["` + block20StateRootLE + `", "0xabcdef"]`,
|
params: `["` + block21StateRootLE + `", "0xabcdef"]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid prefix",
|
name: "invalid prefix",
|
||||||
params: `["` + block20StateRootLE + `", "` + testContractHashLE + `", "notabase64%"]`,
|
params: `["` + block21StateRootLE + `", "` + testContractHashLE + `", "notabase64%"]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid key",
|
name: "invalid key",
|
||||||
params: `["` + block20StateRootLE + `", "` + testContractHashLE + `", "QQ==", "notabase64%"]`,
|
params: `["` + block21StateRootLE + `", "` + testContractHashLE + `", "QQ==", "notabase64%"]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unknown contract/large count",
|
name: "unknown contract/large count",
|
||||||
params: `["` + block20StateRootLE + `", "0000000000000000000000000000000000000000", "QQ==", "QQ==", 101]`,
|
params: `["` + block21StateRootLE + `", "0000000000000000000000000000000000000000", "QQ==", "QQ==", 101]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.ErrUnknownContractCode,
|
errCode: tutusrpc.ErrUnknownContractCode,
|
||||||
},
|
},
|
||||||
|
|
@ -715,7 +715,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
"getstoragehistoric": {
|
"getstoragehistoric": {
|
||||||
{
|
{
|
||||||
name: "positive",
|
name: "positive",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block20StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa10"))),
|
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block21StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa10"))),
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
v := base64.StdEncoding.EncodeToString([]byte("v2"))
|
v := base64.StdEncoding.EncodeToString([]byte("v2"))
|
||||||
return &v
|
return &v
|
||||||
|
|
@ -723,7 +723,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing key",
|
name: "missing key",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "dGU="]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s", "dGU="]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.ErrUnknownStorageItemCode,
|
errCode: tutusrpc.ErrUnknownStorageItemCode,
|
||||||
},
|
},
|
||||||
|
|
@ -735,13 +735,13 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no second parameter",
|
name: "no second parameter",
|
||||||
params: fmt.Sprintf(`["%s"]`, block20StateRootLE),
|
params: fmt.Sprintf(`["%s"]`, block21StateRootLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no third parameter",
|
name: "no third parameter",
|
||||||
params: fmt.Sprintf(`["%s", "%s"]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s"]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
|
|
@ -753,13 +753,13 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid hash",
|
name: "invalid hash",
|
||||||
params: fmt.Sprintf(`["%s", "notahex"]`, block20StateRootLE),
|
params: fmt.Sprintf(`["%s", "notahex"]`, block21StateRootLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid key",
|
name: "invalid key",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "notabase64$"]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s", "notabase64$"]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
|
|
@ -907,7 +907,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
"findstoragehistoric": {
|
"findstoragehistoric": {
|
||||||
{
|
{
|
||||||
name: "not truncated",
|
name: "not truncated",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block20StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa1"))),
|
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block21StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa1"))),
|
||||||
result: func(_ *executor) any { return new(result.FindStorage) },
|
result: func(_ *executor) any { return new(result.FindStorage) },
|
||||||
check: func(t *testing.T, e *executor, res any) {
|
check: func(t *testing.T, e *executor, res any) {
|
||||||
actual, ok := res.(*result.FindStorage)
|
actual, ok := res.(*result.FindStorage)
|
||||||
|
|
@ -928,7 +928,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "truncated first page",
|
name: "truncated first page",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block20StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))),
|
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block21StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))),
|
||||||
result: func(_ *executor) any { return new(result.FindStorage) },
|
result: func(_ *executor) any { return new(result.FindStorage) },
|
||||||
check: func(t *testing.T, e *executor, res any) {
|
check: func(t *testing.T, e *executor, res any) {
|
||||||
actual, ok := res.(*result.FindStorage)
|
actual, ok := res.(*result.FindStorage)
|
||||||
|
|
@ -953,7 +953,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "truncated second page",
|
name: "truncated second page",
|
||||||
params: fmt.Sprintf(`["%s","%s", "%s", 2]`, block20StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))),
|
params: fmt.Sprintf(`["%s","%s", "%s", 2]`, block21StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("aa"))),
|
||||||
result: func(_ *executor) any { return new(result.FindStorage) },
|
result: func(_ *executor) any { return new(result.FindStorage) },
|
||||||
check: func(t *testing.T, e *executor, res any) {
|
check: func(t *testing.T, e *executor, res any) {
|
||||||
actual, ok := res.(*result.FindStorage)
|
actual, ok := res.(*result.FindStorage)
|
||||||
|
|
@ -974,7 +974,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "empty prefix",
|
name: "empty prefix",
|
||||||
params: fmt.Sprintf(`["%s", "%s", ""]`, block20StateRootLE, nnsContractHash),
|
params: fmt.Sprintf(`["%s", "%s", ""]`, block21StateRootLE, nnsContractHash),
|
||||||
result: func(_ *executor) any { return new(result.FindStorage) },
|
result: func(_ *executor) any { return new(result.FindStorage) },
|
||||||
check: func(t *testing.T, e *executor, res any) {
|
check: func(t *testing.T, e *executor, res any) {
|
||||||
actual, ok := res.(*result.FindStorage)
|
actual, ok := res.(*result.FindStorage)
|
||||||
|
|
@ -999,7 +999,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unknown key",
|
name: "unknown key",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block20StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("unknown-key"))),
|
params: fmt.Sprintf(`["%s", "%s", "%s"]`, block21StateRootLE, testContractHashLE, base64.StdEncoding.EncodeToString([]byte("unknown-key"))),
|
||||||
result: func(_ *executor) any { return new(result.FindStorage) },
|
result: func(_ *executor) any { return new(result.FindStorage) },
|
||||||
check: func(t *testing.T, e *executor, res any) {
|
check: func(t *testing.T, e *executor, res any) {
|
||||||
actual, ok := res.(*result.FindStorage)
|
actual, ok := res.(*result.FindStorage)
|
||||||
|
|
@ -1027,31 +1027,31 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no second parameter",
|
name: "no second parameter",
|
||||||
params: fmt.Sprintf(`["%s"]`, block20StateRootLE),
|
params: fmt.Sprintf(`["%s"]`, block21StateRootLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no third parameter",
|
name: "no third parameter",
|
||||||
params: fmt.Sprintf(`["%s", "%s"]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s"]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid hash",
|
name: "invalid hash",
|
||||||
params: fmt.Sprintf(`["%s", "notahex"]`, block20StateRootLE),
|
params: fmt.Sprintf(`["%s", "notahex"]`, block21StateRootLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid key",
|
name: "invalid key",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "notabase64$"]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s", "notabase64$"]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid page",
|
name: "invalid page",
|
||||||
params: fmt.Sprintf(`["%s", "%s", "", "not-an-int"]`, block20StateRootLE, testContractHashLE),
|
params: fmt.Sprintf(`["%s", "%s", "", "not-an-int"]`, block21StateRootLE, testContractHashLE),
|
||||||
fail: true,
|
fail: true,
|
||||||
errCode: tutusrpc.InvalidParamsCode,
|
errCode: tutusrpc.InvalidParamsCode,
|
||||||
},
|
},
|
||||||
|
|
@ -1342,7 +1342,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
expected := result.UnclaimedGas{
|
expected := result.UnclaimedGas{
|
||||||
Address: testchain.MultisigScriptHash(),
|
Address: testchain.MultisigScriptHash(),
|
||||||
Unclaimed: *big.NewInt(11500),
|
Unclaimed: *big.NewInt(12000),
|
||||||
}
|
}
|
||||||
assert.Equal(t, expected, *actual)
|
assert.Equal(t, expected, *actual)
|
||||||
},
|
},
|
||||||
|
|
@ -1428,9 +1428,9 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, with notifications",
|
name: "positive, with notifications",
|
||||||
params: `["` + nnsContractHash + `", "transfer", [{"type":"Hash160", "value":"0x0bcd2978634d961c24f5aea0802297ff128724d6"},{"type":"String", "value":"neo.com"},{"type":"Any", "value":null}],["0xb248508f4ef7088e10c48f14d04be3272ca29eee"]]`,
|
params: `["` + nnsContractHash + `", "transfer", [{"type":"Hash160", "value":"0x0bcd2978634d961c24f5aea0802297ff128724d6"},{"type":"String", "value":"tutus.one"},{"type":"Any", "value":null}],["0xb248508f4ef7088e10c48f14d04be3272ca29eee"]]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
script := append([]byte{0x0b, 0x0c, 0x07, 0x6e, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x0c, 0x14, 0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0xb, 0x13, 0xc0, 0x1f, 0xc, 0x8, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0xc, 0x14}, nnsHash.BytesBE()...)
|
script := append([]byte{0x0b, 0x0c, 0x09, 0x74, 0x75, 0x74, 0x75, 0x73, 0x2e, 0x6f, 0x6e, 0x65, 0x0c, 0x14, 0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0xb, 0x13, 0xc0, 0x1f, 0xc, 0x8, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0xc, 0x14}, nnsHash.BytesBE()...)
|
||||||
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
||||||
return &result.Invoke{
|
return &result.Invoke{
|
||||||
State: "HALT",
|
State: "HALT",
|
||||||
|
|
@ -1444,7 +1444,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
stackitem.Make([]byte{0xee, 0x9e, 0xa2, 0x2c, 0x27, 0xe3, 0x4b, 0xd0, 0x14, 0x8f, 0xc4, 0x10, 0x8e, 0x08, 0xf7, 0x4e, 0x8f, 0x50, 0x48, 0xb2}),
|
stackitem.Make([]byte{0xee, 0x9e, 0xa2, 0x2c, 0x27, 0xe3, 0x4b, 0xd0, 0x14, 0x8f, 0xc4, 0x10, 0x8e, 0x08, 0xf7, 0x4e, 0x8f, 0x50, 0x48, 0xb2}),
|
||||||
stackitem.Make([]byte{0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0x0b}),
|
stackitem.Make([]byte{0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0x0b}),
|
||||||
stackitem.Make(1),
|
stackitem.Make(1),
|
||||||
stackitem.Make("neo.com"),
|
stackitem.Make("tutus.one"),
|
||||||
}),
|
}),
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
|
@ -1484,9 +1484,9 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, verbose",
|
name: "positive, verbose",
|
||||||
params: `["` + nnsContractHash + `", "resolve", [{"type":"String", "value":"neo.com"},{"type":"Integer","value":1}], [], true]`,
|
params: `["` + nnsContractHash + `", "resolve", [{"type":"String", "value":"tutus.one"},{"type":"Integer","value":1}], [], true]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
script := append([]byte{0x11, 0xc, 0x7, 0x6e, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x12, 0xc0, 0x1f, 0xc, 0x7, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0xc, 0x14}, nnsHash.BytesBE()...)
|
script := append([]byte{0x11, 0xc, 0x9, 0x74, 0x75, 0x74, 0x75, 0x73, 0x2e, 0x6f, 0x6e, 0x65, 0x12, 0xc0, 0x1f, 0xc, 0x7, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0xc, 0x14}, nnsHash.BytesBE()...)
|
||||||
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
||||||
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib)
|
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib)
|
||||||
cryptoHash, _ := e.chain.GetNativeContractScriptHash(nativenames.CryptoLib)
|
cryptoHash, _ := e.chain.GetNativeContractScriptHash(nativenames.CryptoLib)
|
||||||
|
|
@ -1567,7 +1567,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, by stateroot",
|
name: "positive, by stateroot",
|
||||||
params: `["` + block20StateRootLE + `", "50befd26fdf6e4d957c11e078b24ebce6291456f", "test", []]`,
|
params: `["` + block21StateRootLE + `", "50befd26fdf6e4d957c11e078b24ebce6291456f", "test", []]`,
|
||||||
result: func(e *executor) any { return &result.Invoke{} },
|
result: func(e *executor) any { return &result.Invoke{} },
|
||||||
check: func(t *testing.T, e *executor, inv any) {
|
check: func(t *testing.T, e *executor, inv any) {
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
|
|
@ -1579,9 +1579,9 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, with notifications",
|
name: "positive, with notifications",
|
||||||
params: `[20, "` + nnsContractHash + `", "transfer", [{"type":"Hash160", "value":"0x0bcd2978634d961c24f5aea0802297ff128724d6"},{"type":"String", "value":"neo.com"},{"type":"Any", "value":null}],["0xb248508f4ef7088e10c48f14d04be3272ca29eee"]]`,
|
params: `[20, "` + nnsContractHash + `", "transfer", [{"type":"Hash160", "value":"0x0bcd2978634d961c24f5aea0802297ff128724d6"},{"type":"String", "value":"tutus.one"},{"type":"Any", "value":null}],["0xb248508f4ef7088e10c48f14d04be3272ca29eee"]]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
script := append([]byte{0x0b, 0x0c, 0x07, 0x6e, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x0c, 0x14, 0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0xb, 0x13, 0xc0, 0x1f, 0xc, 0x8, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0xc, 0x14}, nnsHash.BytesBE()...)
|
script := append([]byte{0x0b, 0x0c, 0x09, 0x74, 0x75, 0x74, 0x75, 0x73, 0x2e, 0x6f, 0x6e, 0x65, 0x0c, 0x14, 0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0xb, 0x13, 0xc0, 0x1f, 0xc, 0x8, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0xc, 0x14}, nnsHash.BytesBE()...)
|
||||||
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
||||||
return &result.Invoke{
|
return &result.Invoke{
|
||||||
State: "HALT",
|
State: "HALT",
|
||||||
|
|
@ -1595,7 +1595,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
stackitem.Make([]byte{0xee, 0x9e, 0xa2, 0x2c, 0x27, 0xe3, 0x4b, 0xd0, 0x14, 0x8f, 0xc4, 0x10, 0x8e, 0x08, 0xf7, 0x4e, 0x8f, 0x50, 0x48, 0xb2}),
|
stackitem.Make([]byte{0xee, 0x9e, 0xa2, 0x2c, 0x27, 0xe3, 0x4b, 0xd0, 0x14, 0x8f, 0xc4, 0x10, 0x8e, 0x08, 0xf7, 0x4e, 0x8f, 0x50, 0x48, 0xb2}),
|
||||||
stackitem.Make([]byte{0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0x0b}),
|
stackitem.Make([]byte{0xd6, 0x24, 0x87, 0x12, 0xff, 0x97, 0x22, 0x80, 0xa0, 0xae, 0xf5, 0x24, 0x1c, 0x96, 0x4d, 0x63, 0x78, 0x29, 0xcd, 0x0b}),
|
||||||
stackitem.Make(1),
|
stackitem.Make(1),
|
||||||
stackitem.Make("neo.com"),
|
stackitem.Make("tutus.one"),
|
||||||
}),
|
}),
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
|
@ -1603,9 +1603,9 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, verbose",
|
name: "positive, verbose",
|
||||||
params: `[20, "` + nnsContractHash + `", "resolve", [{"type":"String", "value":"neo.com"},{"type":"Integer","value":1}], [], true]`,
|
params: `[20, "` + nnsContractHash + `", "resolve", [{"type":"String", "value":"tutus.one"},{"type":"Integer","value":1}], [], true]`,
|
||||||
result: func(e *executor) any {
|
result: func(e *executor) any {
|
||||||
script := append([]byte{0x11, 0xc, 0x7, 0x6e, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x12, 0xc0, 0x1f, 0xc, 0x7, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0xc, 0x14}, nnsHash.BytesBE()...)
|
script := append([]byte{0x11, 0xc, 0x9, 0x74, 0x75, 0x74, 0x75, 0x73, 0x2e, 0x6f, 0x6e, 0x65, 0x12, 0xc0, 0x1f, 0xc, 0x7, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0xc, 0x14}, nnsHash.BytesBE()...)
|
||||||
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
script = append(script, 0x41, 0x62, 0x7d, 0x5b, 0x52)
|
||||||
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib)
|
stdHash, _ := e.chain.GetNativeContractScriptHash(nativenames.StdLib)
|
||||||
cryptoHash, _ := e.chain.GetNativeContractScriptHash(nativenames.CryptoLib)
|
cryptoHash, _ := e.chain.GetNativeContractScriptHash(nativenames.CryptoLib)
|
||||||
|
|
@ -1806,7 +1806,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, by stateroot",
|
name: "positive, by stateroot",
|
||||||
params: `["` + block20StateRootLE + `","UcVrDUhlbGxvLCB3b3JsZCFoD05lby5SdW50aW1lLkxvZ2FsdWY="]`,
|
params: `["` + block21StateRootLE + `","UcVrDUhlbGxvLCB3b3JsZCFoD05lby5SdW50aW1lLkxvZ2FsdWY="]`,
|
||||||
result: func(e *executor) any { return &result.Invoke{} },
|
result: func(e *executor) any { return &result.Invoke{} },
|
||||||
check: func(t *testing.T, e *executor, inv any) {
|
check: func(t *testing.T, e *executor, inv any) {
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
|
|
@ -2079,7 +2079,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positive, by stateroot",
|
name: "positive, by stateroot",
|
||||||
params: fmt.Sprintf(`["`+block20StateRootLE+`","%s", [], [{"account":"%s"}]]`, verifyContractHash, testchain.PrivateKeyByID(0).PublicKey().GetScriptHash().StringLE()),
|
params: fmt.Sprintf(`["`+block21StateRootLE+`","%s", [], [{"account":"%s"}]]`, verifyContractHash, testchain.PrivateKeyByID(0).PublicKey().GetScriptHash().StringLE()),
|
||||||
result: func(e *executor) any { return &result.Invoke{} },
|
result: func(e *executor) any { return &result.Invoke{} },
|
||||||
check: func(t *testing.T, e *executor, inv any) {
|
check: func(t *testing.T, e *executor, inv any) {
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
|
|
@ -2798,7 +2798,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
||||||
|
|
||||||
res := &state.MPTRoot{}
|
res := &state.MPTRoot{}
|
||||||
require.NoError(t, json.Unmarshal(rawRes, res))
|
require.NoError(t, json.Unmarshal(rawRes, res))
|
||||||
require.Equal(t, block20StateRootLE, res.Root.StringLE())
|
require.Equal(t, block21StateRootLE, res.Root.StringLE())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
t.Run("getstate", func(t *testing.T) {
|
t.Run("getstate", func(t *testing.T) {
|
||||||
|
|
@ -3885,7 +3885,7 @@ func checkNep11TransfersAux(t *testing.T, e *executor, acc any, sent, rcvd []int
|
||||||
require.Equal(t, 1, len(blockMintNFSO.Transactions))
|
require.Equal(t, 1, len(blockMintNFSO.Transactions))
|
||||||
txMintNFSO := blockMintNFSO.Transactions[0]
|
txMintNFSO := blockMintNFSO.Transactions[0]
|
||||||
|
|
||||||
blockRegisterNSRecordA, err := e.chain.GetBlock(e.chain.GetHeaderHash(14)) // register `neo.com` with A record type and priv0 owner via NS
|
blockRegisterNSRecordA, err := e.chain.GetBlock(e.chain.GetHeaderHash(15)) // register `tutus.one` with A record type and priv0 owner via NS
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(blockRegisterNSRecordA.Transactions))
|
require.Equal(t, 1, len(blockRegisterNSRecordA.Transactions))
|
||||||
txRegisterNSRecordA := blockRegisterNSRecordA.Transactions[0]
|
txRegisterNSRecordA := blockRegisterNSRecordA.Transactions[0]
|
||||||
|
|
@ -4001,12 +4001,12 @@ func checkNep17TransfersAux(t *testing.T, e *executor, acc any, sent, rcvd []int
|
||||||
txPutValue2 := blockPutNewTestValue.Transactions[2] // invoke `put` method of `test_contract.go` with `aa10`, `v2` args
|
txPutValue2 := blockPutNewTestValue.Transactions[2] // invoke `put` method of `test_contract.go` with `aa10`, `v2` args
|
||||||
txPutValue3 := blockPutNewTestValue.Transactions[3] // invoke `put` method of `test_contract.go` with `aa50`, `v3` args
|
txPutValue3 := blockPutNewTestValue.Transactions[3] // invoke `put` method of `test_contract.go` with `aa50`, `v3` args
|
||||||
|
|
||||||
blockSetRecord, err := e.chain.GetBlock(e.chain.GetHeaderHash(15)) // add type A record to `neo.com` domain via NNS
|
blockSetRecord, err := e.chain.GetBlock(e.chain.GetHeaderHash(16)) // add type A record to `tutus.one` domain via NNS
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(blockSetRecord.Transactions))
|
require.Equal(t, 1, len(blockSetRecord.Transactions))
|
||||||
txSetRecord := blockSetRecord.Transactions[0]
|
txSetRecord := blockSetRecord.Transactions[0]
|
||||||
|
|
||||||
blockRegisterDomain, err := e.chain.GetBlock(e.chain.GetHeaderHash(14)) // register `neo.com` domain via NNS
|
blockRegisterDomain, err := e.chain.GetBlock(e.chain.GetHeaderHash(15)) // register `tutus.one` domain via NNS
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(blockRegisterDomain.Transactions))
|
require.Equal(t, 1, len(blockRegisterDomain.Transactions))
|
||||||
txRegisterDomain := blockRegisterDomain.Transactions[0]
|
txRegisterDomain := blockRegisterDomain.Transactions[0]
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue