Skip to content

Commit

Permalink
update rpc tests (cosmos#276)
Browse files Browse the repository at this point in the history
* update rpc tests

* cleanup

* add log assertion to getTransacionReceipt

* fix queurier_test

* address comment
  • Loading branch information
noot authored May 4, 2020
1 parent 26d4e96 commit ce0feb3
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 158 deletions.
8 changes: 4 additions & 4 deletions rpc/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Backend interface {
PendingTransactions() ([]*Transaction, error)

// Used by log filter
GetTxLogs(txHash common.Hash) ([]*ethtypes.Log, error)
GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)
// TODO: Bloom methods
}

Expand Down Expand Up @@ -154,12 +154,12 @@ func (e *EthermintBackend) getGasLimit() (int64, error) {
return gasLimit, nil
}

// GetTxLogs returns the logs given a transaction hash.
func (e *EthermintBackend) GetTxLogs(txHash common.Hash) ([]*ethtypes.Log, error) {
// GetTransactionLogs returns the logs given a transaction hash.
func (e *EthermintBackend) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) {
// do we need to use the block height somewhere?
ctx := e.cliCtx

res, _, err := ctx.QueryWithData(fmt.Sprintf("custom/%s/%s/%s", types.ModuleName, evm.QueryTxLogs, txHash.Hex()), nil)
res, _, err := ctx.QueryWithData(fmt.Sprintf("custom/%s/%s/%s", types.ModuleName, evm.QueryTransactionLogs, txHash.Hex()), nil)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions rpc/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ func (e *PublicEthAPI) GetCode(address common.Address, blockNumber BlockNumber)
return out.Code, nil
}

// GetTxLogs returns the logs given a transaction hash.
func (e *PublicEthAPI) GetTxLogs(txHash common.Hash) ([]*ethtypes.Log, error) {
return e.backend.GetTxLogs(txHash)
// GetTransactionLogs returns the logs given a transaction hash.
func (e *PublicEthAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) {
return e.backend.GetTransactionLogs(txHash)
}

// Sign signs the provided data using the private key of address via Geth's signature standard.
Expand Down
2 changes: 1 addition & 1 deletion rpc/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (f *Filter) checkMatches(block map[string]interface{}) ([]*ethtypes.Log, er
unfiltered := []*ethtypes.Log{}

for _, tx := range transactions {
logs, err := f.backend.GetTxLogs(common.BytesToHash(tx[:]))
logs, err := f.backend.GetTransactionLogs(common.BytesToHash(tx[:]))
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit ce0feb3

Please sign in to comment.