nef: increase version field to 32 bytes
Follow recent C# changes.
This commit is contained in:
parent
470e1592d9
commit
1672887123
4 changed files with 6 additions and 9 deletions
BIN
cli/testdata/verify.nef
vendored
BIN
cli/testdata/verify.nef
vendored
Binary file not shown.
|
@ -57,7 +57,7 @@ type rpcTestCase struct {
|
|||
}
|
||||
|
||||
const testContractHash = "743ed26f78e29ecd595535b74a943b1f9ccbc444"
|
||||
const deploymentTxHash = "3f81bc99525ed4b1cbb4a3535feadf73176db646a2879aaf975737348a425edc"
|
||||
const deploymentTxHash = "9ecf1273fe0d8868cc024c8270b569a12edd7ea9d675c88554b937134efb03f8"
|
||||
const genesisBlockHash = "a496577895eb8c227bb866dc44f99f21c0cf06417ca8f2a877cc5d761a50dac0"
|
||||
|
||||
const verifyContractHash = "a2eb22340979804cb10cc1add0b8822c201f4d8a"
|
||||
|
@ -1345,7 +1345,7 @@ func checkNep17Balances(t *testing.T, e *executor, acc interface{}) {
|
|||
},
|
||||
{
|
||||
Asset: e.chain.UtilityTokenHash(),
|
||||
Amount: "80009730770",
|
||||
Amount: "80009698770",
|
||||
LastUpdated: 7,
|
||||
}},
|
||||
Address: testchain.PrivateKeyByID(0).GetScriptHash().StringLE(),
|
||||
|
|
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
Binary file not shown.
|
@ -18,7 +18,7 @@ import (
|
|||
// +------------+-----------+------------------------------------------------------------+
|
||||
// | Magic | 4 bytes | Magic header |
|
||||
// | Compiler | 32 bytes | Compiler used |
|
||||
// | Version | 16 bytes | Compiler version |
|
||||
// | Version | 32 bytes | Compiler version |
|
||||
// +------------+-----------+------------------------------------------------------------+
|
||||
// | Script | Var bytes | Var bytes for the payload |
|
||||
// +------------+-----------+------------------------------------------------------------+
|
||||
|
@ -30,10 +30,8 @@ const (
|
|||
Magic uint32 = 0x3346454E
|
||||
// MaxScriptLength is the maximum allowed contract script length.
|
||||
MaxScriptLength = 1024 * 1024
|
||||
// compilerFieldSize is the length of `Compiler` File header field in bytes.
|
||||
// compilerFieldSize is the length of `Compiler` and `Version` File header fields in bytes.
|
||||
compilerFieldSize = 32
|
||||
// versionFieldSize is the length of `Version` File header field in bytes.
|
||||
versionFieldSize = 16
|
||||
)
|
||||
|
||||
// File represents compiled contract file structure according to the NEF3 standard.
|
||||
|
@ -60,7 +58,7 @@ func NewFile(script []byte) (*File, error) {
|
|||
},
|
||||
Script: script,
|
||||
}
|
||||
if len(config.Version) > versionFieldSize {
|
||||
if len(config.Version) > compilerFieldSize {
|
||||
return nil, errors.New("too long version")
|
||||
}
|
||||
file.Checksum = file.CalculateChecksum()
|
||||
|
@ -77,7 +75,6 @@ func (h *Header) EncodeBinary(w *io.BinWriter) {
|
|||
var b = make([]byte, compilerFieldSize)
|
||||
copy(b, []byte(h.Compiler))
|
||||
w.WriteBytes(b)
|
||||
b = b[:versionFieldSize]
|
||||
for i := range b {
|
||||
b[i] = 0
|
||||
}
|
||||
|
@ -98,7 +95,7 @@ func (h *Header) DecodeBinary(r *io.BinReader) {
|
|||
return r == 0
|
||||
})
|
||||
h.Compiler = string(buf)
|
||||
buf = buf[:versionFieldSize]
|
||||
buf = buf[:compilerFieldSize]
|
||||
r.ReadBytes(buf)
|
||||
buf = bytes.TrimRightFunc(buf, func(r rune) bool {
|
||||
return r == 0
|
||||
|
|
Loading…
Reference in a new issue