Skip to content

Commit

Permalink
Merge pull request #1708 from nspcc-dev/native/fixname
Browse files Browse the repository at this point in the history
native: fix `getCommittee` name
  • Loading branch information
roman-khimov committed Feb 5, 2021
2 parents 1ee2166 + d7f68d3 commit b1977ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions pkg/core/native/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package native

import (
"testing"
"unicode"

"github.com/stretchr/testify/require"
)
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion pkg/core/native/native_neo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b1977ea

Please sign in to comment.