diff --git a/cmd/zetaclientd/utils.go b/cmd/zetaclientd/utils.go index 70752db4a5..06dd645edd 100644 --- a/cmd/zetaclientd/utils.go +++ b/cmd/zetaclientd/utils.go @@ -6,6 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" + "github.com/zeta-chain/zetacore/pkg/chains" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/authz" "github.com/zeta-chain/zetacore/zetaclient/chains/base" @@ -15,7 +17,6 @@ import ( evmobserver "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer" evmsigner "github.com/zeta-chain/zetacore/zetaclient/chains/evm/signer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - "github.com/zeta-chain/zetacore/zetaclient/chains/solana" solanaobserver "github.com/zeta-chain/zetacore/zetaclient/chains/solana/observer" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" @@ -193,13 +194,17 @@ func CreateChainObserverMap( } // TODO: config this - programId := "94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d" - co, err := solanaobserver.NewObserver(appContext, zetacoreClient, tss, programId, dbpath, ts) + solChainParams := observertypes.ChainParams{ + GatewayAddress: "94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d", + IsSupported: true, + ChainId: chains.SolanaLocalnet.ChainId, + } + co, err := solanaobserver.NewObserver(appContext, zetacoreClient, solChainParams, tss, dbpath, ts) if err != nil { logger.Std.Error().Err(err).Msg("NewObserver error for solana chain") } else { // TODO: config this - observerMap[solana.LocalnetChainID] = co + observerMap[solChainParams.ChainId] = co } return observerMap, nil diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index b8c7d2910c..99c67c9b1a 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -168,6 +168,7 @@ func NewE2ERunner( EVMAuth: evmAuth, ZEVMAuth: zevmAuth, BtcRPCClient: btcRPCClient, + SolanaClient: solanaClient, Logger: logger, } diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index 9949bfb511..6d4e1d876e 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -36,8 +36,6 @@ import ( "github.com/evmos/ethermint/crypto/hd" etherminttypes "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" - solanaclient "github.com/zeta-chain/zetacore/zetaclient/chains/solana" - "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/pkg/chains" @@ -373,7 +371,7 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20( _, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( addr.String(), "", - solanaclient.LocalnetChainID, + chains.SolanaLocalnet.ChainId, 9, "Solana", "SOL", diff --git a/zetaclient/chains/solana/constants.go b/zetaclient/chains/solana/constants.go index ddd188ff90..ef92f06771 100644 --- a/zetaclient/chains/solana/constants.go +++ b/zetaclient/chains/solana/constants.go @@ -1,7 +1 @@ package solana - -const ( - LocalnetChainID = 28899 - TestnetChainID = 18899 - MainnetChainID = 8899 -) diff --git a/zetaclient/chains/solana/observer/observer.go b/zetaclient/chains/solana/observer/observer.go index 7bd68cf13c..e8db121165 100644 --- a/zetaclient/chains/solana/observer/observer.go +++ b/zetaclient/chains/solana/observer/observer.go @@ -19,7 +19,6 @@ import ( "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - solanaclient "github.com/zeta-chain/zetacore/zetaclient/chains/solana" clientcontext "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" @@ -51,8 +50,8 @@ var _ interfaces.ChainObserver = &Observer{} func NewObserver( appContext *clientcontext.AppContext, zetacoreClient interfaces.ZetacoreClient, + chainParams observertypes.ChainParams, tss interfaces.TSSSigner, - programIdStr string, dbpath string, ts *metrics.TelemetryServer, ) (*Observer, error) { @@ -64,15 +63,12 @@ func NewObserver( ob.logger = logger //ob.coreContext = appContext.ZetacoreContext() - chainParams := observertypes.ChainParams{ - IsSupported: true, - } ob.chainParams = chainParams ob.stop = make(chan struct{}) ob.Mu = &sync.Mutex{} ob.zetacoreClient = zetacoreClient ob.Tss = tss - ob.programId = solana.MustPublicKeyFromBase58(programIdStr) + ob.programId = solana.MustPublicKeyFromBase58(chainParams.GatewayAddress) endpoint := "http://solana:8899" logger.Info().Msgf("Chain solana endpoint %s", endpoint) @@ -238,7 +234,7 @@ func (o *Observer) ObserveInbound() error { } msg := zetacore.GetInboundVoteMessage( accounts[0].String(), // check this--is this the signer? - solanaclient.LocalnetChainID, + o.chainParams.ChainId, accounts[0].String(), // check this--is this the signer? accounts[0].String(), // check this--is this the signer? o.zetacoreClient.Chain().ChainId,