Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Oct 9, 2024
1 parent a7a88de commit 52ab7f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions activation/handler_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ func Test_CalculatingUnits(t *testing.T) {

func TestContextual_PreviousATX(t *testing.T) {
golden := types.RandomATXID()
atxHndlr := newV2TestHandler(t, golden)
atxHdlr := newV2TestHandler(t, golden)
var (
signers []*signing.EdSigner
eqSet []types.NodeID
Expand All @@ -1909,13 +1909,13 @@ func TestContextual_PreviousATX(t *testing.T) {
eqSet = append(eqSet, sig.NodeID())
}

mATX, otherAtxs := marryIDs(t, atxHndlr, signers, golden)
mATX, otherAtxs := marryIDs(t, atxHdlr, signers, golden)

// signer 1 creates a solo ATX
soloAtx := newSoloATXv2(t, mATX.PublishEpoch+1, otherAtxs[0].ID(), mATX.ID())
soloAtx.Sign(signers[1])
atxHndlr.expectAtxV2(soloAtx)
err := atxHndlr.processATX(context.Background(), "", soloAtx, time.Now())
atxHdlr.expectAtxV2(soloAtx)
err := atxHdlr.processATX(context.Background(), "", soloAtx, time.Now())
require.NoError(t, err)

// create a MergedATX for all IDs
Expand All @@ -1933,9 +1933,9 @@ func TestContextual_PreviousATX(t *testing.T) {
merged.MarriageATX = &matxID
merged.Sign(signers[0])

atxHndlr.expectMergedAtxV2(merged, eqSet, []uint64{100})
atxHndlr.mMalPublish.EXPECT().Publish(gomock.Any(), signers[1].NodeID(), gomock.Any())
err = atxHndlr.processATX(context.Background(), "", merged, time.Now())
atxHdlr.expectMergedAtxV2(merged, eqSet, []uint64{100})
atxHdlr.mMalPublish.EXPECT().Publish(gomock.Any(), signers[1].NodeID(), gomock.Any())
err = atxHdlr.processATX(context.Background(), "", merged, time.Now())
require.NoError(t, err)
}

Expand Down
4 changes: 2 additions & 2 deletions activation/wire/malfeasance_double_marry.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewDoubleMarryProof(db sql.Executor, atx1, atx2 *ActivationTxV2, nodeID typ
func createMarryProof(db sql.Executor, atx *ActivationTxV2, nodeID types.NodeID) (MarryProof, error) {
marriageProof, err := marriageProof(atx)
if err != nil {
return MarryProof{}, fmt.Errorf("failed to create proof for ATX 1: %w", err)
return MarryProof{}, fmt.Errorf("create proof for ATX: %w", err)
}

marriageIndex := slices.IndexFunc(atx.Marriages, func(cert MarriageCertificate) bool {
Expand All @@ -77,7 +77,7 @@ func createMarryProof(db sql.Executor, atx *ActivationTxV2, nodeID types.NodeID)
}
certProof, err := certificateProof(atx.Marriages, uint64(marriageIndex))
if err != nil {
return MarryProof{}, fmt.Errorf("failed to create certificate proof for ATX 1: %w", err)
return MarryProof{}, fmt.Errorf("create certificate proof for ATX: %w", err)
}

proof := MarryProof{
Expand Down
6 changes: 3 additions & 3 deletions activation/wire/wire_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ func (atx *ActivationTxV2) TotalNumUnits() uint32 {
type MarriageCertificates []MarriageCertificate

func (mcs MarriageCertificates) Root() []byte {
marriagesTree, err := merkle.NewTreeBuilder().
tree, err := merkle.NewTreeBuilder().
WithHashFunc(atxTreeHash).
Build()
if err != nil {
panic(err)
}
mcs.merkleTree(marriagesTree)
return marriagesTree.Root()
mcs.merkleTree(tree)
return tree.Root()
}

func (mcs MarriageCertificates) merkleTree(tree *merkle.Tree) {
Expand Down

0 comments on commit 52ab7f9

Please sign in to comment.