Skip to content

Conversation

@qnikst
Copy link
Collaborator

@qnikst qnikst commented Dec 18, 2025

; This file was auto-generated from huddle. Please do not modify it directly!

;  Key is just zero
; 
;  ```
;  meta:
;    endian: be
; 
;  seq:
;    - id: key
;      type: nonce
; 
;  types:
;    nonce:
;      doc: Nonce value
;      size: 1
;      type: u1
;      const: 0
;  ```
; 
record_entry = nonces

;  List of nonces used in the protocol state
; 
nonces = 
  { last_slot              : with_origin<slot_no>      
  , cert_counters          : {* keyhash28 => word64}
  , evolving_nonce         : nonce                      
  , candidate_nonce        : nonce                      
  , epoch_nonce            : nonce                      
  , lab_nonce              : nonce                      
  , last_epoch_block_nonce : nonce                      
  }


with_origin<a0> = [0// 1, a0]

slot_no = uint .size 8

keyhash28 = hash32

hash32 = bytes .size 32

word64 = uint .size 8

nonce = neutral_nonce/ just_nonce

neutral_nonce = [0]

just_nonce = [1, hash32]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new nonces/v0 namespace for managing protocol state nonces in the Cardano SCLS system. The nonces namespace stores various nonce values used in the Cardano protocol, including evolving, candidate, epoch, lab, and last epoch block nonces.

  • Adds a new Cardano.SCLS.Namespace.Nonces module with CDDL definitions for nonce-related types
  • Introduces word64 type to Common.hs for use in cert_counters
  • Registers the new namespace with key size 1 (single zero byte)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
scls-cardano/scls-cardano.cabal Adds the new Cardano.SCLS.Namespace.Nonces module to the library's exposed modules list
scls-cardano/cddl-src/Cardano/SCLS/Namespace/Nonces.hs Implements the nonces namespace with CDDL rules defining nonce types (neutral_nonce, just_nonce), a with_origin helper, and the nonces record structure containing various protocol nonces
scls-cardano/cddl-src/Cardano/SCLS/Common.hs Adds word64 rule definition for unsigned 64-bit integers, used by cert_counters in the nonces namespace
scls-cardano/cddl-src/Cardano/SCLS/CDDL.hs Registers the nonces/v0 namespace with key size 1 and integrates it into the namespace map

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@qnikst qnikst linked an issue Dec 18, 2025 that may be closed by this pull request
@qnikst qnikst force-pushed the 174-add-nonce-namespace branch from 39cc43d to b188a28 Compare December 18, 2025 18:36
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.

Add nonce namespace

2 participants