feat: declare precompiles using builder - #1129
Conversation
|
Crate versions that have been updated:
Runtime version has been increased. |
|
Quick benchmark at commit 52ca911 has been executed successfully. |
| sender: crate::contracts::deployer(), | ||
| origin: crate::contracts::deployer(), | ||
| }; | ||
| let (res, data) = Executor::<Runtime>::call(context, data, U256::zero(), 100_000); |
There was a problem hiding this comment.
res here is entirely unused so maybe replace with a underscore(_)?
| use primitives::constants::currency::UNITS; | ||
| use primitives::{AssetId, Balance}; | ||
| use sp_core::Get; | ||
| use sp_core::{H256, U256}; |
There was a problem hiding this comment.
This will need a round of cargo fmt and clippy fixes, reduce redundancies and make stuff more readable
| pub fn is_oracle_address(address: H160) -> bool { | ||
| let oracle_address_prefix = &(H160::from(hex!("0000010000000000000000000000000000000000"))[0..3]); | ||
| pub fn oracle_address_prefix() -> Vec<u8> { | ||
| H160::from(hex!("0000010000000000000000000000000000000000"))[0..3].to_vec() |
There was a problem hiding this comment.
Maybe think about evaluating this manually and keeping this as a constant somewhere in this file rather than deriving each time? In my opinion, that's always easier to maintain and much cleaner, however depending on the usage this should be meh
| pub fn is_asset_address(address: H160) -> bool { | ||
| let asset_address_prefix = &(H160::from(hex!("0000000000000000000000000000000100000000"))[0..16]); | ||
| pub fn asset_address_prefix() -> Vec<u8> { | ||
| H160::from(hex!("0000000000000000000000000000000100000000"))[0..16].to_vec() |
There was a problem hiding this comment.
Same comment here as above
talhadaar
left a comment
There was a problem hiding this comment.
Needs stylistic cleanup, clippy and fmt, otherwise LGTM
|
Closed as we discussed that the refactoring touches core layer of ethereum transaction, involving risks, with little gain. |
TODO:
Features: