diff --git a/account/wallet_test.go b/account/wallet_test.go index 9d7ec27..63ee1ce 100644 --- a/account/wallet_test.go +++ b/account/wallet_test.go @@ -47,7 +47,7 @@ func TestPayload(t *testing.T) { ToAddr: "4BAF5faDA8e5Db92C3d3242618c5B47133AE003C", Amount: "10000000", GasPrice: gasPrice, - GasLimit: "1", + GasLimit: "50", Code: "", Data: "", Priority: false, @@ -71,7 +71,7 @@ func TestWallet_SignWith(t *testing.T) { Version: "65535", Amount: "0", GasPrice: "100000", - GasLimit: "1", + GasLimit: "50", } provider := provider2.NewProvider("https://dev-api.zilliqa.com/") err := wallet.SignWith(tx, "9bfec715a6bd658fcb62b0f8cc9bfa2ade71434a", *provider) @@ -96,7 +96,7 @@ func TestSendTransaction(t *testing.T) { ToAddr: "4BAF5faDA8e5Db92C3d3242618c5B47133AE003C", Amount: "10000000", GasPrice: gasPrice, - GasLimit: "1", + GasLimit: "50", Code: "", Data: "", Priority: false, @@ -131,14 +131,14 @@ func TestBatchSendTransaction(t *testing.T) { assert.Nil(t, err, err) var transactions []*transaction.Transaction - for i := 0; i < 100; i++ { + for i := 0; i < 3; i++ { txn := &transaction.Transaction{ Version: strconv.FormatInt(int64(util.Pack(333, 1)), 10), SenderPubKey: "0246E7178DC8253201101E18FD6F6EB9972451D121FC57AA2A06DD5C111E58DC6A", ToAddr: "4BAF5faDA8e5Db92C3d3242618c5B47133AE003C", Amount: "10000000", GasPrice: gasPrice, - GasLimit: "1", + GasLimit: "50", Code: "", Data: "", Priority: false, @@ -175,7 +175,7 @@ func TestSendTransactionInsufficientAmount(t *testing.T) { ToAddr: "4BAF5faDA8e5Db92C3d3242618c5B47133AE003C", Amount: "2000000000000000000", GasPrice: gasPrice, - GasLimit: "1", + GasLimit: "50", Code: "", Data: "", Priority: false, diff --git a/prover/prover.go b/prover/prover.go index 457460d..3d900e3 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -3,6 +3,7 @@ package prover import ( "errors" "fmt" + "github.com/Zilliqa/gozilliqa-sdk/core" "github.com/Zilliqa/gozilliqa-sdk/mpt" "github.com/Zilliqa/gozilliqa-sdk/provider" @@ -40,7 +41,7 @@ func (p *StateProver) VerifyStateProof(contractAddr string, vname string, indice } db2 := mpt.NewFromProof(proof2) - storageKey := core.GenerateStorageKey(vname, indices) + storageKey := core.GenerateStorageKey(contractAddr, vname, indices) value, err3 := mpt.Verify(storageKey, db2, accountBase.StorageRoot) if err3 != nil { msg := fmt.Sprintf("%s - %s", "get value error", err3.Error()) diff --git a/prover/prover_test.go b/prover/prover_test.go index 96b3c2a..33071e6 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -1,9 +1,10 @@ package prover import ( + "testing" + "github.com/Zilliqa/gozilliqa-sdk/core" "github.com/Zilliqa/gozilliqa-sdk/provider" - "testing" ) func TestStateProver_VerifyStateProof(t *testing.T) { @@ -22,7 +23,8 @@ func TestStateProver_VerifyStateProof(t *testing.T) { t.Log("current block number is: ", blockNum) t.Log("account root hash from tx block: ", accountHash) - stateProof, err := sp.RpcClient.GetStateProof(contractAddr, vname, indices, &blockNum) + storageKey := core.GenerateStorageKey(contractAddr, vname, indices) + stateProof, err := sp.RpcClient.GetStateProof(contractAddr, string(storageKey), &blockNum) if err != nil { t.Fatal(err) }