Skip to content

Commit

Permalink
Merge edba7d7 into cc57e47
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg authored Feb 7, 2023
2 parents cc57e47 + edba7d7 commit 9edd8b7
Show file tree
Hide file tree
Showing 320 changed files with 8,159 additions and 1,928 deletions.
946 changes: 600 additions & 346 deletions Cargo.lock

Large diffs are not rendered by default.

105 changes: 63 additions & 42 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ members = [
"vm/transaction-builder-generator",
"vm/move-coverage",
"vm/resource-viewer",
"vm/starcoin-gas",
"vm/dev",
"vm/gas-algebra-ext",
"vm/move-explain",
"vm/move-package-manager",
"vm/vm-status-translator",
Expand Down Expand Up @@ -178,7 +180,9 @@ default-members = [
"vm/transaction-builder-generator",
"vm/move-coverage",
"vm/resource-viewer",
"vm/starcoin-gas",
"vm/dev",
"vm/gas-algebra-ext",
"vm/move-explain",
"vm/move-package-manager",
"vm/vm-status-translator",
Expand Down Expand Up @@ -215,7 +219,7 @@ debug-assertions = false
codegen-units = 1

[workspace.package]
authors = ["Starcoin Core Dev <dev@starcoin.org>", ]
authors = ["Starcoin Core Dev <dev@starcoin.org>"]
edition = "2021"
homepage = "https://starcoin.org"
license = "Apache-2.0"
Expand Down Expand Up @@ -246,18 +250,18 @@ bitflags = "1.3.2"
bs58 = "0.3.1"
byteorder = "1.3.4"
bytes = "1"
chrono = { version = "0.4.19", default-features = false, features = ["clock", ] }
clap = { version = "3", features = ["derive", ] }
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
clap = { version = "3", features = ["derive"] }
cli-table = "0.3.2"
coarsetime = "0.1.22"
codespan = { version = "0.8.0", features = ["serialization", ] }
codespan = { version = "0.8.0", features = ["serialization"] }
codespan-reporting = "0.11"
colored = "2.0.0"
criterion = "0.3"
crossbeam-channel = "0.5.6"
cryptonight-rs = { path = "consensus/cryptonight-rs" }
csv = "~1"
ctrlc = { version = "3.2.2", features = ["termination", ] }
ctrlc = { version = "3.2.2", features = ["termination"] }
cucumber = { package = "cucumber_rust", version = "^0.6.0" }
darling = "0.10.2"
dashmap = "~5"
Expand All @@ -280,12 +284,12 @@ futures-retry = "0.6"
futures-timer = "3.0"
futures-util = "~0.3"
git-version = "0.3.5"
governor = { version = "0.4.2", features = ["dashmap", ] }
governor = { version = "0.4.2", features = ["dashmap"] }
heck = "0.3.3"
hex = "0.4"
hmac = "0.12.1"
hyper = { version = "0.14.12", features = ["full", ] }
include_dir = { version = "0.6.2", features = ["search", ] }
hyper = { version = "0.14.12", features = ["full"] }
include_dir = { version = "0.6.2", features = ["search"] }
indicatif = "0.16.2"
ip_network = "0.3.4"
io-lifetimes = "0.7.2"
Expand All @@ -296,8 +300,10 @@ jsonrpc-client-transports = "18"
jsonrpc-core = "18"
jsonrpc-core-client = "18"
jsonrpc-derive = "18"
openrpc-derive = {git = "https://github.com/starcoinorg/openrpc-rs",rev = "42e9fdc00036a24c560c2827e84cf4e078edbd0d",features=["jsonrpc"]}
openrpc-schema = {git = "https://github.com/starcoinorg/openrpc-rs",rev = "42e9fdc00036a24c560c2827e84cf4e078edbd0d"}
openrpc-derive = { git = "https://github.com/starcoinorg/openrpc-rs", rev = "42e9fdc00036a24c560c2827e84cf4e078edbd0d", features = [
"jsonrpc",
] }
openrpc-schema = { git = "https://github.com/starcoinorg/openrpc-rs", rev = "42e9fdc00036a24c560c2827e84cf4e078edbd0d" }

jsonrpc-http-server = "18"
jsonrpc-ipc-server = "18"
Expand All @@ -314,33 +320,36 @@ libsecp256k1 = "0.7.1"
linked-hash-map = "0.5.6"
linked_hash_set = "0.1.3"
log = { version = "0.4.16" }
log4rs = { version = "1.0.0", features = ["background_rotation", "gzip", ] }
log4rs = { version = "1.0.0", features = ["background_rotation", "gzip"] }
lru = "0.7.8"
merkletree = { git = "https://github.com/filecoin-project/merkletree", rev = "3b1d98c43b341aed935152c5c1535c17d1b21d20" }
mirai-annotations = "1.10.1"
move-binary-format = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-bytecode-source-map = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-bytecode-verifier = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-cli = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-command-line-common = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-compiler = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-core-types = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-coverage = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-disassembler = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-docgen = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-errmapgen = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-ir-compiler = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-ir-types = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-model = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-package = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-prover = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-prover-test-utils = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-resource-viewer = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-stdlib = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-transactional-test-runner = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-unit-test = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-vm-runtime = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-vm-types = { git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03" }
move-binary-format = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-bytecode-source-map = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-bytecode-verifier = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-cli = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-command-line-common = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-compiler = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-core-types = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-coverage = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-disassembler = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-docgen = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-errmapgen = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-ir-compiler = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-ir-types = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-model = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-package = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-prover = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-prover-test-utils = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-resource-viewer = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-stdlib = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-transactional-test-runner = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-unit-test = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-vm-runtime = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-vm-types = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-table-extension = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }
move-vm-test-utils = { git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c" }

names = { version = "0.14.0", default-features = false }
network-api = { path = "network/api", package = "network-api" }
network-p2p = { path = "network-p2p" }
Expand Down Expand Up @@ -375,7 +384,7 @@ regex = "1.6.0"
ripemd160 = "0.9.1"
rlp = "0.4"
rlp-derive = "0.1"
rocksdb = { default-features = false, features = ["lz4", ], version = "0.18" }
rocksdb = { default-features = false, features = ["lz4"], version = "0.18" }
rpassword = "~5"
rust-argon2 = "0.8"
rust-embed = "6.3.0"
Expand Down Expand Up @@ -425,7 +434,7 @@ starcoin-crypto = { git = "https://github.com/starcoinorg/starcoin-crypto", rev
starcoin-decrypt = { path = "commons/decrypt" }
starcoin-dev = { path = "vm/dev" }
starcoin-executor = { path = "executor" }
starcoin-framework = { git = "https://github.com/starcoinorg/starcoin-framework", rev = "cf1deda180af40a8b3e26c0c7b548c4c290cd7e7" }
starcoin-framework = { git = "https://github.com/starcoinorg/starcoin-framework", rev = "a7eff4fa3e08cecfed09edf3dbf9d216832d7414" }
starcoin-genesis = { path = "genesis" }
starcoin-logger = { path = "commons/logger" }
starcoin-metrics = { path = "commons/metrics" }
Expand All @@ -434,6 +443,8 @@ starcoin-miner-client = { path = "cmd/miner_client" }
starcoin-miner-client-api = { path = "cmd/miner_client/api" }
starcoin-move-compiler = { path = "vm/compiler" }
starcoin-move-explain = { path = "vm/move-explain" }
starcoin-gas-algebra-ext = { path = "vm/gas-algebra-ext" }
starcoin-gas = { path = "vm/starcoin-gas" }
starcoin-natives = { path = "vm/natives" }
starcoin-network = { path = "network" }
starcoin-network-rpc = { path = "network-rpc" }
Expand Down Expand Up @@ -471,24 +482,34 @@ stdlib = { path = "vm/stdlib" }
stest = { path = "commons/stest" }
stest-macro = { path = "commons/stest/stest-macro" }
stream-task = { path = "commons/stream-task" }
syn = { version = "1.0", features = ["full", "extra-traits", "visit", "fold", ] }
syn = { version = "1.0.107", features = [
"full",
"extra-traits",
"visit",
"fold",
] }
sysinfo = "0.25.1"
tempfile = "3.2.0"
test-helper = { path = "test-helper" }
textwrap = "0.14.0"
thiserror = "1.0"
timeout-join-handler = { path = "commons/timeout-join-handler" }
tiny-keccak = { version = "2", features = ["keccak", ] }
tiny-keccak = { version = "2", features = ["keccak"] }
tiny_http = "0.8.2"
tokio = { version = "^1", features = ["full", ] }
tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking", ] }
tokio = { version = "^1", features = ["full"] }
tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] }
toml = "0.5.9"
trace-time = "0.1"
tracing = "0.1.34"
transaction-pool = "2.0.3"
uint = "0.9.3"
unsigned-varint = { version = "0.6.0", features = ["futures", "asynchronous_codec", ] }
vm = { package = "move-binary-format", git = "https://github.com/starcoinorg/move", rev = "2b85bf33378a4469e40b10e7bed815bdbefc5d03", features = ["fuzzing", ] }
unsigned-varint = { version = "0.6.0", features = [
"futures",
"asynchronous_codec",
] }
vm = { package = "move-binary-format", git = "https://github.com/starcoinorg/move", rev = "a781b641dd345c3e8f3e83ed080597f6c23a157c", features = [
"fuzzing",
] }
vm-status-translator = { path = "vm/vm-status-translator" }
void = "1.0.2"
walkdir = "2.3.1"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

Starcoin - a smart contract blockchain network that scales by layering

net proxima using move with table extension feature. If you want to use it, you should compile dev branch.

[Report a Bug](https://github.com/starcoinorg/starcoin/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+")
·
[Request a Feature](https://github.com/starcoinorg/starcoin/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+")
Expand Down
2 changes: 1 addition & 1 deletion abi/decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hex = { workspace = true }
move-binary-format = { workspace = true }
ordinal = { workspace = true }
schemars = { workspace = true }
serde = { features = [ "derive", "rc",], workspace = true }
serde = { features = ["derive", "rc"], workspace = true }
serde_bytes = { workspace = true }
serde_json = { workspace = true }
starcoin-abi-resolver = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions abi/decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ fn value_to_json(origin: AnnotatedMoveValue) -> serde_json::Value {
use serde_json::Value;
match origin {
AnnotatedMoveValue::U8(v) => Value::Number(v.into()),
AnnotatedMoveValue::U16(v) => Value::Number(v.into()),
AnnotatedMoveValue::U32(v) => Value::Number(v.into()),
AnnotatedMoveValue::U64(v) => Value::Number(v.into()),
AnnotatedMoveValue::U128(v) => Value::Number(v.into()),
// XXX FIXME YSG
AnnotatedMoveValue::U256(v) => Value::String(v.to_string()),
AnnotatedMoveValue::Bool(v) => Value::Bool(v),
AnnotatedMoveValue::Address(v) => Value::String(v.to_string()),
AnnotatedMoveValue::Vector(v) => Value::Array(v.into_iter().map(value_to_json).collect()),
Expand Down
40 changes: 27 additions & 13 deletions abi/resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use starcoin_resource_viewer::module_cache::ModuleCache;
use starcoin_resource_viewer::resolver::Resolver;
use starcoin_vm_types::access::ModuleAccess;
use starcoin_vm_types::file_format::{
CompiledModule, CompiledScript, FunctionDefinitionIndex, StructDefinitionIndex, Visibility,
CompiledModule, CompiledScript, FunctionDefinitionIndex, StructDefinitionIndex,
};
use starcoin_vm_types::identifier::{IdentStr, Identifier};
use starcoin_vm_types::language_storage::{ModuleId, StructTag, TypeTag};
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<'a> ABIResolver<'a> {
let functions = m
.exposed_functions
.iter()
.filter(|(_, func)| func.visibility == Visibility::Script) // only script functions
// .filter(|(_, func)| func.visibility == Visibility::Script) // only script functions
.map(|(name, func)| self.function_to_abi(&module_id, name.as_ident_str(), func))
.collect::<Result<Vec<_>>>()?;
Ok(ModuleABI::new(m.module_id(), structs, functions))
Expand Down Expand Up @@ -108,8 +108,11 @@ impl<'a> ABIResolver<'a> {
Ok(match type_tag {
TypeTag::Bool => TypeInstantiation::Bool,
TypeTag::U8 => TypeInstantiation::U8,
TypeTag::U16 => TypeInstantiation::U16,
TypeTag::U32 => TypeInstantiation::U32,
TypeTag::U64 => TypeInstantiation::U64,
TypeTag::U128 => TypeInstantiation::U128,
TypeTag::U256 => TypeInstantiation::U256,
TypeTag::Address => TypeInstantiation::Address,

TypeTag::Signer => TypeInstantiation::Signer,
Expand All @@ -134,8 +137,11 @@ impl<'a> ABIResolver<'a> {
Ok(match ty {
Type::Bool => TypeInstantiation::Bool,
Type::U8 => TypeInstantiation::U8,
Type::U16 => TypeInstantiation::U16,
Type::U32 => TypeInstantiation::U32,
Type::U64 => TypeInstantiation::U64,
Type::U128 => TypeInstantiation::U128,
Type::U256 => TypeInstantiation::U256,
Type::Address => TypeInstantiation::Address,
Type::Signer => TypeInstantiation::Signer,
Type::Struct {
Expand Down Expand Up @@ -351,14 +357,15 @@ fn find_struct_def_in_module(
mod tests {
use crate::ABIResolver;
use anyhow::Result;
use starcoin_vm_types::access_path::{AccessPath, DataPath};
use starcoin_vm_types::access_path::DataPath;
use starcoin_vm_types::account_address::AccountAddress;
use starcoin_vm_types::account_config::genesis_address;
use starcoin_vm_types::file_format::CompiledModule;
use starcoin_vm_types::identifier::Identifier;
use starcoin_vm_types::language_storage::ModuleId;
use starcoin_vm_types::normalized::Module;
use starcoin_vm_types::parser::parse_struct_tag;
use starcoin_vm_types::state_store::state_key::StateKey;
use starcoin_vm_types::state_view::StateView;
use std::collections::BTreeMap;

Expand All @@ -373,16 +380,23 @@ mod tests {
}
}
impl StateView for InMemoryStateView {
fn get(&self, access_path: &AccessPath) -> Result<Option<Vec<u8>>> {
let module_id = match &access_path.path {
DataPath::Code(name) => ModuleId::new(access_path.address, name.clone()),
_ => anyhow::bail!("no data"),
};
Ok(self.modules.get(&module_id).map(|m| {
let mut data = vec![];
m.serialize(&mut data).unwrap();
data
}))
fn get_state_value(&self, state_key: &StateKey) -> Result<Option<Vec<u8>>> {
match state_key {
StateKey::AccessPath(access_path) => {
let module_id = match &access_path.path {
DataPath::Code(name) => ModuleId::new(access_path.address, name.clone()),
_ => anyhow::bail!("no data"),
};
Ok(self.modules.get(&module_id).map(|m| {
let mut data = vec![];
m.serialize(&mut data).unwrap();
data
}))
}
StateKey::TableItem(_table_item) => {
anyhow::bail!("no need table_item")
}
}
}

fn is_genesis(&self) -> bool {
Expand Down
Loading

0 comments on commit 9edd8b7

Please sign in to comment.