Skip to content

feat(randomness): submit drands asap#590

Merged
GabrielMartinezRodriguez merged 4 commits intomasterfrom
gabriel/submit-transactions-asap
Apr 28, 2025
Merged

feat(randomness): submit drands asap#590
GabrielMartinezRodriguez merged 4 commits intomasterfrom
gabriel/submit-transactions-asap

Conversation

@GabrielMartinezRodriguez
Copy link
Contributor

@GabrielMartinezRodriguez GabrielMartinezRodriguez commented Apr 8, 2025

Description

This PR adds a mechanism to the transaction manager to allow submitting transactions without waiting for a new block to arrive. Additionally, this is implemented in the randomness service to submit drands as soon as they arrive. Thanks to this mechanism, we've achieved a 100% success rate in the sequential randomness of the Randomness contract

  • Include all relevant context (but no need to repeat the issue's content).
  • Draw attention to new, noteworthy & unintuitive elements.
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.

< INDICATE BROWSER, DEMO APP & OTHER ENV DETAILS USED FOR TESTING HERE >

< INDICATE TESTED SCENARIOS (USER INTERFACE INTERACTION, CODE FLOWS) HERE >

  • 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.
  • D4. An appropriate Changeset has been generated (and committed) for changes that touch npm published packages (currently packages/core and packages/react), see here for more info.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 8, 2025

Deploying happychain with  Cloudflare Pages  Cloudflare Pages

Latest commit: 280a889
Status:⚡️  Build in progress...

View logs

Copy link
Contributor Author

GabrielMartinezRodriguez commented Apr 8, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@GabrielMartinezRodriguez GabrielMartinezRodriguez marked this pull request as ready for review April 8, 2025 12:17
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from 2ea8352 to fd5421a Compare April 8, 2025 12:29
@GabrielMartinezRodriguez GabrielMartinezRodriguez added the reviewing-1 Ready for, or undergoing first-line review label Apr 8, 2025
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from fd5421a to c75d0b7 Compare April 8, 2025 12:37
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from c75d0b7 to a572b9a Compare April 8, 2025 12:45
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from a572b9a to f56fed2 Compare April 8, 2025 13:02
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from f56fed2 to ffc92f9 Compare April 10, 2025 07:53
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from ee8889a to 513f974 Compare April 13, 2025 21:39
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from 513f974 to 2bf6dd1 Compare April 13, 2025 21:40
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from 2bf6dd1 to 544cb2d Compare April 13, 2025 21:42

drand.transactionSubmitted()

this.drandRepository.updateDrand(drand).catch((error) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this await?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

await this.collectTransactions(transactionsBatch)
}

@TraceMethod("txm.transaction-collector.collect-transactions")
Copy link
Contributor

Choose a reason for hiding this comment

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

i have quite conflicted feelings about decorators 😄

}

@TraceMethod("txm.transaction-collector.collect-transactions")
public async collectTransactions(transactionsBatch: Transaction[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we call this sendTransactions? Since if A passes something to B, B is collecting from A. But in this case, A is passing transactions to B, so it's A doing the action :)

@norswap norswap added merge-blocked-after-changes Ready to merge but waiting for downstack, after requested changes are made and removed reviewing-1 Ready for, or undergoing first-line review labels Apr 24, 2025
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from 22f4cb1 to ef46a34 Compare April 24, 2025 10:03
@GabrielMartinezRodriguez GabrielMartinezRodriguez added merge-blocked Ready to merge, waiting for downstack and removed merge-blocked-after-changes Ready to merge but waiting for downstack, after requested changes are made labels Apr 24, 2025
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from 12eeef7 to f3644b3 Compare April 28, 2025 11:08
@GabrielMartinezRodriguez GabrielMartinezRodriguez force-pushed the gabriel/submit-transactions-asap branch from f3644b3 to 280a889 Compare April 28, 2025 12:53
@GabrielMartinezRodriguez GabrielMartinezRodriguez changed the base branch from gabriel/randomness-monitor to master April 28, 2025 12:53
@GabrielMartinezRodriguez GabrielMartinezRodriguez merged commit 43ce45f into master Apr 28, 2025
3 of 4 checks passed
@GabrielMartinezRodriguez GabrielMartinezRodriguez deleted the gabriel/submit-transactions-asap branch April 28, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-blocked Ready to merge, waiting for downstack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants