Skip to content

Commit

Permalink
relayer/pkg/chainlink/txm/txm.go: set L1Gas instead
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Feb 28, 2024
1 parent b78003c commit 7ea334d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions relayer/pkg/chainlink/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
gasConsumed := friEstimate.GasConsumed.BigInt(new(big.Int))
expandedGas := new(big.Int).Mul(gasConsumed, big.NewInt(140))
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())

// TODO: add margin
tx.ResourceBounds.L2Gas.MaxPricePerUnit = starknetrpc.U128(friEstimate.GasPrice.String())
tx.ResourceBounds.L1Gas.MaxPricePerUnit = starknetrpc.U128(friEstimate.GasPrice.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
Expand Down

0 comments on commit 7ea334d

Please sign in to comment.