Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into docs/remove-set-owned…
Browse files Browse the repository at this point in the history
…-reference
  • Loading branch information
Alina-chan committed Oct 15, 2024
2 parents 84284e6 + 72e5405 commit 130b86b
Show file tree
Hide file tree
Showing 319 changed files with 11,900 additions and 4,381 deletions.
5 changes: 5 additions & 0 deletions .github/actions/diffs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ outputs:
isMoveAutoFormatter:
description: True when changes happened in MoveAutoFormatter code
value: "${{ steps.diff.outputs.isMoveAutoFormatter }}"
isExamples:
description: True when changes happened in examples/ directory
value: "${{ steps.diff.outputs.isExamples }}"

runs:
using: composite
Expand Down Expand Up @@ -76,3 +79,5 @@ runs:
- 'sui-execution/**'
isMoveAutoFormatter:
- 'external-crates/move/crates/move-analyzer/prettier-plugin/**'
isExamples:
- 'examples/**'
4 changes: 2 additions & 2 deletions .github/actions/ts-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ runs:
shell: bash

- name: Run TS SDK e2e tests
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui'
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui test:e2e'
shell: bash

- name: Run TS SDK GraphQL compatibility e2e tests
if: ${{ inputs.ref != "testnet" && inputs.ref != "devnet" }}
if: (!contains(fromJSON('["testnet", "devnet"]'), inputs.ref))
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/graphql-transport test:e2e'
shell: bash
19 changes: 0 additions & 19 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,3 @@ jobs:
- name: Build
run: pnpm build
working-directory: ./docs/site
- name: Check for changes in the examples directory
id: check_changes
run: |
if git diff --name-only $GITHUB_EVENT_BEFORE $GITHUB_SHA | grep '^examples/'; then
echo "examplechanges=true" >> $GITHUB_ENV
else
echo "examplechanges=false" >> $GITHUB_ENV
fi
- name: Notify Slack if examples directory changed
if: env.examplechanges == 'true' && github.event.action == 'opened'
uses: slackapi/[email protected]
with:
payload: |
{
"channel": "#tech-docs",
"text": "An open PR modifies files in the `examples/` directory. Review it: <https://github.com/${{ github.repository }}/pull/${{ github.event.number }}>"
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@ jobs:
outputs:
isDoc: ${{ steps.diff.outputs.isDoc }}
isOldDoc: ${{ steps.diff.outputs.isOldDoc }}
isExamples: ${{ steps.diff.outputs.isExamples }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
- name: Detect Changes
uses: './.github/actions/diffs'
id: diff

examples:
name: Notify Slack if examples directory changed
needs: diff
if: needs.diff.outputs.isExamples == 'true'
runs-on: [ubuntu-latest]

steps:
- name: Notify Slack of Examples Changes
uses: slackapi/[email protected]
with:
channel-id: 'tech-docs'
slack-message: "An open PR modifies files in the `examples/` directory. Review it: <https://github.com/${{ github.repository }}/pull/${{ github.event.number }}>"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

spelling:
name: Lint documentation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: Attach Sui binaries to a ${{ inputs.sui_tag }} release

on:
release:
types: [ published, prereleased ]
types: created
workflow_dispatch:
inputs:
sui_tag:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ jobs:
- name: cargo test
run: |
cargo nextest run --profile ci -E '!package(sui-bridge)'
- name: cargo test (sui-graphql staging)
run: |
cargo nextest run --profile ci --features staging -E 'package(sui-graphql-rpc)' -E 'package(sui-graphql-e2e-tests)'
# Ensure there are no uncommitted changes in the repo after running tests
- run: scripts/changed-files.sh
shell: bash
Expand Down Expand Up @@ -159,6 +156,9 @@ jobs:
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 256
- name: cargo test (sui-graphql staging)
run: |
cargo nextest run --profile ci --features staging -E 'package(sui-graphql-rpc)' -E 'package(sui-graphql-e2e-tests)'
- name: benchmark (smoke)
run: |
cargo run --package sui-benchmark --bin stress -- --log-path /tmp/stress.log --num-client-threads 10 --num-server-threads 24 --num-transfer-accounts 2 bench --target-qps 100 --num-workers 10 --transfer-object 50 --shared-counter 50 --run-duration 10s --stress-stat-collection
Expand Down
22 changes: 19 additions & 3 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ aws-sdk-s3 = "0.29.0"
aws-smithy-http = "0.56"
aws-smithy-runtime-api = "0.56"
axum = { version = "0.7", default-features = false, features = [
"macros",
"tokio",
"http1",
"http2",
Expand Down
1 change: 1 addition & 0 deletions apps/wallet/src/ui/app/pages/swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export function SwapPage() {
amount: parsed.toString(),
slippage: Number(allowedMaxSlippagePercentage),
enabled: isFormValid && parsed > 0n && !!fromCoinType && !!toCoinType,
source: 'sui-wallet',
});

const swapData = useMemo(() => {
Expand Down
1 change: 1 addition & 0 deletions apps/wallet/src/ui/app/pages/swap/useSwapTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type SwapRequest = {
amount: string;
fromType?: string;
slippage: number;
source: string;
sender?: string;
toType?: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ tonic:
connection_buffer_size: 33554432
excessive_message_size: 16777216
message_size_limit: 67108864

30 changes: 9 additions & 21 deletions consensus/core/src/authority_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
core::{Core, CoreSignals},
core_thread::{ChannelCoreThreadDispatcher, CoreThreadHandle},
dag_state::DagState,
leader_schedule::{LeaderSchedule, LeaderSwapTable},
leader_schedule::LeaderSchedule,
leader_timeout::{LeaderTimeoutTask, LeaderTimeoutTaskHandle},
metrics::initialise_metrics,
network::{
Expand Down Expand Up @@ -233,20 +233,10 @@ where
let block_manager =
BlockManager::new(context.clone(), dag_state.clone(), block_verifier.clone());

let leader_schedule = if context
.protocol_config
.mysticeti_leader_scoring_and_schedule()
{
Arc::new(LeaderSchedule::from_store(
context.clone(),
dag_state.clone(),
))
} else {
Arc::new(LeaderSchedule::new(
context.clone(),
LeaderSwapTable::default(),
))
};
let leader_schedule = Arc::new(LeaderSchedule::from_store(
context.clone(),
dag_state.clone(),
));

let commit_consumer_monitor = commit_consumer.monitor();
commit_consumer_monitor
Expand Down Expand Up @@ -426,7 +416,7 @@ mod tests {
use std::{collections::BTreeSet, sync::Arc, time::Duration};

use consensus_config::{local_committee_and_keys, Parameters};
use mysten_metrics::monitored_mpsc::{unbounded_channel, UnboundedReceiver};
use mysten_metrics::monitored_mpsc::UnboundedReceiver;
use prometheus::Registry;
use rstest::rstest;
use sui_protocol_config::ProtocolConfig;
Expand Down Expand Up @@ -457,8 +447,7 @@ mod tests {
let protocol_keypair = keypairs[own_index].1.clone();
let network_keypair = keypairs[own_index].0.clone();

let (sender, _receiver) = unbounded_channel("consensus_output");
let commit_consumer = CommitConsumer::new(sender, 0);
let (commit_consumer, _, _) = CommitConsumer::new(0);

let authority = ConsensusAuthority::start(
network_type,
Expand Down Expand Up @@ -735,8 +724,7 @@ mod tests {
let protocol_keypair = keypairs[index].1.clone();
let network_keypair = keypairs[index].0.clone();

let (sender, receiver) = unbounded_channel("consensus_output");
let commit_consumer = CommitConsumer::new(sender, 0);
let (commit_consumer, commit_receiver, _) = CommitConsumer::new(0);

let authority = ConsensusAuthority::start(
network_type,
Expand All @@ -753,6 +741,6 @@ mod tests {
)
.await;

(authority, receiver)
(authority, commit_receiver)
}
}
20 changes: 10 additions & 10 deletions consensus/core/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
block::{BlockAPI, BlockRef, BlockTimestampMs, Round, Slot, VerifiedBlock},
leader_scoring::ReputationScores,
storage::Store,
TransactionIndex,
};

/// Index of a commit among all consensus commits.
Expand Down Expand Up @@ -109,6 +110,7 @@ pub(crate) struct CommitV1 {
leader: BlockRef,
/// Refs to committed blocks, in the commit order.
blocks: Vec<BlockRef>,
// TODO(fastpath): record rejected transactions.
}

impl CommitAPI for CommitV1 {
Expand Down Expand Up @@ -293,6 +295,8 @@ pub struct CommittedSubDag {
pub leader: BlockRef,
/// All the committed blocks that are part of this sub-dag
pub blocks: Vec<VerifiedBlock>,
/// Indices of rejected transactions in each block.
pub rejected_transactions_by_block: Vec<Vec<TransactionIndex>>,
/// The timestamp of the commit, obtained from the timestamp of the leader block.
pub timestamp_ms: BlockTimestampMs,
/// The reference of the commit.
Expand All @@ -309,13 +313,16 @@ impl CommittedSubDag {
pub fn new(
leader: BlockRef,
blocks: Vec<VerifiedBlock>,
rejected_transactions_by_block: Vec<Vec<TransactionIndex>>,
timestamp_ms: BlockTimestampMs,
commit_ref: CommitRef,
reputation_scores_desc: Vec<(AuthorityIndex, u64)>,
) -> Self {
assert_eq!(blocks.len(), rejected_transactions_by_block.len());
Self {
leader,
blocks,
rejected_transactions_by_block,
timestamp_ms,
commit_ref,
reputation_scores_desc,
Expand Down Expand Up @@ -386,11 +393,14 @@ pub fn load_committed_subdag_from_store(
commit_block
})
.collect::<Vec<_>>();
// TODO(fastpath): recover rejected transaction indices from commit.
let rejected_transactions = vec![vec![]; blocks.len()];
let leader_block_idx = leader_block_idx.expect("Leader block must be in the sub-dag");
let leader_block_ref = blocks[leader_block_idx].reference();
CommittedSubDag::new(
leader_block_ref,
blocks,
rejected_transactions,
commit.timestamp_ms(),
commit.reference(),
reputation_scores_desc,
Expand Down Expand Up @@ -508,16 +518,6 @@ pub(crate) struct CommitInfo {
pub(crate) reputation_scores: ReputationScores,
}

impl CommitInfo {
// Returns a new CommitInfo.
pub(crate) fn new(committed_rounds: Vec<Round>, reputation_scores: ReputationScores) -> Self {
CommitInfo {
committed_rounds,
reputation_scores,
}
}
}

/// CommitRange stores a range of CommitIndex. The range contains the start (inclusive)
/// and end (inclusive) commit indices and can be ordered for use as the key of a table.
///
Expand Down
Loading

0 comments on commit 130b86b

Please sign in to comment.