From d7f68d36505b355fd2ae5cf227e4fa561e6a35b4 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Fri, 5 Feb 2021 12:09:15 +0300 Subject: [PATCH] native: fix `getCommittee` name `C` was in russian. --- pkg/core/native/compatibility_test.go | 23 +++++++++++++++++++++++ pkg/core/native/native_neo.go | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pkg/core/native/compatibility_test.go b/pkg/core/native/compatibility_test.go index f581264df2..5e0c7b4714 100644 --- a/pkg/core/native/compatibility_test.go +++ b/pkg/core/native/compatibility_test.go @@ -2,6 +2,7 @@ package native import ( "testing" + "unicode" "github.com/stretchr/testify/require" ) @@ -18,3 +19,25 @@ func TestNativeHashes(t *testing.T) { // Not yet a part of NEO. //require.Equal(t, "", newNotary().Hash.StringLE()()) } + +// "C" and "O" can easily be typed by accident. +func TestNamesASCII(t *testing.T) { + cs := NewContracts(true) + for _, c := range cs.Contracts { + require.True(t, isASCII(c.Metadata().Name)) + for m := range c.Metadata().Methods { + require.True(t, isASCII(m.Name)) + } + for _, e := range c.Metadata().Manifest.ABI.Events { + require.True(t, isASCII(e.Name)) + } + } +} + +func isASCII(s string) bool { + ok := true + for i := 0; i < len(s); i++ { + ok = ok && s[i] <= unicode.MaxASCII + } + return ok +} diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index 614300ab23..c9f8b585e5 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -133,7 +133,7 @@ func newNEO() *NEO { md = newMethodAndPrice(n.getCandidatesCall, 100000000, callflag.ReadStates) n.AddMethod(md, desc) - desc = newDescriptor("getŠ”ommittee", smartcontract.ArrayType) + desc = newDescriptor("getCommittee", smartcontract.ArrayType) md = newMethodAndPrice(n.getCommittee, 100000000, callflag.ReadStates) n.AddMethod(md, desc)