这是indexloc提供的服务,不要输入任何密码
Skip to content
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
12 changes: 12 additions & 0 deletions aptos-move/block-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,12 @@ where
// +1 for potential BlockEpilogue txn.
let last_input_output = TxnLastInputOutput::new(num_txns + 1);
let mut versioned_cache = MVHashMap::new();
let values = T::override_value(signature_verified_block.get_txn(0));
for (k, v) in values {
versioned_cache
.data()
.write(k, 0, 0, triomphe::Arc::new(v), None);
}
let scheduler = SchedulerV2::new(num_txns, num_workers);

let shared_sync_params: SharedSyncParams<'_, T, E, S> = SharedSyncParams {
Expand Down Expand Up @@ -1866,6 +1872,12 @@ where
);

let mut versioned_cache = MVHashMap::new();
let values = T::override_value(signature_verified_block.get_txn(0));
for (k, v) in values {
versioned_cache
.data()
.write(k, 0, 0, triomphe::Arc::new(v), None);
}
let start_shared_counter = gen_id_start_value(false);
let shared_counter = AtomicU32::new(start_shared_counter);

Expand Down
5 changes: 5 additions & 0 deletions aptos-move/mvhashmap/src/versioned_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ impl<K: Hash + Clone + Debug + Eq, V: TransactionWrite + PartialEq> VersionedDat
value: ValueWithLayout<V>,
dependencies: BTreeMap<TxnIndex, Incarnation>,
) {
let value_clone = value.clone();
let prev_entry = versioned_values.versioned_map.insert(
ShiftedTxnIndex::new(txn_idx),
CachePadded::new(new_write_entry(incarnation, value, dependencies)),
Expand All @@ -639,11 +640,15 @@ impl<K: Hash + Clone + Debug + Eq, V: TransactionWrite + PartialEq> VersionedDat
assert!(prev_entry.is_none_or(|entry| -> bool {
if let EntryCell::ResourceWrite {
incarnation: prev_incarnation,
value_with_layout: prev_value,
..
} = &entry.value
{
// For BlockSTMv1, the dependencies are always empty.
*prev_incarnation < incarnation
|| (incarnation == 0
&& prev_value.extract_value_no_layout()
== value_clone.extract_value_no_layout())
// TODO(BlockSTMv2): when AggregatorV1 is deprecated, we can assert that
// prev_dependencies is empty: they must have been drained beforehand
// (into dependencies) if there was an entry at the same index before.
Expand Down
4 changes: 4 additions & 0 deletions types/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3045,6 +3045,10 @@ pub trait BlockExecutableTransaction: Sync + Send + Clone + 'static {
) -> Self {
unimplemented!()
}

fn override_value(&self) -> Vec<(Self::Key, Self::Value)> {
vec![]
}
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down
19 changes: 18 additions & 1 deletion types/src/transaction/signature_verified_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
use aptos_crypto::{hash::CryptoHash, HashValue};
use move_core_types::{account_address::AccountAddress, language_storage::StructTag};
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use std::{fmt::Debug, str::FromStr};

#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum SignatureVerifiedTransaction {
Expand Down Expand Up @@ -124,6 +124,23 @@ impl BlockExecutableTransaction for SignatureVerifiedTransaction {
) -> Self {
Transaction::block_epilogue_v1(block_id, block_end_info, fee_distribution).into()
}

fn override_value(&self) -> Vec<(Self::Key, Self::Value)> {
match self {
SignatureVerifiedTransaction::Valid(Transaction::BlockMetadataExt(metadata_txn)) => {
let timestamp = metadata_txn.timestamp_usecs();
vec![(
StateKey::resource(
&AccountAddress::ONE,
&StructTag::from_str("0x1::timestamp::CurrentTimeMicroseconds").unwrap(),
)
.unwrap(),
WriteOp::legacy_modification(bcs::to_bytes(&timestamp).unwrap().into()),
)]
},
_ => vec![],
}
}
}

impl From<Transaction> for SignatureVerifiedTransaction {
Expand Down
Loading