Commit 0a31cde3 authored by vipwzw's avatar vipwzw

auto ci

parent 514df5e3
......@@ -172,7 +172,7 @@ func TestAddMinerTx(t *testing.T) {
api := new(apimocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
para := &client{BaseClient:&drivers.BaseClient{}}
para := &client{BaseClient: &drivers.BaseClient{}}
para.SetAPI(api)
para.subCfg = new(subConfig)
para.privateKey = priKey
......
......@@ -16,10 +16,10 @@ import (
"github.com/33cn/chain33/queue"
typesmocks "github.com/33cn/chain33/types/mocks"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
)
const (
......
......@@ -16,12 +16,12 @@ import (
apimocks "github.com/33cn/chain33/client/mocks"
_ "github.com/33cn/chain33/system"
drivers "github.com/33cn/chain33/system/consensus"
"github.com/33cn/chain33/types"
typesmocks "github.com/33cn/chain33/types/mocks"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
drivers "github.com/33cn/chain33/system/consensus"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
)
func init() {
......@@ -45,7 +45,7 @@ func TestCalcCommitMsgTxs(t *testing.T) {
cfg := types.NewChain33Config(testnode.DefaultConfig)
api := new(apimocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
para := &client{BaseClient:&drivers.BaseClient{}}
para := &client{BaseClient: &drivers.BaseClient{}}
para.SetAPI(api)
para.subCfg = new(subConfig)
......@@ -87,8 +87,7 @@ func TestGetConsensusStatus(t *testing.T) {
api := new(apimocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(chain33Cfg, nil)
para := &client{BaseClient:&drivers.BaseClient{}}
para := &client{BaseClient: &drivers.BaseClient{}}
para.subCfg = new(subConfig)
grpcClient := &typesmocks.Chain33Client{}
......@@ -127,7 +126,7 @@ func TestSendCommitMsg(t *testing.T) {
cfg := types.NewChain33Config(testnode.DefaultConfig)
api := new(apimocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
para := &client{BaseClient:&drivers.BaseClient{}}
para := &client{BaseClient: &drivers.BaseClient{}}
para.SetAPI(api)
grpcClient := &typesmocks.Chain33Client{}
......
......@@ -21,12 +21,12 @@ import (
secp256k1 "github.com/btcsuite/btcd/btcec"
"github.com/stretchr/testify/assert"
apimocks "github.com/33cn/chain33/client/mocks"
_ "github.com/33cn/chain33/system"
drivers "github.com/33cn/chain33/system/consensus"
_ "github.com/33cn/plugin/plugin/dapp/init"
_ "github.com/33cn/plugin/plugin/store/init"
"github.com/stretchr/testify/mock"
apimocks "github.com/33cn/chain33/client/mocks"
drivers "github.com/33cn/chain33/system/consensus"
)
func TestTicket(t *testing.T) {
......@@ -176,7 +176,7 @@ func Test_getNextRequiredDifficulty(t *testing.T) {
api := new(apimocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
c := &Client{BaseClient:&drivers.BaseClient{}}
c := &Client{BaseClient: &drivers.BaseClient{}}
c.SetAPI(api)
bits, bt, err := c.getNextRequiredDifficulty(nil, 1)
......
......@@ -9,12 +9,13 @@ import (
"encoding/json"
"fmt"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
"fmt"
)
// AutonomyCmd 自治系统命令行
......
......@@ -9,12 +9,13 @@ import (
"encoding/json"
"fmt"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
"fmt"
)
// ProposalChangeCmd 创建提案命令
......
......@@ -9,12 +9,13 @@ import (
"strings"
"fmt"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
"fmt"
)
// ProposalProjectCmd 创建提案命令
......
......@@ -9,12 +9,13 @@ import (
"strings"
"fmt"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
"fmt"
)
// ProposalRuleCmd 创建提案命令
......
......@@ -21,7 +21,7 @@ var (
alog = log.New("module", "execs.autonomy")
driverName = auty.AutonomyX
autonomyAddr = address.ExecAddress(auty.AutonomyX)
subcfg subConfig
subcfg subConfig
)
// Init 重命名执行器名称
......
......@@ -7,19 +7,19 @@ package executor
import (
"testing"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/queue"
)
var chainTestCfg = types.NewChain33Config(types.GetDefaultCfgstring())
func newTestAutonomy() *Autonomy{
func newTestAutonomy() *Autonomy {
au := &Autonomy{
dapp.DriverBase{},
}
......
......@@ -8,12 +8,14 @@ import (
"testing"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
dbm "github.com/33cn/chain33/common/db"
dbmock "github.com/33cn/chain33/common/db/mocks"
commonlog "github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/queue"
_ "github.com/33cn/chain33/system"
drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
......@@ -23,8 +25,6 @@ import (
ticketTy "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
// ExecEnv exec environment
......
......@@ -11,12 +11,12 @@ import (
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
gt "github.com/33cn/plugin/plugin/dapp/blackwhite/types"
"github.com/33cn/chain33/client"
)
const (
......
......@@ -11,15 +11,15 @@ import (
"fmt"
"strconv"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
gt "github.com/33cn/plugin/plugin/dapp/blackwhite/types"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
func newTestAction() *action{
func newTestAction() *action {
cfg := types.NewChain33Config(types.GetDefaultCfgstring())
au := &action{}
q := queue.New("channel")
......
......@@ -204,7 +204,6 @@ func TestChckSignWithSm2(t *testing.T) {
}
cfg.SetMinFee(0)
tx15.Sign(ct.AuthSM2, privKeysm2)
if !tx15.CheckSign() {
t.Error("check signature failed")
......
......@@ -18,8 +18,6 @@ var (
KeyPrefixPangLocal = "LODB-echo-pang:%s"
)
// Init 本执行器的初始化动作,向系统注册本执行器,这里生效高度暂写为0
func Init(name string, cfg *types.Chain33Config, sub []byte) {
dapp.Register(cfg, echotypes.EchoX, newEcho, 0)
......
......@@ -15,15 +15,15 @@ import (
"time"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
evm "github.com/33cn/plugin/plugin/dapp/evm/executor"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common/crypto"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/runtime"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/state"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
func TestVM(t *testing.T) {
......
......@@ -9,10 +9,14 @@ import (
"fmt"
"strconv"
"strings"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
evm "github.com/33cn/plugin/plugin/dapp/evm/executor"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
......@@ -20,12 +24,9 @@ import (
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/runtime"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/state"
evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
"strings"
)
var chainTestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
var chainTestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
func init() {
evm.Init(evmtypes.ExecutorName, chainTestCfg, nil)
......
......@@ -5,9 +5,9 @@
package state
import (
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/model"
"github.com/33cn/chain33/types"
)
// EVMStateDB 状态数据库封装,面向EVM业务执行逻辑;
......
......@@ -9,13 +9,13 @@ import (
"strings"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/model"
evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types"
"github.com/33cn/chain33/client"
)
// MemoryStateDB 内存状态数据库,保存在区块操作时内部的数据变更操作
......@@ -742,4 +742,4 @@ func (mdb *MemoryStateDB) GetBlockHeight() int64 {
// GetConfig 获取系统配置
func (mdb *MemoryStateDB) GetConfig() *types.Chain33Config {
return mdb.api.GetConfig()
}
\ No newline at end of file
}
......@@ -8,13 +8,13 @@ import (
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
pty "github.com/33cn/plugin/plugin/dapp/game/types"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
type execEnv struct {
......
......@@ -12,12 +12,12 @@ import (
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
gt "github.com/33cn/plugin/plugin/dapp/game/types"
"github.com/33cn/chain33/client"
)
const (
......
......@@ -9,8 +9,8 @@ package types
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
)
func TestCreateRawGamePreCreateTx(t *testing.T) {
......
......@@ -12,15 +12,15 @@ import (
"math/rand"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/queue"
drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
pty "github.com/33cn/plugin/plugin/dapp/hashlock/types"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
var (
......
......@@ -10,12 +10,12 @@ import (
"fmt"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
pty "github.com/33cn/plugin/plugin/dapp/hashlock/types"
"github.com/33cn/chain33/client"
)
var hlog = log.New("module", "hashlock.db")
......
......@@ -23,7 +23,7 @@ import (
func initExec(ldb db.DB, kvdb db.KVDB, code string, t assert.TestingT) *js {
cfg := types.NewChain33Config(types.GetDefaultCfgstring())
Init(ptypes.JsX, cfg,nil)
Init(ptypes.JsX, cfg, nil)
e := newjs().(*js)
......
......@@ -11,29 +11,29 @@ import (
"math/rand"
"testing"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
drivers "github.com/33cn/chain33/system/dapp"
pty "github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
rt "github.com/33cn/plugin/plugin/dapp/lottery/types"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
)
var (
creatorAddr string
buyAddr string
buyPriv crypto.PrivKey
creatorPriv crypto.PrivKey
testNormErr error
lottery drivers.Driver
r *rand.Rand
mydb db.KV
lotteryID string
creatorAddr string
buyAddr string
buyPriv crypto.PrivKey
creatorPriv crypto.PrivKey
testNormErr error
lottery drivers.Driver
r *rand.Rand
mydb db.KV
lotteryID string
chainTestCfg *types.Chain33Config
)
......@@ -196,7 +196,7 @@ func ConstructDrawTx() *types.Transaction {
func constructLotteryInstance() drivers.Driver {
chainTestCfg = types.NewChain33Config(types.GetDefaultCfgstring())
Init(rt.LotteryX, chainTestCfg,nil)
Init(rt.LotteryX, chainTestCfg, nil)
lottery := newLottery()
//lottery.SetStateDB(NewTestDB())
_, _, kvdb := util.CreateTestDB()
......
......@@ -8,12 +8,12 @@ import (
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pty "github.com/33cn/plugin/plugin/dapp/lottery/types"
"github.com/33cn/chain33/client"
)
const (
......
......@@ -31,7 +31,6 @@ func InitExecutor(cfg *types.Chain33Config) {
types.RegistorExecutor(LotteryX, NewType(cfg))
}
// LotteryType def
type LotteryType struct {
types.ExecTypeBase
......@@ -68,7 +67,7 @@ func (lottery *LotteryType) GetPayload() types.Message {
// CreateTx method
func (lottery LotteryType) CreateTx(action string, message json.RawMessage) (*types.Transaction, error) {
llog.Debug("lottery.CreateTx", "action", action)
cfg := lottery.GetConfig()
cfg := lottery.GetConfig()
if action == "LotteryCreate" {
var param LotteryCreateTx
err := json.Unmarshal(message, &param)
......
......@@ -61,7 +61,7 @@ var (
func init() {
commonlog.SetLogLevel("debug")
types.AllowUserExec = append(types.AllowUserExec, []byte("coins"))
Init(mty.MultiSigX, chainTestCfg,nil)
Init(mty.MultiSigX, chainTestCfg, nil)
}
//创建一个多重签名的账户
......
......@@ -32,7 +32,6 @@ var multisiglog = log.New("module", "execs.multisig")
var driverName = "multisig"
// Init multisig模块初始化
func Init(name string, cfg *types.Chain33Config, sub []byte) {
drivers.Register(cfg, GetName(), newMultiSig, cfg.GetDappFork(driverName, "Enable"))
......
......@@ -27,7 +27,6 @@ func InitExecType() {
ety.InitFuncList(types.ListMethod(&oracle{}))
}
// GetName 获取oracle执行器名
func GetName() string {
return newOracle().GetName()
......
......@@ -17,8 +17,8 @@ import (
dbm "github.com/33cn/chain33/common/db"
dbmock "github.com/33cn/chain33/common/db/mocks"
"github.com/33cn/chain33/types"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/mock"
)
......
......@@ -8,6 +8,8 @@ import (
"bytes"
"testing"
"strings"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
......@@ -17,12 +19,11 @@ import (
"github.com/33cn/chain33/common/log"
mty "github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/stretchr/testify/mock"
"strings"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
"github.com/stretchr/testify/suite"
)
// 构造一个4个节点的平行链数据, 进行测试
......@@ -56,7 +57,7 @@ var (
MainBlockHeightForTransfer = int64(9)
tempTitle = ""
chain33TestCfg = types.NewChain33Config(testnode.DefaultConfig)
chain33TestMainCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"test\"" , 1))
chain33TestMainCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"test\"", 1))
)
type CommitTestSuite struct {
......
......@@ -21,7 +21,6 @@ import (
"github.com/pkg/errors"
)
func deepCopy(dst, src interface{}) error {
var buf bytes.Buffer
if err := gob.NewEncoder(&buf).Encode(src); err != nil {
......
......@@ -14,11 +14,11 @@ import (
"github.com/33cn/chain33/client/mocks"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
ptestNode "github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"
ptestNode "github.com/33cn/plugin/plugin/dapp/paracross/testnode"
)
func newGrpc(api client.QueueProtocolAPI) *channelClient {
......
......@@ -47,7 +47,6 @@ func InitExecutor(cfg *types.Chain33Config) {
types.RegistorExecutor(ParaX, NewType(cfg))
}
// GetExecName get para exec name
func GetExecName(cfg *types.Chain33Config) string {
return cfg.ExecName(ParaX)
......
......@@ -4,6 +4,7 @@ import (
"testing"
"github.com/33cn/chain33/account"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
dbm "github.com/33cn/chain33/common/db"
......@@ -13,7 +14,6 @@ import (
pkt "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
apimock "github.com/33cn/chain33/client/mocks"
)
type execEnv struct {
......@@ -34,7 +34,7 @@ var (
func TestPokerbull(t *testing.T) {
cfg := types.NewChain33Config(types.GetDefaultCfgstring())
cfg.SetTitleOnlyForTest("chain33")
Init(pkt.PokerBullX, cfg,nil)
Init(pkt.PokerBullX, cfg, nil)
total := 1000 * types.Coin
accountA := types.Account{
Balance: total,
......
......@@ -17,13 +17,13 @@ import (
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
privacytypes "github.com/33cn/plugin/plugin/dapp/privacy/types"
pexec "github.com/33cn/plugin/plugin/dapp/privacy/executor"
privacytypes "github.com/33cn/plugin/plugin/dapp/privacy/types"
)
var (
pubsByte [10][]byte
secsByte [10][]byte
pubsByte [10][]byte
secsByte [10][]byte
chainTestCfg = types.NewChain33Config(types.GetDefaultCfgstring())
)
......@@ -57,7 +57,7 @@ func init() {
secsByte[i], _ = common.FromHex(secstrs[i])
}
pexec.Init(privacytypes.PrivacyX, chainTestCfg,nil)
pexec.Init(privacytypes.PrivacyX, chainTestCfg, nil)
}
func TestGenerateKeyImage1(t *testing.T) {
......
......@@ -5,19 +5,21 @@
package wallet
import (
"bytes"
"encoding/hex"
"sync"
"time"
"unsafe"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
_ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
wcom "github.com/33cn/chain33/wallet/common"
"github.com/33cn/plugin/plugin/dapp/privacy/crypto"
privacy "github.com/33cn/plugin/plugin/dapp/privacy/crypto"
ty "github.com/33cn/plugin/plugin/dapp/privacy/types"
"encoding/hex"
"bytes"
"unsafe"
"github.com/33cn/chain33/common/address"
"time"
)
type PrivacyMock struct {
......
......@@ -16,13 +16,13 @@ import (
"github.com/33cn/chain33/common/limits"
clog "github.com/33cn/chain33/common/log"
log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/plugin/plugin/dapp/relay/cmd/relayd/relayd"
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/relay/cmd/relayd/relayd"
)
var (
cpuNum = runtime.NumCPU()
configPath = flag.String("f", "relayd.toml", "configfile")
cpuNum = runtime.NumCPU()
configPath = flag.String("f", "relayd.toml", "configfile")
chain33ConfigPath = flag.String("chain33flie", "", "chain33configfile")
)
......
......@@ -16,7 +16,6 @@ var relaylog = log.New("module", "execs.relay")
var driverName = "relay"
// Init relay register driver
func Init(name string, cfg *types.Chain33Config, sub []byte) {
drivers.Register(cfg, GetName(), newRelay, cfg.GetDappFork(driverName, "Enable")) //TODO: ForkV18Relay
......
......@@ -7,6 +7,7 @@ package executor
import (
"testing"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/mocks"
......@@ -14,7 +15,6 @@ import (
ty "github.com/33cn/plugin/plugin/dapp/relay/types"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
apimock "github.com/33cn/chain33/client/mocks"
_ "github.com/33cn/chain33/system"
)
......
......@@ -10,12 +10,12 @@ import (
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
ty "github.com/33cn/plugin/plugin/dapp/relay/types"
"github.com/33cn/chain33/client"
)
const (
......
......@@ -7,6 +7,7 @@ package executor
import (
"testing"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
......@@ -17,7 +18,6 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
apimock "github.com/33cn/chain33/client/mocks"
)
type suiteRelayLog struct {
......
......@@ -11,15 +11,16 @@ import (
"math/rand"
"testing"
"strings"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/queue"
drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
rt "github.com/33cn/plugin/plugin/dapp/retrieve/types"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/client"
"strings"
)
var (
......@@ -50,7 +51,6 @@ func init() {
retrieve = constructRetrieveInstance()
}
func TestExecBackup(t *testing.T) {
var targetReceipt types.Receipt
var targetErr error
......@@ -248,7 +248,7 @@ func TestExecDelLocalBackup(t *testing.T) {
}
func constructRetrieveInstance() drivers.Driver {
cfgstring := strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1)
cfgstring := strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1)
chainTestCfg := types.NewChain33Config(cfgstring)
Init(rt.RetrieveX, chainTestCfg, nil)
q := queue.New("channel")
......
......@@ -13,9 +13,9 @@ import (
"github.com/33cn/chain33/types"
//log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/system/dapp"
rt "github.com/33cn/plugin/plugin/dapp/retrieve/types"
"github.com/33cn/chain33/client"
)
const (
......
......@@ -14,6 +14,7 @@ import (
"strings"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
dbm "github.com/33cn/chain33/common/db"
......@@ -21,7 +22,6 @@ import (
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
ty "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/33cn/chain33/client"
)
var tlog = log.New("module", "ticket.db")
......
......@@ -36,8 +36,8 @@ func (g *channelClient) CreateBindMiner(ctx context.Context, in *ty.ReqBindMiner
if err != nil {
return nil, err
}
cfg := g.GetConfig()
cfg := g.GetConfig()
if in.CheckBalance {
header, err := g.GetLastHeader()
if err != nil {
......
......@@ -10,11 +10,11 @@ import (
rpctypes "github.com/33cn/chain33/rpc/types"
_ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
_ "github.com/33cn/plugin/plugin"
ty "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
)
func TestNewTicket(t *testing.T) {
......
......@@ -13,6 +13,8 @@ import (
"testing"
"time"
"strings"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
......@@ -20,7 +22,6 @@ import (
pty "github.com/33cn/plugin/plugin/dapp/token/types"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"strings"
)
var (
......@@ -423,7 +424,7 @@ func getprivkey(key string) crypto.PrivKey {
}
func TestToken_validSymbolWithHeight(t *testing.T) {
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
forkBadTokenSymbol := cfg.GetDappFork(pty.TokenX, pty.ForkBadTokenSymbolX)
forkTokenSymbolWithNumber := cfg.GetDappFork(pty.TokenX, pty.ForkTokenSymbolWithNumberX)
t.Log("x", "1", forkBadTokenSymbol, "2", forkTokenSymbolWithNumber)
......
......@@ -13,10 +13,12 @@ import (
dbm "github.com/33cn/chain33/common/db"
pty "github.com/33cn/plugin/plugin/dapp/token/types"
"github.com/stretchr/testify/assert"
//"github.com/33cn/chain33/types/jsonpb"
"strings"
"github.com/stretchr/testify/mock"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/stretchr/testify/mock"
)
type execEnv struct {
......@@ -43,7 +45,7 @@ var (
)
func TestToken(t *testing.T) {
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
Init(pty.TokenX, cfg, nil)
tokenTotal := int64(10000 * 1e8)
tokenBurn := int64(10 * 1e8)
......
......@@ -10,12 +10,12 @@ import (
"strings"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common/address"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pty "github.com/33cn/plugin/plugin/dapp/token/types"
"github.com/33cn/chain33/client"
)
type tokenDB struct {
......
......@@ -7,7 +7,10 @@ package executor
import (
"testing"
"strings"
"github.com/33cn/chain33/account"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
......@@ -17,8 +20,6 @@ import (
pty "github.com/33cn/plugin/plugin/dapp/trade/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
apimock "github.com/33cn/chain33/client/mocks"
"strings"
)
type execEnv struct {
......@@ -53,7 +54,7 @@ var (
[]byte("1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"),
[]byte("1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"),
}
chain33TestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
chain33TestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
)
func init() {
......
......@@ -278,7 +278,6 @@ func (action *tradeAction) tradeSell(sell *pty.TradeForSell) (*types.Receipt, er
return nil, pty.ErrAssetAndPriceSame
}
accDB, err := createAccountDB(cfg, action.height, action.db, sell.AssetExec, sell.TokenSymbol)
if err != nil {
return nil, err
......
......@@ -10,9 +10,9 @@ import (
"github.com/33cn/chain33/client/mocks"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
ptypes "github.com/33cn/plugin/plugin/dapp/trade/types"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/mock"
)
......
......@@ -7,8 +7,8 @@ package types
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
)
func TestTradeType_GetName(t *testing.T) {
......
......@@ -11,7 +11,10 @@ import (
"encoding/hex"
"strings"
"github.com/33cn/chain33/account"
apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
......@@ -19,9 +22,7 @@ import (
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
pty "github.com/33cn/plugin/plugin/dapp/unfreeze/types"
"strings"
"github.com/stretchr/testify/mock"
apimock "github.com/33cn/chain33/client/mocks"
)
type execEnv struct {
......@@ -45,7 +46,7 @@ var (
[]byte("1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"),
[]byte("1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"),
}
chain33TestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
chain33TestCfg = types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
)
func init() {
......
......@@ -11,15 +11,16 @@ import (
"encoding/hex"
"testing"
"strings"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/client/mocks"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
vt "github.com/33cn/plugin/plugin/dapp/valnode/types"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"strings"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"
)
func newGrpc(api client.QueueProtocolAPI) *channelClient {
......@@ -33,7 +34,7 @@ func newJrpc(api client.QueueProtocolAPI) *Jrpc {
}
func TestChannelClient_IsSync(t *testing.T) {
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
api := new(mocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
client := newGrpc(api)
......@@ -57,7 +58,7 @@ func TestJrpc_IsSync(t *testing.T) {
}
func TestChannelClient_GetNodeInfo(t *testing.T) {
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"" , 1))
cfg := types.NewChain33Config(strings.Replace(types.GetDefaultCfgstring(), "Title=\"local\"", "Title=\"chain33\"", 1))
api := new(mocks.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(cfg, nil)
client := newGrpc(api)
......
......@@ -8,8 +8,8 @@ import (
log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/rpc/grpcclient"
"github.com/33cn/chain33/types"
)
var mlog = log.New("module", "mempool.para")
......@@ -61,7 +61,7 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
}()
}
func (mem *Mempool) setMainGrpcCli(cfg *types.Chain33Config) {
func (mem *Mempool) setMainGrpcCli(cfg *types.Chain33Config) {
if cfg != nil && cfg.IsPara() {
grpcCli, err := grpcclient.NewMainChainClient(cfg, "")
if err != nil {
......
......@@ -610,7 +610,7 @@ func TestPruning(t *testing.T) {
store := New(storeCfg, nil, nil).(*KVmMavlStore)
assert.NotNil(t, store)
kvmvccStore := NewKVMVCC(&subKVMVCCConfig{PruneHeight:10}, store.GetDB())
kvmvccStore := NewKVMVCC(&subKVMVCCConfig{PruneHeight: 10}, store.GetDB())
var kv []*types.KeyValue
var key string
......@@ -646,7 +646,7 @@ func TestPruning(t *testing.T) {
hashes = append(hashes, hash)
}
pruningMVCC(store.GetDB(), 99, &KVMCCCConfig{PruneHeight:10})
pruningMVCC(store.GetDB(), 99, &KVMCCCConfig{PruneHeight: 10})
//check
getDatas := &types.StoreGet{
......
......@@ -25,7 +25,7 @@ const (
onceScanCount = 10000 // 单次扫描数目
onceCount = 1000 // 容器长度
levelPruningHeight = 100 * 10000
defaultPruneHeight = 10000 // 每个10000裁剪一次
defaultPruneHeight = 10000 // 每个10000裁剪一次
)
var (
......@@ -52,11 +52,11 @@ type KVMCCCConfig struct {
// KVMVCCStore provide kvmvcc store interface implementation
type KVMVCCStore struct {
db dbm.DB
mvcc dbm.MVCC
kvsetmap map[string][]*types.KeyValue
sync bool
kvmvccCfg *KVMCCCConfig
db dbm.DB
mvcc dbm.MVCC
kvsetmap map[string][]*types.KeyValue
sync bool
kvmvccCfg *KVMCCCConfig
}
// NewKVMVCC construct KVMVCCStore module
......@@ -69,15 +69,14 @@ func NewKVMVCC(sub *subKVMVCCConfig, db dbm.DB) *KVMVCCStore {
sub.PruneHeight = defaultPruneHeight
}
kvmvccCfg := &KVMCCCConfig{
EnableMVCCIter: sub.EnableMVCCIter,
EnableMVCCIter: sub.EnableMVCCIter,
EnableMavlPrune: sub.EnableMavlPrune,
PruneHeight: sub.PruneHeight,
PruneHeight: sub.PruneHeight,
}
if kvmvccCfg.EnableMVCCIter {
kvs = &KVMVCCStore{db, dbm.NewMVCCIter(db), make(map[string][]*types.KeyValue),false, kvmvccCfg}
kvs = &KVMVCCStore{db, dbm.NewMVCCIter(db), make(map[string][]*types.KeyValue), false, kvmvccCfg}
} else {
kvs = &KVMVCCStore{db, dbm.NewMVCC(db), make(map[string][]*types.KeyValue),false, kvmvccCfg}
kvs = &KVMVCCStore{db, dbm.NewMVCC(db), make(map[string][]*types.KeyValue), false, kvmvccCfg}
}
return kvs
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment