Skip to content

Commit

Permalink
tmp: fix lint errors (will need to revert)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan4th committed Aug 13, 2024
1 parent dcab056 commit 1d8d310
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions activation/wire/wire_v2_test.go
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
package wire

import (
"math/rand/v2"
"testing"

fuzz "github.com/google/gofuzz"
"github.com/stretchr/testify/require"

"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/signing"
)

type testAtxV2Opt func(*ActivationTxV2)
// type testAtxV2Opt func(*ActivationTxV2)

func withMarriageCertificate(sig *signing.EdSigner, refAtx types.ATXID, atxPublisher types.NodeID) testAtxV2Opt {
return func(atx *ActivationTxV2) {
certificate := MarriageCertificate{
ReferenceAtx: refAtx,
Signature: sig.Sign(signing.MARRIAGE, atxPublisher.Bytes()),
}
atx.Marriages = append(atx.Marriages, certificate)
}
}
// func withMarriageCertificate(sig *signing.EdSigner, refAtx types.ATXID, atxPublisher types.NodeID) testAtxV2Opt {
// return func(atx *ActivationTxV2) {
// certificate := MarriageCertificate{
// ReferenceAtx: refAtx,
// Signature: sig.Sign(signing.MARRIAGE, atxPublisher.Bytes()),
// }
// atx.Marriages = append(atx.Marriages, certificate)
// }
// }

func newActivationTxV2(opts ...testAtxV2Opt) *ActivationTxV2 {
atx := &ActivationTxV2{
PublishEpoch: rand.N(types.EpochID(255)),
PositioningATX: types.RandomATXID(),
PreviousATXs: make([]types.ATXID, 1+rand.IntN(255)),
NiPosts: []NiPostsV2{
{
Membership: MerkleProofV2{
Nodes: make([]types.Hash32, 32),
},
Challenge: types.RandomHash(),
Posts: []SubPostV2{
{
MarriageIndex: rand.Uint32N(256),
PrevATXIndex: 0,
Post: PostV1{
Nonce: 0,
Indices: make([]byte, 800),
Pow: 0,
},
},
},
},
},
}
for _, opt := range opts {
opt(atx)
}
return atx
}
// func newActivationTxV2(opts ...testAtxV2Opt) *ActivationTxV2 {
// atx := &ActivationTxV2{
// PublishEpoch: rand.N(types.EpochID(255)),
// PositioningATX: types.RandomATXID(),
// PreviousATXs: make([]types.ATXID, 1+rand.IntN(255)),
// NiPosts: []NiPostsV2{
// {
// Membership: MerkleProofV2{
// Nodes: make([]types.Hash32, 32),
// },
// Challenge: types.RandomHash(),
// Posts: []SubPostV2{
// {
// MarriageIndex: rand.Uint32N(256),
// PrevATXIndex: 0,
// Post: PostV1{
// Nonce: 0,
// Indices: make([]byte, 800),
// Pow: 0,
// },
// },
// },
// },
// },
// }
// for _, opt := range opts {
// opt(atx)
// }
// return atx
// }

func Benchmark_ATXv2ID(b *testing.B) {
f := fuzz.New()
Expand Down

0 comments on commit 1d8d310

Please sign in to comment.