Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Use NET bill in transaction receipt during light validation mode #8856

Merged
merged 3 commits into from
Mar 24, 2020

Conversation

arhag
Copy link
Contributor

@arhag arhag commented Mar 24, 2020

Change Description

Since the NET bill is objective, a node in full validation mode is able to calculate what the NET bill for a transaction should be. Even with this change, a node in full validation mode will always compute the NET bill rather than blindly trusting the NET bill provided by the producer in the transaction receipt and it will reject the block if there is a mismatch.

However, with the changes in this PR, a node operating in a mode where the normal transaction checks are skipped (light validation mode or applying a block by a trusted producer) will now simply use the NET bill provided by the producer in the transaction receipt rather than computing the amount itself. This sets the stage for later changes that allow a light validation node to apply a block that may have had some context-free data within the block removed, which would make it impossible to calculate the correct NET bill.

This PR also adds a new unit test, resource_limits_test/light_net_validation, to test the new behavior.

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

Adds unit test resource_limits_test/light_net_validation.
This prevents calling add_transaction_usage with bad data that cause its invariants to fail. We should avoid that even in light validation mode.

Also, there is no need to keep the skip_trx_checks if statement within check_net_usage. It doesn't even make things more efficient.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants