I have a simple contract with a function that should return a byte32
which is passed as a parameter.
This is a snippet of my contract
contract SimpleContract{
function simple(byte32 toReturn, byte32 otherArg) public returns (byte32){
//Work with the values
return toReturn; //Unmodified
}
}
Now, if I test it in Solidity, works seamlessly, but since I want to run more complex test, I turned to Truffle and used its JS library to run the test. Specifically, simple
is tested this way:
contract("SimpleContract", function(accounts){
it("should return the passed value", function (){
SimpleContract.deployed().then(function(instance){
var arg1 = 0xec40808d22324ec2fd140c398284c2a263871d111f54eb6f1b308c874ea1abc9;
var arg2 = 0x1234567890;
instance.simple.call(arg1, arg2).then(function(returnedValue){
expect(returnedValue).to.equal(arg1);
});
});
});
});
Then I get this error:
AssertionError: expected 'ec40808d22324ec2fd140c398284c2a263871d111f54eb6f1b308c874ea1abc9' to equal '0xbd4419d46aafe6c72f31a89e54fd9976c34fe7cd385253d36e4226f94376e6dd'
I suspect there is some encoding issue, but I still haven't been able to wrap my head around it.
function simple(bytes32 toReturn, bytes32 otherArg) public constant returns (bytes32)
byte32
isbytes32