Skip to content

Prototype: Introduce ReadOnly coins to Executor #2940

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

Draft
wants to merge 16 commits into
base: spike/add-data-coins-to-predicate-eval
Choose a base branch
from
Draft
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: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ url = "2.2"
# add patch for fuel-vm
[patch.crates-io]
fuel-vm-private = { path = "../fuel-vm/fuel-vm", version = "0.60.0", package = "fuel-vm" }
fuel-tx = { path = "../fuel-vm/fuel-tx", version = "0.60.0" }
fuel-types = { path = "../fuel-vm/fuel-types", version = "0.60.0" }
10 changes: 5 additions & 5 deletions crates/chain-config/src/config/coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ impl From<CoinConfig> for TableEntry<Coins> {
}
}
};
tracing::debug!(
"Created TableEntry: key={:?}, value={:?}",
&entry.key,
&entry.value,
);
// tracing::debug!(
// "Created TableEntry: key={:?}, value={:?}",
// &entry.key,
// &entry.value,
// );
entry
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ use fuel_core_types::{
Receipt,
Transaction,
TxId,
UniqueIdentifier,
},
fuel_types::{
self,
Expand Down Expand Up @@ -909,6 +910,8 @@ impl FuelClient {
estimate_predicates: Option<bool>,
) -> io::Result<TransactionStatus> {
use cynic::SubscriptionBuilder;
tracing::debug!("submitting tx: {:?}", tx.id(&Default::default()).to_bytes());
tracing::debug!("encoding tx: {:?}", tx);
let tx = tx.clone().to_bytes();
let s =
schema::tx::SubmitAndAwaitSubscription::build(TxWithEstimatedPredicatesArg {
Expand Down
49 changes: 48 additions & 1 deletion crates/compression/src/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ pub mod fault_proving {

#[cfg(feature = "fault-proving")]
use fault_proving::DecompressDb;

use fuel_core_types::fuel_tx::input::coin::{
UnverifiedCoin,
UnverifiedDataCoin,
};
#[cfg(not(feature = "fault-proving"))]
use not_fault_proving::DecompressDb;

Expand Down Expand Up @@ -254,6 +257,50 @@ where
}
}

impl<D> DecompressibleBy<DecompressCtx<D>> for UnverifiedCoin
where
D: DecompressDb,
{
async fn decompress_with(
c: <UnverifiedCoin as Compressible>::Compressed,
ctx: &DecompressCtx<D>,
) -> anyhow::Result<UnverifiedCoin> {
let utxo_id = UtxoId::decompress_with(c.utxo_id, ctx).await?;
let coin_info = ctx.db.coin(utxo_id)?;
let tx_pointer = Default::default();
Ok(Self {
utxo_id,
owner: coin_info.owner,
amount: coin_info.amount,
asset_id: coin_info.asset_id,
tx_pointer,
})
}
}

impl<D> DecompressibleBy<DecompressCtx<D>> for UnverifiedDataCoin
where
D: DecompressDb,
{
async fn decompress_with(
c: <UnverifiedDataCoin as Compressible>::Compressed,
ctx: &DecompressCtx<D>,
) -> anyhow::Result<UnverifiedDataCoin> {
let utxo_id = UtxoId::decompress_with(c.utxo_id, ctx).await?;
let coin_info = ctx.db.coin(utxo_id)?;
let tx_pointer = Default::default();
let data = c.data.decompress(ctx).await?;
Ok(Self {
utxo_id,
owner: coin_info.owner,
amount: coin_info.amount,
asset_id: coin_info.asset_id,
tx_pointer,
data,
})
}
}

impl<D, Specification> DecompressibleBy<DecompressCtx<D>> for Message<Specification>
where
D: DecompressDb,
Expand Down
Loading
Loading