diff --git a/engine/execution/block_result_test.go b/engine/execution/block_result_test.go index a96e3576728..3890f476e87 100644 --- a/engine/execution/block_result_test.go +++ b/engine/execution/block_result_test.go @@ -26,6 +26,8 @@ func makeBlockExecutionResultFixture(serviceEventsPerChunk []int) *BlockExecutio // Tests that ServiceEventCountForChunk method works as expected under various circumstances: func TestBlockExecutionResult_ServiceEventCountForChunk(t *testing.T) { + t.Parallel() + t.Run("no service events", func(t *testing.T) { nChunks := rand.Intn(10) + 1 // always contains at least system chunk blockResult := makeBlockExecutionResultFixture(make([]int, nChunks)) diff --git a/engine/execution/computation/execution_verification_test.go b/engine/execution/computation/execution_verification_test.go index 21500d43a4d..7aef67b3d1f 100644 --- a/engine/execution/computation/execution_verification_test.go +++ b/engine/execution/computation/execution_verification_test.go @@ -56,6 +56,9 @@ var chain = flow.Emulator.Chain() // This is not relevant to the test, as only the non-system transactions are tested. func Test_ExecutionMatchesVerification(t *testing.T) { + + t.Parallel() + t.Run("empty block", func(t *testing.T) { executeBlockAndVerify(t, [][]*flow.TransactionBody{}, @@ -339,6 +342,7 @@ func Test_ExecutionMatchesVerification(t *testing.T) { } func TestTransactionFeeDeduction(t *testing.T) { + t.Parallel() type testCase struct { name string diff --git a/engine/execution/computation/manager_test.go b/engine/execution/computation/manager_test.go index b265f94268d..c5a5f885b8d 100644 --- a/engine/execution/computation/manager_test.go +++ b/engine/execution/computation/manager_test.go @@ -51,6 +51,8 @@ import ( var scriptLogThreshold = 1 * time.Second func TestComputeBlockWithStorage(t *testing.T) { + t.Parallel() + chain := flow.Mainnet.Chain() vm := fvm.NewVirtualMachine() @@ -180,6 +182,7 @@ func TestComputeBlockWithStorage(t *testing.T) { } func TestComputeBlock_Uploader(t *testing.T) { + t.Parallel() noopCollector := &metrics.NoopCollector{} @@ -230,6 +233,7 @@ func TestComputeBlock_Uploader(t *testing.T) { } func TestExecuteScript(t *testing.T) { + t.Parallel() logger := zerolog.Nop() @@ -296,6 +300,7 @@ func TestExecuteScript(t *testing.T) { // Balance script used to swallow errors, which meant that even if the view was empty, a script that did nothing but get // the balance of an account would succeed and return 0. func TestExecuteScript_BalanceScriptFailsIfViewIsEmpty(t *testing.T) { + t.Parallel() logger := zerolog.Nop() @@ -361,6 +366,7 @@ func TestExecuteScript_BalanceScriptFailsIfViewIsEmpty(t *testing.T) { } func TestExecuteScripPanicsAreHandled(t *testing.T) { + t.Parallel() ctx := fvm.NewContext() @@ -411,6 +417,7 @@ func TestExecuteScripPanicsAreHandled(t *testing.T) { } func TestExecuteScript_LongScriptsAreLogged(t *testing.T) { + t.Parallel() ctx := fvm.NewContext() @@ -464,6 +471,7 @@ func TestExecuteScript_LongScriptsAreLogged(t *testing.T) { } func TestExecuteScript_ShortScriptsAreNotLogged(t *testing.T) { + t.Parallel() ctx := fvm.NewContext() @@ -647,6 +655,7 @@ func (f *FakeBlockComputer) ExecuteBlock( } func TestExecuteScriptTimeout(t *testing.T) { + t.Parallel() timeout := 1 * time.Millisecond manager, err := New( @@ -694,6 +703,7 @@ func TestExecuteScriptTimeout(t *testing.T) { } func TestExecuteScriptCancelled(t *testing.T) { + t.Parallel() timeout := 30 * time.Second manager, err := New( @@ -750,6 +760,7 @@ func TestExecuteScriptCancelled(t *testing.T) { } func Test_EventEncodingFailsOnlyTxAndCarriesOn(t *testing.T) { + t.Parallel() chain := flow.Mainnet.Chain() vm := fvm.NewVirtualMachine() @@ -908,6 +919,7 @@ func (e *testingEventEncoder) Encode(event cadence.Event) ([]byte, error) { } func TestScriptStorageMutationsDiscarded(t *testing.T) { + t.Parallel() timeout := 10 * time.Second chain := flow.Mainnet.Chain() diff --git a/engine/execution/computation/programs_test.go b/engine/execution/computation/programs_test.go index b8dc91a6c2c..883775b6241 100644 --- a/engine/execution/computation/programs_test.go +++ b/engine/execution/computation/programs_test.go @@ -40,6 +40,8 @@ const ( ) func TestPrograms_TestContractUpdates(t *testing.T) { + t.Parallel() + chain := flow.Mainnet.Chain() vm := fvm.NewVirtualMachine() execCtx := fvm.NewContext(fvm.WithChain(chain)) @@ -215,6 +217,8 @@ func (b blockProvider) ByHeightFrom(height uint64, _ *flow.Header) (*flow.Header // -> Block121 (emit event - version should be 2) // -> Block1211 (emit event - version should be 2) func TestPrograms_TestBlockForks(t *testing.T) { + t.Parallel() + block := unittest.BlockFixture() chain := flow.Emulator.Chain() vm := fvm.NewVirtualMachine() diff --git a/engine/execution/execution_test.go b/engine/execution/execution_test.go index 10b3e4d97ca..065a0c0a64e 100644 --- a/engine/execution/execution_test.go +++ b/engine/execution/execution_test.go @@ -38,6 +38,8 @@ func sendBlock(exeNode *testmock.ExecutionNode, from flow.Identifier, proposal * // create another child block which will trigger the parent // block to be incorporated and be passed to the ingestion engine func TestExecutionFlow(t *testing.T) { + t.Parallel() + hub := stub.NewNetworkHub() chainID := flow.Testnet @@ -383,6 +385,8 @@ func makeSuccessBlock(t *testing.T, conID *flow.Identity, colID *flow.Identity, // Test a successful tx should change the statecommitment, // but a failed Tx should not change the statecommitment. func TestFailedTxWillNotChangeStateCommitment(t *testing.T) { + t.Parallel() + hub := stub.NewNetworkHub() chainID := flow.Emulator @@ -547,6 +551,8 @@ func mockCollectionEngineToReturnCollections(t *testing.T, collectionNode *testm // Test the receipt will be sent to multiple verification nodes func TestBroadcastToMultipleVerificationNodes(t *testing.T) { + t.Parallel() + hub := stub.NewNetworkHub() chainID := flow.Emulator diff --git a/fvm/accounts_test.go b/fvm/accounts_test.go index 0746f505efc..86179587b4b 100644 --- a/fvm/accounts_test.go +++ b/fvm/accounts_test.go @@ -360,6 +360,8 @@ func newAccountKey( func TestCreateAccount(t *testing.T) { + t.Parallel() + options := []fvm.Option{ fvm.WithAuthorizationChecksEnabled(false), fvm.WithSequenceNumberCheckAndIncrementEnabled(false), @@ -469,6 +471,8 @@ func TestCreateAccount(t *testing.T) { func TestCreateAccount_WithRestrictedAccountCreation(t *testing.T) { + t.Parallel() + options := []fvm.Option{ fvm.WithAuthorizationChecksEnabled(false), fvm.WithSequenceNumberCheckAndIncrementEnabled(false), @@ -614,6 +618,8 @@ func TestCreateAccount_WithRestrictedAccountCreation(t *testing.T) { func TestAddAccountKey(t *testing.T) { + t.Parallel() + options := []fvm.Option{ fvm.WithAuthorizationChecksEnabled(false), fvm.WithSequenceNumberCheckAndIncrementEnabled(false), @@ -932,6 +938,8 @@ func TestAddAccountKey(t *testing.T) { func TestRemoveAccountKey(t *testing.T) { + t.Parallel() + options := []fvm.Option{ fvm.WithAuthorizationChecksEnabled(false), fvm.WithSequenceNumberCheckAndIncrementEnabled(false), @@ -1211,6 +1219,8 @@ func TestRemoveAccountKey(t *testing.T) { func TestGetAccountKey(t *testing.T) { + t.Parallel() + options := []fvm.Option{ fvm.WithAuthorizationChecksEnabled(false), fvm.WithSequenceNumberCheckAndIncrementEnabled(false), @@ -1483,6 +1493,9 @@ func byteSliceToCadenceArrayLiteral(bytes []byte) string { } func TestAccountBalanceFields(t *testing.T) { + + t.Parallel() + t.Run("Get balance works", newVMTest().withContextOptions( fvm.WithAuthorizationChecksEnabled(false), @@ -1725,6 +1738,9 @@ func TestAccountBalanceFields(t *testing.T) { } func TestGetStorageCapacity(t *testing.T) { + + t.Parallel() + t.Run("Get storage capacity", newVMTest().withContextOptions( fvm.WithAuthorizationChecksEnabled(false), diff --git a/fvm/environment/programs_test.go b/fvm/environment/programs_test.go index 57ce7ee4b7c..092fb22b043 100644 --- a/fvm/environment/programs_test.go +++ b/fvm/environment/programs_test.go @@ -147,6 +147,8 @@ func getTestContract( } func Test_Programs(t *testing.T) { + t.Parallel() + vm := fvm.NewVirtualMachine() derivedBlockData := derived.NewEmptyDerivedBlockData(0) diff --git a/fvm/fvm_blockcontext_test.go b/fvm/fvm_blockcontext_test.go index 4974acc22b9..90ed8045470 100644 --- a/fvm/fvm_blockcontext_test.go +++ b/fvm/fvm_blockcontext_test.go @@ -1751,6 +1751,8 @@ func TestBlockContext_GetAccount(t *testing.T) { } func TestBlockContext_Random(t *testing.T) { + t.Parallel() + chain, vm := createChainAndVm(flow.Mainnet) header := &flow.Header{HeaderBody: flow.HeaderBody{Height: 42}} source := testutil.EntropyProviderFixture(nil) @@ -1906,6 +1908,8 @@ func TestBlockContext_ExecuteTransaction_CreateAccount_WithMonotonicAddresses(t } func TestBlockContext_ExecuteTransaction_FailingTransactions(t *testing.T) { + t.Parallel() + getBalance := func( vm fvm.VM, chain flow.Chain, diff --git a/fvm/fvm_test.go b/fvm/fvm_test.go index c5939f6a27b..57f159d94a9 100644 --- a/fvm/fvm_test.go +++ b/fvm/fvm_test.go @@ -474,6 +474,8 @@ func TestWithServiceAccount(t *testing.T) { } func TestEventLimits(t *testing.T) { + t.Parallel() + chain, vm := createChainAndVm(flow.Mainnet) ctx := fvm.NewContext( @@ -579,6 +581,7 @@ func TestEventLimits(t *testing.T) { // TestHappyPathSigning checks that a signing a transaction with `Sign` doesn't produce an error. // Transaction verification tests are in `TestVerifySignatureFromTransaction`. func TestHappyPathTransactionSigning(t *testing.T) { + t.Parallel() newVMTest().run( func(t *testing.T, vm fvm.VM, chain flow.Chain, ctx fvm.Context, snapshotTree snapshot.SnapshotTree) { @@ -620,6 +623,8 @@ func TestHappyPathTransactionSigning(t *testing.T) { } func TestTransactionFeeDeduction(t *testing.T) { + t.Parallel() + getBalance := func(vm fvm.VM, chain flow.Chain, ctx fvm.Context, snapshotTree snapshot.SnapshotTree, address flow.Address) uint64 { sc := systemcontracts.SystemContractsForChain(chain.ChainID()) code := []byte(fmt.Sprintf( @@ -1098,6 +1103,7 @@ func TestTransactionFeeDeduction(t *testing.T) { } func TestSettingExecutionWeights(t *testing.T) { + t.Parallel() // change the chain so that the metering settings are read from the service account chain := flow.Emulator.Chain() @@ -1837,6 +1843,8 @@ func TestEnforcingComputationLimit(t *testing.T) { } func TestStorageCapacity(t *testing.T) { + t.Parallel() + t.Run("Storage capacity updates on FLOW transfer", newVMTest(). withContextOptions( fvm.WithAuthorizationChecksEnabled(false), @@ -2328,6 +2336,9 @@ func TestScriptExecutionLimit(t *testing.T) { } func TestInteractionLimit(t *testing.T) { + + t.Parallel() + type testCase struct { name string interactionLimit uint64 @@ -2497,6 +2508,7 @@ func TestInteractionLimit(t *testing.T) { } func TestAttachments(t *testing.T) { + t.Parallel() newVMTest(). withBootstrapProcedureOptions(). @@ -2531,6 +2543,8 @@ func TestAttachments(t *testing.T) { } func TestCapabilityControllers(t *testing.T) { + t.Parallel() + test := func(t *testing.T) { newVMTest(). withBootstrapProcedureOptions(). @@ -2800,6 +2814,8 @@ func TestStorageIterationWithBrokenValues(t *testing.T) { } func TestEntropyCallOnlyOkIfAllowed(t *testing.T) { + t.Parallel() + source := testutil.EntropyProviderFixture(nil) test := func(t *testing.T, allowed bool) { @@ -2859,6 +2875,8 @@ func TestEntropyCallOnlyOkIfAllowed(t *testing.T) { } func TestEntropyCallExpectsNoParameters(t *testing.T) { + t.Parallel() + source := testutil.EntropyProviderFixture(nil) newVMTest(). withBootstrapProcedureOptions(). @@ -2902,6 +2920,7 @@ func TestEntropyCallExpectsNoParameters(t *testing.T) { } func TestTransientNetworkCoreContractAddresses(t *testing.T) { + t.Parallel() // This test ensures that the transient networks have the correct core contract addresses. newVMTest(). @@ -2927,6 +2946,8 @@ func TestTransientNetworkCoreContractAddresses(t *testing.T) { } func TestFlowCallbackScheduler(t *testing.T) { + t.Parallel() + ctxOpts := []fvm.Option{ fvm.WithScheduleCallbacksEnabled(true), } @@ -2975,6 +2996,8 @@ func TestFlowCallbackScheduler(t *testing.T) { } func TestEVM(t *testing.T) { + t.Parallel() + blocks := new(envMock.Blocks) block1 := unittest.BlockFixture() blocks.On("ByHeightFrom", @@ -3244,6 +3267,8 @@ func TestEVM(t *testing.T) { } func TestVMBridge(t *testing.T) { + t.Parallel() + blocks := new(envMock.Blocks) block1 := unittest.BlockFixture() blocks.On("ByHeightFrom", @@ -3812,6 +3837,7 @@ func TestVMBridge(t *testing.T) { } func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) { + t.Parallel() // Note: This cannot be tested anymore using a transaction, // because publish method also aborts when trying to publish an entitled capability. @@ -3874,6 +3900,7 @@ func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) { } func TestAccountCapabilitiesPublishEntitledRejection(t *testing.T) { + t.Parallel() t.Run("entitled capability", newVMTest(). run(func( @@ -4131,6 +4158,7 @@ func TestCrypto(t *testing.T) { } func Test_BlockHashListShouldWriteOnPush(t *testing.T) { + t.Parallel() chain := flow.Emulator.Chain() sc := systemcontracts.SystemContractsForChain(chain.ChainID()) diff --git a/fvm/transactionVerifier_test.go b/fvm/transactionVerifier_test.go index 7d222bac013..e1b5aba4808 100644 --- a/fvm/transactionVerifier_test.go +++ b/fvm/transactionVerifier_test.go @@ -17,6 +17,8 @@ import ( ) func TestTransactionVerification(t *testing.T) { + t.Parallel() + txnState := testutils.NewSimpleTransaction(nil) accounts := environment.NewAccounts(txnState)