fix smart contract test so it compiles

This commit is contained in:
x
2022-10-25 10:45:28 +00:00
parent 2d7942bfee
commit e46ce80bd3
4 changed files with 83 additions and 37 deletions

View File

@@ -295,25 +295,6 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bincode"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bb50c5a2ef4b9b1e7ae73e3a73b52ea24b20312d629f9c4df28260b7ad2c3c4"
dependencies = [
"bincode_derive",
"serde",
]
[[package]]
name = "bincode_derive"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a45a23389446d2dd25dc8e73a7a3b3c43522b630cac068927f0649d43d719d2"
dependencies = [
"virtue",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -818,25 +799,21 @@ dependencies = [
name = "darkfi"
version = "0.3.0"
dependencies = [
"async-channel",
"async-executor",
"async-std",
"async-trait",
"bincode",
"blake2b_simd",
"blake3",
"bs58",
"chrono",
"crypto_api_chachapoly",
"darkfi-derive",
"darkfi-sdk",
"dirs",
"darkfi-serial",
"dashu",
"ed25519-compact",
"fast-socks5",
"futures",
"futures-rustls",
"fxhash",
"group",
"halo2_gadgets",
"halo2_proofs",
"hex",
@@ -901,10 +878,28 @@ name = "darkfi-sdk"
version = "0.3.0"
dependencies = [
"bs58",
"darkfi-serial",
"halo2_gadgets",
"incrementalmerkletree",
"lazy_static",
"pasta_curves",
"subtle",
"thiserror",
]
[[package]]
name = "darkfi-serial"
version = "0.3.0"
dependencies = [
"blake3",
"darkfi-derive",
"futures-lite",
"fxhash",
"incrementalmerkletree",
"pasta_curves",
"url",
]
[[package]]
name = "darling"
version = "0.14.1"
@@ -939,6 +934,56 @@ dependencies = [
"syn",
]
[[package]]
name = "dashu"
version = "0.2.0"
source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
dependencies = [
"dashu-base",
"dashu-float",
"dashu-int",
"dashu-macros",
]
[[package]]
name = "dashu-base"
version = "0.2.0"
source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
[[package]]
name = "dashu-float"
version = "0.2.0"
source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
dependencies = [
"dashu-base",
"dashu-int",
"static_assertions",
]
[[package]]
name = "dashu-int"
version = "0.2.0"
source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
dependencies = [
"cfg-if",
"dashu-base",
"num-traits",
"rand",
"static_assertions",
]
[[package]]
name = "dashu-macros"
version = "0.2.0"
source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
dependencies = [
"dashu-base",
"dashu-float",
"dashu-int",
"proc-macro2",
"quote",
]
[[package]]
name = "digest"
version = "0.10.5"
@@ -2555,6 +2600,8 @@ version = "0.3.0"
dependencies = [
"darkfi",
"darkfi-sdk",
"darkfi-serial",
"getrandom",
"simplelog",
]
@@ -3075,12 +3122,6 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "virtue"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b60dcd6a64dd45abf9bd426970c9843726da7fc08f44cd6fcebf68c21220a63"
[[package]]
name = "waker-fn"
version = "1.1.0"

View File

@@ -17,8 +17,14 @@ overflow-checks = true
[dependencies]
darkfi-sdk = { path = "../../src/sdk" }
darkfi = { path = "../../", features = ["serial"] }
#darkfi = { path = "../../", features = [] }
darkfi-serial = { path = "../../src/serial" }
# We need to disable random using "custom" which makes the crate a noop
# so the wasm32-unknown-unknown target is enabled.
getrandom = { version = "0.2", features = ["custom"] }
[dev-dependencies]
darkfi = { path = "../../", features = ["wasm-runtime"] }
simplelog = "0.12.0"

View File

@@ -1,4 +1,4 @@
use darkfi::serial::{deserialize, SerialDecodable, SerialEncodable};
use darkfi_serial::{deserialize, SerialDecodable, SerialEncodable};
use darkfi_sdk::{
crypto::Nullifier,
entrypoint,
@@ -19,7 +19,7 @@ pub struct Args {
// Through here, you can branch out into different functions inside
// this library.
entrypoint!(process_instruction);
fn process_instruction(ix: &[u8]) -> ContractResult {
fn process_instruction(_state: &[u8], ix: &[u8]) -> ContractResult {
// Deserialize the payload into `Args`.
let args: Args = deserialize(ix)?;

View File

@@ -1,11 +1,10 @@
use darkfi_serial::serialize;
use darkfi::{
crypto::nullifier::Nullifier,
node::{MemoryState, State},
runtime::{util::serialize_payload, vm_runtime::Runtime},
serial::serialize,
Result,
};
use darkfi_sdk::pasta::pallas;
use darkfi_sdk::{pasta::pallas, crypto::nullifier::Nullifier};
use smart_contract::Args;