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

Implement engine_signalSuperchainV1 #148

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

mininny
Copy link

@mininny mininny commented Mar 12, 2024

Implementation for engine_signalSuperchainV1 method.
RPC Spec: See https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#engine_signalsuperchainv1

Optional extension to the Engine API. Signals superchain information to the Engine: V1 signals which protocol version is recommended and required.
Introduces rollup.halt run flag.

  • none, default
  • patch
  • minor
  • major

When rollup.halt is set to a specific version diff-level, the node will halt when the version difference is more significant than the diff-level specified. More specific examples of this behavior is explained in the testing section below.

When rollup.halt is not set, but there is a significant version difference, the node will leave logs with corresponding severity as well.

Based on ethereum-optimism/op-geth#128 with minimal changes.


Testing

I haven't found any traces of Engine API testing in the op-erigon repo, so I did manual testings by triggering engine_signalSuperchainV1 under different circumstances.

Start Node: RPC running at port 8545:

./build/bin/erigon --datadir=datadir --chain=op-sepolia --http.port=8751 --authrpc.port=8545 --torrent.port=42068 --no-downloader --nodiscover --private.api.addr=127.0.0.1:9091 --http --ws --http.api=admin,engine,eth --p2p.allowed-ports=30309,30310,30311  --authrpc.jwtsecret=../secrets/jwt.hex  --p2p.protocol=67,68  --log.console.verbosity=3

Scenario 1: Up-to-date engine protocol version

Node version: 3.1.1
Required version: 3.0.0
Recommended version: 3.1.0

Result is same for up-to-date engine for all flags

  • none/patch/minor/major
./build/bin/erigon OTHER_FLAGS --rollup.halt=none|patch|minor|major

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000000000000000000000", // Represents 3.0.0 
            "recommended": "0x0000000000000000000000000000000000000003000000010000000000000000" // Represents 3.1.0
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
{'jsonrpc': '2.0', 'id': 1, 'result': '0x0000000000000000000000000000000000000003000000010000000000000001'}
// Node Log
None

Scenario 2: Recommanded patch-outdated engine protocol version

Node version: 3.1.1
Required version: 3.1.0
Recommended version: 3.1.2

  • patch/minor/major
./build/bin/erigon OTHER_FLAGS --rollup.halt=patch|minor|major

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000010000000000000000", // Represents 3.1.0 
            "recommended": "0x0000000000000000000000000000000000000003000000010000000200000000" // Represents 3.1.2
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
{'jsonrpc': '2.0', 'id': 1, 'result': '0x0000000000000000000000000000000000000003000000010000000000000001'}
// Node Log
INFO[03-11|23:13:19.922] Outdated with support backward-compatible recommended protocol change local=v3.1.0-1 required=v3.1.0 recommended=v3.1.2

Scenario 3: Required patch-outdated engine protocol version

Node version: 3.1.1
Required version: 3.1.2
Recommended version: 3.1.2

  • patch
./build/bin/erigon OTHER_FLAGS --rollup.halt=patch

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000010000000200000000", // Represents 3.1.2
            "recommended": "0x0000000000000000000000000000000000000003000000010000000200000000" // Represents 3.1.2
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
http.client.RemoteDisconnected: Remote end closed connection without response
// Node Log
INFO[03-11|23:16:43.416] Outdated with support backward-compatible required protocol change local=v3.1.0-1 required=v3.1.2 recommended=v3.1.2
EROR[03-11|23:16:43.416] Opted to halt, unprepared for protocol change required=v3.1.2 local=v3.1.0-1
INFO[03-11|23:16:43.416] Exiting...
INFO[03-11|23:16:43.416] Exiting Engine...
INFO[03-11|23:16:43.416] HTTP endpoint closed                     url=127.0.0.1:8751
INFO[03-11|23:16:43.416] RPC server shutting down
  • minor/major
    Halting is ignored for rollup.halt=minor/major when the version diff is only patch-level.
./build/bin/erigon OTHER_FLAGS --rollup.halt=minor|major

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000010000000200000000", // Represents 3.1.2
            "recommended": "0x0000000000000000000000000000000000000003000000010000000200000000" // Represents 3.1.2
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
{'jsonrpc': '2.0', 'id': 1, 'result': '0x0000000000000000000000000000000000000003000000010000000000000001'}
// Node Log
INFO[03-11|23:17:29.527] Outdated with support backward-compatible recommended protocol change local=v3.1.0-1 required=v3.1.2 recommended=v3.1.2
INFO[03-11|23:17:29.527] Outdated with support backward-compatible required protocol change local=v3.1.0-1 required=v3.1.2 recommended=v3.1.2

Scenario 4: Required minor-outdated engine protocol version

Node version: 3.1.1
Required version: 3.2.0
Recommended version: 3.2.0

  • patch/minor
./build/bin/erigon OTHER_FLAGS --rollup.halt=patch|minor

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000020000000000000000", // Represents 3.2.0
            "recommended": "0x0000000000000000000000000000000000000003000000020000000000000000" // Represents 3.2.0
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
http.client.RemoteDisconnected: Remote end closed connection without response
// Node Log
WARN[03-11|23:20:39.938] Outdated with minor backward-compatible recommended protocol change local=v3.1.0-1 required=v3.2.0 recommended=v3.2.0
WARN[03-11|23:20:39.939] Outdated with minor backward-compatible required protocol change local=v3.1.0-1 required=v3.2.0 recommended=v3.2.0
EROR[03-11|23:20:39.939] Opted to halt, unprepared for protocol change required=v3.2.0 local=v3.1.0-1
INFO[03-11|23:20:39.939] Exiting...
INFO[03-11|23:20:39.939] HTTP endpoint closed                     url=127.0.0.1:8751
INFO[03-11|23:20:39.939] Exiting Engine...
INFO[03-11|23:20:39.939] RPC server shutting down
  • major
    Halting is ignored for rollup.halt=major when the version diff is only minor-level.
./build/bin/erigon OTHER_FLAGS --rollup.halt=major

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000003000000020000000000000000", // Represents 3.2.0
            "recommended": "0x0000000000000000000000000000000000000003000000020000000000000000" // Represents 3.2.0
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
{'jsonrpc': '2.0', 'id': 1, 'result': '0x0000000000000000000000000000000000000003000000010000000000000001'}
// Node Log
WARN[03-11|23:21:26.808] Outdated with minor backward-compatible recommended protocol change local=v3.1.0-1 required=v3.2.0 recommended=v3.2.0
WARN[03-11|23:21:26.808] Outdated with minor backward-compatible required protocol change local=v3.1.0-1 required=v3.2.0 recommended=v3.2.0

Scenario 5: Required major-outdated engine protocol version

Node version: 3.1.1
Required version: 4.0.0
Recommended version: 4.0.0

  • patch/minor/major
./build/bin/erigon OTHER_FLAGS --rollup.halt=patch|minor|major

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000004000000000000000000000000", // Represents 4.0.0
            "recommended": "0x0000000000000000000000000000000000000004000000000000000000000000" // Represents 4.0.0
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
http.client.RemoteDisconnected: Remote end closed connection without response
// Node Log
EROR[03-11|23:23:35.265] Outdated with major recommended protocol change local=v3.1.0-1 required=v4.0.0 recommended=v4.0.0
EROR[03-11|23:23:35.265] Outdated with major required protocol change local=v3.1.0-1 required=v4.0.0 recommended=v4.0.0
EROR[03-11|23:23:35.265] Opted to halt, unprepared for protocol change required=v4.0.0 local=v3.1.0-1
INFO[03-11|23:23:35.265] Exiting...
INFO[03-11|23:23:35.265] Exiting Engine...
INFO[03-11|23:23:35.265] RPC server shutting down
INFO[03-11|23:23:35.265] HTTP endpoint closed                     url=127.0.0.1:8751
  • none
    Halting is ignored for rollup.halt=none.
./build/bin/erigon OTHER_FLAGS --rollup.halt=none

RPC Sent:

{
    "jsonrpc": "2.0",
    "method": "engine_signalSuperchainV1",
    "params": [
        {
            "required": "0x0000000000000000000000000000000000000004000000000000000000000000", // Represents 4.0.0
            "recommended": "0x0000000000000000000000000000000000000004000000000000000000000000" // Represents 4.0.0
        }   
    ],
    "id": 1,
}

Result:

// RPC Response
{'jsonrpc': '2.0', 'id': 1, 'result': '0x0000000000000000000000000000000000000003000000010000000000000001'}
// Node Log
EROR[03-11|23:24:08.871] Outdated with major recommended protocol change local=v3.1.0-1 required=v4.0.0 recommended=v4.0.0
EROR[03-11|23:24:08.871] Outdated with major required protocol change local=v3.1.0-1 required=v4.0.0 recommended=v4.0.0

@mininny mininny requested review from pcw109550 and ImTei March 12, 2024 15:25
@mininny mininny self-assigned this Mar 12, 2024
Copy link
Member

@ImTei ImTei left a comment

Choose a reason for hiding this comment

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

Not yet reviewed detailed functionalities, but left some comments.

turbo/engineapi/engine_server.go Outdated Show resolved Hide resolved
cmd/utils/flags.go Outdated Show resolved Hide resolved
@mininny mininny force-pushed the mininny/engine_signalSuperChainV1 branch from fecdc47 to 47b9422 Compare March 18, 2024 09:46
Copy link
Member

@ImTei ImTei left a comment

Choose a reason for hiding this comment

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

I also manually tested RPC and it works!

params/superchain.go Outdated Show resolved Hide resolved
@mininny mininny requested a review from ImTei March 21, 2024 14:59
@ImTei ImTei merged commit a181e5e into op-erigon Mar 21, 2024
6 checks passed
@mininny mininny deleted the mininny/engine_signalSuperChainV1 branch March 24, 2024 22:07
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.

None yet

3 participants