Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ff78e0f
Modifiy zebra-chain structures to support multiple action groups
dmidem Apr 3, 2025
3ef968b
Merge branch 'zsa-integration-consensus' into zsa-integration-consens…
dmidem Apr 3, 2025
38f50f6
Fix zebrad test compilation errors
dmidem Apr 3, 2025
221d8bc
Fix zebra-consensus tests compilation errors
dmidem Apr 3, 2025
d8cd819
Fix zebrad tests compilation errors
dmidem Apr 3, 2025
518fa23
Fix cargo clippy error
dmidem Apr 3, 2025
d9305da
Minor fixes in comments
dmidem Apr 3, 2025
5612c75
Add support of serialization of multiple action groups (use new zsa-s…
dmidem Apr 4, 2025
adfa962
Create push-deploy.yaml on zsa-integration-consensus
seniakalma May 28, 2025
aab80b1
Create dockerfile
seniakalma May 28, 2025
0e7199a
Rename dockerfile to dockerfile
seniakalma May 28, 2025
e1c2413
Change clangq to clang
seniakalma May 28, 2025
d658474
Create push-ecr.yaml
seniakalma Jul 15, 2025
0001f7f
Add ecs and remove old workflow
seniakalma Jul 15, 2025
d2a0b64
Add workflows from zsa1 default branch (#66)
seniakalma Jul 16, 2025
c89448c
Add version logs
seniakalma Jul 21, 2025
8958cfc
Move code to the end of the func
seniakalma Jul 21, 2025
3ef63c8
Explain
seniakalma Jul 21, 2025
72fa2e4
Fix cargo fmt
seniakalma Jul 21, 2025
d6669b2
Add version prints (#69)
seniakalma Jul 21, 2025
2db59c6
Add dockerfile and regtest-config files
seniakalma Jul 22, 2025
95cd946
Test fix
seniakalma Jul 23, 2025
b1ecb69
Update dockerfile
seniakalma Jul 23, 2025
aef9d6d
Update dockerfile2
seniakalma Jul 23, 2025
b1a692a
Update dockerfile3
seniakalma Jul 23, 2025
9d356b8
Update dockerfile
seniakalma Jul 23, 2025
b61489b
Fix
seniakalma Jul 25, 2025
b42da49
Revert to built
seniakalma Jul 25, 2025
afdc33d
Create regtest-config.toml
seniakalma Jul 26, 2025
487d5f1
Adjust
seniakalma Jul 26, 2025
0b63edd
Adjust
seniakalma Jul 26, 2025
d542531
Adjust
seniakalma Jul 26, 2025
91b9760
Adjust
seniakalma Jul 26, 2025
937d812
Adjust
seniakalma Jul 26, 2025
91819f8
Fix dockerignore..
seniakalma Jul 26, 2025
dd2b2a6
Fix typo
seniakalma Jul 26, 2025
9859d4b
Merge branch 'zsa-integration-demo' into arseni-adjust-dockerfiles
seniakalma Jul 26, 2025
e09ad24
Update .dockerignore
seniakalma Jul 27, 2025
fdb4c48
Clean dockerfile
seniakalma Jul 27, 2025
9bacc76
Update dockerfile
seniakalma Jul 27, 2025
e0343c7
Update dockerfile
seniakalma Jul 28, 2025
6497738
Update dockerfile
seniakalma Jul 28, 2025
90cc5e7
Update dockerfile
seniakalma Jul 28, 2025
80f3dfc
Add dockerfile and regtest files (#70)
seniakalma Jul 28, 2025
a55cf6c
Update push-ecr.yaml
seniakalma Aug 4, 2025
4ef3af1
Fix case of empty tag by user (#72)
seniakalma Aug 4, 2025
01ab25c
Add git commit and tag from env var, and rust fallback
seniakalma Aug 6, 2025
d31b6d4
Merge branch 'zsa-integration-demo' into arseni-fix-git-info-fetching
seniakalma Aug 6, 2025
a1b6504
Update build.rs
seniakalma Aug 6, 2025
505bfa2
Change order
seniakalma Aug 7, 2025
155eb10
Re-phrase
seniakalma Aug 11, 2025
f39c465
Fix git info fetching (#74)
seniakalma Aug 12, 2025
1880f93
Update deploy ecs on zsa-integration-demo branch
seniakalma Aug 19, 2025
75397cd
Update deploy ecs on zsa-integration-demo branch (#75)
PaulLaux Aug 19, 2025
37668f3
Merge branch 'zsa1' into zsa-integration-demo
dmidem Oct 28, 2025
1e07ba0
Add support for ZSA state management (non-refactored) to the demo (#89)
dmidem Nov 3, 2025
11dcfc2
Merge branch 'zsa1' into zsa-integration-demo
dmidem Nov 28, 2025
4348299
Merge branch 'zsa-integration-consensus-multiple-ag' into multiple-ag
dmidem Dec 3, 2025
4b57e61
Reorder fields in fmt::Display for ActionGroup according the spec layout
dmidem Dec 3, 2025
e3b115c
Merge branch 'multiple-ag' into zsa-integration-demo-multiple-ag
dmidem Dec 3, 2025
47287e3
Fix compilation error im zebra-chain
dmidem Dec 3, 2025
3702878
Additional refactoring
dmidem Dec 3, 2025
5d56117
Merge branch 'multiple-ag' into zsa-integration-demo-multiple-ag
dmidem Dec 3, 2025
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
28 changes: 27 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143f5327f23168716be068f8e1014ba2ea16a6c91e8777bc8927da7b51e1df1f"
dependencies = [
"bs58",
"hmac",
"hmac 0.13.0-pre.4",
"rand_core 0.6.4",
"ripemd 0.2.0-pre.4",
"secp256k1 0.29.1",
Expand Down Expand Up @@ -1247,6 +1247,7 @@ dependencies = [
"block-buffer 0.10.4",
"const-oid",
"crypto-common 0.1.6",
"subtle",
]

[[package]]
Expand Down Expand Up @@ -1305,7 +1306,9 @@ dependencies = [
"der",
"digest 0.10.7",
"elliptic-curve",
"rfc6979",
"signature",
"spki",
]

[[package]]
Expand Down Expand Up @@ -1373,6 +1376,7 @@ dependencies = [
"ff",
"generic-array",
"group",
"pkcs8",
"rand_core 0.6.4",
"sec1",
"subtle",
Expand Down Expand Up @@ -1936,6 +1940,15 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"

[[package]]
name = "hmac"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
"digest 0.10.7",
]

[[package]]
name = "hmac"
version = "0.13.0-pre.4"
Expand Down Expand Up @@ -2495,6 +2508,7 @@ dependencies = [
"cfg-if 1.0.0",
"ecdsa",
"elliptic-curve",
"once_cell",
"sha2 0.10.8",
"signature",
]
Expand Down Expand Up @@ -3804,6 +3818,16 @@ dependencies = [
"winreg",
]

[[package]]
name = "rfc6979"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
dependencies = [
"hmac 0.12.1",
"subtle",
]

[[package]]
name = "rgb"
version = "0.8.47"
Expand Down Expand Up @@ -4059,6 +4083,7 @@ dependencies = [
"base16ct",
"der",
"generic-array",
"pkcs8",
"subtle",
"zeroize",
]
Expand Down Expand Up @@ -6195,6 +6220,7 @@ dependencies = [
"incrementalmerkletree",
"itertools 0.13.0",
"jubjub",
"k256",
"lazy_static",
"nonempty 0.7.0",
"num-integer",
Expand Down
5 changes: 5 additions & 0 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ tx_v6 = [
"nonempty"
]

# Support for ZSA asset swaps
zsa-swap = []

[dependencies]

# Cryptography
Expand Down Expand Up @@ -158,6 +161,8 @@ rand_chacha = { version = "0.3.1", optional = true }

zebra-test = { path = "../zebra-test/", version = "1.0.0-beta.41", optional = true }

k256 = "0.13.3"

[dev-dependencies]
# Benchmarks
criterion = { version = "0.5.1", features = ["html_reports"] }
Expand Down
2 changes: 1 addition & 1 deletion zebra-chain/src/orchard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use address::Address;
pub use commitment::{CommitmentRandomness, NoteCommitment, ValueCommitment};
pub use keys::Diversifier;
pub use note::{EncryptedNote, Note, Nullifier, WrappedNoteKey};
pub use shielded_data::{AuthorizedAction, Flags, ShieldedData};
pub use shielded_data::{ActionGroup, AuthorizedAction, Flags, ShieldedData};
pub use shielded_data_flavor::{OrchardVanilla, ShieldedDataFlavor};

#[cfg(feature = "tx_v6")]
Expand Down
109 changes: 94 additions & 15 deletions zebra-chain/src/orchard/shielded_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ use orchard::{note::AssetBase, value::ValueSum};

use super::{OrchardVanilla, ShieldedDataFlavor};

/// A bundle of [`Action`] descriptions and signature data.
// FIXME: wrap all ActionGroup usages with tx_v6 feature flag?
/// Action Group description.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[cfg_attr(
not(feature = "tx_v6"),
Expand All @@ -41,40 +42,77 @@ use super::{OrchardVanilla, ShieldedDataFlavor};
deserialize = "Flavor::BurnType: serde::Deserialize<'de>"
))
)]
pub struct ShieldedData<Flavor: ShieldedDataFlavor> {
pub struct ActionGroup<Flavor: ShieldedDataFlavor> {
/// The orchard flags for this transaction.
/// Denoted as `flagsOrchard` in the spec.
pub flags: Flags,
/// The net value of Orchard spends minus outputs.
/// Denoted as `valueBalanceOrchard` in the spec.
pub value_balance: Amount,
/// The shared anchor for all `Spend`s in this transaction.
/// Denoted as `anchorOrchard` in the spec.
pub shared_anchor: tree::Root,

/// Block height after which this Bundle's Actions are invalid by consensus.
/// Denoted as `nAGExpiryHeight` in the spec.
#[cfg(feature = "tx_v6")]
pub expiry_height: u32,

/// Assets intended for burning
/// Denoted as `vAssetBurn` in the spec (ZIP 230).
#[cfg(feature = "tx_v6")]
pub burn: Flavor::BurnType,

/// The aggregated zk-SNARK proof for all the actions in this transaction.
/// Denoted as `proofsOrchard` in the spec.
pub proof: Halo2Proof,
/// The Orchard Actions, in the order they appear in the transaction.
/// Denoted as `vActionsOrchard` and `vSpendAuthSigsOrchard` in the spec.
pub actions: AtLeastOne<AuthorizedAction<Flavor>>,
}

impl<Flavor: ShieldedDataFlavor> ActionGroup<Flavor> {
/// Iterate over the [`Action`]s for the [`AuthorizedAction`]s in this
/// action group, in the order they appear in it.
pub fn actions(&self) -> impl Iterator<Item = &Action<Flavor>> {
self.actions.actions()
}
}

/// A bundle of [`Action`] descriptions and signature data.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[cfg_attr(
not(feature = "tx_v6"),
serde(bound(serialize = "Flavor::EncryptedNote: serde::Serialize"))
)]
#[cfg_attr(
feature = "tx_v6",
serde(bound(
serialize = "Flavor::EncryptedNote: serde::Serialize, Flavor::BurnType: serde::Serialize",
deserialize = "Flavor::BurnType: serde::Deserialize<'de>"
))
)]
pub struct ShieldedData<Flavor: ShieldedDataFlavor> {
/// Action Group descriptions.
/// Denoted as `vActionGroupsOrchard` in the spec (ZIP 230).
pub action_groups: AtLeastOne<ActionGroup<Flavor>>,
/// Denoted as `valueBalanceOrchard` in the spec.
pub value_balance: Amount,
/// A signature on the transaction `sighash`.
/// Denoted as `bindingSigOrchard` in the spec.
pub binding_sig: Signature<Binding>,

#[cfg(feature = "tx_v6")]
/// Assets intended for burning
/// Denoted as `vAssetBurn` in the spec (ZIP 230).
pub burn: Flavor::BurnType,
}

impl<Flavor: ShieldedDataFlavor> fmt::Display for ShieldedData<Flavor> {
impl<Flavor: ShieldedDataFlavor> fmt::Display for ActionGroup<Flavor> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut fmter = f.debug_struct("orchard::ShieldedData");
let mut fmter = f.debug_struct("orchard::ActionGroup");

fmter.field("actions", &self.actions.len());
fmter.field("value_balance", &self.value_balance);
fmter.field("flags", &self.flags);

#[cfg(feature = "tx_v6")]
fmter.field("expiry_height", &self.expiry_height);

#[cfg(feature = "tx_v6")]
fmter.field("burn", &self.burn.as_ref().len());

fmter.field("proof_len", &self.proof.zcash_serialized_size());

fmter.field("shared_anchor", &self.shared_anchor);
Expand All @@ -83,11 +121,25 @@ impl<Flavor: ShieldedDataFlavor> fmt::Display for ShieldedData<Flavor> {
}
}

impl<Flavor: ShieldedDataFlavor> fmt::Display for ShieldedData<Flavor> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut fmter = f.debug_struct("orchard::ShieldedData");

fmter.field("action_groups", &self.action_groups);
fmter.field("value_balance", &self.value_balance);

// FIXME: format binding_sig as well?

fmter.finish()
}
}

impl<Flavor: ShieldedDataFlavor> ShieldedData<Flavor> {
/// Iterate over the [`Action`]s for the [`AuthorizedAction`]s in this
/// transaction, in the order they appear in it.
pub fn actions(&self) -> impl Iterator<Item = &Action<Flavor>> {
self.actions.actions()
self.authorized_actions()
.map(|authorized_action| &authorized_action.action)
}

/// Collect the [`Nullifier`]s for this transaction.
Expand Down Expand Up @@ -139,7 +191,11 @@ impl<Flavor: ShieldedDataFlavor> ShieldedData<Flavor> {
(ValueSum::default() + i64::from(self.value_balance)).unwrap(),
AssetBase::native(),
);
let burn_value_commitment = compute_burn_value_commitment(self.burn.as_ref());
let burn_value_commitment = self
.action_groups
.iter()
.map(|action_group| compute_burn_value_commitment(action_group.burn.as_ref()))
.sum::<ValueCommitment>();
cv - cv_balance - burn_value_commitment
};

Expand All @@ -160,6 +216,29 @@ impl<Flavor: ShieldedDataFlavor> ShieldedData<Flavor> {
pub fn note_commitments(&self) -> impl Iterator<Item = &pallas::Base> {
self.actions().map(|action| &action.cm_x)
}

/// Makes a union of the flags for this transaction.
pub fn flags_union(&self) -> Flags {
self.action_groups
.iter()
.map(|action_group| &action_group.flags)
.fold(Flags::empty(), |result, flags| result.union(*flags))
}

/// Collect the shared anchors for this transaction.
pub fn shared_anchors(&self) -> impl Iterator<Item = tree::Root> + '_ {
self.action_groups
.iter()
.map(|action_group| action_group.shared_anchor)
}

/// Iterate over the [`AuthorizedAction`]s in this
/// transaction, in the order they appear in it.
pub fn authorized_actions(&self) -> impl Iterator<Item = &AuthorizedAction<Flavor>> {
self.action_groups
.iter()
.flat_map(|action_group| action_group.actions.iter())
}
}

impl<Flavor: ShieldedDataFlavor> AtLeastOne<AuthorizedAction<Flavor>> {
Expand Down
2 changes: 2 additions & 0 deletions zebra-chain/src/orchard/shielded_data_flavor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub trait ShieldedDataFlavor: OrchardFlavor {
#[cfg(feature = "tx_v6")]
type BurnType: Clone
+ Debug
+ PartialEq
+ Eq
+ ZcashDeserialize
+ ZcashSerialize
+ AsRef<[BurnItem]>
Expand Down
8 changes: 7 additions & 1 deletion zebra-chain/src/orchard_zsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
#[cfg(any(test, feature = "proptest-impl"))]
mod arbitrary;

pub mod asset_state;
mod burn;
mod issuance;

pub(crate) use burn::{compute_burn_value_commitment, Burn, BurnItem, NoBurn};
pub(crate) use burn::{compute_burn_value_commitment, Burn, NoBurn};
pub(crate) use issuance::IssueData;

pub use burn::BurnItem;

// FIXME: should asset_state mod be pub and these structs be pub as well?
pub use asset_state::{AssetBase, AssetState, AssetStateChange, IssuedAssets, IssuedAssetsChange};
Loading