Skip to content

Commit

Permalink
Update contract size tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl committed Nov 2, 2023
1 parent 869b50f commit 9dca6dc
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/functional/feature_evm_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,34 @@ def non_payable_proxied_contract(self):

# should fail since it is larger than DVM TX size limit
def fail_send_large_tx(self):
self.rollback_to(self.start_height)

# 65404 bytes in data is the max that will go through with 64k limit
# TODO: Precise calc on the DVM envelope + EVM rest of the TX data to verify
max_allowed = 65404
tx = self.node.w3.eth.send_transaction(
{
"to": "0x0000000000000000000000000000000000000000",
"from": self.evm_key_pair.address,
"data": "0x" + "ff" * max_allowed,
"value": self.node.w3.to_hex(self.node.w3.to_wei("1", "ether")),
"gas": 10_000_000,
}
)

self.node.generate(1)
block = self.nodes[0].eth_getBlockByNumber("latest")
assert_equal(len(block["transactions"]), 1)

# +1 should not work
assert_raises_web3_error(
-32001,
"reason: scriptpubkey",
self.node.w3.eth.send_transaction,
{
"to": "0x0000000000000000000000000000000000000000",
"from": self.evm_key_pair.address,
"data": "0x" + "ff" * 64000,
"data": "0x" + "ff" * (max_allowed + 1),
"value": self.node.w3.to_hex(self.node.w3.to_wei("1", "ether")),
"gas": 10_000_000,
},
Expand Down

0 comments on commit 9dca6dc

Please sign in to comment.