Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.1 KB

cip-0045.md

File metadata and controls

49 lines (39 loc) · 2.1 KB
cip title author discussions-to status type category created license
45
Modify Transaction Fee Check
Tong Wang <@yoduyodu>
Final
Standards Track
Ring 0
2021-08-16
Apache 2.0

Simple Summary

Paying transaction fees using non-native currencies should be feasible if a transactor has a balance greater than or equal to the sum of the fee and the transferred value.

Abstract

When paying transaction fees, the transaction should be deemed as valid if the transactor's balance is greater than or equal to the transaction fee + transferred value. This CIP seeks to modify the transaction fee check rule.

Specification

When checking if the balance covers the transaction fee in state_transition and tx_pool, it should pass if the balance >= transaction fee + transferred value. The current behavior is:

  • For native currency(CELO), require balance >= fee.
  • For non-native currencies(cUSD, cEUR, ...), require balance > fee.

Rationale

  • Add transferred value in fee check to align with Geth.
  • Transaction fee checks should be consistent across using native currency CELO and other non-native currencies.

Backwards Compatibility

This introduces a change in the transaction validity check.

Test Cases

For native currency(CELO):

  • Send a Tx with balance >= fee, but balance < fee + value: ✅ before HF block, ❌ after.
  • Send a Tx with balance >= fee + value: ✅ before HF block, ✅ after. For non-native currencies(cUSD, cEUR, ...):
  • Send a Tx with balance < fee + value: ❌ before HF block, ❌ after.
  • Send a Tx with balance = fee, with value == 0 : ❌ before HF block, ✅ after.
  • Send a Tx with balance > fee + value: ✅ before/after HF block.

Implementation

celo-org/celo-blockchain#1664

Updated in https://github.com/celo-org/celo-blockchain/pull/1696/files

Security Considerations

A more strict transaction validity check should imply less security risks.

License

This work is licensed under the Apache License, Version 2.0.