Skip to content

Ledger rule changes: documentation & consistency? #1028

@waalge

Description

@waalge

Someone sent me a message to inform me that a dapp what I wrote no longer works.
The breakage is due to a change in ledger rules.
Specifically the one corresponding to https://input-output-hk.github.io/cardano-js-sdk/enums/_cardano_sdk_core.TxSubmissionErrorCode.html#ConflictingInputsAndReferences

Essentially the dapp involves a CIP 68 style "updateable" state, that doubles as linked list lexicographically sorted by token name.
To insert a new item in the list, you "update" the token that will precede it.

The initial entry of the list, has blank token name (excluding CIP67 tag) .
This entry's datum contains information that controls additional behaviour of how a new item can be inserted into the list.
As a result, for any insert, the validator expects to find this token in reference inputs.

Under the change to ledger rules, this breaks for the first insert.
In fact, for every insert in which the first token is spent.

There are numerous elementary ways the dapp can be modified adhere to the new ledger rules.
But had the dapp already been deployed, that would be irrelevant.

Reading from the distance, I'm guessing significant efforts have been made to futureproof Plutus.
Its kinda all for not so much if Ledger rules can just break your dapp anyway.
I frequently make assumptions on ledger rules.
For example,

  • MinAda was no longer required, then a bunch of stuff I've written would no longer work, such as
expect [_ , (hash, name, amount) ] = value |> assets.flatten
  • Inputs are lexicographically sorted. (An example utilising this is a bit more involved)

It is very helpful relying on things being enforced by the ledger. And very unhelpful when these change.
From memory this is not the first time this is has happened.

As far as I know, there is no "Ledger rules we promise you can assume" list out there. Is there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: LedgerProposals belonging to the 'Ledger' category.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions