Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpc: introduce coin_index_2 with coins sorted by balance #19822

Merged
merged 8 commits into from
Oct 16, 2024
9 changes: 5 additions & 4 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use crate::execution_cache::ExecutionCacheTraitPointers;
use crate::execution_cache::TransactionCacheRead;
use crate::jsonrpc_index::CoinIndexKey2;
use crate::rest_index::RestIndexStore;
use crate::transaction_outputs::TransactionOutputs;
use crate::verify_indexes::verify_indexes;
Expand Down Expand Up @@ -64,6 +65,8 @@ use self::authority_store_pruner::AuthorityStorePruningMetrics;
pub use authority_store::{AuthorityStore, ResolverWrapper, UpdateType};
use mysten_metrics::{monitored_scope, spawn_monitored_task};

use crate::jsonrpc_index::IndexStore;
use crate::jsonrpc_index::{CoinInfo, ObjectIndexChanges};
use once_cell::sync::OnceCell;
use shared_crypto::intent::{AppId, Intent, IntentMessage, IntentScope, IntentVersion};
use sui_archival::reader::ArchiveReaderBalancer;
Expand All @@ -76,10 +79,8 @@ use sui_json_rpc_types::{
SuiTransactionBlockEvents, TransactionFilter,
};
use sui_macros::{fail_point, fail_point_async, fail_point_if};
use sui_storage::indexes::{CoinInfo, ObjectIndexChanges};
use sui_storage::key_value_store::{TransactionKeyValueStore, TransactionKeyValueStoreTrait};
use sui_storage::key_value_store_metrics::KeyValueStoreMetrics;
use sui_storage::IndexStore;
use sui_types::authenticator_state::get_authenticator_state;
use sui_types::committee::{EpochId, ProtocolVersion};
use sui_types::crypto::{default_hash, AuthoritySignInfo, Signer};
Expand Down Expand Up @@ -3664,10 +3665,10 @@ impl AuthorityState {
&self,
owner: SuiAddress,
// If `Some`, the query will start from the next item after the specified cursor
cursor: (String, ObjectID),
cursor: (String, u64, ObjectID),
limit: usize,
one_coin_type_only: bool,
) -> SuiResult<impl Iterator<Item = (String, ObjectID, CoinInfo)> + '_> {
) -> SuiResult<impl Iterator<Item = (CoinIndexKey2, CoinInfo)> + '_> {
if let Some(indexes) = &self.indexes {
indexes.get_owned_coins_iterator_with_cursor(owner, cursor, limit, one_coin_type_only)
} else {
Expand Down
3 changes: 2 additions & 1 deletion crates/sui-core/src/authority/test_authority_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::epoch::committee_store::CommitteeStore;
use crate::epoch::epoch_metrics::EpochMetrics;
use crate::epoch::randomness::RandomnessManager;
use crate::execution_cache::build_execution_cache;
use crate::jsonrpc_index::IndexStore;
use crate::mock_consensus::{ConsensusMode, MockConsensusClient};
use crate::module_cache_metrics::ResolverMetrics;
use crate::rest_index::RestIndexStore;
Expand All @@ -30,7 +31,6 @@ use sui_config::ExecutionCacheConfig;
use sui_macros::nondeterministic;
use sui_network::randomness;
use sui_protocol_config::ProtocolConfig;
use sui_storage::IndexStore;
use sui_swarm_config::genesis_config::AccountConfig;
use sui_swarm_config::network_config::NetworkConfig;
use sui_types::base_types::{AuthorityName, ObjectID};
Expand Down Expand Up @@ -270,6 +270,7 @@ impl<'a> TestAuthorityBuilder<'a> {
.protocol_config()
.max_move_identifier_len_as_option(),
false,
&authority_store,
)))
};
let rest_index = if self.disable_indexer {
Expand Down
Loading
Loading