tari-project / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
348 stars 216 forks source link

Remove weight and fees from coinbase extra #4997

Open stringhandler opened 1 year ago

stringhandler commented 1 year ago

The coinbase extra was originally a metadata field that allowed for any output. There were special rules for calculating the weight and fee due to its length.

However, this field is only allowed on the coinbase, which has no fees. I don't think there's a need for a custom weight calculation either, since it already has a max and we should assume it will always be used as a max.

Given these reasons, I suggest removing the weight (and thus fee) calculation completely for this field

sdbondi commented 1 year ago

This currently works by calculating the total bytes using consensus encoding(borsh) required for OutputFeatures and applying the weight. We'd just have to define another function that does not include the byte count for metadata/coinbase_extra. Alternatively, we could move the field out of output features.

Since we don't have many different output features, we perhaps simplify the way weights are calculated perhaps with a set weight cost for each output type, since there is an additional but fixed resource cost to validating/processing/storing these.

stringhandler commented 1 year ago

I prefer the idea of set weight per output type, but maybe let's leave the metadata calculation in, but rename it to feature_weight

SWvheerden commented 1 year ago

Currently its called: rounded_up_features_and_scripts_byte_size