Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions soroban-contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[workspace]
members = ["soroscan_core", "soroscan_macros"]
resolver = "2"

# Patch soroban-env-host to restrict ed25519-dalek to <3, which is required for
# compatibility with the rand_chacha/rand_core 0.6 usage in testutils.rs.
# soroban-env-host 21.2.1 uses `ed25519-dalek >= 2.0.0` (no upper bound), but
# ed25519-dalek 3.0.0 changed the CryptoRng trait in an incompatible way.
[patch.crates-io]
soroban-env-host = { path = "vendor/soroban-env-host" }
1 change: 1 addition & 0 deletions soroban-contracts/vendor/soroban-env-host/.cargo-ok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":1}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"git": {
"sha1": "e44506e251b5bf80c0dd0674a816af9e24a871a7"
},
"path_in_vcs": "soroban-env-host"
}
279 changes: 279 additions & 0 deletions soroban-contracts/vendor/soroban-env-host/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2021"
rust-version = "1.74"
name = "soroban-env-host"
version = "21.2.1"
authors = ["Stellar Development Foundation <info@stellar.org>"]
build = "build.rs"
exclude = ["observations/"]
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Soroban contract host environment."
homepage = "https://github.com/stellar/rs-soroban-env"
readme = "README.md"
license = "Apache-2.0"
repository = "https://github.com/stellar/rs-soroban-env"

[package.metadata.docs.rs]
features = [
"recording_mode",
"tracy",
"testutils",
]

[lib]
name = "soroban_env_host"
path = "src/lib.rs"

[[bin]]
name = "main"
path = "src/bin/main.rs"

[[test]]
name = "array"
path = "tests/array.rs"

[[test]]
name = "ed25519_edge_cases"
path = "tests/ed25519_edge_cases.rs"

[[test]]
name = "fees"
path = "tests/fees.rs"

[[test]]
name = "integration"
path = "tests/integration.rs"

[[test]]
name = "option"
path = "tests/option.rs"

[[test]]
name = "secp256r1_sig_ver"
path = "tests/secp256r1_sig_ver.rs"
required-features = ["testutils"]

[[bench]]
name = "variation_histograms"
path = "benches/variation_histograms.rs"
bench = true
harness = false
required-features = ["bench"]

[[bench]]
name = "worst_case_linear_models"
path = "benches/worst_case_linear_models.rs"
bench = true
harness = false
required-features = ["bench"]

[dependencies.backtrace]
version = "0.3.69"
optional = true

[dependencies.curve25519-dalek]
version = ">=4.1.1"
features = ["digest"]
default-features = false

[dependencies.ecdsa]
version = "0.16.7"
default-features = false

[dependencies.ed25519-dalek]
version = ">=2.0.0, <3"
features = ["rand_core"]

[dependencies.elliptic-curve]
version = "0.13.5"
default-features = false

[dependencies.generic-array]
version = "0.14.7"

[dependencies.getrandom]
version = "0.2.11"
features = ["js"]

[dependencies.hex-literal]
version = "0.4.1"

[dependencies.hmac]
version = "0.12.1"

[dependencies.k256]
version = "0.13.1"
features = [
"ecdsa",
"arithmetic",
]
default-features = false

[dependencies.num-derive]
version = "0.4.1"

[dependencies.num-integer]
version = "0.1.45"

[dependencies.num-traits]
version = "0.2.17"

[dependencies.p256]
version = "0.13.2"
features = [
"ecdsa",
"arithmetic",
]
default-features = false

[dependencies.rand]
version = "0.8.5"

[dependencies.rand_chacha]
version = "0.3.1"

[dependencies.sec1]
version = "0.7.2"

[dependencies.sha2]
version = "0.10.8"

[dependencies.sha3]
version = "0.10.8"

[dependencies.soroban-builtin-sdk-macros]
version = "=21.2.1"

[dependencies.soroban-env-common]
version = "=21.2.1"
features = [
"std",
"wasmi",
"shallow-val-hash",
]
default-features = false

[dependencies.static_assertions]
version = "1.1.0"

[dependencies.stellar-strkey]
version = "0.0.8"

[dependencies.wasmi]
version = "=0.31.1-soroban.20.0.1"
package = "soroban-wasmi"

[dependencies.wasmparser]
version = "=0.116.1"

[dev-dependencies.arbitrary]
version = "1.3.2"

[dev-dependencies.backtrace]
version = "0.3.69"

[dev-dependencies.bytes-lit]
version = "0.0.5"

[dev-dependencies.expect-test]
version = "1.4.1"

[dev-dependencies.hex]
version = "0.4.3"

[dev-dependencies.itertools]
version = "0.11.0"

[dev-dependencies.k256]
version = "0.13.1"
features = ["alloc"]
default-features = false

[dev-dependencies.lstsq]
version = "0.5.0"

[dev-dependencies.more-asserts]
version = "0.3.1"

[dev-dependencies.nalgebra]
version = "0.32.3"
features = ["std"]
default-features = false

[dev-dependencies.p256]
version = "0.13.2"
features = ["alloc"]
default-features = false

[dev-dependencies.pretty_assertions]
version = "1.4.0"

[dev-dependencies.rustversion]
version = "1.0"

[dev-dependencies.serde_json]
version = "1.0.108"

[dev-dependencies.soroban-env-macros]
version = "=21.2.1"

[dev-dependencies.stellar-xdr]
version = "=21.2.0"
features = ["arbitrary"]
default-features = false

[dev-dependencies.tabwriter]
version = "1.3.0"

[dev-dependencies.textplots]
version = "0.8.4"

[dev-dependencies.thousands]
version = "0.2.0"

[dev-dependencies.wasm-encoder]
version = "0.36.2"

[dev-dependencies.wasmprinter]
version = "0.2.72"

[dev-dependencies.wycheproof]
version = "0.5.1"

[features]
bench = []
next = ["soroban-env-common/next"]
recording_mode = []
testutils = [
"soroban-env-common/testutils",
"recording_mode",
"dep:backtrace",
]
tracy = [
"dep:tracy-client",
"soroban-env-common/tracy",
]
unstable-next-api = []

[target.'cfg(not(target_family = "wasm"))'.dependencies.tracy-client]
version = "0.16.4"
features = [
"enable",
"timer-fallback",
]
optional = true
default-features = false
9 changes: 9 additions & 0 deletions soroban-contracts/vendor/soroban-env-host/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# rs-soroban-env

Rust contract-environment interface and (optional) host implementation for Soroban.

The `soroban-env-common` crate contains elements of the shared environment-interface between smart contract guest and host: the `Env` trait that defines the set of available environment functions as well as the `Val` type that can pass back and forth through the WASM calling convention. Additionally small wrappers around subtypes of `Val` are included: `Object`, `Symbol`, `Error`, etc.

The `soroban-env-guest` crate contains the guest-side _stub implementation_ of the environment interface called `Guest` dependent on extern fns provided by the host implementation. This can be used in a WASM runtime that provides the extern fns.

The `soroban-env-host` crate contains the host-side _full implementation_ of the environment interface called `Host`. This can be used either in the real blockchain host, or for local testing in the SDK.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use crate::common::HostCostMeasurement;
use ed25519_dalek::SigningKey;
use rand::rngs::StdRng;
use soroban_env_host::{cost_runner::ComputeEd25519PubKeyRun, Host};

// This measures the costs to turn one byte buffer into an Ed25519
// pubkey, which should be constant time. The input value is ignored.
pub(crate) struct ComputeEd25519PubKeyMeasure {
key: Vec<u8>,
}

impl HostCostMeasurement for ComputeEd25519PubKeyMeasure {
type Runner = ComputeEd25519PubKeyRun;

fn new_random_case(_host: &Host, rng: &mut StdRng, _input: u64) -> Vec<u8> {
let key = SigningKey::generate(rng);
key.verifying_key().to_bytes().into()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use crate::common::HostCostMeasurement;
use rand::rngs::StdRng;
use soroban_env_host::{cost_runner::ComputeKeccak256HashRun, Host};

// This measures the costs of performing a keccak256 hash on a variable-sized
// byte buffer. The input value is the size of the buffer. It should be
// linear time.
pub(crate) struct ComputeKeccak256HashMeasure;

impl HostCostMeasurement for ComputeKeccak256HashMeasure {
type Runner = ComputeKeccak256HashRun;

fn new_random_case(_host: &Host, _rng: &mut StdRng, input: u64) -> Vec<u8> {
let size = Self::INPUT_BASE_SIZE + input * Self::STEP_SIZE;
(0..size).map(|n| n as u8).collect()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use crate::common::HostCostMeasurement;
use rand::rngs::StdRng;
use soroban_env_host::{cost_runner::ComputeSha256HashRun, Host};

// This measures the costs of performing a sha256 hash on a variable-sized
// byte buffer. The input value is the size of the buffer. It should be
// linear time.
pub(crate) struct ComputeSha256HashMeasure;

impl HostCostMeasurement for ComputeSha256HashMeasure {
type Runner = ComputeSha256HashRun;

fn new_random_case(_host: &Host, _rng: &mut StdRng, input: u64) -> Vec<u8> {
let size = Self::INPUT_BASE_SIZE + input * Self::STEP_SIZE;
(0..size).map(|n| n as u8).collect()
}
}
Loading