Skip to content

Commit

Permalink
Merge branch 'dev' into deposit-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalinin committed Sep 18, 2024
2 parents 67cc3a5 + 7cacee6 commit 1513492
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 246 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/generate_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
default: dev
type: string
required: true
schedule:
- cron: '0 2 * * *'

jobs:
generate-tests:
Expand All @@ -22,7 +24,7 @@ jobs:
with:
repository: 'ethereum/consensus-specs'
path: 'consensus-specs'
ref: ${{ inputs.source_ref }}
ref: ${{ inputs.source_ref || 'dev' }}
- name: Checkout consensus-spec-tests repository
uses: actions/checkout@v4
with:
Expand Down
38 changes: 38 additions & 0 deletions pysetup/spec_builders/electra.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,41 @@ def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
'CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(86)',
'NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(87)',
}


@classmethod
def execution_engine_cls(cls) -> str:
return """
class NoopExecutionEngine(ExecutionEngine):
def notify_new_payload(self: ExecutionEngine,
execution_payload: ExecutionPayload,
execution_requests: ExecutionRequests,
parent_beacon_block_root: Root) -> bool:
return True
def notify_forkchoice_updated(self: ExecutionEngine,
head_block_hash: Hash32,
safe_block_hash: Hash32,
finalized_block_hash: Hash32,
payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]:
pass
def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> GetPayloadResponse:
# pylint: disable=unused-argument
raise NotImplementedError("no default block production")
def is_valid_block_hash(self: ExecutionEngine,
execution_payload: ExecutionPayload,
parent_beacon_block_root: Root) -> bool:
return True
def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool:
return True
def verify_and_notify_new_payload(self: ExecutionEngine,
new_payload_request: NewPayloadRequest) -> bool:
return True
EXECUTION_ENGINE = NoopExecutionEngine()"""
24 changes: 0 additions & 24 deletions specs/_features/eip7594/polynomial-commitments-sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
- [BLS12-381 helpers](#bls12-381-helpers)
- [`cell_to_coset_evals`](#cell_to_coset_evals)
- [`coset_evals_to_cell`](#coset_evals_to_cell)
- [Linear combinations](#linear-combinations)
- [`g2_lincomb`](#g2_lincomb)
- [FFTs](#ffts)
- [`_fft_field`](#_fft_field)
- [`fft_field`](#fft_field)
Expand Down Expand Up @@ -125,28 +123,6 @@ def coset_evals_to_cell(coset_evals: CosetEvals) -> Cell:
return Cell(cell)
```

### Linear combinations

#### `g2_lincomb`

```python
def g2_lincomb(points: Sequence[G2Point], scalars: Sequence[BLSFieldElement]) -> Bytes96:
"""
BLS multiscalar multiplication in G2. This can be naively implemented using double-and-add.
"""
assert len(points) == len(scalars)

if len(points) == 0:
return bls.G2_to_bytes96(bls.Z2())

points_g2 = []
for point in points:
points_g2.append(bls.bytes96_to_G2(point))

result = bls.multi_exp(points_g2, scalars)
return Bytes96(bls.G2_to_bytes96(result))
```

### FFTs

#### `_fft_field`
Expand Down
14 changes: 9 additions & 5 deletions specs/_features/eip7732/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class SignedExecutionPayloadHeader(Container):
```python
class ExecutionPayloadEnvelope(Container):
payload: ExecutionPayload
execution_requests: ExecutionRequests
builder_index: ValidatorIndex
beacon_block_root: Root
blob_kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK]
Expand All @@ -175,7 +176,7 @@ class SignedExecutionPayloadEnvelope(Container):

#### `BeaconBlockBody`

**Note:** The Beacon Block body is modified to contain a `Signed ExecutionPayloadHeader`. The containers `BeaconBlock` and `SignedBeaconBlock` are modified indirectly.
**Note:** The Beacon Block body is modified to contain a `Signed ExecutionPayloadHeader`. The containers `BeaconBlock` and `SignedBeaconBlock` are modified indirectly. The field `execution_requests` is removed from the beacon block body and moved into the signed execution payload envelope.

```python
class BeaconBlockBody(Container):
Expand All @@ -191,8 +192,9 @@ class BeaconBlockBody(Container):
sync_aggregate: SyncAggregate
# Execution
# Removed execution_payload [Removed in EIP-7732]
# Removed blob_kzg_commitments [Removed in EIP-7732]
bls_to_execution_changes: List[SignedBLSToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES]
# Removed blob_kzg_commitments [Removed in EIP-7732]
# Removed execution_requests [Removed in EIP-7732]
# PBS
signed_execution_payload_header: SignedExecutionPayloadHeader # [New in EIP-7732]
payload_attestations: List[PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS] # [New in EIP-7732]
Expand Down Expand Up @@ -650,11 +652,13 @@ def process_execution_payload(state: BeaconState,
# Verify the execution payload is valid
versioned_hashes = [kzg_commitment_to_versioned_hash(commitment)
for commitment in envelope.blob_kzg_commitments]
requests = envelope.execution_requests
assert execution_engine.verify_and_notify_new_payload(
NewPayloadRequest(
execution_payload=payload,
versioned_hashes=versioned_hashes,
parent_beacon_block_root=state.latest_block_header.parent_root,
execution_requests=requests,
)
)

Expand All @@ -663,9 +667,9 @@ def process_execution_payload(state: BeaconState,
for operation in operations:
fn(state, operation)

for_ops(payload.deposit_requests, process_deposit_request)
for_ops(payload.withdrawal_requests, process_withdrawal_request)
for_ops(payload.consolidation_requests, process_consolidation_request)
for_ops(requests.deposit_requests, process_deposit_request)
for_ops(requests.withdrawal_requests, process_withdrawal_request)
for_ops(requests.consolidation_requests, process_consolidation_request)

# Cache the execution payload header and proposer
state.latest_block_hash = payload.block_hash
Expand Down
Loading

0 comments on commit 1513492

Please sign in to comment.