Skip to content

Commit

Permalink
fix starcoin abi & aggregator (#4204)
Browse files Browse the repository at this point in the history
revert update on StateView
  • Loading branch information
simonjiao committed Sep 23, 2024
1 parent a1fd538 commit fdae842
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion abi/decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use starcoin_resource_viewer::{AnnotatedMoveStruct, AnnotatedMoveValue};
use starcoin_vm_types::account_address::AccountAddress;
use starcoin_vm_types::identifier::Identifier;
use starcoin_vm_types::language_storage::{ModuleId, TypeTag};
use starcoin_vm_types::state_view::StateView;
use starcoin_vm_types::state_store::StateView;
use starcoin_vm_types::transaction::{Module, Package, Script, ScriptFunction, TransactionPayload};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum DecodedTransactionPayload {
Expand Down
2 changes: 1 addition & 1 deletion abi/resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use starcoin_vm_types::file_format::{
use starcoin_vm_types::identifier::{IdentStr, Identifier};
use starcoin_vm_types::language_storage::{ModuleId, StructTag, TypeTag};
use starcoin_vm_types::normalized::{Function, Module, Struct, Type};
use starcoin_vm_types::state_view::StateView;
use starcoin_vm_types::state_store::StateView;

#[allow(clippy::upper_case_acronyms)]
pub struct ABIResolver<'a> {
Expand Down
12 changes: 7 additions & 5 deletions vm/resource-viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use anyhow::{anyhow, Result};
use move_core_types::u256;
use starcoin_vm_types::language_storage::TypeTag;
use starcoin_vm_types::state_store::state_key::StateKey;
use starcoin_vm_types::state_store::state_storage_usage::StateStorageUsage;
use starcoin_vm_types::state_store::state_value::StateValue;
use starcoin_vm_types::state_store::TStateView;
use starcoin_vm_types::state_view::StateView;
use starcoin_vm_types::state_store::{StateView, TStateView};
use starcoin_vm_types::value::MoveTypeLayout;
use starcoin_vm_types::{
account_address::AccountAddress,
Expand All @@ -30,7 +30,6 @@ use std::{
convert::TryInto,
fmt::{Display, Formatter},
};
use starcoin_vm_types::state_store::state_storage_usage::StateStorageUsage;

mod fat_type;
pub mod module_cache;
Expand Down Expand Up @@ -318,11 +317,14 @@ pub struct NullStateView;
impl TStateView for NullStateView {
type Key = StateKey;

fn get_state_value(&self, _state_key: &StateKey) -> starcoin_vm_types::state_store::Result<Option<StateValue>> {
fn get_state_value(
&self,
_state_key: &StateKey,
) -> starcoin_vm_types::state_store::Result<Option<StateValue>> {
Ok(None)
}

fn get_usage(&self) -> starcoin_vm_types::state_store::Result<StateStorageUsage> {
unimplemented!()
unimplemented!("get_usage not implemented for NullStateView")
}
}
3 changes: 1 addition & 2 deletions vm/resource-viewer/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
module_cache::ModuleCache,
};
use anyhow::{anyhow, Result};
use starcoin_vm_types::state_store::state_key::StateKey;
use starcoin_vm_types::{
access::ModuleAccess,
account_address::AccountAddress,
Expand All @@ -20,7 +19,7 @@ use starcoin_vm_types::{
},
identifier::{IdentStr, Identifier},
language_storage::{ModuleId, StructTag, TypeTag},
state_view::StateView,
state_store::{state_key::StateKey, StateView},
};
use std::rc::Rc;

Expand Down
2 changes: 1 addition & 1 deletion vm/starcoin-aggregator/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use starcoin_vm_types::{
state_store::{
state_key::StateKey,
state_value::{StateValue, StateValueMetadata},
StateView,
},
state_view::StateView,
write_set::WriteOp,
};
use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion vm/types/src/on_chain_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use crate::account_config::genesis_address;
use crate::state_view::StateView;
use crate::state_store::StateView;
use crate::{
access_path::AccessPath,
account_address::AccountAddress,
Expand Down
5 changes: 4 additions & 1 deletion vm/types/src/state_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::state_store::{
errors::StateviewError, in_memory_state_view::InMemoryStateView, state_key::StateKey,
state_storage_usage::StateStorageUsage, state_value::StateValue,
};
use crate::state_view::StateView;
use crate::transaction::Version;
use arr_macro::arr;
use bytes::Bytes;
Expand Down Expand Up @@ -50,6 +49,10 @@ pub trait TStateView {
}
}

pub trait StateView: TStateView<Key = StateKey> {}

impl<T: TStateView<Key = StateKey>> StateView for T {}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum StateViewId {
// XXX FIXME YSG should remove
Expand Down
6 changes: 1 addition & 5 deletions vm/types/src/state_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! This crate defines [`trait StateView`](StateView).

use crate::state_store::state_key::StateKey;
use crate::state_store::TStateView;
use crate::state_store::StateView;
use crate::{
account_config::{
genesis_address, token_code::TokenCode, AccountResource, BalanceResource, TokenInfo,
Expand All @@ -31,10 +31,6 @@ use move_core_types::{
language_storage::{ModuleId, StructTag},
};

pub trait StateView: TStateView<Key = StateKey> {}

impl<T: TStateView<Key = StateKey>> StateView for T {}

impl<T: ?Sized> StateReaderExt for T where T: StateView {}

pub trait StateReaderExt: StateView {
Expand Down

0 comments on commit fdae842

Please sign in to comment.