Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSA integration (step 8): Merge zsa-issued-assets into zsa-integration-consensus with bug fixes #29

Open
wants to merge 36 commits into
base: zsa-integration-consensus
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1af120e
Defines and implements the issued asset state types
arya2 Nov 12, 2024
cc8bc0d
Adds issued assets to the finalized state
arya2 Nov 12, 2024
c7116f3
Validates issuance actions and burns before committing blocks to a no…
arya2 Nov 12, 2024
bb62c67
Adds `issued_assets` fields on `ChainInner` and `ContextuallyValidate…
arya2 Nov 12, 2024
3d00b81
Adds issued assets map to non-finalized chains
arya2 Nov 12, 2024
2daf84f
adds new column family to list of state column families
arya2 Nov 12, 2024
c6c099b
Updates AssetState, AssetStateChange, IssuedAssetsOrChange, & Semanti…
arya2 Nov 14, 2024
9e0e043
Fixes tests by computing an `IssuedAssetsChange` for conversions to C…
arya2 Nov 14, 2024
8f26a89
fixes finalization checks
arya2 Nov 14, 2024
e063729
Adds documentation to types and methods in `asset_state` module, fixe…
arya2 Nov 15, 2024
6aad8da
Merge branch 'zsa-issued-assets' into zsa-integration-state
dmidem Nov 27, 2024
f0b64ad
Fix compilation errors that appeared after the previous merge
dmidem Nov 27, 2024
bc0c8e6
Avoid using NonEmpty in orchard_zsa/issuance
dmidem Nov 27, 2024
17f3ee6
Fix BurnItem serialization/deserializartioon errors (use LE instead o…
dmidem Nov 27, 2024
3f96af0
Make a minor fix and add FIXME comment in orchard_flavor_ext.rs
dmidem Nov 27, 2024
5524480
Fix the sign of burn value in SupplyChange::add in orchard_zsa/asset_…
dmidem Nov 27, 2024
8096da4
Fix the 'transactions must have only one burn item per asset base' er…
dmidem Nov 27, 2024
20fd58d
Use NoteValue from the orchard crate for BurnItem amount instead of u…
dmidem Nov 27, 2024
4932495
Use BurnItem::from instead of try_from
dmidem Nov 27, 2024
89be470
Fix a compilation error for the previous commit ('Use BurnItem::from …
dmidem Nov 27, 2024
c3daec9
Fix a compilation error for the previous commit ('Use BurnItem::from …
dmidem Nov 27, 2024
a8668d6
Modify ValueCommitment::with_asset to accept value as a NoteValue ins…
dmidem Dec 3, 2024
e31f24c
Adds TODOs
arya2 Nov 28, 2024
2a5aebd
Adds state request/response variants for querying asset states
arya2 Nov 28, 2024
f7b43a9
Adds a `getassetstate` RPC method
arya2 Nov 28, 2024
e35ae57
Adds snapshot test
arya2 Nov 28, 2024
c278758
Addesses some FIXMEs and replaces a couple others with TODOs.
arya2 Nov 29, 2024
d144774
Removes `issued_assets_change` field from `SemanticallyVerifiedBlock`
arya2 Nov 29, 2024
727e3e3
Temporarily disable specific Clippy checks for Rust 1.83.0 compatibility
dmidem Dec 5, 2024
9a8c032
Disable clippy warning about doc comment for empty line
dmidem Dec 5, 2024
fb512d9
Update Orchard ZSA consensus tests to calculate and check asset supply
dmidem Dec 6, 2024
977af42
Rename ZSA workflow tests (including file, constant and variable name…
dmidem Dec 6, 2024
29af613
Add amount method to BurnItem and make BurnItem pub (visible for othe…
dmidem Dec 6, 2024
2b7926a
Fix Orchard ZSA workflow tests to make it compilable with getblocktem…
dmidem Dec 6, 2024
73c804f
Fix clippy error
dmidem Dec 6, 2024
6bd4284
Add rust-toolchain.toml with Rust version 1.82.0 to avoid clippy erro…
dmidem Dec 9, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6034,6 +6034,7 @@ dependencies = [
"incrementalmerkletree",
"itertools 0.13.0",
"jubjub",
"k256",
"lazy_static",
"nonempty",
"num-integer",
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.82.0"
components = [ "clippy", "rustfmt" ]
2 changes: 2 additions & 0 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,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
6 changes: 3 additions & 3 deletions zebra-chain/src/orchard/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use halo2::{
use lazy_static::lazy_static;
use rand_core::{CryptoRng, RngCore};

use orchard::note::AssetBase;
use orchard::{note::AssetBase, value::NoteValue};

use crate::{
amount::Amount,
Expand Down Expand Up @@ -255,8 +255,8 @@ impl ValueCommitment {
/// Generate a new `ValueCommitment` from an existing `rcv on a `value` (ZSA version).
#[cfg(feature = "tx-v6")]
#[allow(non_snake_case)]
pub fn with_asset(rcv: pallas::Scalar, value: Amount, asset: &AssetBase) -> Self {
let v = pallas::Scalar::from(value);
pub fn with_asset(rcv: pallas::Scalar, value: NoteValue, asset: &AssetBase) -> Self {
let v = pallas::Scalar::from(value.inner());
let V_zsa = asset.cv_base();
Self::from(V_zsa * v + *R * rcv)
}
Expand Down
4 changes: 3 additions & 1 deletion zebra-chain/src/orchard/orchard_flavor_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
};

#[cfg(feature = "tx-v6")]
use crate::orchard_zsa::{Burn, NoBurn};
use crate::orchard_zsa::{Burn, BurnItem, NoBurn};

use super::note;

Expand Down Expand Up @@ -58,7 +58,9 @@ pub trait OrchardFlavorExt: Clone + Debug {
+ Default
+ ZcashDeserialize
+ ZcashSerialize
// FIXME: consider using AsRef instead of Into, to avoid a redundancy
+ Into<ValueCommitment>
+ AsRef<[BurnItem]>
+ TestArbitrary;
}

Expand Down
6 changes: 6 additions & 0 deletions zebra-chain/src/orchard_zsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ pub(crate) mod arbitrary;
#[cfg(any(test, feature = "proptest-impl"))]
pub mod tests;

pub mod asset_state;
mod burn;
mod issuance;

pub(crate) use burn::{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};
6 changes: 1 addition & 5 deletions zebra-chain/src/orchard_zsa/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ impl Arbitrary for BurnItem {
// FIXME: move arb_asset_to_burn out of BundleArb in orchard
// as it does not depend on flavor (we pinned it here OrchardVanilla
// just for certainty, as there's no difference, which flavor to use)
// FIXME: consider to use BurnItem(asset_base, value.try_into().expect("Invalid value for Amount"))
// instead of filtering non-convertable values
// FIXME: should we filter/protect from including native assets into burn here?
BundleArb::<orchard::orchard_flavor::OrchardVanilla>::arb_asset_to_burn()
.prop_filter_map("Conversion to Amount failed", |(asset_base, value)| {
BurnItem::try_from((asset_base, value)).ok()
})
.prop_map(|(asset_base, value)| BurnItem::from((asset_base, value)))
.boxed()
}

Expand Down
Loading
Loading