ergoplatform / ergo-appkit

Appkit: A Library for Java/Scala/Kotlin Development of Ergo Applications
MIT License
38 stars 27 forks source link

Box value of 0 (zero) should not be allowed on box construction and/or singing #221

Open greenhat opened 1 year ago

greenhat commented 1 year ago

Following https://discord.com/channels/668903786361651200/1073484137131950091/1097795535886372926

Motivation

The node will reject it anyway.

Suggestion

Ideally, box value should be more than min value per byte * box size, but some compromises could be made, like in https://github.com/ergoplatform/sigma-rust/blob/e7bebc6ef7c7c6f5c05e4ae72ccd2e5690100284/ergotree-ir/src/chain/ergo_box/box_value.rs#L31-L47

Luivatra commented 1 year ago

Agree, min value per byte would be great. Had some surprises when moving from off chain appkit signing based test cases to on chain testing (some my fault for forgetting to set a value, but others due to box being too big for the usual 0.001 erg)