From d06718e1cbde01cece75a9b3ef4cb36ec66b63c5 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Tue, 9 Mar 2021 13:17:51 +0300 Subject: [PATCH 1/3] core/tests: print hash of the genesis block --- pkg/core/helper_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/core/helper_test.go b/pkg/core/helper_test.go index 40b64f9b5..389a1378b 100644 --- a/pkg/core/helper_test.go +++ b/pkg/core/helper_test.go @@ -304,6 +304,7 @@ func initBasicChain(t *testing.T, bc *Blockchain) { t.Logf("native NEO hash: %v", neoHash) t.Logf("native Policy hash: %v", policyHash) t.Logf("native Notary hash: %v", notaryHash) + t.Logf("Block0 hash: %s", bc.GetHeaderHash(0).StringLE()) priv0 := testchain.PrivateKeyByID(0) priv0ScriptHash := priv0.GetScriptHash() From 3e54b46ffbddcfa4671fdb24c312cd28dc515c3e Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Tue, 9 Mar 2021 13:18:34 +0300 Subject: [PATCH 2/3] rpc/tests: fix verification contract --- pkg/rpc/server/testdata/verification_contract.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/rpc/server/testdata/verification_contract.go b/pkg/rpc/server/testdata/verification_contract.go index 8ebad6985..03e9bb480 100644 --- a/pkg/rpc/server/testdata/verification_contract.go +++ b/pkg/rpc/server/testdata/verification_contract.go @@ -1,7 +1,6 @@ package testdata import ( - "github.com/nspcc-dev/neo-go/pkg/interop/convert" "github.com/nspcc-dev/neo-go/pkg/interop/runtime" "github.com/nspcc-dev/neo-go/pkg/interop/util" ) @@ -11,5 +10,5 @@ import ( func Verify() bool { tx := runtime.GetScriptContainer() addr := util.FromAddress("NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc") - return util.Equals(convert.ToByteArray(tx.Sender), convert.ToByteArray(addr)) + return util.Equals(string(tx.Sender), string(addr)) } From 55009153a904b03d86846afab48246be2eff4ca9 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Tue, 9 Mar 2021 13:17:21 +0300 Subject: [PATCH 3/3] vm/emit: emit Boolean values correctly We should convert both `true` and `false` values. --- cli/nep17_test.go | 2 +- cli/testdata/wallet1_solo.json | 2 +- pkg/compiler/binary_expr_test.go | 12 +++++++++++ pkg/compiler/for_test.go | 2 +- pkg/compiler/import_test.go | 2 +- pkg/rpc/server/server_test.go | 8 ++++---- pkg/rpc/server/testdata/testblocks.acc | Bin 9869 -> 9881 bytes pkg/vm/emit/emit.go | 4 ++-- pkg/vm/emit/emit_test.go | 27 ++++++++++++++++--------- 9 files changed, 39 insertions(+), 20 deletions(-) diff --git a/cli/nep17_test.go b/cli/nep17_test.go index 3341b35a2..3994b318a 100644 --- a/cli/nep17_test.go +++ b/cli/nep17_test.go @@ -85,7 +85,7 @@ func TestNEP17Balance(t *testing.T) { } e.checkNextLine(t, "^\\s*$") - addr4, err := address.StringToUint160("NbxpLNCCSWZ9BkYpCYT8NfN1uoxq9Rfbrn") // deployed verify.go contract + addr4, err := address.StringToUint160("NWTDxsHVde5qSjRkTRUAg6i8xC3JSWEC9k") // deployed verify.go contract require.NoError(t, err) e.checkNextLine(t, "^Account "+address.Uint160ToString(addr4)) e.checkEOF(t) diff --git a/cli/testdata/wallet1_solo.json b/cli/testdata/wallet1_solo.json index 764d94cfa..050459eb0 100644 --- a/cli/testdata/wallet1_solo.json +++ b/cli/testdata/wallet1_solo.json @@ -61,7 +61,7 @@ "isdefault": false }, { - "address" : "NbxpLNCCSWZ9BkYpCYT8NfN1uoxq9Rfbrn", + "address" : "NWTDxsHVde5qSjRkTRUAg6i8xC3JSWEC9k", "key" : "6PYXDze5Ak4HahYKygcNzk6n65ACjWdDCYLSuKgA5KG8vyMJSFboUNSiPD", "label" : "", "contract" : { diff --git a/pkg/compiler/binary_expr_test.go b/pkg/compiler/binary_expr_test.go index 22bafd8a7..0afb2bcc2 100644 --- a/pkg/compiler/binary_expr_test.go +++ b/pkg/compiler/binary_expr_test.go @@ -361,3 +361,15 @@ func TestShortCircuit(t *testing.T) { eval(t, src, big.NewInt(17)) }) } + +func TestEmitBoolean(t *testing.T) { + src := `package foo + func Main() int { + a := true + if (a == true) == true { + return 42 + } + return 11 + }` + eval(t, src, big.NewInt(42)) +} diff --git a/pkg/compiler/for_test.go b/pkg/compiler/for_test.go index f2995cc3c..ab2a29fbe 100644 --- a/pkg/compiler/for_test.go +++ b/pkg/compiler/for_test.go @@ -209,7 +209,7 @@ func TestBoolAssign(t *testing.T) { return x } ` - eval(t, src, big.NewInt(1)) + eval(t, src, true) } func TestBoolCompare(t *testing.T) { diff --git a/pkg/compiler/import_test.go b/pkg/compiler/import_test.go index c72097a56..9080209f4 100644 --- a/pkg/compiler/import_test.go +++ b/pkg/compiler/import_test.go @@ -46,7 +46,7 @@ func TestMultipleDirFileImport(t *testing.T) { return ok } ` - eval(t, src, big.NewInt(1)) + eval(t, src, true) } func TestImportNameSameAsOwn(t *testing.T) { diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index c643aa790..9c90f3fdd 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -59,9 +59,9 @@ type rpcTestCase struct { check func(t *testing.T, e *executor, result interface{}) } -const testContractHash = "c6436aab21ebd15279b85af8d7b5808d38455b0a" -const deploymentTxHash = "050e2189d7cd7b719d9c4bbc525d3edcd89ffedb28cc974862d17dda14377612" -const genesisBlockHash = "41d1099030004d60f3b4b7ffe00bf184e84fac3a39ee7136c761e005f0186d93" +const testContractHash = "500858b96054d3c302078882c30e76915aac1c83" +const deploymentTxHash = "fbea49056332ecf1482568e24ed745151ed3fcacbb59afc22d9baff5346e6257" +const genesisBlockHash = "0542f4350c6e236d0509bcd98188b0034bfbecc1a0c7fcdb8e4295310d468b70" const verifyContractHash = "03ffc0897543b9b709e0f8cab4a7682dae0ba943" const verifyContractAVM = "570300412d51083021700c14aa8acf859d4fe402b34e673f2156821796a488ebdb30716813cedb2869db289740" @@ -1598,7 +1598,7 @@ func checkNep17Balances(t *testing.T, e *executor, acc interface{}) { }, { Asset: e.chain.UtilityTokenHash(), - Amount: "78994306100", + Amount: "78994294100", LastUpdated: 8, }}, Address: testchain.PrivateKeyByID(0).GetScriptHash().StringLE(), diff --git a/pkg/rpc/server/testdata/testblocks.acc b/pkg/rpc/server/testdata/testblocks.acc index b7bdeaecce5a51549f4d8c9e71c717ad1308b6e3..6fc740d620562b196e3bc8475ad58b4e524119ad 100644 GIT binary patch delta 3684 zcmc(hXH=8hwuVU%Ny0}*dKD4rDAEk&ql7BGOA!J=3B9Y-2vH;$$_Faai+}As%rWLO-}hbXwn?T*%6U3MO9bbYR12XP z{z+C8;!Wocn&HEU+*99%V%7~=*CwsV9VtTM+{_2<X71A=w{K zZz-Ch?^%r{EHjN+0^nb9RDG@Bk(!B=qWv+(8wCsRw^w+&IKsKqJVwKLnahbj*DOp+ zndLk3=HM@vw@_VaHhvPNXJ2thD^}BCvd-ZE(6oEwdxiY<8*?;O%~jsnUYLw)u2Qr& zHDuvx8LLmF$s9fcCK;!`HS_02g>}5%m}UU`$mQ2r?2-*y$Q><62FQ&&1M)t`P(1`2 zrnP_&G>2z4Df(SFA_wxjMw=G@;(`t5{PCaSGtXCAu2XeeD0D_@Mg0`TOvgNx+zMwh*b*YpQH-vTmX zfAqv7G^&V$E2)`0)}gr$&Q70pjkZqjLX&Dx|z)>hRn_^w_5F*E88fPPgcbo-U^ zHu=JX!$Nf}Z%f>Xto9X37(kts4Z2}DSm>t&)8y>}D9PVf>*@wL;T~BxC*GQsoV?CF z3!*Ul)>i?rv|>U9J<>#7qp>o$`eV*`Kvk8kIqGCc^JcE&>o>HIY1~ihbkZk&o5$?1 z!tOK$P>BOhv^`VSc;-M(-iyT4U!d}#tMmY^MvMf+!XtQuhGt(JdPFY^g`zlMXQ4z? z1QdZlK|=@*m?E@*ph9Ex9B>6is0AqmF(QPaedIB?f;_~5a)V?LT=28<|9eA3m_g-8 zHrN^HIZ_ew=Z~Oelz>BD`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