Skip to content

Add configurable HTTP polling interval for block monitoring#362

Merged
aodhgan merged 2 commits intogabriel/txm-force-initializationfrom
gabriel/txm-http-polling-interval
Feb 5, 2025
Merged

Add configurable HTTP polling interval for block monitoring#362
aodhgan merged 2 commits intogabriel/txm-force-initializationfrom
gabriel/txm-http-polling-interval

Conversation

@GabrielMartinezRodriguez
Copy link
Contributor

@GabrielMartinezRodriguez GabrielMartinezRodriguez commented Jan 22, 2025

Linked Issues

Description

Adds configurable HTTP polling interval for block monitoring based on block time. When using HTTP transport, the system now polls for new blocks at an interval that is a fraction of the block time (defaulting to 1/8th)

Toggle Checklist

Checklist

Basics

  • B1. I have applied the proper label & proper branch name (e.g. norswap/build-system-caching).
  • B2. This PR is not so big that it should be split & addresses only one concern.
  • B3. The PR targets the lowest branch it can (ideally master).

Reminder: PR review guidelines

Correctness

  • C1. Builds and passes tests.

  • C2. The code is properly parameterized & compatible with different environments (e.g. local,
    testnet, mainnet, standalone wallet, ...).

  • C3. I have manually tested my changes & connected features.

  • C4. I have performed a thorough self-review of my code after submitting the PR,
    and have updated the code & comments accordingly.

Architecture & Documentation

  • D1. I made it easy to reason locally about the code, by (1) using proper abstraction boundaries,
    (2) commenting these boundaries correctly, (3) adding inline comments for context when needed.
  • D2. All public-facing APIs & meaningful (non-local) internal APIs are properly documented in code
    comments.
  • D3. If appropriate, the general architecture of the code is documented in a code comment or
    in a Markdown document.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 22, 2025

Deploying happychain with  Cloudflare Pages  Cloudflare Pages

Latest commit: 991bf7f
Status: ✅  Deploy successful!
Preview URL: https://a598b157.happychain.pages.dev
Branch Preview URL: https://gabriel-txm-http-polling-int.happychain.pages.dev

View logs

@GabrielMartinezRodriguez GabrielMartinezRodriguez marked this pull request as ready for review January 22, 2025 11:37
@GabrielMartinezRodriguez GabrielMartinezRodriguez added the reviewing-1 Ready for, or undergoing first-line review label Jan 22, 2025
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch 2 times, most recently from 1f12879 to db559e2 Compare January 22, 2025 14:20
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 3be8f45 to 6d998d9 Compare January 22, 2025 14:20
@linear
Copy link

linear bot commented Jan 22, 2025

public readonly blockTime: bigint
public readonly finalizedTransactionPurgeTime: number
public readonly pollingInterval: number
public readonly transportProtocol: "http" | "websocket"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels odd to me to have 'http' and 'websocket' instead of 'ws'

also not sure if its an issue for you here or not (i think not?) but do you want tls variants?

Suggested change
public readonly transportProtocol: "http" | "websocket"
public readonly transportProtocol: "http" | "https" | "ws" | "wss"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the getUrlProtocol() function decodes "ws" or "wss" into either "http" or "websocket" and throws if its neither so its ok

@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch from 30792ba to 9a55112 Compare January 31, 2025 14:44
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 0b937a8 to 9fa6f10 Compare January 31, 2025 14:44
@GabrielMartinezRodriguez GabrielMartinezRodriguez mentioned this pull request Feb 3, 2025
10 tasks
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch from 9a55112 to 5aee502 Compare February 3, 2025 12:40
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 9fa6f10 to 9cee1b9 Compare February 3, 2025 12:40
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch from 5aee502 to 7459249 Compare February 3, 2025 13:14
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 9cee1b9 to 61a2966 Compare February 3, 2025 13:14
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch from 7459249 to f8fd7af Compare February 4, 2025 13:51
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 61a2966 to 6655ac3 Compare February 4, 2025 13:51

/**
* Specifies the polling interval in milliseconds.
* Defaults to 1/2 of the block time.
Copy link
Contributor

@aodhgan aodhgan Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR description says the default 1/8th of the block time, but we will find an ideal default thru testing i think

@aodhgan aodhgan added reviewing-2 Ready for, or undergoing final review and removed reviewing-1 Ready for, or undergoing first-line review labels Feb 5, 2025
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-force-initialization branch from f8fd7af to 28a3351 Compare February 5, 2025 14:03
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/txm-http-polling-interval branch from 6655ac3 to 991bf7f Compare February 5, 2025 14:03
@aodhgan aodhgan merged commit 19b3996 into gabriel/txm-force-initialization Feb 5, 2025
1 of 2 checks passed
@aodhgan aodhgan deleted the gabriel/txm-http-polling-interval branch February 5, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewing-2 Ready for, or undergoing final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants