@@ -59,13 +59,13 @@ func TestNewContractInstanceCosts(t *testing.T) {
59
59
srcLen : 1 ,
60
60
srcConfig : DefaultGasRegisterConfig (),
61
61
pinned : true ,
62
- exp : sdk . Gas ( 1 ) ,
62
+ exp : DefaultContractMessageDataCost ,
63
63
},
64
64
"big msg - pinned" : {
65
65
srcLen : math .MaxUint32 ,
66
66
srcConfig : DefaultGasRegisterConfig (),
67
67
pinned : true ,
68
- exp : sdk .Gas (math .MaxUint32 ),
68
+ exp : DefaultContractMessageDataCost * sdk .Gas (math .MaxUint32 ),
69
69
},
70
70
"empty msg - pinned" : {
71
71
srcLen : 0 ,
@@ -76,18 +76,17 @@ func TestNewContractInstanceCosts(t *testing.T) {
76
76
"small msg - unpinned" : {
77
77
srcLen : 1 ,
78
78
srcConfig : DefaultGasRegisterConfig (),
79
- pinned : true ,
80
- exp : sdk .Gas (1 ),
79
+ exp : DefaultContractMessageDataCost + DefaultInstanceCost ,
81
80
},
82
81
"big msg - unpinned" : {
83
82
srcLen : math .MaxUint32 ,
84
83
srcConfig : DefaultGasRegisterConfig (),
85
- exp : sdk .Gas (math .MaxUint32 + 40_000 ),
84
+ exp : sdk .Gas (DefaultContractMessageDataCost * math .MaxUint32 + DefaultInstanceCost ),
86
85
},
87
86
"empty msg - unpinned" : {
88
87
srcLen : 0 ,
89
88
srcConfig : DefaultGasRegisterConfig (),
90
- exp : sdk .Gas (40_000 ),
89
+ exp : sdk .Gas (DefaultInstanceCost ),
91
90
},
92
91
93
92
"negative len" : {
@@ -123,13 +122,13 @@ func TestContractInstanceCosts(t *testing.T) {
123
122
srcLen : 1 ,
124
123
srcConfig : DefaultGasRegisterConfig (),
125
124
pinned : true ,
126
- exp : sdk . Gas ( 1 ) ,
125
+ exp : DefaultContractMessageDataCost ,
127
126
},
128
127
"big msg - pinned" : {
129
128
srcLen : math .MaxUint32 ,
130
129
srcConfig : DefaultGasRegisterConfig (),
131
130
pinned : true ,
132
- exp : sdk .Gas (math .MaxUint32 ),
131
+ exp : sdk .Gas (DefaultContractMessageDataCost * math .MaxUint32 ),
133
132
},
134
133
"empty msg - pinned" : {
135
134
srcLen : 0 ,
@@ -140,18 +139,17 @@ func TestContractInstanceCosts(t *testing.T) {
140
139
"small msg - unpinned" : {
141
140
srcLen : 1 ,
142
141
srcConfig : DefaultGasRegisterConfig (),
143
- pinned : true ,
144
- exp : sdk .Gas (1 ),
142
+ exp : DefaultContractMessageDataCost + DefaultInstanceCost ,
145
143
},
146
144
"big msg - unpinned" : {
147
145
srcLen : math .MaxUint32 ,
148
146
srcConfig : DefaultGasRegisterConfig (),
149
- exp : sdk .Gas (math .MaxUint32 + 40_000 ),
147
+ exp : sdk .Gas (DefaultContractMessageDataCost * math .MaxUint32 + DefaultInstanceCost ),
150
148
},
151
149
"empty msg - unpinned" : {
152
150
srcLen : 0 ,
153
151
srcConfig : DefaultGasRegisterConfig (),
154
- exp : sdk .Gas (40_000 ),
152
+ exp : sdk .Gas (DefaultInstanceCost ),
155
153
},
156
154
157
155
"negative len" : {
@@ -195,7 +193,7 @@ func TestReplyCost(t *testing.T) {
195
193
},
196
194
srcConfig : DefaultGasRegisterConfig (),
197
195
pinned : true ,
198
- exp : sdk .Gas (3 + 10 + 1 ), // len("foo") + 1 * DefaultPerAttributeCost + len(data )
196
+ exp : sdk .Gas (3 * DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost ), // 3 == len("foo")
199
197
},
200
198
"subcall response with events - pinned" : {
201
199
src : wasmvmtypes.Reply {
@@ -209,7 +207,7 @@ func TestReplyCost(t *testing.T) {
209
207
},
210
208
srcConfig : DefaultGasRegisterConfig (),
211
209
pinned : true ,
212
- exp : sdk .Gas (3 + 10 ), // len("foo") + 1 * DefaultPerAttributeCost
210
+ exp : sdk .Gas (3 * DefaultEventAttributeDataCost + DefaultPerAttributeCost ), // 3 == len("foo")
213
211
},
214
212
"subcall response with events exceeds free tier- pinned" : {
215
213
src : wasmvmtypes.Reply {
@@ -223,7 +221,7 @@ func TestReplyCost(t *testing.T) {
223
221
},
224
222
srcConfig : DefaultGasRegisterConfig (),
225
223
pinned : true ,
226
- exp : sdk .Gas (3 + 10 + 6 ), // len("foo") + 1 * DefaultPerAttributeCost + len("myData")
224
+ exp : sdk .Gas (( 3 + 6 ) * DefaultEventAttributeDataCost + DefaultPerAttributeCost ), // 3 == len("foo"), 6 == len("myData")
227
225
},
228
226
"subcall response error - pinned" : {
229
227
src : wasmvmtypes.Reply {
@@ -233,7 +231,7 @@ func TestReplyCost(t *testing.T) {
233
231
},
234
232
srcConfig : DefaultGasRegisterConfig (),
235
233
pinned : true ,
236
- exp : sdk . Gas ( 3 ), // len("foo")
234
+ exp : 3 * DefaultContractMessageDataCost ,
237
235
},
238
236
"subcall response with events and data - unpinned" : {
239
237
src : wasmvmtypes.Reply {
@@ -247,7 +245,7 @@ func TestReplyCost(t *testing.T) {
247
245
},
248
246
},
249
247
srcConfig : DefaultGasRegisterConfig (),
250
- exp : sdk .Gas (40_000 + 3 + 10 + 1 ), // DefaultInstanceCost len("foo") + 1 * DefaultPerAttributeCost + len(data)
248
+ exp : sdk .Gas (DefaultInstanceCost + 3 * DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost ),
251
249
},
252
250
"subcall response with events - unpinned" : {
253
251
src : wasmvmtypes.Reply {
@@ -260,7 +258,7 @@ func TestReplyCost(t *testing.T) {
260
258
},
261
259
},
262
260
srcConfig : DefaultGasRegisterConfig (),
263
- exp : sdk .Gas (40_000 + 3 + 10 ), // DefaultInstanceCost + len("foo") + 1 * DefaultPerAttributeCost
261
+ exp : sdk .Gas (DefaultInstanceCost + 3 * DefaultEventAttributeDataCost + DefaultPerAttributeCost ),
264
262
},
265
263
"subcall response with events exceeds free tier- unpinned" : {
266
264
src : wasmvmtypes.Reply {
@@ -273,7 +271,7 @@ func TestReplyCost(t *testing.T) {
273
271
},
274
272
},
275
273
srcConfig : DefaultGasRegisterConfig (),
276
- exp : sdk .Gas (40_000 + 3 + 10 + 6 ), // DefaultInstanceCost + len("foo") + 1 * DefaultPerAttributeCost + len("myData")
274
+ exp : sdk .Gas (DefaultInstanceCost + ( 3 + 6 ) * DefaultEventAttributeDataCost + DefaultPerAttributeCost ), // 3 == len("foo"), 6 == len("myData")
277
275
},
278
276
"subcall response error - unpinned" : {
279
277
src : wasmvmtypes.Reply {
@@ -282,7 +280,7 @@ func TestReplyCost(t *testing.T) {
282
280
},
283
281
},
284
282
srcConfig : DefaultGasRegisterConfig (),
285
- exp : sdk .Gas (40_000 + 3 ), // DefaultInstanceCost + len("foo")
283
+ exp : sdk .Gas (DefaultInstanceCost + 3 * DefaultContractMessageDataCost ),
286
284
},
287
285
}
288
286
for name , spec := range specs {
0 commit comments