Skip to content

Commit

Permalink
[AptosFramework] merge core into aptos framework
Browse files Browse the repository at this point in the history
  • Loading branch information
zekun000 authored and aptos-bot committed Apr 13, 2022
1 parent 0abf736 commit a6068c0
Show file tree
Hide file tree
Showing 213 changed files with 102 additions and 7,999 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ address 0x2 {
// the account address of each list node is actually the address bound to the key(name)
module NameService {
use 0x2::SortedLinkedList::{Self, EntryHandle};
use CoreFramework::Block;
use AptosFramework::Block;
use Std::Signer;
use Std::Vector;

Expand Down
6 changes: 3 additions & 3 deletions aptos-move/framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ 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. Particularly:
* Documentation for the set of allowed transaction scripts in aptos-framework can be found in [script_documentation.md](aptos-framework/releases/artifacts/current/build/AptosCoreFramework/docs/script_documentation.md).
* The overview documentation for the Move modules can be found in [overview.md](aptos-framework/releases/artifacts/current/build/AptosCoreFramework/docs/overview.md).
* An overview of the approach to formal verification of the framework can be found in [spec_documentation.md](aptos-framework/releases/artifacts/current/build/AptosCoreFramework/docs/spec_documentation.md).
* Documentation for the set of allowed transaction scripts in aptos-framework can be found in [script_documentation.md](aptos-framework/releases/artifacts/current/build/AptosFramework/docs/script_documentation.md).
* The overview documentation for the Move modules can be found in [overview.md](aptos-framework/releases/artifacts/current/build/AptosFramework/docs/overview.md).
* An overview of the approach to formal verification of the framework can be found in [spec_documentation.md](aptos-framework/releases/artifacts/current/build/AptosFramework/docs/spec_documentation.md).
* Contributing guidelines and basic coding standards for the Aptos Framework can be found in [CONTRIBUTING.md](CONTRIBUTING.md).

## Compilation and Generation
Expand Down
3 changes: 0 additions & 3 deletions aptos-move/framework/aptos-framework/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ version = "1.0.0"

[addresses]
Std = "0x1"
CoreFramework = "0x1"
AptosFramework = "0x1"
CoreResources = "0xA550C18"
VMReserved = "0x0"

[dependencies]
MoveStdlib = { local = "../move-stdlib" }

CoreFramework = { local = "../core" }
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module CoreFramework::Account {
module AptosFramework::Account {
use Std::BCS;
use Std::Errors;
use Std::Signer;
use Std::Hash;
use Std::Vector;
use CoreFramework::ChainId;
use CoreFramework::Reconfiguration;
use CoreFramework::SystemAddresses;
use AptosFramework::ChainId;
use AptosFramework::Reconfiguration;
use AptosFramework::SystemAddresses;

/// Resource representing an account.
struct Account has key, store {
Expand Down Expand Up @@ -38,8 +38,8 @@ module CoreFramework::Account {
const EACCOUNT: u64 = 0;
/// Sequence number exceeded the maximum value for a u64
const ESEQUENCE_NUMBER_TOO_BIG: u64 = 1;
/// The address provided didn't match the `CoreFramework` address.
const ENOT_CORE_FRAMEWORK: u64 = 2;
/// The address provided didn't match the `AptosFramework` address.
const ENOT_APTOS_FRAMEWORK: u64 = 2;
/// The marker type provided is not the registered type for `Account`.
const ENOT_MARKER_TYPE: u64 = 3;
/// The provided authentication had an invalid length
Expand All @@ -65,7 +65,7 @@ module CoreFramework::Account {
writeset_epilogue_name: vector<u8>,
currency_code_required: bool,
) {
assert!(Signer::address_of(account) == @CoreResources, Errors::requires_address(ENOT_CORE_FRAMEWORK));
assert!(Signer::address_of(account) == @CoreResources, Errors::requires_address(ENOT_APTOS_FRAMEWORK));
move_to(account, Marker<T> {});
move_to(account, ChainSpecificAccountInfo {
module_addr,
Expand Down
16 changes: 8 additions & 8 deletions aptos-move/framework/aptos-framework/sources/AptosAccount.move
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
module AptosFramework::AptosAccount {
use Std::Errors;
use Std::Signer;
use CoreFramework::Account;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use CoreFramework::TransactionPublishingOption;
use AptosFramework::Account;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;
use AptosFramework::TransactionPublishingOption;
use AptosFramework::Marker;
use AptosFramework::AptosValidatorConfig;
use AptosFramework::AptosValidatorOperatorConfig;
Expand Down Expand Up @@ -43,16 +43,16 @@ module AptosFramework::AptosAccount {
Errors::invalid_argument(ECANNOT_CREATE_AT_VM_RESERVED)
);
assert!(
auth_key != @CoreFramework,
auth_key != @AptosFramework,
Errors::invalid_argument(ECANNOT_CREATE_AT_CORE_CODE)
);
Account::create_account(auth_key, &Marker::get())
}

/// Create the account for @CoreFramework to help module upgrades on testnet.
/// Create the account for @AptosFramework to help module upgrades on testnet.
public(friend) fun create_core_framework_account(): signer {
Timestamp::assert_genesis();
let (signer, _) = Account::create_account(@CoreFramework, &Marker::get());
let (signer, _) = Account::create_account(@AptosFramework, &Marker::get());
signer
}

Expand All @@ -63,7 +63,7 @@ module AptosFramework::AptosAccount {
SystemAddresses::assert_core_resource(core_resource);
Account::initialize<Marker::ChainMarker>(
core_resource,
@CoreFramework,
@AptosFramework,
b"AptosAccount",
b"script_prologue",
b"module_prologue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// This module defines a struct storing the metadata of the block and new block events.
module CoreFramework::Block {
module AptosFramework::Block {
use Std::Errors;
use Std::Event;
use CoreFramework::ValidatorSystem;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use AptosFramework::ValidatorSystem;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;

struct BlockMetadata has key {
/// Height of the current block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// The chain id distinguishes between different chains (e.g., testnet and the main network).
/// One important role is to prevent transactions intended for one chain from being executed on another.
/// This code provides a container for storing a chain id and functions to initialize and get it.
module CoreFramework::ChainId {
use CoreFramework::SystemAddresses;
use CoreFramework::Timestamp;
module AptosFramework::ChainId {
use AptosFramework::SystemAddresses;
use AptosFramework::Timestamp;
use Std::Errors;
use Std::Signer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module CoreFramework::CoreGenesis {
use CoreFramework::ChainId;
use CoreFramework::Block;
use CoreFramework::Reconfiguration;
use CoreFramework::Timestamp;
module AptosFramework::CoreGenesis {
use AptosFramework::ChainId;
use AptosFramework::Block;
use AptosFramework::Reconfiguration;
use AptosFramework::Timestamp;

/// This can only be called once successfully, since after the first call time will have started.
public fun init(core_resource_account: &signer, chain_id: u8) {
Expand Down
10 changes: 5 additions & 5 deletions aptos-move/framework/aptos-framework/sources/Genesis.move
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module AptosFramework::Genesis {
use Std::Signer;
use Std::Event;
use Std::Vector;
use CoreFramework::CoreGenesis;
use AptosFramework::CoreGenesis;
use AptosFramework::AptosAccount;

// Config imports
use CoreFramework::ValidatorConfig;
use CoreFramework::ValidatorOperatorConfig;
use AptosFramework::ValidatorConfig;
use AptosFramework::ValidatorOperatorConfig;
use AptosFramework::AptosConsensusConfig;
use AptosFramework::AptosTransactionPublishingOption;
use AptosFramework::AptosValidatorConfig;
Expand Down Expand Up @@ -200,10 +200,10 @@ module AptosFramework::Genesis {

#[test(account = @CoreResources)]
fun test_setup(account: signer) {
use CoreFramework::Account;
use AptosFramework::Account;

setup(&account);
assert!(Account::exists_at(@CoreFramework), 0);
assert!(Account::exists_at(@AptosFramework), 0);
assert!(Account::exists_at(@CoreResources), 0);
}
}
4 changes: 2 additions & 2 deletions aptos-move/framework/aptos-framework/sources/Marker.move
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module AptosFramework::Marker {
use Std::Capability;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;

friend AptosFramework::AptosAccount;
friend AptosFramework::AptosConsensusConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/// Publishes configuration information for validators, and issues reconfiguration events
/// to synchronize configuration changes for the validators.
module CoreFramework::Reconfiguration {
module AptosFramework::Reconfiguration {
use Std::Errors;
use Std::Event;
use Std::Signer;
use Std::GUID;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;

friend CoreFramework::Account;
friend CoreFramework::ConsensusConfig;
friend CoreFramework::ValidatorSystem;
friend CoreFramework::Version;
friend CoreFramework::VMConfig;
friend CoreFramework::ParallelExecutionConfig;
friend CoreFramework::TransactionPublishingOption;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;

friend AptosFramework::Account;
friend AptosFramework::ConsensusConfig;
friend AptosFramework::ValidatorSystem;
friend AptosFramework::Version;
friend AptosFramework::VMConfig;
friend AptosFramework::ParallelExecutionConfig;
friend AptosFramework::TransactionPublishingOption;

/// Event that signals consensus to start a new epoch,
/// with new configuration information. This is also called a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Contains functions for [ed25519](https://en.wikipedia.org/wiki/EdDSA) digital signatures.
module CoreFramework::Signature {
module AptosFramework::Signature {

/// Return `true` if the bytes in `public_key` can be parsed as a valid Ed25519 public key.
/// Returns `false` if `public_key` is not 32 bytes OR is 32 bytes, but does not pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CoreFramework::SystemAddresses {
module AptosFramework::SystemAddresses {
use Std::Errors;
use Std::Signer;

Expand Down
2 changes: 1 addition & 1 deletion aptos-move/framework/aptos-framework/sources/TestCoin.move
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module AptosFramework::TestCoin {
use Std::Event::{Self, EventHandle};
use Std::Option::{Self, Option};

use CoreFramework::SystemAddresses;
use AptosFramework::SystemAddresses;

friend AptosFramework::TransactionFee;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
/// genesis (`Self::assert_operating`). These are essentially distinct states of the system. Specifically,
/// if `Self::assert_operating` succeeds, assumptions about invariants over the global state can be made
/// which reflect that the system has been successfully initialized.
module CoreFramework::Timestamp {
use CoreFramework::SystemAddresses;
module AptosFramework::Timestamp {
use AptosFramework::SystemAddresses;
use Std::Signer;
use Std::Errors;

friend CoreFramework::CoreGenesis;
friend AptosFramework::CoreGenesis;

/// A singleton resource holding the current Unix time in microseconds
struct CurrentTimeMicroseconds has key {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AptosFramework::AptosConsensusConfig {
use Std::Capability;
use CoreFramework::ConsensusConfig;
use AptosFramework::ConsensusConfig;
use AptosFramework::Marker;

public fun initialize(account: &signer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module AptosFramework::AptosTransactionPublishingOption {
use Std::Capability;
use AptosFramework::Marker::{Self, ChainMarker};
use CoreFramework::TransactionPublishingOption;
use AptosFramework::TransactionPublishingOption;

public fun initialize(
core_resource_account: &signer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AptosFramework::AptosVMConfig {
use Std::Capability;
use CoreFramework::VMConfig;
use AptosFramework::VMConfig;
use AptosFramework::Marker;

/// Publishes the VM config.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module AptosFramework::AptosValidatorConfig {
use Std::Capability;
use CoreFramework::ValidatorConfig;
use CoreFramework::ValidatorOperatorConfig;
use CoreFramework::ValidatorSystem;
use AptosFramework::ValidatorConfig;
use AptosFramework::ValidatorOperatorConfig;
use AptosFramework::ValidatorSystem;
use AptosFramework::Marker;

friend AptosFramework::AptosAccount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AptosFramework::AptosValidatorOperatorConfig {
use Std::Capability;
use CoreFramework::ValidatorOperatorConfig;
use AptosFramework::ValidatorOperatorConfig;
use AptosFramework::Marker;

friend AptosFramework::AptosAccount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AptosFramework::AptosValidatorSet {
use Std::Capability;
use CoreFramework::ValidatorSystem;
use AptosFramework::ValidatorSystem;
use AptosFramework::Marker;

public fun initialize_validator_set(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AptosFramework::AptosVersion {
use Std::Capability;
use CoreFramework::Version;
use AptosFramework::Version;
use AptosFramework::Marker;

/// Publishes the Version config.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// Maintains the consensus config for the blockchain. The config is stored in a
/// Reconfiguration, and may be updated by root.
module CoreFramework::ConsensusConfig {
module AptosFramework::ConsensusConfig {
use Std::Capability::Cap;
use Std::Errors;
use Std::Vector;
use CoreFramework::Reconfiguration;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use AptosFramework::Reconfiguration;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;

/// Error with chain marker
const ECHAIN_MARKER: u64 = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// This module defines structs and methods to initialize VM configurations,
/// including different costs of running the VM.
module CoreFramework::ParallelExecutionConfig {
module AptosFramework::ParallelExecutionConfig {
use Std::Capability::Cap;
use Std::Errors;
use Std::Option::{Self, Option};
use CoreFramework::Reconfiguration;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use AptosFramework::Reconfiguration;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;

/// Error with chain marker
const ECHAIN_MARKER: u64 = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module AptosFramework::Stake {
use Std::Vector;
use Std::Signer;
use CoreFramework::SystemAddresses;
use CoreFramework::Timestamp;
// use CoreFramework::Reconfiguration;
use AptosFramework::SystemAddresses;
use AptosFramework::Timestamp;
// use AptosFramework::Reconfiguration;
use AptosFramework::TestCoin::{Self, Coin};

const MINIMUM_LOCK_PERIOD: u64 = 86400;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// This module defines a struct storing the publishing policies for the VM.
module CoreFramework::TransactionPublishingOption {
module AptosFramework::TransactionPublishingOption {
use Std::Capability::Cap;
use Std::Errors;
use Std::Vector;
use CoreFramework::Timestamp;
use CoreFramework::SystemAddresses;
use CoreFramework::Reconfiguration;
use AptosFramework::Timestamp;
use AptosFramework::SystemAddresses;
use AptosFramework::Reconfiguration;

struct ChainMarker<phantom T> has key {}

Expand Down
Loading

0 comments on commit a6068c0

Please sign in to comment.