1

The code:

pragma solidity <0.9.0;

contract Callee {
    address public a;
    address public b;
 
    function test(uint256 i) public returns(uint256){
        a=address(this);
        b=msg.sender;
        return i+1;
    }
}

After compiled by Remix and Truffle, the numbers after PUSH are different.

enter image description here

Environment:

  1. Remix:
  • compiler: 0.8.13+commit.abaa5c0e
  • evm version: london
  • 'enable optimization' unchecked
  • run environment: Javascript VM (London)
  1. Truffle:
  • compiler: native solc 0.8.13+commit.abaa5c0e.Linux.g++
  compilers: {
    solc: {
      version: "native", 
       settings: { 
        optimizer: {
          enabled: false,
          //runs: 200
        },
        evmVersion: "london"
       }
    }
  },

What causes the difference?

1
  • Remove <0.9.0 and use exactly pragma solidity 0.8.13
    – Majd TL
    Apr 30 at 12:13

0

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.