Skip to content

Update minimum gasPrice for Gnosis#256

Merged
zsculac merged 7 commits intov8/developfrom
fix/gnosis-gasprice
Jul 10, 2025
Merged

Update minimum gasPrice for Gnosis#256
zsculac merged 7 commits intov8/developfrom
fix/gnosis-gasprice

Conversation

@Niks988
Copy link
Contributor

@Niks988 Niks988 commented Jul 9, 2025

PATCH: Force minimum gas price for Gnosis

try {
const response = await axios.get(blockchain.gasPriceOracleLink);
const fastGasPrice = Number(response?.data?.fast) * 1e9;
const fastGasPrice = Number(response ? .data ? .fast) * 1e9;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aditional spaces here need to be removed


try {
if (requestData?.paymaster && requestData?.paymaster !== ZERO_ADDRESS) {
if (requestData ? .paymaster && requestData ? .paymaster !== ZERO_ADDRESS) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong synatx

@Mihajlo-Pavlovic
Copy link
Collaborator

There are some formatting changes that look suspicius, but what you changed looks good. I woud just move that logic to this function:

    async getGnosisGasPrice(blockchain) {
        try {
            const response = await axios.get(blockchain.gasPriceOracleLink);
            const fastGasPrice = Number(response?.data?.fast) * 1e9;
            return fastGasPrice || DEFAULT_GAS_PRICE_WEI.GNOSIS;
        } catch (error) {
            console.warn(`Failed to fetch gas price from Gnosis oracle: ${error}`);
            return DEFAULT_GAS_PRICE_WEI.GNOSIS;
        }
    }

Can we move logic there and merge only those chagnes.

Also version bump is need, after version is updated and npm i is done we can release

const fastGasPrice = Number(response?.data?.fast) * 1e9;
return fastGasPrice || DEFAULT_GAS_PRICE_WEI.GNOSIS;
let fastGasPrice = Number(response?.data?.fast) * 1e9;
const minGnosisGasPrice = 1100000000; // 1.1 Gwei
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a constant and reuse it in catch?

const minGnosisGasPrice = 1100000000; // 1.1 Gwei
// Enforce minimum
if (!fastGasPrice || fastGasPrice < minGnosisGasPrice) {
fastGasPrice = minGnosisGasPrice;
Copy link
Contributor

@zsculac zsculac Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fastGasPrice is multiplied by 1e9 but minGnosisGasPrice is not. That seems to suggest that the final value should be in wei, not gwei.

However, when you're assigning fastGasPrice = minGnosisGasPrice, fastGasPrice becomes a gwei value. Same for the catch block

gasPrice = Number(response.result, 10);
} else if (blockchain.name.split(':')[1] === '10200') {
gasPrice = Math.round((response.data.fast) * 1e9);
gasPrice = Math.round(response.data.fast * 1e9);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be different if response fast is less than minimum required than use default values, also this is only change for testnet

@zsculac zsculac merged commit 53fd60e into v8/develop Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants