2

enter image description here

what is the meaning of this key?

it's not a memory address of value - this is thisobject.key


contract code (but it doesn't matter)

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.12;

struct Xx { int256 x; }


contract Storage {
    mapping(uint256 => bool) public mappingName;
    Xx yy;
    bool mybool;
    
    constructor () {
        mybool = true;
        mybool = false;
        mappingName[1] = true;
        mappingName[4] = true;

        mappingName[3] = false;
        yy = Xx(0x01);
    }
    
    /**
     * @dev Store value in variable
     */
    function store() public returns (bool) {
        bytes32 asdf;
        assembly {
            asdf := sload(0x3f9553dc324cd1fd24b54243720c42e18e5c20165bc5e523e42b440a8654abd1)
            asdf := sload(0xada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7d)
            asdf := sload(0x8c5463c4917005f6f56c5b404257d4579d1c38c101ead4559bdf4510fcfa0ebd)
            asdf := sload(0x52d75039926638d3c558b2bdefb945d5be8dae29dedd1c313212a4d472d9fde5)
        }
       mappingName[1] = false;
       delete mappingName[4];

       return mappingName[1];
        
    }
}

EDIT

in code it is called innerkey

https://github.com/ethereum/remix-project/blob/6e896f3676a01fbb332adf6cf1873008640a49b8/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx#L210

which is a key of calldata object

not this https://github.com/ethereum/remix-project/blob/6e896f3676a01fbb332adf6cf1873008640a49b8/libs/remix-ui/debugger-ui/src/types/index.ts#L21

but this https://github.com/ethereum/remix-project/blob/6e896f3676a01fbb332adf6cf1873008640a49b8/libs/remix-ui/debugger-ui/src/reducers/calldata.ts#L7

2
  • Can you include the contract as text?
    – Ismael
    Commented Oct 11, 2021 at 16:34
  • @Ismael added, tnx
    – srghma
    Commented Oct 12, 2021 at 9:49

1 Answer 1

1

It appears that the top level key is the keccak256 hash of the key value under it. For example below are the storage values displayed in Remix debugger in a dummy contract I wrote. The keccak256(000...0001) = 0xb10e...cf6, keccak256(e5585...4994) = 0xc5f7...3e6d etc.

This is shown this way because of how the account storage data structure Trie encodes into the trie a mapping from the Keccak256-bit hash of the 256-bit integer keys to the RLP-encoded 256-bit integer values. See "storageRoot" explantion in the image at https://i.sstatic.net/afWDt.jpg and for more information see - https://medium.com/shyft-network/understanding-trie-databases-in-ethereum-9f03d2c3325d

{
    "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6": {
        "key": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "value": "0x07855b46a623a8ecabac76ed697aa4e13631e3b6718c8a0d342860c13c30d2fc"
    },
    "0xc5f7bd2ffa69640fdb902c1e99f6e20c5315b1da99817a0ff0bf40db3d863e6d": {
        "key": "0xe5585f670120da72037ceaaf17a48de28247bb09935fce827f7b42f44cfe4994",
        "value": "0x00000000000000000000000000000000000000000000000000000000000000a1"
    },
    "0x5907fe8790797888d8e2f8ed99b17c95ed9a74b233ef6370039da40c7ba33ab9": {
        "key": "0xc5f7bd2ffa69640fdb902c1e99f6e20c5315b1da99817a0ff0bf40db3d863e6d",
        "value": "0x68656c6c6f68656c6c6f68656c6c6f68656c6c6f68656c6c6f68656c6c6f6865"
    },
    "0xc60576cc8d9783786e09d7eeb7af374ff4cadcff85940ac057b23705362bb5a7": {
        "key": "0xc5f7bd2ffa69640fdb902c1e99f6e20c5315b1da99817a0ff0bf40db3d863e6e",
        "value": "0x6c6c6f68656c6c6f68656c6c6f68656c6c6f68656c6c6f68656c6c6f68656c6c"
    },
    "0x4fa43ab19b07248b845176509abfef01aaf15f03ccafa4eb387319661c08ec63": {
        "key": "0xc5f7bd2ffa69640fdb902c1e99f6e20c5315b1da99817a0ff0bf40db3d863e6f",
        "value": "0x6f68656c6c6f68656c6c6f68656c6c6f00000000000000000000000000000000"
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.