forked from cerc-io/laconicd-deprecated
conflicts
This commit is contained in:
@@ -34,8 +34,11 @@ func TestPersonal_NewAccount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPersonal_Sign(t *testing.T) {
|
||||
rpcRes := Call(t, "personal_sign", []interface{}{hexutil.Bytes{0x88}, hexutil.Bytes(from), ""})
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{hexutil.Bytes(from), ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "personal_sign", []interface{}{hexutil.Bytes{0x88}, hexutil.Bytes(from), ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
var res hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &res)
|
||||
require.NoError(t, err)
|
||||
|
||||
+57
-53
@@ -1,9 +1,8 @@
|
||||
// This is a test utility for Ethermint's Web3 JSON-RPC services.
|
||||
//
|
||||
// To run these tests please first ensure you have the ethermintd running
|
||||
// and have started the RPC service with `ethermintcli rest-server`.
|
||||
//
|
||||
// You can configure the desired HOST and MODE as well
|
||||
// You can configure the desired HOST and MODE as well in integration-test-all.sh
|
||||
package tests
|
||||
|
||||
import (
|
||||
@@ -55,6 +54,33 @@ func TestMain(m *testing.M) {
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func TestEth_GetTransactionCount(t *testing.T) {
|
||||
// TODO: this test passes on when run on its own, but fails when run with the other tests
|
||||
if testing.Short() {
|
||||
t.Skip("skipping TestEth_GetTransactionCount")
|
||||
}
|
||||
|
||||
prev := GetNonce(t, "latest")
|
||||
SendTestTransaction(t, from)
|
||||
time.Sleep(20 * time.Second)
|
||||
post := GetNonce(t, "latest")
|
||||
require.Equal(t, prev, post-1)
|
||||
}
|
||||
|
||||
func TestEth_GetLogs_NoLogs(t *testing.T) {
|
||||
param := make([]map[string][]string, 1)
|
||||
param[0] = make(map[string][]string)
|
||||
param[0]["topics"] = []string{}
|
||||
rpcRes := Call(t, "eth_getLogs", param)
|
||||
require.NotNil(t, rpcRes)
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
var logs []*ethtypes.Log
|
||||
err := json.Unmarshal(rpcRes.Result, &logs)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, logs) // begin, end are -1, crit.Addresses, crit.Topics are empty array, so no log should be returned(run this test before anyone else so that log will be empty)
|
||||
}
|
||||
|
||||
func TestBlockBloom(t *testing.T) {
|
||||
hash := DeployTestContractWithFunction(t, from)
|
||||
receipt := WaitForReceipt(t, hash)
|
||||
@@ -72,20 +98,6 @@ func TestBlockBloom(t *testing.T) {
|
||||
require.Equal(t, hash.String(), block["transactions"].([]interface{})[0])
|
||||
}
|
||||
|
||||
func TestEth_GetLogs_NoLogs(t *testing.T) {
|
||||
param := make([]map[string][]string, 1)
|
||||
param[0] = make(map[string][]string)
|
||||
param[0]["topics"] = []string{}
|
||||
rpcRes := Call(t, "eth_getLogs", param)
|
||||
require.NotNil(t, rpcRes)
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
var logs []*ethtypes.Log
|
||||
err := json.Unmarshal(rpcRes.Result, &logs)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, logs)
|
||||
}
|
||||
|
||||
func TestEth_GetLogs_Topics_AB(t *testing.T) {
|
||||
// TODO: this test passes on when run on its own, but fails when run with the other tests
|
||||
if testing.Short() {
|
||||
@@ -115,18 +127,6 @@ func TestEth_GetLogs_Topics_AB(t *testing.T) {
|
||||
require.Equal(t, 1, len(logs))
|
||||
}
|
||||
|
||||
func TestEth_GetTransactionCount(t *testing.T) {
|
||||
// TODO: this test passes on when run on its own, but fails when run with the other tests
|
||||
if testing.Short() {
|
||||
t.Skip("skipping TestEth_GetTransactionCount")
|
||||
}
|
||||
|
||||
prev := GetNonce(t, "latest")
|
||||
SendTestTransaction(t, from)
|
||||
post := GetNonce(t, "latest")
|
||||
require.Equal(t, prev, post-1)
|
||||
}
|
||||
|
||||
func TestEth_GetTransactionLogs(t *testing.T) {
|
||||
// TODO: this test passes on when run on its own, but fails when run with the other tests
|
||||
if testing.Short() {
|
||||
@@ -205,7 +205,8 @@ func TestEth_GetBalance(t *testing.T) {
|
||||
|
||||
func TestEth_GetStorageAt(t *testing.T) {
|
||||
expectedRes := hexutil.Bytes{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
rpcRes := Call(t, "eth_getStorageAt", []string{addrA, fmt.Sprint(addrAStoreKey), zeroString})
|
||||
testKey := 1 // using 0 as key here will create an ethereum empty hash which is considered as invalid hash
|
||||
rpcRes := Call(t, "eth_getStorageAt", []string{addrA, fmt.Sprint(testKey), "0x3"})
|
||||
|
||||
var storage hexutil.Bytes
|
||||
err := storage.UnmarshalJSON(rpcRes.Result)
|
||||
@@ -220,7 +221,8 @@ func TestEth_GetProof(t *testing.T) {
|
||||
params := make([]interface{}, 3)
|
||||
params[0] = addrA
|
||||
params[1] = []string{fmt.Sprint(addrAStoreKey)}
|
||||
params[2] = "latest"
|
||||
params[2] = "0x3" // queries at height <= 2 are not supported
|
||||
|
||||
rpcRes := Call(t, "eth_getProof", params)
|
||||
require.NotNil(t, rpcRes)
|
||||
|
||||
@@ -255,7 +257,10 @@ func TestEth_SendTransaction_Transfer(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x55ae82600"
|
||||
|
||||
rpcRes := Call(t, "eth_sendTransaction", param)
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "eth_sendTransaction", param)
|
||||
|
||||
var hash hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &hash)
|
||||
@@ -272,7 +277,10 @@ func TestEth_SendTransaction_ContractDeploy(t *testing.T) {
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||
param[0]["data"] = "0x6080604052348015600f57600080fd5b5060117f775a94827b8fd9b519d36cd827093c664f93347070a554f65e4a6f56cd73889860405160405180910390a2603580604b6000396000f3fe6080604052600080fdfea165627a7a723058206cab665f0f557620554bb45adf266708d2bd349b8a4314bdff205ee8440e3c240029"
|
||||
|
||||
rpcRes := Call(t, "eth_sendTransaction", param)
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "eth_sendTransaction", param)
|
||||
|
||||
var hash hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &hash)
|
||||
@@ -369,12 +377,15 @@ func TestEth_GetTransactionReceipt(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEth_GetTransactionReceipt_ContractDeployment(t *testing.T) {
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{hexutil.Bytes(from), ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
hash, _ := DeployTestContract(t, from)
|
||||
|
||||
time.Sleep(time.Second * 5)
|
||||
|
||||
param := []string{hash.String()}
|
||||
rpcRes := Call(t, "eth_getTransactionReceipt", param)
|
||||
rpcRes = Call(t, "eth_getTransactionReceipt", param)
|
||||
|
||||
receipt := make(map[string]interface{})
|
||||
err := json.Unmarshal(rpcRes.Result, &receipt)
|
||||
@@ -410,11 +421,7 @@ func TestEth_GetFilterChanges_NoTopics(t *testing.T) {
|
||||
|
||||
// get filter changes
|
||||
changesRes := Call(t, "eth_getFilterChanges", []string{ID})
|
||||
|
||||
var logs []*ethtypes.Log
|
||||
err = json.Unmarshal(changesRes.Result, &logs)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Equal(t, 2, len(changesRes.Result))
|
||||
}
|
||||
|
||||
func TestEth_GetFilterChanges_Addresses(t *testing.T) {
|
||||
@@ -458,12 +465,7 @@ func TestEth_GetFilterChanges_Topics_AB(t *testing.T) {
|
||||
|
||||
// get filter changes
|
||||
changesRes := Call(t, "eth_getFilterChanges", []string{ID})
|
||||
|
||||
var logs []*ethtypes.Log
|
||||
err = json.Unmarshal(changesRes.Result, &logs)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Equal(t, 2, len(changesRes.Result))
|
||||
}
|
||||
|
||||
func TestEth_GetFilterChanges_Topics_XB(t *testing.T) {
|
||||
@@ -488,12 +490,7 @@ func TestEth_GetFilterChanges_Topics_XB(t *testing.T) {
|
||||
|
||||
// get filter changes
|
||||
changesRes := Call(t, "eth_getFilterChanges", []string{ID})
|
||||
|
||||
var logs []*ethtypes.Log
|
||||
err = json.Unmarshal(changesRes.Result, &logs)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Equal(t, 2, len(changesRes.Result))
|
||||
}
|
||||
|
||||
func TestEth_GetFilterChanges_Topics_XXC(t *testing.T) {
|
||||
@@ -532,7 +529,11 @@ func TestEth_EstimateGas(t *testing.T) {
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||
param[0]["to"] = "0x1122334455667788990011223344556677889900"
|
||||
param[0]["value"] = "0x1"
|
||||
rpcRes := Call(t, "eth_estimateGas", param)
|
||||
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.NotNil(t, rpcRes)
|
||||
|
||||
rpcRes = Call(t, "eth_estimateGas", param)
|
||||
require.NotNil(t, rpcRes)
|
||||
require.NotEmpty(t, rpcRes.Result)
|
||||
|
||||
@@ -540,7 +541,7 @@ func TestEth_EstimateGas(t *testing.T) {
|
||||
err := json.Unmarshal(rpcRes.Result, &gas)
|
||||
require.NoError(t, err, string(rpcRes.Result))
|
||||
|
||||
require.Equal(t, "0xf560", gas)
|
||||
require.Equal(t, "0xfab9", gas)
|
||||
}
|
||||
|
||||
func TestEth_EstimateGas_ContractDeployment(t *testing.T) {
|
||||
@@ -558,6 +559,9 @@ func TestEth_EstimateGas_ContractDeployment(t *testing.T) {
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||
param[0]["data"] = bytecode
|
||||
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.NotNil(t, rpcRes)
|
||||
|
||||
rpcRes = Call(t, "eth_estimateGas", param)
|
||||
require.NotNil(t, rpcRes)
|
||||
require.NotEmpty(t, rpcRes.Result)
|
||||
@@ -566,7 +570,7 @@ func TestEth_EstimateGas_ContractDeployment(t *testing.T) {
|
||||
err := json.Unmarshal(rpcRes.Result, &gas)
|
||||
require.NoError(t, err, string(rpcRes.Result))
|
||||
|
||||
require.Equal(t, "0x1a738", gas.String())
|
||||
require.Equal(t, "0x1ab8d", gas.String())
|
||||
}
|
||||
|
||||
func TestEth_GetBlockByNumber(t *testing.T) {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// This is a test utility for Ethermint's Web3 JSON-RPC services.
|
||||
//
|
||||
// To run these tests please first ensure you have the ethermintd running
|
||||
// and have started the RPC service with `ethermintcli rest-server`.
|
||||
//
|
||||
// You can configure the desired HOST and MODE as well
|
||||
// You can configure the desired HOST and MODE as well in integration-test-all.sh
|
||||
package pending
|
||||
|
||||
import (
|
||||
@@ -13,10 +12,9 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
rpctypes "github.com/cosmos/ethermint/rpc/types"
|
||||
util "github.com/cosmos/ethermint/tests"
|
||||
@@ -92,6 +90,9 @@ func TestEth_Pending_GetBalance(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
rpcRes = util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
@@ -118,6 +119,7 @@ func TestEth_Pending_GetTransactionCount(t *testing.T) {
|
||||
|
||||
currentNonce := util.GetNonce(t, "latest")
|
||||
t.Logf("Current nonce is %d", currentNonce)
|
||||
require.Equal(t, prePendingNonce, currentNonce)
|
||||
|
||||
param := make([]map[string]string, 1)
|
||||
param[0] = make(map[string]string)
|
||||
@@ -127,17 +129,20 @@ func TestEth_Pending_GetTransactionCount(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
|
||||
txRes := util.Call(t, "eth_sendTransaction", param)
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
txRes = util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
pendingNonce := util.GetNonce(t, "pending")
|
||||
latestNonce := util.GetNonce(t, "latest")
|
||||
t.Logf("Latest nonce is %d", latestNonce)
|
||||
require.Equal(t, currentNonce, latestNonce)
|
||||
t.Logf("Pending nonce is %d", pendingNonce)
|
||||
require.NotEqual(t, latestNonce, pendingNonce)
|
||||
|
||||
require.Greater(t, uint64(pendingNonce), uint64(latestNonce))
|
||||
t.Logf("Latest nonce is %d", latestNonce)
|
||||
require.Equal(t, currentNonce+1, latestNonce)
|
||||
|
||||
t.Logf("Pending nonce is %d", pendingNonce)
|
||||
require.Equal(t, latestNonce, pendingNonce)
|
||||
|
||||
require.Equal(t, uint64(prePendingNonce)+uint64(1), uint64(pendingNonce))
|
||||
}
|
||||
|
||||
@@ -154,6 +159,8 @@ func TestEth_Pending_GetBlockTransactionCountByNumber(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
t.Logf("Pre tx latest nonce is %d", preTxLatestTxCount)
|
||||
|
||||
require.Equal(t, preTxPendingTxCount, preTxLatestTxCount)
|
||||
|
||||
param := make([]map[string]string, 1)
|
||||
param[0] = make(map[string]string)
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||
@@ -162,7 +169,10 @@ func TestEth_Pending_GetBlockTransactionCountByNumber(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
|
||||
txRes := util.Call(t, "eth_sendTransaction", param)
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
txRes = util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
rpcRes = util.Call(t, "eth_getBlockTransactionCountByNumber", []interface{}{"pending"})
|
||||
@@ -177,8 +187,10 @@ func TestEth_Pending_GetBlockTransactionCountByNumber(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
t.Logf("Post tx latest nonce is %d", postTxLatestTxCount)
|
||||
|
||||
require.Equal(t, uint64(preTxPendingTxCount)+uint64(1), uint64(postTxPendingTxCount))
|
||||
require.NotEqual(t, uint64(postTxPendingTxCount)-uint64(preTxPendingTxCount), uint64(postTxLatestTxCount)-uint64(preTxLatestTxCount))
|
||||
require.Equal(t, postTxPendingTxCount, postTxLatestTxCount)
|
||||
|
||||
require.Equal(t, uint64(preTxPendingTxCount), uint64(postTxPendingTxCount))
|
||||
require.Equal(t, uint64(postTxPendingTxCount)-uint64(preTxPendingTxCount), uint64(postTxLatestTxCount)-uint64(preTxLatestTxCount))
|
||||
}
|
||||
|
||||
func TestEth_Pending_GetBlockByNumber(t *testing.T) {
|
||||
@@ -202,7 +214,9 @@ func TestEth_Pending_GetBlockByNumber(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
|
||||
txRes := util.Call(t, "eth_sendTransaction", param)
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
txRes = util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
rpcRes = util.Call(t, "eth_getBlockByNumber", []interface{}{"pending", true})
|
||||
@@ -210,7 +224,7 @@ func TestEth_Pending_GetBlockByNumber(t *testing.T) {
|
||||
err = json.Unmarshal(rpcRes.Result, &postTxPendingBlock)
|
||||
require.NoError(t, err)
|
||||
postTxPendingTxs := len(postTxPendingBlock["transactions"].([]interface{}))
|
||||
require.Greater(t, postTxPendingTxs, preTxPendingTxs)
|
||||
require.Equal(t, postTxPendingTxs, preTxPendingTxs)
|
||||
|
||||
rpcRes = util.Call(t, "eth_getBlockByNumber", []interface{}{"latest", true})
|
||||
var postTxLatestBlock map[string]interface{}
|
||||
@@ -219,7 +233,7 @@ func TestEth_Pending_GetBlockByNumber(t *testing.T) {
|
||||
postTxLatestTxs := len(postTxLatestBlock["transactions"].([]interface{}))
|
||||
require.Equal(t, preTxLatestTxs, postTxLatestTxs)
|
||||
|
||||
require.Greater(t, postTxPendingTxs, preTxPendingTxs)
|
||||
require.Equal(t, postTxPendingTxs, preTxPendingTxs)
|
||||
}
|
||||
|
||||
func TestEth_Pending_GetTransactionByBlockNumberAndIndex(t *testing.T) {
|
||||
@@ -239,26 +253,33 @@ func TestEth_Pending_GetTransactionByBlockNumberAndIndex(t *testing.T) {
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
param[0]["data"] = data
|
||||
|
||||
txRes := util.Call(t, "eth_sendTransaction", param)
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
txRes = util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
rpcRes := util.Call(t, "eth_getTransactionByBlockNumberAndIndex", []interface{}{"pending", "0x" + fmt.Sprintf("%X", pendingTxCount)})
|
||||
var pendingBlockTx map[string]interface{}
|
||||
err = json.Unmarshal(rpcRes.Result, &pendingBlockTx)
|
||||
// test will be blocked here until tx gets confirmed
|
||||
var txHash common.Hash
|
||||
err = json.Unmarshal(txRes.Result, &txHash)
|
||||
require.NoError(t, err)
|
||||
|
||||
rpcRes := util.Call(t, "eth_getTransactionByBlockNumberAndIndex", []interface{}{"latest", "0x" + fmt.Sprintf("%X", pendingTxCount)})
|
||||
var latestBlockTx map[string]interface{}
|
||||
err = json.Unmarshal(rpcRes.Result, &latestBlockTx)
|
||||
require.NoError(t, err)
|
||||
|
||||
// verify the pending tx has all the correct fields from the tx sent.
|
||||
require.NotEmpty(t, pendingBlockTx["hash"])
|
||||
require.Equal(t, pendingBlockTx["value"], "0xa")
|
||||
require.Equal(t, data, pendingBlockTx["input"])
|
||||
require.NotEmpty(t, latestBlockTx["hash"])
|
||||
require.Equal(t, latestBlockTx["value"], "0xa")
|
||||
require.Equal(t, data, latestBlockTx["input"])
|
||||
|
||||
rpcRes = util.Call(t, "eth_getTransactionByBlockNumberAndIndex", []interface{}{"latest", "0x" + fmt.Sprintf("%X", pendingTxCount)})
|
||||
var latestBlock map[string]interface{}
|
||||
err = json.Unmarshal(rpcRes.Result, &latestBlock)
|
||||
rpcRes = util.Call(t, "eth_getTransactionByBlockNumberAndIndex", []interface{}{"pending", "0x" + fmt.Sprintf("%X", pendingTxCount)})
|
||||
var pendingBlock map[string]interface{}
|
||||
err = json.Unmarshal(rpcRes.Result, &pendingBlock)
|
||||
require.NoError(t, err)
|
||||
|
||||
// verify the pending trasnaction does not exist in the latest block info.
|
||||
require.Empty(t, latestBlock)
|
||||
// verify the transaction does not exist in the pending block info.
|
||||
require.Empty(t, pendingBlock)
|
||||
}
|
||||
|
||||
func TestEth_Pending_GetTransactionByHash(t *testing.T) {
|
||||
@@ -272,7 +293,10 @@ func TestEth_Pending_GetTransactionByHash(t *testing.T) {
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
param[0]["data"] = data
|
||||
|
||||
txRes := util.Call(t, "eth_sendTransaction", param)
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
txRes = util.Call(t, "eth_sendTransaction", param)
|
||||
var txHash common.Hash
|
||||
err := txHash.UnmarshalJSON(txRes.Result)
|
||||
require.NoError(t, err)
|
||||
@@ -299,6 +323,9 @@ func TestEth_Pending_SendTransaction_PendingNonce(t *testing.T) {
|
||||
param[0]["gasLimit"] = "0x5208"
|
||||
param[0]["gasPrice"] = "0x1"
|
||||
|
||||
txRes := util.Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, txRes.Error)
|
||||
|
||||
// first transaction
|
||||
txRes1 := util.Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, txRes1.Error)
|
||||
|
||||
+15
-3
@@ -141,7 +141,12 @@ func SendTestTransaction(t *testing.T, addr []byte) hexutil.Bytes {
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", addr)
|
||||
param[0]["to"] = "0x1122334455667788990011223344556677889900"
|
||||
param[0]["value"] = "0x1"
|
||||
rpcRes := Call(t, "eth_sendTransaction", param)
|
||||
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
var hash hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &hash)
|
||||
@@ -157,7 +162,11 @@ func DeployTestContract(t *testing.T, addr []byte) (hexutil.Bytes, map[string]in
|
||||
param[0]["data"] = "0x6080604052348015600f57600080fd5b5060117f775a94827b8fd9b519d36cd827093c664f93347070a554f65e4a6f56cd73889860405160405180910390a2603580604b6000396000f3fe6080604052600080fdfea165627a7a723058206cab665f0f557620554bb45adf266708d2bd349b8a4314bdff205ee8440e3c240029"
|
||||
param[0]["gas"] = "0x200000"
|
||||
|
||||
rpcRes := Call(t, "eth_sendTransaction", param)
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "eth_sendTransaction", param)
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
var hash hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &hash)
|
||||
@@ -197,7 +206,10 @@ func DeployTestContractWithFunction(t *testing.T, addr []byte) hexutil.Bytes {
|
||||
param[0]["data"] = bytecode
|
||||
param[0]["gas"] = "0x200000"
|
||||
|
||||
rpcRes := Call(t, "eth_sendTransaction", param)
|
||||
rpcRes := Call(t, "personal_unlockAccount", []interface{}{param[0]["from"], ""})
|
||||
require.Nil(t, rpcRes.Error)
|
||||
|
||||
rpcRes = Call(t, "eth_sendTransaction", param)
|
||||
|
||||
var hash hexutil.Bytes
|
||||
err := json.Unmarshal(rpcRes.Result, &hash)
|
||||
|
||||
Reference in New Issue
Block a user