mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-04 07:01:40 +00:00
Fix tests for counter application using uin64
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
|
"time"
|
||||||
|
//"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
@ -31,16 +34,21 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Make a bunch of requests
|
// Make a bunch of requests
|
||||||
request := rpctypes.NewRPCRequest("fakeid", "net_info", nil)
|
buf := make([]byte, 32)
|
||||||
for i := 0; ; i++ {
|
for i := 0; ; i++ {
|
||||||
|
binary.LittleEndian.PutUint64(buf, uint64(i))
|
||||||
|
//txBytes := hex.EncodeToString(buf[:n])
|
||||||
|
request := rpctypes.NewRPCRequest("fakeid", "broadcast_tx", Arr(buf[:8]))
|
||||||
reqBytes := wire.JSONBytes(request)
|
reqBytes := wire.JSONBytes(request)
|
||||||
|
fmt.Println("!!", string(reqBytes))
|
||||||
err := ws.WriteMessage(websocket.TextMessage, reqBytes)
|
err := ws.WriteMessage(websocket.TextMessage, reqBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
Exit(err.Error())
|
||||||
}
|
}
|
||||||
if i%1000 == 0 {
|
if i%100 == 0 {
|
||||||
fmt.Println(i)
|
fmt.Println(i)
|
||||||
}
|
}
|
||||||
|
time.Sleep(time.Millisecond * 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.Stop()
|
ws.Stop()
|
||||||
|
@ -278,7 +278,7 @@ func simpleConsensusState(nValidators int) (*ConsensusState, []*validatorStub) {
|
|||||||
blockStore := bc.NewBlockStore(blockDB)
|
blockStore := bc.NewBlockStore(blockDB)
|
||||||
|
|
||||||
// one for mempool, one for consensus
|
// one for mempool, one for consensus
|
||||||
app := example.NewCounterApplication()
|
app := example.NewCounterApplication(false)
|
||||||
appCMem := app.Open()
|
appCMem := app.Open()
|
||||||
appCCon := app.Open()
|
appCCon := app.Open()
|
||||||
proxyAppCtxMem := proxy.NewLocalAppContext(appCMem)
|
proxyAppCtxMem := proxy.NewLocalAppContext(appCMem)
|
||||||
|
@ -12,9 +12,8 @@ import (
|
|||||||
|
|
||||||
func TestSerialReap(t *testing.T) {
|
func TestSerialReap(t *testing.T) {
|
||||||
|
|
||||||
app := example.NewCounterApplication()
|
app := example.NewCounterApplication(true)
|
||||||
appCtxMempool := app.Open()
|
appCtxMempool := app.Open()
|
||||||
appCtxMempool.SetOption("serial", "on")
|
|
||||||
proxyAppCtx := proxy.NewLocalAppContext(appCtxMempool)
|
proxyAppCtx := proxy.NewLocalAppContext(appCtxMempool)
|
||||||
mempool := NewMempool(proxyAppCtx)
|
mempool := NewMempool(proxyAppCtx)
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ func TestSerialReap(t *testing.T) {
|
|||||||
|
|
||||||
// This will succeed
|
// This will succeed
|
||||||
txBytes := make([]byte, 32)
|
txBytes := make([]byte, 32)
|
||||||
_ = binary.PutVarint(txBytes, int64(i))
|
binary.LittleEndian.PutUint64(txBytes, uint64(i))
|
||||||
err := mempool.AppendTx(txBytes)
|
err := mempool.AppendTx(txBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Error after AppendTx: %v", err)
|
t.Fatal("Error after AppendTx: %v", err)
|
||||||
@ -59,7 +58,7 @@ func TestSerialReap(t *testing.T) {
|
|||||||
txs := make([]types.Tx, 0)
|
txs := make([]types.Tx, 0)
|
||||||
for i := start; i < end; i++ {
|
for i := start; i < end; i++ {
|
||||||
txBytes := make([]byte, 32)
|
txBytes := make([]byte, 32)
|
||||||
_ = binary.PutVarint(txBytes, int64(i))
|
binary.LittleEndian.PutUint64(txBytes, uint64(i))
|
||||||
txs = append(txs, txBytes)
|
txs = append(txs, txBytes)
|
||||||
}
|
}
|
||||||
blockHeader := &types.Header{Height: 0}
|
blockHeader := &types.Header{Height: 0}
|
||||||
@ -75,7 +74,7 @@ func TestSerialReap(t *testing.T) {
|
|||||||
// Append some txs.
|
// Append some txs.
|
||||||
for i := start; i < end; i++ {
|
for i := start; i < end; i++ {
|
||||||
txBytes := make([]byte, 32)
|
txBytes := make([]byte, 32)
|
||||||
_ = binary.PutVarint(txBytes, int64(i))
|
binary.LittleEndian.PutUint64(txBytes, uint64(i))
|
||||||
_, retCode := appCtxConsensus.AppendTx(txBytes)
|
_, retCode := appCtxConsensus.AppendTx(txBytes)
|
||||||
if retCode != tmsp.RetCodeOK {
|
if retCode != tmsp.RetCodeOK {
|
||||||
t.Error("Error committing tx", retCode)
|
t.Error("Error committing tx", retCode)
|
||||||
|
Reference in New Issue
Block a user