From e702a1611b1a81f95a539c1e672c1db4ba47f6dd Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 6 Jul 2022 15:44:19 +0300 Subject: [PATCH 1/3] - new go.mod + integration test --- go.mod | 2 + go.sum | 2 + integrationTests/vm/txsFee/asyncESDT_test.go | 50 ++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/go.mod b/go.mod index 811ae38b0ee..c6cdb80bc4c 100644 --- a/go.mod +++ b/go.mod @@ -55,3 +55,5 @@ replace github.com/ElrondNetwork/arwen-wasm-vm/v1_2 v1.2.40 => github.com/Elrond replace github.com/ElrondNetwork/arwen-wasm-vm/v1_3 v1.3.40 => github.com/ElrondNetwork/arwen-wasm-vm v1.3.40 replace github.com/ElrondNetwork/arwen-wasm-vm/v1_4 v1.4.54-rc2 => github.com/ElrondNetwork/arwen-wasm-vm v1.4.54-rc2 + +replace github.com/ElrondNetwork/elrond-vm-common v1.3.6 => github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870 diff --git a/go.sum b/go.sum index 3c7b1193d62..ef9d3e80c99 100644 --- a/go.sum +++ b/go.sum @@ -75,6 +75,8 @@ github.com/ElrondNetwork/elrond-vm-common v1.2.9/go.mod h1:B/Y8WiqHyDd7xsjNYsaYb github.com/ElrondNetwork/elrond-vm-common v1.3.4/go.mod h1:B/Y8WiqHyDd7xsjNYsaYbVMp1jQgQ+z4jTJkFvj/EWI= github.com/ElrondNetwork/elrond-vm-common v1.3.6 h1:4wr26EVIMAu7pJ197EkAqa1NYoVYiAJ3Z11UcQyc+cg= github.com/ElrondNetwork/elrond-vm-common v1.3.6/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= +github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870 h1:hySHmw9hZaCmQSnr173M7Ydpdt5a07OPcON800XOyZ4= +github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1 h1:Nu/uwYQg/QbfoQ0uD6GahYTwgtAkAwtzsB0HVfSP58I= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1/go.mod h1:pJfaShe+i5aWZx8NhSkQjvOYQYLoqPztmFUlKjToOzM= github.com/ElrondNetwork/protobuf v1.3.2 h1:qoCSYiO+8GtXBEZWEjw0WPcZfM3g7QuuJrwpN+y6Mvg= diff --git a/integrationTests/vm/txsFee/asyncESDT_test.go b/integrationTests/vm/txsFee/asyncESDT_test.go index 8ae9ddabf3b..6289be465a6 100644 --- a/integrationTests/vm/txsFee/asyncESDT_test.go +++ b/integrationTests/vm/txsFee/asyncESDT_test.go @@ -397,3 +397,53 @@ func TestAsyncMultiTransferOnCallAndOnCallback(t *testing.T) { utils.CheckESDTNFTBalance(t, testContext, forwarderAddr, sftTokenID, 2, halfBalance) utils.CheckESDTNFTBalance(t, testContext, forwarderAddr, sftTokenID, 3, halfBalance) } + +func TestSendNFTToContractWith0Function(t *testing.T) { + testContext, err := vm.CreatePreparedTxProcessorWithVMs(config.EnableEpochs{}) + require.Nil(t, err) + defer testContext.Close() + + ownerAddr := []byte("12345678901234567890123456789010") + sftTokenID := []byte("SFT-123456") + sftNonce := uint64(1) + sftBalance := big.NewInt(1000) + + utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance) + utils.CheckESDTNFTBalance(t, testContext, ownerAddr, sftTokenID, sftNonce, sftBalance) + + gasPrice := uint64(10) + ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr) + deployGasLimit := uint64(1000000) + txGasLimit := uint64(1000000) + + vaultAddr := utils.DoDeploySecond(t, + testContext, + "../esdt/testdata/vault-managed-api.wasm", + ownerAccount, + gasPrice, + deployGasLimit, + nil, + big.NewInt(0), + ) + + // send the tokens to vault + ownerAccount, _ = testContext.Accounts.LoadAccount(ownerAddr) + tx := utils.CreateESDTNFTTransferTx( + ownerAccount.GetNonce(), + ownerAddr, + vaultAddr, + sftTokenID, + sftNonce, + sftBalance, + gasPrice, + txGasLimit, + "", + ) + tx.Data = append(tx.Data, []byte("@")...) + retCode, err := testContext.TxProcessor.ProcessTransaction(tx) + require.Equal(t, vmcommon.Ok, retCode) + require.Nil(t, err) + + _, err = testContext.Accounts.Commit() + require.Nil(t, err) +} From 7ae8f96515c18a0da8a957e8e06f144f8b6b3152 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 6 Jul 2022 18:38:39 +0300 Subject: [PATCH 2/3] - new go.mod --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c6cdb80bc4c..45699d205df 100644 --- a/go.mod +++ b/go.mod @@ -56,4 +56,4 @@ replace github.com/ElrondNetwork/arwen-wasm-vm/v1_3 v1.3.40 => github.com/Elrond replace github.com/ElrondNetwork/arwen-wasm-vm/v1_4 v1.4.54-rc2 => github.com/ElrondNetwork/arwen-wasm-vm v1.4.54-rc2 -replace github.com/ElrondNetwork/elrond-vm-common v1.3.6 => github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870 +replace github.com/ElrondNetwork/elrond-vm-common v1.3.6 => github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636 diff --git a/go.sum b/go.sum index ef9d3e80c99..f545f1254f4 100644 --- a/go.sum +++ b/go.sum @@ -77,6 +77,8 @@ github.com/ElrondNetwork/elrond-vm-common v1.3.6 h1:4wr26EVIMAu7pJ197EkAqa1NYoVY github.com/ElrondNetwork/elrond-vm-common v1.3.6/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870 h1:hySHmw9hZaCmQSnr173M7Ydpdt5a07OPcON800XOyZ4= github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= +github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636 h1:F4KEjjcGzyZy2Eek8EM4M7y6bP7HwyrqrgbptFkQfiU= +github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1 h1:Nu/uwYQg/QbfoQ0uD6GahYTwgtAkAwtzsB0HVfSP58I= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1/go.mod h1:pJfaShe+i5aWZx8NhSkQjvOYQYLoqPztmFUlKjToOzM= github.com/ElrondNetwork/protobuf v1.3.2 h1:qoCSYiO+8GtXBEZWEjw0WPcZfM3g7QuuJrwpN+y6Mvg= From d55a7f9dd22081c7c1a77496e7d3925ca0a74779 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 6 Jul 2022 22:02:44 +0300 Subject: [PATCH 3/3] - new go.mod --- go.mod | 4 +--- go.sum | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 45699d205df..13f93643f18 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/ElrondNetwork/elrond-go-core v1.1.15 github.com/ElrondNetwork/elrond-go-crypto v1.0.1 github.com/ElrondNetwork/elrond-go-logger v1.0.7 - github.com/ElrondNetwork/elrond-vm-common v1.3.6 + github.com/ElrondNetwork/elrond-vm-common v1.3.10 github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1 github.com/beevik/ntp v0.3.0 github.com/btcsuite/btcd v0.22.0-beta @@ -55,5 +55,3 @@ replace github.com/ElrondNetwork/arwen-wasm-vm/v1_2 v1.2.40 => github.com/Elrond replace github.com/ElrondNetwork/arwen-wasm-vm/v1_3 v1.3.40 => github.com/ElrondNetwork/arwen-wasm-vm v1.3.40 replace github.com/ElrondNetwork/arwen-wasm-vm/v1_4 v1.4.54-rc2 => github.com/ElrondNetwork/arwen-wasm-vm v1.4.54-rc2 - -replace github.com/ElrondNetwork/elrond-vm-common v1.3.6 => github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636 diff --git a/go.sum b/go.sum index f545f1254f4..cb7bfd2e45f 100644 --- a/go.sum +++ b/go.sum @@ -73,12 +73,9 @@ github.com/ElrondNetwork/elrond-go-logger v1.0.7/go.mod h1:cBfgx0ST/CJx8jrxJSC5a github.com/ElrondNetwork/elrond-vm-common v1.1.0/go.mod h1:w3i6f8uiuRkE68Ie/gebRcLgTuHqvruJSYrFyZWuLrE= github.com/ElrondNetwork/elrond-vm-common v1.2.9/go.mod h1:B/Y8WiqHyDd7xsjNYsaYbVMp1jQgQ+z4jTJkFvj/EWI= github.com/ElrondNetwork/elrond-vm-common v1.3.4/go.mod h1:B/Y8WiqHyDd7xsjNYsaYbVMp1jQgQ+z4jTJkFvj/EWI= -github.com/ElrondNetwork/elrond-vm-common v1.3.6 h1:4wr26EVIMAu7pJ197EkAqa1NYoVYiAJ3Z11UcQyc+cg= github.com/ElrondNetwork/elrond-vm-common v1.3.6/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= -github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870 h1:hySHmw9hZaCmQSnr173M7Ydpdt5a07OPcON800XOyZ4= -github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706122339-3b8c8e07b870/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= -github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636 h1:F4KEjjcGzyZy2Eek8EM4M7y6bP7HwyrqrgbptFkQfiU= -github.com/ElrondNetwork/elrond-vm-common-ghsa-xw23-hv54-vg9p v1.3.7-0.20220706153722-bc06a3992636/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= +github.com/ElrondNetwork/elrond-vm-common v1.3.10 h1:s7jLzKw6V5bCDx6nImD0c+FQNZvod0RqXLAkl65fcCQ= +github.com/ElrondNetwork/elrond-vm-common v1.3.10/go.mod h1:seROQuR7RJCoCS7mgRXVAlvjztltY1c+UroAgWr/USE= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1 h1:Nu/uwYQg/QbfoQ0uD6GahYTwgtAkAwtzsB0HVfSP58I= github.com/ElrondNetwork/go-libp2p-pubsub v0.6.1-rc1/go.mod h1:pJfaShe+i5aWZx8NhSkQjvOYQYLoqPztmFUlKjToOzM= github.com/ElrondNetwork/protobuf v1.3.2 h1:qoCSYiO+8GtXBEZWEjw0WPcZfM3g7QuuJrwpN+y6Mvg=