fix(gas): when estimating GasLimit only apply priors up to the nonce
The bug is applying all messages from given From address are priors before appling the message that we are estimating. If user tries replacing message in the middle with gas limit estimation then message sequence is off and user will either get an execution error or gas mis-esimation. Resolves #5402 Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
29b076ad69
commit
8c7fda4441
@ -229,6 +229,9 @@ func gasEstimateGasLimit(
|
|||||||
pending, ts := mpool.PendingFor(fromA)
|
pending, ts := mpool.PendingFor(fromA)
|
||||||
priorMsgs := make([]types.ChainMsg, 0, len(pending))
|
priorMsgs := make([]types.ChainMsg, 0, len(pending))
|
||||||
for _, m := range pending {
|
for _, m := range pending {
|
||||||
|
if m.Message.Nonce == msg.Nonce {
|
||||||
|
break
|
||||||
|
}
|
||||||
priorMsgs = append(priorMsgs, m)
|
priorMsgs = append(priorMsgs, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user