Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for is_data_available in fork choice #3194

Closed
2 tasks
hwwhww opened this issue Jan 6, 2023 · 1 comment
Closed
2 tasks

Add tests for is_data_available in fork choice #3194

hwwhww opened this issue Jan 6, 2023 · 1 comment

Comments

@hwwhww
Copy link
Contributor

hwwhww commented Jan 6, 2023

We can inject is_data_available output in the way we hacked get_pow_block in on_merge_block tests:

def with_pow_block_patch(spec, blocks, func):
def get_pow_block(hash: spec.Bytes32) -> spec.PowBlock:
for block in blocks:
if block.block_hash == hash:
return block
raise BlockNotFoundException()
get_pow_block_backup = spec.get_pow_block
spec.get_pow_block = get_pow_block
class AtomicBoolean():
value = False
is_called = AtomicBoolean()
def wrap(flag: AtomicBoolean):
yield from func()
flag.value = True
try:
yield from wrap(is_called)
finally:
spec.get_pow_block = get_pow_block_backup
assert is_called.value

TODOs

  • Update fork-choice test format
  • Add test cases
@hwwhww hwwhww changed the title Add tests for is_data_available in fork-chocie Add tests for is_data_available in fork choice Jun 6, 2023
@hwwhww
Copy link
Contributor Author

hwwhww commented Aug 3, 2023

closing in favor of #3463

@hwwhww hwwhww closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant