Skip to content

Improve fee estimation API for state transition #3041

Open

Description

@lklimek

Expected Behavior

Provide a way to estimate fees for AddressCreditWithdrawalTransition without requiring a fully constructed and signed transition, and without manually instantiating AddressCreditWithdrawalTransitionV0 with potentially invalid or incomplete fields.

Also applies to other state transition types.

Current Behavior

StateTransitionEstimatedFeeValidation is implemented for AddressCreditWithdrawalTransition, which requires the full transition to be known. But selecting inputs depends on the fee (inputs must cover the fee), so the transition can’t be constructed until the fee is known.

The official constructor try_from_inputs_with_signer() signs the transition, which is not suitable for estimation-only use. The alternative is manually constructing AddressCreditWithdrawalTransitionV0, which bypasses versioning safety and risks invalid fields or defaults causing incorrect fee calculations.

Possible Solution

Introduce an estimation API that works from inputs needed for fee estimation (e.g., amounts, output counts, serialized size assumptions, etc.) without requiring a fully formed transition or signer.

Examples:

A dedicated “fee estimate builder” or “draft” transition type that enforces required fields and versioning but does not sign.

A function that derives a deterministic, unsigned transition specifically for fee estimation, with minimal required inputs and validated defaults.

Alternatives Considered

Continue manually constructing AddressCreditWithdrawalTransitionV0 for estimates. This is brittle, risks invalid data, and undermines versioning guarantees.

Additional Context

There is a chicken-and-egg problem: input selection depends on fee, and fee estimation depends on the full list of inputs. We need an API that breaks this cycle without requiring signing or unsafe manual construction.

Activity

  1. added
    enhancement
    on Feb 2, 2026
  2. changed the title [-]Improve fee estimation API for AddressCreditWithdrawalTransition[/-] [+]Improve fee estimation API for state transition[/+] on Feb 2, 2026
  3. added
    effort: M
    priority: medium
    on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: Menhancementpriority: mediumrs-sdk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions