ganache-ui icon indicating copy to clipboard operation
ganache-ui copied to clipboard

Incorrect display of value in contract storage

Open rinze32 opened this issue 2 years ago • 3 comments

Truffle v5.5.20 Ganache 2.5.4

Reproducible: Yes

Create new project then open cmd

truffle init

add Sample.sol contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Sample {
    uint256 public balance;

    constructor() payable {
        balance = address(this).balance;
    }
}

modify 1_initial_migration.js

const Migrations = artifacts.require("Migrations");
const Sample = artifacts.require("Sample");

module.exports = function (deployer) {
  deployer.deploy(Migrations);
  deployer.deploy(Sample, {
    value: 10000000000000000000,
  });
};

Create new workspace and connect to truffle config

on CMD

truffle migrate

In Ganache -> Contracts -> Sample Storage

Input Value: 10000000000000000000 (decimal)

Displayed Value: 9127230490480000 Copied Value: 8ac7230489e80000 (hex) (This is correct)

Using the copy button gives correct value.

maybe this will help every other 4 bytes of hex is the error

8ac7 + 0660 = 9127

89e8 + 0660 = 9048

rinze32 avatar Jul 06 '22 07:07 rinze32

Hi @rinze32! We are starting a large effort to upgrade the Ganache UI to use the latest version of Ganache. This is going to take some time on our end, but it should resolve this and many other issues with the UI. It might be your best bet to try using the CLI version of Ganache, which can be installed via npm. Here are the installation instructions. For now, we're going to transfer this issue to the Ganache-UI repository so that we can be sure this fix is included when we upgrade the UI.

MicaiahReid avatar Jul 07 '22 16:07 MicaiahReid

@MicaiahReid

We are starting a large effort to upgrade the Ganache UI to use the latest version of Ganache. This is going to take some time on our end, but it should resolve this and many other issues with the UI.

That's excellent! How's the progress? Is there an issue we can subscribe to for updates?

rsodre avatar Aug 18 '22 15:08 rsodre

Hi @rsodre. This is still planned, but no updates yet. You can star this repo to subscribe to updates!

MicaiahReid avatar Aug 23 '22 16:08 MicaiahReid