Skip to content

Commit

Permalink
Use correct field names for validator requests
Browse files Browse the repository at this point in the history
The request fields should be amed `pubkey` instead of `public_key` to be
compatible with `execution-spec-tests` and latest EIP specs.
  • Loading branch information
etan-status committed Sep 30, 2024
1 parent 2875a73 commit 08bc20a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ethereum/prague/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DepositRequest:
[EIP-6110]: https://eips.ethereum.org/EIPS/eip-6110
"""

public_key: Bytes48
pubkey: Bytes48
withdrawal_credentials: Bytes32
amount: U64
signature: Bytes96
Expand All @@ -60,7 +60,7 @@ class WithdrawalRequest:
"""

source_address: Address
validator_public_key: Bytes48
validator_pubkey: Bytes48
amount: U64


Expand All @@ -74,8 +74,8 @@ class ConsolidationRequest:
"""

source_address: Address
source_public_key: Bytes48
target_public_key: Bytes48
source_pubkey: Bytes48
target_pubkey: Bytes48


Request = Union[DepositRequest, WithdrawalRequest, ConsolidationRequest]
Expand Down Expand Up @@ -117,7 +117,7 @@ def parse_deposit_data(data: Bytes) -> DepositRequest:
Parses Deposit Request from the DepositContract.DepositEvent data.
"""
return DepositRequest(
public_key=Bytes48(data[192:240]),
pubkey=Bytes48(data[192:240]),
withdrawal_credentials=Bytes32(data[288:320]),
amount=U64.from_le_bytes(data[352:360]),
signature=Bytes96(data[416:512]),
Expand Down Expand Up @@ -148,7 +148,7 @@ def parse_withdrawal_data(data: Bytes) -> WithdrawalRequest:
assert len(data) == WITHDRAWAL_REQUEST_LENGTH
return WithdrawalRequest(
source_address=Address(data[:20]),
validator_public_key=Bytes48(data[20:68]),
validator_pubkey=Bytes48(data[20:68]),
amount=U64.from_be_bytes(data[68:76]),
)

Expand Down Expand Up @@ -181,8 +181,8 @@ def parse_consolidation_data(data: Bytes) -> ConsolidationRequest:
assert len(data) == CONSOLIDATION_REQUEST_LENGTH
return ConsolidationRequest(
source_address=Address(data[:20]),
source_public_key=Bytes48(data[20:68]),
target_public_key=Bytes48(data[68:116]),
source_pubkey=Bytes48(data[20:68]),
target_pubkey=Bytes48(data[68:116]),
)


Expand Down

0 comments on commit 08bc20a

Please sign in to comment.