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

Ethereum Service meta data label update #126

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions seedemu/services/EthereumService/EthereumServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from .EthTemplates import EthServerFileTemplates, GethCommandTemplates
from .EthTemplates.LighthouseCommandTemplates import *

ETH_LABEL_META = 'ethereum.{key}'

class EthereumServer(Server):
"""!
@brief The Ethereum Server
Expand Down Expand Up @@ -38,7 +40,9 @@ class EthereumServer(Server):
_miner_thread: int
_coinbase: str

_geth_start_command:str
_geth_start_command: str

_role: list

def __init__(self, id: int, blockchain:Blockchain):
"""!
Expand Down Expand Up @@ -75,6 +79,8 @@ def __init__(self, id: int, blockchain:Blockchain):
self._miner_thread = 1
self._coinbase = ""
self._geth_start_command = ""

self._role = []


def _generateGethStartCommand(self):
Expand Down Expand Up @@ -111,10 +117,14 @@ def install(self, node: Node, eth: EthereumService):
"""

node.appendClassName('EthereumService')
node.setLabel('node_id', self.getId())
node.setLabel('consensus', self._consensus_mechanism.value)
node.setLabel('blockchain', self._blockchain.getChainName())
node.setLabel('chain_id', self._blockchain.getChainId())
node.setLabel(ETH_LABEL_META.format(key='node_id'), self.getId())
node.setLabel(ETH_LABEL_META.format(key='consensus'), self._consensus_mechanism.value)
node.setLabel(ETH_LABEL_META.format(key='chain_name'), self._blockchain.getChainName())
node.setLabel(ETH_LABEL_META.format(key='chain_id'), self._blockchain.getChainId())

if self.isBootNode(): self._role.append("bootnode")
if self.isStartMiner(): self._role.append("miner")
node.setLabel(ETH_LABEL_META.format(key='role'), json.dumps(self._role).replace("\"", "\\\""))

ifaces = node.getInterfaces()
assert len(ifaces) > 0, 'EthereumServer::install: node as{}/{} has no interfaces'.format(node.getAsn(), node.getName())
Expand Down Expand Up @@ -586,6 +596,11 @@ def install(self, node: Node, eth: EthereumService):
beacon_setup_node.install(node, self._blockchain)
return

if self.__is_beacon_validator_at_genesis:
self._role.append("validator_at_genesis")
if self.__is_beacon_validator_at_running:
self._role.append("validator_at_running")

super().install(node,eth)
self.__install_beacon(node, eth)

Expand Down