Ejemplo n.º 1
0
        return b''
    else:
        return keccak(text="{0}".format(block_number))


def get_prev_hashes_testing(self, last_block_hash, db):
    prev_hashes = []
    return prev_hashes


FrontierVMStateForTesting = FrontierVMState.configure(
    name='FrontierVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
HomesteadVMStateForTesting = HomesteadVMState.configure(
    name='HomesteadVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
TangerineWhistleVMStateForTesting = TangerineWhistleVMState.configure(
    name='TangerineWhistleVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
SpuriousDragonVMStateForTesting = SpuriousDragonVMState.configure(
    name='SpuriousDragonVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
ByzantiumVMStateForTesting = ByzantiumVMState.configure(
    name='ByzantiumVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)

FrontierVMForTesting = FrontierVM.configure(
Ejemplo n.º 2
0
        return b''
    else:
        return keccak(text="{0}".format(block_number))


def get_prev_hashes_testing(self, last_block_hash, db):
    prev_hashes = []
    return prev_hashes


FrontierVMStateForTesting = FrontierVMState.configure(
    name='FrontierVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
HomesteadVMStateForTesting = HomesteadVMState.configure(
    name='HomesteadVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
TangerineWhistleVMStateForTesting = TangerineWhistleVMState.configure(
    name='TangerineWhistleVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
SpuriousDragonVMStateForTesting = SpuriousDragonVMState.configure(
    name='SpuriousDragonVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)
ByzantiumVMStateForTesting = ByzantiumVMState.configure(
    name='ByzantiumVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
)

FrontierVMForTesting = FrontierVM.configure(
Ejemplo n.º 3
0
    if block_number >= self.block_number:
        return b''
    elif block_number < self.block_number - 256:
        return b''
    else:
        return keccak(text="{0}".format(block_number))


HomesteadComputationForTesting = HomesteadComputation.configure(
    name='HomesteadComputationForTesting',
    apply_message=apply_message_for_testing,
    apply_create_message=apply_create_message_for_testing,
)
HomesteadVMStateForTesting = HomesteadVMState.configure(
    name='HomesteadVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
    computation_class=HomesteadComputationForTesting,
)
HomesteadVMForTesting = HomesteadVM.configure(
    name='HomesteadVMForTesting',
    _state_class=HomesteadVMStateForTesting,
)


@pytest.fixture(params=['Frontier', 'Homestead', 'EIP150', 'SpuriousDragon'])
def vm_class(request):
    if request.param == 'Frontier':
        pytest.skip('Only the Homestead VM rules are currently supported')
    elif request.param == 'Homestead':
        return HomesteadVMForTesting
    elif request.param == 'EIP150':
Ejemplo n.º 4
0
    if block_number >= self.block_number:
        return b''
    elif block_number < self.block_number - 256:
        return b''
    else:
        return keccak(text="{0}".format(block_number))


HomesteadComputationForTesting = HomesteadComputation.configure(
    name='HomesteadComputationForTesting',
    apply_message=apply_message_for_testing,
    apply_create_message=apply_create_message_for_testing,
)
HomesteadVMStateForTesting = HomesteadVMState.configure(
    name='HomesteadVMStateForTesting',
    get_ancestor_hash=get_block_hash_for_testing,
    computation_class=HomesteadComputationForTesting,
)
HomesteadVMForTesting = HomesteadVM.configure(
    name='HomesteadVMForTesting',
    _state_class=HomesteadVMStateForTesting,
)


@pytest.fixture(params=['Frontier', 'Homestead', 'EIP150', 'SpuriousDragon'])
def vm_class(request):
    if request.param == 'Frontier':
        pytest.skip('Only the Homestead VM rules are currently supported')
    elif request.param == 'Homestead':
        return HomesteadVMForTesting
    elif request.param == 'EIP150':