question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to pass some number of block number during test script in between Txs?

See original GitHub issue

During testing my script, in between transaction calls I want to pass N number of blocks on the ganache blockchain, if possible.

Populus had something as follows: chain.wait.for_block(100), but there is no chain object exist on brownie; is there any alternative object for the chain object?

print(web3.eth.blockNumber) # prints: 100
tx = token.setValue({'from': accounts[0]}) 
tx = token.setValue({'from': accounts[0]}) 
print(web3.eth.blockNumber) # prints: 100

tx = token.setValue({'from': accounts[0]}) 
print(web3.eth.blockNumber) # prints: 100
chain.wait.for_block(100) # I want to pass 100 blocks on the blockchain ...
print(web3.eth.blockNumber) # prints: 200
tx = token.setValue({'from': accounts[0]})

[Q] Does Brownie provide this, if yes how?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
iamdefinitelyahumancommented, Apr 29, 2019

Brownie loads ganache-cli itself when it loads. If you already have ganache running, it won’t recognize that.

I need to document this behaviour and maybe make brownie check for a running copy of ganahe…

1reaction
iamdefinitelyahumancommented, Apr 26, 2019

Yes, it’s possible using the rpc class: https://eth-brownie.readthedocs.io/en/latest/api.html#rpc

>>> web3.eth.blockNumber
1
>>> rpc.mine(100)
Block height at 100

It’s available in the immediately when you load the console. From a script, either from brownie import * or from brownie.network import rpc

Sorry the documentation on this is a bit lacking, I’m in the process of updating it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing and Organizing Tests - Cypress Documentation
Passed. Note that a test can pass after several test retries. In that case the Command Log shows some failed attempts, but ultimately...
Read more >
Guidelines for Specimen Collection and Submission
The laboratory provides educational resources (such as this guidance) to submitters with the aim of maximizing the number of testable specimens we receive....
Read more >
Documentation - Narrowing - TypeScript
Within our if check, TypeScript sees typeof padding === "number" and understands that as a special form of code called a type guard....
Read more >
How to Block Spam Calls - The New York Times
Spam and scam calls are a nuisance, but there are ways to reduce the amount ... If you have a phone number in...
Read more >
Command-line Options | Go Ethereum
... show-deprecated-flags Show flags that have been deprecated snapshot A set of commands based on the snapshot version Print version numbers version-check ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found