Skip to content

Commit

Permalink
Change generic to uint
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Oct 10, 2024
1 parent baca3b2 commit 88bd27a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dot/network/warp_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const MaxAllowedSameRequestPerPeer = 5
type WarpSyncVerificationResult struct {
SetId grandpa.SetID
AuthorityList grandpa.AuthorityList
Header generic.Header[uint64, hash.H256, runtime.BlakeTwo256]
Header generic.Header[uint, hash.H256, runtime.BlakeTwo256]
Completed bool
}

Expand Down
20 changes: 10 additions & 10 deletions internal/client/consensus/grandpa/warp_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ type GrandpaState interface {
type WarpSyncFragment struct {
// The last block that the given authority set finalized. This block should contain a digest
// signalling an authority set change from which we can fetch the next authority set.
Header generic.Header[uint64, hash.H256, runtime.BlakeTwo256]
Header generic.Header[uint, hash.H256, runtime.BlakeTwo256]
// A justification for the header above which proves its finality. In order to validate it the
// verifier must be aware of the authorities and set id for which the justification refers to.
Justification GrandpaJustification[hash.H256, uint64]
Justification GrandpaJustification[hash.H256, uint]
}

type WarpSyncProof struct {
Expand Down Expand Up @@ -74,7 +74,7 @@ func (w *WarpSyncProof) addFragment(fragment WarpSyncFragment) (limitReached boo
return false, nil
}

func (w *WarpSyncProof) lastProofBlockNumber() uint64 {
func (w *WarpSyncProof) lastProofBlockNumber() uint {
if len(w.Proofs) == 0 {
return 0
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (p *WarpSyncProofProvider) Generate(start common.Hash) ([]byte, error) {
return nil, err
}

justification, err := decodeJustification[hash.H256, uint64, runtime.BlakeTwo256](encJustification)
justification, err := decodeJustification[hash.H256, uint, runtime.BlakeTwo256](encJustification)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (p *WarpSyncProofProvider) Generate(start common.Hash) ([]byte, error) {
return nil, err
}

justification, err := decodeJustification[hash.H256, uint64, runtime.BlakeTwo256](latestJustification)
justification, err := decodeJustification[hash.H256, uint, runtime.BlakeTwo256](latestJustification)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -279,19 +279,19 @@ func (p *WarpSyncProofProvider) Verify(
}

func findScheduledChange(
header generic.Header[uint64, hash.H256, runtime.BlakeTwo256],
) *grandpa.ScheduledChange[uint64] {
header generic.Header[uint, hash.H256, runtime.BlakeTwo256],
) *grandpa.ScheduledChange[uint] {
panic("not implemented")
}

func headerToGenericHeader(header types.Header) generic.Header[uint64, hash.H256, runtime.BlakeTwo256] {
func headerToGenericHeader(header types.Header) generic.Header[uint, hash.H256, runtime.BlakeTwo256] {
digest := runtime.Digest{}
for _, digestItem := range header.Digest {
digest.Push(digestItem)
}

return *generic.NewHeader[uint64, hash.H256, runtime.BlakeTwo256](
uint64(header.Number),
return *generic.NewHeader[uint, hash.H256, runtime.BlakeTwo256](
header.Number,
hash.H256(header.ExtrinsicsRoot.String()),
hash.H256(header.StateRoot.String()),
hash.H256(header.ParentHash.String()),
Expand Down

0 comments on commit 88bd27a

Please sign in to comment.