mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
remove redundant TransactionPayload struct
This commit is contained in:
parent
16e3a682fe
commit
e1e018fcfc
@ -66,60 +66,6 @@ impl Transaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
||||||
///General transaction object
|
|
||||||
pub struct TransactionPayload {
|
|
||||||
pub tx_kind: TxKind,
|
|
||||||
///Tx input data (public part)
|
|
||||||
pub execution_input: Vec<u8>,
|
|
||||||
///Tx output data (public_part)
|
|
||||||
pub execution_output: Vec<u8>,
|
|
||||||
///Tx input utxo commitments
|
|
||||||
pub utxo_commitments_spent_hashes: Vec<TreeHashType>,
|
|
||||||
///Tx output utxo commitments
|
|
||||||
pub utxo_commitments_created_hashes: Vec<TreeHashType>,
|
|
||||||
///Tx output nullifiers
|
|
||||||
pub nullifier_created_hashes: Vec<TreeHashType>,
|
|
||||||
///Execution proof (private part)
|
|
||||||
pub execution_proof_private: String,
|
|
||||||
///Encoded blobs of data
|
|
||||||
pub encoded_data: Vec<(CipherText, Vec<u8>, Tag)>,
|
|
||||||
///Transaction senders ephemeral pub key
|
|
||||||
pub ephemeral_pub_key: Vec<u8>,
|
|
||||||
///Public (Pedersen) commitment
|
|
||||||
pub commitment: Vec<PedersenCommitment>,
|
|
||||||
///tweak
|
|
||||||
pub tweak: Tweak,
|
|
||||||
///secret_r
|
|
||||||
pub secret_r: [u8; 32],
|
|
||||||
///Hex-encoded address of a smart contract account called
|
|
||||||
pub sc_addr: String,
|
|
||||||
///Recorded changes in state of smart contract
|
|
||||||
///
|
|
||||||
/// First value represents vector of changes, second is new length of a state
|
|
||||||
pub state_changes: (serde_json::Value, usize),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<TransactionPayload> for Transaction {
|
|
||||||
fn from(value: TransactionPayload) -> Self {
|
|
||||||
Self {
|
|
||||||
tx_kind: value.tx_kind,
|
|
||||||
execution_input: value.execution_input,
|
|
||||||
execution_output: value.execution_output,
|
|
||||||
utxo_commitments_spent_hashes: value.utxo_commitments_spent_hashes,
|
|
||||||
utxo_commitments_created_hashes: value.utxo_commitments_created_hashes,
|
|
||||||
nullifier_created_hashes: value.nullifier_created_hashes,
|
|
||||||
execution_proof_private: value.execution_proof_private,
|
|
||||||
encoded_data: value.encoded_data,
|
|
||||||
ephemeral_pub_key: value.ephemeral_pub_key,
|
|
||||||
commitment: value.commitment,
|
|
||||||
tweak: value.tweak,
|
|
||||||
secret_r: value.secret_r,
|
|
||||||
sc_addr: value.sc_addr,
|
|
||||||
state_changes: value.state_changes,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct MintMoneyPublicTx {
|
pub struct MintMoneyPublicTx {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use common::ExecutionFailureKind;
|
|||||||
use accounts::account_core::{Account, AccountAddress};
|
use accounts::account_core::{Account, AccountAddress};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use chain_storage::NodeChainStore;
|
use chain_storage::NodeChainStore;
|
||||||
use common::transaction::{Transaction, TransactionPayload, TxKind};
|
use common::transaction::{Transaction, TxKind};
|
||||||
use config::NodeConfig;
|
use config::NodeConfig;
|
||||||
use log::info;
|
use log::info;
|
||||||
use sc_core::proofs_circuits::{
|
use sc_core::proofs_circuits::{
|
||||||
@ -246,7 +246,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Private,
|
tx_kind: TxKind::Private,
|
||||||
execution_input: vec![],
|
execution_input: vec![],
|
||||||
execution_output: vec![],
|
execution_output: vec![],
|
||||||
@ -343,7 +343,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Private,
|
tx_kind: TxKind::Private,
|
||||||
execution_input: vec![],
|
execution_input: vec![],
|
||||||
execution_output: vec![],
|
execution_output: vec![],
|
||||||
@ -459,7 +459,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Private,
|
tx_kind: TxKind::Private,
|
||||||
execution_input: vec![],
|
execution_input: vec![],
|
||||||
execution_output: vec![],
|
execution_output: vec![],
|
||||||
@ -604,7 +604,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Private,
|
tx_kind: TxKind::Private,
|
||||||
execution_input: vec![],
|
execution_input: vec![],
|
||||||
execution_output: vec![],
|
execution_output: vec![],
|
||||||
@ -727,7 +727,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Shielded,
|
tx_kind: TxKind::Shielded,
|
||||||
execution_input: serde_json::to_vec(&ActionData::SendMoneyShieldedTx(
|
execution_input: serde_json::to_vec(&ActionData::SendMoneyShieldedTx(
|
||||||
SendMoneyShieldedTx {
|
SendMoneyShieldedTx {
|
||||||
@ -820,7 +820,7 @@ impl NodeCore {
|
|||||||
|
|
||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok(TransactionPayload {
|
Ok(Transaction {
|
||||||
tx_kind: TxKind::Deshielded,
|
tx_kind: TxKind::Deshielded,
|
||||||
execution_input: serde_json::to_vec(&ActionData::SendMoneyDeshieldedTx(
|
execution_input: serde_json::to_vec(&ActionData::SendMoneyDeshieldedTx(
|
||||||
SendMoneyDeshieldedTx {
|
SendMoneyDeshieldedTx {
|
||||||
@ -1459,7 +1459,7 @@ impl NodeCore {
|
|||||||
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Shielded,
|
tx_kind: TxKind::Shielded,
|
||||||
execution_input: vec![],
|
execution_input: vec![],
|
||||||
execution_output: serde_json::to_vec(&publication).unwrap(),
|
execution_output: serde_json::to_vec(&publication).unwrap(),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use accounts::account_core::Account;
|
use accounts::account_core::Account;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use common::transaction::{TransactionPayload, TxKind};
|
use common::transaction::{Transaction, TxKind};
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
use risc0_zkvm::Receipt;
|
use risc0_zkvm::Receipt;
|
||||||
use secp256k1_zkp::{CommitmentSecrets, PedersenCommitment, Tweak};
|
use secp256k1_zkp::{CommitmentSecrets, PedersenCommitment, Tweak};
|
||||||
@ -15,8 +15,8 @@ pub fn create_public_transaction_payload(
|
|||||||
secret_r: [u8; 32],
|
secret_r: [u8; 32],
|
||||||
sc_addr: String,
|
sc_addr: String,
|
||||||
state_changes: (serde_json::Value, usize),
|
state_changes: (serde_json::Value, usize),
|
||||||
) -> TransactionPayload {
|
) -> Transaction {
|
||||||
TransactionPayload {
|
Transaction {
|
||||||
tx_kind: TxKind::Public,
|
tx_kind: TxKind::Public,
|
||||||
execution_input,
|
execution_input,
|
||||||
execution_output: vec![],
|
execution_output: vec![],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user