-
Notifications
You must be signed in to change notification settings - Fork 15
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
CLI binding executor address #4042
Conversation
PRO-840 Add executor binding to CLI
The functionality added in the parent issue needs to be added to the CLI. Should be mostly cut-and-paste based on the redeem address binding. |
@@ -165,6 +172,35 @@ async fn request_redemption( | |||
bail!("No redeem address supplied and no bound redeem address found for your account {account_id}."), | |||
}; | |||
|
|||
// Check the bound executor address for this account | |||
let supplied_executor_address = if let Some(address) = supplied_executor_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.
What is the use-case of providing an executor 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.
See the original issue: https://linear.app/chainflip/issue/PRO-823/bind-nodes-executor-to-an-address
It's for Liquidity Staking Providers
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.
👍
}, | ||
#[clap(about = "Restricts your account to only be able to redeem to the specified address")] | ||
BindRedeemAddress { | ||
#[clap(help = "The Ethereum address you wish to bind your account to")] | ||
eth_address: String, | ||
}, | ||
#[clap( | ||
about = "Restricts your account to only be able to execute registered redemptions with the specified 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.
while you're here, I think it would be nice to say that it's irreversible, same for the other binding commands, rather than wait until they start the process to see it, they can see it when they --help
ensure!(executor.is_some(), Error::<T>::ExecutorBindingRestrictionViolated); | ||
ensure!( | ||
executor_addr == executor.unwrap_or_default(), | ||
executor_addr == executor.unwrap(), |
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.
Should avoid the unwrap here:
if let Some(executor_addr) = BoundExecutorAddress::<T>::get(&account_id) {
let executor = executor.ok_or(Error::<T>::ExecutorBindingRestrictionViolated)?;
ensure!(executor_addr == executor, Error::<T>::ExecutorBindingRestrictionViolated);
}
Codecov Report
@@ Coverage Diff @@
## main #4042 +/- ##
======================================
- Coverage 72% 72% -0%
======================================
Files 369 369
Lines 58591 59302 +711
Branches 58591 59302 +711
======================================
+ Hits 42381 42650 +269
- Misses 14111 14531 +420
- Partials 2099 2121 +22
... and 27 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
* feat: cli binding executor address * refactor: avoid unwrap * docs: update readme and cmd description * chore: add example --------- Co-authored-by: Daniel <daniel@chainflip.io>
* feat: cli binding executor address * refactor: avoid unwrap * docs: update readme and cmd description * chore: add example --------- Co-authored-by: Daniel <daniel@chainflip.io>
* feat: cli binding executor address * refactor: avoid unwrap * docs: update readme and cmd description * chore: add example --------- Co-authored-by: Daniel <daniel@chainflip.io>
* feat: cli binding executor address * refactor: avoid unwrap * docs: update readme and cmd description * chore: add example --------- Co-authored-by: Daniel <daniel@chainflip.io>
Pull Request
Closes: PRO-840
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
BindExecutorAddress
,GetBoundExecutorAddress
.redeem
cmd that looks at the bound executor address and uses it or gives a nice error.