From d56af987bc8f2e8d716caf52395c0eb653658cf4 Mon Sep 17 00:00:00 2001 From: lightclient <14004106+lightclient@users.noreply.github.com> Date: Sun, 11 Oct 2020 20:24:08 -0600 Subject: [PATCH] Automatically merged updates to draft EIP(s) 2733 (#3038) Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing --- EIPS/eip-2733.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-2733.md b/EIPS/eip-2733.md index e4025145..cb4e25d8 100644 --- a/EIPS/eip-2733.md +++ b/EIPS/eip-2733.md @@ -126,13 +126,17 @@ fn is_valid(config: &Config, state: &State, tx: TransactionPackage) bool { if config.chain_id() != tx.chain_id { false } + + if tx.children.len() == 0 { + false + } if state.nonce(tx.from()) + 1 != tx.nonce { false } let cum_limit = tx.children.map(|x| x.gas_limit).sum(); - if state.balance(tx.from()) < cum_limit * tx.gas_price { + if state.balance(tx.from()) < cum_limit * tx.gas_price + intrinsic_gas(tx) { false } @@ -184,6 +188,16 @@ struct Result { } ``` +### Intrinsic Cost +Let the intrinsic cost of the transaction package be defined as follows: + +``` +fn intrinsic_gas(tx: TransactionPackage) u256 { + let data_cost = tx.children.map(|c| data_cost(&c.data)).sum(); + 17000 + 8000 * tx.children.len() + data_cost +} +``` + ### Execution Transaction packages should be executed as follows: 1. Deduct the cumulative cost from the outer signer's balance.