From e3db4b27e6096108871eb46f582618be422a11c9 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 11 Mar 2024 13:55:59 -0400 Subject: [PATCH] switch back to L1Gas --- relayer/pkg/chainlink/txm/txm.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/relayer/pkg/chainlink/txm/txm.go b/relayer/pkg/chainlink/txm/txm.go index 9d9c68030..f9c986efe 100644 --- a/relayer/pkg/chainlink/txm/txm.go +++ b/relayer/pkg/chainlink/txm/txm.go @@ -310,21 +310,21 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun return txhash, fmt.Errorf("failed to get FRI estimate") } - txm.lggr.Infow("Fee estimate", "unit", friEstimate.FeeUnit) + txm.lggr.Infow("Fee estimate", "in units", friEstimate.FeeUnit) - // pad estimate to 140% (add extra because estimate did not include validation) + // pad estimate to 120% (add extra because estimate did not include validation) gasConsumed := friEstimate.GasConsumed.BigInt(new(big.Int)) - expandedGas := new(big.Int).Mul(gasConsumed, big.NewInt(140)) + expandedGas := new(big.Int).Mul(gasConsumed, big.NewInt(120)) maxGas := new(big.Int).Div(expandedGas, big.NewInt(100)) - tx.ResourceBounds.L2Gas.MaxAmount = starknetrpc.U64(starknetutils.BigIntToFelt(maxGas).String()) + tx.ResourceBounds.L1Gas.MaxAmount = starknetrpc.U64(starknetutils.BigIntToFelt(maxGas).String()) // pad by 120% gasPrice := friEstimate.GasPrice.BigInt(new(big.Int)) expandedGasPrice := new(big.Int).Mul(gasPrice, big.NewInt(120)) maxGasPrice := new(big.Int).Div(expandedGasPrice, big.NewInt(100)) - tx.ResourceBounds.L2Gas.MaxPricePerUnit = starknetrpc.U128(starknetutils.BigIntToFelt(maxGasPrice).String()) + tx.ResourceBounds.L1Gas.MaxPricePerUnit = starknetrpc.U128(starknetutils.BigIntToFelt(maxGasPrice).String()) - txm.lggr.Infow("Set resource bounds", "L2MaxAmount", tx.ResourceBounds.L2Gas.MaxAmount, "L2MaxPricePerUnit", tx.ResourceBounds.L2Gas.MaxPricePerUnit) + txm.lggr.Infow("Set resource bounds", "L1MaxAmount", tx.ResourceBounds.L1Gas.MaxAmount, "L1MaxPricePerUnit", tx.ResourceBounds.L1Gas.MaxPricePerUnit) // Re-sign transaction now that we've determined MaxFee // TODO: SignInvokeTransaction for V3 is missing so we do it by hand