Пример #1
0
 def run_with(
     _cls,
     inputs: Tuple[BeaconState, Tuple[SignedBeaconBlock, ...]],
     config: Optional[Eth2Config],
 ) -> BeaconState:
     state, blocks = inputs
     for block in blocks:
         state = apply_state_transition(config, state, block)
         if block.message.state_root != state.hash_tree_root:
             raise ValidationError(
                 "block's state root did not match computed state root")
     return state
Пример #2
0
    def apply_state_transition(
        self,
        state: BeaconState,
        signed_block: BaseSignedBeaconBlock = None,
        future_slot: Slot = None,
        check_proposer_signature: bool = True,
    ) -> Tuple[BeaconState, BaseSignedBeaconBlock]:
        state = apply_state_transition(self.config, state, signed_block,
                                       future_slot, check_proposer_signature)

        if signed_block:
            signed_block = signed_block.transform(("message", "state_root"),
                                                  state.hash_tree_root)

        return state, signed_block