def get_vm_class_for_block_number(cls, block_number: BlockNumber) -> Type['BaseVM']: """ Returns the VM class for the given block number. """ 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))
def get_vm_class_for_block_number(self, block_number): """ Return the vm class for the given block number. """ validate_block_number(block_number) for n in reversed(self.vms_by_range.keys()): if block_number >= n: return self.vms_by_range[n] else: raise VMNotFound("No vm available for block #{0}".format(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))