Skip to content

Commit

Permalink
fix StarcoinMoveResolver trait bound complains
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao committed Oct 14, 2024
1 parent f75644d commit 9d5b6e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vm/vm-runtime/src/data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//! Scratchpad for on chain values during the execution.

use crate::move_vm_ext::AsExecutorView;
use bytes::Bytes;
use move_binary_format::deserializer::DeserializerConfig;
use move_binary_format::CompiledModule;
Expand All @@ -11,6 +12,7 @@ use move_core_types::value::MoveTypeLayout;
use move_table_extension::{TableHandle, TableResolver};
use starcoin_logger::prelude::*;
use starcoin_types::account_address::AccountAddress;
use starcoin_vm_runtime_types::resolver::ExecutorView;
use starcoin_vm_runtime_types::resource_group_adapter::ResourceGroupAdapter;
use starcoin_vm_types::state_store::{
errors::StateviewError, state_key::StateKey, state_storage_usage::StateStorageUsage,
Expand Down Expand Up @@ -255,6 +257,12 @@ impl<S: StateView> AsMoveResolver<S> for S {
}
}

impl<S: StateView> AsExecutorView for S {
fn as_executor_view(&self) -> &dyn ExecutorView {
todo!()
}
}

pub struct RemoteStorageOwned<S> {
state_view: S,
}
Expand Down Expand Up @@ -312,13 +320,6 @@ impl<S: StateView> TableResolver for RemoteStorageOwned<S> {
}
}

// TODO Note for Conflicting: conflicting implementation in crate `starcoin_vm_types`: - impl<V> ConfigStorage for V where V: StateView;
// impl<S: StateView> ConfigStorage for RemoteStorageOwned<S> {
// fn fetch_config(&self, access_path: AccessPath) -> Option<Vec<u8>> {
// self.as_move_resolver().fetch_config(access_path)
// }
// }

pub trait IntoMoveResolver<S> {
fn into_move_resolver(self) -> RemoteStorageOwned<S>;
}
Expand Down
5 changes: 5 additions & 0 deletions vm/vm-runtime/src/move_vm_ext/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ pub trait StarcoinMoveResolver:
{
}

impl<S: ConfigStorage + MoveResolver<PartialVMError> + TableResolver + AsExecutorView>
StarcoinMoveResolver for S
{
}

pub trait AsExecutorView {
fn as_executor_view(&self) -> &dyn ExecutorView;
}

0 comments on commit 9d5b6e6

Please sign in to comment.