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

fix: add nano-scale timestamp to fantom blocks #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fubuloubu
Copy link
Member

What I did

fixes: #4

@fubuloubu
Copy link
Member Author

still buggy in the case of ape-hardhat which does not produce this field:

Traceback (most recent call last):
  File "~/ape-hardhat/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "site-packages/ape/_cli.py", line 40, in invoke
    return super().invoke(ctx)
  File "site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "site-packages/ape/cli/commands.py", line 17, in invoke
    with networks.parse_network_choice(value):
  File "site-packages/ape/api/networks.py", line 301, in __enter__
    self.provider.connect()
  File "~/ape-hardhat/ape_hardhat/providers.py", line 393, in connect
    if self.get_block(0).hash != upstream_genesis_block_hash:
  File "site-packages/ape/api/providers.py", line 681, in get_block
    return self.network.ecosystem.decode_block(block_data)  # type: ignore
  File "site-packages/ape_fantom/ecosystem.py", line 46, in decode_block
    return Block(timestamp_nano=data.get("timestampNano", 0), **block.dict())
  File "pydantic/main.py", line 331, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Block
timestamp_nano
  int() can't convert non-string with explicit base (type=type_error)

@antazoey
Copy link
Member

  • Would love to see tests for this one! This is one of those differences in ecosystems that make me love the plugin system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fantom blocks have field timestampNano
2 participants