With a truffle version of 4.1.0, using truffle debug on a call of my contract function below:

function Deposit (uint256 timeout, bytes32 hash, address recipient)
        public payable returns (uint256)
        require( timeout >= now );
        require( timeout < (now + MAX_TIMEOUT) );
        require( msg.value > 0 );

        var lock_id = m_ctr;
        m_ctr += 1;
        m_locks[lock_id] = LockState(timeout, hash, recipient, msg.sender, msg.value);

        OnDeposit(lock_id, recipient);

        return lock_id;

as (via geth):

Deposit(1521568000, '0xffcec51439a3a7195c8f5c32732bfc2bf66688a13c1d52fc9d5e548f4733b5c1,', "0x0e0060f625534293d280547bd8a782da45333b95", {from: "0x4a7268f1982acd8e405e2d8d26075480e0d6fe8f", gas:900000, value: 1})

the debug console reveals that the second argument hash is null.

5: function Deposit (uint256 timeout, bytes32 hash, address recipient)
6:     public payable returns (uint256)

debug(testnet1:0x2b899125...)> v

      lock_id: undefined
      timeout: 1521568000
         hash: null
    recipient: '0x0e0060f625534293d280547bd8a782da45333b95'
             : 117
      m_locks: null
        m_ctr: 0

Considering that there is no such thing as null in Solidity, I am confused at the reported value of the hash argument. More importantly, passing a value for this parameter has resulted in it being reported back as null by truffle debug.

It has received the first argument timeout and third argument recipient correctly as expected so the call itself seems to be well-formed.

Another variable also seems to be reported back as null whilst another is undefined. What are the differences between them and why have they been assigned different 'values'?

Why is my hash argument being interpreted as null when being passed appropriate values?

  • 2
    Did you ever figure this out? I have the same issue; variables that are not null and are in use appear null. – Inn0vative1 Apr 22 '18 at 5:30
  • Unfortunately not. I abandoned the problem... If you ever find anything, please do let me know. – Shiri Apr 23 '18 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.