Skip to content

Commit

Permalink
Merge branch 'mdgeorge/remove-core-dep' into mdgeorge/remove-features
Browse files Browse the repository at this point in the history
  • Loading branch information
mdgeorge4153 committed Dec 20, 2024
2 parents e7e6291 + fd6c3e1 commit 9d2fc4e
Show file tree
Hide file tree
Showing 157 changed files with 8,482 additions and 1,832 deletions.
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ For each box you select, include information after the relevant heading that des

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] gRPC:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:
4 changes: 2 additions & 2 deletions .github/workflows/bridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
swap-size-gb: 256
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | { cat; echo '$FOUNDRY_BIN_DIR/foundryup --version nightly-fdfaafd629faa2eea3362a8370eef7c1f8074710'; } | bash
curl -L https://foundry.paradigm.xyz | { cat; echo '$FOUNDRY_BIN_DIR/foundryup -i nightly-fdfaafd629faa2eea3362a8370eef7c1f8074710'; } | bash
echo "$HOME/.config/.foundry/bin" >> $GITHUB_PATH
- name: Install Foundry Dependencies
working-directory: bridge/evm
Expand All @@ -111,7 +111,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | { cat; echo '$FOUNDRY_BIN_DIR/foundryup --version nightly-fdfaafd629faa2eea3362a8370eef7c1f8074710'; } | bash
curl -L https://foundry.paradigm.xyz | { cat; echo '$FOUNDRY_BIN_DIR/foundryup -i nightly-fdfaafd629faa2eea3362a8370eef7c1f8074710'; } | bash
echo "$HOME/.config/.foundry/bin" >> $GITHUB_PATH
- name: Install Foundry Dependencies
working-directory: bridge/evm
Expand Down
27 changes: 24 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ members = [
"crates/sui-indexer",
"crates/sui-indexer-alt",
"crates/sui-indexer-alt-framework",
"crates/sui-indexer-alt-jsonrpc",
"crates/sui-indexer-alt-schema",
"crates/sui-indexer-builder",
"crates/sui-json",
Expand Down Expand Up @@ -641,6 +642,7 @@ sui-graphql-rpc-headers = { path = "crates/sui-graphql-rpc-headers" }
sui-genesis-builder = { path = "crates/sui-genesis-builder" }
sui-indexer = { path = "crates/sui-indexer" }
sui-indexer-alt-framework = { path = "crates/sui-indexer-alt-framework" }
sui-indexer-alt-jsonrpc = { path = "crates/sui-indexer-alt-jsonrpc" }
sui-indexer-alt-schema = { path = "crates/sui-indexer-alt-schema" }
sui-indexer-builder = { path = "crates/sui-indexer-builder" }
sui-json = { path = "crates/sui-json" }
Expand Down
1 change: 1 addition & 0 deletions apps/core/src/utils/transaction/getOwnerType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const getOwnerType = (change: SuiObjectChange) => {
if ('AddressOwner' in change.owner) return 'AddressOwner';
if ('ObjectOwner' in change.owner) return 'ObjectOwner';
if ('Shared' in change.owner) return 'Shared';
if ('ConsensusV2' in change.owner) return 'ConsensusV2';
}
return change.owner;
};
1 change: 1 addition & 0 deletions apps/core/src/utils/transaction/groupByOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const getOwner = (change: SuiObjectChangeWithDisplay) => {
if ('AddressOwner' in change.owner) return change.owner.AddressOwner;
if ('ObjectOwner' in change.owner) return change.owner.ObjectOwner;
if ('Shared' in change.owner) return change.objectId;
if ('ConsensusV2' in change.owner) return change.owner.ConsensusV2.authenticator.SingleOwner;
}
return '';
};
Expand Down
65 changes: 45 additions & 20 deletions apps/wallet/src/ui/app/components/known-scam-overlay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,63 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { cx } from 'class-variance-authority';

import { Button } from '../../shared/ButtonUI';
import { Heading } from '../../shared/heading';
import { Portal } from '../../shared/Portal';
import type { DappPreflightResponse } from './types';
import WarningSvg from './warning.svg';

export type ScamOverlayProps = {
onDismiss(): void;
open: boolean;
title?: string;
subtitle?: string;
preflight: DappPreflightResponse;
onClickBack(): void;
onClickContinue(): void;
};

export function ScamOverlay({ open, onDismiss, title, subtitle }: ScamOverlayProps) {
if (!open) return null;
function Warning({ title, subtitle }: { title: string; subtitle: string }) {
return (
<div className="flex flex-col gap-2 text-center pb-4">
<Heading variant="heading2" weight="semibold" color="gray-90">
{title || 'Malicious website'}
</Heading>
<div className="flex text-center font-medium text-pBody text-gray-90">
<div className="font-medium text-pBody text-gray-90">
{subtitle ||
'This website has been flagged for malicious behavior. To protect your wallet from potential threats, please return to safety.'}
</div>
</div>
</div>
);
}

export function ScamOverlay({ preflight, onClickBack, onClickContinue }: ScamOverlayProps) {
const { block, warnings } = preflight;

if (!block.enabled && !warnings?.length) return null;

return (
<Portal containerId="overlay-portal-container">
<div className="h-full w-full bg-issue-light flex flex-col p-4 justify-center items-center gap-4 absolute top-0 left-0 bottom-0 z-50">
<div
className={cx(
'h-full w-full flex flex-col p-4 justify-center items-center gap-4 absolute top-0 left-0 bottom-0 z-50',
block.enabled ? 'bg-issue-light' : 'bg-warning-light',
)}
>
<WarningSvg />
<div className="flex flex-col gap-2 text-center pb-4">
<Heading variant="heading2" weight="semibold" color="gray-90">
{title || 'Malicious website'}
</Heading>
<div className="flex text-center font-medium text-pBody text-gray-90">
<div className="font-medium text-pBody text-gray-90">
{subtitle ||
'This website has been flagged for malicious behavior. To protect your wallet from potential threats, please return to safety.'}
</div>
</div>
</div>

<div className="gap-2 mt-auto w-full items-stretch">
<Button variant="primary" text="I understand" onClick={onDismiss} />
{!!block.enabled && <Warning {...preflight.block} />}

{warnings?.map(({ title, subtitle }, i) => {
// warnings list won't ever change, index key is fine
return <Warning key={i} title={title} subtitle={subtitle} />;
})}

<div className="flex flex-col gap-2 mt-auto w-full items-stretch">
<Button variant="primary" text="Return to safety" onClick={onClickBack} />
{!block.enabled && (
<Button variant="outlineWarning" text="Proceed" onClick={onClickContinue} />
)}
</div>
</div>
</Portal>
Expand Down
4 changes: 4 additions & 0 deletions apps/wallet/src/ui/app/components/known-scam-overlay/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export type DappPreflightResponse = {
title: string;
subtitle: string;
};
warnings?: {
title: string;
subtitle: string;
}[];
};

export type Network = 'mainnet' | 'testnet' | 'devnet' | 'local';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export function useShowScamWarning({

return {
data,
isOpen: !!data?.block.enabled && !isError,
isPending,
isError,
};
Expand Down
39 changes: 22 additions & 17 deletions apps/wallet/src/ui/app/components/user-approve-container/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { ampli } from '_src/shared/analytics/ampli';
import { type PermissionType } from '_src/shared/messaging/messages/payloads/permissions';
import { Transaction } from '@mysten/sui/transactions';
import cn from 'clsx';
import { useCallback, useMemo, useState } from 'react';
import { useMemo, useState } from 'react';
import type { ReactNode } from 'react';
import { useParams } from 'react-router-dom';

Expand Down Expand Up @@ -53,14 +54,18 @@ export function UserApproveContainer({
checkAccountLock,
}: UserApproveContainerProps) {
const [submitting, setSubmitting] = useState(false);
const handleOnResponse = useCallback(
async (allowed: boolean) => {
setSubmitting(true);
await onSubmit(allowed);
setSubmitting(false);
},
[onSubmit],
);
const [scamOverlayDismissed, setScamOverlayDismissed] = useState(false);

const handleDismissScamOverlay = () => {
ampli.bypassedScamWarning({ hostname: new URL(origin).hostname });
setScamOverlayDismissed(true);
};

const handleOnResponse = async (allowed: boolean) => {
setSubmitting(true);
await onSubmit(allowed);
setSubmitting(false);
};

const { data: selectedAccount } = useAccountByAddress(address);
const parsedOrigin = useMemo(() => new URL(origin), [origin]);
Expand All @@ -82,8 +87,7 @@ export function UserApproveContainer({
const message = request && request.tx && 'message' in request.tx ? request.tx.message : undefined;

const {
data,
isOpen,
data: preflight,
isPending: isDomainCheckLoading,
isError,
} = useShowScamWarning({
Expand All @@ -99,12 +103,13 @@ export function UserApproveContainer({

return (
<>
<ScamOverlay
open={isOpen}
title={data?.block.title}
subtitle={data?.block.subtitle}
onDismiss={() => handleOnResponse(false)}
/>
{!scamOverlayDismissed && !!preflight && (
<ScamOverlay
preflight={preflight}
onClickBack={() => handleOnResponse(false)}
onClickContinue={handleDismissScamOverlay}
/>
)}
<div className="flex flex-1 flex-col flex-nowrap h-full">
<div className="flex-1 pb-0 flex flex-col">
<DAppInfoCard
Expand Down
5 changes: 5 additions & 0 deletions crates/sui-benchmark/src/workloads/randomized_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use async_trait::async_trait;
use futures::future::join_all;
use rand::Rng;
use std::sync::Arc;
use std::time::Duration;
use sui_test_transaction_builder::TestTransactionBuilder;
use sui_types::base_types::{ObjectID, ObjectRef, SequenceNumber, SuiAddress};
use sui_types::crypto::{get_key_pair, AccountKeyPair};
Expand Down Expand Up @@ -406,6 +407,10 @@ impl Workload<dyn Payload> for RandomizedTransactionWorkload {
proxy: Arc<dyn ValidatorProxy + Sync + Send>,
system_state_observer: Arc<SystemStateObserver>,
) {
// We observed that randomness may need a few seconds until DKG completion, and this may
// causing randomness transaction fail with `TooOldTransactionPendingOnObject` error.
// Therefore, wait a few seconds at the beginning to give DKG some time.
tokio::time::sleep(Duration::from_secs(5)).await;
if self.basics_package_id.is_some() {
return;
}
Expand Down
5 changes: 4 additions & 1 deletion crates/sui-benchmark/tests/simtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ mod test {
// having queued certs which are missing dependencies.
check_system_overload_at_execution: false,
check_system_overload_at_signing: false,
max_txn_age_in_queue: Duration::from_secs(10000),
max_transaction_manager_queue_length: 10000,
max_transaction_manager_per_object_queue_length: 10000,
..Default::default()
})
.with_execution_cache_config(cache_config)
Expand Down Expand Up @@ -1012,7 +1015,7 @@ mod test {
shared_deletion_weight: 1,
shared_counter_hotness_factor: 50,
randomness_weight: 1,
randomized_transaction_weight: 1,
randomized_transaction_weight: 0,
num_shared_counters: Some(1),
use_shared_counter_max_tip: false,
shared_counter_max_tip: 0,
Expand Down
1 change: 1 addition & 0 deletions crates/sui-cluster-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ telemetry-subscribers.workspace = true

test-cluster.workspace = true
move-core-types.workspace = true
sui-move-build.workspace = true
2 changes: 1 addition & 1 deletion crates/sui-cluster-test/src/test_case/coin_index_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use jsonrpsee::rpc_params;
use move_core_types::language_storage::StructTag;
use serde_json::json;
use std::collections::HashMap;
use sui_core::test_utils::compile_managed_coin_package;
use sui_json::SuiJsonValue;
use sui_json_rpc_types::ObjectChange;
use sui_json_rpc_types::SuiTransactionBlockResponse;
use sui_json_rpc_types::{Balance, SuiTransactionBlockResponseOptions};
use sui_move_build::test_utils::compile_managed_coin_package;
use sui_test_transaction_builder::make_staking_transaction;
use sui_types::base_types::{ObjectID, ObjectRef};
use sui_types::gas_coin::GAS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
use crate::{TestCaseImpl, TestContext};
use async_trait::async_trait;
use jsonrpsee::rpc_params;
use sui_core::test_utils::compile_basics_package;
use sui_json_rpc_types::SuiTransactionBlockEffectsAPI;
use sui_move_build::test_utils::compile_basics_package;
use sui_types::{base_types::ObjectID, object::Owner};

pub struct FullNodeBuildPublishTransactionTest;
Expand Down
3 changes: 3 additions & 0 deletions crates/sui-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ mod transfer_to_object_tests;
#[cfg(test)]
#[path = "unit_tests/type_param_tests.rs"]
mod type_param_tests;
#[cfg(test)]
#[path = "unit_tests/unit_test_utils.rs"]
mod unit_test_utils;

pub mod signature_verifier;

Expand Down
2 changes: 1 addition & 1 deletion crates/sui-core/src/quorum_driver/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::quorum_driver::{
use crate::test_authority_clients::LocalAuthorityClient;
use crate::test_authority_clients::LocalAuthorityClientFaultConfig;
use crate::test_utils::make_transfer_sui_transaction;
use crate::{quorum_driver::QuorumDriverMetrics, test_utils::init_local_authorities};
use crate::{quorum_driver::QuorumDriverMetrics, unit_test_utils::init_local_authorities};
use mysten_common::sync::notify_read::{NotifyRead, Registration};
use std::net::SocketAddr;
use std::sync::atomic::{AtomicUsize, Ordering};
Expand Down
Loading

0 comments on commit 9d2fc4e

Please sign in to comment.