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 PoA middleware dynamic checking [APE-838] #61

Open
NotPeopling2day opened this issue Apr 12, 2023 · 0 comments
Open

Add PoA middleware dynamic checking [APE-838] #61

NotPeopling2day opened this issue Apr 12, 2023 · 0 comments
Labels
category: feature New feature or request

Comments

@NotPeopling2day
Copy link
Contributor

In the connect we need to add PoA dynamic checking:

       def check_poa(block_id) -> bool:
            try:
                block = self.web3.eth.get_block(block_id)
            except ExtraDataLengthError:
                return True
            else:
                return (
                    "proofOfAuthorityData" in block
                    or len(block.get("extraData", "")) > MAX_EXTRADATA_LENGTH
                )

      # Handle if using PoA
      if any(map(check_poa, (0, "latest"))):
          self._web3.middleware_onion.inject(geth_poa_middleware, layer=0)
@NotPeopling2day NotPeopling2day added the category: feature New feature or request label Apr 12, 2023
@NotPeopling2day NotPeopling2day changed the title Add PoA middleware dynamic checking Add PoA middleware dynamic checking [APE-838] Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant