-
Notifications
You must be signed in to change notification settings - Fork 42
/
contract_test.go
59 lines (58 loc) · 1.71 KB
/
contract_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package wavelet
//import (
// "github.com/perlin-network/noise/skademlia"
// "github.com/perlin-network/wavelet/avl"
// "github.com/perlin-network/wavelet/store"
// "github.com/perlin-network/wavelet/sys"
// "github.com/stretchr/testify/assert"
// "io/ioutil"
// "testing"
//)
//
//func BenchmarkContractInGraph(b *testing.B) {
// const InitialBalance = 1000000000000
//
// store := store.NewInmem()
//
// state := avl.New(store)
// viewID := uint64(0)
// state.SetViewID(viewID)
//
// keys, err := skademlia.NewKeys(1, 1)
// assert.NoError(b, err)
//
// mempool := NewMempool()
//
// WriteAccountBalance(state, keys.PublicKey(), InitialBalance)
//
// round := NewBlock(viewID, state.Checksum())
//
// accounts := NewAccounts(store)
// assert.NoError(b, accounts.Commit(state))
//
// code, err := ioutil.ReadFile("testdata/transfer_back.wasm")
// assert.NoError(b, err)
//
// contract := NewTransaction(keys, sys.TagContract, buildContractSpawnPayload(100000, 0, code).Marshal())
// assert.NoError(b, ApplyTransaction(state, &round, &contract))
//
// var criticalCount int
//
// for criticalCount < b.N {
// mempool.Add(EmptyBlockID, NewTransaction(keys,
// sys.TagTransfer,
// buildTransferWithInvocationPayload(contract.ID, 200, 500000, []byte("on_money_received"), nil, 0).Marshal(),
// ))
//
// //if tx.IsCritical(4) {
// // results, err := collapseTransactions(graph, accounts, viewID+1, &round, round.End, tx, false)
// // assert.NoError(b, err)
// // err = accounts.Commit(results.snapshot)
// // assert.NoError(b, err)
// // state = results.snapshot
// // round = NewRound(viewID+1, state.Checksum(), uint32(results.appliedCount+results.rejectedCount), round.End, tx)
// // viewID += 1
// // criticalCount += 1
// //}
// }
//}