Skip to content

Commit b14c464

Browse files
Add log to addToGasPoolWithMultiGasConstraints
1 parent 0611789 commit b14c464

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

arbos/l2pricing/model.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"math/big"
99

1010
"github.com/ethereum/go-ethereum/arbitrum/multigas"
11+
"github.com/ethereum/go-ethereum/log"
1112
"github.com/ethereum/go-ethereum/params"
1213

1314
"github.com/offchainlabs/nitro/util/arbmath"
@@ -35,14 +36,6 @@ const (
3536
GasModelMultiGasConstraints
3637
)
3738

38-
var FeeRelevantResourceKinds = [...]multigas.ResourceKind{
39-
multigas.ResourceKindComputation,
40-
multigas.ResourceKindHistoryGrowth,
41-
multigas.ResourceKindStorageAccess,
42-
multigas.ResourceKindStorageGrowth,
43-
multigas.ResourceKindL1Calldata,
44-
}
45-
4639
func (ps *L2PricingState) GasModelToUse(arbosVersion uint64) (GasModel, error) {
4740
if arbosVersion >= ArbosMultiGasConstraintsVersion {
4841
constraintsLength, err := ps.MultiGasConstraintsLength()
@@ -85,7 +78,7 @@ func (ps *L2PricingState) AddToGasPool(growBacklog bool, usedGas uint64, usedMul
8578
case GasModelSingleGasConstraints:
8679
return ps.addToGasPoolWithSingleGasConstraints(growBacklog, usedGas)
8780
case GasModelMultiGasConstraints:
88-
return ps.addToGasPoolWithMultiGasConstraints(growBacklog, usedMultiGas)
81+
return ps.addToGasPoolWithMultiGasConstraints(growBacklog, usedGas, usedMultiGas)
8982
default:
9083
return fmt.Errorf("can not determine gas model")
9184
}
@@ -119,20 +112,24 @@ func (ps *L2PricingState) addToGasPoolWithSingleGasConstraints(growBacklog bool,
119112
return nil
120113
}
121114

122-
func (ps *L2PricingState) addToGasPoolWithMultiGasConstraints(growBacklog bool, usedGas multigas.MultiGas) error {
115+
func (ps *L2PricingState) addToGasPoolWithMultiGasConstraints(growBacklog bool, usedGas uint64, usedMultiGas multigas.MultiGas) error {
116+
if usedMultiGas.SingleGas() != usedGas {
117+
log.Warn("usedGas does not match sum of usedMultiGas", "usedGas", usedGas, "usedMultiGas", usedMultiGas.SingleGas())
118+
}
119+
123120
constraintsLength, err := ps.multigasConstraints.Length()
124121
if err != nil {
125122
return fmt.Errorf("failed to get number of multi-gas constraints: %w", err)
126123
}
127124
for i := range constraintsLength {
128125
constraint := ps.OpenMultiGasConstraintAt(i)
129126
if growBacklog {
130-
err = constraint.IncrementBacklog(usedGas)
127+
err = constraint.IncrementBacklog(usedMultiGas)
131128
if err != nil {
132129
return fmt.Errorf("failed to increment backlog of multi-gas constraint %v: %w", i, err)
133130
}
134131
} else {
135-
err = constraint.DecrementBacklog(usedGas)
132+
err = constraint.DecrementBacklog(usedMultiGas)
136133
if err != nil {
137134
return fmt.Errorf("failed to decrement backlog of multi-gas constraint %v: %w", i, err)
138135
}

0 commit comments

Comments
 (0)