diff --git a/tests/functional/syntax/test_block.py b/tests/functional/syntax/test_block.py index 1cfdc87a5c..6a90f8f992 100644 --- a/tests/functional/syntax/test_block.py +++ b/tests/functional/syntax/test_block.py @@ -138,7 +138,7 @@ def foo(): """ @external def foo(): - x: uint256 = block.prevrandao + 185 + x: bytes32 = block.prevrandao if tx.origin == self: y: Bytes[35] = concat(block.prevhash, b"dog") """, diff --git a/vyper/codegen/expr.py b/vyper/codegen/expr.py index d7afe6c7f6..62c776134c 100644 --- a/vyper/codegen/expr.py +++ b/vyper/codegen/expr.py @@ -273,7 +273,7 @@ def parse_Attribute(self): warning = "tried to use block.prevrandao in pre-Paris " warning += "environment! Suggest using block.difficulty instead." vyper_warn(warning, self.expr) - return IRnode.from_list(["prevrandao"], typ=UINT256_T) + return IRnode.from_list(["prevrandao"], typ=BYTES32_T) elif key == "block.difficulty": if version_check(begin="paris"): warning = "tried to use block.difficulty in post-Paris " diff --git a/vyper/semantics/environment.py b/vyper/semantics/environment.py index 94a26157af..2585521f21 100644 --- a/vyper/semantics/environment.py +++ b/vyper/semantics/environment.py @@ -19,7 +19,7 @@ class _Block(_EnvType): _type_members = { "coinbase": AddressT(), "difficulty": UINT256_T, - "prevrandao": UINT256_T, + "prevrandao": BYTES32_T, "number": UINT256_T, "gaslimit": UINT256_T, "basefee": UINT256_T,