Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the position of Metadata.CKB_RELATED_INFO_KEY? #1565

Closed
yangby-cryptape opened this issue Nov 16, 2023 · 2 comments
Closed

What's the position of Metadata.CKB_RELATED_INFO_KEY? #1565

yangby-cryptape opened this issue Nov 16, 2023 · 2 comments
Labels
question Further information is requested

Comments

@yangby-cryptape
Copy link
Collaborator

Question

I want to get the proof of Metadata.CKB_RELATED_INFO_KEY through eth_getProof.

What's the position (or storage keys) of it?

/// | CKB_RELATED_INFO_KEY | `CkbRelatedInfo.encode()` |

axon/core/api/README.md

Lines 1081 to 1087 in 835cb16

#### Method `eth_getProof`
##### Params
* `DATA`, 20 Bytes - address of the account.
* `ARRAY`, 32 Bytes - array of storage-keys which should be proofed and included. See eth_getStorageAt
* `QUANTITY|TAG` - integer block number, or the string "latest" or "earliest", see the default block parameter

axon/core/api/README.md

Lines 1910 to 1917 in 835cb16

#### Method `eth_getStorageAt`
* `eth_getStorageAt(address,position,number)`
* `address`: [`H160`](#type-H160)
* `position`: [`U256`](#type-U256)
* `number`: [`BlockId`](#type-BlockId)
* result: [`Hex`](#type-Hex)
Returns the value from a storage position at a given address.

In Further

If I'm incorrect, please point out.

I have only read some documents from the internet.

In my understand, the positions are defined as following:

contract Demo {
    uint     a = 1;
    uint128  b = 2;
    uint32   c = 3;

    /* ... omit ... */
}
storage(position = 0) is 0x0000000000000000000000000000000000000000000000000000000000000001
                                                                                          ^
storage(position = 1) is 0x0000000000000000000000000000000300000000000000000000000000000002
                                                          ^                               ^

Also, the position will be the key in the storage.

Since Axon system contracts use self-defined keys for all state variables, how could users to get those keys?

If one data has more than 256 bits, it will have more than 1 position.
If data type is array or map, it's more complex.
But each data for Axon system contracts has only one key, how to process these situations?

References

@yangby-cryptape yangby-cryptape added the question Further information is requested label Nov 16, 2023
@yangby-cryptape yangby-cryptape changed the title [Question] What's the position of Metadata.CKB_RELATED_INFO_KEY? What's the position of Metadata.CKB_RELATED_INFO_KEY? Nov 16, 2023
@yangby-cryptape
Copy link
Collaborator Author

Have been answered in #1561 (comment).

@KaoImin
Copy link
Contributor

KaoImin commented Nov 16, 2023

Duplicated with #1561

@KaoImin KaoImin closed this as completed Nov 16, 2023
@yangby-cryptape yangby-cryptape closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants