Skip to content

Fix web3 and yaml dependency #204

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

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion seedemu/layers/ScionRouting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os.path
from typing import Dict

import yaml

from seedemu.core import Emulator, Node, ScionAutonomousSystem, ScionRouter
from seedemu.layers import Routing, ScionBase, ScionIsd
Expand Down Expand Up @@ -175,6 +174,8 @@ def __provision_router_config(router: ScionRouter):
def _provision_cs_config(node: Node, as_: ScionAutonomousSystem):
"""Set control service configuration."""

import yaml

# Start building the beaconing section
beaconing = ["[beaconing]"]
interval_keys = ["origination_interval", "propagation_interval", "registration_interval"]
Expand Down
6 changes: 3 additions & 3 deletions seedemu/services/EthereumService/EthUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
from datetime import datetime, timezone
from os import path
from .EthTemplates import GenesisFileTemplates
from web3 import Web3
from sys import stderr
from time import time

class Genesis():
"""!
@brief Genesis manage class
"""

__genesis:dict
__consensusMechanism:ConsensusMechanism

Expand Down Expand Up @@ -70,6 +68,7 @@ def addLocalAccount(self, address:str, balance:int) -> Genesis:

@returns self, for chaining calls.
"""
from web3 import Web3

assert balance >= 0, "Genesis::allocateBalance: balance cannot have a negative value. Requested Balance Value : {}".format(balance)
checksum_address = Web3.toChecksumAddress(address)
Expand Down Expand Up @@ -148,7 +147,6 @@ class EthAccount():
"""
@brief Ethereum Local Account.
"""

@staticmethod
def importAccount(keyfilePath: str, balance:int, password = "admin"):
"""
Expand Down Expand Up @@ -181,6 +179,8 @@ def __encryptAccount(account, password:str):
@staticmethod
def createEmulatorAccountFromMnemonic(id:int, mnemonic:str, balance:int, index:int, password:str):
from eth_account import Account
from web3 import Web3

Account.enable_unaudited_hdwallet_features()

EthAccount._log('creating node_{} emulator account {} from mnemonic...'.format(id, index))
Expand Down
4 changes: 2 additions & 2 deletions seedemu/services/EthereumService/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
from .EthTemplates import *
from .EthEnum import ConsensusMechanism, Syncmode, EthereumServerTypes
from .EthUtil import Genesis, AccountStructure, SmartContract, EthAccount
from .EthereumServer import *
from .EthereumService import *
from .EthereumServer import EthereumServer, PoAServer, PoWServer, PoSServer, BeaconSetupServer
from .EthereumService import Blockchain, EthereumService