Redirect historical RPC requests#13
Conversation
4156bb6 to
38c9ffa
Compare
9602cea to
8d598c0
Compare
80c1aba to
00108c8
Compare
00108c8 to
b6d9f59
Compare
Code with annotation about failure temp: Fix nil pointer dereference bug Add tests for eth_call implement estimategas
b6d9f59 to
72f7284
Compare
|
Whats the plan for other requests like balance at & proofs? (Realistically also for any RPC that takes a block number) |
|
@trianglesphere the database will still contain historical block bodies and headers, so we only need the RPCs that include execution. |
|
|
@trianglesphere I'd like to use this PR for validation of the approach and then expand to other methods. Here is a list of methods I think do/do not require history, would appreciate a sanity check on them (only methods that take a // **Needs History**
func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) {
func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) {
func (s *BlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error) {
func (s *BlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
func (s *BlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
func (s *BlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
// **Does not need history**
func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction {
func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes {
func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error) {
func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error) { |
|
The plan sounds good (gonna need more linear tickets though). I agree with the skips. For the historical ones, I think we might be able to skip the access list one for historical state. I'd also want to double check that we need to load state (rather than the block bodies) for the uncles one. I'd also want to cross check this against the |
trianglesphere
left a comment
There was a problem hiding this comment.
lgtm. Follow up steps are to extend this to other historical RPC tests + get a devnet like (maybe hive, not sure yet) to start exercising these codepaths in CI.
This commit squashes the op-geth fork history into a more maintainable diff for rebasing upon upstream geth. reference-optimistic-geth changes (origins of op-geth in early Bedrock development stage): - Deposit TX Type - Enable deposit tx in EVM/tx pool - Change deposit nonce to not be the max nonce - Extend PayloadAttributesV1 with a Transactions field - Force deposits at the start of each L2 block - Fix height check - noTxPool flag, reproduce block in verifier mode without tx pool interference - Fix RPC json marshalling (ref op-geth PR 4) - Deposit txs block height check in block body validation (ref op-geth PR 5) - core: do not try to reinject deposit txs into tx-pool (ref-op-geth PR 6) - deposit source hash field instead of L2 block height and tx index combination - Include invalid deposits, rewind state, but always persist mint (#10) - Provide gas to Call/Create in deposit transactions (#12) - Add docker builds (ref-op-geth PR 16, 17) - Don't panic on deposit transaction signature values or chain ID (ref-op-geth PR 18) - core: Add version to DepositTx (ref-op-geth PR 19) - Enable Geth build/lint/test in CircleCI (ref-op-geth PR 23) - core: Include guaranteed gas in the gas pool (ref-op-geth PR 21) - core: handle base fee, l1 availability fee, tx fee (ref-op-geth PR 27) - fix: deposit tx hash - fix l1 fee cache, rpc, tracing and tx pool - core: remove deposit-tx sub-type (a.k.a. deposit version byte) - eth/catalyst: allow engine user to reorg own chain - miner: restore ability to reorg deep as block builder - params: print Optimism consensus type in banner - core/types: remove unused protected() method, see upstream PR 23376 - core: do not mutate original balance value in tx pool l1 cost adjustment - core: subtract deposit gas from pool, so other txs do not use the same gas. And fail tx processing if deposits reach gas limit - core/types: deposits do not tip, avoid basefee subtraction - Unmeter the L1 Attributes Transaction - miner: handle force tx errors as critical, clean up diff - ci: Switch branch - eth,miner: return STATUS_INVALID when failing to process forced transactions in request (ref-op-geth PR 40) - verifier: forward tx to sequencer based on flag - txpool: add flag to disable tx gossip (ref-op-geth PR 42) - Add op-geth version in addition to geth version (ref-op-geth PR 43) - ci: CircleCI improvements (ref-op-geth PR 44) - Rename to op-geth - Build latest tag on optimism branch op-geth changes: - Expose cache config in simulated backend (#2) - Add EIP-1559 parameters - eth/catalyst: update payload id computation (#1) - make eip1559 configurable (#4) - post-merge network should not log warnings about missing transition information (#5) - Make the simulator more configurable (#6) - fix OPB-6 - IsDepositTx check instead of artificial nonce value check (#7) - Simulated backend - enable proof of stake consensus type and fix performance issue (#8) - accounts: simulated backend consensus engine option and immediate tx indexing - consensus/beacon: recognize all blocks as reached TTD with 0 TTD in chain config - Add --rollup.historicalhttp CLI flag and fix backend iface - Flags and interfaces for historical RPC requests (#12) - Redirect historical RPC requests (#13) - Use the pre-existing ethereum.NotFound error (#18) - Add historical endpoint to TraceBlockByNumber and TraceBlockByHash (#19) - Add historical endpoint to TraceTransaction (#20) - Add historical endpoint to TraceCall (#21) - optimism: fee params from info txi, update l1 cost func GPO params read (#15) - add hardcoded addresses for fee payouts (#23) - dynamic gas limit via engine API (#22) Co-authored-by: Matthew Slipper <me@matthewslipper.com> Co-authored-by: Joshua Gutow <jgutow@oplabs.co> Co-authored-by: protolambda <proto@protolambda.com> Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com> Co-authored-by: Maurelian <maurelian@protonmail.ch>
* chore: add issue and pull request templates * fix typo
Merge es-op-geth to latest op-geth
* feat(api_backend.go): add logging for transaction simulation duration in SimulateTransactionWithSSVTrace to improve observability * fix log * fix(ssv_mailbox_processor.go): update transaction analysis to handle STATICCALL operations alongside CALL operations for better functionality and accuracy in processing mailbox transactions * fix(ssv_mailbox_processor.go): update cross-rollup dependency check to use correct chain destination for improved accuracy feat(ssv_mailbox_processor.go): add logging for read operations to enhance traceability and debugging * fix(ssv_mailbox_processor.go): correct SourceChainID assignment in analyzeTransaction to use ChainDest for accurate dependency tracking fix(ssv_mailbox_processor.go): change SourceChainID formatting in waitForCIRCMessage to hex encoding for consistency in message representation
Description
Updates the
BlockChainAPI.Call()andBlockChainAPI.EstimateGas()methods so that they will attempt to fallback to calling theHistoricalRPCServicein the event that the block is not found locally.In order to handle this cleanly, a new error
ErrHeaderNotFoundwas created.Tests
New tests were added for both methods.