IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
250 stars 157 forks source link

simplify?: voter CDDL #4441

Closed ashisherc closed 1 week ago

ashisherc commented 2 weeks ago

referring to the below CDDL Schema,

https://github.com/IntersectMBO/cardano-ledger/blob/a44a5b5ac9f68c5d7a2ff38b040a5fcac8ccfc6a/eras/conway/impl/cddl-files/conway.cddl#L125C1-L136C4

; Constitutional Committee Hot KeyHash: 0
; Constitutional Committee Hot ScriptHash: 1
; DRep KeyHash: 2
; DRep ScriptHash: 3
; StakingPool KeyHash: 4
voter =
  [ 0, addr_keyhash
  // 1, scripthash
  // 2, addr_keyhash
  // 3, scripthash
  // 4, addr_keyhash
  ]

I believe since the dRep, CCHot, and pool_keyhash types are well defined, it would be ideal to have the Voter type defined as below,

voter = 
[ 0, committee_cold_credential
// 1, drep_credential
// 2, pool_keyhash
]
lehins commented 1 week ago

Current approach was done for efficiency. We considered an approach you are suggesting, but it will incur more bytes on chain. Considering that we expect a lot of votes, this is a worthwhile optimization.

Moreover we are too late in the game to change CDDL spec.

Thank you for your suggestion though.