Skip to content

Commit

Permalink
[aptos-vm] change restriction on view functions to support legacy view (
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw authored Feb 6, 2023
1 parent 895ae28 commit cb4ba0a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aptos-move/aptos-vm/src/verifier/view_function.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use crate::move_vm_ext::{MoveResolverExt, SessionExt};
use crate::verifier::transaction_arg_validation;
use aptos_framework::{KnownAttribute, RuntimeModuleMetadataV1};
use crate::{
move_vm_ext::{MoveResolverExt, SessionExt},
verifier::transaction_arg_validation,
};
use aptos_framework::RuntimeModuleMetadataV1;
use move_binary_format::errors::{PartialVMError, PartialVMResult};
use move_core_types::identifier::IdentStr;
use move_core_types::vm_status::StatusCode;
use move_core_types::{identifier::IdentStr, vm_status::StatusCode};
use move_vm_runtime::session::LoadedFunctionInstantiation;
use move_vm_types::loaded_data::runtime_types::Type;

Expand All @@ -23,7 +24,7 @@ pub(crate) fn validate_view_function<S: MoveResolverExt>(
let is_view = if let Some(data) = module_metadata {
data.fun_attributes
.get(fun_name.as_str())
.map(|attrs| attrs.contains(&KnownAttribute::view_function()))
.map(|attrs| attrs.iter().any(|attr| attr.is_view_function()))
.unwrap_or_default()
} else {
false
Expand Down

0 comments on commit cb4ba0a

Please sign in to comment.