From c7a865c3ca3e7ea4c9de37b6c2252bd04f460381 Mon Sep 17 00:00:00 2001 From: Florian Lenz Date: Fri, 28 Sep 2018 08:32:37 -0700 Subject: [PATCH] [tests] fixed api test --- api/dapp.go | 5 +++-- bip32/bip32_test.go | 8 ++++---- db/bolt_to_storm.go | 1 - documents/call.go | 9 ++++----- keyManager/keyManager.go | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/api/dapp.go b/api/dapp.go index 1c92ada..aa03883 100644 --- a/api/dapp.go +++ b/api/dapp.go @@ -66,15 +66,16 @@ func (a *DAppApi) SendEthereumTransaction(value, to, data string) (string, error objTx := map[string]interface{}{ "nonce": ethTx.Nonce, "gasPrice": ethTx.GasPrice, - "gas": ethTx.GasLimit, + "gasLimit": ethTx.GasLimit, "to": ethTx.To, "value": ethTx.Value, - "input": ethTx.Data, + "data": ethTx.Data, "v": ethTx.V, "r": ethTx.R, "s": ethTx.S, "from": ethTx.From, "hash": ethTx.Hash, + "chainId": ethTx.ChainID, } raw, err := json.Marshal(objTx) diff --git a/bip32/bip32_test.go b/bip32/bip32_test.go index 3bd6422..223c6c5 100644 --- a/bip32/bip32_test.go +++ b/bip32/bip32_test.go @@ -132,10 +132,10 @@ func TestKeyDerivation(t *testing.T) { //Test vector set one testVectorErrorMapping := map[string]int{ - "m/0H/1": 1, - "m/0H/1/2H": 1, - "m/0H/1/2H/2": 1, - "m/0H/1/2H/2/1000000000": 1, + "m/0H/1": 1, + "m/0H/1/2H": 1, + "m/0H/1/2H/2": 1, + "m/0H/1/2H/2/1000000000": 1, "m/0": 0, "m/0/2147483647H": 0, "m/0/2147483647H/1": 0, diff --git a/db/bolt_to_storm.go b/db/bolt_to_storm.go index 978c490..e083294 100644 --- a/db/bolt_to_storm.go +++ b/db/bolt_to_storm.go @@ -6,7 +6,6 @@ import ( "errors" "time" - aes "github.com/Bit-Nation/panthalassa/crypto/aes" keyManager "github.com/Bit-Nation/panthalassa/keyManager" queue "github.com/Bit-Nation/panthalassa/queue" diff --git a/documents/call.go b/documents/call.go index 51c36a2..336f3e5 100644 --- a/documents/call.go +++ b/documents/call.go @@ -226,23 +226,22 @@ func (d *DocumentSubmitCall) Handle(data map[string]interface{}) (map[string]int if err := d.s.db.One("ID", int(docID), &doc); err != nil { return map[string]interface{}{}, err } - + // decrypt document content docContent, err := d.km.AESDecrypt(doc.EncryptedContent) if err != nil { return map[string]interface{}{}, err } - + // assign plain document content doc.Content = docContent - - + // hash document docHash, err := mh.Sum(doc.Content, mh.SHA2_256, -1) if err != nil { return map[string]interface{}{}, err } - + docContentCID := cid.NewCidV1(cid.Raw, docHash).Bytes() // attach cid to document diff --git a/keyManager/keyManager.go b/keyManager/keyManager.go index d3407a2..bd3aefa 100644 --- a/keyManager/keyManager.go +++ b/keyManager/keyManager.go @@ -328,7 +328,7 @@ func (km KeyManager) SignEthTx(signer types.Signer, addresses common.Address, tx } // convert gas - txMap["gas"], err = numToHex(txMap, "gas") + txMap["gas"], err = numToHex(txMap, "gasLimit") if err != nil { return nil, err }