def get_vm_class_for_block_number(cls, block_number: BlockNumber) -> Type[VirtualMachineAPI]: if cls.vm_configuration is None: raise AttributeError("Chain classes must define the VMs in vm_configuration") validate_block_number(block_number) for start_block, vm_class in reversed(cls.vm_configuration): if block_number >= start_block: return vm_class else: raise VMNotFound(f"No vm available for block #{block_number}")
def get_vm_class_for_block_number(cls, block_number: BlockNumber) -> Type['BaseVM']: """ Returns the VM class for the given block number. """ if cls.vm_configuration is None: raise AttributeError("Chain classes must define the VMs in vm_configuration") validate_block_number(block_number) for start_block, vm_class in reversed(cls.vm_configuration): if block_number >= start_block: return vm_class else: raise VMNotFound("No vm available for block #{0}".format(block_number))