Skip to content

Commit

Permalink
Merge branch 'develop' into dev-tools/test-data-alias-ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 authored Jul 2, 2024
2 parents eb636a3 + 85a61ec commit cee8989
Show file tree
Hide file tree
Showing 117 changed files with 487 additions and 491 deletions.
4 changes: 2 additions & 2 deletions apps/wallet/configs/webpack/webpack.config.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function generateDateVersion(patch: number) {
}

const WALLET_BETA = process.env.WALLET_BETA === 'true';
const PATCH_VERISON = Number(process.env.PATCH_VERSION) || 0;
const PATCH_VERSION = Number(process.env.PATCH_VERSION) || 0;

const SDK_ROOT = resolve(__dirname, '..', '..', '..', '..', 'sdk');
const PROJECT_ROOT = resolve(__dirname, '..', '..');
Expand Down Expand Up @@ -99,7 +99,7 @@ async function generateAliasFromTs() {

const commonConfig: () => Promise<Configuration> = async () => {
const alias = await generateAliasFromTs();
const walletVersionDetails = generateDateVersion(PATCH_VERISON);
const walletVersionDetails = generateDateVersion(PATCH_VERSION);
const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN;
return {
context: SRC_ROOT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function findAccounts(
getBalance: GetBalanceCallback,
gasTypeArg: string,
): Promise<AccountFromFinder[]> {
// TODO: first check that accounts: Account[] is correctly sorted, if not, throw exception or somethintg
// TODO: first check that accounts: Account[] is correctly sorted, if not, throw exception or something
// Check new addresses for existing accounts
if (addressGapLimit > 0) {
for (const account of accounts) {
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/background/storage-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MIGRATION_DONE_STORAGE_KEY = 'storage-migration-done';
let statusCache: Status | null = null;

export async function getStatus() {
// placeholde for migration status, always returns ready
// placeholder for migration status, always returns ready
if (statusCache) {
return statusCache;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getGroupTitle(aGroupAccount: SerializedUIAccount) {
return ACCOUNT_TYPE_TO_LABEL[aGroupAccount?.type] || '';
}

// todo: we probbaly have some duplication here with the various FooterLink / ButtonOrLink
// todo: we probably have some duplication here with the various FooterLink / ButtonOrLink
// components - we should look to add these to base components somewhere
const FooterLink = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonOrLinkProps>(
({ children, to, ...props }, ref) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-bridge/src/iota_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where

async fn run_event_listening_task(
// The module where interested events are defined.
// Moudle is always of bridge package 0x9.
// Module is always of bridge package 0x9.
module: Identifier,
mut cursor: EventID,
events_sender: mysten_metrics::metered_channel::Sender<(Identifier, Vec<IotaEvent>)>,
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-bridge/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ mod tests {

#[tokio::test]
async fn test_iota_watcher_task() {
// Note: this test may fail beacuse of the following reasons:
// Note: this test may fail because of the following reasons:
// the IotaEvent's struct tag does not match the ones in events.rs

let (iota_events_tx, iota_events_rx, _eth_events_tx, eth_events_rx, iota_client, store) =
Expand Down Expand Up @@ -268,7 +268,7 @@ mod tests {

#[tokio::test]
async fn test_eth_watcher_task() {
// Note: this test may fail beacuse of the following reasons:
// Note: this test may fail because of the following reasons:
// 1. Log and BridgeAction returned from `get_test_log_and_action` are not in
// sync
// 2. Log returned from `get_test_log_and_action` is not parseable log (not
Expand Down
1 change: 0 additions & 1 deletion crates/iota-config/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
time::Duration,
usize,
};

use anyhow::Result;
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3566,12 +3566,12 @@ impl AuthorityState {
.rev()
.skip_while(|d| cursor.is_some() && Some(*d) != cursor)
.skip(usize::from(cursor.is_some()));
return Ok(iter.take(limit.unwrap_or(usize::max_value())).collect());
return Ok(iter.take(limit.unwrap_or(usize::MAX)).collect());
} else {
let iter = iter
.skip_while(|d| cursor.is_some() && Some(*d) != cursor)
.skip(usize::from(cursor.is_some()));
return Ok(iter.take(limit.unwrap_or(usize::max_value())).collect());
return Ok(iter.take(limit.unwrap_or(usize::MAX)).collect());
}
}
self.get_indexes()?
Expand Down
5 changes: 1 addition & 4 deletions crates/iota-core/src/authority/test_authority_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ impl<'a> TestAuthorityBuilder<'a> {
None,
)
.unwrap();
let expensive_safety_checks = match self.expensive_safety_checks {
None => ExpensiveSafetyCheckConfig::default(),
Some(config) => config,
};
let expensive_safety_checks = self.expensive_safety_checks.unwrap_or_default();
let cache = Arc::new(ExecutionCache::new_for_tests(
authority_store.clone(),
&registry,
Expand Down
2 changes: 2 additions & 0 deletions crates/iota-core/src/transaction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub struct TransactionManager {
#[derive(Clone, Debug)]
pub struct PendingCertificateStats {
// The time this certificate enters transaction manager.
#[cfg(test)]
pub enqueue_time: Instant,
// The time this certificate becomes ready for execution.
pub ready_time: Option<Instant>,
Expand Down Expand Up @@ -554,6 +555,7 @@ impl TransactionManager {
expected_effects_digest,
waiting_input_objects: input_object_keys,
stats: PendingCertificateStats {
#[cfg(test)]
enqueue_time: pending_cert_enqueue_time,
ready_time: None,
},
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-framework/docs/iota-framework/kiosk.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ A capability which locks an item and gives a permission to
purchase it from a <code><a href="kiosk.md#0x2_kiosk_Kiosk">Kiosk</a></code> for any price no less than <code>min_price</code>.

Allows exclusive listing: only bearer of the <code><a href="kiosk.md#0x2_kiosk_PurchaseCap">PurchaseCap</a></code> can
purchase the asset. However, the capablity should be used
purchase the asset. However, the capability should be used
carefully as losing it would lock the asset in the <code><a href="kiosk.md#0x2_kiosk_Kiosk">Kiosk</a></code>.

The main application for the <code><a href="kiosk.md#0x2_kiosk_PurchaseCap">PurchaseCap</a></code> is building extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module iota::kiosk {
/// purchase it from a `Kiosk` for any price no less than `min_price`.
///
/// Allows exclusive listing: only bearer of the `PurchaseCap` can
/// purchase the asset. However, the capablity should be used
/// purchase the asset. However, the capability should be used
/// carefully as losing it would lock the asset in the `Kiosk`.
///
/// The main application for the `PurchaseCap` is building extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ module std::vector_tests {
assert!(index == 1, 1);
}

// index_of will return the index first occurence that is equal
// index_of will return the index first occurrence that is equal
#[test]
fun index_of_nonempty_has_multiple_occurences() {
fun index_of_nonempty_has_multiple_occurrences() {
let mut v = vector[];
v.push_back(false);
v.push_back(true);
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-graphql-rpc/src/types/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) struct Page<C> {

/// In case there are more than `limit` entries in the range described by
/// `(after, before)`, this field states whether the entries up to limit
/// are taken fron the `Front` or `Back` of that range.
/// are taken from the `Front` or `Back` of that range.
end: End,
}

Expand Down
1 change: 1 addition & 0 deletions crates/iota-graphql-rpc/src/types/move_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub(crate) enum MoveObjectDowncastError {

/// This interface is implemented by types that represent a Move object on-chain
/// (A Move value whose type has `key`).
#[allow(clippy::duplicated_attributes)]
#[derive(Interface)]
#[graphql(
name = "IMoveObject",
Expand Down
1 change: 1 addition & 0 deletions crates/iota-graphql-rpc/src/types/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ pub(crate) struct HistoricalObjectCursor {

/// Interface implemented by on-chain values that are addressable by an ID (also
/// referred to as its address). This includes Move objects and packages.
#[allow(clippy::duplicated_attributes)]
#[derive(Interface)]
#[graphql(
name = "IObject",
Expand Down
1 change: 1 addition & 0 deletions crates/iota-graphql-rpc/src/types/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub(crate) struct OwnerImpl {
/// either the public key of an account or another object. The same address can
/// only refer to an account or an object, never both, but it is not possible to
/// know which up-front.
#[allow(clippy::duplicated_attributes)]
#[derive(Interface)]
#[graphql(
name = "IOwner",
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-json-rpc-types/src/iota_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ impl IotaProgrammableTransactionBlock {
}

fn resolve_input_type(
inputs: &Vec<CallArg>,
inputs: &[CallArg],
commands: &[Command],
module_cache: &impl GetModule,
) -> Vec<Option<MoveTypeLayout>> {
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-rpc-loadgen/src/payload/query_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'a> ProcessPayload<'a, &'a QueryTransactionBlocks> for RpcCommandProcessor
}
};

results = join_all(clients.iter().enumerate().map(|(_i, client)| {
results = join_all(clients.iter().map(|client| {
let with_query = query.clone();
async move {
query_transaction_blocks(client, with_query, cursor, None)
Expand Down
7 changes: 1 addition & 6 deletions crates/iota-storage/src/http_key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,7 @@ impl HttpKVStore {

async fn multi_fetch(&self, uris: Vec<Key>) -> Vec<IotaResult<Option<Bytes>>> {
let uris_vec = uris.to_vec();
let fetches = stream::iter(
uris_vec
.into_iter()
.enumerate()
.map(|(_i, uri)| self.fetch(uri)),
);
let fetches = stream::iter(uris_vec.into_iter().map(|uri| self.fetch(uri)));
fetches.buffered(uris.len()).collect::<Vec<_>>().await
}

Expand Down
2 changes: 1 addition & 1 deletion crates/iota-storage/src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ impl IndexStore {
});
let coin = obj.as_coin_maybe().unwrap_or_else(|| {
panic!(
"object_id: {:?} in written_coins cannot be deserialzied as a Coin, written_coins: {:?}, tx_digest: {:?}",
"object_id: {:?} in written_coins cannot be deserialized as a Coin, written_coins: {:?}, tx_digest: {:?}",
obj_id, written_coins, digest
)
});
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-storage/src/object_store/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ pub fn get_path(prefix: &str) -> Path {
}

// Snapshot MANIFEST file is very simple. Just a newline delimited list of all
// paths in the snapshot directory this simplicty enables easy parsing for
// paths in the snapshot directory this simplicity enables easy parsing for
// scripts to download snapshots
pub async fn write_snapshot_manifest<S: ObjectStoreListExt + ObjectStorePutExt>(
dir: &Path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,12 @@ impl SimulatorStore for PersistedStore {
fn insert_committee(&mut self, committee: Committee) {
let epoch = committee.epoch as usize;

let mut committees = if let Some(c) = self
let mut committees = self
.read_write
.epoch_to_committee
.get(&())
.expect("Fatal: DB read failed")
{
c
} else {
vec![]
};
.unwrap_or_default();

if committees.get(epoch).is_some() {
return;
Expand Down Expand Up @@ -394,16 +390,12 @@ impl SimulatorStore for PersistedStore {
.live_objects
.insert(&object_id, &version)
.expect("Fatal: DB write failed");
let mut q = if let Some(x) = self
let mut q = self
.read_write
.objects
.get(&object_id)
.expect("Fatal: DB read failed")
{
x
} else {
BTreeMap::new()
};
.unwrap_or_default();
q.insert(version, object);
self.read_write
.objects
Expand Down
1 change: 1 addition & 0 deletions crates/iota/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const GIT_REVISION: &str = {
};

const VERSION: &str = {
#[allow(clippy::const_is_empty)]
if GIT_REVISION.is_empty() {
env!("CARGO_PKG_VERSION")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ source: crates/iota/tests/ptb_files_tests.rs
expression: "results.join(\"\\n\")"
---
=== PREVIEW ===
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
PTB Preview
├───────────────┬─────────────────────────────────────────────────────────────────────────────────────────┤
commandvalues
├───────────────┼─────────────────────────────────────────────────────────────────────────────────────────┤
assignx vector[1u64, 2u64, 3u64, 4u64] │
assignx vector[1u64, 2u64, 3u64, 4u64] │
assignx vector["1", "2, 3", "", "4 "] │
assignx vector["1", "2, 3", "", "4 \n "] │
make-move-vec │ <u16> [1u64, 2u64, 3u64, 4u64] │
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────
PTB Preview
├───────────────┬─────────────────────────────────────────────────────────────────────────────────────────
commandvalues
├───────────────┼─────────────────────────────────────────────────────────────────────────────────────────
assignx vector[1u64, 2u64, 3u64, 4u64]
assignx vector[1u64, 2u64, 3u64, 4u64]
assignx vector["1", "2, 3", "", "4 "]
assignx vector["1", "2, 3", "", "4 \n "]
make-move-vec │ <u16> [1u64, 2u64, 3u64, 4u64]
│ make-move-vec │ <iota::string::String> [1u64, 2u64, 3u64, 4u64] │
│ make-move-vec │ <iota::string::String> ["1", "2, 3", "", "4 "] │
│ make-move-vec │ <iota::string::String> ["1", "2, 3", "", "4 \n "] │
├───────────────┼─────────────────────────────────────────────────────────────────────────────────────────┤
│ gas-budget │ 100 │
╰───────────────┴─────────────────────────────────────────────────────────────────────────────────────────╯
├───────────────┼─────────────────────────────────────────────────────────────────────────────────────────
│ gas-budget │ 100
╰───────────────┴─────────────────────────────────────────────────────────────────────────────────────────
=== BUILT PTB ===
Input 0: Pure([1, 0, 0, 0, 0, 0, 0, 0])
Input 1: Pure([2, 0, 0, 0, 0, 0, 0, 0])
Expand Down
6 changes: 1 addition & 5 deletions crates/iotaop-cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ impl Default for CommandOptions {

pub fn run_cmd(cmd_in: Vec<&str>, options: Option<CommandOptions>) -> Result<Output> {
debug!("attempting to run {}", cmd_in.join(" "));
let opts = if let Some(opts) = options {
opts
} else {
CommandOptions::default()
};
let opts = options.unwrap_or_default();

let mut cmd = Command::new(cmd_in[0]);
// add extra args
Expand Down
2 changes: 1 addition & 1 deletion crates/telemetry-subscribers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl SamplingFilter {

fn clamp(sample_rate: f64) -> f64 {
// clamp sample rate to between 0.0001 and 1.0
sample_rate.max(0.0001).min(1.0)
sample_rate.clamp(0.0001, 1.0)
}

fn update_sampling_rate(&self, sample_rate: f64) {
Expand Down
2 changes: 1 addition & 1 deletion crates/typed-store/src/rocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,7 @@ fn populate_missing_cfs(
/// Given a vec<u8>, find the value which is one more than the vector
/// if the vector was a big endian number.
/// If the vector is already minimum, don't change it.
fn big_endian_saturating_add_one(v: &mut Vec<u8>) {
fn big_endian_saturating_add_one(v: &mut [u8]) {
if is_max(v) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Overview({ output }: { output: DryRunTransactionBlockResponse })
network,
status:
output.effects.status?.status === 'success'
? '✅ Transaction dry run executed succesfully!'
? '✅ Transaction dry run executed successfully!'
: output.effects.status?.status === 'failure'
? '❌ Transaction failed to execute!'
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<'a> BoundsChecker<'a> {
check_bounds_impl(self.view.identifiers(), function_handle.name)?;
check_bounds_impl(self.view.signatures(), function_handle.parameters)?;
check_bounds_impl(self.view.signatures(), function_handle.return_)?;
// function signature type paramters must be in bounds to the function type
// function signature type parameters must be in bounds to the function type
// parameters
let type_param_count = function_handle.type_parameters.len();
if let Some(sig) = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ fn type_parameter_phantom_decl_compatible(
// phantom/non-phantom cannot change from one version to the next.
old_type_parameter.is_phantom == new_type_parameter.is_phantom
} else {
// old_type_paramter.is_phantom => new_type_parameter.is_phantom
// old_type_parameter.is_phantom => new_type_parameter.is_phantom
!old_type_parameter.is_phantom || new_type_parameter.is_phantom
}
}
Expand Down
Loading

0 comments on commit cee8989

Please sign in to comment.