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

refactor!: rename TransactionValue into CommittedTransaction #4610

Merged
merged 1 commit into from
May 17, 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
12 changes: 6 additions & 6 deletions core/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct BlockBuilder<B>(B);
mod pending {
use std::time::SystemTime;

use iroha_data_model::transaction::TransactionValue;
use iroha_data_model::transaction::CommittedTransaction;

use super::*;
use crate::state::StateBlock;
Expand Down Expand Up @@ -148,7 +148,7 @@ mod pending {
previous_height: u64,
prev_block_hash: Option<HashOf<SignedBlock>>,
view_change_index: u64,
transactions: &[TransactionValue],
transactions: &[CommittedTransaction],
) -> BlockHeader {
BlockHeader {
height: previous_height + 1,
Expand All @@ -175,12 +175,12 @@ mod pending {
fn categorize_transactions(
transactions: Vec<AcceptedTransaction>,
state_block: &mut StateBlock<'_>,
) -> Vec<TransactionValue> {
) -> Vec<CommittedTransaction> {
transactions
.into_iter()
.map(
|tx| match state_block.transaction_executor().validate(tx, state_block) {
Ok(tx) => TransactionValue {
Ok(tx) => CommittedTransaction {
value: tx,
error: None,
},
Expand All @@ -190,7 +190,7 @@ mod pending {
caused_by = ?error.source(),
"Transaction validation failed",
);
TransactionValue {
CommittedTransaction {
value: tx,
error: Some(error),
}
Expand Down Expand Up @@ -374,7 +374,7 @@ mod valid {
.transactions()
// TODO: Unnecessary clone?
.cloned()
.try_for_each(|TransactionValue { value, error }| {
.try_for_each(|CommittedTransaction { value, error }| {
let transaction_executor = state_block.transaction_executor();
let limits = &transaction_executor.transaction_limits;

Expand Down
4 changes: 2 additions & 2 deletions core/src/smartcontracts/isi/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use iroha_data_model::{
error::{FindError, QueryExecutionFail},
TransactionQueryOutput,
},
transaction::TransactionValue,
transaction::CommittedTransaction,
};
use iroha_telemetry::metrics;

Expand Down Expand Up @@ -54,7 +54,7 @@ impl BlockTransactionRef {
.as_ref()
.authority()
}
fn value(&self) -> TransactionValue {
fn value(&self) -> CommittedTransaction {
self.0
.transactions()
.nth(self.1)
Expand Down
4 changes: 2 additions & 2 deletions data_model/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mod model {
/// Topology of the network at the time of block commit.
pub commit_topology: UniqueVec<peer::PeerId>,
/// array of transactions, which successfully passed validation and consensus step.
pub transactions: Vec<TransactionValue>,
pub transactions: Vec<CommittedTransaction>,
/// Event recommendations.
pub event_recommendations: Vec<EventBox>,
}
Expand Down Expand Up @@ -149,7 +149,7 @@ impl SignedBlock {

/// Block transactions
#[inline]
pub fn transactions(&self) -> impl ExactSizeIterator<Item = &TransactionValue> {
pub fn transactions(&self) -> impl ExactSizeIterator<Item = &CommittedTransaction> {
let SignedBlock::V1(block) = self;
block.payload.transactions.iter()
}
Expand Down
8 changes: 4 additions & 4 deletions data_model/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
events::TriggeringEventFilterBox,
metadata::MetadataValueBox,
seal,
transaction::{SignedTransaction, TransactionPayload, TransactionValue},
transaction::{CommittedTransaction, SignedTransaction, TransactionPayload},
IdBox, Identifiable, IdentifiableBox,
};

Expand Down Expand Up @@ -256,7 +256,7 @@ mod model {
pub block_hash: HashOf<SignedBlock>,
/// Transaction
#[getset(skip)]
pub transaction: TransactionValue,
pub transaction: CommittedTransaction,
}

/// Request type clients (like http clients or wasm) can send to a query endpoint.
Expand Down Expand Up @@ -528,8 +528,8 @@ where
}
}

impl AsRef<TransactionValue> for TransactionQueryOutput {
fn as_ref(&self) -> &TransactionValue {
impl AsRef<CommittedTransaction> for TransactionQueryOutput {
fn as_ref(&self) -> &CommittedTransaction {
&self.transaction
}
}
Expand Down
6 changes: 3 additions & 3 deletions data_model/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ mod model {
)]
#[ffi_type]
#[getset(get = "pub")]
pub struct TransactionValue {
pub struct CommittedTransaction {
/// Committed transaction
#[getset(skip)]
pub value: SignedTransaction,
Expand Down Expand Up @@ -335,7 +335,7 @@ impl SignedTransactionV1 {
}
}

impl AsRef<SignedTransaction> for TransactionValue {
impl AsRef<SignedTransaction> for CommittedTransaction {
fn as_ref(&self) -> &SignedTransaction {
&self.value
}
Expand Down Expand Up @@ -759,7 +759,7 @@ pub mod prelude {
#[cfg(feature = "http")]
pub use super::http::TransactionBuilder;
pub use super::{
error::prelude::*, Executable, SignedTransaction, TransactionValue, WasmSmartContract,
error::prelude::*, CommittedTransaction, Executable, SignedTransaction, WasmSmartContract,
};
}

Expand Down
34 changes: 17 additions & 17 deletions docs/source/references/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@
},
{
"name": "transactions",
"type": "Vec<TransactionValue>"
"type": "Vec<CommittedTransaction>"
},
{
"name": "event_recommendations",
Expand Down Expand Up @@ -746,6 +746,18 @@
}
]
},
"CommittedTransaction": {
"Struct": [
{
"name": "value",
"type": "SignedTransaction"
},
{
"name": "error",
"type": "Option<TransactionRejectionReason>"
}
]
},
"Compact<u128>": {
"Int": "Compact"
},
Expand Down Expand Up @@ -3858,7 +3870,7 @@
},
{
"name": "transaction",
"type": "TransactionValue"
"type": "CommittedTransaction"
}
]
},
Expand Down Expand Up @@ -3912,18 +3924,6 @@
}
]
},
"TransactionValue": {
"Struct": [
{
"name": "value",
"type": "SignedTransaction"
},
{
"name": "error",
"type": "Option<TransactionRejectionReason>"
}
]
},
"Transfer<Account, AssetDefinitionId, Account>": {
"Struct": [
{
Expand Down Expand Up @@ -4342,6 +4342,9 @@
}
]
},
"Vec<CommittedTransaction>": {
"Vec": "CommittedTransaction"
},
"Vec<EventBox>": {
"Vec": "EventBox"
},
Expand All @@ -4366,9 +4369,6 @@
"Vec<QueryOutputBox>": {
"Vec": "QueryOutputBox"
},
"Vec<TransactionValue>": {
"Vec": "TransactionValue"
},
"Vec<u8>": {
"Vec": "u8"
},
Expand Down
4 changes: 2 additions & 2 deletions schema/gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ types!(
Burn<Numeric, Asset>,
BurnBox,
ChainId,
CommittedTransaction,
ConfigurationEvent,
ConfigurationEventFilter,
ConfigurationEventSet,
Expand Down Expand Up @@ -343,7 +344,6 @@ types!(
TransactionPayload,
TransactionQueryOutput,
TransactionRejectionReason,
TransactionValue,
TransactionStatus,
Transfer<Account, AssetDefinitionId, Account>,
Transfer<Account, DomainId, Account>,
Expand Down Expand Up @@ -373,6 +373,7 @@ types!(
UnregisterBox,
Upgrade,
ValidationFail,
Vec<CommittedTransaction>,
Vec<EventBox>,
Vec<EventFilterBox>,
Vec<InstructionBox>,
Expand All @@ -381,7 +382,6 @@ types!(
Vec<PeerId>,
Vec<PredicateBox>,
Vec<QueryOutputBox>,
Vec<TransactionValue>,
Vec<u8>,
WasmExecutionFail,
WasmSmartContract,
Expand Down
Loading