Berlin Fork Upgrade - Matic Mainnet

Hi All,
We are excited to announce Berlin Fork Upgrade for Matic Mainnet!

The Matic Mainnet will be upgrading to the latest Geth with Berlin Fork updates. Mainnet will hit the Berlin fork at block number 14750000, at around 7AM UTC on 21st May 2021. You will need to upgrade before 21st May 2021 to ensure that your node stays in sync. If you do not upgrade your node before that, it will go out of sync.

Please follow the instructions below to upgrade your Node. This is applicable to all full nodes you are running - including sentry, validator, archive, rpc nodes.

  1. Navigate to bor code directory

    cd ~/bor
    
  2. Fetch latest changes and use Bor v0.2.5:

    git fetch
    git checkout v0.2.5
    
  3. Stop the bor service

    sudo service bor stop
    
  4. Build latest changes

    make bor-all
    

    Now check bor version. This should print β€”

    Bor
    Version: 1.10.1-stable
    Git Commit: 11880ac9703c438fc97fd62eaabfb7ccb99f96cc
    Architecture: amd64
    Go Version: go1.15.5
    Operating System: linux
    
  5. Go back to home directory

    cd ~
    
  6. Download the new genesis file:

    curl https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/sentry/sentry/bor/genesis.json > ~/genesis.json
    
  7. Init bor with new genesis file (with berlin fork enabled). Make sure you specify the correct data directory. If you have used ansible, it will be at ~/.bor/data by default. If you are not using the defaults, please modify the datadir in the following command:

    bor --datadir ~/.bor/data init ~/genesis.json
    

    This should print β€œSuccessfully wrote genesis state” on your console. That means it was successful.

  8. Few flags were deprecated in the latest version. Below is the list of deprecated flags (on the left) and the new flag that you need to replace with (on the right). You will have to update the deprecated flags only if your ~/node/bor/start.sh already contains any of these flags in the bor command. If you do not have these flags, no action needs to be taken and you can proceed to the next step.

    --rpc -> --http - Enable the HTTP-RPC server
    --rpcaddr -> --http.addr - HTTP-RPC server listening interface
    --rpcport -> --http.port - HTTP-RPC server listening port
    --rpccorsdomain -> --http.corsdomain - Domain from which to accept requests
    --rpcvhosts -> --http.vhosts - Virtual hostnames from which to accept requests
    --rpcapi -> --http.api - API's offered over the HTTP-RPC interface
    --wsaddr -> --ws.addr - WS-RPC server listening interface
    --wsport -> --ws.port - WS-RPC server listening port
    --wsorigins -> --ws.origins - Origins from which to accept websockets requests
    --wsapi -> --ws.api - API's offered over the WS-RPC interface
    --gpoblocks -> --gpo.blocks - Number of blocks to check for gas prices
    --gpopercentile -> --gpo.percentile - Percentile of recent txs to use as gas suggestion
    --graphql.addr -> --graphql - Enable GraphQL on the HTTP-RPC server
    --graphql.port -> --graphql - Enable GraphQL on the HTTP-RPC server
    --pprofport -> --pprof.port - Profiler HTTP server listening port
    --pprofaddr -> --pprof.addr - Profiler HTTP server listening interface
    --memprofilerate -> --pprof.memprofilerate - Turn on memory profiling with the given rate
    --blockprofilerate -> --pprof.blockprofilerate - Turn on block profiling with the given rate
    --cpuprofile -> --pprof.cpuprofile - Write CPU profile to the given file
    
  9. Start the bor service

    sudo service bor start
    
  10. Check if the logs are reflecting the berlin block changes:

    journalctl -u bor --since today | grep -i berlin
    

    and verify that you see this text Berlin: 14750000 in the output. It will look something like this:

    May 19 15:29:21 ip-40-0-0-33 bash[28667]: INFO [05-19|15:29:21.539] Initialised chain configuration          config="{ChainID: 137 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 3395000, Muir Glacier: 3395000, **Berlin: 14750000**, YOLO v3: <nil>, Engine: bor}"
    

    If not, please run steps (5), (6) & (7) above and ensure that you are getting the expected output.
    Thank you!

1 Like

Hard to spot it, it’s in Initialised chain configuration.

Better to run sudo journalctl -n 1000 -u bor | grep 14750000

1 Like

Thanks for highlighting this, editing the instructions now.

On step 8, one has to change only flags which are already in your start.sh. No need to add all flags. It’s just flag names changed in this release. It was deprecated before.

Few nodes will have new flags already. In that case no need to change anything.

1 Like

Updated step (8) in the instructions.