Skip to content

Commit

Permalink
set verification flags in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Apr 10, 2024
1 parent 275ef98 commit 2b8711e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
if !skipSetup {
logger.Print("⚙️ setting up networks")
startTime := time.Now()

if err := deployerRunner.EnableVerificationFlags(); err != nil {
panic(err)
}

deployerRunner.SetupEVM(contractsDeployed, true)
deployerRunner.SetZEVMContracts()

Expand Down
7 changes: 7 additions & 0 deletions e2e/runner/setup_zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ func (runner *E2ERunner) SetupBTCZRC20() {
runner.BTCZRC20 = BTCZRC20
}

// EnableVerificationFlags enables the verification flags on ZetaChain
func (runner *E2ERunner) EnableVerificationFlags() error {
runner.Logger.Print("⚙️ enabling verification flags for block headers")

return runner.ZetaTxServer.EnableVerificationFlags(e2eutils.FungibleAdminName)
}

// FundEmissionsPool funds the emissions pool on ZetaChain with the same value as used originally on mainnet (20M ZETA)
func (runner *E2ERunner) FundEmissionsPool() error {
runner.Logger.Print("⚙️ funding the emissions pool on ZetaChain with 20M ZETA (%s)", txserver.EmissionsPoolAddress)
Expand Down
22 changes: 22 additions & 0 deletions e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types"
"math/big"
"os"
"strings"
Expand Down Expand Up @@ -192,6 +193,27 @@ func (zts ZetaTxServer) BroadcastTx(account string, msg sdktypes.Msg) (*sdktypes
return zts.clientCtx.BroadcastTx(txBytes)
}

// EnableVerificationFlags enables the verification flags for the lightclient module
func (zts ZetaTxServer) EnableVerificationFlags(account string) error {
// retrieve account
acc, err := zts.clientCtx.Keyring.Key(account)
if err != nil {
return err
}
addr, err := acc.GetAddress()
if err != nil {
return err
}

_, err = zts.BroadcastTx(account, lightclienttypes.NewMsgUpdateVerificationFlags(
addr.String(),
true,
true,
))

return err
}

// DeploySystemContractsAndZRC20 deploys the system contracts and ZRC20 contracts
// returns the addresses of uniswap factory, router and erc20 zrc20
func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, erc20Addr string) (string, string, string, string, string, error) {
Expand Down

0 comments on commit 2b8711e

Please sign in to comment.