Skip to content

fix(express): restore backward compatibility for empty eip1559 object#8171

Open
Marzooqa wants to merge 1 commit intomasterfrom
WP-7882
Open

fix(express): restore backward compatibility for empty eip1559 object#8171
Marzooqa wants to merge 1 commit intomasterfrom
WP-7882

Conversation

@Marzooqa
Copy link
Contributor

@Marzooqa Marzooqa commented Feb 18, 2026

Summary

  • Restores backward compatibility for clients sending eip1559: {}
  • Adds validation to reject partial eip1559 objects (only one of
    maxFeePerGas/maxPriorityFeePerGas)
  • Applies to both /sendcoins and /sendmany endpoints

Changes

  • Updated EIP1559Params schema to use t.partial for flexible input validation
  • Added controller-level validation with clear error messages:
    • eip1559 missing maxPriorityFeePerGas
    • eip1559 missing maxFeePerGas
  • Empty eip1559: {} is normalized to undefined.
  • Added tests for backward compatibility and partial object rejection

TICKET: WP-7882

const hasMax = maxFeePerGas !== undefined;
const hasPriority = maxPriorityFeePerGas !== undefined;
if (hasMax && !hasPriority) {
throw new ApiResponseError('eip1559 missing maxPriorityFeePerGas', 400);
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you confirmed whether both fields are required to be passed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The server-side auto-estimation only triggers when both fields are missing. If only one field is provided, the server won't auto-estimate, it will fail downstream. Better to reject early with a clear error.

@Marzooqa Marzooqa marked this pull request as ready for review February 19, 2026 07:09
@Marzooqa Marzooqa requested review from a team as code owners February 19, 2026 07:09
*
* Note: Partial objects (only one field) pass validation but backend handles them
*/
export const EIP1559Params = t.type({
Copy link
Contributor

@alextse-bg alextse-bg Feb 19, 2026

Choose a reason for hiding this comment

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

nit:

export const EIP1559Params = t.union([
  t.type({}),
  t.type({
    /** Maximum priority fee per gas (in wei) - REQUIRED */
    maxPriorityFeePerGas: t.union([t.number, t.string]),
    /** Maximum fee per gas (in wei) - REQUIRED */
    maxFeePerGas: t.union([t.number, t.string]),
  })
]);

Copy link
Contributor

@alextse-bg alextse-bg left a comment

Choose a reason for hiding this comment

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

some nits

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

Comments