mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-06 16:17:11 +00:00
shame: forgot to add new code pkg
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/abci/example/code"
|
||||
"github.com/tendermint/abci/types"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/iavl"
|
||||
@@ -42,11 +43,11 @@ func (app *DummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
|
||||
{Key: "app.creator", ValueType: types.KVPair_STRING, ValueString: "jae"},
|
||||
{Key: "app.key", ValueType: types.KVPair_STRING, ValueString: string(key)},
|
||||
}
|
||||
return types.ResponseDeliverTx{Code: types.CodeTypeOK, Tags: tags}
|
||||
return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags}
|
||||
}
|
||||
|
||||
func (app *DummyApplication) CheckTx(tx []byte) types.ResponseCheckTx {
|
||||
return types.ResponseCheckTx{Code: types.CodeTypeOK}
|
||||
return types.ResponseCheckTx{Code: code.CodeTypeOK}
|
||||
}
|
||||
|
||||
func (app *DummyApplication) Commit() types.ResponseCommit {
|
||||
@@ -64,7 +65,7 @@ func (app *DummyApplication) Commit() types.ResponseCommit {
|
||||
}
|
||||
}
|
||||
|
||||
return types.ResponseCommit{Code: types.CodeTypeOK, Data: hash}
|
||||
return types.ResponseCommit{Code: code.CodeTypeOK, Data: hash}
|
||||
}
|
||||
|
||||
func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
|
||||
|
||||
@@ -7,12 +7,15 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
abcicli "github.com/tendermint/abci/client"
|
||||
abciserver "github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
|
||||
"github.com/tendermint/iavl"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
|
||||
abcicli "github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/example/code"
|
||||
abciserver "github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func testDummy(t *testing.T, app types.Application, tx []byte, key, value string) {
|
||||
@@ -27,7 +30,7 @@ func testDummy(t *testing.T, app types.Application, tx []byte, key, value string
|
||||
Path: "/store",
|
||||
Data: []byte(key),
|
||||
})
|
||||
require.Equal(t, types.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, code.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
|
||||
// make sure proof is fine
|
||||
@@ -36,7 +39,7 @@ func testDummy(t *testing.T, app types.Application, tx []byte, key, value string
|
||||
Data: []byte(key),
|
||||
Prove: true,
|
||||
})
|
||||
require.EqualValues(t, types.CodeTypeOK, resQuery.Code)
|
||||
require.EqualValues(t, code.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
proof, err := iavl.ReadKeyExistsProof(resQuery.Proof)
|
||||
require.Nil(t, err)
|
||||
@@ -295,7 +298,7 @@ func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string)
|
||||
Data: []byte(key),
|
||||
})
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, types.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, code.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
|
||||
// make sure proof is fine
|
||||
@@ -305,7 +308,7 @@ func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string)
|
||||
Prove: true,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, types.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, code.CodeTypeOK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
proof, err := iavl.ReadKeyExistsProof(resQuery.Proof)
|
||||
require.Nil(t, err)
|
||||
|
||||
@@ -97,7 +97,7 @@ func (app *PersistentDummyApplication) Commit() types.ResponseCommit {
|
||||
}
|
||||
|
||||
app.logger.Info("Commit block", "height", height, "root", appHash)
|
||||
return types.ResponseCommit{Code: types.CodeTypeOK, Data: appHash}
|
||||
return types.ResponseCommit{Code: code.CodeTypeOK, Data: appHash}
|
||||
}
|
||||
|
||||
func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
|
||||
@@ -217,5 +217,5 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
||||
// we only update the changes array if we successfully updated the tree
|
||||
app.changes = append(app.changes, v)
|
||||
|
||||
return types.ResponseDeliverTx{Code: types.CodeTypeOK}
|
||||
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user