Skip to content
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

kairos-cli: implement call to deposit endpoint and integration test #91

Merged
merged 9 commits into from
May 9, 2024

Conversation

marijanp
Copy link
Contributor

@marijanp marijanp commented May 3, 2024

Things done

  • Moved all code except cli parsing to kairos_cli::run
  • Introduced new kairos-server-address option, that defaults a value if not set
  • Implemented a client function that will submit a transaction to the kairos-server, this client function introduces a KairosClientError enum type that could be used for better error handling
  • implemented the mapping from cli arguments for a deposit -> deposit payload, signing and submitting of a deposit
  • Updated the integration test to actually spawn a kairos-server
  • Updated the ne2e-test

Overview

#92

Motivation

@marijanp marijanp mentioned this pull request May 3, 2024
7 tasks
@marijanp marijanp marked this pull request as ready for review May 3, 2024 19:33
@marijanp marijanp self-assigned this May 3, 2024
@marijanp marijanp added the demo Required for our first demo label May 3, 2024
kairos-cli/src/lib.rs Outdated Show resolved Hide resolved
kairos-cli/src/client.rs Outdated Show resolved Hide resolved
@Rom3dius
Copy link
Contributor

Rom3dius commented May 6, 2024

I'm a little confused as to why you're spawning a tokio runtime to use reqwests async API in a CLI application when reqwest has a blocking API and the nature of a CLI is generally synchronous.

Let's merge it, just leaving this comment here for future reference and to make everyone aware of reqwests blocking API.

kairos-cli/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@koxu1996 koxu1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more work - details in comments.

@koxu1996
Copy link
Contributor

koxu1996 commented May 6, 2024

I'm a little confused as to why you're spawning a tokio runtime to use reqwests async API in a CLI application when reqwest has a blocking API and the nature of a CLI is generally synchronous.

Let's merge it, just leaving this comment here for future reference and to make everyone aware of reqwests blocking API.

@Rom3dius that's right! CLI client (replaced with Rust SDK in the future) should be synchronous, not only for simplicity, but there is no advantage of having async there. @marijanp could you use reqwest::blocking?

@marijanp
Copy link
Contributor Author

marijanp commented May 6, 2024

@Rom3dius @koxu1996 I began writing the client with potentially factoring it out in a separate crate, so I decided to make it async as they usually don't block but do so in our CLI. But it might just be premature optimization. so I will make this blocking.

Avi-D-coder
Avi-D-coder previously approved these changes May 6, 2024
Base automatically changed from implement-deposit-cli-2 to main May 6, 2024 15:49
@marijanp marijanp dismissed Avi-D-coder’s stale review May 6, 2024 15:49

The base branch was changed.

@marijanp marijanp requested review from koxu1996 and Avi-D-coder May 6, 2024 15:59
@marijanp marijanp force-pushed the implement-deposit-cli-3 branch from 987177d to 0c980ef Compare May 6, 2024 16:20
Copy link

github-actions bot commented May 7, 2024

File Coverage
All files 53%
kairos-tx/src/asn.rs 48%
kairos-tx/src/error.rs 0%
kairos-server/src/state/transactions/batch_state.rs 42%
kairos-crypto/src/implementations/casper.rs 6%
kairos-server/src/state/transactions.rs 40%
kairos-server/src/state/trie.rs 35%
kairos-server/src/config.rs 0%
kairos-server/src/errors.rs 12%
kairos-server/src/lib.rs 95%
kairos-server/src/state.rs 90%
kairos-server/src/utils.rs 22%
kairos-test-utils/src/cctl/parsers.rs 66%
kairos-test-utils/src/cctl.rs 87%
kairos-server/src/routes/deposit.rs 88%
kairos-server/src/routes/transfer.rs 90%
kairos-server/tests/transactions.rs 85%

Minimum allowed coverage is 60%

Generated by 🐒 cobertura-action against 1da5208

@marijanp marijanp merged commit 9ac33ec into main May 9, 2024
7 checks passed
@marijanp marijanp deleted the implement-deposit-cli-3 branch May 9, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo Required for our first demo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants