From c95f2079d5c4de11a99802ac6a676c711dd336f8 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 24 Aug 2021 18:01:34 +0300 Subject: [PATCH] core: adjust comments on behaviour defferences for MPT TestCompatibility C# node does not return empty proof enymore in case if path is bad. C# node also throws an exception on bad Put. Our node does not return an error on delete if the key is empty. --- pkg/core/mpt/compat_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/core/mpt/compat_test.go b/pkg/core/mpt/compat_test.go index ac99515de..f83273e80 100644 --- a/pkg/core/mpt/compat_test.go +++ b/pkg/core/mpt/compat_test.go @@ -38,11 +38,14 @@ func prepareMPTCompat() *Trie { // TestCompatibility contains tests present in C# implementation. // https://github.com/neo-project/neo-modules/blob/master/tests/Neo.Plugins.StateService.Tests/MPT/UT_MPTTrie.cs // There are some differences, though: -// 1. In our implementation delete is silent, i.e. we do not return an error is the key is missing. +// 1. In our implementation delete is silent, i.e. we do not return an error is the key is missing or empty. // However, we do return error when contents of hash node are missing from the store // (corresponds to exception in C# implementation). -// 2. If `GetProof` key is missing from the trie, we return error, while C# node just returns empty proof -// with no exception. +// 2. In our implementation put returns error if something goes wrong, while C# implementation throws +// an exception and returns nothing. +// 3. In our implementation get does not immediately return error in case of an empty key. An error is returned +// only if value is missing from the storage. C# implementation checks that key is not empty and throws an error +// otherwice. func TestCompatibility(t *testing.T) { mainTrie := prepareMPTCompat()