Skip to content

Commit ae5f382

Browse files
committed
Some chain methods converted to classmethod
1 parent ab0482e commit ae5f382

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

eth/chains/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ def from_genesis_header(cls,
149149
#
150150
# VM API
151151
#
152-
def get_vm_class(self, header: BlockHeader) -> Type['BaseVM']:
152+
@classmethod
153+
def get_vm_class(cls, header: BlockHeader) -> Type['BaseVM']:
153154
"""
154155
Returns the VM instance for the given block number.
155156
"""
156-
return self.get_vm_class_for_block_number(header.block_number)
157+
return cls.get_vm_class_for_block_number(header.block_number)
157158

158159
@abstractmethod
159160
def get_vm(self, header: BlockHeader=None) -> 'BaseVM':

eth/vm/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,9 @@ def get_uncle_reward(block_number: int, uncle: BaseBlock) -> int:
238238
def create_transaction(self, *args, **kwargs):
239239
raise NotImplementedError("VM classes must implement this method")
240240

241+
@classmethod
241242
@abstractmethod
242-
def create_unsigned_transaction(self, *args, **kwargs):
243+
def create_unsigned_transaction(cls, *args, **kwargs):
243244
raise NotImplementedError("VM classes must implement this method")
244245

245246
@classmethod
@@ -646,11 +647,12 @@ def create_transaction(self, *args, **kwargs):
646647
"""
647648
return self.get_transaction_class()(*args, **kwargs)
648649

649-
def create_unsigned_transaction(self, *args, **kwargs):
650+
@classmethod
651+
def create_unsigned_transaction(cls, *args, **kwargs):
650652
"""
651653
Proxy for instantiating an unsigned transaction for this VM.
652654
"""
653-
return self.get_transaction_class().create_unsigned_transaction(*args, **kwargs)
655+
return cls.get_transaction_class().create_unsigned_transaction(*args, **kwargs)
654656

655657
@classmethod
656658
def get_transaction_class(cls):

0 commit comments

Comments
 (0)