by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 08 14:27
    nolash opened #1702
  • Aug 08 14:25
    nolash commented #1700
  • Aug 08 14:25
    nolash commented #1700
  • Aug 07 06:03
    esraa95mahmoud commented #1698
  • Aug 06 20:14
    marcgarreau labeled #1700
  • Aug 06 20:13
    marcgarreau commented #1700
  • Aug 06 15:51
    kclowes closed #1698
  • Aug 06 15:51
    kclowes commented #1698
  • Aug 06 15:50
    MatthiasLohr commented #1490
  • Aug 06 15:23
    kclowes commented #1701
  • Aug 06 11:51
    esraa95mahmoud commented #1698
  • Aug 06 07:01
    esraa95mahmoud commented #1698
  • Aug 06 06:47
    nolash edited #1701
  • Aug 06 06:46
    nolash edited #1701
  • Aug 06 06:44
    nolash opened #1701
  • Aug 06 05:24
    nolash edited #1700
  • Aug 06 05:23
    nolash edited #1700
  • Aug 06 05:23
    nolash opened #1700
  • Aug 03 21:32
    pipermerriam commented #1699
  • Aug 03 20:18
    pipermerriam commented #1699
Jason Carver
@carver
So this is why I was recommending using the "intended validator" approach
Abhishek Kumar
@kuabhish

Hey @carver
As you had suggessted I tried

from eth_account.messages import encode_defunct, encode_intended_validator
msg = Web3.soliditySha3( [ 'address' , 'uint256' ] , 
                   [ Web3.toChecksumAddress("0x516510e3B61F3D425Fe5F52D7492E8950C8647D7") , 500])
message = encode_intended_validator(Web3.toChecksumAddress("0x09c1814a3c53c025f354a9d7b88e28a084d0f162"),
                                    hexstr=msg.hex())
print("message" , message)
signed_message = w3.eth.account.sign_message(message, private_key=private_key)

But this time the signed_message.messagehash and what i got from solidity are diffrent :(

Voith Mascarenhas
@voith
@kuabhish If I had to figure this out then I would read the source code of eth-accounts:
https://github.com/ethereum/eth-account
Abhishek Kumar
@kuabhish
ohh great .. thanks ..
Abhishek Kumar
@kuabhish
@voith checked the code a little ,, but couldn't figure out where the difference is..
Voith Mascarenhas
@voith
did you go through the tests?
Abhishek Kumar
@kuabhish

@carver I also used this https://eips.ethereum.org/EIPS/eip-191

and so made a little code change :

keccak256(abi.encodePacked(byte(0x19),byte(0),address(this),destination, value, data, nonce));

Still didn't match

did you go through the tests?

I forgot .. i ll check tyhe tests now ..

Abhishek Kumar
@kuabhish
@voith the tests gave a good insight hoe it works ,, thanks man
Ben Hauser
@iamdefinitelyahuman
hey web3py team.. right now you're raising a ValidationError when a POA network returns >32 bytes of extraData and the geth_poa_middleware isn't active. I want to handle this automatically in Brownie.. when connecting to a new network, query an endpoint and if this error is raised, add the middleware. I can do so by examining at the string of the ValidationError but that feels brittle. Wondering if you'd be open to instead raising a new exception, POAValidationError or ExtraDataError? This exception can subclass ValidationError so the change won't break anything, and this way there is a much stronger approach for catching the specific error.
Eth-Gitter-Bridge
@Eth-Gitter-Bridge
<carver> Yup, something like an ExtraDataLengthError that subclasses ValidationError seems reasonable πŸ‘
Ben Hauser
@iamdefinitelyahuman
@carver thanks! i'll make a PR shortly
Abhishek Kumar
@kuabhish

Hi, guys

var hash = "0x" + abi.soliditySHA3(
        ["address", "uint256"],
        ["0x516510e3B61F3D425Fe5F52D7492E8950C8647D7", 500]
    ).toString("hex");
var signature = web3.eth.accounts.sign( hash , privateKey );

I was able to solve my issue by using nodejs .. using this code the signature.messagehash == solidity message hash.. But I wanted to write the Api in python only.. Why can't i solve it with python??

Marc Garreau
@marcgarreau
glad you have some form of solution @kuabhish. we’re all juggling a few things at once; if you can write up an issue with your best understanding of the problem, we would appreciate it. that makes the history of context easier to track without scrolling through Gitter.

======

web3.py v5.11.0 released :rocket: https://web3py.readthedocs.io/en/latest/releases.html#v5-11-0-2020-06-03

Thanks to contributors @palango @iamdefinitelyahuman @cygnusv @cryptoscopia :muscle:

Abhishek Kumar
@kuabhish
Ok sure @marcgarreau I will write an issue about it properly.
Marc Garreau
@marcgarreau
thanks!
Abhishek Kumar
@kuabhish
Hey @marcgarreau I have written an issue..
ethereum/web3.py#1667
Please review and tell if it is alright
Marc Garreau
@marcgarreau
that looks like a great starting point, thank you for typing it up.
Abhishek Kumar
@kuabhish
no problem bro
Ben Hauser
@iamdefinitelyahuman
ahh wow guys, thanks for pushing a new release right away! @marcgarreau @carver
didn't expect to have that new exception available right away
Marc Garreau
@marcgarreau
You had good timing ;)
Steven Nevins
@dmintercept
I have a quick question about web3.py would using the filter class save me Infura calls if I want to get all transactions for a specific contract vs iterating through each block?
Adam Bavosa
@realadambavosa_twitter
hello, I am the devrel lead at Compound. did someone need help with code?
Ben Scherrey
@scherrey
Is there a consistent mechanism to estimate average gas prices and their quartiles so transactions can be created with optimal gas prices from inside python? Seems many people are relying on Metamask to give them numbers.
Eth-Gitter-Bridge
@Eth-Gitter-Bridge
<carver> @realadambavosa_twitter -- yeah someone linked an ABI for a contract that looks malformed: it has a several duplicates of the same function, like admin(), which triggers a validation error in web3.py. I can't think of a good reason for there to be such duplicates in the ABI intentionally, it just looks broken. Maybe you could publish one that doesn't have duplicates? https://compound.finance/docs/abi/mainnet/Comptroller
<carver> > Is there a consistent mechanism to estimate average gas prices and their quartiles so transactions can be created with optimal gas prices from inside python? Seems many people are relying on Metamask to give them numbers.
This is a much harder problem than it sounds like, with a lot of intricacies. There is a gas estimator in web3, but I wouldn't bet production code on it. Frankly, I'm kind of hoping/figuring that EIP-1559 will solve it before we get around to writing a more complicated one.
2 replies
Adam Bavosa
@realadambavosa_twitter
ah ok I understand, I will investigate this issue!
Mikko Ohtamaa
@miohtama
The gas estimator coming from Ethereum nodes is crappy at the best
Mikko Ohtamaa
@miohtama
My recommendation is
1) have an app level configuration where devops can adjust the recommended gas price based on a data feed
2) always set gasLimit for the transactions, as often the estimator cannot determine the spent gas, defaults to the max value 9M GWei and then gives you an absurd estimation like $1000/tx
Adam Bavosa
@realadambavosa_twitter
About Compound's Comptroller ABI: We have identified the issue that causes multiple member references. We will deploy the update and fix the ABI in the docs soon. Thank you @miohtama for bringing this issue to our attention!
Eth-Gitter-Bridge
@Eth-Gitter-Bridge
<carver> πŸ‘
Mikko Ohtamaa
@miohtama
@realadambavosa_twitter Thank so you much. Do you have a Github issue link? If it is some common pattern other projects may suffer this as well.
Eth-Gitter-Bridge
@Eth-Gitter-Bridge
<carver> Agree, very unlikely to get to Berlin. Some conversation at https://ethereum-magicians.org/t/eip-1559-fee-market-change-for-eth-1-0-chain/2783/76
Stellarize
@Stellarize
hello i'm new to web3.py hope will get beautiful experience here . thanks
Eth-Gitter-Bridge
@Eth-Gitter-Bridge
<Christoph> Welcome Stellarize!
brschkv
@brschkv
Does anyone else have problems with querying event logs from infura? I always run into "TimeoutError" if I query events further in the past than about 30 days. Seems to be related to this issue: https://community.infura.io/t/ropsten-websocket-event-timeout-with-web3-py/1078/3
Works completely fine back to block 0 with web3.js Contract.getPastEventLogs().
Mikko Ohtamaa
@miohtama
@brschkv You cannot query too big chunks. You need to paginage your queries.
because it puts too big strain on their database and then timeouts because it cannot reply fast enough
brschkv
@brschkv
I did with varying chunk sizes (1000 blocks to 50_000 blocks), but always the same error at around the same time.
LATEST_BLOCK = 10226095
STEP_SIZE = 100_000

for i in range(0, int(1_000_000 / STEP_SIZE)):
    filter_builder = cDAI.events.LiquidateBorrow.build_filter()
    filter_builder.fromBlock = LATEST_BLOCK - ((i + 1) * STEP_SIZE)
    filter_builder.toBlock = LATEST_BLOCK - (i * STEP_SIZE)
    filter_instance = filter_builder.deploy(w3)
    entries = filter_instance.get_all_entries()
    if len(entries) > 0:
        print(i, entries)
Mikko Ohtamaa
@miohtama
@brschkv does it crash on a specific block
I would assume the start of the historical chain is empty, util you start to see much activity after the launch
and you can simply workd around it by decreasing the step size and starting when cDAI was launched
brschkv
@brschkv
I will try and find out if it crashes on a specific block. It does crash around the same time (about a month in the past) with each step_size, but definitely after cDAI was launched.
Mikko Ohtamaa
@miohtama
@brschkv Usually to make things developer friendly (if you ever develop smart contracts) add a running counter index to your events so they are easier to query