migalabs / goteth

Ethereum Chain metrics analyzer (CL and EL): duties, rewards, balances, and many more
MIT License
14 stars 7 forks source link

Transaction Details hardcoded to bellatrix #64

Open tdahar opened 1 year ago

tdahar commented 1 year ago

Description

Right now we request the transaction details using the bellatrix.Transaction. However, this structure might change in the future, so the details should be requested using a standard structure as a Hash. https://github.com/cortze/goteth/pull/63#pullrequestreview-1539550611

Proposal

In order to make the transaction request compatible with the rest of the tool, we intend to request the details inside the block, at the same time it is converted to an AgnosticBlock taking into account the current fork. Then, inside the block we would store an array of AgnosticTransaction.

// This Wrapper is meant to include all common objects across Ethereum Hard Fork Specs
type AgnosticExecutionPayload struct {
    FeeRecipient  bellatrix.ExecutionAddress
    GasLimit      uint64
    GasUsed       uint64
    Timestamp     uint64
    BaseFeePerGas [32]byte
    BlockHash     phase0.Hash32
    Transactions  []local_spec.AgnosticTransaction
    BlockNumber   uint64
    Withdrawals   []*capella.Withdrawal
}
cortze commented 1 year ago

I agree with this update. I'll also like to leave the APIClient interface as clean as possible. Right now, we have a lot of data parsing from transactions in an APIClient method, when the actual call to the EL node is only to fetch the transaction.Receipt from a given tx.Hash .

From my understanding, this data parsing should be part of the AgnosticTransaction, and should be identified/parsed when parsing the Block.