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
Merged

Contract rewards #1258

merged 7 commits into from
Sep 12, 2019

Conversation

evgenykuzyakov
Copy link
Collaborator

Fixes #1179

@evgenykuzyakov
Copy link
Collaborator Author

@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
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is not needed anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generate_refund_receipts is now only called if predecessor_id is not system.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens to the logs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@evgenykuzyakov evgenykuzyakov merged commit a7960e9 into staging Sep 12, 2019
@evgenykuzyakov evgenykuzyakov deleted the contract-rewards branch September 12, 2019 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants