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

Rename payouts failure file #81

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Changes from 1 commit
Commits
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
9 changes: 5 additions & 4 deletions cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use std::sync::Arc;
use tabled::{settings::object::Object, Table, Tabled};
use url::Url;

const FAILURE_FILE: &str = "./SuccessfulPayouts{}";
const ADMIN_ROLE: [u8; 32] = [0; 32];

const LOTUS_RPC_URL: &str = "http://127.0.0.1:1234/rpc/v1";
Expand Down Expand Up @@ -450,7 +451,7 @@ pub async fn propose_payout_batch(
Ok(message) => message,
Err(error) => {
let date = chrono::offset::Utc::now().to_string();
let file_path = PathBuf::from(&format!("./FailedPayouts{}", date));
let file_path = PathBuf::from(&format!("{}{}", FAILURE_FILE, date));
Copy link

Choose a reason for hiding this comment

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

it looks like this actually should be called something like "FailedPayouts" - the error happened trying to get a signature, so I think these payouts really wouldn't have gone forward.

I do think "FailedPayouts" implies that it contains all payouts that weren't done, which is also wrong! maybe this file should be called something like "SignatureFailedPayouts"?

write_payout_csv(&file_path, &payees, &shares).unwrap();
panic!(
"Error signing multisig propose message for batch payout at index range {:?} .. {:?}: {:?}",
Expand All @@ -466,7 +467,7 @@ pub async fn propose_payout_batch(
Ok(mpool_push) => mpool_push,
Err(error) => {
let date = chrono::offset::Utc::now().to_string();
let file_path = PathBuf::from(&format!("./FailedPayouts{}", date));
let file_path = PathBuf::from(&format!("{}{}", FAILURE_FILE, date));
Copy link

Choose a reason for hiding this comment

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

similarly, if this failed I think the transaction never actually made it to the network - this is a nuanced failure, as the signature succeeded so theoretically there is a valid transaction somewhere - I'm unclear whether this could be a partial failure to push into the mempool (maybe one validator got the transaction and another didn't or something?) - probably worth calling this something specific too - MempoolPushFailedPayouts or something?

write_payout_csv(&file_path, &payees, &shares).unwrap();
panic!(
"MpoolPush error for proposing batch payout at index range {:?} .. {:?}: {:?}",
Expand Down Expand Up @@ -1107,7 +1108,7 @@ pub async fn deploy_payout_batch<S: Middleware + 'static>(
Ok(gas) => gas,
Err(error) => {
let date = chrono::offset::Utc::now().to_string();
let file_path = PathBuf::from(&format!("./FailedPayouts{}", date));
let file_path = PathBuf::from(&format!("{}{}", FAILURE_FILE, date));
Copy link

Choose a reason for hiding this comment

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

this also seems like a real failure - if gas couldn't be estimated I think we would not send the transaction? probably a good idea for this to have a bespoke name too - maybe GasEstimateFailedPayouts ?

write_payout_csv(&file_path, &payees, &shares).unwrap();
panic!(
"Error estimating gas for batch payout at index range {:?} .. {:?}: {:?}",
Expand All @@ -1128,7 +1129,7 @@ pub async fn deploy_payout_batch<S: Middleware + 'static>(
Ok(receipt) => receipt,
Err(error) => {
let date = chrono::offset::Utc::now().to_string();
let file_path = PathBuf::from(&format!("./FailedPayouts{}", date));
Copy link

Choose a reason for hiding this comment

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

ok if I had to guess this is the one we actually saw - the transaction was send but the receipt is an error for some reason? in this case it seems possible that the transaction did in fact get sent, but we ran into an error getting the receipt - seems like it might be possible that the transactions succeeded OR failed, so maybe yet another name - ReceiptFailedPayouts or something?

let file_path = PathBuf::from(&format!("{}{}", FAILURE_FILE, date));
write_payout_csv(&file_path, &payees, &shares).unwrap();
panic!(
"Error deploying batch payout at index range {:?} .. {:?}: {:?}",
Expand Down
Loading