-
Notifications
You must be signed in to change notification settings - Fork 86
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
Feature owen eth rooch address mapping #348
Feature owen eth rooch address mapping #348
Conversation
|
||
let transaction = resp.map(|_transaction_view: TransactionView| -> Transaction { | ||
Transaction { | ||
hash: H256::from_str("0x7fd17d4a368fccdba4291ab121e48c96329b7dc3d027a373643fb23c20a19a3f").unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the real tx hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The transaction_view's raw is the original eth tx. We can improve this function result in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but here's a question, is it possible to view transactions created through the Rooch API.
let hash = blake2b256(&maddress.raw_address); | ||
option::some(moveos_std::bcd::to_address(hash)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think creating a new address in the resolve function is not a good idea because we can not ensure that the address mapping exists via the resolve function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An available Rooch address must be returned here, otherwise MetaMask wallet users will prompt an error when they initiate a transaction for the first time: the multiaddress sender({}) mapping record is not exists.
The idea here is to temporarily use the ETH address to obtain the Rooch address through Hash, and after the transaction is executed, complete the creation of the Rooch account and the mapping of the address in post_execute.
The reason why the ETH public key is not used as the Rooch address as previously discussed is because the ETH public key cannot be obtained in the resolve contract method. If the resolve signature is reconstructed later, it should be changed to use the ETH public key as the Rooch address. Rooch address. But I feel that this solution is not universal enough. When we need to support a new L1 public chain, we need to adapt here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this TBD. We can generate the address in the rust code. The rust code can get the ETH signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge this PR first, make the eth address TBD
* commit '4b1455160a92181c304e87395cf94328aa611a7b': [Testing] moveos_stdlib::account_storage (rooch-network#355) add release workflow (rooch-network#343) [cli] return a string for init command. (rooch-network#347) Feature owen eth rooch address mapping (rooch-network#348) Fix the issue of illegal invocation of private_generics in the module without throwing an error. (rooch-network#345)
Successful debugging of calling the Move contract through MetaMask:
When the Rooch address cannot be found according to ETH, use blake2b256(eth_address) to automatically generate the Rooch address