diff --git a/cli/testdata/verify.nef b/cli/testdata/verify.nef index 309796612..2d3a78cab 100755 Binary files a/cli/testdata/verify.nef and b/cli/testdata/verify.nef differ diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 20db7ca7e..ff55d6b83 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -57,7 +57,7 @@ type rpcTestCase struct { } const testContractHash = "743ed26f78e29ecd595535b74a943b1f9ccbc444" -const deploymentTxHash = "8e848d367d6194c0ddc12310e0509c0bb3bf716b0bcd9c10508b4bc9c954408d" +const deploymentTxHash = "f4abbf6a5af7b79819378cce1576dd72663a95961010383d67d8c4e1f00fac02" const genesisBlockHash = "a496577895eb8c227bb866dc44f99f21c0cf06417ca8f2a877cc5d761a50dac0" const verifyContractHash = "a2eb22340979804cb10cc1add0b8822c201f4d8a" @@ -1345,7 +1345,7 @@ func checkNep17Balances(t *testing.T, e *executor, acc interface{}) { }, { Asset: e.chain.UtilityTokenHash(), - Amount: "80009690770", + Amount: "80009730770", LastUpdated: 7, }}, Address: testchain.PrivateKeyByID(0).GetScriptHash().StringLE(), diff --git a/pkg/rpc/server/testdata/testblocks.acc b/pkg/rpc/server/testdata/testblocks.acc index 4023d6e32..167c4ab35 100644 Binary files a/pkg/rpc/server/testdata/testblocks.acc and b/pkg/rpc/server/testdata/testblocks.acc differ diff --git a/pkg/smartcontract/nef/nef.go b/pkg/smartcontract/nef/nef.go index effb07ab6..c65e061be 100644 --- a/pkg/smartcontract/nef/nef.go +++ b/pkg/smartcontract/nef/nef.go @@ -11,7 +11,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/config" "github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/io" - "github.com/nspcc-dev/neo-go/pkg/util" ) // NEO Executable Format 3 (NEF3) @@ -23,7 +22,6 @@ import ( // | Magic | 4 bytes | Magic header | // | Compiler | 32 bytes | Compiler used | // | Version | 16 bytes | Compiler version (Major, Minor, Build, Version) | -// | ScriptHash | 20 bytes | ScriptHash for the script (BE) | // +------------+-----------+------------------------------------------------------------+ // | Checksum | 4 bytes | First four bytes of double SHA256 hash of the header | // +------------+-----------+------------------------------------------------------------+ @@ -48,10 +46,9 @@ type File struct { // Header represents File header. type Header struct { - Magic uint32 - Compiler string - Version Version - ScriptHash util.Uint160 + Magic uint32 + Compiler string + Version Version } // Version represents compiler version. @@ -66,9 +63,8 @@ type Version struct { func NewFile(script []byte) (File, error) { file := File{ Header: Header{ - Magic: Magic, - Compiler: "neo-go", - ScriptHash: hash.Hash160(script), + Magic: Magic, + Compiler: "neo-go", }, Script: script, } @@ -156,7 +152,6 @@ func (h *Header) EncodeBinary(w *io.BinWriter) { w.WriteBytes(make([]byte, compilerFieldSize-len(bytes))) } h.Version.EncodeBinary(w) - h.ScriptHash.EncodeBinary(w) } // DecodeBinary implements io.Serializable interface. @@ -173,7 +168,6 @@ func (h *Header) DecodeBinary(r *io.BinReader) { }) h.Compiler = string(buf) h.Version.DecodeBinary(r) - h.ScriptHash.DecodeBinary(r) } // CalculateChecksum returns first 4 bytes of double-SHA256(Header) converted to uint32. @@ -207,10 +201,6 @@ func (n *File) DecodeBinary(r *io.BinReader) { r.Err = errors.New("empty script") return } - if !hash.Hash160(n.Script).Equals(n.Header.ScriptHash) { - r.Err = errors.New("script hashes mismatch") - return - } } // Bytes returns byte array with serialized NEF File. diff --git a/pkg/smartcontract/nef/nef_test.go b/pkg/smartcontract/nef/nef_test.go index 229d786a2..1ed9575a3 100644 --- a/pkg/smartcontract/nef/nef_test.go +++ b/pkg/smartcontract/nef/nef_test.go @@ -4,8 +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/util" "github.com/stretchr/testify/require" ) @@ -21,7 +19,6 @@ func TestEncodeDecodeBinary(t *testing.T) { Build: 3, Revision: 4, }, - ScriptHash: hash.Hash160(script), }, Script: script, } @@ -39,7 +36,6 @@ func TestEncodeDecodeBinary(t *testing.T) { t.Run("zero-length script", func(t *testing.T) { expected.Script = make([]byte, 0) - expected.Header.ScriptHash = hash.Hash160(expected.Script) expected.Checksum = expected.Header.CalculateChecksum() checkDecodeError(t, expected) }) @@ -47,21 +43,12 @@ func TestEncodeDecodeBinary(t *testing.T) { t.Run("invalid script length", func(t *testing.T) { newScript := make([]byte, MaxScriptLength+1) expected.Script = newScript - expected.Header.ScriptHash = hash.Hash160(newScript) - expected.Checksum = expected.Header.CalculateChecksum() - checkDecodeError(t, expected) - }) - - t.Run("invalid scripthash", func(t *testing.T) { - expected.Script = script - expected.Header.ScriptHash = util.Uint160{1, 2, 3} expected.Checksum = expected.Header.CalculateChecksum() checkDecodeError(t, expected) }) t.Run("positive", func(t *testing.T) { expected.Script = script - expected.Header.ScriptHash = hash.Hash160(script) expected.Checksum = expected.Header.CalculateChecksum() expected.Header.Magic = Magic testserdes.EncodeDecodeBinary(t, expected, &File{}) @@ -86,7 +73,6 @@ func TestBytesFromBytes(t *testing.T) { Build: 3, Revision: 4, }, - ScriptHash: hash.Hash160(script), }, Script: script, }