Skip to content

Commit

Permalink
Merge pull request from GHSA-qf7j-25g9-r63f
Browse files Browse the repository at this point in the history
Extra check in vm-common
  • Loading branch information
iulianpascalau authored Jul 6, 2022
2 parents 84c9960 + d55a7f9 commit cb487fd
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +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 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=
Expand Down
50 changes: 50 additions & 0 deletions integrationTests/vm/txsFee/asyncESDT_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit cb487fd

Please sign in to comment.