-
Notifications
You must be signed in to change notification settings - Fork 463
feat(test-fill): align fill-stateful with gas-benchmarks implementation
#2923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: forks/amsterdam
Are you sure you want to change the base?
Changes from all commits
d198221
0252bec
05f3c16
54f43ad
8477bfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,3 +347,65 @@ def fund_via_withdrawals( | |
| new_payload, | ||
| payload_attributes.parent_beacon_block_root, | ||
| ) | ||
|
|
||
| def bump_block_gas_limit( | ||
| self, | ||
| block_count: int, | ||
| ) -> List[EnginePayloadMetadata]: | ||
| """ | ||
| Build empty block to increase the block gas limit to target. | ||
| """ | ||
| if block_count <= 0: | ||
| return [] | ||
| assert self.testing_rpc is not None, ( | ||
| "bump_block_gas_limit requires testing_rpc" | ||
| ) | ||
| captured: List[EnginePayloadMetadata] = [] | ||
| with self.block_building_lock: | ||
| for _ in range(block_count): | ||
| head_block = self.get_block_by_number("latest") | ||
| assert head_block is not None | ||
| next_timestamp = int(HexNumber(head_block["timestamp"]) + 1) | ||
| payload_attributes = self._payload_attributes( | ||
| next_timestamp=next_timestamp, | ||
| ) | ||
| new_payload = self.testing_rpc.build_block( | ||
| parent_block_hash=Hash(head_block["hash"]), | ||
| payload_attributes=payload_attributes, | ||
| transactions=[], | ||
| extra_data=Bytes(b""), | ||
| ) | ||
| captured.append( | ||
| self._finalize_payload( | ||
| new_payload, | ||
| payload_attributes.parent_beacon_block_root, | ||
| ) | ||
| ) | ||
| return captured | ||
|
|
||
| def set_canonical_head(self, head_block_hash: Hash) -> None: | ||
| """ | ||
| Reorg the canonical head to head_block_hash via | ||
| ``engine_forkchoiceUpdated``. | ||
| """ | ||
| head_block = self.get_block_by_hash(head_block_hash) | ||
| assert head_block is not None, ( | ||
| f"cannot reset head to unknown block {head_block_hash}" | ||
| ) | ||
| head_fork = self.fork.fork_at( | ||
| block_number=HexNumber(head_block["number"]), | ||
| timestamp=HexNumber(head_block["timestamp"]), | ||
| ) | ||
|
Comment on lines
+395
to
+398
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see now the reason behind the previous call, but perhaps the solution is that we should never expect |
||
| fcu_version = head_fork.engine_forkchoice_updated_version() | ||
| assert fcu_version is not None, ( | ||
| "Fork does not support engine forkchoice_updated" | ||
| ) | ||
|
Comment on lines
+399
to
+402
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could do this once during initialization of |
||
| response = self.engine_rpc.forkchoice_updated( | ||
| ForkchoiceState(head_block_hash=head_block_hash), | ||
| None, | ||
| version=fcu_version, | ||
| ) | ||
| assert response.payload_status.status == PayloadStatusEnum.VALID, ( | ||
| f"forkchoice_updated reset to {head_block_hash} was not VALID " | ||
| f"(got {response.payload_status.status})" | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is unnecessary, since the client itself will make the same complaint if it cannot find the block.
It's just one less RPC call to make IMO.