Skip to content

Commit

Permalink
Fix block serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm50 committed Aug 4, 2023
1 parent b2ba86b commit 7edc0d5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/iotaledger/hive.go/lo"
"github.com/iotaledger/hive.go/serializer/v2"
"github.com/iotaledger/hive.go/serializer/v2/serix"
"github.com/iotaledger/iota-core/pkg/model"
iotago "github.com/iotaledger/iota.go/v4"
"github.com/iotaledger/iota.go/v4/api"
"github.com/iotaledger/iota.go/v4/builder"
Expand Down Expand Up @@ -52,16 +51,16 @@ func TestBlock_DeSerialize(t *testing.T) {
}

func createBlockAtSlotWithVersion(t *testing.T, index iotago.SlotIndex, version iotago.Version, apiProvider *api.EpochBasedProvider) error {

Check failure on line 53 in block_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] block_test.go#L53

test helper function should start from t.Helper() (thelper)
Raw output
block_test.go:53:6: test helper function should start from t.Helper() (thelper)
func createBlockAtSlotWithVersion(t *testing.T, index iotago.SlotIndex, version iotago.Version, apiProvider *api.EpochBasedProvider) error {
     ^
api := apiProvider.APIForSlot(index)
block, err := builder.NewBasicBlockBuilder(api).
apiForSlot := apiProvider.APIForSlot(index)
block, err := builder.NewBasicBlockBuilder(apiForSlot).
ProtocolVersion(version).
StrongParents(iotago.BlockIDs{iotago.BlockID{}}).
IssuingTime(api.TimeProvider().SlotStartTime(index)).
SlotCommitmentID(iotago.NewCommitment(api.Version(), index-api.ProtocolParameters().MinCommittableAge(), iotago.CommitmentID{}, iotago.Identifier{}, 0).MustID()).
IssuingTime(apiForSlot.TimeProvider().SlotStartTime(index)).
SlotCommitmentID(iotago.NewCommitment(apiForSlot.Version(), index-apiForSlot.ProtocolParameters().MinCommittableAge(), iotago.CommitmentID{}, iotago.Identifier{}, 0).MustID()).
Build()
require.NoError(t, err)

return lo.Return2(model.BlockFromBlock(block, api, serix.WithValidation()))
return lo.Return2(apiForSlot.Encode(block, serix.WithValidation()))
}

func TestProtocolBlock_ProtocolVersionSyntactical(t *testing.T) {
Expand Down

0 comments on commit 7edc0d5

Please sign in to comment.