diff --git a/crates/rooch-open-rpc-spec/schemas/openrpc.json b/crates/rooch-open-rpc-spec/schemas/openrpc.json index ba6ee8a1e4..17f35ec897 100644 --- a/crates/rooch-open-rpc-spec/schemas/openrpc.json +++ b/crates/rooch-open-rpc-spec/schemas/openrpc.json @@ -1236,7 +1236,7 @@ "value": { "anyOf": [ { - "$ref": "#/components/schemas/AnnotatedMoveValueView" + "$ref": "#/components/schemas/AnnotatedMoveStructView" }, { "type": "null" diff --git a/crates/rooch-rpc-api/src/jsonrpc_types/state_view.rs b/crates/rooch-rpc-api/src/jsonrpc_types/state_view.rs index 1c99fb9cfb..165dbc7dff 100644 --- a/crates/rooch-rpc-api/src/jsonrpc_types/state_view.rs +++ b/crates/rooch-rpc-api/src/jsonrpc_types/state_view.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::{ - AnnotatedMoveValueView, BytesView, H256View, RoochAddressView, StrView, StructTagView, - TypeTagView, + AnnotatedMoveStructView, AnnotatedMoveValueView, BytesView, H256View, RoochAddressView, + StrView, StructTagView, TypeTagView, }; use anyhow::Result; @@ -13,7 +13,7 @@ use moveos_types::state::{ }; use moveos_types::state_resolver::StateKV; use moveos_types::{ - moveos_std::object::ObjectID, + moveos_std::object::{AnnotatedObject, ObjectID}, state::{AnnotatedState, State, StateChangeSet, TableTypeInfo}, }; use rooch_types::address::RoochAddress; @@ -375,7 +375,7 @@ pub struct IndexerObjectStateView { pub object_id: ObjectID, pub owner: RoochAddressView, pub flag: u8, - pub value: Option, + pub value: Option, pub object_type: StructTagView, pub state_root: H256View, pub size: u64, @@ -388,14 +388,14 @@ pub struct IndexerObjectStateView { impl IndexerObjectStateView { pub fn new_from_object_state( - annotated_state: Option, + annotated_state: Option, state: IndexerObjectState, ) -> IndexerObjectStateView { IndexerObjectStateView { object_id: state.object_id, owner: state.owner.into(), flag: state.flag, - value: annotated_state.map(|v| AnnotatedMoveValueView::from(v.decoded_value)), + value: annotated_state.map(|v| AnnotatedMoveStructView::from(v.value)), object_type: state.object_type.into(), state_root: state.state_root.into(), size: state.size, diff --git a/crates/rooch-rpc-server/src/server/rooch_server.rs b/crates/rooch-rpc-server/src/server/rooch_server.rs index 3facfc46a8..2b7dd69f3d 100644 --- a/crates/rooch-rpc-server/src/server/rooch_server.rs +++ b/crates/rooch-rpc-server/src/server/rooch_server.rs @@ -626,7 +626,11 @@ impl RoochAPIServer for RoochServer { !valid_display_field_views.is_empty(), "display fields should not be empty" ); - (Some(s), valid_display_field_views.pop().unwrap()) + let annotated_obj = s.into_annotated_object().expect("should be object"); + ( + Some(annotated_obj), + valid_display_field_views.pop().unwrap(), + ) } None => (None, None), }) @@ -634,7 +638,14 @@ impl RoochAPIServer for RoochServer { } else { annotated_states .into_iter() - .map(|s| (s, None)) + .map(|s| { + let obj = s.map(|annotated_s| { + annotated_s + .into_annotated_object() + .expect("should be object") + }); + (obj, None) + }) .collect::>() }; diff --git a/frameworks/moveos-stdlib/sources/evm.move b/frameworks/moveos-stdlib/sources/evm.move index 23ab05066f..8eb850b3c1 100644 --- a/frameworks/moveos-stdlib/sources/evm.move +++ b/frameworks/moveos-stdlib/sources/evm.move @@ -3,9 +3,11 @@ // Evm Precompiled Contracts https://www.evm.codes/precompiled?fork=cancun module moveos_std::evm { - use std::vector; use moveos_std::hash; + #[test_only] + use std::vector; + const ErrorEcRecoverFailed: u64 = 1; const ErrorModexpFailed: u64 = 5; const ErrorEcAddFailed: u64 = 6;