Fix reference script fee calculation#376
Open
colll78 wants to merge 5 commits into
Open
Conversation
| const oldPkg = require(`${pathToRepo}/publish/package.json`); | ||
|
|
||
| const packageNameRoot = hyphenRepoName.split("-wasm")[0]; | ||
| oldPkg.name = '@dcspark/' + packageNameRoot + buildType; |
Contributor
There was a problem hiding this comment.
you'll need to revert this one
| script_ref.hash(), | ||
| script_ref | ||
| .raw_plutus_bytes() | ||
| .expect("TODO: handle this") |
Contributor
Author
There was a problem hiding this comment.
The TODO is what was already there prior to any of my changes.
| None => builder.min_fee(include_exunits), | ||
| // generating the change output involves changing the fee | ||
| Some(_x) => return Ok(false), | ||
| Some(set_fee) => Ok(set_fee.clone()), |
Contributor
There was a problem hiding this comment.
I think this now contradicts the comment directly above it?
Contributor
Author
There was a problem hiding this comment.
The comment was already contradicted, generating the change output did not change the fee if there was a fee set.
| pub type SubCoin = Rational; | ||
| #[derive(Clone, Debug)] | ||
| #[wasm_bindgen] | ||
| pub struct SubCoin(cml_chain::SubCoin); |
Contributor
There was a problem hiding this comment.
Is this needed for anything?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates min_fee_with_exunits to match Conway ledger reference-script fee accounting.
Previously, CML only counted reference-script bytes when a reference input’s script hash matched a spent script-address input. That missed cases where a transaction spends a regular input carrying a reference script, and it also did not match the ledger’s actual txNonDistinctRefScriptsSize behavior.
Changes:
Count reference scripts from regular inputs ∪ reference inputs.
De-duplicate by TransactionInput, so the same TxIn appearing in both sets counts once.
Count the same script multiple times when it appears on different UTxOs, matching ledger behavior.
Handle native reference scripts without panicking.
Change reference-script tier fee rounding from ceil to floor, matching Conway tierRefScriptFee.