Skip to content

Commit

Permalink
Updates for Mainnet (MystenLabs#11134)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
randall-Mysten authored Apr 21, 2023
1 parent 6905c8a commit cbaf7e7
Show file tree
Hide file tree
Showing 38 changed files with 95 additions and 114 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Sui offers the following benefits and capabilities:
* Ability to define rich and composable on-chain assets
* Better user experience for web3 apps

Sui is the only blockchain today that can scale with the growth of web3 while achieving industry-leading performance, cost, programmability, and usability. As we push towards mainnet launch, we will demonstrate capacity beyond the transaction processing capabilities of established systems – traditional and blockchain alike. We see Sui as the first internet-scale programmable blockchain platform, a foundational layer for web3.
Sui is the only blockchain today that can scale with the growth of web3 while achieving industry-leading performance, cost, programmability, and usability. As Sui approaches Mainnet launch, it will demonstrate capacity beyond the transaction processing capabilities of established systems – traditional and blockchain alike. Sui is the first internet-scale programmable blockchain platform, a foundational layer for web3.

## Sui Architecture

Expand Down
4 changes: 2 additions & 2 deletions doc/src/build/cli-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ sui client transfer --to 0xcd2630011f6cb9aef960ed42d95b04e063c44a6143083ef89a35e
You can merge coins to reduce the number of separate coin objects in an account, or split coins to create smaller coin objects to use for transfers or gas payments.
We can use the `merge-coin` command and `split-coin` command to consolidate or split coins, respectively.
You can use the `merge-coin` command and `split-coin` command to consolidate or split coins, respectively.
### Merge coins
Expand Down Expand Up @@ -425,7 +425,7 @@ The command parameters include:
* address of the new gas object owner
* `--gas` - an optional object containing gas used to pay for this
function call
* `--gas-budget` - a decimal value expressing how much gas we are
* `--gas-budget` - a decimal value expressing how much gas you are
willing to pay for the `transfer` call to be completed to avoid
accidental drain of all gas in the gas pay)
Expand Down
4 changes: 2 additions & 2 deletions doc/src/build/connect-sui-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Connect to a Sui Network

Sui has Testnet and Devnet networks available. Use one of the on-chain networks to experiment with the version of Sui running on that network. You can also spin up a [local Sui network](sui-local-network.md) for local development.

The Sui networks consist of:
The Sui Testnet and Devnet networks consist of:

* Four validator nodes operated by Mysten Labs. Clients send transactions and read requests via this endpoint: `https://fullnode.<SUI-NETWORK-VERSION>.sui.io:443` using [JSON-RPC](../build/json-rpc.md).
* A public network [Sui Explorer](https://explorer.sui.io) for browsing transaction history.
Expand Down Expand Up @@ -251,7 +251,7 @@ Created new keypair for address with scheme ED25519: [0xa01cd0c520f12a1e9d57bf3c
Secret Recovery Phrase : [sunny tip element salad frequent february amount notice chair kite race push noise ketchup that same cannon bench mirror please dinosaur indicate violin sunset]
```
To create a sword and transfer it to another player, we use the following command to call the `sword_create` [function](https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/move_tutorial/sources/my_module.move#L47) in the `my_module` [module](https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/move_tutorial/sources/my_module.move#L4) of the package we previously published.
To create a sword and transfer it to another player, use the following command to call the `sword_create` [function](https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/move_tutorial/sources/my_module.move#L47) in the `my_module` [module](https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/move_tutorial/sources/my_module.move#L4) of the package you previously published.
You must use the same format for the command and function parameters as the example shown.
Expand Down
2 changes: 1 addition & 1 deletion doc/src/build/event_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ You can use `EventFilter` to filter the events included in your subscription to

### Combining filters

We provide a few operators for combining filters:
Sui provides a few operators for combining filters:

| Operator | Description | JSON-RPC Parameter Example |
|----------| ----------- | -------------------------- |
Expand Down
6 changes: 3 additions & 3 deletions doc/src/build/fullnode.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Follow the instructions here to run your own Sui Full.

Suggested minimum hardware to run a Sui Full node:

- CPUs: 10 core
- RAM: 32 GB
- Storage (SSD): 2 TB
- CPUs: 10 physical cores / 20 vCPUs
- RAM: 128 GB
- Storage (SSD): 2 TB NVMe drive

### Software requirements

Expand Down
2 changes: 1 addition & 1 deletion doc/src/build/move/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sui Move is an open source language for writing safe smart contracts. It was ori
blockchains with vastly different data and execution models.


The documentation for the original Move language is available in the [Move GitHub](https://github.com/move-language/move) repository and includes a [tutorial](https://github.com/move-language/move/blob/main/language/documentation/tutorial/README.md) and a [book](https://github.com/move-language/move/blob/main/language/documentation/book/src/SUMMARY.md) describing language features in detail. These are invaluable resources to deepen your understanding of the Move language but not strict prerequisites to following the Sui tutorial, which we strived to make self-contained. Further, Sui Move differs in some ways from Move, which we explore here.
The documentation for the original Move language is available in the [Move GitHub](https://github.com/move-language/move) repository and includes a [tutorial](https://github.com/move-language/move/blob/main/language/documentation/tutorial/README.md) and a [book](https://github.com/move-language/move/blob/main/language/documentation/book/src/SUMMARY.md) describing language features in detail. These are invaluable resources to deepen your understanding of the Move language but not strict prerequisites to following the Sui tutorial. Further, Sui Move differs in some ways from Move, which is explored here.

You can use Sui Move to define, create, and manage programmable [Sui objects](../objects.md) representing user-level assets. Sui's object system is implemented by adding new functionality to Move while also imposing additional restrictions, creating a dialect of Move (a.k.a. *Sui Move*) that makes certain parts of the original Move documentation not applicable to smart contract development in Sui. Consequently, it's best to follow this tutorial and the relevant Move documentation links within.

Expand Down
10 changes: 5 additions & 5 deletions doc/src/build/prog-trans-ts-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Sui Programmable Transaction Blocks with the TS SDK
---

In Sui, all user-initiated transactions are called Programmable Transaction Blocks.
In Sui, all user-initiated transactions are called Programmable Transaction blocks.

## Get Started

To get started using Programmable Transaction Blocks, make sure that you have the latest TypeScript SDK installed.
To get started using Programmable Transaction blocks, make sure that you have the latest TypeScript SDK installed.

This example starts by constructing a transaction block to send Sui. If you are familiar with the legacy Sui transaction types, this is similar to a `paySui` transaction. To construct transactions, import the `TransactionBlock` class, and construct it:

Expand Down Expand Up @@ -59,11 +59,11 @@ signer.signAndExecuteTransactionBlock({ transactionBlock: txb });

## Inputs and transactions

Programmable Transaction Blocks have two key concepts: inputs and transactions.
Programmable Transaction blocks have two key concepts: inputs and transactions.

Inputs are values that are used as arguments to the transactions in the transaction block. Inputs can either be an object reference (either to an owned object, an immutable object, or a shared object), or a pure BCS value (for example, an encoded string used as an argument to a move call).

Transactions are steps of execution in the transaction block. You can also use the result of previous transaction as an argument to future transactions. By combining multiple transactions together, Programmable Transaction Blocks provide a flexible way to create complex transactions.
Transactions are steps of execution in the transaction block. You can also use the result of previous transaction as an argument to future transactions. By combining multiple transactions together, Programmable Transaction blocks provide a flexible way to create complex transactions.

## Constructing inputs

Expand Down Expand Up @@ -217,7 +217,7 @@ function handleSignRequest(input) {
}
```

## Sponsored Transaction Blocks
## Sponsored transaction blocks

The transaction block builder can support sponsored transaction blocks by using the `onlyTransactionKind` flag when building the transaction block.

Expand Down
6 changes: 3 additions & 3 deletions doc/src/build/programming-with-objects/ch1-object-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ sui move build

### Writing unit tests

After you define the `create` function, you can test it in Sui Move using unit tests without having to go all the way through sending Sui transactions. Since [Sui manages global storage separately outside of Move](../../learn/sui-move-diffs.md#object-centric-global-storage), there is no direct way to retrieve objects from global storage within Move. This poses a question: after calling the `create` function, how do we check that the object is properly transferred?
After you define the `create` function, you can test it in Sui Move using unit tests without having to go all the way through sending Sui transactions. Since [Sui manages global storage separately outside of Move](../../learn/sui-move-diffs.md#object-centric-global-storage), there is no direct way to retrieve objects from global storage within Move. This poses a question: after calling the `create` function, how do you check that the object is properly transferred?

To assist easy testing in Sui Move, we provide a comprehensive testing framework in the [test_scenario](https://github.com/MystenLabs/sui/tree/main/crates/sui-framework/packages/sui-framework/sources/test/test_scenario.move) module that allows us to interact with objects put into the global storage. This allows us to test the behavior of any function directly in Sui Move unit tests. A lot of this is also covered in our [Move testing](../move/build-test.md#sui-specific-testing) topic.
To assist easy testing in Sui Move, Sui provides a comprehensive testing framework in the [test_scenario](https://github.com/MystenLabs/sui/tree/main/crates/sui-framework/packages/sui-framework/sources/test/test_scenario.move) module that allows us to interact with objects put into the global storage. This allows us to test the behavior of any function directly in Sui Move unit tests. A lot of this is also covered in our [Move testing](../move/build-test.md#sui-specific-testing) topic.

The `test_scenario` emulates a series of Sui transactions, each sent from a particular address. You can start the first transaction using the `test_scenario::begin` function that takes the address of the user sending this transaction as an argument, and returns an instance of the `Scenario` struct representing a test scenario.

Expand Down Expand Up @@ -147,7 +147,7 @@ test_scenario::next_tx(scenario, not_owner);
```

`test_scenario::next_tx` switches the transaction sender to `@0x2`, which is a new address different from the previous one.
`test_scenario::has_most_recent_for_sender` checks whether an object with the given type actually exists in the global storage owned by the current sender of the transaction. In this code, we assert that we should not be able to remove such an object, because `@0x2` does not own any object.
`test_scenario::has_most_recent_for_sender` checks whether an object with the given type actually exists in the global storage owned by the current sender of the transaction. This code asserts that you should not be able to remove such an object, because `@0x2` does not own any object.

**Note:** The second parameter of `assert!` is the error code. In non-test code, you usually define a list of dedicated error code constants for each type of error that could happen in production. For unit tests, it's usually unnecessary because there are too many assertions. The stack trace upon error is sufficient to tell where the error happened. You can just put `0` for assertions in unit tests.

Expand Down
6 changes: 3 additions & 3 deletions doc/src/build/programming-with-objects/ch2-using-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sui authentication mechanisms ensure only you can use objects owned by you in Su

There are two ways to pass objects by reference: read-only references (`&T`) and mutable references (`&mut T`). Read-only references allow you to read data from the object, while mutable references allow you to mutate the data in the object. To add a function that allows you to update one of the values of `ColorObject` with another value of `ColorObject`. This exercises both using read-only references and mutable references.

The `ColorObject` we defined in the previous chapter looks like:
The `ColorObject` defined in the previous chapter looks like:
```rust
struct ColorObject has key {
id: UID,
Expand Down Expand Up @@ -102,7 +102,7 @@ There are two ways to handle a pass-by-value Sui object in Move:

If the intention is to actually delete the object, unpack it. You can do this only in the module that defined the struct type, due to Move's [privileged struct operations rules](https://github.com/move-language/move/blob/main/language/documentation/book/src/structs-and-resources.md#privileged-struct-operations). If any field is also of struct type, you must use recursive unpacking and deletion when you unpack the object.

However, the `id` field of a Sui object requires special handling. You must call the following API in the [object](https://github.com/MystenLabs/sui/tree/main/crates/sui-framework/packages/sui-framework/sources/object.move) module to signal Sui that we intend to delete this object:
However, the `id` field of a Sui object requires special handling. You must call the following API in the [object](https://github.com/MystenLabs/sui/tree/main/crates/sui-framework/packages/sui-framework/sources/object.move) module to signal Sui that you intend to delete this object:

```rust
public fun delete(id: UID) { ... }
Expand Down Expand Up @@ -130,7 +130,7 @@ let scenario = &mut scenario_val;
let ctx = test_scenario::ctx(scenario);
color_object::create(255, 0, 255, ctx);
};
// Delete the ColorObject we just created.
// Delete the ColorObject just created.
test_scenario::next_tx(scenario, owner);
{
let object = test_scenario::take_from_sender<ColorObject>(scenario);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ In the preceding entry function, you must pass the object by value so that it's

The wrapper object is then sent to the service operator, with the address specified in the call as `service_address`.

Although the service operator (`service_address`) now owns the `ObjectWrapper`, which contains the object to be swapped, the service operator still cannot access or steal the underlying wrapped `Object`. This is because the `transfer_object` function we defined requires the caller to pass an `Object` into it; but the service operator cannot access the wrapped `Object`, and passing `ObjectWrapper` to the `transfer_object` function would be invalid. Recall that an object can be read or modified only by the module in which it is defined; because this module defines only a wrapping / packing function (`request_swap`), and not an unwrapping / unpacking function, the service operator has no way to unpack the `ObjectWrapper` to retrieve the wrapped `Object`. Also, `ObjectWrapper` itself lacks any defined transfer method, so the service operator cannot transfer the wrapped object to someone else either.
Although the service operator (`service_address`) now owns the `ObjectWrapper`, which contains the object to be swapped, the service operator still cannot access or steal the underlying wrapped `Object`. This is because the `transfer_object` function you defined requires you to pass an `Object` into it; but the service operator cannot access the wrapped `Object`, and passing `ObjectWrapper` to the `transfer_object` function would be invalid. Recall that an object can be read or modified only by the module in which it is defined; because this module defines only a wrapping / packing function (`request_swap`), and not an unwrapping / unpacking function, the service operator has no way to unpack the `ObjectWrapper` to retrieve the wrapped `Object`. Also, `ObjectWrapper` itself lacks any defined transfer method, so the service operator cannot transfer the wrapped object to someone else either.

The function interface for the function that the service operator can call to perform a swap between two objects sent from two addresses resembles:

Expand Down
2 changes: 1 addition & 1 deletion doc/src/build/programming-with-objects/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Programming Objects Tutorial Series

Sui is a blockchain centered on [objects](../../learn/objects.md). Once you start programming non-trivial [smart contracts](../../build/move/index.md) on Sui, you will begin dealing with Sui objects in the code. Sui includes a rich, comprehensive library and testing framework to allow you to interact with objects in a safe yet flexible way.

In this tutorial series, we will walk through all the powerful ways to interact with objects in [Sui Move](../../learn/sui-move-diffs.md). At the end, we will also explore the designs of a few (close-to-)real-world examples to demonstrate the tradeoffs of using different object types and ownership relationships.
This tutorial series walks through all the powerful ways to interact with objects in [Sui Move](../../learn/sui-move-diffs.md). At the end, it also explores the designs of a few (close-to-)real-world examples to demonstrate the tradeoffs of using different object types and ownership relationships.

## Prerequisites

Expand Down
Loading

0 comments on commit cbaf7e7

Please sign in to comment.