From 8cf07742901bdb467591cb98fe99de85433997fe Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 18 Jun 2020 20:34:34 +0800 Subject: [PATCH] Fix shard_block_length type in `compute_updated_gasprice` --- specs/phase1/beacon-chain.md | 2 +- specs/phase1/shard-transition.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index cd938e0c5..6e8700e2f 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -493,7 +493,7 @@ def compute_offset_slots(start_slot: Slot, end_slot: Slot) -> Sequence[Slot]: #### `compute_updated_gasprice` ```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: delta = (prev_gasprice * (shard_block_length - TARGET_SHARD_BLOCK_SIZE) // TARGET_SHARD_BLOCK_SIZE // GASPRICE_ADJUSTMENT_COEFFICIENT) diff --git a/specs/phase1/shard-transition.md b/specs/phase1/shard-transition.md index 24c39aa3d..083064225 100644 --- a/specs/phase1/shard-transition.md +++ b/specs/phase1/shard-transition.md @@ -70,8 +70,9 @@ def shard_state_transition(shard_state: ShardState, """ shard_state.slot = block.slot prev_gasprice = shard_state.gasprice - shard_state.gasprice = compute_updated_gasprice(prev_gasprice, len(block.body)) - if len(block.body) == 0: + shard_block_length = len(block.body) + 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 else: latest_block_root = hash_tree_root(block)