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

Contract rewards #1258

Merged
merged 7 commits into from Sep 12, 2019

Conversation

@evgenykuzyakov
Copy link
Collaborator

commented Sep 4, 2019

Fixes #1179

@evgenykuzyakov evgenykuzyakov requested review from bowenwang1996 and nearmax Sep 4, 2019
@evgenykuzyakov evgenykuzyakov force-pushed the contract-rewards branch from 6370c46 to 0f0a57e Sep 5, 2019
@evgenykuzyakov

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 5, 2019

@nearmax pointed out that the given change is likely going to slow down WASM execution because deduct_gas got more expensive with a new burnt_gas_reward.

Refunds are free, meaining no gas cost to create/send or execute.
Return burnt_gas as part of TransactionResult.
Fixing tests by fixing tests.
Increase fees 10X to properly check rewards.
@evgenykuzyakov evgenykuzyakov requested a review from SkidanovAlex as a code owner Sep 11, 2019
@evgenykuzyakov

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 11, 2019

Introduce execution rewards for every burnt_gas.
Refunds are free, meaning no gas cost to create/send or execute.
Return burnt_gas as part of TransactionResult.
Fixing tests by fixing tests.
Increase fees 10X to properly check rewards.

|| (new_burnt_gas < self.config.max_gas_burnt
&& new_used_gas < self.context.prepaid_gas)
if new_burnt_gas <= self.config.max_gas_burnt
&& (self.context.free_of_charge || new_used_gas <= self.context.prepaid_gas)

This comment has been minimized.

Copy link
@evgenykuzyakov

evgenykuzyakov Sep 11, 2019

Author Collaborator

Also moving free_of_charge post max_gas_burnt limit to avoid infinite loops with view calls.

runtime/near-vm-logic/src/logic.rs Outdated Show resolved Hide resolved
@@ -638,10 +674,10 @@ impl Runtime {
deposit_refund += gas_balance_refund;
gas_balance_refund = 0;
}
if deposit_refund > 0 && &receipt.predecessor_id != &system_account() {
if deposit_refund > 0 {

This comment has been minimized.

Copy link
@nearmax

nearmax Sep 12, 2019

Collaborator

Why is not needed anymore?

This comment has been minimized.

Copy link
@evgenykuzyakov

evgenykuzyakov Sep 12, 2019

Author Collaborator

generate_refund_receipts is now only called if predecessor_id is not system.

}
TransactionResult {
status: TransactionStatus::Completed,
logs: vec![],

This comment has been minimized.

Copy link
@bowenwang1996

bowenwang1996 Sep 12, 2019

Member

what happens to the logs

This comment has been minimized.

Copy link
@evgenykuzyakov

evgenykuzyakov Sep 12, 2019

Author Collaborator

SignedTransaction verification doesn't generate logs. The are later generated by receipts.

@evgenykuzyakov evgenykuzyakov merged commit a7960e9 into staging Sep 12, 2019
2 checks passed
2 checks passed
GitLab CI pipeline (branch) Pipeline completed on GitLab CI
Details
GitLab CI pipeline (pull request) Pipeline completed on GitLab CI
Details
@evgenykuzyakov evgenykuzyakov deleted the contract-rewards branch Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.