perf: eth: gas estimate set applyTsMessages false (#10546)
* have gas estimate call callInternal with applyTsMessages = false and other calls with applyTsMessages=true for gas caclulation optimization * set applyTsMessages = true in CallWithGas call in shed * update test with new callwithgas api optimization for eth call * Update chain/stmgr/call.go Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com> * env flag LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS must be 1 in order to have applyTsMessages change * env flag LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS must be 1 in order to have applyTsMessages change * make sure that even if we arent apply ts messages we grab ts messages from the particular user who is requesting gas estimation --------- Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com> Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com> Co-authored-by: Ubuntu <ubuntu@ip-10-0-4-29.us-east-2.compute.internal>
This commit is contained in:
co-authored by
Łukasz Magiera
Jiaying Wang
Ubuntu
parent
4efc29aa64
commit
41fce94db4
+13
-2
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"sync"
|
||||
@@ -888,9 +889,14 @@ func (a *EthModule) applyMessage(ctx context.Context, msg *types.Message, tsk ty
|
||||
return nil, xerrors.Errorf("cannot get tipset: %w", err)
|
||||
}
|
||||
|
||||
applyTsMessages := true
|
||||
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
|
||||
applyTsMessages = false
|
||||
}
|
||||
|
||||
// Try calling until we find a height with no migration.
|
||||
for {
|
||||
res, err = a.StateManager.CallWithGas(ctx, msg, []types.ChainMsg{}, ts)
|
||||
res, err = a.StateManager.CallWithGas(ctx, msg, []types.ChainMsg{}, ts, applyTsMessages)
|
||||
if err != stmgr.ErrExpensiveFork {
|
||||
break
|
||||
}
|
||||
@@ -959,10 +965,15 @@ func gasSearch(
|
||||
high := msg.GasLimit
|
||||
low := msg.GasLimit
|
||||
|
||||
applyTsMessages := true
|
||||
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
|
||||
applyTsMessages = false
|
||||
}
|
||||
|
||||
canSucceed := func(limit int64) (bool, error) {
|
||||
msg.GasLimit = limit
|
||||
|
||||
res, err := smgr.CallWithGas(ctx, &msg, priorMsgs, ts)
|
||||
res, err := smgr.CallWithGas(ctx, &msg, priorMsgs, ts, applyTsMessages)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("CallWithGas failed: %w", err)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
lru "github.com/hashicorp/golang-lru/v2"
|
||||
@@ -276,10 +277,15 @@ func gasEstimateCallWithGas(
|
||||
priorMsgs = append(priorMsgs, m)
|
||||
}
|
||||
|
||||
applyTsMessages := true
|
||||
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
|
||||
applyTsMessages = false
|
||||
}
|
||||
|
||||
// Try calling until we find a height with no migration.
|
||||
var res *api.InvocResult
|
||||
for {
|
||||
res, err = smgr.CallWithGas(ctx, &msg, priorMsgs, ts)
|
||||
res, err = smgr.CallWithGas(ctx, &msg, priorMsgs, ts, applyTsMessages)
|
||||
if err != stmgr.ErrExpensiveFork {
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user