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

Orchestrator Async runtime improvements #274

Merged
merged 28 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6e88e25
working on erc20.rs successful
hannydevelop Oct 27, 2021
c7fffc3
erc20 is ready
hannydevelop Oct 29, 2021
87996fc
orchestrator/src/main_loop.rs is still a work in progress
hannydevelop Oct 29, 2021
bf0ed0a
main_loop ready
hannydevelop Oct 29, 2021
b403dea
main_loop almost ready
hannydevelop Nov 1, 2021
71d4acb
fixed 2021 errors on docker
hannydevelop Nov 1, 2021
3ef27eb
happy_path_v2 ready for review
hannydevelop Nov 3, 2021
763fd16
main_loop, resolving changes
hannydevelop Nov 3, 2021
b5faf34
happy_path.rs ready for review
hannydevelop Nov 3, 2021
9347dde
happy_path.rs is ready
hannydevelop Nov 3, 2021
cab25b2
removing instant, replacing with delay_for in erc20.rs
hannydevelop Nov 7, 2021
fc227ac
fixed indentation, removed stale duration
hannydevelop Nov 7, 2021
14ddc5c
capturing erc20 in info!
hannydevelop Nov 7, 2021
4d7cc8f
removed stale imports, removed early break, adding loop
hannydevelop Nov 7, 2021
17d6d54
removing early break
hannydevelop Nov 7, 2021
81c152c
writing better error message for panic in happy_path v2.rs
hannydevelop Nov 7, 2021
165f569
fixed previous merged PR not captured because of conflicts
hannydevelop Nov 7, 2021
acf20ea
fixed usage of tokio::time::sleep and delay_for in main_loop
hannydevelop Nov 9, 2021
d2dd8d2
worked on implementing delay_for uniformly in happypath.rs
hannydevelop Nov 9, 2021
b79a083
fixed typo in happy_path.rs
hannydevelop Nov 9, 2021
9b958a3
capturing erc20 in success message
hannydevelop Nov 9, 2021
268d995
adding a break for if balance.denom.contains and balance.amount match…
hannydevelop Nov 9, 2021
a6cb54a
adding break to avoid looping till timeout
hannydevelop Nov 9, 2021
1a15f8e
merging main
hannydevelop Nov 9, 2021
df1c1a3
fixing sleep and break in loop
hannydevelop Nov 9, 2021
ab2bca6
just ran cargo fmt
hannydevelop Nov 16, 2021
19c9eee
ran git merge main
hannydevelop Nov 16, 2021
d5f6ebc
fixed conflicting files, ran git merge main again
hannydevelop Nov 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions orchestrator/gorc/src/commands/deploy/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use gravity_proto::gravity::{DenomToErc20ParamsRequest, DenomToErc20Request};
use gravity_utils::connection_prep::{check_for_eth, create_rpc_connections};
use std::convert::TryFrom;
use std::process::exit;
use std::time::{Duration, Instant};
use std::time::{Duration};
use tokio::time::sleep as delay_for;

/// Deploy Erc20
Expand Down Expand Up @@ -85,30 +85,33 @@ impl Erc20 {

println!("We have deployed ERC20 contract {:#066x}, waiting to see if the Cosmos chain choses to adopt it", res);

let start = Instant::now();
loop {
let req = DenomToErc20Request {
denom: denom.clone(),
};

let res = grpc.denom_to_erc20(req).await;

if let Ok(val) = res {
let val = val.into_inner();
match tokio::time::timeout(Duration::from_secs(100), async {
loop {
let req = DenomToErc20Request {
denom: denom.clone(),
};

let res = grpc.denom_to_erc20(req).await;

if let Ok(val) = res {
break val;
}
delay_for(Duration::from_secs(1)).await;
}
}).await
{
Ok(val) => {
println!(
"Asset {} has accepted new ERC20 representation {}",
denom, val.erc20
denom,
val.into_inner().erc20
);
exit(0);
}

if Instant::now() - start > Duration::from_secs(100) {
println!(
"Your ERC20 contract was not adopted, double check the metadata and try again"
);
},
Err(_) => {
println!("Your ERC20 contract was not adopted, double check the metadata and try again");
exit(1);
}
delay_for(Duration::from_secs(1)).await;
hannydevelop marked this conversation as resolved.
Show resolved Hide resolved
},
}
}
}
Loading