-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli] background tx submission service (#325)
Co-authored-by: 0o-de-lally <[email protected]>
- Loading branch information
1 parent
bfe08b0
commit 22045b0
Showing
16 changed files
with
375 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,6 +320,11 @@ jobs: | |
cache-all-crates: true | ||
cache-on-failure: true | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
name: framework-build | ||
path: framework/ | ||
|
||
- name: twin | ||
working-directory: ./testsuites/twin | ||
run: cargo test --no-fail-fast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
pub mod constants; | ||
pub mod generic_tx; | ||
pub mod publish; | ||
pub mod stream; | ||
pub mod submit_transaction; | ||
pub mod transfer; | ||
pub mod txs_cli; | ||
pub mod txs_cli_community; | ||
pub mod txs_cli_governance; | ||
pub mod txs_cli_stream; | ||
pub mod txs_cli_user; | ||
pub mod txs_cli_vals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#[derive(clap::Args)] | ||
pub struct PofBidArgs { | ||
#[clap(short, long)] | ||
pub net_reward: u64, | ||
|
||
#[clap(short, long)] | ||
pub test_private_key: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use diem_logger::info; | ||
use diem_types::transaction::TransactionPayload; | ||
use libra_cached_packages::libra_stdlib; | ||
use libra_types::exports::Client; | ||
use std::borrow::BorrowMut; | ||
use std::sync::mpsc::Sender; | ||
use std::thread; | ||
use std::time::Duration; | ||
|
||
pub fn epoch_tickle_poll(mut tx: Sender<TransactionPayload>, client: Client, delay_secs: u64) { | ||
println!("polling epoch boundary"); | ||
let handle = thread::spawn(move || loop { | ||
let rt = tokio::runtime::Builder::new_current_thread() | ||
.enable_all() | ||
.build() | ||
.unwrap(); | ||
|
||
// TODO: make the client borrow instead of clone | ||
let res = rt.block_on(libra_query::chain_queries::epoch_over_can_trigger( | ||
&client.clone(), | ||
)); | ||
|
||
match res { | ||
Ok(true) => { | ||
let func = libra_stdlib::diem_governance_trigger_epoch(); | ||
|
||
tx.borrow_mut().send(func).unwrap(); | ||
} | ||
_ => { | ||
info!("Not ready to call epoch.") | ||
} | ||
} | ||
|
||
thread::sleep(Duration::from_secs(delay_secs)); | ||
}); | ||
handle.join().expect("cannot poll for epoch boundary"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod epoch_tickle_poll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.