-
Notifications
You must be signed in to change notification settings - Fork 91
pallas-validate: Conway phase-1 validation fails on value check when comparing Coin(x) vs Multiasset(x, {}) #731
Copy link
Copy link
Open
Description
Summary
A transaction that burns all of its native assets should leave both sides of the preservation of value check as pure ADA. However the arithmetic can produce Multiasset(ada, {}) on the lhs while the rhs resolves to Coin(ada).
The equality check fails here:
pallas/pallas-validate/src/phase1/conway.rs
Lines 329 to 331 in 996893a
| if !conway_values_are_equal(&input, &output) { | |
| return Err(PostAlonzo(PreservationOfValue)); | |
| } |
pallas/pallas-validate/src/utils.rs
Lines 610 to 623 in 996893a
| pub fn conway_values_are_equal(first: &ConwayValue, second: &ConwayValue) -> bool { | |
| match (first, second) { | |
| (ConwayValue::Coin(f), ConwayValue::Coin(s)) => f == s, | |
| (ConwayValue::Multiasset(..), ConwayValue::Coin(..)) => false, | |
| (ConwayValue::Coin(..), ConwayValue::Multiasset(..)) => false, | |
| (ConwayValue::Multiasset(f, fma), ConwayValue::Multiasset(s, sma)) => { | |
| if f != s { | |
| false | |
| } else { | |
| conway_multi_assets_are_equal(fma, sma) | |
| } | |
| } | |
| } | |
| } |
Observed behaviour
Validation fails with transaction values are not preserved correctly, despite the values being equal. This was captured after adding tracing to the Conway phase-1 validation:
conway preservation of value mismatch
consumed = Ok(Multiasset(821828716, {policy: {Bounty_23: 1}}))
produced = Coin(820149135)
fee = 1679581
mint = Some({policy: {Bounty_23: -1}})
lhs_input_plus_mint = Multiasset(821828716, {})
rhs_output_plus_fee = Coin(821828716)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels