@@ -72,7 +72,7 @@ def _apply_msg(ext, msg, code):
72
72
if trace_msg :
73
73
log_msg .debug ("MSG APPLY" , sender = encode_hex (msg .sender ), to = encode_hex (msg .to ),
74
74
gas = msg .gas , value = msg .value ,
75
- data = encode_hex (msg .data .extract_all ()))
75
+ data = encode_hex (msg .data .extract_all ()) if msg . data . size < 2500 else ( "data<%d>" % msg . data . size ) )
76
76
if log_state .is_active ('trace' ):
77
77
log_state .trace ('MSG PRE STATE SENDER' , account = encode_hex (msg .sender ),
78
78
bal = ext .get_balance (msg .sender ),
@@ -97,7 +97,7 @@ def _apply_msg(ext, msg, code):
97
97
# assert utils.is_numeric(gas)
98
98
if trace_msg :
99
99
log_msg .debug ('MSG APPLIED' , gas_remained = gas ,
100
- sender = encode_hex (msg .sender ), to = encode_hex (msg .to ), data = dat )
100
+ sender = encode_hex (msg .sender ), to = encode_hex (msg .to ), data = dat if len ( dat ) < 2500 else ( "data<%d>" % len ( dat )) )
101
101
if log_state .is_active ('trace' ):
102
102
log_state .trace ('MSG POST STATE SENDER' , account = encode_hex (msg .sender ),
103
103
bal = ext .get_balance (msg .sender ),
@@ -118,40 +118,30 @@ def create_contract(ext, msg):
118
118
#print('CREATING WITH GAS', msg.gas)
119
119
sender = decode_hex (msg .sender ) if len (msg .sender ) == 40 else msg .sender
120
120
code = msg .data .extract_all ()
121
- if ext .post_metropolis_hardfork ():
122
- msg .to = mk_metropolis_contract_address (msg .sender , code )
123
- if ext .get_code (msg .to ):
124
- if ext .get_nonce (msg .to ) >= 2 ** 40 :
125
- ext .set_nonce (msg .to , (ext .get_nonce (msg .to ) + 1 ) % 2 ** 160 )
126
- msg .to = normalize_address ((ext .get_nonce (msg .to ) - 1 ) % 2 ** 160 )
127
- else :
128
- ext .set_nonce (msg .to , (big_endian_to_int (msg .to ) + 2 ) % 2 ** 160 )
129
- msg .to = normalize_address ((ext .get_nonce (msg .to ) - 1 ) % 2 ** 160 )
130
- else :
131
- if ext .tx_origin != msg .sender :
132
- ext .increment_nonce (msg .sender )
133
- nonce = utils .encode_int (ext .get_nonce (msg .sender ) - 1 )
134
- msg .to = mk_contract_address (sender , nonce )
121
+ if ext .tx_origin != msg .sender :
122
+ ext .increment_nonce (msg .sender )
123
+ nonce = utils .encode_int (ext .get_nonce (msg .sender ) - 1 )
124
+ msg .to = mk_contract_address (sender , nonce )
135
125
b = ext .get_balance (msg .to )
136
126
if b > 0 :
137
127
ext .set_balance (msg .to , b )
138
128
ext .set_nonce (msg .to , 0 )
139
129
ext .set_code (msg .to , b'' )
140
- ext .reset_storage (msg .to )
130
+ # ext.reset_storage(msg.to)
141
131
msg .is_create = True
142
132
# assert not ext.get_code(msg.to)
143
133
msg .data = vm .CallData ([], 0 , 0 )
144
134
snapshot = ext .snapshot ()
145
135
ext .set_nonce (msg .to , 1 if ext .post_clearing_hardfork () else 0 )
146
136
res , gas , dat = _apply_msg (ext , msg , code )
147
137
assert utils .is_numeric (gas )
148
- log_msg .debug ('CONTRACT CREATION FINISHED' , res = res , gas = gas , dat = dat )
138
+ log_msg .debug ('CONTRACT CREATION FINISHED' , res = res , gas = gas , dat = dat if len ( dat ) < 2500 else ( "data<%d>" % len ( dat )) )
149
139
150
140
if res :
151
141
if not len (dat ):
152
142
return 1 , gas , msg .to
153
143
gcost = len (dat ) * opcodes .GCONTRACTBYTE
154
- if gas >= gcost and len (dat ) < 24000 :
144
+ if gas >= gcost and ( len (dat ) <= 24576 or not ext . post_anti_dos_hardfork ()) :
155
145
gas -= gcost
156
146
else :
157
147
dat = []
0 commit comments