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

Handle legacy fork id Eth/64 #1542

Merged

Conversation

AbdelStark
Copy link
Contributor

@AbdelStark AbdelStark commented Nov 9, 2020

PR description

The fork id computation has been updated to not include 0 fork blocks in the list of forks used to compute the fork id.
As a result, previous Besu versions are not capable anymore to talk to newest versions of Besu because their fork id are rejected with the new computation method.
We should allow previous Besu nodes to talk with new Besu nodes by adding a command line flag that enable the legacy fork id computation.
This PR adds a CLI flag to enable the legacy fork id computation method: --compatibility-eth64-forkid-enabled defaulted to false.

Fixed Issue(s)

Adresses #1541

Testing

Manual Test

Setup

Local testnet with 2 Besu nodes:

  • besu/v20.10.1-dev-9589ae08/osx-x86_64/adoptopenjdk-java-11
    • --compatibility-eth64-forkid-enabled=true
  • besu/v1.4.6/osx-x86_64/adoptopenjdk-java-11

Genesis

{
  "config": {
    "chainId": 1542,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 4,
    "byzantiumBlock": 5,
    "constantinopleBlock": 6,
    "petersburgBlock": 7,
    "istanbulBlock": 8,
    "muirGlacierBlock": 9,
    "ethash": {
    }
  },
  "difficulty": "0x20",
  "gasLimit": "0x200B20",
  "alloc": {
    "fe3b557e8fb62b89f4916b721be55ceb828dbd73": {
      "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
      "balance": "90000000000000000000000"
    },
    "627306090abaB3A6e1400e9345bC60c78a8BEf57": {
      "privateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
      "balance": "90000000000000000000000"
    },
    "f17f52151EbEF6C7334FAD080c5704D77216b732": {
      "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f",
      "balance": "90000000000000000000000"
    }
  }
}

Result

Nodes are able to communicate correctly using Eth/64 subprotocol.

Admin peers of besu/v20.10.1
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "version": "0x5",
            "name": "besu/v1.4.6/osx-x86_64/adoptopenjdk-java-11",
            "caps": [
                "eth/62",
                "eth/63",
                "eth/64"
            ],
            "network": {
                "localAddress": "127.0.0.1:50958",
                "remoteAddress": "127.0.0.1:40303"
            },
            "port": "0x9d6f",
            "id": "0x3eca270e124b5e24e846bb39d0a911d152cfd2671be079478e72e768363c959852301b40b2afffddbe45a285fd752fa4541e8376f73dad688757e0a07a35e164"
        }
    ]
}
Admin peers of besu/v1.4.6
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "version": "0x5",
            "name": "besu/v20.10.1-dev-9589ae08/osx-x86_64/adoptopenjdk-java-11",
            "caps": [
                "eth/62",
                "eth/63",
                "eth/64"
            ],
            "network": {
                "localAddress": "127.0.0.1:40303",
                "remoteAddress": "127.0.0.1:50958"
            },
            "port": "0x765f",
            "id": "0x1c6d296749018e4e4a78baf9a8a3048aae2557c3f2f11a340570d57e71071e2e9816a5f5d9215a333d12b432a81ff5017520b09461c4a102e72c7a1a2d9d7d0f"
        }
    ]
}

Unit tests

Added ForkIdBackwardCompatibilityTest class to cover backward compatibility testing.
Copied legacy ForkIdManager from Besu 1.4.6 and added as a test resource to compute expected results for tests.

Changelog

Signed-off-by: Abdelhamid Bakhta abdelhamid.bakhta@consensys.net

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark added bug Something isn't working P2 High (ex: Degrading performance issues, unexpected behavior of core features (DevP2P, syncing, etc)) labels Nov 9, 2020
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark self-assigned this Nov 9, 2020
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
Copy link
Contributor

@RatanRSur RatanRSur left a comment

Choose a reason for hiding this comment

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

@abdelhamidbakhta discovered some issues so just putting this here to signal that this shouldn't be merged

@AbdelStark AbdelStark marked this pull request as draft November 9, 2020 16:45
…ompatibility

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark marked this pull request as ready for review November 12, 2020 08:59
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark requested a review from RatanRSur November 12, 2020 12:52
Copy link
Contributor

@RatanRSur RatanRSur left a comment

Choose a reason for hiding this comment

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

Which pairs of versions was this tested on?

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark requested a review from RatanRSur November 12, 2020 13:24
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
…ompatibility

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark
Copy link
Contributor Author

AbdelStark commented Nov 12, 2020

Which pairs of versions was this tested on?

  • 20.10.1 <=> 1.4.6
  • 20.10.1 <=> 1.5.0
  • 20.1.1 <=> 1.5.1

@RatanRSur
Copy link
Contributor

And 1.4.6 and 1.5.0 is expected to continue to not work, correct? We're going to advise upgrading?

@AbdelStark
Copy link
Contributor Author

And 1.4.6 and 1.5.0 is expected to continue to not work, correct? We're going to advise upgrading?

Yes this is the plan for the moment.

Copy link
Contributor

@RatanRSur RatanRSur left a comment

Choose a reason for hiding this comment

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

Ok, cool. Appooved assuming that plan holds.

…ompatibility

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
…ompatibility

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

# Conflicts:
#	CHANGELOG.md
- change cli option name
- add unit tests

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@AbdelStark AbdelStark merged commit 0bedfff into hyperledger:master Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 High (ex: Degrading performance issues, unexpected behavior of core features (DevP2P, syncing, etc))
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants