consensus-specs icon indicating copy to clipboard operation
consensus-specs copied to clipboard

Differences between official spec document and eth2spec 1.1.10 library

Open GyeongMinDan opened this issue 1 year ago โ€ข 3 comments

Hi ๐Ÿ™‚. I am GyeongMin Dan. I am conducting research at the Software Security Lab at Sungkyunkwan University.

While I was developing ethereum-consensus-spec using eth2spec library(pypi) version 1.1.10. I had to report some issues because there was a difference between the official spec document and eth2spec 1.1.10.

===========================================================================

๐Ÿ› ๏ธ My Development Environment

  • Visual Studio Code
  • Python / 3.9.0
  • eth2spec / 1.1.10
  • milagro_bls_bidning / 1.6.3

===========================================================================

โœจ Problem

  • There are a few differences -> Between ethereum-consensus-spec docs and eth2spec library(1.1.10)

===========================================================================

Spec Docs ๐Ÿ”ฝ

https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md

eth2spec library ๐Ÿ”ฝ

https://pypi.org/project/eth2spec/

These are the links I referenced during development.

===========================================================================

โ“Issue

In the BeaconBlockBody section in ethereum-consensus-specs > capella > beacon-chian.md

I was able to find the following part ๐Ÿ”ฝ

bls_to_execution_changes: List[SignedBLSToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES] # [New in Capella]

But in eth2spec > capella > mainnet.py that value did not exist. mainnet beaconblock body

Also, because the corresponding value did not exist, the constant values โ€‹โ€‹MAX_BLS_TO_EXECUTION_CHANGES, SignedBLSToExecutionChange, and the BLSToExecutionChange class did not exist.

However, I was able to find the corresponding constant and class values โ€‹โ€‹in the Capella spec document.

MAX_BLS_TO_EXECUTION_CHANGES | 2^4ย (= 16)

class BLSToExecutionChange(Container):
    validator_index: ValidatorIndex
    from_bls_pubkey: BLSPubkey
    to_execution_address: ExecutionAddress
class SignedBLSToExecutionChange(Container):
       message: BLSToExecutionChange
       signature: BLSSignature

These constant value and two classes are not implemented in eth2spec > capella > mainnet.py

===========================================================================

โ“Issue

In the BeaconState section in ethereum-consensus-specs > capella > beacon-chian.md

I was able to find the following part ๐Ÿ”ฝ

    # Withdrawals
    next_withdrawal_index: WithdrawalIndex  # [New in Capella]
    next_withdrawal_validator_index: ValidatorIndex  # [New in Capella]
    # Deep history valid from Capella onwards
    historical_summaries: List[HistoricalSummary, HISTORICAL_ROOTS_LIMIT]  # [New in Capella]

But in eth2spec > capella > mainnet.py #Withdrawals part is implemented differently from the official spec. beaconstate error

In the official spec document:

    # Withdrawals
    next_withdrawal_index: WithdrawalIndex # [New in Capella]
    next_withdrawal_validator_index: ValidatorIndex # [New in Capella]
    # Deep history valid from Capella onwards
    historical_summaries: List[HistoricalSummary, HISTORICAL_ROOTS_LIMIT] # [New in Capella]

In eth2spec capella mainnet.py, it is not implemented according to the document. It is implemented with the values โ€‹โ€‹withdrawal_index and withdrawals_queue. The value of historical summaries is not implemented.

class HistoricalSummary(Container):
    """
    `HistoricalSummary` matches the components of the phase0 `HistoricalBatch`
    making the two hash_tree_root-compatible.
    """
    block_summary_root: Root
    state_summary_root: Root

This class is not implemented in eth2spec > capella > mainnet.py

===========================================================================

โ“Issue

In the Withdrawal section in ethereum-consensus-specs > capella > beacon-chian.md

I was able to find the following part ๐Ÿ”ฝ

    class Withdrawal(Container):
        index: WithdrawalIndex
        validator_index: ValidatorIndex
        address: ExecutionAddress
        amount: Gwei

But in eth2spec > capella > mainnet.py ValidatorIndex fields is not implemented. withdrawal errors

Although ValidatorIndex is specified in the official spec, it is not implemented in eth2spec capella mainnet.py.

===========================================================================

Thank you! ๐Ÿ™‚ Have a good day! ๐Ÿ˜Š

GyeongMinDan avatar Sep 20 '24 08:09 GyeongMinDan

Hi @GyeongMinDan, it has been a couple years since we published a new eth2spec package to PyPI. This is the reason for the differences. I'll look into publishing these again.

jtraglia avatar Sep 20 '24 12:09 jtraglia

Hi @jtraglia, Thanks for your reply! ๐Ÿ™‚ I have one question. Before distributing a new eth2spec, may I ask what is the way to develop an ssz file suitable for ethereum Capella Version? Currently, I am using my own modified eth2spec 1.1.10 mainnet.py. Is there a better way?

Thank you!๐Ÿ™‚ Have a good day! ๐Ÿ˜Š

GyeongMinDan avatar Sep 21 '24 06:09 GyeongMinDan

What is the way to develop an ssz file suitable for ethereum Capella Version? Currently, I am using my own modified eth2spec 1.1.10 mainnet.py. Is there a better way?

Hey @GyeongMinDan ๐Ÿ‘‹ it's been a while since I've used it but I believe zcli is what I would use.

  • https://github.com/protolambda/zcli

jtraglia avatar Sep 23 '24 12:09 jtraglia

I am closing this issue because it seems stale. Please, do not hesitate to reopen it if this is a mistake

leolara avatar Jun 10 '25 09:06 leolara