diff --git a/engine/execution/computation/computer/computer_test.go b/engine/execution/computation/computer/computer_test.go index 6fc1a7f010d..8f74d211ffb 100644 --- a/engine/execution/computation/computer/computer_test.go +++ b/engine/execution/computation/computer/computer_test.go @@ -39,7 +39,6 @@ import ( "github.com/onflow/flow-go/fvm/storage/testutils" "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/ledger" - "github.com/onflow/flow-go/model/convert/fixtures" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/epochs" "github.com/onflow/flow-go/module/executiondatasync/execution_data" @@ -553,7 +552,7 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) { serviceEvents, err := systemcontracts.ServiceEventsForChain(execCtx.Chain.ChainID()) require.NoError(t, err) - payload, err := json.Decode(nil, []byte(fixtures.EpochSetupFixtureJSON)) + payload, err := json.Decode(nil, []byte(unittest.EpochSetupFixtureJSON)) require.NoError(t, err) serviceEventA, ok := payload.(cadence.Event) @@ -564,7 +563,7 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) { } serviceEventA.EventType.QualifiedIdentifier = serviceEvents.EpochSetup.QualifiedIdentifier() - payload, err = json.Decode(nil, []byte(fixtures.EpochCommitFixtureJSON)) + payload, err = json.Decode(nil, []byte(unittest.EpochCommitFixtureJSON)) require.NoError(t, err) serviceEventB, ok := payload.(cadence.Event) diff --git a/model/convert/service_event_test.go b/model/convert/service_event_test.go index f1a77fc43b4..0a14a0be7d5 100644 --- a/model/convert/service_event_test.go +++ b/model/convert/service_event_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" "github.com/onflow/flow-go/model/convert" - "github.com/onflow/flow-go/model/convert/fixtures" "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/utils/unittest" ) func TestEventConversion(t *testing.T) { @@ -17,7 +17,7 @@ func TestEventConversion(t *testing.T) { t.Run("epoch setup", func(t *testing.T) { - fixture, expected := fixtures.EpochSetupFixtureByChainID(chainID) + fixture, expected := unittest.EpochSetupFixtureByChainID(chainID) // convert Cadence types to Go types event, err := convert.ServiceEvent(chainID, fixture) @@ -34,7 +34,7 @@ func TestEventConversion(t *testing.T) { t.Run("epoch commit", func(t *testing.T) { - fixture, expected := fixtures.EpochCommitFixtureByChainID(chainID) + fixture, expected := unittest.EpochCommitFixtureByChainID(chainID) // convert Cadence types to Go types event, err := convert.ServiceEvent(chainID, fixture) diff --git a/module/chunks/chunkVerifier_test.go b/module/chunks/chunkVerifier_test.go index 17e3557cd19..a96e152e345 100644 --- a/module/chunks/chunkVerifier_test.go +++ b/module/chunks/chunkVerifier_test.go @@ -21,7 +21,6 @@ import ( "github.com/onflow/flow-go/ledger/complete/wal/fixtures" chunksmodels "github.com/onflow/flow-go/model/chunks" "github.com/onflow/flow-go/model/convert" - convertfixtures "github.com/onflow/flow-go/model/convert/fixtures" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/model/verification" "github.com/onflow/flow-go/module/chunks" @@ -48,8 +47,8 @@ var eventsList = flow.EventsList{ // the chain we use for this test suite var testChain = flow.Emulator -var epochSetupEvent, _ = convertfixtures.EpochSetupFixtureByChainID(testChain) -var epochCommitEvent, _ = convertfixtures.EpochCommitFixtureByChainID(testChain) +var epochSetupEvent, _ = unittest.EpochSetupFixtureByChainID(testChain) +var epochCommitEvent, _ = unittest.EpochCommitFixtureByChainID(testChain) var epochSetupServiceEvent, _ = convert.ServiceEvent(testChain, epochSetupEvent) var epochCommitServiceEvent, _ = convert.ServiceEvent(testChain, epochCommitEvent) diff --git a/model/convert/fixtures/fixture.go b/utils/unittest/service_events_fixtures.go similarity index 90% rename from model/convert/fixtures/fixture.go rename to utils/unittest/service_events_fixtures.go index 75b6eb9a982..0f56bb4316c 100644 --- a/model/convert/fixtures/fixture.go +++ b/utils/unittest/service_events_fixtures.go @@ -1,10 +1,9 @@ -package fixtures +package unittest import ( "github.com/onflow/flow-go/crypto" "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/model/flow" - "github.com/onflow/flow-go/utils/unittest" ) // This file contains service event fixtures for testing purposes. @@ -18,7 +17,7 @@ func EpochSetupFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochSetu panic(err) } - event := unittest.EventFixture(events.EpochSetup.EventType(), 1, 1, unittest.IdentifierFixture(), 0) + event := EventFixture(events.EpochSetup.EventType(), 1, 1, IdentifierFixture(), 0) event.Payload = []byte(EpochSetupFixtureJSON) // randomSource is [0,0,...,1,2,3,4] @@ -50,56 +49,56 @@ func EpochSetupFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochSetu Role: flow.RoleCollection, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000001"), Address: "1.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), Weight: 100, }, { Role: flow.RoleCollection, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000002"), Address: "2.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), Weight: 100, }, { Role: flow.RoleCollection, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000003"), Address: "3.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), Weight: 100, }, { Role: flow.RoleCollection, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000004"), Address: "4.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"), Weight: 100, }, { Role: flow.RoleConsensus, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000011"), Address: "11.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "cfdfe8e4362c8f79d11772cb7277ab16e5033a63e8dd5d34caf1b041b77e5b2d63c2072260949ccf8907486e4cfc733c8c42ca0e4e208f30470b0d950856cd47"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "8207559cd7136af378bba53a8f0196dee3849a3ab02897c1995c3e3f6ca0c4a776c3ae869d1ddbb473090054be2400ad06d7910aa2c5d1780220fdf3765a3c1764bce10c6fe66a5a2be51a422e878518bd750424bb56b8a0ecf0f8ad2057e83f"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "cfdfe8e4362c8f79d11772cb7277ab16e5033a63e8dd5d34caf1b041b77e5b2d63c2072260949ccf8907486e4cfc733c8c42ca0e4e208f30470b0d950856cd47"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "8207559cd7136af378bba53a8f0196dee3849a3ab02897c1995c3e3f6ca0c4a776c3ae869d1ddbb473090054be2400ad06d7910aa2c5d1780220fdf3765a3c1764bce10c6fe66a5a2be51a422e878518bd750424bb56b8a0ecf0f8ad2057e83f"), Weight: 100, }, { Role: flow.RoleExecution, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000021"), Address: "21.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "d64318ba0dbf68f3788fc81c41d507c5822bf53154530673127c66f50fe4469ccf1a054a868a9f88506a8999f2386d86fcd2b901779718cba4fb53c2da258f9e"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "880b162b7ec138b36af401d07868cb08d25746d905395edbb4625bdf105d4bb2b2f4b0f4ae273a296a6efefa7ce9ccb914e39947ce0e83745125cab05d62516076ff0173ed472d3791ccef937597c9ea12381d76f547a092a4981d77ff3fba83"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "d64318ba0dbf68f3788fc81c41d507c5822bf53154530673127c66f50fe4469ccf1a054a868a9f88506a8999f2386d86fcd2b901779718cba4fb53c2da258f9e"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "880b162b7ec138b36af401d07868cb08d25746d905395edbb4625bdf105d4bb2b2f4b0f4ae273a296a6efefa7ce9ccb914e39947ce0e83745125cab05d62516076ff0173ed472d3791ccef937597c9ea12381d76f547a092a4981d77ff3fba83"), Weight: 100, }, { Role: flow.RoleVerification, NodeID: flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000031"), Address: "31.flow.com", - NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "697241208dcc9142b6f53064adc8ff1c95760c68beb2ba083c1d005d40181fd7a1b113274e0163c053a3addd47cd528ec6a1f190cf465aac87c415feaae011ae"), - StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "b1f97d0a06020eca97352e1adde72270ee713c7daf58da7e74bf72235321048b4841bdfc28227964bf18e371e266e32107d238358848bcc5d0977a0db4bda0b4c33d3874ff991e595e0f537c7b87b4ddce92038ebc7b295c9ea20a1492302aa7"), + NetworkPubKey: MustDecodePublicKeyHex(crypto.ECDSAP256, "697241208dcc9142b6f53064adc8ff1c95760c68beb2ba083c1d005d40181fd7a1b113274e0163c053a3addd47cd528ec6a1f190cf465aac87c415feaae011ae"), + StakingPubKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "b1f97d0a06020eca97352e1adde72270ee713c7daf58da7e74bf72235321048b4841bdfc28227964bf18e371e266e32107d238358848bcc5d0977a0db4bda0b4c33d3874ff991e595e0f537c7b87b4ddce92038ebc7b295c9ea20a1492302aa7"), Weight: 100, }, }, @@ -117,7 +116,7 @@ func EpochCommitFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochCom panic(err) } - event := unittest.EventFixture(events.EpochCommit.EventType(), 1, 1, unittest.IdentifierFixture(), 0) + event := EventFixture(events.EpochCommit.EventType(), 1, 1, IdentifierFixture(), 0) event.Payload = []byte(EpochCommitFixtureJSON) expected := &flow.EpochCommit{ @@ -128,19 +127,19 @@ func EpochCommitFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochCom flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000001"), flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000002"), }, - SigData: unittest.MustDecodeSignatureHex("b072ed22ed305acd44818a6c836e09b4e844eebde6a4fdbf5cec983e2872b86c8b0f6c34c0777bf52e385ab7c45dc55d"), + SigData: MustDecodeSignatureHex("b072ed22ed305acd44818a6c836e09b4e844eebde6a4fdbf5cec983e2872b86c8b0f6c34c0777bf52e385ab7c45dc55d"), }, { VoterIDs: []flow.Identifier{ flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000003"), flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000004"), }, - SigData: unittest.MustDecodeSignatureHex("899e266a543e1b3a564f68b22f7be571f2e944ec30fadc4b39e2d5f526ba044c0f3cb2648f8334fc216fa3360a0418b2"), + SigData: MustDecodeSignatureHex("899e266a543e1b3a564f68b22f7be571f2e944ec30fadc4b39e2d5f526ba044c0f3cb2648f8334fc216fa3360a0418b2"), }, }, - DKGGroupKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "8c588266db5f5cda629e83f8aa04ae9413593fac19e4865d06d291c9d14fbdd9bdb86a7a12f9ef8590c79cb635e3163315d193087e9336092987150d0cd2b14ac6365f7dc93eec573752108b8c12368abb65f0652d9f644e5aed611c37926950"), + DKGGroupKey: MustDecodePublicKeyHex(crypto.BLSBLS12381, "8c588266db5f5cda629e83f8aa04ae9413593fac19e4865d06d291c9d14fbdd9bdb86a7a12f9ef8590c79cb635e3163315d193087e9336092987150d0cd2b14ac6365f7dc93eec573752108b8c12368abb65f0652d9f644e5aed611c37926950"), DKGParticipantKeys: []crypto.PublicKey{ - unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "87a339e4e5c74f089da20a33f515d8c8f4464ab53ede5a74aa2432cd1ae66d522da0c122249ee176cd747ddc83ca81090498389384201614caf51eac392c1c0a916dfdcfbbdf7363f9552b6468434add3d3f6dc91a92bbe3ee368b59b7828488"), + MustDecodePublicKeyHex(crypto.BLSBLS12381, "87a339e4e5c74f089da20a33f515d8c8f4464ab53ede5a74aa2432cd1ae66d522da0c122249ee176cd747ddc83ca81090498389384201614caf51eac392c1c0a916dfdcfbbdf7363f9552b6468434add3d3f6dc91a92bbe3ee368b59b7828488"), }, }