manifest/compiler: drop hashes from ABI and debug info
See neo-project/neo-devpack-dotnet#391 and neo-project/neo#2044.
This commit is contained in:
parent
34d2eaf00e
commit
b92ea2a48a
16 changed files with 57 additions and 115 deletions
|
@ -11,16 +11,13 @@ import (
|
|||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
)
|
||||
|
||||
// DebugInfo represents smart-contract debug information.
|
||||
type DebugInfo struct {
|
||||
MainPkg string `json:"-"`
|
||||
Hash util.Uint160 `json:"hash"`
|
||||
Documents []string `json:"documents"`
|
||||
Methods []MethodDebugInfo `json:"methods"`
|
||||
Events []EventDebugInfo `json:"events"`
|
||||
|
@ -115,7 +112,6 @@ func (c *codegen) saveSequencePoint(n ast.Node) {
|
|||
func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
|
||||
d := &DebugInfo{
|
||||
MainPkg: c.mainPkg.Pkg.Name(),
|
||||
Hash: hash.Hash160(contract),
|
||||
Events: []EventDebugInfo{},
|
||||
Documents: c.documents,
|
||||
}
|
||||
|
@ -427,7 +423,7 @@ func (di *DebugInfo) ConvertToManifest(name string, events []manifest.Event, sup
|
|||
}
|
||||
}
|
||||
|
||||
result := manifest.NewManifest(di.Hash, name)
|
||||
result := manifest.NewManifest(name)
|
||||
if supportedStandards != nil {
|
||||
result.SupportedStandards = supportedStandards
|
||||
}
|
||||
|
@ -435,7 +431,6 @@ func (di *DebugInfo) ConvertToManifest(name string, events []manifest.Event, sup
|
|||
events = make([]manifest.Event, 0)
|
||||
}
|
||||
result.ABI = manifest.ABI{
|
||||
Hash: di.Hash,
|
||||
Methods: methods,
|
||||
Events: events,
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/internal/testserdes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
|
@ -69,10 +68,6 @@ func _deploy(isUpdate bool) {}
|
|||
d := c.emitDebugInfo(buf)
|
||||
require.NotNil(t, d)
|
||||
|
||||
t.Run("hash", func(t *testing.T) {
|
||||
require.True(t, hash.Hash160(buf).Equals(d.Hash))
|
||||
})
|
||||
|
||||
t.Run("return types", func(t *testing.T) {
|
||||
returnTypes := map[string]string{
|
||||
"MethodInt": "Integer",
|
||||
|
@ -155,7 +150,6 @@ func _deploy(isUpdate bool) {}
|
|||
expected := &manifest.Manifest{
|
||||
Name: "MyCTR",
|
||||
ABI: manifest.ABI{
|
||||
Hash: hash.Hash160(buf),
|
||||
Methods: []manifest.Method{
|
||||
{
|
||||
Name: "_deploy",
|
||||
|
@ -262,7 +256,6 @@ func _deploy(isUpdate bool) {}
|
|||
},
|
||||
Extra: nil,
|
||||
}
|
||||
require.True(t, expected.ABI.Hash.Equals(actual.ABI.Hash))
|
||||
require.ElementsMatch(t, expected.ABI.Methods, actual.ABI.Methods)
|
||||
require.Equal(t, expected.ABI.Events, actual.ABI.Events)
|
||||
require.Equal(t, expected.Groups, actual.Groups)
|
||||
|
@ -304,7 +297,6 @@ func TestSequencePoints(t *testing.T) {
|
|||
|
||||
func TestDebugInfo_MarshalJSON(t *testing.T) {
|
||||
d := &DebugInfo{
|
||||
Hash: util.Uint160{10, 11, 12, 13},
|
||||
Documents: []string{"/path/to/file"},
|
||||
Methods: []MethodDebugInfo{
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue