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

[Meta] ChainId #4583

Closed
sydhds opened this issue Dec 8, 2023 · 3 comments
Closed

[Meta] ChainId #4583

sydhds opened this issue Dec 8, 2023 · 3 comments

Comments

@sydhds
Copy link
Contributor

sydhds commented Dec 8, 2023

Intro

ChainId implementation for Massa

Documentation

ChainId idea comes from Etherum (and was required to separate the network between Ethereum & Ethereum Classic)

Ethereum ChainId

Example code from Umbrella:

function update(
    bytes32[] calldata _priceKeys,
    PriceData[] calldata _priceDatas,
    Signature[] calldata _signatures
) external {
    if (_priceKeys.length != _priceDatas.length) revert ArraysDataDoNotMatch();

    bytes32 priceDataHash = keccak256(abi.encode(getChainId(), address(this), _priceKeys, _priceDatas));
    verifySignatures(priceDataHash, _signatures);

    ...
}

function getChainId() public view returns (uint256 id) {
    // solhint-disable-next-line no-inline-assembly
    assembly {
        id := chainid()
    }
}

Implementation

Remaining questions

@damip
Copy link
Member

damip commented Dec 11, 2023

@sydhds
Copy link
Contributor Author

sydhds commented Dec 12, 2023

@sydhds
Copy link
Contributor Author

sydhds commented Dec 12, 2023

  • PR to chain id list site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants