Skip to content

Commit

Permalink
Address review comment for namespace support in storage
Browse files Browse the repository at this point in the history
Closes: #324
  • Loading branch information
sitalkedia authored and aptos-bot committed Mar 28, 2022
1 parent 71b4b2b commit ff37b98
Show file tree
Hide file tree
Showing 66 changed files with 421 additions and 450 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"type": "genesis_transaction",
"version": "0",
"hash": "0x2f3234ca268787211bff124cf62a40e439a73a970113d0e2c7b5374233495644",
"state_root_hash": "0xf590dda7172290b8a46f86cff1c4b1427f7e2b94f60e5b7302405b6a7ae38546",
"state_root_hash": "0x6f52022c84a60306880f27ed787127655b5ee117bc1e6858d2ff904aad38ea0c",
"event_root_hash": "0xdc52e4d65bc1d4bcc915eddd4afe5210466932431da4ca1e2f6076f24ff334c9",
"gas_used": "0",
"success": true,
"vm_status": "Executed successfully",
"accumulator_root_hash": "0x603bedbd5ebfcee75d20ce23cc3072f68bf99dca4ab886de82b535d995ad212a",
"accumulator_root_hash": "0xae1773ab6e6d5bd7a3cd0dc4356368b92efc0ab1f70a405bb646ccd8843581cc",
"payload": {
"type": "write_set_payload",
"write_set": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"type": "block_metadata_transaction",
"version": "1",
"hash": "0x4713d577c835382e6b2ccb496595f7af6476f7277389e0c9ab290288cadf20a8",
"state_root_hash": "0x9e744521f583ac61674c0d4070c35bdfec7bc9521f805b4fbd1147c7e7f96c14",
"state_root_hash": "0xb7543c2d4f63fb35fff70a8904c3645cdf1a3f62f6d2664c43182ca2b80d0b3a",
"event_root_hash": "0xbf2bc789a83ba627b41caef795917152790ff6c97fe48606c23f7617e3b695c7",
"gas_used": "0",
"success": true,
"vm_status": "Executed successfully",
"accumulator_root_hash": "0xf7998508496d399ba2cdf48311f3d455d1840c8d7f577825d40e806b2f4aa818",
"accumulator_root_hash": "0xce600d9932f602c051b6633c3f90a63bb293531d2b3ce7c48fac123a0c913aa5",
"id": "0xf44b581f23222c10916b17a369b4da039d075952b58036f2a7b561446592403c",
"round": "1",
"previous_block_votes": [],
Expand All @@ -19,12 +19,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0xe5cfb5b362c05ff993d5104d157ae3108a5760d43eab7bbbb9dd0aa42d9945c6",
"state_root_hash": "0x54f6fda0373623e29074b70a2f81b007aa7a99c243eec4c7d44688d30ffabcf8",
"state_root_hash": "0x0f93191239c27cee9a98a87c6de5a98b646832a4670f13000f21c9c79031a5b1",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "412",
"success": true,
"vm_status": "Executed successfully",
"accumulator_root_hash": "0x14d5c83d3f16a8595c41f559c06833cbd4401fb44f45390ee6d8b807af8ca204",
"accumulator_root_hash": "0x601ae981b3fb7302ad88d55f8898974cfe1519cff629c4835c68db6c478f09ff",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0x4301a8ea114254a1694d265b0c66924bd97d04ed60a521bbbdfaa029ce277afb",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0x1d7b96e2417b6a7e7cf1bde54fcb62f38bc23a23f5c5dc50f73aee0783c6f5c0",
"accumulator_root_hash": "0xd5175bb7bf4e14be490ae523616a5e393838aea8d65940af081ceaa8126e388c",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0xa76f6ca3c7bbb763e80dba0cb3f6d1d1ab5fe26502e185758bdd9df0f4831a60",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0x0532f56b5a23142e9917f5628a9a8c93d07828bc7bdf02710613cce9dcde0fe1",
"accumulator_root_hash": "0x8c5fc3f3b82ffc91fc84638cbb69046f9d7af3daaa9e66b9c16b8ef4c322a41d",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0xc83538832bd72205d12b9d3f727bb8023d233512d1f7f0a710fbdc59ae6e0d0c",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0xa771b90604c43c419bb9d8715163ca8b7230590026efebd8809666c624339fca",
"accumulator_root_hash": "0xc59521018812eb8f7718129a39094d7fc742099a007a62ddfa193c97db3b10d6",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0x068b7171b72a144c0dda8460ab7c14b95308a33f6a1b71dff8076bbf63ede87c",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0x3679212937d7b49af3d3689b0382047ecad0b35ace88bf419731caa8cf27a793",
"accumulator_root_hash": "0x530b83664b15a38feb4110595b9c3562ae04061e5f993476b131d7d06de64d98",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0x859f7cb227645db8c149e77750216dc729de4185c4397803f522e8a6b3605253",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0x5ff1447ffaccadd9d28f5d54dd3579bb1b89a64c4105da3428fcc51800d63d4f",
"accumulator_root_hash": "0xf407fe53166bb380a7acb30ec32adeb17bcdd05b2372f23cc6f1eae82452cc40",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0xe58e229bc8dc107f9495127e81f8ea755ae1749651f6dd544a8ed3502f4376f3",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0xa614e65cb7812f6e18dfeaeac3e1d6c68f2b06317347e6f4c66af03e7d5eb299",
"accumulator_root_hash": "0xc223f660aadee72cbb4393c5e81201e232173d9db0f894648e9cdbb1f8ebe5d7",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "2",
"hash": "0xacfde9314bb58673b2f15eae5cb6e4ad43a2e42cf4c62a2f9eba9dcce5eb96ad",
"state_root_hash": "0x0ec49569244f801d0a0f30c4e21d233f41db06b1b675a2f7e2d32342d40a0a51",
"state_root_hash": "0xe494b93d6cddb5faf3b814fbb203a372c972dd15aac6ac43348c79abee952472",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "1",
"success": false,
"vm_status": "Move bytecode deserialization / verification failed, including script function not found or invalid arguments",
"accumulator_root_hash": "0xf777561926c23a3a0c0773b08a70bcc0ac466e5d3295cd9951ff2737cd0b37d3",
"accumulator_root_hash": "0x6f417b38fb2ed6c5db494775d1c1ac595cc1f8589e98a416366eaae9603a4f52",
"sender": "0xa550c18",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "user_transaction",
"version": "4",
"hash": "0xbf88ed17fd51ff7bd53d652460a76cda92793874307f900cae38c4288fef1382",
"state_root_hash": "0x44f3fe0b959dd7cb503a179389ccd3ee7a9135fd3d852f1d2c75e83dd3fbcf07",
"state_root_hash": "0x2fe45f56fc0ea40395033ba8d32cfdea8dd88df367b77007e8b78cc2b17aa400",
"event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
"gas_used": "21",
"success": false,
"vm_status": "Move abort: code 8 at 00000000000000000000000000000001::TestCoin",
"accumulator_root_hash": "0xa4d5b53a1cd2e359b681cbb30aa9f04c9950c724984f05406b373f410cd636ae",
"accumulator_root_hash": "0x7c0173468699af78b97a5524fc194109d9f932d962f1e78427ded447ed81c24d",
"sender": "0x62f8f9148c207643864d7ed4a2b23159",
"sequence_number": "0",
"max_gas_amount": "1000",
Expand Down
8 changes: 4 additions & 4 deletions api/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use aptos_types::{
use storage_interface::{MoveDbReader, Order};

use anyhow::{ensure, format_err, Result};
use aptos_types::state_store::state_store_key::StateStoreKey;
use aptos_types::state_store::state_key::StateKey;
use futures::{channel::oneshot, SinkExt};
use std::{
borrow::Borrow,
Expand Down Expand Up @@ -108,10 +108,10 @@ impl Context {
account: AccountAddress,
version: u64,
) -> Result<Option<AccountStateBlob>> {
let (state_store_value, _) = self
let (state_value, _) = self
.db
.get_value_with_proof_by_version(StateStoreKey::AccountAddressKey(account), version)?;
Ok(state_store_value.map(AccountStateBlob::from))
.get_state_value_with_proof_by_version(StateKey::AccountAddressKey(account), version)?;
Ok(state_value.map(AccountStateBlob::from))
}

pub fn get_block_timestamp(&self, version: u64) -> Result<u64> {
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/aptos-validator-interface/src/storage_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use aptos_types::{
account_state::AccountState,
contract_event::EventWithProof,
event::EventKey,
state_store::state_store_key::StateStoreKey,
state_store::state_key::StateKey,
transaction::{Transaction, Version},
};
use aptosdb::AptosDB;
Expand All @@ -36,7 +36,7 @@ impl AptosValidatorInterface for DBDebuggerInterface {
version: Version,
) -> Result<Option<AccountState>> {
self.0
.get_value_with_proof_by_version(StateStoreKey::AccountAddressKey(account), version)?
.get_state_value_with_proof_by_version(StateKey::AccountAddressKey(account), version)?
.0
.map(|s| AccountState::try_from(&s))
.transpose()
Expand Down
6 changes: 3 additions & 3 deletions aptos-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use aptos_types::{
chain_id::ChainId,
move_resource::MoveStorage,
on_chain_config::{VMPublishingOption, ON_CHAIN_CONFIG_REGISTRY},
state_store::state_store_key::StateStoreKey,
state_store::state_key::StateKey,
waypoint::Waypoint,
};
use aptos_vm::AptosVM;
Expand Down Expand Up @@ -211,8 +211,8 @@ pub fn print_api_config(config: &NodeConfig, lazy: bool) {
fn fetch_chain_id(db: &DbReaderWriter) -> ChainId {
let blob = db
.reader
.get_value_with_proof_by_version(
StateStoreKey::AccountAddressKey(aptos_root_address()),
.get_state_value_with_proof_by_version(
StateKey::AccountAddressKey(aptos_root_address()),
(&*db.reader)
.fetch_synced_version()
.expect("[aptos-node] failed fetching synced version."),
Expand Down
5 changes: 2 additions & 3 deletions config/management/genesis/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use aptos_temppath::TempPath;
use aptos_types::{
account_address::AccountAddress, account_config, account_state::AccountState,
network_address::NetworkAddress, on_chain_config::ValidatorSet,
state_store::state_store_key::StateStoreKey, validator_config::ValidatorConfig,
waypoint::Waypoint,
state_store::state_key::StateKey, validator_config::ValidatorConfig, waypoint::Waypoint,
};
use aptos_vm::AptosVM;
use aptosdb::AptosDB;
Expand Down Expand Up @@ -241,7 +240,7 @@ fn validator_config(
reader: Arc<dyn DbReader>,
) -> Result<ValidatorConfig, Error> {
let blob = reader
.get_latest_value(StateStoreKey::AccountAddressKey(
.get_latest_state_value(StateKey::AccountAddressKey(
account_config::validator_set_address(),
))
.map_err(|e| {
Expand Down
4 changes: 2 additions & 2 deletions execution/executor-benchmark/src/transaction_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use aptos_types::{
account_config::{aptos_root_address, AccountResource},
account_state_blob::AccountStateBlob,
chain_id::ChainId,
state_store::state_store_key::StateStoreKey,
state_store::state_key::StateKey,
transaction::{RawTransaction, SignedTransaction, Transaction, Version},
};
use chrono::Local;
Expand Down Expand Up @@ -341,7 +341,7 @@ impl TransactionGenerator {
for account in &self.accounts_cache {
let address = account.address;
let state_store_value = db
.get_latest_value(StateStoreKey::AccountAddressKey(address))
.get_latest_state_value(StateKey::AccountAddressKey(address))
.expect("Failed to query storage.")
.expect("Account must exist.");
let account_resource =
Expand Down
31 changes: 14 additions & 17 deletions execution/executor-test-helpers/src/integration_test_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use aptos_types::{
},
account_state::AccountState,
event::EventKey,
state_store::{state_store_key::StateStoreKey, state_store_value::StateStoreValueWithProof},
state_store::{state_key::StateKey, state_value::StateValueWithProof},
transaction::{
authenticator::AuthenticationKey, Transaction, TransactionListWithProof,
TransactionWithProof, WriteSetPayload,
Expand Down Expand Up @@ -298,8 +298,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account1_state_with_proof = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account1),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account1),
current_version,
current_version,
)
Expand All @@ -308,8 +308,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account2_state_with_proof = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account2),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account2),
current_version,
current_version,
)
Expand All @@ -318,8 +318,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account3_state_with_proof = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account3),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account3),
current_version,
current_version,
)
Expand Down Expand Up @@ -400,8 +400,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account4_state = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account4),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account4),
current_version,
current_version,
)
Expand Down Expand Up @@ -459,8 +459,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account1_state_with_proof = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account1),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account1),
current_version,
current_version,
)
Expand All @@ -469,8 +469,8 @@ pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {

let account3_state_with_proof = db
.reader
.get_value_with_proof(
StateStoreKey::AccountAddressKey(account3),
.get_state_value_with_proof(
StateKey::AccountAddressKey(account3),
current_version,
current_version,
)
Expand Down Expand Up @@ -548,10 +548,7 @@ pub fn create_db_and_executor<P: AsRef<std::path::Path>>(
(db, dbrw, executor, waypoint)
}

pub fn verify_account_balance<F>(
account_state_with_proof: &StateStoreValueWithProof,
f: F,
) -> Result<()>
pub fn verify_account_balance<F>(account_state_with_proof: &StateValueWithProof, f: F) -> Result<()>
where
F: Fn(u64) -> bool,
{
Expand Down
2 changes: 1 addition & 1 deletion execution/executor-types/src/executed_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ExecutedChunk {
Ok(TransactionToCommit::new(
txn.clone(),
txn_data.txn_info.clone(),
txn_data.state_store_updates().clone(),
txn_data.state_updates().clone(),
Some(txn_data.jf_node_hashes().clone()),
txn_data.write_set().clone(),
txn_data.events().to_vec(),
Expand Down

0 comments on commit ff37b98

Please sign in to comment.