@@ -167,11 +167,9 @@ var bindTests = []struct {
167167 `[{"constant":true,"inputs":[],"name":"transactString","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":true,"inputs":[],"name":"deployString","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"str","type":"string"}],"name":"transact","outputs":[],"type":"function"},{"inputs":[{"name":"str","type":"string"}],"type":"constructor"}]` ,
168168 `
169169 // Generate a new random account and a funded simulator
170- key := crypto.NewKey(rand.Reader)
171- sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: key.Address, Balance: big.NewInt(10000000000)})
172-
173- // Convert the tester key to an authorized transactor for ease of use
170+ key, _ := crypto.GenerateKey()
174171 auth := bind.NewKeyedTransactor(key)
172+ sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: auth.From, Balance: big.NewInt(10000000000)})
175173
176174 // Deploy an interaction tester contract and call a transaction on it
177175 _, _, interactor, err := DeployInteractor(auth, sim, "Deploy string")
@@ -210,11 +208,9 @@ var bindTests = []struct {
210208 `[{"constant":true,"inputs":[],"name":"tuple","outputs":[{"name":"a","type":"string"},{"name":"b","type":"int256"},{"name":"c","type":"bytes32"}],"type":"function"}]` ,
211209 `
212210 // Generate a new random account and a funded simulator
213- key := crypto.NewKey(rand.Reader)
214- sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: key.Address, Balance: big.NewInt(10000000000)})
215-
216- // Convert the tester key to an authorized transactor for ease of use
211+ key, _ := crypto.GenerateKey()
217212 auth := bind.NewKeyedTransactor(key)
213+ sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: auth.From, Balance: big.NewInt(10000000000)})
218214
219215 // Deploy a tuple tester contract and execute a structured call on it
220216 _, _, tupler, err := DeployTupler(auth, sim)
@@ -252,11 +248,9 @@ var bindTests = []struct {
252248 `[{"constant":true,"inputs":[{"name":"input","type":"address[]"}],"name":"echoAddresses","outputs":[{"name":"output","type":"address[]"}],"type":"function"},{"constant":true,"inputs":[{"name":"input","type":"uint24[23]"}],"name":"echoFancyInts","outputs":[{"name":"output","type":"uint24[23]"}],"type":"function"},{"constant":true,"inputs":[{"name":"input","type":"int256[]"}],"name":"echoInts","outputs":[{"name":"output","type":"int256[]"}],"type":"function"},{"constant":true,"inputs":[{"name":"input","type":"bool[]"}],"name":"echoBools","outputs":[{"name":"output","type":"bool[]"}],"type":"function"}]` ,
253249 `
254250 // Generate a new random account and a funded simulator
255- key := crypto.NewKey(rand.Reader)
256- sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: key.Address, Balance: big.NewInt(10000000000)})
257-
258- // Convert the tester key to an authorized transactor for ease of use
251+ key, _ := crypto.GenerateKey()
259252 auth := bind.NewKeyedTransactor(key)
253+ sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: auth.From, Balance: big.NewInt(10000000000)})
260254
261255 // Deploy a slice tester contract and execute a n array call on it
262256 _, _, slicer, err := DeploySlicer(auth, sim)
@@ -265,10 +259,10 @@ var bindTests = []struct {
265259 }
266260 sim.Commit()
267261
268- if out, err := slicer.EchoAddresses(nil, []common.Address{key.Address , common.Address{}}); err != nil {
262+ if out, err := slicer.EchoAddresses(nil, []common.Address{auth.From , common.Address{}}); err != nil {
269263 t.Fatalf("Failed to call slice echoer: %v", err)
270- } else if !reflect.DeepEqual(out, []common.Address{key.Address , common.Address{}}) {
271- t.Fatalf("Slice return mismatch: have %v, want %v", out, []common.Address{key.Address , common.Address{}})
264+ } else if !reflect.DeepEqual(out, []common.Address{auth.From , common.Address{}}) {
265+ t.Fatalf("Slice return mismatch: have %v, want %v", out, []common.Address{auth.From , common.Address{}})
272266 }
273267 ` ,
274268 },
@@ -288,11 +282,9 @@ var bindTests = []struct {
288282 `[{"constant":true,"inputs":[],"name":"caller","outputs":[{"name":"","type":"address"}],"type":"function"}]` ,
289283 `
290284 // Generate a new random account and a funded simulator
291- key := crypto.NewKey(rand.Reader)
292- sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: key.Address, Balance: big.NewInt(10000000000)})
293-
294- // Convert the tester key to an authorized transactor for ease of use
285+ key, _ := crypto.GenerateKey()
295286 auth := bind.NewKeyedTransactor(key)
287+ sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: auth.From, Balance: big.NewInt(10000000000)})
296288
297289 // Deploy a default method invoker contract and execute its default method
298290 _, _, defaulter, err := DeployDefaulter(auth, sim)
@@ -306,8 +298,8 @@ var bindTests = []struct {
306298
307299 if caller, err := defaulter.Caller(nil); err != nil {
308300 t.Fatalf("Failed to call address retriever: %v", err)
309- } else if (caller != key.Address ) {
310- t.Fatalf("Address mismatch: have %v, want %v", caller, key.Address )
301+ } else if (caller != auth.From ) {
302+ t.Fatalf("Address mismatch: have %v, want %v", caller, auth.From )
311303 }
312304 ` ,
313305 },
0 commit comments