-
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
Simplify fee charging #1516
Simplify fee charging #1516
Conversation
Signed-off-by: tinker-michaelj <[email protected]>
…g user transaction Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
…cessLogic change Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
…isable CI for now Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
import com.hedera.services.txns.submission.SystemPrecheck; | ||
import com.hedera.services.utils.SignedTxnAccessor; |
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.
These two imports can be removed
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.
Removed.
hedera-node/src/main/java/com/hedera/services/fees/charging/TxnChargingPolicyAgent.java
Show resolved
Hide resolved
hedera-node/src/test/java/com/hedera/services/fees/charging/TxnChargingPolicyAgentTest.java
Show resolved
Hide resolved
...ients/src/main/java/com/hedera/services/bdd/spec/transactions/crypto/HapiCryptoTransfer.java
Outdated
Show resolved
Hide resolved
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 think the charging policy needs to be revised. Please see inline comments.
hedera-node/src/main/java/com/hedera/services/context/NodeInfo.java
Outdated
Show resolved
Hide resolved
hedera-node/src/main/java/com/hedera/services/fees/charging/NarratedCharging.java
Show resolved
Hide resolved
hedera-node/src/main/java/com/hedera/services/fees/charging/NarratedCharging.java
Show resolved
Hide resolved
Signed-off-by: tinker-michaelj <[email protected]>
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.
Need to resolve newly introduced sonar issues(if any)
It compares to master
...I addressed the issues and will check if it passes now...
Codecov Report
@@ Coverage Diff @@
## master-plus-sdk-0.15.0-alpha.1 #1516 +/- ##
====================================================================
+ Coverage 91.27% 91.32% +0.04%
+ Complexity 5876 5848 -28
====================================================================
Files 461 461
Lines 16897 16852 -45
Branches 1781 1778 -3
====================================================================
- Hits 15423 15390 -33
+ Misses 1009 999 -10
+ Partials 465 463 -2
Continue to review full report at Codecov.
|
void chargePayerAllFees(); | ||
void chargePayerServiceFee(); | ||
void chargePayerNetworkAndUpToNodeFee(); | ||
void chargeSubmittingNodeUpToNetworkFee(); |
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.
So this function will charge the submitting node up to the network fee as a penalty for not performing basic due diligence or for submitting a duplicate transaction with another node? I know some of the function names have enough details, but some of them may still need javadoc to explain.
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, other than maybe adding some javadoc.
Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: anighanta <[email protected]>
if (payerExempt) { | ||
return; | ||
} | ||
ledger.adjustBalance(grpcNodeId, +nodeFee); |
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 +
could be removed for adjustBalance
.
if (!narratedCharging.isPayerWillingToCoverNetworkFee()) { | ||
narratedCharging.chargeSubmittingNodeUpToNetworkFee(); | ||
return INSUFFICIENT_TX_FEE; |
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.
So the logic here is that if the payer offers a large amount of fee willing to pay, but it actually has almost zero balance, in this cause, the submitting node will be charged and the payer walked away with nothing to lose?
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 node should check that the payer will be able to afford the network fee before it submits the txn...if it doesn't check, it is penalized for this lack of "due diligence".
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 see. If it does and the transaction goes through, the submitting node will get reward as compensation.
Signed-off-by: anighanta <[email protected]>
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
Related issue(s):
Closes #1461
Summary of the change:
ItemizableFeeCharging
with aNarratedFeeCharging
whose methods support exactly the charging actions that Services actually takes.UncheckedSubmit
to verify charging actions taken in case of a node not performing due diligence.uncheckedSubmit=2-50
to dev/api-permission.properties to allow this.PolicyChargingAgent
fromAwareProcessLogic
to encapsulate the choice of which charging actions to take.External impacts:
None.
Applicable documentation