imp(tests): prune node integration tests (#1212)

* first pass

* extra comment

* fixed pruned node tests. Fix getBalance on pruned. Fix BaseFee on pruned.

* fix tests execution

* check logs on tests

* address pr comments

* address comments

* Update rpc/namespaces/ethereum/eth/api.go

* update error msg check

* fix lint

* fix linter

* fix linter

* fix py lint

* test lint

* fix lint

* pin golangcli version

* pin golanci version

* pin lint to version 0.48

* fix linter

* fix last linter last file

Co-authored-by: ramacarlucho <ramirocarlucho@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Freddy Caceres
2022-08-08 10:17:10 +02:00
committed by GitHub
co-authored by ramacarlucho Federico Kunze Küllmer
parent 7331cd2065
commit ccbaf1fe05
22 changed files with 268 additions and 34 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ import (
)
// BackendI implements the Cosmos and EVM backend.
type BackendI interface { // nolint: revive
type BackendI interface { //nolint: revive
CosmosBackend
EVMBackend
}
+1 -1
View File
@@ -287,7 +287,7 @@ func (a *API) BlockProfile(file string, nsec uint) error {
// CpuProfile turns on CPU profiling for nsec seconds and writes
// profile data to file.
func (a *API) CpuProfile(file string, nsec uint) error { // nolint: golint, stylecheck, revive
func (a *API) CpuProfile(file string, nsec uint) error { //nolint: golint, stylecheck, revive
a.logger.Debug("debug_cpuProfile", "file", file, "nsec", nsec)
if err := a.StartCPUProfile(file); err != nil {
return err
+6 -1
View File
@@ -128,7 +128,7 @@ func (e *PublicAPI) ProtocolVersion() hexutil.Uint {
}
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (e *PublicAPI) ChainId() (*hexutil.Big, error) { // nolint
func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint
e.logger.Debug("eth_chainId")
// if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
bn, err := e.backend.BlockNumber()
@@ -294,6 +294,11 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.Bl
return nil, errors.New("invalid balance")
}
// balance can only be negative in case of pruned node
if val.IsNegative() {
return nil, errors.New("couldn't fetch balance. Node state is pruned")
}
return (*hexutil.Big)(val.BigInt()), nil
}
@@ -48,7 +48,7 @@ func NewRangeFilter(logger log.Logger, backend Backend, begin, end int64, addres
// Flatten the address and topic filter clauses into a single bloombits filter
// system. Since the bloombits are not positional, nil topics are permitted,
// which get flattened into a nil byte slice.
var filtersBz [][][]byte // nolint: prealloc
var filtersBz [][][]byte //nolint: prealloc
if len(addresses) > 0 {
filter := make([][]byte, len(addresses))
for i, address := range addresses {
+3 -3
View File
@@ -15,9 +15,9 @@ import (
)
// QueryClient defines a gRPC Client used for:
// - Transaction simulation
// - EVM module queries
// - Fee market module queries
// - Transaction simulation
// - EVM module queries
// - Fee market module queries
type QueryClient struct {
tx.ServiceClient
evmtypes.QueryClient