@@ -191,9 +191,10 @@ func TestInitCacheEmptyCapabilities(t *testing.T) {
191
191
ReleaseCache (cache )
192
192
}
193
193
194
- func withCache (t testing.TB ) (Cache , func ()) {
194
+ func withCache (tb testing.TB ) (Cache , func ()) {
195
+ tb .Helper ()
195
196
tmpdir , err := os .MkdirTemp ("" , "wasmvm-testing" )
196
- require .NoError (t , err )
197
+ require .NoError (tb , err )
197
198
config := types.VMConfig {
198
199
Cache : types.CacheOptions {
199
200
BaseDir : tmpdir ,
@@ -203,7 +204,7 @@ func withCache(t testing.TB) (Cache, func()) {
203
204
},
204
205
}
205
206
cache , err := InitCache (config )
206
- require .NoError (t , err )
207
+ require .NoError (tb , err )
207
208
208
209
cleanup := func () {
209
210
os .RemoveAll (tmpdir )
@@ -868,6 +869,8 @@ func Benchmark100ConcurrentContractCalls(b *testing.B) {
868
869
resChan := make (chan []byte , callCount )
869
870
wg .Add (callCount )
870
871
872
+ info = MockInfoBin (b , "fred" )
873
+
871
874
for i := 0 ; i < callCount ; i ++ {
872
875
go func () {
873
876
defer wg .Done ()
@@ -1189,6 +1192,7 @@ func TestReplyAndQuery(t *testing.T) {
1189
1192
}
1190
1193
1191
1194
func requireOkResponse (tb testing.TB , res []byte , expectedMsgs int ) {
1195
+ tb .Helper ()
1192
1196
var result types.ContractResult
1193
1197
err := json .Unmarshal (res , & result )
1194
1198
require .NoError (tb , err )
@@ -1197,6 +1201,7 @@ func requireOkResponse(tb testing.TB, res []byte, expectedMsgs int) {
1197
1201
}
1198
1202
1199
1203
func requireQueryError (t * testing.T , res []byte ) {
1204
+ t .Helper ()
1200
1205
var result types.QueryResult
1201
1206
err := json .Unmarshal (res , & result )
1202
1207
require .NoError (t , err )
@@ -1205,6 +1210,7 @@ func requireQueryError(t *testing.T, res []byte) {
1205
1210
}
1206
1211
1207
1212
func requireQueryOk (t * testing.T , res []byte ) []byte {
1213
+ t .Helper ()
1208
1214
var result types.QueryResult
1209
1215
err := json .Unmarshal (res , & result )
1210
1216
require .NoError (t , err )
@@ -1213,36 +1219,43 @@ func requireQueryOk(t *testing.T, res []byte) []byte {
1213
1219
return result .Ok
1214
1220
}
1215
1221
1216
- func createHackatomContract (t testing.TB , cache Cache ) []byte {
1217
- return createContract (t , cache , "../../testdata/hackatom.wasm" )
1222
+ func createHackatomContract (tb testing.TB , cache Cache ) []byte {
1223
+ tb .Helper ()
1224
+ return createContract (tb , cache , "../../testdata/hackatom.wasm" )
1218
1225
}
1219
1226
1220
- func createCyberpunkContract (t testing.TB , cache Cache ) []byte {
1221
- return createContract (t , cache , "../../testdata/cyberpunk.wasm" )
1227
+ func createCyberpunkContract (tb testing.TB , cache Cache ) []byte {
1228
+ tb .Helper ()
1229
+ return createContract (tb , cache , "../../testdata/cyberpunk.wasm" )
1222
1230
}
1223
1231
1224
- func createQueueContract (t testing.TB , cache Cache ) []byte {
1225
- return createContract (t , cache , "../../testdata/queue.wasm" )
1232
+ func createQueueContract (tb testing.TB , cache Cache ) []byte {
1233
+ tb .Helper ()
1234
+ return createContract (tb , cache , "../../testdata/queue.wasm" )
1226
1235
}
1227
1236
1228
- func createReflectContract (t testing.TB , cache Cache ) []byte {
1229
- return createContract (t , cache , "../../testdata/reflect.wasm" )
1237
+ func createReflectContract (tb testing.TB , cache Cache ) []byte {
1238
+ tb .Helper ()
1239
+ return createContract (tb , cache , "../../testdata/reflect.wasm" )
1230
1240
}
1231
1241
1232
- func createFloaty2 (t testing.TB , cache Cache ) []byte {
1233
- return createContract (t , cache , "../../testdata/floaty_2.0.wasm" )
1242
+ func createFloaty2 (tb testing.TB , cache Cache ) []byte {
1243
+ tb .Helper ()
1244
+ return createContract (tb , cache , "../../testdata/floaty_2.0.wasm" )
1234
1245
}
1235
1246
1236
- func createContract (t testing.TB , cache Cache , wasmFile string ) []byte {
1247
+ func createContract (tb testing.TB , cache Cache , wasmFile string ) []byte {
1248
+ tb .Helper ()
1237
1249
wasm , err := os .ReadFile (wasmFile )
1238
- require .NoError (t , err )
1250
+ require .NoError (tb , err )
1239
1251
checksum , err := StoreCode (cache , wasm , true )
1240
- require .NoError (t , err )
1252
+ require .NoError (tb , err )
1241
1253
return checksum
1242
1254
}
1243
1255
1244
1256
// exec runs the handle tx with the given signer
1245
1257
func exec (t * testing.T , cache Cache , checksum []byte , signer types.HumanAddress , store types.KVStore , api * types.GoAPI , querier Querier , gasExpected uint64 ) types.ContractResult {
1258
+ t .Helper ()
1246
1259
gasMeter := NewMockGasMeter (TESTING_GAS_LIMIT )
1247
1260
igasMeter := types .GasMeter (gasMeter )
1248
1261
env := MockEnvBin (t )
0 commit comments