From b5d92633b3268e5ab5f73d6845acb227ae88ece5 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Wed, 4 Oct 2023 15:17:12 -0400 Subject: [PATCH] factor out allocation limit --- vyper/codegen/memory_allocator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vyper/codegen/memory_allocator.py b/vyper/codegen/memory_allocator.py index 6d202ab36a..e444f4577e 100644 --- a/vyper/codegen/memory_allocator.py +++ b/vyper/codegen/memory_allocator.py @@ -46,6 +46,8 @@ class MemoryAllocator: next_mem: int + _ALLOCATION_LIMIT: int = 2**64 + def __init__(self, start_position: int = MemoryPositions.RESERVED_MEMORY): """ Initializer. @@ -111,10 +113,11 @@ def _expand_memory(self, size: int) -> int: self.next_mem += size self.size_of_mem = max(self.size_of_mem, self.next_mem) - if self.size_of_mem >= 2**64: + if self.size_of_mem >= self._ALLOCATION_LIMIT: # this should not be caught raise MemoryAllocationException( - "Tried to allocate {self.size_of_mem} bytes! (limit is 2**32 bytes)" + f"Tried to allocate {self.size_of_mem} bytes! " + f"(limit is 2**64 bytes)" ) return before_value