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

Change a representation of witnesses in transaction's certificates to an ordered map where a certificate is the key #734

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Jan 22, 2025

Changelog

- description: |
    Change a representation of witnesses in transaction's certificates to an ordered map where a certificate is the key.
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
   - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
   - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

This PR changes representation of transaction certificates' witnesses from a list of with stake credentials to a map.

The issue is that there's a relationship Certificate *--1 StakeCredential which makes the assigning of witnesses impossible in the cases where we have more than one certificate with the same stake credential. This then breaks witnesses indexing.

See related PRs:

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer changed the title Use correct representation of witnesses in transaction's certificates Change a representation of witnesses in transaction's certificates to an ordered map where a certificate is the key Jan 24, 2025
@carbolymer carbolymer force-pushed the mgalazyn/fix/correct-certificates-representation branch from 9b2bcb4 to 090aa57 Compare January 24, 2025 14:24
… an ordered map where a certificate is the key
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm we aren't reintroducing a bug and I'll be happy to approve.

, Either
(TxBodyErrorAutoBalance era)
( BuildTxWith
BuildTx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes my eyes bleed (I know it's not your fault).

(Certificate era)
( BuildTxWith
build
(Maybe (StakeCredential, Witness WitCtxStake era))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would seek confirmation that #456 is not an issue with this change. I suspect this needs to be a list still.

@@ -142,6 +142,8 @@ data Certificate era where

deriving instance Eq (Certificate era)

deriving instance Ord (Certificate era)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a ord_distributive test for Certificate just to be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants