-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add bind_redeem_address
to CLI
#3908
Conversation
PRO-436 Redeem address binding through the Cli
See parent issue for details. We basically just want to submit a We need to expose this functionality through the CLI. |
aa1a162
to
e271bab
Compare
Codecov Report
@@ Coverage Diff @@
## main #3908 +/- ##
=====================================
- Coverage 71% 71% -0%
=====================================
Files 366 366
Lines 56762 56798 +36
Branches 56762 56798 +36
=====================================
- Hits 40540 40539 -1
- Misses 14213 14244 +31
- Partials 2009 2015 +6
... and 8 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
api/bin/chainflip-cli/src/main.rs
Outdated
.context("Invalid ETH address supplied")? | ||
.as_slice(), | ||
); | ||
let eth_address = if let Some(address) = eth_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.
We should check the bound address first right? If there's a bound address then the eth_address supplied doesn't matter. Then, rather than pushing the redemption through to an address other than the user specified, we should compare the provided address, if provided, and check if they match - providing appropriate messages to the user if it does /doesn't - and exiting if they don't match.
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.
Yeah i thought about this and was not sure what approach to take. Thinking about it again, catching the mistake early so the user doesn't waste gas makes more sense.
api/bin/chainflip-cli/src/main.rs
Outdated
|
||
async fn get_bound_redeem_address(api: QueryApi) -> Result<()> { | ||
if let Some(bound_address) = api.get_bound_redeem_address(None, None).await? { | ||
println!("Your account is bound to redeem address: 0x{}", hex::encode(bound_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.
EthereumAddress prints as hex by default, no need for explicit conversions. I ran a test:
#[test]
fn eth_address() {
let e = EthereumAddress::repeat_byte(0xff);
println!("{} / {:?} / {:x?}", e, e, e);
}
Prints:
0xffff…ffff / 0xffffffffffffffffffffffffffffffffffffffff / 0xffffffffffffffffffffffffffffffffffffffff
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.
I was only encoding it manually to avoid it displaying as a shortened string. But the :? does the same, so ill use that.
* origin/main: Fix: Correct Select Median Implementation (#3934) fix: independent witnessing startup (#3913) 🍒 cherry-pick: changes in release for CI and chainspec (#3933) refactor: Re-arrange Chains traits for better composability (#3912) fix: log error when we try to transfer *more* than we have fetched (#3930) chore: add checks and increase timeout (#3928) Add `bind_redeem_address` to CLI (#3908) 🍒 cherry-pick: add missing prod dockerfiles (#3926) chore: skip localnet specific tests in devnet 🤫 (#3919) fix: broadcast success should be witnessable after a rotation (#3921) # Conflicts: # state-chain/chains/src/eth/api.rs # state-chain/runtime/src/chainflip.rs
…on-integration * origin/main: Added CFE setting for logging span lifecycles (#3936) fix: only burn flip if non zero (#3932) Fix: Correct Select Median Implementation (#3934) fix: independent witnessing startup (#3913) 🍒 cherry-pick: changes in release for CI and chainspec (#3933) refactor: Re-arrange Chains traits for better composability (#3912) fix: log error when we try to transfer *more* than we have fetched (#3930) chore: add checks and increase timeout (#3928) Add `bind_redeem_address` to CLI (#3908) 🍒 cherry-pick: add missing prod dockerfiles (#3926) chore: skip localnet specific tests in devnet 🤫 (#3919) fix: broadcast success should be witnessable after a rotation (#3921) # Conflicts: # state-chain/cf-integration-tests/src/network.rs
Pull Request
Closes: PRO-436
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
bind_redeem_address
to the CLI and Operator APIget_bound_redeem_address
to the CLI and Query APIredeem
command in the CLI to use the bound redeem address if the user does not supply an address.