Skip to content

refactor(tx-manager): make nonce manager generic over provider trait#1400

Merged
jackchuma merged 1 commit intomainfrom
refactor/nonce-manager
Mar 17, 2026
Merged

refactor(tx-manager): make nonce manager generic over provider trait#1400
jackchuma merged 1 commit intomainfrom
refactor/nonce-manager

Conversation

@jackchuma
Copy link
Contributor

@jackchuma jackchuma commented Mar 17, 2026

What changed? Why?

Makes NonceManager generic over a provider trait (P: Provider) instead of being hardcoded to RootProvider.

  • NonceManager now takes a type parameter P and stores provider: P instead of provider: RootProvider
  • The impl block is bounded by P: Provider, so any provider implementation can be used
  • SimpleTxManager concretizes the type as NonceManager<RootProvider> to preserve its existing API
  • RootProvider import moved from the main module to the test module where it's still needed for the test-only seeded constructor

This decouples the nonce manager from a specific provider type, enabling easier testing with mock providers and reuse in contexts that don't use RootProvider.

Notes to reviewers

Pure refactor — no behavioral changes. All existing tests pass without modification (only type annotations updated).

How has it been tested?

Existing unit and integration tests in crates/utilities/tx-manager/ continue to pass.

Change management (definitions)

type=routine
risk=low
impact=sev5

Backwards Compatibility (learn more)

backwards_compatible=true

automerge=false

@linear
Copy link

linear bot commented Mar 17, 2026

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Mar 17, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
base Ignored Ignored Mar 17, 2026 1:15am

Request Review

@jackchuma jackchuma changed the title refactor(CHAIN-3471): make nonce manager generic over provider trait refactor(tx-manager): make nonce manager generic over provider trait Mar 17, 2026
@github-actions
Copy link
Contributor

Review Summary

Clean refactor — no issues found.

The change correctly introduces a generic parameter P: Provider on NonceManager, replacing the hardcoded RootProvider. Key observations:

  • Bounded correctly: P: Provider on the impl block, no unnecessary bounds on the struct definition (idiomatic Rust).
  • Derive implications: #[derive(Debug, Clone)] implicitly requires P: Debug + Clone, which is a natural requirement for provider types and is satisfied by RootProvider.
  • Scope is minimal: SimpleTxManager remains concrete with NonceManager<RootProvider> — no over-generification.
  • All references updated: Verified no external crate references to NonceManager were missed.
  • Test helpers properly scoped: new_with_nonce narrowed to impl NonceManager<RootProvider>.

@jackchuma jackchuma requested a review from refcell March 17, 2026 01:21
@jackchuma jackchuma enabled auto-merge March 17, 2026 01:22
@jackchuma jackchuma added this pull request to the merge queue Mar 17, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 17, 2026
@jackchuma jackchuma added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit 8849355 Mar 17, 2026
28 checks passed
@jackchuma jackchuma deleted the refactor/nonce-manager branch March 17, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants