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

web3py unsuccessful contract deployment to Klaytn testnet #588

Open
SuperCipher opened this issue Feb 9, 2022 · 0 comments
Open

web3py unsuccessful contract deployment to Klaytn testnet #588

SuperCipher opened this issue Feb 9, 2022 · 0 comments

Comments

@SuperCipher
Copy link

Describe the bug
When I try to connect to Klaytn testnet (baobab) using Python web3 Library
I got this error

val = '0xd883010703846b6c617988676f312e31352e37856c696e757800000000000000f90164f85494571e53df607be97431a5bbefca1dffe5aef56f4...5dc26799c96fa0cfde0e8db06b08edb644eab4d08f64271d7cea0c754553ca90ae82ed633fc146609da2aef4effe4a97d3cc6021b102ed476d1f00'

    def check_extradata_length(val: Any) -> Any:
        if not isinstance(val, (str, int, bytes)):
            return val
        result = HexBytes(val)
        if len(result) > MAX_EXTRADATA_LENGTH:
>           raise ExtraDataLengthError(
                "The field extraData is %d bytes, but should be %d. "
                "It is quite likely that you are connected to a POA chain. "
                "Refer to "
                "http://web3py.readthedocs.io/en/stable/middleware.html#geth-style-proof-of-authority "
                "for more details. The full extraData is: %r" % (
                    len(result), MAX_EXTRADATA_LENGTH, result
                )
            )
E           web3.exceptions.ExtraDataLengthError: The field extraData is 391 bytes, but should be 32. It is quite likely that you are connected to a POA chain. Refer to http://web3py.readthedocs.io/en/stable/middleware.html#geth-style-proof-of-authority for more details. The full extraData is: HexBytes('0xd883010703846b6c617988676f312e31352e37856c696e757800000000000000f90164f85494571e53df607be97431a5bbefca1dffe5aef56f4d945cb1a7dccbd0dc446e3640898ede8820368554c89499fb17d324fa0e07f23b49d09028ac0919414db694b74ff9dea397fe9e231df545eb53fe2adf776cb2b8417ecacf557255c26d121cf3708de5ce4f11df5766ad3d8d650aec16553e9004187df9fe31a665d244951f76a4f032963e223ba04304623e9d59607debb192898d00f8c9b84195808f73d27a1ce1f8c740c858d5ffb8ee2e8c3a8a533f73b0f2cb1398ada422591a5ae39249011a35be0c84eafb9bbf59b593d31aab9dc342b14d0b0ab58fa201b841defe316c7840d36740bdccef3d315995b4da5c4562aabb06ac19b862802df55f5e6e9128db01fb82688810a866a2e8e7a60499a070f0ae02edc9d51dacafd9b201b8415260b00e49805dc26799c96fa0cfde0e8db06b08edb644eab4d08f64271d7cea0c754553ca90ae82ed633fc146609da2aef4effe4a97d3cc6021b102ed476d1f00')

../../../opt/anaconda3/envs/brown39/lib/python3.9/site-packages/web3/middleware/validation.py:71: ExtraDataLengthError

How to reproduce

ERC721_VYPER_CONTRACT.vy

https://github.com/ActorForth/bitcoincash-research/blob/master/Vyper/ERC721_OpenSeaTest.vy

requirement.txt

cytoolz==0.11.2
eth-brownie==1.17.2
pytest==6.2.5
vyper==0.3.1
web3==5.25.0
pytest-bdd==5.0.0

test_deploy.py

from web3 import Web3
from web3 import HTTPProvider
from web3.middleware import geth_poa_middleware
import pytest
import brownie
import logging


w3 = Web3(HTTPProvider("https://public-node-api.klaytnapi.com/v1/baobab"))
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
logging.getLogger("web3.providers.HTTPProvider").setLevel(logging.DEBUG)

def test_token_contract_ERC1155(ERC721_VYPER_CONTRACT, accounts):
    accounts.add(PRIVATE_KEY)
    accounts[0].deploy(ERC721_VYPER_CONTRACT)

Setup test

install dependency
pip install requirement
setup chain network

brownie networks add Ethereum klaytn-baobab host=https://public-node-api.klaytnapi.com/v1/baobab chainid=1001

run test deploy ERC721 Vyper contract

brownie test tests/test_Blockchain_Performance.py -vv --network klaytn-baobab --durations=0 --gas -s

Expected behavior
Able to deploy the contract on testnet baobab successfully

Attachments
Full log

Environment (please complete the following information)

  • caver-js: not use
  • OS and its version: macOS/12.0

Additional context
I'm a Vyper smart contract developer the tooling and source code is mainly developed using Python. Migrating to JS or JAVA is not an option.

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

No branches or pull requests

1 participant