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

Possibly incorrect min_fee calculation. #354

Open
Bromel777 opened this issue Sep 2, 2024 · 11 comments
Open

Possibly incorrect min_fee calculation. #354

Bromel777 opened this issue Sep 2, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@Bromel777
Copy link

Hi, I'm trying to calculate min_fee for this tx by calling min_fee(true), the result is less than real.
Tx hash 84a800838258201a2548ca9a2d9fb35a16c3da5c760b7704002c14339844647415f2e9bb5e59a5008258202b03bb18f6cfd952fca26c9e2114226c6ea3c5ab91d73be4e56227a55d1c010e0082582030d954068e79dfd28694fa897672ece76a4ba65524ee8aa5b32e1918eb93079a000183a3005839309dee0659686c3ab807895c929e3284c11222affd710b09be690f924db2f6abf60ccde92eae1a2f4fdf65f2eaf6208d872c6f0e597cc10b0701821b0000000288f93cd0a3581cd9bb181e3bb7993a343d6cdc7c1b96080243ff935ae18808432c0a44a14a4e4557205343524950541a0f8cd1fe581c6e917b8b965078a39804a6313e5be73535612421acd70aa83f0ec200a15820712764b20fe9746c5e6c0a576ffd0fb8a3ca136773a8cb8db02fc3fb0937b6e71b7fffffff9b8b1550581cd8eb52caf3289a2880288b23141ce3d2a7025dcf76f26fd5659add06a15820ddae4822e3183bcd3f1527cbcd723b3e57f5dd4774587f2e53c1d7052813575801028201d818590111d8799fd8799f581cd8eb52caf3289a2880288b23141ce3d2a7025dcf76f26fd5659add065820ddae4822e3183bcd3f1527cbcd723b3e57f5dd4774587f2e53c1d70528135758ffd8799f4040ffd8799f581cd9bb181e3bb7993a343d6cdc7c1b96080243ff935ae18808432c0a444a4e455720534352495054ffd8799f581c6e917b8b965078a39804a6313e5be73535612421acd70aa83f0ec2005820712764b20fe9746c5e6c0a576ffd0fb8a3ca136773a8cb8db02fc3fb0937b6e7ff1a000182b81864190fa0009fd8799fd87a9f581ce5619f78d716cc24ea924e4412d83353ae390edd9905ecc6d5c85c2bffffff00581c75c4570eb625ae881b32a34c52b159f6f3f3f2c7aaabf5bac4688133ffa200583900719bee424a97b58b3dca88fe5da6feac6494aa7226f975f3506c5b257846f6bb07f5b2825885e4502679e699b4e60a0c4609a46bc35454cd01821a001a7f25a1581cd9bb181e3bb7993a343d6cdc7c1b96080243ff935ae18808432c0a44a14a4e455720534352495054195c98a200583900719bee424a97b58b3dca88fe5da6feac6494aa7226f975f3506c5b257846f6bb07f5b2825885e4502679e699b4e60a0c4609a46bc35454cd01821a001b37e7a1581cd9bb181e3bb7993a343d6cdc7c1b96080243ff935ae18808432c0a44a14a4e455720534352495054195c93021a0008d89405a1581df096f5c1bee23481335ff4aece32fe1dfa1aa40a944a66d2d6edc9a9a5000b58203aa61c76f6cf133bac54787dbd0e381f3628d197a5cc61d6cb380eb3ab65440a0d81825820204619c402f17d83be5cdf7728514053a948f46ab44cf193957c720ba1b53328000e81581c5cb2c968e5d1c7197a6ce7615967310a375545d9bc65063a964335b21283825820a85dbebcf7a9c27a2548191e6516b12140ec744c142248355ddeef8652ab071f00825820d676064bdbc3aa59bcf266506cd6d6bcf246d9874e7f21089fccca2e36b3064e0082582077fc5b1688a79dd5b9bdba5981b7403b519690dda4f1471fffa78151bbefe0f501a20081825820d39f6e2677e23ac35da0a65bef78ae5cfdf34eb57c4059d4d7f31aa9ccdb8eff5840adf9788ac6d4201fb4e2547de0b7f9a8cad1b71b7681e5512deb095649105d16f0cc05d9694cde090a200b99b0d494cd86a2ed9c969cb6b642bd904750eac3050584840000d879820200821a0009eb101a0f7f4900840001d87a80821a000298101a03dfd240840002d87a80821a000298101a03dfd24084030080821a000f42401a160dc080f5f6
Value from min_fee(true) is 579732
Value from attempt to submit tx manually by Cardano-cli 592007

@Bromel777
Copy link
Author

next cost models used

let ops_v1 = [
        100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
        100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
        61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
        2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150,
        32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541,
        1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1,
        90434, 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 270652, 22588,
        4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32,
        24588, 32, 20744, 32, 25933, 32, 24623, 32, 53384111, 14333, 10,
    ];

  let ops_v2 = [
      100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
      100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
      61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
      2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150,
      32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541,
      1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1,
      90434, 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 955506,
      213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1,
      81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111,
      14333, 10, 43574283, 26308, 10,
  ];

  let ops_v3 = [
      100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
      100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
      61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 549, 57,
      85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000,
      60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74,
      1, 43285, 552, 1, 44749, 541, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32,
      85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203,
      7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1,
      955506, 213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420,
      1, 1, 81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10,
      53384111, 14333, 10, 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1,
      52538055, 3756, 18, 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022,
      1, 166917843, 4307, 36, 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72,
      2174038, 72, 2261318, 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1,
  ];

@rooooooooob
Copy link
Contributor

rooooooooob commented Sep 3, 2024

Can you provide more info about the scripts used in those reference inputs? (size is the relevant thing here)

From where are they all being used? I'm guessing they aren't just used to spend utxos?

Could you share your tx-builder-related code?

@rooooooooob rooooooooob added the bug Something isn't working label Sep 3, 2024
rooooooooob added a commit that referenced this issue Sep 10, 2024
* Check everywhere that could use a ref script (not sure if everyone
  it's allowed)

* Duplicate size for different ref inptus with the same ref script as
  per Haskell code

* look in spent inputs too (as this is possible to ref a script from)

Possibly addresses #354
@rooooooooob
Copy link
Contributor

@Bromel777 can you check to see if #359 fixes this?

@jonathanfishbein1
Copy link

I'm experiencing this using eternl and lace to spend utxos at public key addresses with either an inline datum or reference script

@SebastienGllmt
Copy link
Contributor

@jonathanfishbein1 we're blocked information from somebody who hits this issue such as yourself to help us validate a fix: #359 (comment)

@jonathanfishbein1
Copy link

Would it help if I pasted here the tx cbor?

@SebastienGllmt
Copy link
Contributor

It depends. We want to know what transaction inputs lead to this error and the tx cbor contains the inputs but also contains the change inputs as well. We can probably reverse engineer what the inputs are, but it's extra work

@jonathanfishbein1
Copy link

Eternl says they're using cardano-serialization-lib, so maybe the bug I'm experiencing is different?

@Bromel777
Copy link
Author

Bromel777 commented Nov 12, 2024

@rooooooooob @SebastienGllmt Hi, sorry for delay. I've tested version from #359 and still getting this issue.
New tx cbor
84a700828258209486be94750630417fac8edcd48b98a0b859ea19307c88e6c566ceac58cefc0800825820ff22d9b8f323d2ea748bce80ab00901b77b01928c8131c7fbd9f886e6fb8c436000183a300581d70b09d1ccde30a0c65316c8e5dada41ee4d86ca0d0bb5370542693dafa01821a05f5e100a3581c4b3459fd18a1dbabe207cd19c9951a9fac9f5c0f9c384e3d97efba26a14574657374441a05f5e100581c7adf9da5cf304976ded41896f9453ce5d706fecda4d28362d105c3b0a1426c711b7ffffffff4143dff581c34d9e2ffb87551fa04191ed8e5fb2af78e29d023d48dcf429c1590eaa1436e667401028201d81858f5d8799fd8799f581c34d9e2ffb87551fa04191ed8e5fb2af78e29d023d48dcf429c1590ea436e6674ffd8799f4040ffd8799f581c4b3459fd18a1dbabe207cd19c9951a9fac9f5c0f9c384e3d97efba26457465737444ffd8799f581c7adf9da5cf304976ded41896f9453ce5d706fecda4d28362d105c3b0426c71ff1a00017318192710192710000000009fd8799fd87a9f581cef8bd8fbb18b4236d8c48c16eb60a5b22f8787a4ec911f14d5ff039affffff581cb09d1ccde30a0c65316c8e5dada41ee4d86ca0d0bb5370542693dafa5820d4b74586f897798bdce8ca0d37c3e95ae1885c2b4c4f44338f01adf2d9b2ca1401ffa200581d6026077fda71d72f97c3fb62e258f67cd3ffc7c2e0628cc824b95d4509011a00197b708258390087f295e1dceebc33a9c15fddb2f6321b9500312be64e34853e4dfc1ed6913ad6700e61ea2412aeac97e095ab39cfd5ef0d03ed93976c8f321a006d0178021a0012199805a1581df0ef8bd8fbb18b4236d8c48c16eb60a5b22f8787a4ec911f14d5ff039a000b5820c7ee87d557c5b41aa14cd05bbe715f83fefa2129e1b17fb7b50c07e7f7ece8f60d8182582052747d590e90462eb8d65bb14b0990bd593ddaa4dea1feebbc0299d5110d9824001283825820ca66025cdf9a2527d2d15b061b25a7b431682164ed0de3509a9caa12805f5419008258205c8c44c2a3735f4572257a24275ad3dc825518c30e0d03e84b632acba8809ca0008258205c8c44c2a3735f4572257a24275ad3dc825518c30e0d03e84b632acba8809ca001a20081825820983745ab9aa588c0b574f8f2e5d0782b09b51cbcc890a3648934c2e46a75355a58406b34651d4ff0b669409408095b72ce5554146323b151ed044bd142119298bcb3c5322b00bb343897a52102d3e0905a05a6454ecb62e0ffb8294a032f7498d90d0583840000d8798401000100821a0016e3601a1312d000840001d879820301821a001e84801a47868c00840300d879840201d8799f581c34d9e2ffb87551fa04191ed8e5fb2af78e29d023d48dcf429c1590ea436e6674ff815840feba296dda6c67108e70f47d2c7b29a852f2d96da5a22dd7e7fec65e5d2f1081a854620d9cc6cbe9f2d9d6b0f2a4916f696ff5787a1a475f992c3a4e1e03fb02821a005b8d801ad0c85ba7f5f6

Node CLI error:
ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (FeeTooSmallUTxO (Coin 1286360) (Coin 1186200))) :| []))

Scripts:
spend1.txt
spend0.txt
wdrl.txt

Also I'm using Maestro API for calculation exUnits, response for this tx is:
[ { "redeemer_tag": "spend", "redeemer_index": 0, "ex_units": { "mem": 167533, "steps": 56621204 } }, { "redeemer_tag": "spend", "redeemer_index": 1, "ex_units": { "mem": 334405, "steps": 124328586 } }, { "redeemer_tag": "wdrl", "redeemer_index": 0, "ex_units": { "mem": 5482856, "steps": 3302791591 } } ]

I've often used values exceeding those.

@Bromel777
Copy link
Author

Bromel777 commented Nov 12, 2024

Also as I can see that increasing ex_units affects to min_fee from cml, but the difference is still in range of 100_000 lovelace +-

@Bromel777
Copy link
Author

upd. Cardano cli also add Error decoding redeemer: unexpected CBOR token type for a JSON value: TypeTag during attempt to deserialize cbor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants