Skip to content

Commit

Permalink
use solana chain from merged commits
Browse files Browse the repository at this point in the history
  • Loading branch information
brewmaster012 committed Jul 3, 2024
1 parent 152e237 commit df6412b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
13 changes: 9 additions & 4 deletions cmd/zetaclientd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions e2e/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func NewE2ERunner(
EVMAuth: evmAuth,
ZEVMAuth: zevmAuth,
BtcRPCClient: btcRPCClient,
SolanaClient: solanaClient,

Logger: logger,
}
Expand Down
4 changes: 1 addition & 3 deletions e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -373,7 +371,7 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(
_, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20(
addr.String(),
"",
solanaclient.LocalnetChainID,
chains.SolanaLocalnet.ChainId,
9,
"Solana",
"SOL",
Expand Down
6 changes: 0 additions & 6 deletions zetaclient/chains/solana/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
package solana

const (
LocalnetChainID = 28899
TestnetChainID = 18899
MainnetChainID = 8899
)
10 changes: 3 additions & 7 deletions zetaclient/chains/solana/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -51,8 +50,8 @@ var _ interfaces.ChainObserver = &Observer{}
func NewObserver(
appContext *clientcontext.AppContext,

Check failure on line 51 in zetaclient/chains/solana/observer/observer.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'appContext' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 51 in zetaclient/chains/solana/observer/observer.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'appContext' seems to be unused, consider removing or renaming it as _ (revive)
zetacoreClient interfaces.ZetacoreClient,
chainParams observertypes.ChainParams,
tss interfaces.TSSSigner,
programIdStr string,
dbpath string,

Check failure on line 55 in zetaclient/chains/solana/observer/observer.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'dbpath' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 55 in zetaclient/chains/solana/observer/observer.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'dbpath' seems to be unused, consider removing or renaming it as _ (revive)
ts *metrics.TelemetryServer,
) (*Observer, error) {
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit df6412b

Please sign in to comment.