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

Test hmnd #220

Closed
wants to merge 13 commits into from
Closed

Test hmnd #220

wants to merge 13 commits into from

Conversation

ManojJiSharma
Copy link
Contributor

No description provided.

Comment on lines 106 to 111
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,
}
Copy link

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

Comment on lines +255 to +263
// 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))
};
Copy link

@MOZGIII MOZGIII Mar 15, 2024

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

CC @dmitrylavrenov

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.

Comment on lines +240 to +247
// 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

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.

Copy link

@MOZGIII MOZGIII Mar 17, 2024

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:
image
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.

@isabellelaususan isabellelaususan linked an issue May 17, 2024 that may be closed by this pull request
5 tasks
@ManojJiSharma ManojJiSharma removed a link to an issue May 29, 2024
5 tasks
@ManojJiSharma
Copy link
Contributor Author

Need to reconfigure whole humanode

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

Successfully merging this pull request may close these issues.

3 participants