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

Unable to deploy contract from web3.py #7900

Open
maoudia-via opened this issue Nov 21, 2024 · 0 comments
Open

Unable to deploy contract from web3.py #7900

maoudia-via opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@maoudia-via
Copy link

maoudia-via commented Nov 21, 2024

Steps to Reproduce

I used the following code to deploy a smart contract on Besu with a gasless setup:

def deployed_contract():
    w3 = get_provider()
    contract = get_contract()
    owner_account = get_contract_owner_account()
    transaction = contract.constructor().build_transaction(
        {
            "nonce": w3.eth.get_transaction_count(owner_account.address),
            "gas": 1000000,
            "gasPrice": 0,
            "chainId": CHAIN_ID,
        }
    )
    signed_transaction = owner_account.sign_transaction(transaction)
    tx_hash = get_provider().eth.send_raw_transaction(
        signed_transaction.raw_transaction
    )
    
    try:
        tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash, timeout=60)
    except Exception as e:
        print(f"Error in deploy transaction {e}")
        raise
    assert tx_receipt.status == 1, f"Contract deployment failed {tx_receipt.logs}"
    deployed_contract = w3.eth.contract(
        address=tx_receipt.contractAddress, abi=contract.abi
    )
    print(f"contract deploy receipt items {tx_receipt.items()}")
    return deployed_contract

The contract itself is built via a solc command and I was able to compile and deploy it on the quorum explorer (contracts tab).

Expected behavior: The transaction receipt should have a status equal to 1.

Actual behavior: The transaction receipt has a status equal to 0 and I am unable to interact with the contract functions properly. I am able to interact.with the smart contract if I deploy it using quorum explorer.

Frequency: Every time

Logs

Transaction receipt attributes:

AttributeDict({'blockHash': HexBytes('0xea1dbc47478ad8775e9ac727cbe9471136fbdab7a4d24ca2788feb4f4af0574d'), 'blockNumber': 97575, 'contractAddress': '0x200070cfd443C125b9E8D472c09D1C1EECEae107', 'cumulativeGasUsed': 1000000, 'from': '0x9Bf048626634F6984793727C13aA73d6D5c06c97', 'gasUsed': 1000000, 'effectiveGasPrice': 0, 'logs': [], 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'status': 0, 'to': None, 'transactionHash': HexBytes('0xa0ec6ff133f3fd036c785cc8d594b11f7128ee8a29c13844fdc5b079a35127ab'), 'transactionIndex': 0, 'type': 0}).status

Versions (Add all that apply)

web3 7.5.0

Smart contract information (If you're reporting an issue arising from deploying or calling a smart contract, please supply related information)

  • Solidity version :
    solc, the solidity compiler commandline interface
    Version: 0.8.28+commit.7893614a.Darwin.appleclang
@maoudia-via maoudia-via added the bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant