forked from tendermint/spn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simapp.go
49 lines (42 loc) · 1.31 KB
/
simapp.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
package simapp
import (
"time"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/tendermint/spm/cosmoscmd"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
tmdb "github.com/tendermint/tm-db"
"github.com/tendermint/spn/app"
)
// New creates application instance with in-memory database and disabled logging.
func New(dir string) cosmoscmd.App {
db := tmdb.NewMemDB()
logger := log.NewNopLogger()
encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics)
a := app.New(logger, db, nil, true, map[int64]bool{}, dir, 0, encoding,
simapp.EmptyAppOptions{})
// InitChain updates deliverState which is required when app.NewContext is called
a.InitChain(abci.RequestInitChain{
ConsensusParams: defaultConsensusParams,
AppStateBytes: []byte("{}"),
})
return a
}
var defaultConsensusParams = &abci.ConsensusParams{
Block: &abci.BlockParams{
MaxBytes: 200000,
MaxGas: 2000000,
},
Evidence: &tmproto.EvidenceParams{
MaxAgeNumBlocks: 302400,
MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration
MaxBytes: 10000,
},
Validator: &tmproto.ValidatorParams{
PubKeyTypes: []string{
tmtypes.ABCIPubKeyTypeEd25519,
},
},
}