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.

Solidity test invoking function in ABI order instead of original source order

See original GitHub issue
  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

The order of function calls in a Solidity test file doesn’t necessarily match the original file.

Steps to Reproduce

I don’t know exactly how to reproduce this. For example, I created another file with several functions, and they all execute in the order expected.

Expected Behavior

The first function in the test contract should be called, then the second, and so on.

Actual Results

In my case, the first function is called, then the third, then the fourth, and finally the second.

Environment

  • Operating System: Ubuntu 16.04
  • Ethereum client: ganache: installed: X-AppImage-BuildId=4bc085d0-f4f6-11a7-2bf2-7146c546a2c0 image: X-AppImage-BuildId=4bc085d0-f4f6-11a7-2bf2-7146c546a2c0
  • Truffle version (truffle version): Running truffle via node doesn’t offer that option. It was built from a clean download of the truffle git as of 2-23-18.
  • node version (node --version): v6.11.0
  • npm version (npm --version): 3.10.10

I verified that the version I was previously using does invoke the functions in the expected order.:

Solidity v0.4.18 (solc-js)

I discussed this with @gnidan in the gitter. We discussed some related changes: https://github.com/trufflesuite/truffle-compile/pull/42 … I verified that OrderABI was being called in my code. Yet the order was still fubared. Suggestions?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cgeweckecommented, Mar 8, 2018

@fdouglis Believe this is fixed in 4.1.3. Please re-open if not. Thanks again.

1reaction
fdougliscommented, Feb 26, 2018

@cgewecke How about that … The whole reason I had it in its own contract was that I wanted to include Debuggable, but in the test directory, I muffed the syntax to include it. I could have sworn I tried the simple import “./XXX” you suggested, and failed. But it worked here, anyway, and it did run the tests in the correct order. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calling functions of other contracts on Solidity - Medium
In Ethereum, Contract ABI is an interface that defines a standard scheme of how to call functions in a smart contract and get...
Read more >
Expressions and Control Structures - Solidity
Function call arguments can be given by name, in any order, if they are enclosed in { } as can be seen in...
Read more >
Interact with your contracts - Truffle Suite
When you execute a contract's function via a transaction, you cannot receive that function's return value because the transaction isn't processed immediately.
Read more >
Solidity Cheatsheet and Best practices - Manoj
This document is a cheatsheet for Solidity that you can use to write Smart ... Function call arguments can also be given by...
Read more >
Testing by Example — Remix - Ethereum IDE 1 documentation
With Solidity, one can directly verify the changes made by a method in storage by retrieving those variables from a contract. But testing...
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