-
Notifications
You must be signed in to change notification settings - Fork 85
Fix fee-less transactions, and refactor it to have fee-less addresses 🚀 #1389
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1389 +/- ##
==========================================
+ Coverage 57.43% 57.47% +0.04%
==========================================
Files 1002 1002
Lines 42408 42417 +9
==========================================
+ Hits 24355 24380 +25
+ Misses 16364 16350 -14
+ Partials 1689 1687 -2 🚀 New features to boost your workflow:
|
app/ante/validator_tx_fee.go
Outdated
| "elys16qgewtplahkqwqa0aqv4pxnxa58ulu48k6crhj", // Price Feeder 1 mainnet | ||
| "elys1zwexzk6ns5ermvag5fc0gtyvrnxyaz9kzaflqf", // Price Feeder 2 mainnet | ||
| "elys1nelawytdfdk4af3z0sy2p8vkrllk8zw9g32jmf", // Execution bot 1 mainnet | ||
| "elys1gszp63euzm0ecs3qwu0j6mexjr97hjs7x5gvzk", // Execution bot 2 mainnet |
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.
we should not hardcode these addresses, should be stored or removed via gov
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.
Building that logic out is definitely outside my scope of Cosmos SDK. But I also never saw a project do it like that, in everyone else's implementation things were hard coded.
But maybe can implement some logic so that if its testnet only testnet addresses are in the array, etc.
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.
ref this: #1389 (comment)
In pre-blocker, you can call params and use a setter function.
app/ante/validator_tx_fee.go
Outdated
| } | ||
| minGasPrices = sdk.NewDecCoins(minGasPrice) | ||
| "elys1gy503ty29ydute5rksnkwgmtatelret9d455lt", // Execution bot devnet | ||
| "elys1dae9z45ccetfwr208ghya6npntg75qvxgmg4p9", // Price Feeder devnet |
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.
same here
| priority = getTxPriority(feeCoins, int64(gas)) | ||
| } | ||
|
|
||
| return feeCoins, priority, nil |
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 this we are making all txs gases for hardcoded addresses, is that correct ?
I guess we should only allow price txs as gasless otherwise someone can spam the chain with other txs if compromised.
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 priority changes the priority of the TX, allowing our gasless TXs to execute before everyone else otherwise our gasless TXs always execute last.
This logic also does not remove gas from the tx it simply makes it so the minimum fee is 0, so if you upload a TX with a fee 0 it can pass. But you can still pass in a fee.
Also because this uses the feepayer address to identify who can send 0 uelys fees, we can actually make it one address then do a feegrant, from say governance. So we could control who has access.
| // GaslessAddrs contains only the governance module address. | ||
| // Governance can grant feegrants to operational addresses (price feeders, liquidation bots, etc.) | ||
| // When those addresses use feegrants, the fee payer becomes governance, enabling gasless transactions. | ||
| var GaslessAddrs = []string{ |
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.
hard coding sender of tx makes tit difficult to change on the fly. Why not set it when chain starts by fetching params of respective module?
Only con is it might have to be done every block or we can do periodically or some other design
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.
I mean this makes it so governance can change it on the fly. If a wallet gets compromised then the governance module simply revokes the fee grant.
| feePayer := sdk.AccAddress(feePayerBytes).String() | ||
|
|
||
| for _, ga := range GaslessAddrs { | ||
| if feePayer == ga { |
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.
this allow address to do all txs gasless
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.
Yeah I mean this was just a design choice for flexibility. Allows governance to pick and choose what they want to allow as fee-less too. Then if it's abused the abuser can get removed it's not really a huge risk IMHO.
But I mean I don't mind either way we can limit it to specific TXs.
The old system which existed to allow fee-less price feeder TXs simply didnt work, due to it comparing lowercase msg type URLs to mixed case msg type URLs.
This new system replaces that logic, and allows certain addresses to ability to define 0uelys fees and have it get into the block. It also forces highest execution priority to TXs of such nature, so Price-Feeder TXs should always execute before anything else for example.