-
Notifications
You must be signed in to change notification settings - Fork 99
feat: declare precompiles using builder #1129
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here as above
talhadaar
left a comment
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.
Needs stylistic cleanup, clippy and fmt, otherwise LGTM
TODO:
Features: