949674e511
* fix(rpc): align fee history (#1611) * update nix * add next fee in fee history * fix test * add change doc * height + 1 for next fee * cross check baseFeePerGas len * Update tests/integration_tests/test_fee_history.py Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * fix oldestBlock & align earliest input as eth * update doc * update nix * isort test_fee_history.py * fix test * align rpc res as eth * add cross check * add baseFeePerGas len check * add oldestBlock check Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> (cherry picked from commit 47fdfd3d8318358c2578b610bc35bc8c1ebb131e) # Conflicts: # CHANGELOG.md * address merge conflicts Co-authored-by: mmsqe <mavis@crypto.com> Co-authored-by: MalteHerrmann <malte@evmos.org> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
105 lines
4.4 KiB
Go
105 lines
4.4 KiB
Go
// Copyright 2021 Evmos Foundation
|
|
// This file is part of Evmos' Ethermint library.
|
|
//
|
|
// The Ethermint library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The Ethermint library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
|
|
package types
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
|
)
|
|
|
|
// Copied the Account and StorageResult types since they are registered under an
|
|
// internal pkg on geth.
|
|
|
|
// AccountResult struct for account proof
|
|
type AccountResult struct {
|
|
Address common.Address `json:"address"`
|
|
AccountProof []string `json:"accountProof"`
|
|
Balance *hexutil.Big `json:"balance"`
|
|
CodeHash common.Hash `json:"codeHash"`
|
|
Nonce hexutil.Uint64 `json:"nonce"`
|
|
StorageHash common.Hash `json:"storageHash"`
|
|
StorageProof []StorageResult `json:"storageProof"`
|
|
}
|
|
|
|
// StorageResult defines the format for storage proof return
|
|
type StorageResult struct {
|
|
Key string `json:"key"`
|
|
Value *hexutil.Big `json:"value"`
|
|
Proof []string `json:"proof"`
|
|
}
|
|
|
|
// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
|
|
type RPCTransaction struct {
|
|
BlockHash *common.Hash `json:"blockHash"`
|
|
BlockNumber *hexutil.Big `json:"blockNumber"`
|
|
From common.Address `json:"from"`
|
|
Gas hexutil.Uint64 `json:"gas"`
|
|
GasPrice *hexutil.Big `json:"gasPrice"`
|
|
GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"`
|
|
GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
|
|
Hash common.Hash `json:"hash"`
|
|
Input hexutil.Bytes `json:"input"`
|
|
Nonce hexutil.Uint64 `json:"nonce"`
|
|
To *common.Address `json:"to"`
|
|
TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
|
|
Value *hexutil.Big `json:"value"`
|
|
Type hexutil.Uint64 `json:"type"`
|
|
Accesses *ethtypes.AccessList `json:"accessList,omitempty"`
|
|
ChainID *hexutil.Big `json:"chainId,omitempty"`
|
|
V *hexutil.Big `json:"v"`
|
|
R *hexutil.Big `json:"r"`
|
|
S *hexutil.Big `json:"s"`
|
|
}
|
|
|
|
// StateOverride is the collection of overridden accounts.
|
|
type StateOverride map[common.Address]OverrideAccount
|
|
|
|
// OverrideAccount indicates the overriding fields of account during the execution of
|
|
// a message call.
|
|
// Note, state and stateDiff can't be specified at the same time. If state is
|
|
// set, message execution will only use the data in the given state. Otherwise
|
|
// if statDiff is set, all diff will be applied first and then execute the call
|
|
// message.
|
|
type OverrideAccount struct {
|
|
Nonce *hexutil.Uint64 `json:"nonce"`
|
|
Code *hexutil.Bytes `json:"code"`
|
|
Balance **hexutil.Big `json:"balance"`
|
|
State *map[common.Hash]common.Hash `json:"state"`
|
|
StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
|
|
}
|
|
|
|
type FeeHistoryResult struct {
|
|
OldestBlock *hexutil.Big `json:"oldestBlock"`
|
|
Reward [][]*hexutil.Big `json:"reward,omitempty"`
|
|
BaseFee []*hexutil.Big `json:"baseFeePerGas,omitempty"`
|
|
GasUsedRatio []float64 `json:"gasUsedRatio"`
|
|
}
|
|
|
|
// SignTransactionResult represents a RLP encoded signed transaction.
|
|
type SignTransactionResult struct {
|
|
Raw hexutil.Bytes `json:"raw"`
|
|
Tx *ethtypes.Transaction `json:"tx"`
|
|
}
|
|
|
|
type OneFeeHistory struct {
|
|
BaseFee, NextBaseFee *big.Int // base fee for each block
|
|
Reward []*big.Int // each element of the array will have the tip provided to miners for the percentile given
|
|
GasUsedRatio float64 // the ratio of gas used to the gas limit for each block
|
|
}
|