-
Notifications
You must be signed in to change notification settings - Fork 253
add getProxies in precompile #2207
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: devnet-ready
Are you sure you want to change the base?
Conversation
precompiles/src/proxy.rs
Outdated
| for proxy in proxies.0 { | ||
| let delegate: [u8; 32] = proxy.delegate.into(); | ||
| result.push(delegate.into()); |
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.
Can we add the proxytype and the delay here
Returning a struct would be nice
This reverts commit 77a8082.
| Self::SudoUncheckedSetCode => Ok(14), | ||
| Self::SwapHotkey => Ok(15), | ||
| Self::SubnetLeaseBeneficiary => Ok(16), | ||
| Self::RootClaim => Err(()), |
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.
Is this intentional? I thought we added root claim operations to proxy filter.
| struct ProxyInfo { | ||
| bytes32 delegate; | ||
| uint256 proxy_type; | ||
| uint256 delay; | ||
| } |
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.
More of a question for my personal knowledge, what is the difference between defining a struct inside the interface scope and out of the interface scope?
| await tx.wait() | ||
| } | ||
|
|
||
| const proxiesAfterAdd = await await api.query.Proxy.Proxies.getValue(convertH160ToSS58(evmWallet4.address)) |
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.
Is the double await expected here?
| impl TryInto<u8> for ProxyType { | ||
| type Error = (); | ||
|
|
||
| fn try_into(self) -> Result<u8, Self::Error> { | ||
| match self { | ||
| Self::Any => Ok(0), | ||
| Self::Owner => Ok(1), | ||
| Self::NonCritical => Ok(2), | ||
| Self::NonTransfer => Ok(3), | ||
| Self::Senate => Ok(4), | ||
| Self::NonFungible => Ok(5), | ||
| Self::Triumvirate => Ok(6), | ||
| Self::Governance => Ok(7), | ||
| Self::Staking => Ok(8), | ||
| Self::Registration => Ok(9), | ||
| Self::Transfer => Ok(10), | ||
| Self::SmallTransfer => Ok(11), | ||
| Self::RootWeights => Ok(12), | ||
| Self::ChildKeys => Ok(13), | ||
| Self::SudoUncheckedSetCode => Ok(14), | ||
| Self::SwapHotkey => Ok(15), | ||
| Self::SubnetLeaseBeneficiary => Ok(16), | ||
| Self::RootClaim => Err(()), | ||
| } | ||
| } | ||
| } |
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.
It is more idiomatic to avoid implementing TryInto directly but implement TryFrom instead because it provides a blanket (automatic) implementation of TryInto.
So if you implement TryFrom<ProxyType> for u8 you get TryInto<u8> for ProxyType for free.
Description
Add getProxies function in precompile.
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.