Skip to content

Commit

Permalink
Merge branch 'starcoinorg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhutoulala authored Mar 13, 2022
2 parents e52df59 + 1e65cf9 commit c1ea903
Show file tree
Hide file tree
Showing 516 changed files with 1,876 additions and 30,708 deletions.
1,191 changes: 390 additions & 801 deletions Cargo.lock

Large diffs are not rendered by default.

47 changes: 4 additions & 43 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ members = [
"benchmarks",
"commons/stest",
"commons/bcs_ext",
"commons/crypto",
"commons/decrypt",
"commons/logger",
"commons/scmd",
"commons/metrics",
"commons/utils",
"commons/proptest-helpers",
"commons/service-registry",
"commons/timeout-join-handler",
"commons/serde-helpers",
Expand Down Expand Up @@ -43,7 +41,6 @@ members = [
"chain/mock",
"chain/chain-notify",
"chain/service",
"devtools/x",
"node/api",
"node",
"sync",
Expand All @@ -63,12 +60,12 @@ members = [
"account/api",
"account",
"account/service",
"account/provider",
"rpc/api",
"rpc/middleware",
"rpc/client",
"rpc/server",
"vm/types",

"vm/vm-runtime",
"vm/natives",
"vm/stdlib",
Expand All @@ -83,7 +80,6 @@ members = [
"vm/move-package-manager",
"vm/vm-status-translator",
"vm/starcoin-transactional-test-harness",
"vm/transactional-tests",
"abi/types",
"abi/decoder",
"abi/resolver",
Expand All @@ -103,20 +99,19 @@ members = [
"stratum",
"cmd/miner_client/api",
"cmd/db-exporter",
"cmd/genesis-nft-miner"
"cmd/genesis-nft-miner",
"devtools/x"
]

default-members = [
"benchmarks",
"commons/stest",
"commons/bcs_ext",
"commons/crypto",
"commons/decrypt",
"commons/logger",
"commons/scmd",
"commons/metrics",
"commons/utils",
"commons/proptest-helpers",
"commons/service-registry",
"commons/timeout-join-handler",
"commons/serde-helpers",
Expand Down Expand Up @@ -173,7 +168,6 @@ default-members = [
"rpc/client",
"rpc/server",
"vm/types",
"vm/transactional-tests",
"vm/vm-runtime",
"vm/natives",
"vm/stdlib",
Expand Down Expand Up @@ -236,37 +230,4 @@ starcoin-genesis.debug = 1
starcoin-vm-runtime.debug = 1

[profile.release.package."*"]
debug = false

#[patch."https://github.com/starcoinorg/diem"]
#move-bytecode-source-map = {git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-bytecode-verifier = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#diem-crypto = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#diem-crypto-derive = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#diem-proptest-helpers = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#diem-temppath = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#diem-workspace-hack = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-disassembler = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-docgen = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-errmapgen = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-binary-format = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-command-line-common = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-transactional-test-runner= { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-core-types={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-coverage={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-ir-types={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-compiler={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-model={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-prover={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-prover-test-utils={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-stdlib={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-unit-test={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-vm-runtime={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-vm-types={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#short-hex-str={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#x = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#x-core={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#x-lint={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-resource-viewer={ git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-cli = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
#move-package = { git = "https://github.com/lerencao/libra", branch="debug/temp" }
debug = false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[![Build and Test](https://github.com/starcoinorg/starcoin/workflows/Build%20and%20Test/badge.svg)](https://github.com/starcoinorg/starcoin/actions?query=workflow%3A%22Build+and+Test%22+branch%3Amaster)
[![License](https://img.shields.io/badge/license-Apache-green.svg)](LICENSE)
[![codecov](https://codecov.io/gh/starcoinorg/starcoin/branch/master/graph/badge.svg)](https://codecov.io/gh/starcoinorg/starcoin)
[![LoC](https://tokei.rs/b1/github/starcoinorg/starcoin?category=lines)](https://github.com/starcoinorg/starcoin)


## Build from source
Expand Down
5 changes: 2 additions & 3 deletions abi/decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ serde_json = "1.0"
serde = { version = "1.0.130", features = ["derive", "rc"] }
serde_bytes = "0.11"
anyhow = "1.0.41"
once_cell = "1.8.0"
hex = "0.4.3"
move-binary-format = {git = "https://github.com/starcoinorg/diem", rev="59f3187dabfcd4fdf5f1a3d0248ca67a27aba498" }
move-binary-format = {git = "https://github.com/starcoinorg/move", rev = "314436e8ab94f4cff2699d8cd0f62b96c1d2a6df" }
starcoin-resource-viewer = {path = "../../vm/resource-viewer"}
starcoin-vm-types = { path = "../../vm/types" }
starcoin-abi-types = {path = "../types"}
starcoin-abi-resolver = {path = "../resolver"}
bcs-ext = {path = "../../commons/bcs_ext"}
bcs = "0.1"
schemars = {git = "https://github.com/starcoinorg/schemars", rev="08416753ea9fdb9ba27d255b37e036425b7c55a3"}
schemars = {git = "https://github.com/starcoinorg/schemars", rev="6972da92f4360e1779168bb3fe0274c521d324e2"}
2 changes: 1 addition & 1 deletion abi/resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ starcoin-vm-types = {path = "../../vm/types"}
starcoin-abi-types = {path = "../types"}
anyhow="~1"
starcoin-resource-viewer = {path = "../../vm/resource-viewer"}
move-model = { git = "https://github.com/starcoinorg/diem", rev="59f3187dabfcd4fdf5f1a3d0248ca67a27aba498" }
move-model = { git = "https://github.com/starcoinorg/move", rev = "314436e8ab94f4cff2699d8cd0f62b96c1d2a6df" }
[dev-dependencies]
stdlib = {path = "../../vm/stdlib"}
serde_json = "1"
Expand Down
2 changes: 1 addition & 1 deletion abi/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ serde="~1"
serde_bytes = "0.11"
serde_json = "~1"
hex = "0.4"
schemars = {git = "https://github.com/starcoinorg/schemars", rev="08416753ea9fdb9ba27d255b37e036425b7c55a3"}
schemars = {git = "https://github.com/starcoinorg/schemars", rev="6972da92f4360e1779168bb3fe0274c521d324e2"}
4 changes: 2 additions & 2 deletions account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
anyhow = "1.0.41"
futures = "0.3.12"
async-trait = "0.1"
rand = "0.8.4"
rand = "0.8.5"
parking_lot = "0.12"
serde = "1.0.130"
serde_json = "~1"
Expand All @@ -19,7 +19,7 @@ starcoin-account-api = {path = "./api"}
bcs-ext ={package= "bcs-ext", path = "../commons/bcs_ext" }
starcoin-types = { path = "../types"}
starcoin-config = { path = "../config"}
starcoin-crypto = { path = "../commons/crypto"}
starcoin-crypto = { git = "https://github.com/starcoinorg/starcoin-crypto", rev = "d871dfb4216f034ee334a575926c101574d9d6dc"}
starcoin-decrypt = {path = "../commons/decrypt"}
starcoin-storage = {path = "../storage"}
starcoin-logger = {path = "../commons/logger"}
Expand Down
6 changes: 3 additions & 3 deletions account/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ serde_json = "~1"
bcs-ext ={package= "bcs-ext", path = "../../commons/bcs_ext" }
hex= "0.4.3"
starcoin-types = { path = "../../types"}
starcoin-crypto = { path = "../../commons/crypto"}
rand = "0.8.4"
starcoin-crypto = { git = "https://github.com/starcoinorg/starcoin-crypto", rev = "d871dfb4216f034ee334a575926c101574d9d6dc"}
rand = "0.8.5"
rand_core = { version = "0.6.3", default-features = false }
futures = "0.3.12"
starcoin-service-registry = { path = "../../commons/service-registry" }
schemars = {git = "https://github.com/starcoinorg/schemars", rev="08416753ea9fdb9ba27d255b37e036425b7c55a3"}
schemars = {git = "https://github.com/starcoinorg/schemars", rev="6972da92f4360e1779168bb3fe0274c521d324e2"}

[dev-dependencies]

Expand Down
4 changes: 2 additions & 2 deletions account/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

pub mod error;
pub mod message;
mod provider;
mod rich_wallet;
mod service;
mod types;

pub use provider::*;
pub use rich_wallet::*;
pub use service::*;
pub use types::*;

pub type AccountResult<T> = std::result::Result<T, error::AccountError>;
77 changes: 77 additions & 0 deletions account/api/src/provider.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
use crate::AccountInfo;
use anyhow::Result;
use starcoin_types::account_address::AccountAddress;
use starcoin_types::account_config::token_code::TokenCode;
use starcoin_types::sign_message::{SignedMessage, SigningMessage};
use starcoin_types::transaction::{RawUserTransaction, SignedUserTransaction};

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AccountProviderStrategy {
RPC,
Local,
}

impl Default for AccountProviderStrategy {
fn default() -> Self {
AccountProviderStrategy::RPC
}
}
pub trait AccountProvider {
fn create_account(&self, password: String) -> Result<AccountInfo>;

fn get_default_account(&self) -> Result<Option<AccountInfo>>;
fn set_default_account(&self, address: AccountAddress) -> Result<AccountInfo>;
fn get_accounts(&self) -> Result<Vec<AccountInfo>>;

fn get_account(&self, address: AccountAddress) -> Result<Option<AccountInfo>>;

/// Signs the hash of data with given address.
fn sign_message(
&self,
address: AccountAddress,
message: SigningMessage,
) -> Result<SignedMessage>;

fn sign_txn(
&self,
raw_txn: RawUserTransaction,
signer_address: AccountAddress,
) -> Result<SignedUserTransaction>;
fn unlock_account(
&self,
address: AccountAddress,
password: String,
duration: std::time::Duration,
) -> Result<AccountInfo>;
fn lock_account(&self, address: AccountAddress) -> Result<AccountInfo>;
fn import_account(
&self,
address: AccountAddress,
private_key: Vec<u8>,
password: String,
) -> Result<AccountInfo>;

fn import_readonly_account(
&self,
address: AccountAddress,
public_key: Vec<u8>,
) -> Result<AccountInfo>;

/// Return the private key as bytes for `address`
fn export_account(&self, address: AccountAddress, password: String) -> Result<Vec<u8>>;

fn accepted_tokens(&self, address: AccountAddress) -> Result<Vec<TokenCode>>;

/// change account password, user need to unlock account first.
fn change_account_password(
&self,
address: AccountAddress,
new_password: String,
) -> Result<AccountInfo>;

fn remove_account(
&self,
address: AccountAddress,
password: Option<String>,
) -> Result<AccountInfo>;
}
14 changes: 14 additions & 0 deletions account/provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "starcoin-account-provider"
version = "1.10.0-rc.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.41"
starcoin-account = { path = "../" }
starcoin-account-api = { path = "../api", features = ["mock"] }
starcoin-types = { path = "../../types" }
starcoin-rpc-client = { path = "../../rpc/client" }
starcoin-config = { path = "../../config" }
4 changes: 4 additions & 0 deletions account/provider/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mod local_provider;
mod provider;
mod rpc_provider;
pub use provider::ProviderFactory;
Loading

0 comments on commit c1ea903

Please sign in to comment.