Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KIP-247] Gasless Transaction #47

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

[KIP-247] Gasless Transaction #47

wants to merge 10 commits into from

Conversation

ian0371
Copy link
Contributor

@ian0371 ian0371 commented Feb 19, 2025

Proposed changes

Types of changes

  • Bugfix
  • KIP Proposal
  • KIP Improvement

Checklist

  • Used the suggested template: https://github.com/kaiachain/KIPs/blob/main/kip-template.md
  • I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribution
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

Depends on #45

@ian0371 ian0371 self-assigned this Feb 19, 2025
@ian0371 ian0371 marked this pull request as ready for review February 19, 2025 07:25
@ian0371 ian0371 requested review from shiki-tak and ulbqb February 19, 2025 07:25
@ulbqb
Copy link

ulbqb commented Feb 19, 2025

I have a question about invalid swap tx. When the swap transactions sent by users without CL token are removed from a block? I think we need alternative checks instead of balance check.

@ian0371
Copy link
Contributor Author

ian0371 commented Feb 19, 2025

@ulbqb It'll revert by the condition R1 (GaslessSwapRouter). Token balance check in validateTx existed but has been removed because it's difficult to make a EVM call.

insufficientFund error
```

#### Promoting GaslessTx (promoteExecutables)
Copy link

@ulbqb ulbqb Feb 20, 2025

Choose a reason for hiding this comment

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

In practice, there is a more complicated case. I provide some examples:

[transfer_0, approve_1, swap_2] is queue contents.
[transfer_0, approve_1, swap_2] shoud be promoted to pending.

[approve_0, swap_1, approve_2, swap_3] is a queue list.
[approve_0, swap_1, approve_2, swap_3] shoud be promoted to pending.

[approve_0, approve_1, swap_2] is a queue list.
[] shoud be promoted to pending.

[approve_0, transfer_1, swap_2] is a queue list.
[] shoud be promoted to pending.

Is this correct? And I think there is a lack of checking of nonce overall.

AP1 and SPx: approveTx.Nonce + 1 == swapTX.Nonce

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should only allow either

  • (if approve exists) when getNonce(user) == GaslessApproveTx.nonce and getNonce(user) + 1 == GaslessSwapTx.nonce
  • (else) when getNonce(user) == GaslessSwapTx.nonce

Thus, these are NOT regarded as GaslessTx:

  • approve_1 and swap_2 in [transfer_0, approve_1, swap_2]
  • approve_2 and swap_3 in [approve_0, swap_1, approve_2, swap_3]
  • approve_1 and swap_2 in [approve_0, approve_1, swap_2]

The nonce check added by previous commit was meant to imply this nonce check.

---
kip: 247
title: Gasless Transaction
author: Ian (@ian0371) and Ollie (@blukat29)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
author: Ian (@ian0371) and Ollie (@blukat29)
author: Ian (@ian0371), Ollie (@blukat29)

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.

4 participants