Skip to content

Commit

Permalink
Add gorm annotations for fixed hex string length
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Jul 30, 2024
1 parent 364ff6f commit cb8a974
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zkp/golang/pkg/core/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ type SMTRoot struct {
Name string `gorm:"primaryKey"`
// this must be the hex bytes of the root index
// following the big-endian encoding
RootIndex string `gorm:"type:text"`
RootIndex string `gorm:"size:64"`
}

// SMTNode is the structure of a node in the merkle tree.
// It only captures the reference key and the index of the node.
// The value properties of a node are local states that are
// handled outside of the merkle tree library.
type SMTNode struct {
RefKey string `gorm:"primaryKey"`
RefKey string `gorm:"primaryKey;size:64"`
Type byte
Index *string // only leaf nodes have an index
LeftChild *string // only branch nodes have children
RightChild *string
Index *string `gorm:"size:64"` // only leaf nodes have an index
LeftChild *string `gorm:"size:64"` // only branch nodes have children
RightChild *string `gorm:"size:64"`
}

0 comments on commit cb8a974

Please sign in to comment.