-
Notifications
You must be signed in to change notification settings - Fork 6
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
R4R: implement meta transaction #2
Conversation
ef17bcb
to
b58bdaf
Compare
if metaTxParams == nil { | ||
continue | ||
} | ||
if metaTxParams.ExpireHeight < currHeight { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of metaTxParams.ExpireHeight
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gas fee sponsor have no idea about when the users will submit meta transactions. Suppose the gas fee sponsor don't want to sponsor gas fee any more, and want to use the wallet in the future, it would be possible that sponsor wallet will be deducted native token in the future, which will be very confusing. With the ExpireHeight
, the sponsor can ensure that there will be no unconscious deduction after the highest ExpireHeight
.
In summary, the ExpireHeight
can bring more determinism for the fee sponsor.
core/txpool/txpool.go
Outdated
if metaTxParams.ExpireHeight < pool.chain.CurrentBlock().Number.Uint64() { | ||
return types.ErrExpiredMetaTx | ||
} | ||
balance = pool.currentState.GetBalance(metaTxParams.GasFeeSponsor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when there is not enough balance in st.msg. MetaTxParams. GasFeeSponsor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line 706, balance
will be checked against tx cost.
44b716c
to
07feb74
Compare
Try to support gas fee sponsor percent. |
18dc64c
to
1d2aac1
Compare
refacor implementation and add unittests
refactor code bug fix
remove expired metatx fix nil pointer issue
add unittest in txpool to conver meta tx
improve unittests
add more tests refactor util
1d2aac1
to
5ed7682
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR enable mantle-v2 to natively support meta transaction(gas less. transaction) in protocol.
There are other gasless transaction protocols which don't need any changes in protocol, such as
https://eips.ethereum.org/EIPS/eip-2771
https://eips.ethereum.org/EIPS/eip-2612
However, all above gas less transaction protocols have some limitations on either user accounts or assets contracts, which is not convenient.
Tools to build and broadcast meta tx:
metatx.zip