validator: Move DeployParamsV1 to darkfi-sdk

This commit is contained in:
parazyd
2024-01-09 13:27:48 +01:00
parent 2ad9183239
commit fecab39d77
7 changed files with 13 additions and 24 deletions

View File

@@ -21,11 +21,10 @@ use darkfi::{
zkas::ZkBinary,
Result,
};
use darkfi_sdk::crypto::Keypair;
use darkfi_sdk::{crypto::Keypair, deploy::DeployParamsV1};
use log::{debug, info};
use super::create_derive_contractid_proof;
use crate::model::DeployParamsV1;
pub struct DeployCallDebris {
pub params: DeployParamsV1,

View File

@@ -19,6 +19,7 @@
use darkfi_sdk::{
crypto::{ContractId, PublicKey},
db::{db_get, db_lookup, db_set},
deploy::DeployParamsV1,
error::{ContractError, ContractResult},
msg,
pasta::pallas,
@@ -31,9 +32,8 @@ use wasmparser::{
};
use crate::{
error::DeployError,
model::{DeployParamsV1, DeployUpdateV1},
DeployFunction, DEPLOY_CONTRACT_LOCK_TREE, DEPLOY_CONTRACT_ZKAS_DERIVE_NS_V1,
error::DeployError, model::DeployUpdateV1, DeployFunction, DEPLOY_CONTRACT_LOCK_TREE,
DEPLOY_CONTRACT_ZKAS_DERIVE_NS_V1,
};
/// `get_metadata` function for `Deploy::DeployV1`

View File

@@ -22,17 +22,6 @@ use darkfi_serial::async_trait;
use darkfi_sdk::crypto::{ContractId, PublicKey};
use darkfi_serial::{SerialDecodable, SerialEncodable};
/// Parameters for `Deploy::Deploy`
#[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
pub struct DeployParamsV1 {
/// Webassembly bincode of the smart contract
pub wasm_bincode: Vec<u8>,
/// Public key used to sign the transaction and derive the `ContractId`
pub public_key: PublicKey,
/// Serialized deployment payload instruction
pub ix: Vec<u8>,
}
/// State update for `Deploy::Deploy`
#[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
pub struct DeployUpdateV1 {

View File

@@ -16,12 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use darkfi_sdk::crypto::PublicKey;
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
#[cfg(feature = "async")]
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use crate::crypto::PublicKey;
/// Parameters for `Deploy::Deploy`
///
/// This is copied from `src/contract/deployooor.rs`
#[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
pub struct DeployParamsV1 {
/// Webassembly bincode of the smart contract

View File

@@ -27,6 +27,9 @@ pub mod blockchain;
/// Database functions
pub mod db;
/// Contract deployment utilities
pub mod deploy;
/// Entrypoint used for the wasm binaries
pub mod entrypoint;

View File

@@ -63,9 +63,6 @@ pub mod validation;
pub mod utils;
use utils::deploy_native_contracts;
/// Contract deployment utilities
pub mod deploy;
/// Base 10 big float implementation for high precision arithmetics
pub mod float_10;

View File

@@ -25,6 +25,7 @@ use darkfi_sdk::{
DEPLOYOOOR_CONTRACT_ID, MONEY_CONTRACT_ID,
},
dark_tree::dark_forest_leaf_vec_integrity_check,
deploy::DeployParamsV1,
pasta::pallas,
};
use darkfi_serial::{deserialize_async, AsyncDecodable, AsyncEncodable, AsyncWriteExt, WriteExt};
@@ -39,7 +40,6 @@ use crate::{
util::time::TimeKeeper,
validator::{
consensus::{Consensus, Fork, Proposal, TXS_CAP},
deploy::DeployParamsV1,
pow::PoWModule,
validation::validate_block,
},