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
This commit is contained in:
lightclient 2020-10-11 20:24:08 -06:00 committed by GitHub
parent ec36396a28
commit d56af987bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.