File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ def test_worst_calldatacopy(
77
77
if size == 0 and non_zero_data :
78
78
pytest .skip ("Non-zero data with size 0 is not applicable." )
79
79
80
+ # If `non_zero_data` is True, we fill the calldata with deterministic random data.
81
+ # Note that if `size == 0` and `non_zero_data` is a skipped case.
82
+ data = Bytes ([i % 256 for i in range (size )]) if non_zero_data else Bytes ()
83
+
84
+ intrinsic_gas_calculator = fork .transaction_intrinsic_cost_calculator ()
85
+ min_gas = intrinsic_gas_calculator (calldata = data )
86
+ if min_gas > env .gas_limit :
87
+ pytest .skip ("Minimum gas required for calldata ({min_gas}) is greater than the gas limit" )
88
+
80
89
# We create the contract that will be doing the CALLDATACOPY multiple times.
81
90
#
82
91
# If `non_zero_data` is True, we leverage CALLDATASIZE for the copy length. Otherwise, since we
@@ -105,10 +114,6 @@ def test_worst_calldatacopy(
105
114
)
106
115
tx_target = pre .deploy_contract (code = code )
107
116
108
- # If `non_zero_data` is True, we fill the calldata with deterministic random data.
109
- # Note that if `size == 0` and `non_zero_data` is a skipped case.
110
- data = Bytes ([i % 256 for i in range (size )]) if non_zero_data else Bytes ()
111
-
112
117
tx = Transaction (
113
118
to = tx_target ,
114
119
gas_limit = env .gas_limit ,
You can’t perform that action at this time.
0 commit comments