-
Notifications
You must be signed in to change notification settings - Fork 4
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
Test hmnd #220
Test hmnd #220
Conversation
match &self.client { | ||
GenericClient::Astar(client) => client.finalized_block().await, | ||
GenericClient::Humanode(client) => client.finalized_block().await, | ||
GenericClient::Ethereum(client) => client.finalized_block().await, | ||
GenericClient::Polkadot(client) => client.finalized_block().await, | ||
} |
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.
Consider using https://docs.rs/trait_enum for things like this
// convert address | ||
let dest = { | ||
let address: H160 = address.address().parse()?; | ||
let mut data = [0u8; 24]; | ||
data[0..4].copy_from_slice(b"evm:"); | ||
data[4..24].copy_from_slice(&address[..]); | ||
let hash = sp_core::hashing::blake2_256(&data); | ||
AccountId32::from(Into::<[u8; 32]>::into(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 don't think this is valid for Humanode network
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.
Sure, it doesn't work for Humanode. I see the same logic is used in other places of this PR.
In Humanode, EVM and Native substrate addresses are fully independent. You can't convert native to hmnd and vice versa.
// Frontier `eth_getBalance` returns the reducible_balance instead the free balance: | ||
// https://github.com/paritytech/frontier/blob/polkadot-v0.9.43/frame/evm/src/lib.rs#L853-L855 | ||
// using substrate to get the free balance | ||
let address = address | ||
.evm_to_ss58(Ss58AddressFormat::custom(42)) | ||
.map_err(|err| anyhow::anyhow!("{}", err))?; | ||
let account_info = self.account_info(&address, Some(block)).await?; | ||
account_info.data.free |
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.
Humanode version returns the exact free balance, we apply own patch to meet general eth logic - humanode-network/frontier@a06c5f0.
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.
Also, note that for the EVM integration you'd need to use the JSON-RPC API to interact with the network. Alternatively, you can use the evm_system
pallet:
It is not possible though to submit an EVM transaction signing it with Substrate account signature. But the above pallet would work to determine the balance.
Need to reconfigure whole humanode |
No description provided.