Skip to content

Commit

Permalink
Fix framework build tools (#4215)
Browse files Browse the repository at this point in the history
* fix StateView errors in state-api

* fix some errors in starcoin framework
  • Loading branch information
simonjiao authored Sep 28, 2024
1 parent 2d891f7 commit 0f53add
Show file tree
Hide file tree
Showing 415 changed files with 28,576 additions and 28,573 deletions.
25 changes: 14 additions & 11 deletions state/api/src/chain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ use forkable_jellyfish_merkle::{blob::Blob, proof::SparseMerkleProof, RawKey};
use serde::{Deserialize, Serialize};
use starcoin_crypto::HashValue;
use starcoin_state_tree::AccountStateSetIterator;
use starcoin_types::language_storage::StructTag;
use starcoin_types::state_set::AccountStateSet;
use starcoin_types::write_set::WriteSet;
use starcoin_types::{
access_path::AccessPath, account_address::AccountAddress, account_config::AccountResource,
account_state::AccountState, state_set::ChainStateSet,
account_state::AccountState, language_storage::StructTag, state_set::AccountStateSet,
state_set::ChainStateSet, write_set::WriteSet,
};
use starcoin_vm_types::{
account_config::TABLE_HANDLE_ADDRESS_LIST,
genesis_config::ChainId,
move_resource::MoveResource,
on_chain_config::OnChainConfig,
on_chain_resource::{Epoch, EpochInfo, GlobalTimeOnChain},
state_store::{
table::{TableHandle, TableInfo},
StateView,
},
token::token_code::TokenCode,
};
use starcoin_vm_types::account_config::TABLE_HANDLE_ADDRESS_LIST;
use starcoin_vm_types::genesis_config::ChainId;
use starcoin_vm_types::on_chain_resource::{Epoch, EpochInfo, GlobalTimeOnChain};
use starcoin_vm_types::state_store::table::{TableHandle, TableInfo};
use starcoin_vm_types::state_store::StateView;
use starcoin_vm_types::token::token_code::TokenCode;
use starcoin_vm_types::{move_resource::MoveResource, on_chain_config::OnChainConfig};
use std::convert::TryFrom;

#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize)]
Expand Down
10 changes: 5 additions & 5 deletions vm/framework/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This guide describes the process for adding, removing, and changing the Move mod

## Overview

Every state change in the Aptos blockchain occurs via executing a Move *entry function* or a *script* embedded in a [SignedTransaction](../../types/src/transaction/mod.rs). Entry functions and scripts invoke procedures of Move *modules* that update published *resources*. The Move standard library consists of [modules](modules/) initially published in the genesis transaction.
Every state change in the Starcoin blockchain occurs via executing a Move *entry function* or a *script* embedded in a [SignedTransaction](../../types/src/transaction/mod.rs). Entry functions and scripts invoke procedures of Move *modules* that update published *resources*. The Move standard library consists of [modules](modules/) initially published in the genesis transaction.

## Environment Setup

Start by following the general Aptos setup advice [here](../../CONTRIBUTING.md). Nothing else is strictly required, but you may want to consider a Move syntax highlighter for your editor (asking it to interpret `.move` files as Rust source is a decent start).
Start by following the general Starcoin setup advice [here](../../CONTRIBUTING.md). Nothing else is strictly required, but you may want to consider a Move syntax highlighter for your editor (asking it to interpret `.move` files as Rust source is a decent start).

<!-- TODO: editor-specific suggestions, bash aliases -->

Expand All @@ -35,12 +35,12 @@ Most tests for the standard library live [here](../e2e-move-tests) and can be ru
## Coding conventions

### Naming
- **Module names**: are camel case e.g., `AptosAccount`, `Aptos`
- **Module names**: are camel case e.g., `StarcoinAccount`, `Starcoin`
- **Type names**: are camel case e.g., `WithdrawalCapability`, `KeyRotationCapability`
- **Function names**: are lower snake case e.g., `register_currency`
- **Constant names**: are upper snake case e.g., `TREASURY_COMPLIANCE_ADDRESS`
- Generic types should be descriptive, or anti-descriptive where appropriate (e.g. `T` for the Vector generic type parameter, `AptosAccount` for the core `AptosAccount` resource, `deposit<CoinType>(t: CoinType)` for depositing a token in the `Aptos` module). Most of the time the "main" type in a module should be the same name as the module e.g., `Aptos::Aptos`, `AptosAccount::AptosAccount`.
- **Module file names**: are the same as the module name e.g., `AptosAccount.move`
- Generic types should be descriptive, or anti-descriptive where appropriate (e.g. `T` for the Vector generic type parameter, `StarcoinAccount` for the core `StarcoinAccount` resource, `deposit<CoinType>(t: CoinType)` for depositing a token in the `Starcoin` module). Most of the time the "main" type in a module should be the same name as the module e.g., `Starcoin::Starcoin`, `StarcoinAccount::StarcoinAccount`.
- **Module file names**: are the same as the module name e.g., `StarcoinAccount.move`
- **Script file names**: should be lower snake case and named after the name of the “main” function in the script.
- **Mixed file names**: If the file contains multiple modules and/or scripts, the file name should be lower_snake_case, where the name does not match any particular module/script inside.

Expand Down
8 changes: 4 additions & 4 deletions vm/framework/FRAMEWORK-PROVER-GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
This guide gives some hints to troubleshoot issues when using the prover for specifying the Aptos frameworks.
This guide gives some hints to troubleshoot issues when using the prover for specifying the Starcoin frameworks.

## Installation

Please refer to the [doc](https://aptos.dev/tools/aptos-cli/install-cli/install-move-prover/).
Please refer to the [doc](https://starcoin.dev/tools/starcoin-cli/install-cli/install-move-prover/).

## Timeout

Expand Down Expand Up @@ -32,10 +32,10 @@ After making these changes, please submit a Github issue for the prover team to
## Suppressing prover tests

Prover tests are land-blockers for PRs which change the Move code and/or specifications in the `framework` directory. To disable them locally for efficiency,
you could use the command `cargo test --release -p aptos-framework -- --skip prover`.
you could use the command `cargo test --release -p starcoin-framework -- --skip prover`.


## Specification guide

Please refer to the [Move Prover Book](https://aptos.dev/guides/prover-guides/move-prover)
Please refer to the [Move Prover Book](https://starcoin.dev/guides/prover-guides/move-prover)
for detailed introduction on how to write specifications and use Move Prover.
48 changes: 24 additions & 24 deletions vm/framework/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: Aptos-framework
title: Aptos Framework
custom_edit_url: https://github.com/aptos-labs/aptos-core/edit/main/Aptos-move/Aptos-framework/README.md
id: Starcoin-framework
title: Starcoin Framework
custom_edit_url: https://github.com/starcoin-labs/starcoin-core/edit/main/Starcoin-move/Starcoin-framework/README.md
---

## The Aptos Framework
## The Starcoin Framework

The Aptos Framework defines the standard actions that can be performed on-chain
both by the Aptos VM---through the various prologue/epilogue functions---and by
The Starcoin Framework defines the standard actions that can be performed on-chain
both by the Starcoin VM---through the various prologue/epilogue functions---and by
users of the blockchain---through the allowed set of transactions. This
directory contains different directories that hold the source Move
modules and transaction scripts, along with a framework for generation of
Expand All @@ -16,47 +16,47 @@ files. See the [Layout](#layout) section for a more detailed overview of the str

## Documentation

Each of the main components of the Aptos Framework and contributing guidelines are documented separately. See them by version below:
Each of the main components of the Starcoin Framework and contributing guidelines are documented separately. See them by version below:

* *Aptos tokens* - [main](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-token/doc/overview.md), [testnet](https://github.com/aptos-labs/aptos-core/blob/testnet/aptos-move/framework/aptos-token/doc/overview.md), [devnet](https://github.com/aptos-labs/aptos-core/blob/devnet/aptos-move/framework/aptos-token/doc/overview.md)
* *Aptos framework* - [main](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/doc/overview.md), [testnet](https://github.com/aptos-labs/aptos-core/blob/testnet/aptos-move/framework/aptos-framework/doc/overview.md), [devnet](https://github.com/aptos-labs/aptos-core/blob/devnet/aptos-move/framework/aptos-framework/doc/overview.md)
* *Aptos stdlib* - [main](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-stdlib/doc/overview.md), [testnet](https://github.com/aptos-labs/aptos-core/blob/testnet/aptos-move/framework/aptos-stdlib/doc/overview.md), [devnet](https://github.com/aptos-labs/aptos-core/blob/devnet/aptos-move/framework/aptos-stdlib/doc/overview.md)
* *Move stdlib* - [main](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/move-stdlib/doc/overview.md), [testnet](https://github.com/aptos-labs/aptos-core/blob/testnet/aptos-move/framework/move-stdlib/doc/overview.md), [devnet](https://github.com/aptos-labs/aptos-core/blob/devnet/aptos-move/framework/move-stdlib/doc/overview.md)
* *Starcoin tokens* - [main](https://github.com/starcoin-labs/starcoin-core/blob/main/starcoin-move/framework/starcoin-token/doc/overview.md), [testnet](https://github.com/starcoin-labs/starcoin-core/blob/testnet/starcoin-move/framework/starcoin-token/doc/overview.md), [devnet](https://github.com/starcoin-labs/starcoin-core/blob/devnet/starcoin-move/framework/starcoin-token/doc/overview.md)
* *Starcoin framework* - [main](https://github.com/starcoin-labs/starcoin-core/blob/main/starcoin-move/framework/starcoin-framework/doc/overview.md), [testnet](https://github.com/starcoin-labs/starcoin-core/blob/testnet/starcoin-move/framework/starcoin-framework/doc/overview.md), [devnet](https://github.com/starcoin-labs/starcoin-core/blob/devnet/starcoin-move/framework/starcoin-framework/doc/overview.md)
* *Starcoin stdlib* - [main](https://github.com/starcoin-labs/starcoin-core/blob/main/starcoin-move/framework/starcoin-stdlib/doc/overview.md), [testnet](https://github.com/starcoin-labs/starcoin-core/blob/testnet/starcoin-move/framework/starcoin-stdlib/doc/overview.md), [devnet](https://github.com/starcoin-labs/starcoin-core/blob/devnet/starcoin-move/framework/starcoin-stdlib/doc/overview.md)
* *Move stdlib* - [main](https://github.com/starcoin-labs/starcoin-core/blob/main/starcoin-move/framework/move-stdlib/doc/overview.md), [testnet](https://github.com/starcoin-labs/starcoin-core/blob/testnet/starcoin-move/framework/move-stdlib/doc/overview.md), [devnet](https://github.com/starcoin-labs/starcoin-core/blob/devnet/starcoin-move/framework/move-stdlib/doc/overview.md)

Follow our [contributing guidelines](CONTRIBUTING.md) and basic coding standards for the Aptos Framework.
Follow our [contributing guidelines](CONTRIBUTING.md) and basic coding standards for the Starcoin Framework.

## Compilation and Generation

The documents above were created by the Move documentation generator for Aptos. It is available as part of the Aptos CLI. To see its options, run:
The documents above were created by the Move documentation generator for Starcoin. It is available as part of the Starcoin CLI. To see its options, run:
```shell
aptos move document --help
starcoin move document --help
```

The documentation process is also integrated into the framework building process and will be automatically triggered like other derived artifacts, via `cached-packages` or explicit release building.

## Running Move tests

To test our Move code while developing the Aptos Framework, run `cargo test` inside this directory:
To test our Move code while developing the Starcoin Framework, run `cargo test` inside this directory:

```
cargo test
```

(Alternatively, run `cargo test -p aptos-framework` from anywhere.)
(Alternatively, run `cargo test -p starcoin-framework` from anywhere.)

To skip the Move prover tests, run:

```
cargo test -- --skip prover
```

To filter and run only the tests in specific packages (e.g., `aptos_stdlib`), run:
To filter and run only the tests in specific packages (e.g., `starcoin_stdlib`), run:

```
cargo test -- aptos_stdlib --skip prover
cargo test -- starcoin_stdlib --skip prover
```

(See tests in `tests/move_unit_test.rs` to determine which filter to use; e.g., to run the tests in `aptos_framework` you must filter by `move_framework`.)
(See tests in `tests/move_unit_test.rs` to determine which filter to use; e.g., to run the tests in `starcoin_framework` you must filter by `move_framework`.)

Sometimes, Rust runs out of stack memory in dev build mode. You can address this by either:
1. Adjusting the stack size
Expand All @@ -72,15 +72,15 @@ cargo test --release -- --skip prover
```

## Layout
The overall structure of the Aptos Framework is as follows:
The overall structure of the Starcoin Framework is as follows:

```
├── aptos-framework # Sources, testing and generated documentation for Aptos framework component
├── aptos-token # Sources, testing and generated documentation for Aptos token component
├── aptos-stdlib # Sources, testing and generated documentation for Aptos stdlib component
├── starcoin-framework # Sources, testing and generated documentation for Starcoin framework component
├── starcoin-token # Sources, testing and generated documentation for Starcoin token component
├── starcoin-stdlib # Sources, testing and generated documentation for Starcoin stdlib component
├── move-stdlib # Sources, testing and generated documentation for Move stdlib component
├── cached-packages # Tooling to generate SDK from mvoe sources.
├── src # Compilation and generation of information from Move source files in the Aptos Framework. Not designed to be used as a Rust library
├── src # Compilation and generation of information from Move source files in the Starcoin Framework. Not designed to be used as a Rust library
├── releases # Move release bundles
└── tests
```
2 changes: 1 addition & 1 deletion vm/framework/cached-packages/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © Aptos Foundation
// Copyright © Starcoin Foundation
// SPDX-License-Identifier: Apache-2.0

use once_cell::sync::Lazy;
Expand Down
Loading

0 comments on commit 0f53add

Please sign in to comment.