Merge pull request #1919 from ethereum/hwwhww/shard_block_length
Fix shard_block_length type in `compute_updated_gasprice`
This commit is contained in:
commit
02d518c9e3
|
@ -493,7 +493,7 @@ def compute_offset_slots(start_slot: Slot, end_slot: Slot) -> Sequence[Slot]:
|
||||||
#### `compute_updated_gasprice`
|
#### `compute_updated_gasprice`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def compute_updated_gasprice(prev_gasprice: Gwei, shard_block_length: uint8) -> Gwei:
|
def compute_updated_gasprice(prev_gasprice: Gwei, shard_block_length: uint64) -> Gwei:
|
||||||
if shard_block_length > TARGET_SHARD_BLOCK_SIZE:
|
if shard_block_length > TARGET_SHARD_BLOCK_SIZE:
|
||||||
delta = (prev_gasprice * (shard_block_length - TARGET_SHARD_BLOCK_SIZE)
|
delta = (prev_gasprice * (shard_block_length - TARGET_SHARD_BLOCK_SIZE)
|
||||||
// TARGET_SHARD_BLOCK_SIZE // GASPRICE_ADJUSTMENT_COEFFICIENT)
|
// TARGET_SHARD_BLOCK_SIZE // GASPRICE_ADJUSTMENT_COEFFICIENT)
|
||||||
|
|
|
@ -70,8 +70,9 @@ def shard_state_transition(shard_state: ShardState,
|
||||||
"""
|
"""
|
||||||
shard_state.slot = block.slot
|
shard_state.slot = block.slot
|
||||||
prev_gasprice = shard_state.gasprice
|
prev_gasprice = shard_state.gasprice
|
||||||
shard_state.gasprice = compute_updated_gasprice(prev_gasprice, len(block.body))
|
shard_block_length = len(block.body)
|
||||||
if len(block.body) == 0:
|
shard_state.gasprice = compute_updated_gasprice(prev_gasprice, uint64(shard_block_length))
|
||||||
|
if shard_block_length == 0:
|
||||||
latest_block_root = shard_state.latest_block_root
|
latest_block_root = shard_state.latest_block_root
|
||||||
else:
|
else:
|
||||||
latest_block_root = hash_tree_root(block)
|
latest_block_root = hash_tree_root(block)
|
||||||
|
|
Loading…
Reference in New Issue