From 167288712335e555c3dfc1f59f561250047e3888 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 30 Nov 2020 11:26:29 +0300 Subject: [PATCH] nef: increase version field to 32 bytes Follow recent C# changes. --- cli/testdata/verify.nef | Bin 66 -> 82 bytes pkg/rpc/server/server_test.go | 4 ++-- pkg/rpc/server/testdata/testblocks.acc | Bin 7490 -> 7522 bytes pkg/smartcontract/nef/nef.go | 11 ++++------- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cli/testdata/verify.nef b/cli/testdata/verify.nef index f8bf2ff484af657cb2466fb260319611cd3feac5..5bb3c8bbe40518db36efb14d911e84b0a574ee9e 100755 GIT binary patch delta 51 zcmZm7st(zZH8v-%M6lbsIiqWmKhA$cakk+tSS4>SVFSIp`Mvrl#8OicA>wk zOV^Uz5L5Q?c)v#n?p~F=*B}Ae;)NZpVZ73ccfichdx0_&qlphl)XzQVn*}F1baeHh zI8TFgu(n{<-nF{BOZ{bHf3I7*7t)_Il>3B8Uu{wgM!)afx(r@5-xfn1mJ8wVje24P zu%*oNpIp7#q(ZHrGj&kh-O_kh+7UVHZ?DlG(4@JBq+PCVu%pKJ8Ib7GU|smavB++V z{=xX>XE(>2PSWgJcrR^G8vbSs)(Ua!BCjnkP|BA>?go9PHRWcc`I9XqHcoefb^6|` zn9%o6U8m*j!K>dpV#Zi3g9M!fYO?4us30Zq-QgA4x><>)czGoO)pev(U*fCwWd6+J zkoo)B7@i;y4GkEmhw&2`Xj)@j&P((K1*teblQwhXXDb<6P+zbYzb;-5%fZ?`FT(iC zhFd46DpRML?I24Q#T&DHSifp-^wS$s6s#f?r&0{c7~*W7b(>?W*-bIriF`1MiGR5X zS^hi}X|gvA={j=TiuUTV&EgSW$8(gweQrWXd^T%~zl0qAZm4yiIUb6erYqze*SR|% zhFcr_xePjPc)3exzfS%gy>gY{XeQeFwwH- zS{5EK;DHc<$Ve&4NXeiB2>t2qp1jK7315=L~mZN+u`9A-}Nlpa$(q0LEE_=#o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#o7ticfyj`goH2MvXjsj=+71OR7&uJ)wbdl@pmG z*WGlbUK7%|u&n>;jO(|~mQ*dIDico(1Do{GAs{^OR`zNIvhMZMQbq|PJL_dT^7b13 zuI^rIYIc6Ol$&#?)9^{%#Aj==GByj-W@~5nb@l|DUTJ>g?S96YWlb~pC>XT@e?;^t zsY~mw#7$33rHq;zi%CO?A~7y`nVaz95*gxE(`|>w)QiG)+mSd~-fjT9O|MRpaml2- zZ6L^3e%SJ-9wQP7<#5SsDMgyR3}lM)y9~<(<*uWTm5+34?2X7E^lFZyop*vnD!*q0(q z%rVNc7fU5tzm8jEr7q)}rp7*=Hyo)5(SHqp6%0qPARhmBI9P<#x 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