mlabs-haskell / clb

Cardano Node Emulator (next-gen PSM)
7 stars 3 forks source link

Parameterize CLB configuration with validation options #24

Open uhbif19 opened 6 months ago

uhbif19 commented 6 months ago

TODO:

euonymos commented 6 months ago

Also - don't use cryptography (if it's possible).

uhbif19 commented 6 months ago

@euonymos

More info on options.

There is config to disable validation for any ledger rules. But to use it we need to go deeper than applyTx .

As for feature of fee disabling discussed on last meeting: seems like there is at least two ways to do it, this one, and making fees zero.

Also there are some "events" some of which may cover some of our needs.

uhbif19 commented 6 months ago

@euonymos Updated TODO list.

Also - don't use cryptography (if it's possible).

You mean in cabal? Or I do not understand.

euonymos commented 6 months ago

No, we use an instance of Cardano.Ledger.Crypto.Crypto, which is StandardCrypto. By using mock hashes we can probably speed everything up a bit. Take a look here. `

euonymos commented 6 months ago

Disabling ledger predicates might be an issue. Adding any instrumentation to the ledger is not an option (and we don't want to maintain our fork). AFAIK there is no way to "turn off" any rules, we have to find ways to circumvent them in other ways, like using parameters.

euonymos commented 6 months ago

There is config to disable validation for any ledger rules.

Do you mean this?

uhbif19 commented 6 months ago

I mean ValidateSuchThat ([Label] -> Bool) constructor for ValidationPolicy. It is passed inside applyTx, so we can use any. It seems like exactly what we need, if works correctly.

There are two Labels in this file so I am not sure which one :D Second is just string, so I assumed only rule as whole can be disabled.

euonymos commented 6 months ago

ValidationPolicy

I mean ValidateSuchThat ([Label] -> Bool) constructor for ValidationPolicy. It is passed inside applyTx, so we can use any. It seems like exactly what we need, if works correctly.

Sorry, I see it's passed for applyBlock and applyTMiick, but not for applyTx. (Cannot check the latest ledger's code though right now, using what I have locally).

uhbif19 commented 5 months ago

@euonymos

Sure. That is why we need to inline it: https://github.com/mlabs-haskell/clb/pull/33/commits

uhbif19 commented 3 months ago

My initial approach did not work, using ValidateSuchThat did not seem to change behavior.

So I tried to parse L.ApplyTxError to get kind of error and retry sendTx in that case, but I failed to win its pattern matching, all its entries look like LS.UtxowFailure (LB.UtxoFailure (LB.AlonzoInBabbageUtxoPredFailure (LA.UtxosFailure (LS.ExpiredUTxO {})))) (where LS/LB... are different versions of ledgers).