Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update Solana last scanned block more frequently #3314

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* [3253](https://github.com/zeta-chain/node/pull/3253) - fix solana inbound version 0 queries and move tss keysign prior to relayer key checking
* [3278](https://github.com/zeta-chain/node/pull/3278) - enforce checksum format for asset address in ZRC20
* [3289](https://github.com/zeta-chain/node/pull/3289) - remove all dynamic peer discovery (zetaclient)
* [3314](https://github.com/zeta-chain/node/pull/3314) - update `last_scanned_block_number` metrics more frequently for Solana chain

## v23.0.0

Expand Down
12 changes: 11 additions & 1 deletion zetaclient/chains/solana/observer/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,24 @@
ob.WithLastTxScanned(lastSig.String())
}

// query last finalized slot
lastSlot, err := ob.solClient.GetSlot(ctx, rpc.CommitmentFinalized)
if err != nil {
ob.Logger().Inbound.Err(err).Msg("unable to get last slot")
}

Check warning on line 88 in zetaclient/chains/solana/observer/inbound.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/observer/inbound.go#L85-L88

Added lines #L85 - L88 were not covered by tests

// get all signatures for the gateway address since last scanned signature
lastSig := solana.MustSignatureFromBase58(ob.LastTxScanned())
signatures, err := solanarpc.GetSignaturesForAddressUntil(ctx, ob.solClient, ob.gatewayID, lastSig, pageLimit)
if err != nil {
ob.Logger().Inbound.Err(err).Msg("error GetSignaturesForAddressUntil")
return err
}
if len(signatures) > 0 {

// update metrics if no new signatures found
if len(signatures) == 0 {
ob.WithLastBlockScanned(lastSlot)
} else {

Check warning on line 101 in zetaclient/chains/solana/observer/inbound.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/observer/inbound.go#L99-L101

Added lines #L99 - L101 were not covered by tests
ob.Logger().Inbound.Info().Msgf("ObserveInbound: got %d signatures for chain %d", len(signatures), chainID)
}

Expand Down
Loading