"""
    return cls(*args)


def get_block_hash_for_testing(self, block_number):
    if block_number >= self.block_number:
        return b''
    elif block_number < self.block_number - 256:
        return b''
    else:
        return keccak(to_bytes(text=f"{block_number}"))


HomesteadComputationForTesting = HomesteadComputation.configure(
    __name__='HomesteadComputationForTesting',
    apply_message=apply_message_for_testing,
    apply_create_message=apply_create_message_for_testing,
)
HomesteadStateForTesting = HomesteadState.configure(
    __name__='HomesteadStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
    computation_class=HomesteadComputationForTesting,
)
HomesteadVMForTesting = HomesteadVM.configure(
    __name__='HomesteadVMForTesting',
    _state_class=HomesteadStateForTesting,
)


@pytest.fixture(params=['Frontier', 'Homestead', 'EIP150', 'SpuriousDragon'])
def vm_class(request):
Beispiel #2
0
    apply_computation=fuzz_apply_computation,
)
FrontierStateForFuzzTesting = FrontierState.configure(
    __name__='FrontierStateForFuzzTesting',
    get_ancestor_hash=get_block_hash_for_testing,
    computation_class=FrontierComputationForFuzzTesting,
    account_db_class=EmulatorAccountDB,
)
FrontierVMForFuzzTesting = FrontierVM.configure(
    __name__='FrontierVMForFuzzTesting',
    _state_class=FrontierStateForFuzzTesting,
)

# HOMESTEAD
HomesteadComputationForFuzzTesting = HomesteadComputation.configure(
    __name__='HomesteadComputationForFuzzTesting',
    apply_computation=fuzz_apply_computation,
)
HomesteadStateForFuzzTesting = HomesteadState.configure(
    __name__='HomesteadStateForFuzzTesting',
    get_ancestor_hash=get_block_hash_for_testing,
    computation_class=HomesteadComputationForFuzzTesting,
    account_db_class=EmulatorAccountDB,
)
HomesteadVMForFuzzTesting = MainnetHomesteadVM.configure(
    __name__='HomesteadVMForFuzzTesting',
    _state_class=HomesteadStateForFuzzTesting,
)

# TANGERINE WHISTLE
TangerineWhistleComputationForFuzzTesting = TangerineWhistleComputation.configure(
    __name__='TangerineWhistleComputationForFuzzTesting',