github.com/MetalBlockchain/subnet-evm@v0.4.9/tests/precompile/solidity/suites.go (about)

     1  // Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  // Implements solidity tests.
     5  package solidity
     6  
     7  import (
     8  	"context"
     9  	"time"
    10  
    11  	"github.com/MetalBlockchain/metalgo/api/health"
    12  	"github.com/MetalBlockchain/subnet-evm/tests/utils"
    13  	ginkgo "github.com/onsi/ginkgo/v2"
    14  	"github.com/onsi/gomega"
    15  )
    16  
    17  var _ = ginkgo.Describe("[Precompiles]", ginkgo.Ordered, func() {
    18  	ginkgo.It("ping the network", ginkgo.Label("setup"), func() {
    19  		client := health.NewClient(utils.DefaultLocalNodeURI)
    20  		healthy, err := client.Readiness(context.Background())
    21  		gomega.Expect(err).Should(gomega.BeNil())
    22  		gomega.Expect(healthy.Healthy).Should(gomega.BeTrue())
    23  	})
    24  })
    25  
    26  var _ = ginkgo.Describe("[Precompiles]", ginkgo.Ordered, func() {
    27  	// Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/)
    28  	// to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contract-examples/tests/)
    29  	ginkgo.It("contract native minter", ginkgo.Label("Precompile"), ginkgo.Label("ContractNativeMinter"), func() {
    30  		ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    31  		defer cancel()
    32  
    33  		utils.ExecuteHardHatTestOnNewBlockchain(ctx, "contract_native_minter")
    34  	})
    35  
    36  	ginkgo.It("tx allow list", ginkgo.Label("Precompile"), ginkgo.Label("TxAllowList"), func() {
    37  		ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    38  		defer cancel()
    39  
    40  		utils.ExecuteHardHatTestOnNewBlockchain(ctx, "tx_allow_list")
    41  	})
    42  
    43  	ginkgo.It("contract deployer allow list", ginkgo.Label("Precompile"), ginkgo.Label("ContractDeployerAllowList"), func() {
    44  		ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    45  		defer cancel()
    46  
    47  		utils.ExecuteHardHatTestOnNewBlockchain(ctx, "contract_deployer_allow_list")
    48  	})
    49  
    50  	ginkgo.It("fee manager", ginkgo.Label("Precompile"), ginkgo.Label("FeeManager"), func() {
    51  		ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    52  		defer cancel()
    53  
    54  		utils.ExecuteHardHatTestOnNewBlockchain(ctx, "fee_manager")
    55  	})
    56  
    57  	ginkgo.It("reward manager", ginkgo.Label("Precompile"), ginkgo.Label("RewardManager"), func() {
    58  		ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    59  		defer cancel()
    60  
    61  		utils.ExecuteHardHatTestOnNewBlockchain(ctx, "reward_manager")
    62  	})
    63  
    64  	// TODO: can we refactor this so that it automagically checks to ensure each hardhat test file matches the name of a hardhat genesis file
    65  	// and then runs the hardhat tests for each one without forcing precompile developers to modify this file.
    66  	// ADD YOUR PRECOMPILE HERE
    67  	/*
    68  		ginkgo.It("your precompile", ginkgo.Label("Precompile"), ginkgo.Label("YourPrecompile"), func() {
    69  			ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    70  			defer cancel()
    71  
    72  			// Specify the name shared by the genesis file in ./tests/precompile/genesis/{your_precompile}.json
    73  			// and the test file in ./contract-examples/tests/{your_precompile}.ts
    74  			utils.ExecuteHardHatTestOnNewBlockchain(ctx, "your_precompile")
    75  		})
    76  	*/
    77  })