-
Notifications
You must be signed in to change notification settings - Fork 143
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
Sponsored Fees #1068
base: main
Are you sure you want to change the base?
Sponsored Fees #1068
Conversation
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
✅ Deploy Preview for hedera-hips ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…types Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Updated HIP with scope concept and fixed PR description with updated Abstract |
Would it be possible for sponsored fees to be optionally set towards spending by a smart contract, thus limiting the scope of the approval to executing only 1 particular smart contract. |
@tud0r6 I like this idea, to be clear, you mean that if I grant some hbar to Alice, I would be able to specify that Alice can only spend the hBar on executing transactions related to a specific contract, nothing else. She would not be able to execute another contract, or create an NFT, etc... Note, hbar in this case is gas for contracts, does the allowance extend to paying for gas (through the SDK and/or relay), or just native fees ? If only native fees, we may need to consider supporting gas payments. |
Great considerations @gregscullard and @tud0r6 . |
Indeed, I won't want to sponsor general-use gas(HBAR), rather application(SC)-specific gas(HBAR). |
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
@gregscullard and @tud0r6 I've added the gas scope but also added thoughts in the open questions section around some challenges here. |
@Nana-EC on the gas scope and the EVM tooling question, could we not consider that if an EOA account has 0 balance, then gas fees should be paid out of the allowance, or if the account has balance, it consumes that balance first, then dips into allowances if they exist ? I think we're still missing something with regards to the applicability of allowances for gas. Specifically the ability to be explicit about which contracts can be executed with a given allowance. User-stories-ish for example:
|
Hey @gregscullard , |
Hey @gregscullard , |
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
|
||
1. As an existing account on the network I want to be able to sponsor up to a certain HBAR limit the cost of future | ||
transaction fees due by another account by granting an explicit allowance. | ||
2. As an existing account on the network I want to be able to sponsor an unlimited amount of HBARs to cover the cost |
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 behaviour seems similar to the behaviour we have for NFT allowances, more specifically approvedForAll=true, where each new serial number of a given NFT will have been granted as an allowance to the spender.
Is the concept here the same? Since hbars are fungible there might be some applications like:
- If a sponsor gives allowance to multiple accounts with unlimited HBAR amounts - the granted accounts might use a competative greedy approach to try to use a part or the whole balance for their personal use before another account and thus having unfair share of the sponsored balance
- Defend the sponsor against a malicious account which performs operations in a loop, exhausting all of the balance
There might be safe use cases for this unlimited amount sponsorship, but I wanted to raise some security implications and corner cases, which can be thought of.
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.
Interesting points.
If by similar you mean will new hbars or FTs made available by a treasury be applicable to an existing allowance then yes, this would continue to be the case.
The cases noted are the same today I believe if an account was to provide one or multiple allowances with large enough values in comparison to their balance, so I don't believe this is a new edge case.
Solid consideration but I think it's already covered within the service capabilities.
It's the responsibility of the account to consider its awarded allowances.
HIP/hip-1068.md
Outdated
|
||
### Protobuf | ||
|
||
A new new allowance scope will be added to help define which type of fee an allowance can be used for |
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.
Typo - new repetition
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.
Fixed
} | ||
``` | ||
|
||
By default existing nft allowances will map to an `NftAllowance` with scope `CRYPTO_TRANSFER` |
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.
Typo: NftAllowance -> TokenAllowance
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.
Fixed
HIP/hip-1068.md
Outdated
*/ | ||
message TransactionSponsorClaim { | ||
/** | ||
* The account a spender is noting has provided prior willingness through an transaction fee allowance to |
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.
Typo: an -> a
I think the field description is a bit too complex and can be simplified. Part of the description can be moved in the description for the TransactionSponsorClaim operation
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.
Fixed
|
||
A new new allowance scope will be added to help define which type of fee an allowance can be used for | ||
```protobuf | ||
enum AllowanceScope { |
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
scope seems to be missing.
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.
Isn't GAS part of the TRANSACTION_FEE for a Smart contract call?
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.
There is an interesting case that we should make sure is covered properly by this scope concept.
If we perform a precompile smart contract call that creates a token - this precompile requires gas amount in tinybars + separate value sent in tinybars, since the gas amount will be above some of the limits. This implies that calling createFungibleToken precompile call might make use of both GAS
and TRANSACTION_FEE
scopes.
We can elaborate more of what TRANSACTION_FEE
covers in this HIP as a scope? I understand it as hbar amount needed to cover transaction expenses different than the gas itself. Or is it actually the gas amount itself?
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.
But at some other points GAS is used as a scope (Mirror Node endpoint, for example). Here it must be clear what is the difference and if GAS must be included.
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 agree, I'm a bit confused regarding the difference between GAS
and TRANSACTION_FEE
scope.
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.
To clarify, gas is a concept of resource utilization.
Gas fee is how much each unit of gas costs a user in HBAR.
Here the allowance is capturing the cost in hbar when settlement occurs
```solidity | ||
interface IHRC1068 { | ||
/// extensions of HIP 514 | ||
function approve(address token, address spender, uint256 amount, AllowanceScope allowanceScope) external |
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.
Definition of AllowanceScope enum in solidity is missing
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.
Added
} | ||
``` | ||
|
||
`IHRC1068` token methods will be callable via the HTS system contract at `0x167`. |
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.
While I know HTS I do not know what HAS or EOA stand for. Can we add a link or the full name at first usage?
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.
HAS -> Hedera Account Service
EAO -> Externally owned account
I agree with your comment for adding more info about the full names.
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.
Added
The Mirror Node allowance REST APIs would need to be updated to support the applicable scope concept values. | ||
|
||
#### getCryptoAllowances | ||
The `/api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/crypto` would need to be updated to to support all scopes. |
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.
Do I call this endpoint when want to get information about an allowance for calling smart contracts for example? If that is correct I dislike the "/crypto" at the end. Since we have the scope I would assume "/api/v1/accounts/{idOrAliasOrEvmAddress}/allowances" as endpoint.
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 is an existing endpoint that lists all the allowances with relation to hbar crypto.
This is distinguished from the /api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/nfts
and /api/v1/accounts/{idOrAliasOrEvmAddress}/allowances/tokens
endpoints.
See https://testnet.mirrornode.hedera.com/api/v1/docs/
… asset file Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Description:
This HIP proposes an expansion to the approval and allowance network logic (i.e. CryptoApproveAllowance, NftAllowance
and TokenAllowance) by allowing any account on the network to provide allowances that will sponsor the payment of the
fees for another account’s submitted transactions.
In this way account Alice may assign an HBAR / token transaction fee allowance for EOA account Bob or Contract account
Carol and pay the fees due to nodes, the network and accounts for any transactions they submit, thus allowing Bob or
Carol to have zero balance and still transact on chain.
This proposal extends the existing Approval and Allowance API by adding the concept of a scope that designates the type
of value transafer an allowance applies to.
The scopes will include CryptoTranafer, HAPI transsaction fee and token custom fees.
This enables value transfer and fee payments to another account without requiring one-off
approval for each transaction. This feature enhances flexibility and efficiency in managing transaction costs,
particularly for high volume applications.
Related issue(s):
Fixes #912
Notes for reviewer:
Expect more changes soon.
There's an outstanding item to condense the Allowances types to instead be scopes on the existing allowances as a cleaner API form
Checklist