[Meta] ChainId
sydhds opened this issue · 3 comments
sydhds commented
Intro
ChainId implementation for Massa
Documentation
ChainId idea comes from Etherum (and was required to separate the network between Ethereum & Ethereum Classic)
Ethereum ChainId
- https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
- List of chainId:
- Ethereum SC (Solidity) documentation:
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
- Massa node
- [massa-proto]
- [massa-proto-rs]
- [massa-sc-runtime]:
- implement new abi:
- [old abi] chainid() -> u64
- [grpc] chainid_v1() -> u64
- Gas calibration
- massalabs/massa-sc-runtime#320
- implement new abi:
- [massa]:
- Modify SecureShare impl
- implement abi calls
- Add a new entry in config.toml
- Add to API:
- [jsonrpc] add to get_status() (public api)
- [grpc] add to https://github.com/massalabs/massa-proto/blob/main/proto/commons/massa/model/v1/node.proto
- Add to PublicStatus (privé) & NodeStatus (privé)
- Warning -> Add to the end of the struct to be backward compat
- Add to PublicStatus (privé) & NodeStatus (privé)
- labnet deploy
- #4588
- Massa node test tooling
- [massa-test-framework]:
- Modify op serialization code in Python https://github.com/massalabs/massa-test-framework/pull/24
- [massa-functional-tests]:
- implement a test showcasing invalid transaction replay https://github.com/massalabs/massa-functional-tests/pull/15
- [massa-unit-tests-src]:
- [massa-test-framework]:
- Massa tooling
- [massa-as-sdk]:
- implement abi function
- update doc
- massalabs/massa-as-sdk#316
- [as_abi_proto]:
- OUTDATED - will not be updated
- [massa-as-sdk]:
- Massa projects
- [massa station & massa wallet]
- Massa Wallet: massalabs/station-massa-wallet#856
- Massa Station: massalabs/station#1297
- [massa-web3]:
- Secure share impl modification (Typescript)
- eval: 0.5 days
- Risk: Ben is in holidays next week (until Thursday)
- Next version: 2.3.0?
- massalabs/massa-web3#510
- Secure share impl modification (Typescript)
- [umbrella]:
- Use chainId abi in SC in update function
- Update Certik (Damir)
- eval: 0.5 days
- [massa-explorer]
- https://github.com/massalabs/massa-explorer => test.massa.net/v1
- https://github.com/massalabs/massa.net => test.massa.net
- Other:
- [bearby]:
- Contact Discord channel: #bearby
- Github issue / PR
- bearby-wallet/bearby-extension#56 (bearby extension)
- eval: 1.5 days
- [bearby]:
- [massa station & massa wallet]
Remaining questions
- Should we implement a NetworkId as well?
damip commented
- Update doc https://docs.massa.net/docs/learn/operation-format-execution#signature
- And Update API JSON et GRPC + ABI
sydhds commented
- massa client: check that op can be emitted
- test.massa.net - https://test.massa.net/v1/ -> wallet in js code
sydhds commented
- PR to chain id list site