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

switch providers and txn submits to use finalized commit level #848

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion custom_tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn record<T>(field: &str, value: T)
where
T: std::fmt::Display,
{
Span::current().record(field, &tracing::field::display(value));
Span::current().record(field, tracing::field::display(value));
}

pub fn record_b58(key: &str, pub_key: &[u8]) {
Expand Down
5 changes: 0 additions & 5 deletions iot_config/src/org.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ pub struct Org {
pub constraints: Option<Vec<DevAddrConstraint>>,
}

#[derive(Debug, Serialize)]
pub struct OrgList {
orgs: Vec<Org>,
}

impl FromRow<'_, PgRow> for Org {
fn from_row(row: &PgRow) -> sqlx::Result<Self> {
let delegate_keys = row
Expand Down
11 changes: 0 additions & 11 deletions iot_config/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,17 +849,6 @@ async fn remove_skfs(skfs: &[Skf], db: impl sqlx::PgExecutor<'_>) -> anyhow::Res
Ok(query_builder.build_query_as::<Skf>().fetch_all(db).await?)
}

#[derive(Debug, Serialize)]
pub struct RouteList {
routes: Vec<Route>,
}

impl RouteList {
pub fn count(&self) -> usize {
self.routes.len()
}
}

impl From<proto::RouteV1> for Route {
fn from(route: proto::RouteV1) -> Self {
let net_id: NetIdField = route.net_id.into();
Expand Down
4 changes: 2 additions & 2 deletions iot_packet_verifier/src/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl PendingTables for PgPool {
VALUES ($1, $2, $3, $4)
"#,
)
.bind(&signature.to_string())
.bind(signature.to_string())
.bind(payer)
.bind(amount as i64)
.bind(Utc::now())
Expand Down Expand Up @@ -195,7 +195,7 @@ impl<'a> PendingTablesTransaction<'a> for Transaction<'a, Postgres> {
signature: &Signature,
) -> Result<(), sqlx::Error> {
sqlx::query("DELETE FROM pending_txns WHERE signature = $1")
.bind(&signature.to_string())
.bind(signature.to_string())
.execute(self)
.await?;
Ok(())
Expand Down
8 changes: 4 additions & 4 deletions solana/src/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl SolanaRpc {
return Err(SolanaRpcError::FailedToReadKeypairError);
};
let provider =
RpcClient::new_with_commitment(settings.rpc_url.clone(), CommitmentConfig::confirmed());
RpcClient::new_with_commitment(settings.rpc_url.clone(), CommitmentConfig::finalized());
let program_cache = BurnProgramCache::new(&provider, dc_mint, dnt_mint).await?;
if program_cache.dc_burn_authority != keypair.pubkey() {
return Err(SolanaRpcError::InvalidKeypair);
Expand Down Expand Up @@ -219,7 +219,7 @@ impl SolanaNetwork for SolanaRpc {
data_credits::id(),
&self.cluster,
std::rc::Rc::new(Keypair::from_bytes(&self.keypair).unwrap()),
Some(CommitmentConfig::confirmed()),
Some(CommitmentConfig::finalized()),
);

let args = instruction::BurnDelegatedDataCreditsV0 {
Expand Down Expand Up @@ -261,7 +261,7 @@ impl SolanaNetwork for SolanaRpc {
.provider
.send_and_confirm_transaction_with_spinner_and_config(
tx,
CommitmentConfig::confirmed(),
CommitmentConfig::finalized(),
config,
)) {
Ok(signature) => {
Expand All @@ -287,7 +287,7 @@ impl SolanaNetwork for SolanaRpc {
self.provider
.get_signature_status_with_commitment_and_history(
txn,
CommitmentConfig::confirmed(),
CommitmentConfig::finalized(),
true,
)
.await?,
Expand Down
4 changes: 2 additions & 2 deletions solana/src/start_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl SolanaNetwork for SolanaRpc {
hexboosting::id(),
&self.cluster,
std::rc::Rc::new(Keypair::from_bytes(&self.keypair).unwrap()),
Some(CommitmentConfig::confirmed()),
Some(CommitmentConfig::finalized()),
);
for update in batch {
let account = accounts::StartBoostV0 {
Expand Down Expand Up @@ -138,7 +138,7 @@ impl SolanaNetwork for SolanaRpc {
self.provider
.get_signature_status_with_commitment_and_history(
&txn,
CommitmentConfig::confirmed(),
CommitmentConfig::finalized(),
true,
)
.await?,
Expand Down