embarklabs / embark

Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms

Home Page:https://framework.embarklabs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

from address being ignore in tests

opened this issue · comments

Bug Report

Summary

I am trying to set the from address in some tests to make sure correct address is being used. However, it seems that the address is being ignored.

        // await UTO.setBeneficiary(0x0, {from: owner}).should.be.rejectedWith(EVMInvalid);
        await UTO.setBeneficiary(owner, {from: "0x123"});
        (await UTO.beneficiary()).should.deep.equal(owner);
     });

You can see I am purposely using an invalid address, yet the test does not throw an error and the funcion seems to be called correctly.

Hi @adamjamesmartin . You seem to be using the old web3js syntax, so first, I'd like to know which version of Embark you use.
Even though we still support the old syntax, I want to make sure you are not using an overly old version of Embark.

Either way, I think using the new web3js syntax could fix the issue. Could you try the following:

await UTO.methods.setBeneficiary(owner).send({from: "0x123"});
(await UTO.methods.beneficiary().call()).should.deep.equal(owner);

Finally, if the above code still works, could you give us a link to your repository, or if it is not possible, copy the code of the whole test and the UTO contract so that we can check if there is not a small mistake hidden.

Hi @jrainville . Thanks, that worked. I am using embark 5.2.3. As a side note, where do I go to find information for all types of EVM Errors, for example.. I currently look for:

const EVMThrow = 'revert';
const EVMInvalid = 'invalid opcode';

But seems there are new ones?

Great news!

For the EVM errors, I'm not sure. Maybe in the web3js docs or the EVM specs. Sorry I can't help you further on this one

Thanks