Skip to content

Commit

Permalink
Merge branch 'support-document-symbol-psl' of github.com:yubing744/st…
Browse files Browse the repository at this point in the history
…arcoin-move into startcoin-move-analyzer
  • Loading branch information
yubing744 committed Jul 24, 2022
2 parents b5c3857 + c4f76b9 commit 8dc7558
Show file tree
Hide file tree
Showing 337 changed files with 13,783 additions and 14,460 deletions.
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ xtest = "run --package x --bin x -- test"
xlint = "run --package x --bin x -- lint"
xbuild = "run --package x --bin x -- build"
nextest = "run --package x --bin x -- nextest"

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-arg=/STACK:8000000"]
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
*.txt text
*.yml text

# Use Rust syntax highlighter for Move and Move IR code
*.move linguist-language=Rust
*.mvir linguist-language=Rust
# Use Move syntax highlighter for Move IR code
*.mvir linguist-language=Move
30 changes: 30 additions & 0 deletions .github/workflows/ci-post-land.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# CI jobs to be run upon the code lands to the main branch or GitHub Action test branches.

name: ci-post-land

on:
push:
branches: [main, gha-test-*]

jobs:
generate-documentation:
name: Generate the Move Book using mdBook
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v2

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.10'
# mdbook-version: 'latest'

- run: mdbook build language/documentation/book

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./language/documentation/book/book
44 changes: 34 additions & 10 deletions .github/workflows/ci-test.yml → .github/workflows/ci-pre-land.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: ci-test
# CI jobs to be run upon the code lands to the main branch or GitHub Action test branches.

name: ci-pre-land

on:
push:
branches: [main, gha-test-*]
pull_request:
branches: [main]
branches: [main, gha-test-*]

jobs:
prepare:
Expand All @@ -21,7 +21,7 @@ jobs:
name: determine changes
uses: diem/actions/changes@faadd16607b77dfa2231a8f366883e01717b3225
with:
workflow-file: ci-test.yml
workflow-file: ci.yml
github-token: ${{secrets.GITHUB_TOKEN}}
- id: any-changes-found
name: determine if there are any files listed in the CHANGES_CHANGED_FILE_OUTPUTFILE.
Expand Down Expand Up @@ -205,9 +205,13 @@ jobs:
# path: |
# /tmp/benches

build-move-analyzer-vscode-extension:
name: Build VS Code extension for move-analyzer
runs-on: ubuntu-latest
test-move-analyzer-vscode-extension:
name: Test VS Code extension for move-analyzer
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2022]
runs-on: ${{ matrix.os }}
needs:
- prepare
steps:
Expand All @@ -217,7 +221,7 @@ jobs:
- name: Use Node.js 14
uses: actions/setup-node@v2.4.0
with:
node-version: '14'
node-version: "14"
- name: Install NPM dependencies
working-directory: language/move-analyzer/editors/code
run: npm install
Expand All @@ -234,6 +238,26 @@ jobs:
with:
working-directory: language/move-analyzer/editors/code
run: npm run test

release-move-analyzer-vscode-extension:
name: Release VS Code extension for move-analyzer
runs-on: ubuntu-20.04
needs:
- prepare
steps:
- uses: actions/checkout@v2.4.0
- name: install rust toolchain
uses: actions-rs/toolchain@v1
- name: Use Node.js 14
uses: actions/setup-node@v2.4.0
with:
node-version: "14"
- name: Install NPM dependencies
working-directory: language/move-analyzer/editors/code
run: npm install
- name: Build the extension
working-directory: language/move-analyzer/editors/code
run: npm run pretest
- name: Package the extension
working-directory: language/move-analyzer/editors/code
run: npm run package
Expand Down Expand Up @@ -273,4 +297,4 @@ jobs:
- name: Build BasicCoin Move module
run: |
cd ./language/documentation/tutorial/step_1/BasicCoin
docker run -v `pwd`:/project move/cli package build
docker run -v `pwd`:/project move/cli build
17 changes: 7 additions & 10 deletions .github/workflows/release_asset.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# When the release is published, this workflow is automatically triggered,
# the move-related binaries are automatically packaged, and uploaded to
# the release's Assets

name: Release asset bot

on:
Expand Down Expand Up @@ -28,17 +32,10 @@ jobs:
command: build
args: --release

- name: build move release asset
run: bash ./scripts/release.sh ${{ matrix.platform }}

- name: upload artifact asset
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'release'}}
with:
name: move-${{ matrix.platform }}.zip
path: ./move-${{ matrix.platform }}.zip
- name: package move asset
run: bash ./scripts/package_asset.sh ${{ matrix.platform }}

- name: upload move release asset
- name: upload move asset
if: ${{ github.event_name == 'release'}}
id: upload-release-asset
uses: actions/upload-release-asset@v1
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ docker build -t move/cli -f docker/move-cli/Dockerfile .

```
cd ./language/documentation/tutorial/step_1/BasicCoin
docker run -v `pwd`:/project move/cli package build
docker run -v `pwd`:/project move/cli build
```

## Community
Expand Down
16 changes: 5 additions & 11 deletions language/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: move-language
title: Move Language
custom_edit_url: https://github.com/diem/move/edit/main/language/README.md
custom_edit_url: https://github.com/move-language/move/edit/main/language/README.md
---


Expand All @@ -11,20 +11,14 @@ Move is a new programming language developed to provide a safe and programmable

The Move language directory consists of four main parts:

- [virtual machine](vm/) (VM) — contains the bytecode format, a bytecode interpreter, and infrastructure for executing a block of transactions. This directory also contains the infrastructure to generate the genesis block.
- [virtual machine](move-vm/) (VM) — contains the bytecode format, a bytecode interpreter, and infrastructure for executing a block of transactions. This directory also contains the infrastructure to generate the genesis block.

- [bytecode verifier](bytecode-verifier/) — contains a static analysis tool for rejecting invalid Move bytecode. The virtual machine runs the bytecode verifier on any new Move code it encounters before executing it. The compiler runs the bytecode verifier on its output and surfaces the errors to the programmer.
- [bytecode verifier](move-bytecode-verifier/) — contains a static analysis tool for rejecting invalid Move bytecode. The virtual machine runs the bytecode verifier on any new Move code it encounters before executing it. The compiler runs the bytecode verifier on its output and surfaces the errors to the programmer.

- [move-compiler](move-compiler/) — contains the Move source language compiler.

- [standard library](stdlib/) — contains the Move code for the core system modules (such as `DiemAccount`), as well as the standard library transaction scripts.

## How the Move Language Fits Into Diem Core

Diem Core components interact with the language component through the VM. Specifically, the [admission control](../admission_control/) component uses a limited, read-only [subset](../vm_validator/) of the VM functionality to discard invalid transactions before they are admitted to the mempool and consensus. The [execution](../execution/) component uses the VM to execute a block of transactions.
- [standard library](move-stdlib/) — contains the standard library transaction scripts.

## Exploring the Move language

- You can find many small Move examples in the [tests](move-compiler/tests/functional/) directory. The easiest way to experiment with Move is to create a new test in this directory and run it with `cargo test`.
- More substantial examples can be found in the [standard library](stdlib/modules) directory. The Two particularly notable ones are [DiemAccount](stdlib/modules/diem_account.move), which implements accounts on the Diem blockchain, and [Diem](stdlib/modules/diem.move), which implements generic currency logic used by all of the currencies the Diem payment network supports.
- The transaction scripts supported in the Diem blockchain are also in the standard library directory. Move tests and local instances of the Diem blockchain can execute arbitrary transaction scripts, but the Diem blockchain and testnet are limited to accepting the scripts in this directory.
- You can find many small Move examples in the [tests](move-compiler/tests/move_check/) directory. The easiest way to experiment with Move is to create a new test in this directory and run it with `cargo test`.
4 changes: 2 additions & 2 deletions language/changes/3-abilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ struct NoAbilities {}
struct MyResource has key { f: u64 }
fun valid(account: &signer) acquires MyResource {
let addr = Signer::address_of(account);
let addr = signer::address_of(account);
let has_resource = exists<MyResource>(addr); // Valid, 'MyResource' has 'key'
if (!has_resource) {
move_to(account, MyResource { f: 0 }) // Valid, 'MyResource' has 'key'
Expand Down Expand Up @@ -314,7 +314,7 @@ struct NoAbilities {}
struct MyResource<T> has key { f: T }
fun valid(account: &signer) acquires MyResource {
let addr = Signer::address_of(account);
let addr = signer::address_of(account);
// Valid, 'MyResource<u64>' has 'key'
let has_resource = exists<MyResource<u64>>(addr);
if (!has_resource) {
Expand Down
2 changes: 1 addition & 1 deletion language/changes/4-unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ In the development of unit tests, there were a couple of alternatives considered

### Expected Value Tests

Move already supports [expected value tests](https://github.com/diem/move/tree/main/language/tools/move-cli#testing-with-the-move-cli) in the Move CLI, however these cover a different aspect of testing for Move. In particular, there is no concept of test-only code and test-only dependencies, which makes testing non-public functions much more difficult. Additionally, each expected value test entry must be a transaction or script function. Because of this, the expected value tests rely on a specific Move adapter implementation, whereas the unit tests do not rely on an adapter implementation and rely solely on the Move compiler and VM.
Move already supports [expected value tests](https://github.com/move-language/move/tree/main/language/tools/move-cli#testing-with-the-move-cli) in the Move CLI, however these cover a different aspect of testing for Move. In particular, there is no concept of test-only code and test-only dependencies, which makes testing non-public functions much more difficult. Additionally, each expected value test entry must be a transaction or script function. Because of this, the expected value tests rely on a specific Move adapter implementation, whereas the unit tests do not rely on an adapter implementation and rely solely on the Move compiler and VM.

Due to the design of unit tests, unit tests make it easier to test the individual units of code that comprise a Move module. However, because the unit tests do not require or use an adapter, they do not support certain features that you may wish to test. E.g., there is no way in Move unit tests to query if a specific event has been emitted.

Expand Down
6 changes: 3 additions & 3 deletions language/changes/5-named-addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ level elements (outside of modules and scripts) in Move Packages, or passed as
arguments to the Move compiler.

With the landing of this feature, Move standard library modules now reside under the address `Std`,
e.g. `Std::Vector`. Similarly, Diem Framework modules now reside under the address `DiemFramework`,
e.g. `std::vector`. Similarly, Diem Framework modules now reside under the address `DiemFramework`,
e.g. `DiemFramework::XUS`.

Named address declarations are opaque, meaning they must be accessed via the name and not their
Expand Down Expand Up @@ -52,7 +52,7 @@ operator any valid address can be used. For example:
let _: u8 = 0x1u8;
let _: u64 = 0x42u64;
let _: u128 = 0x42u128;
let a1: address = @Std;
let a1: address = @std;
let a2: address = @66;
let a3: address = @0x42;
```
Expand Down Expand Up @@ -167,7 +167,7 @@ See the 'Future Work' section below for details about how this might work in the
Since, all standard library modules and all Diem Framework modules live in `Std` and `DiemFramework`
respectively, source code must be updated to use those named addresses. The named addresses are
opaque, so the numeric values can no longer be used to access the modules. For example, any use of
`0x1::Vector` must now be `Std::Vector`.
`0x1::Vector` must now be `std::vector`.

Note, as this is just a syntactic change, the compiled module binaries will not be affected.

Expand Down
6 changes: 3 additions & 3 deletions language/changes/7-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ NamedAddr = "0xC0FFEE"
## Usage, Artifacts, and Data Structures

The Move package system comes with a command line option as part of the Move
CLI `move package <package_flags> <command> <command_flags>`. Unless a
CLI `move <flags> <command> <command_flags>`. Unless a
particular path is provided, all package commands will run in the current working
directory. The full list of commands and flags for the Move Package CLI can be found by
running `move package --help`.
directory. The full list of commands and flags for the Move CLI can be found by
running `move --help`.

### Usage

Expand Down
2 changes: 1 addition & 1 deletion language/documentation/book/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: move-book
title: Move Book
custom_edit_url: https://github.com/diem/move/edit/main/language/documentation/book
custom_edit_url: https://github.com/move-language/move/edit/main/language/documentation/book/README.md
---

In order to update the Move book and preview changes to it you'll need to
Expand Down
12 changes: 12 additions & 0 deletions language/documentation/book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[book]
title = "The Move Book"
description = "Move book maintained by the Move core team."
authors = ["The Move Contributors"]
language = "en"
multilingual = false
src = "src"

[output.html]
git-repository-url = "https://github.com/move-language/move"
git-repository-icon = "fa-github"
edit-url-template = "https://github.com/move-language/move/edit/main/language/documentation/book/{path}"
2 changes: 1 addition & 1 deletion language/documentation/book/src/creating-coins.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Move Tutorial

Please refer to the [Move Tutorial](https://github.com/diem/move/tree/main/language/documentation/tutorial).
Please refer to the [Move Tutorial](https://github.com/move-language/move/tree/main/language/documentation/tutorial).
2 changes: 1 addition & 1 deletion language/documentation/book/src/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ The usual restrictions apply and `T` can only be instantiated with arguments hav

## Constraints

In the examples above, we have demonstrated how one can use type parameters to define "unkonwn" types that can be plugged in by callers at a later time. This however means the type system has little information about the type and has to perform checks in a very conservative way. In some sense, the type system must assume the worst case scenario for an unconstrained generic. Simply put, by default generic type parameters have no [abilities](./abilities.md).
In the examples above, we have demonstrated how one can use type parameters to define "unknown" types that can be plugged in by callers at a later time. This however means the type system has little information about the type and has to perform checks in a very conservative way. In some sense, the type system must assume the worst case scenario for an unconstrained generic. Simply put, by default generic type parameters have no [abilities](./abilities.md).

This is where constraints come into play: they offer a way to specify what properties these unknown types have so the type system can allow operations that would otherwise be unsafe.

Expand Down
2 changes: 1 addition & 1 deletion language/documentation/book/src/loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The `break` expression cannot be used outside of a loop.

### `continue`

The `continue` expression skips the rest of the loop and continuess to the next iteration. This loop uses `continue` to compute the sum of `1, 2, ..., n`, except when the number is divisible by 10:
The `continue` expression skips the rest of the loop and continues to the next iteration. This loop uses `continue` to compute the sum of `1, 2, ..., n`, except when the number is divisible by 10:

```move
fun sum_intermediate(n: u64): u64 {
Expand Down
2 changes: 1 addition & 1 deletion language/documentation/book/src/modules-and-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ arguments, and must not return a value. Here is an example with each of these co

```move
script {
// Import the Debug module published at the named account address Std.
// Import the Debug module published at the named account address std.
use std::debug;
const ONE: u64 = 1;
Expand Down
6 changes: 3 additions & 3 deletions language/documentation/book/src/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ named_addr = "0xC0FFEE"
## Usage, Artifacts, and Data Structures

The Move package system comes with a command line option as part of the Move
CLI `move package <package_flags> <command> <command_flags>`. Unless a
CLI `move <flags> <command> <command_flags>`. Unless a
particular path is provided, all package commands will run in the current working
directory. The full list of commands and flags for the Move Package CLI can be found by
running `move package --help`.
directory. The full list of commands and flags for the Move CLI can be found by
running `move --help`.

### Usage

Expand Down
2 changes: 1 addition & 1 deletion language/documentation/book/src/structs-and-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ By default, structs are linear and ephemeral. By this we mean that they: cannot
dropped, and cannot be stored in global storage. This means that all values have to have ownership
transferred (linear) and the values must be dealt with by the end of the program's execution
(ephemeral). We can relax this behavior by giving the struct [abilities](./abilities.md) which allow
values to be copied or dropped and also to be stored in global storage or to define gobal storage
values to be copied or dropped and also to be stored in global storage or to define global storage
schemas.

## Defining Structs
Expand Down
Loading

0 comments on commit 8dc7558

Please sign in to comment.