Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Max fee less than base fee sometimes when deploying to alternative L1/L2 for rootchain #1738

Closed
iamarkdev opened this issue Jul 20, 2023 · 3 comments · Fixed by #1718

Comments

@iamarkdev
Copy link

iamarkdev commented Jul 20, 2023

Max fee less than base fee sometimes when deploying to alternative L1/L2 for rootchain

Description

If you're deploying to an alternative rootchain, such as Ethereum or Goerli, regardless of RPC used, the stake-manager-deploy and rootchain deploy command intermittently fails depending on network activity and gas fees. This issue occurs with an error along the lines of max fee per gas less than block base fee: address 0x5FFF686fF9dA3f66F6EC1C58Dd2C266390B6e53A, maxFeePerGas: 1496959907 baseFee: 1621120078 (supplied gas 15010499)

Your environment

Ubuntu
Polygon Edge tag v1.0.1
Cloud hosted (Using supernets terraform deployment)

Steps to reproduce

Run the https://github.com/maticnetwork/terraform-polygon-supernets deployment, but target Goerli Eth instead of the deployed geth instance.

Expected behavior

Rootchain contracts should deploy without issue, and occasionally without any other configuration changes they do - this seems to be dependent on the rootchain network gas/gwei price and network activity overall. When there's low to no network activity and fees are low, there's no issues.

Proposed solution

Fix plz

@iamarkdev
Copy link
Author

Just tried the same on Sepolia, same exact problem. err: max fee per gas less than block base fee: address 0x5FFF686fF9dA3f66F6EC1C58Dd2C266390B6e53A, maxFeePerGas: 164983 baseFee: 174243 (supplied gas 15010499)\"}

@iamarkdev
Copy link
Author

iamarkdev commented Jul 20, 2023

For further context, here is my bootstrap script I'm using with terraform-polygon-supernets.

#!/bin/bash -x

#
# NOTES:
# 1. deployer addr must be prefunded with stake token on rootchain
#

main() {
    if [[ -d "/var/lib/bootstrap" ]]; then
        echo "It appears this network has already been boot strapped"
        exit
    fi
    mkdir /var/lib/bootstrap
    pushd /var/lib/bootstrap

{% for item in hostvars %}
{% if (hostvars[item].tags.Role == "fullnode" or hostvars[item].tags.Role == "validator") %}
  polygon-edge polybft-secrets --data-dir {{ hostvars[item].tags["Name"] }} --json --insecure > {{ hostvars[item].tags["Name"] }}.json
{% endif %}
{% endfor %}

    apt update
    curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
    apt-get install -y nodejs

    pushd /opt/polygon-edge/
    make compile-core-contracts
    cp -r /opt/polygon-edge/core-contracts /var/lib/bootstrap/core-contracts/
    popd

    polygon-edge genesis \
                 --name {{ chain_name }} \
                 --consensus polybft \
                 --chain-id {{ chain_id }} \
                 {% for item in hostvars %}{% if (hostvars[item].tags.Role == "fullnode" or hostvars[item].tags.Role == "validator") %} --bootnode /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id') {% endif %}{% endfor %} \
                 --premine 0x0 {{ bridge_premine_amount }} \
                 --block-gas-limit {{ block_gas_limit }} \
                 --block-time {{ block_time }}s \
                 {% for item in hostvars %}{% if (hostvars[item].tags.Role == "validator") %} --validators /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address' | sed 's/^0x//'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_pubkey') {% endif %}{% endfor %} \
                 --epoch-size {{ epoch_size }} \
                 --epoch-reward {{ epoch_reward }} \
                 --reward-wallet {{ epoch_reward_wallet }}:{{ epoch_reward_wallet_premine }} \
                 --native-token-config {{ native_token_config }}

    polygon-edge polybft stake-manager-deploy \
        --genesis genesis.json \
        --stake-token {{ stake_token_address }} \
        --private-key {{ deployer_private_key }} \
        --jsonrpc {{ rootchain_json_rpc }}

    polygon-edge rootchain deploy \
                 --genesis genesis.json \
                 --stake-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.stakeManagerAddr') \
                 --stake-token {{ stake_token_address }} \
                 --erc20-token {{ stake_token_address }} \
                 --json-rpc {{ rootchain_json_rpc }} \
                 --deployer-key {{ deployer_private_key }}

    polygon-edge rootchain fund \
                --private-key {{ deployer_private_key }} \
                --addresses $(cat validator-*.json | jq -r ".[].address" | paste -sd "," - | tr -d '\n') \
                --amounts $(for f in validator-*.json; do echo -n "500000000000000000,"; done | sed 's/,$//') \
                --json-rpc {{ rootchain_json_rpc }}

    # transfer stake token to validators for staking requirements
    {% for item in hostvars %}
    {% if (hostvars[item].tags.Role == "validator") %}
      cast send --rpc-url {{ rootchain_json_rpc }} --from {{ deployer_address }} {{ stake_token_address }} "transfer(address,uint256)" $(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address') 1000000000000000000000000 --private-key {{ deployer_private_key }}
    {% endif %}
    {% endfor %}

     polygon-edge polybft whitelist-validators \
                  --private-key {{ deployer_private_key }} \
                  --addresses $(cat validator-*.json | jq -r ".[].address" | paste -sd "," - | tr -d '\n') \
                  --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \
                  --jsonrpc {{ rootchain_json_rpc }}

    counter=1
{% for item in hostvars %}
{% if (hostvars[item].tags.Role == "validator") %}
    echo "Registering validator: ${counter}"

    polygon-edge polybft register-validator \
                 --data-dir {{ hostvars[item].tags["Name"] }} \
                 --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \
                 --jsonrpc {{ rootchain_json_rpc }}

    polygon-edge polybft stake \
                 --data-dir {{ hostvars[item].tags["Name"] }} \
                 --amount 1000000000000000000000000 \
                 --supernet-id $(cat genesis.json | jq -r '.params.engine.polybft.supernetID') \
                 --stake-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.stakeManagerAddr') \
                 --stake-token {{ stake_token_address }} \
                 --jsonrpc {{ rootchain_json_rpc }}

    ((counter++))
{% endif %}
{% endfor %}

{% for item in hostvars %}
{% if (hostvars[item].tags.Role == "validator") %}
{% endif %}
{% endfor %}

    polygon-edge polybft supernet \
                 --private-key {{ deployer_private_key }} \
                 --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \
                 --stake-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.stakeManagerAddr') \
                 --finalize-genesis-set \
                 --enable-staking \
                 --jsonrpc {{ rootchain_json_rpc }}

    tar czf {{ base_dn }}.tar.gz *.json *.private
    popd
}

main

@Stefan-Ethernal
Copy link
Collaborator

This is fixed in #1718, which is going to be included in the next release, which is expected in the following days.

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 a pull request may close this issue.

2 participants