Skip to content

Commit

Permalink
expose new l1 fields via evm api
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul committed Aug 20, 2024
1 parent a85cb37 commit 2de5149
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions sqa/eth/ingest/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class Receipt(TypedDict):
l1FeeScalar: NotRequired[float]
l1GasPrice: NotRequired[Qty]
l1GasUsed: NotRequired[Qty]
l1BaseFeeScalar: NotRequired[Qty]
l1BlobBaseFeeScalar: NotRequired[Qty]
l1BlobBaseFee: NotRequired[Qty]


DebugFrame = TypedDict('DebugFrame', {
Expand Down
13 changes: 13 additions & 0 deletions sqa/eth/ingest/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def __init__(self):
self.l1_fee_scalar = Column(bigfloat())
self.l1_gas_price = Column(qty())
self.l1_gas_used = Column(qty())
self.l1_blob_base_fee = Column(qty())
self.l1_blob_base_fee_scalar = Column(pyarrow.uint32())
self.l1_base_fee_scalar = Column(pyarrow.uint32())

def append(self, tx: Transaction):
block_number = qty2int(tx['blockNumber'])
Expand Down Expand Up @@ -131,6 +134,9 @@ def append(self, tx: Transaction):
self.l1_fee_scalar.append(receipt.get('l1FeeScalar'))
self.l1_gas_price.append(receipt.get('l1GasPrice'))
self.l1_gas_used.append(receipt.get('l1GasUsed'))
self.l1_blob_base_fee.append(receipt.get('l1BlobBaseFee'))
self.l1_blob_base_fee_scalar.append(_qty2int(receipt.get('l1BlobBaseFeeScalar')))
self.l1_base_fee_scalar.append(_qty2int(receipt.get('l1BaseFeeScalar')))
else:
self.gas_used.append(None)
self.cumulative_gas_used.append(None)
Expand All @@ -147,6 +153,9 @@ def append(self, tx: Transaction):
self.l1_fee_scalar.append(None)
self.l1_gas_price.append(None)
self.l1_gas_used.append(None)
self.l1_blob_base_fee.append(None)
self.l1_blob_base_fee_scalar.append(None)
self.l1_base_fee_scalar.append(None)


class LogTableBuilder(TableBuilder):
Expand Down Expand Up @@ -539,3 +548,7 @@ def _to_sighash(tx_input: str) -> str | None:
return tx_input[:10]
else:
return None


def _qty2int(v: Qty | None) -> int | None:
return None if v is None else qty2int(v)
9 changes: 8 additions & 1 deletion sqa/eth/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ class BlockFieldSelection(TypedDict, total=False):
'cumulativeGasUsed': bool,
'effectiveGasPrice': bool,
'type': bool,
'status': bool
'status': bool,
'l1Fee': bool,
'l1FeeScalar': bool,
'l1GasPrice': bool,
'l1GasUsed': bool,
'l1BlobBaseFee': bool,
'l1BlobBaseFeeScalar': bool,
'l1BaseFeeScalar': bool,
}, total=False)


Expand Down

0 comments on commit 2de5149

Please sign in to comment.