diff --git a/changelog.md b/changelog.md index 9c482d64f9..d522fc869d 100644 --- a/changelog.md +++ b/changelog.md @@ -19,6 +19,7 @@ * [3206](https://github.com/zeta-chain/node/pull/3206) - skip Solana unsupported transaction version to not block inbound observation * [3184](https://github.com/zeta-chain/node/pull/3184) - zetaclient should not retry if inbound vote message validation fails * [3225](https://github.com/zeta-chain/node/pull/3225) - use separate database file names for btc signet and testnet4 +* [3253](https://github.com/zeta-chain/node/pull/3253) - fix solana inbound version 0 queries and move tss keysign prior to relayer key checking ## v23.0.0 diff --git a/zetaclient/chains/solana/observer/inbound_tracker.go b/zetaclient/chains/solana/observer/inbound_tracker.go index 19f8d26d04..2e26dd25cc 100644 --- a/zetaclient/chains/solana/observer/inbound_tracker.go +++ b/zetaclient/chains/solana/observer/inbound_tracker.go @@ -5,9 +5,9 @@ import ( "fmt" "github.com/gagliardetto/solana-go" - "github.com/gagliardetto/solana-go/rpc" "github.com/pkg/errors" + solanarpc "github.com/zeta-chain/node/zetaclient/chains/solana/rpc" zctx "github.com/zeta-chain/node/zetaclient/context" clienttypes "github.com/zeta-chain/node/zetaclient/types" ) @@ -61,10 +61,12 @@ func (ob *Observer) ProcessInboundTrackers(ctx context.Context) error { // process inbound trackers for _, tracker := range trackers { signature := solana.MustSignatureFromBase58(tracker.TxHash) - txResult, err := ob.solClient.GetTransaction(ctx, signature, &rpc.GetTransactionOpts{ - Commitment: rpc.CommitmentFinalized, - }) - if err != nil { + txResult, err := solanarpc.GetTransaction(ctx, ob.solClient, signature) + switch { + case errors.Is(err, solanarpc.ErrUnsupportedTxVersion): + ob.Logger().Inbound.Warn().Stringer("tx.signature", signature).Msg("skip inbound tracker hash") + continue + case err != nil: return errors.Wrapf(err, "error GetTransaction for chain %d sig %s", chainID, signature) } diff --git a/zetaclient/chains/solana/rpc/rpc.go b/zetaclient/chains/solana/rpc/rpc.go index f523011c0d..d9f306c8b5 100644 --- a/zetaclient/chains/solana/rpc/rpc.go +++ b/zetaclient/chains/solana/rpc/rpc.go @@ -85,12 +85,8 @@ func GetSignaturesForAddressUntil( var allSignatures []*rpc.TransactionSignature // make sure that the 'untilSig' exists to prevent undefined behavior on GetSignaturesForAddressWithOpts - _, err := client.GetTransaction( - ctx, - untilSig, - &rpc.GetTransactionOpts{Commitment: rpc.CommitmentFinalized}, - ) - if err != nil { + _, err := GetTransaction(ctx, client, untilSig) + if err != nil && !errors.Is(err, ErrUnsupportedTxVersion) { return nil, errors.Wrapf(err, "error GetTransaction for untilSig %s", untilSig) } @@ -137,6 +133,7 @@ func GetTransaction( sig solana.Signature, ) (*rpc.GetTransactionResult, error) { txResult, err := client.GetTransaction(ctx, sig, &rpc.GetTransactionOpts{ + Commitment: rpc.CommitmentFinalized, MaxSupportedTransactionVersion: &rpc.MaxSupportedTransactionVersion0, }) diff --git a/zetaclient/chains/solana/rpc/rpc_live_test.go b/zetaclient/chains/solana/rpc/rpc_live_test.go index e5d47b7302..a4000f9934 100644 --- a/zetaclient/chains/solana/rpc/rpc_live_test.go +++ b/zetaclient/chains/solana/rpc/rpc_live_test.go @@ -7,8 +7,10 @@ import ( "github.com/gagliardetto/solana-go" solanarpc "github.com/gagliardetto/solana-go/rpc" "github.com/stretchr/testify/require" + "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/zetaclient/chains/solana/rpc" "github.com/zeta-chain/node/zetaclient/common" + "github.com/zeta-chain/node/zetaclient/testutils" ) // Test_SolanaRPCLive is a phony test to run all live tests @@ -20,6 +22,7 @@ func Test_SolanaRPCLive(t *testing.T) { LiveTest_GetTransactionWithVersion(t) LiveTest_GetFirstSignatureForAddress(t) LiveTest_GetSignaturesForAddressUntil(t) + LiveTest_GetSignaturesForAddressUntil_Version0(t) LiveTest_CheckRPCStatus(t) } @@ -80,6 +83,22 @@ func LiveTest_GetSignaturesForAddressUntil(t *testing.T) { } } +func LiveTest_GetSignaturesForAddressUntil_Version0(t *testing.T) { + // create a Solana devnet RPC client + client := solanarpc.New(solanarpc.DevNet_RPC) + + // program address and signature of version "0" + chain := chains.SolanaDevnet + address := solana.MustPublicKeyFromBase58(testutils.GatewayAddresses[chain.ChainId]) + untilSig := solana.MustSignatureFromBase58( + "39fSgD2nteJCQRQP3ynqEcDMZAFSETCbfb61AUqLU6y7qbzSJL5rn2DHU2oM35zsf94Feb5C5QWd5L5UnncBsAay", + ) + + // should get all signatures for the address until a signature of version "0" successfully + _, err := rpc.GetSignaturesForAddressUntil(context.Background(), client, address, untilSig, 100) + require.NoError(t, err) +} + func LiveTest_CheckRPCStatus(t *testing.T) { // create a Solana devnet RPC client client := solanarpc.New(solanarpc.DevNet_RPC) diff --git a/zetaclient/chains/solana/signer/signer.go b/zetaclient/chains/solana/signer/signer.go index b6739751ac..1e3d6914f3 100644 --- a/zetaclient/chains/solana/signer/signer.go +++ b/zetaclient/chains/solana/signer/signer.go @@ -127,12 +127,6 @@ func (signer *Signer) TryProcessOutbound( nonce := params.TssNonce coinType := cctx.InboundParams.CoinType - // skip relaying the transaction if this signer hasn't set the relayer key - if !signer.HasRelayerKey() { - logger.Warn().Msgf("TryProcessOutbound: no relayer key configured") - return - } - var tx *solana.Transaction switch coinType { @@ -168,6 +162,12 @@ func (signer *Signer) TryProcessOutbound( return } + // skip relaying the transaction if this signer hasn't set the relayer key + if !signer.HasRelayerKey() { + logger.Warn().Msgf("TryProcessOutbound: no relayer key configured") + return + } + // set relayer balance metrics signer.SetRelayerBalanceMetrics(ctx) diff --git a/zetaclient/keys/relayer_key.go b/zetaclient/keys/relayer_key.go index af5918c634..2c7df857f5 100644 --- a/zetaclient/keys/relayer_key.go +++ b/zetaclient/keys/relayer_key.go @@ -7,6 +7,7 @@ import ( "github.com/gagliardetto/solana-go" "github.com/pkg/errors" + "github.com/rs/zerolog/log" "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/crypto" @@ -68,6 +69,8 @@ func LoadRelayerKey(relayerKeyPath string, network chains.Network, password stri return relayerKey, nil } + log.Logger.Warn().Msgf("relayer key file not found: %s", fileName) + // relayer key is optional, so it's okay if the relayer key is not provided return nil, nil }