core,eth/tracers: fix TestPrestateWithDiffModeTracer

This commit is contained in:
Raneet Debnath 2023-07-06 15:50:11 +05:30
parent 46882e8247
commit 60b85cf088
No known key found for this signature in database
GPG key ID: C232FD2D870BCD3D
9 changed files with 68 additions and 15 deletions

View file

@ -141,6 +141,9 @@ func applyTransaction(msg *Message, config *params.ChainConfig, gp *GasPool, sta
statedb.AddBalance(result.BurntContractAddress, result.FeeBurnt)
}
// TODO(raneet10) Double check
statedb.AddBalance(evm.Context.Coinbase, result.FeeTipped)
if result.Err == vm.ErrInterrupt {
return nil, result.Err
}

View file

@ -441,15 +441,16 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee))
}
if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
// Skip fee payment when NoBaseFee is set and the fee fields
// are 0. This avoids a negative effectiveTip being applied to
// the coinbase when simulating calls.
} else {
fee := new(big.Int).SetUint64(st.gasUsed())
fee.Mul(fee, effectiveTip)
st.state.AddBalance(st.evm.Context.Coinbase, fee)
}
// TODO(raneet10): Double check. We might want to inculcate this fix in a separate condition
// if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
// // Skip fee payment when NoBaseFee is set and the fee fields
// // are 0. This avoids a negative effectiveTip being applied to
// // the coinbase when simulating calls.
// } else {
// fee := new(big.Int).SetUint64(st.gasUsed())
// fee.Mul(fee, effectiveTip)
// st.state.AddBalance(st.evm.Context.Coinbase, fee)
// }
amount := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)

View file

@ -37,6 +37,13 @@
"clique": {
"period": 0,
"epoch": 30000
},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
}
},

View file

@ -41,7 +41,14 @@
"londonBlock": 12965000,
"arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000,
"ethash": {}
"ethash": {},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
}
},
"context": {

View file

@ -56,7 +56,14 @@
"arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000,
"terminalTotalDifficultyPassed": true,
"ethash": {}
"ethash": {},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x0000000000000000000000000000000000000dead"
}
}
}
},
"context": {

View file

@ -53,7 +53,14 @@
"londonBlock": 12965000,
"arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000,
"ethash": {}
"ethash": {},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
}
},
"context": {

View file

@ -189,7 +189,14 @@
"londonBlock": 12965000,
"arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000,
"ethash": {}
"ethash": {},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
}
},
"context": {

View file

@ -41,7 +41,14 @@
"eip155Block": 10,
"eip158Block": 10,
"ethash": {},
"homesteadBlock": 0
"homesteadBlock": 0,
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
},
"difficulty": "3509749784",
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",

View file

@ -61,7 +61,14 @@
"londonBlock": 12965000,
"arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000,
"ethash": {}
"ethash": {},
"bor": {
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"burntContract": {
"0": "0x00000000000000000000000000000000000000000"
}
}
}
},
"context": {