Giter Site home page Giter Site logo

Comments (5)

tymat avatar tymat commented on May 21, 2024

See this for our rationale:

https://github.com/LeastAuthority/ethereum-analyses/blob/master/GasEcon.md#predictability

from truffle.

tcoulter avatar tcoulter commented on May 21, 2024

Hi @tymat. If I understand what you wrote correctly, this is already built in. Truffle uses Pudding under the hood, which makes ABI functions and sendTransaction() not call their callback until the transaction has been processed. The syntax is different than your example, but the effect is the same. Pudding uses promises to allow you to write the following:

val = "..." # some address
test = TestContract.at(TestContract.deployed_address)
test.setter(val, {from: caller}).then (tx) ->
  # This code block won't be executed until the transaction tx has been processed.
  # Note: The next line returns a promise.
  test.addr.call()
.then (addr) ->
  assert.isEqual(addr, val)

This should produce the effect you're looking for. Let me know if I misunderstood.

from truffle.

tcoulter avatar tcoulter commented on May 21, 2024

The function within Pudding that does exactly what you described is here: https://github.com/ConsenSys/ether-pudding/blob/master/src/pudding.coffee#L100

from truffle.

tymat avatar tymat commented on May 21, 2024

@tcoulter Thanks. That seems to work. Is there a way to set the timeout values?

from truffle.

tcoulter avatar tcoulter commented on May 21, 2024

Ya, that's a feature of mocha. There are three different scopes the timeouts can apply to. Consider this example:

contract "TestContract", (accounts) ->
  # Each test has a timeout of ten seconds.
  @timeout(10000) 

  before "do something before", (done) ->
    # This before() hook has a timeout of 15 seconds.
    @timeout(15000)

  it "should test something", (done) ->
    # This test has a timeout of 30 seconds.
    @timeout(30000)

  it "should do something else", (done) ->
    # This test only has a timeout of 10 seconds, based on the timeout above.

from truffle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.