mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 16:53:21 +08:00
merge: develop -> next (#2828)
* fix: clarify difference between stx-transfer? and (n)ft-transfer? * build: add Clarity workspace member (#2744) * build: add libvm workspace member * chore: skip lib-clarity-vm in circleci * refactor: address pavi's comment * refactor: naming * fix: update lib name * refactor: rename, drop the lib suffix * refactor: address Greg's comments * style: rustfmt Co-authored-by: Aaron Blankstein <aaron@blockstack.com> * build: buster -> bullseye in rust testing dockerfiles * added blank line to restart github tests * fixed the rstest/clarity interaction * removed extra line Co-authored-by: Friedger Müffke <mail@friedger.de> Co-authored-by: Aaron Blankstein <aaron@blockstack.com> Co-authored-by: Reed Rosenbluth <331327+reedrosenbluth@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
WORKDIR /src/
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
||||
44
Cargo.lock
generated
44
Cargo.lock
generated
@@ -359,6 +359,44 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clarity"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"assert-json-diff",
|
||||
"chrono",
|
||||
"curve25519-dalek",
|
||||
"ed25519-dalek",
|
||||
"integer-sqrt",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"mio",
|
||||
"percent-encoding",
|
||||
"prometheus",
|
||||
"rand 0.7.2",
|
||||
"rand_chacha 0.2.2",
|
||||
"regex",
|
||||
"ripemd160",
|
||||
"rstest",
|
||||
"rstest_reuse",
|
||||
"rusqlite",
|
||||
"secp256k1",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
"sha2 0.8.2",
|
||||
"sha2-asm",
|
||||
"sha3",
|
||||
"slog",
|
||||
"slog-json",
|
||||
"slog-term",
|
||||
"stx-genesis",
|
||||
"time 0.2.23",
|
||||
"tini",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clear_on_drop"
|
||||
version = "0.2.4"
|
||||
@@ -2524,6 +2562,12 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tini"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11eeaa68267376df2aacbaaed9b0092544ebbc897cd59f61e81a1105fbaf102e"
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "0.3.3"
|
||||
|
||||
@@ -112,7 +112,8 @@ sha2-asm = "0.5.3"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
".",
|
||||
"clarity",
|
||||
"stx-genesis",
|
||||
"testnet/stacks-node",
|
||||
"testnet/puppet-chain"]
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- run:
|
||||
no_output_timeout: 200m
|
||||
command: |
|
||||
cargo test -j 1 --workspace
|
||||
cargo test -j 1 --workspace --exclude clarity
|
||||
all_tests:
|
||||
docker:
|
||||
- image: rust:1.40-stretch
|
||||
|
||||
88
clarity/Cargo.toml
Normal file
88
clarity/Cargo.toml
Normal file
@@ -0,0 +1,88 @@
|
||||
[package]
|
||||
name = "clarity"
|
||||
version = "0.0.1"
|
||||
authors = [ "Jude Nelson <jude@stacks.org>",
|
||||
"Aaron Blankstein <aaron@blockstack.com>",
|
||||
"Ludo Galabru <ludovic@blockstack.com>" ]
|
||||
license = "GPLv3"
|
||||
homepage = "https://github.com/blockstack/stacks-blockchain"
|
||||
repository = "https://github.com/blockstack/stacks-blockchain"
|
||||
description = "Reference implementation of the Stacks 2.0 Blockchain"
|
||||
keywords = [ "stacks", "stx", "bitcoin", "crypto", "blockstack", "decentralized", "dapps", "blockchain" ]
|
||||
readme = "README.md"
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
||||
[lib]
|
||||
name = "clarity"
|
||||
path = "../src/libclarity.rs"
|
||||
|
||||
[dependencies]
|
||||
tini = "0.2"
|
||||
rand = "=0.7.2"
|
||||
rand_chacha = "=0.2.2"
|
||||
serde = "1"
|
||||
serde_derive = "1"
|
||||
serde_stacker = "0.1"
|
||||
sha3 = "0.8.2"
|
||||
ripemd160 = "0.8.0"
|
||||
regex = "1"
|
||||
mio = "0.6"
|
||||
lazy_static = "1.4.0"
|
||||
url = "2.1.0"
|
||||
percent-encoding = "2.1.0"
|
||||
sha2 = "0.8.0"
|
||||
prometheus = { version = "0.9", optional = true }
|
||||
integer-sqrt = "0.1.3"
|
||||
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
|
||||
slog-term = "2.6.0"
|
||||
slog-json = { version = "2.3.0", optional = true }
|
||||
chrono = "0.4.19"
|
||||
libc = "0.2.82"
|
||||
|
||||
[dependencies.serde_json]
|
||||
version = "1.0"
|
||||
features = ["arbitrary_precision", "unbounded_depth"]
|
||||
|
||||
[dependencies.secp256k1]
|
||||
version = "0.19.0"
|
||||
features = ["serde", "recovery"]
|
||||
|
||||
[dependencies.rusqlite]
|
||||
version = "=0.24.2"
|
||||
features = ["blob", "serde_json", "i128_blob", "bundled", "trace"]
|
||||
|
||||
[dependencies.ed25519-dalek]
|
||||
version = "=1.0.0-pre.3"
|
||||
features = ["serde"]
|
||||
|
||||
[dependencies.curve25519-dalek]
|
||||
version = "=2.0.0"
|
||||
features = ["serde"]
|
||||
|
||||
[dependencies.time]
|
||||
version = "0.2.23"
|
||||
features = ["std"]
|
||||
|
||||
[dev-dependencies]
|
||||
rstest = "0.11.0"
|
||||
rstest_reuse = "0.1.3"
|
||||
assert-json-diff = "1.0.0"
|
||||
# a nightly rustc regression (35dbef235 2021-03-02) prevents criterion from compiling
|
||||
# but it isn't necessary for tests: only benchmarks. therefore, commenting out for now.
|
||||
# criterion = "0.3"
|
||||
stx_genesis = { package = "stx-genesis", path = "../stx-genesis/."}
|
||||
|
||||
[features]
|
||||
default = ["developer-mode"]
|
||||
developer-mode = []
|
||||
monitoring_prom = ["prometheus"]
|
||||
slog_json = ["slog-json"]
|
||||
|
||||
|
||||
[profile.dev.package.regex]
|
||||
opt-level = 2
|
||||
|
||||
[target.'cfg(all(target_arch = "x86_64", not(target_env = "msvc")))'.dependencies]
|
||||
sha2-asm = "0.5.3"
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:buster
|
||||
FROM rust:bullseye
|
||||
|
||||
### Install Node.js
|
||||
RUN apt-get update
|
||||
|
||||
133
src/libclarity.rs
Normal file
133
src/libclarity.rs
Normal file
@@ -0,0 +1,133 @@
|
||||
// Copyright (C) 2013-2020 Blockstack PBC, a public benefit corporation
|
||||
// Copyright (C) 2020 Stacks Open Internet Foundation
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![cfg_attr(test, allow(unused_variables, unused_assignments))]
|
||||
|
||||
extern crate curve25519_dalek;
|
||||
extern crate ed25519_dalek;
|
||||
extern crate rand;
|
||||
extern crate rand_chacha;
|
||||
extern crate rusqlite;
|
||||
extern crate secp256k1;
|
||||
extern crate serde;
|
||||
extern crate tini;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate integer_sqrt;
|
||||
extern crate mio;
|
||||
extern crate percent_encoding;
|
||||
extern crate regex;
|
||||
extern crate ripemd160;
|
||||
extern crate sha2;
|
||||
extern crate sha3;
|
||||
extern crate time;
|
||||
extern crate url;
|
||||
|
||||
#[macro_use(o, slog_log, slog_trace, slog_debug, slog_info, slog_warn, slog_error)]
|
||||
extern crate slog;
|
||||
extern crate chrono;
|
||||
#[cfg(feature = "slog_json")]
|
||||
extern crate slog_json;
|
||||
extern crate slog_term;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate assert_json_diff;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate rstest;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate rstest_reuse;
|
||||
|
||||
#[cfg(feature = "monitoring_prom")]
|
||||
#[macro_use]
|
||||
pub extern crate prometheus;
|
||||
|
||||
#[macro_use]
|
||||
pub mod codec;
|
||||
|
||||
#[macro_use]
|
||||
pub mod util;
|
||||
|
||||
#[macro_use]
|
||||
pub mod net;
|
||||
|
||||
#[macro_use]
|
||||
/// The Clarity virtual machine
|
||||
pub mod vm;
|
||||
|
||||
#[macro_use]
|
||||
pub mod chainstate;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate stx_genesis;
|
||||
|
||||
pub mod address;
|
||||
pub mod burnchains;
|
||||
|
||||
/// A high level library for interacting with the Clarity vm
|
||||
pub mod clarity_vm;
|
||||
pub mod core;
|
||||
pub mod deps;
|
||||
|
||||
pub mod clarity;
|
||||
|
||||
pub mod monitoring;
|
||||
pub mod types;
|
||||
|
||||
// set via _compile-time_ envars
|
||||
const GIT_BRANCH: Option<&'static str> = option_env!("GIT_BRANCH");
|
||||
const GIT_COMMIT: Option<&'static str> = option_env!("GIT_COMMIT");
|
||||
const GIT_TREE_CLEAN: Option<&'static str> = option_env!("GIT_TREE_CLEAN");
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
const BUILD_TYPE: &'static str = "debug";
|
||||
#[cfg(not(debug_assertions))]
|
||||
const BUILD_TYPE: &'static str = "release";
|
||||
|
||||
pub fn version_string(pkg_name: &str, pkg_version: &str) -> String {
|
||||
let git_branch = GIT_BRANCH.unwrap_or("");
|
||||
let git_commit = GIT_COMMIT.unwrap_or("");
|
||||
let git_tree_clean = GIT_TREE_CLEAN.unwrap_or("");
|
||||
|
||||
format!(
|
||||
"{} {} ({}:{}{}, {} build, {} [{}])",
|
||||
pkg_name,
|
||||
pkg_version,
|
||||
&git_branch,
|
||||
git_commit,
|
||||
git_tree_clean,
|
||||
BUILD_TYPE,
|
||||
std::env::consts::OS,
|
||||
std::env::consts::ARCH
|
||||
)
|
||||
}
|
||||
@@ -1677,7 +1677,8 @@ const TOKEN_TRANSFER: SpecialAPI = SpecialAPI {
|
||||
output_type: "(response bool uint)",
|
||||
signature: "(ft-transfer? token-name amount sender recipient)",
|
||||
description: "`ft-transfer?` is used to increase the token balance for the `recipient` principal for a token
|
||||
type defined using `define-fungible-token` by debiting the `sender` principal.
|
||||
type defined using `define-fungible-token` by debiting the `sender` principal. In contrast to `stx-transfer?`,
|
||||
any user can transfer the assets. When used, relevant guards need to be added.
|
||||
|
||||
This function returns (ok true) if the transfer is successful. In the event of an unsuccessful transfer it returns
|
||||
one of the following error codes:
|
||||
@@ -1700,7 +1701,8 @@ const ASSET_TRANSFER: SpecialAPI = SpecialAPI {
|
||||
signature: "(nft-transfer? asset-class asset-identifier sender recipient)",
|
||||
description: "`nft-transfer?` is used to change the owner of an asset identified by `asset-identifier`
|
||||
from `sender` to `recipient`. The `asset-class` must have been defined by `define-non-fungible-token` and `asset-identifier`
|
||||
must be of the type specified in that definition.
|
||||
must be of the type specified in that definition. In contrast to `stx-transfer?`, any user can transfer the asset.
|
||||
When used, relevant guards need to be added.
|
||||
|
||||
This function returns (ok true) if the transfer is successful. In the event of an unsuccessful transfer it returns
|
||||
one of the following error codes:
|
||||
|
||||
Reference in New Issue
Block a user