commit
7457802806
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
. "github.com/tendermint/go-common"
|
||||
. "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyes "github.com/tendermint/merkleeyes/client"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
//tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
|
@ -65,7 +65,7 @@ func loadGenesis(filePath string) (*FullGenesisDoc, error) {
|
|||
// tmGenesis := new(tmtypes.GenesisDoc)
|
||||
// err = wire.ReadJSONBytes(bytes, tmGenesis)
|
||||
|
||||
// the basecoin genesis go-data :)
|
||||
// the basecoin genesis go-wire/data :)
|
||||
genDoc := new(FullGenesisDoc)
|
||||
err = json.Unmarshal(bytes, genDoc)
|
||||
if err != nil {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
eyescli "github.com/tendermint/merkleeyes/client"
|
||||
)
|
||||
|
@ -38,7 +38,7 @@ func TestLoadGenesis(t *testing.T) {
|
|||
assert.EqualValues("blank", acct.Balance[0].Denom)
|
||||
|
||||
// and public key is parsed properly
|
||||
apk := acct.PubKey.PubKey
|
||||
apk := acct.PubKey.Unwrap()
|
||||
require.NotNil(apk)
|
||||
epk, ok := apk.(crypto.PubKeyEd25519)
|
||||
if assert.True(ok) {
|
||||
|
@ -52,7 +52,7 @@ func TestParseGenesisList(t *testing.T) {
|
|||
bytes, err := cmn.ReadFile(genesisFilepath)
|
||||
require.Nil(err, "loading genesis file %+v", err)
|
||||
|
||||
// the basecoin genesis go-data :)
|
||||
// the basecoin genesis go-wire/data :)
|
||||
genDoc := new(FullGenesisDoc)
|
||||
err = json.Unmarshal(bytes, genDoc)
|
||||
require.Nil(err, "unmarshaling genesis file %+v", err)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"github.com/tendermint/go-logger"
|
||||
"github.com/tendermint/tmlibs/logger"
|
||||
)
|
||||
|
||||
var log = logger.New("module", "app")
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
|
||||
"github.com/tendermint/basecoin/plugins/ibc"
|
||||
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
|
@ -229,7 +229,7 @@ func ibcPacketPostTxCmd(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
var packet ibc.Packet
|
||||
proof := new(merkle.IAVLProof)
|
||||
proof := new(iavl.IAVLProof)
|
||||
|
||||
err = wire.ReadBinaryBytes(packetBytes, &packet)
|
||||
if err != nil {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
cmn "github.com/tendermint/go-common"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
//commands
|
||||
|
|
|
@ -62,9 +62,9 @@ func (a *Address) UnmarshalJSON(addrHex []byte) error {
|
|||
}
|
||||
|
||||
type Key struct {
|
||||
Address Address `json:"address"`
|
||||
PubKey crypto.PubKeyS `json:"pub_key"`
|
||||
PrivKey crypto.PrivKeyS `json:"priv_key"`
|
||||
Address Address `json:"address"`
|
||||
PubKey crypto.PubKey `json:"pub_key"`
|
||||
PrivKey crypto.PrivKey `json:"priv_key"`
|
||||
}
|
||||
|
||||
// Implements Signer
|
||||
|
@ -75,13 +75,14 @@ func (k *Key) Sign(msg []byte) crypto.Signature {
|
|||
// Generates a new validator with private key.
|
||||
func genKey() *Key {
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
addrBytes := privKey.PubKey().Address()
|
||||
pubKey := privKey.PubKey()
|
||||
addrBytes := pubKey.Address()
|
||||
var addr Address
|
||||
copy(addr[:], addrBytes)
|
||||
return &Key{
|
||||
Address: addr,
|
||||
PubKey: crypto.PubKeyS{privKey.PubKey()},
|
||||
PrivKey: crypto.PrivKeyS{privKey},
|
||||
PubKey: pubKey,
|
||||
PrivKey: privKey.Wrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/tendermint/go-logger"
|
||||
"github.com/tendermint/tmlibs/logger"
|
||||
)
|
||||
|
||||
var log = logger.New("module", "commands")
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
|
@ -202,7 +202,7 @@ func verifyCmd(cmd *cobra.Command, args []string) error {
|
|||
return errors.Errorf("Proof (%v) is invalid hex: %v\n", proofFlag, err)
|
||||
}
|
||||
|
||||
proof, err := merkle.ReadProof(proofBytes)
|
||||
proof, err := iavl.ReadProof(proofBytes)
|
||||
if err != nil {
|
||||
return errors.Errorf("Error unmarshalling proof: %v\n", err)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/tendermint/abci/server"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
eyes "github.com/tendermint/merkleeyes/client"
|
||||
|
||||
tmcfg "github.com/tendermint/tendermint/config/tendermint"
|
||||
|
|
|
@ -8,9 +8,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/tendermint/basecoin/types"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
|
||||
client "github.com/tendermint/go-rpc/client"
|
||||
client "github.com/tendermint/tendermint/rpc/lib/client"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
@ -123,7 +122,7 @@ func sendTxCmd(cmd *cobra.Command, args []string) error {
|
|||
|
||||
// sign that puppy
|
||||
signBytes := tx.SignBytes(chainIDFlag)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{privKey.Sign(signBytes)}
|
||||
tx.Inputs[0].Signature = privKey.Sign(signBytes)
|
||||
|
||||
fmt.Println("Signed SendTx:")
|
||||
fmt.Println(string(wire.JSONBytes(tx)))
|
||||
|
@ -179,7 +178,7 @@ func AppTx(name string, data []byte) error {
|
|||
Data: data,
|
||||
}
|
||||
|
||||
tx.Input.Signature = crypto.SignatureS{privKey.Sign(tx.SignBytes(chainIDFlag))}
|
||||
tx.Input.Signature = privKey.Sign(tx.SignBytes(chainIDFlag))
|
||||
|
||||
fmt.Println("Signed AppTx:")
|
||||
fmt.Println(string(wire.JSONBytes(tx)))
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
"github.com/tendermint/basecoin/types"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
client "github.com/tendermint/go-rpc/client"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
client "github.com/tendermint/tendermint/rpc/lib/client"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
hash: c6e5febc35b5fd1003066820defb8a089db048b407239dad9faf44553fdc15e8
|
||||
updated: 2017-04-21T12:55:42.7004558-04:00
|
||||
hash: ab7d4136802bfb9c56c25d6c384ce65891adfda2f2fc338fb4532ecc8e85ad40
|
||||
updated: 2017-04-27T12:49:42.595893036-04:00
|
||||
imports:
|
||||
- name: github.com/btcsuite/btcd
|
||||
version: 4b348c1d33373d672edd83fc576892d0e46686d2
|
||||
subpackages:
|
||||
- btcec
|
||||
- name: github.com/BurntSushi/toml
|
||||
version: b26d9c308763d68093482582cea63d69be07a0f0
|
||||
- name: github.com/ebuchman/fail-test
|
||||
version: 95f809107225be108efcf10a3509e4ea6ceef3c4
|
||||
- name: github.com/fsnotify/fsnotify
|
||||
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
|
||||
- name: github.com/go-stack/stack
|
||||
version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82
|
||||
- name: github.com/golang/protobuf
|
||||
|
@ -20,20 +20,49 @@ imports:
|
|||
version: 553a641470496b2327abcac10b36396bd98e45c9
|
||||
- name: github.com/gorilla/websocket
|
||||
version: 3ab3a8b8831546bd18fd182c20687ca853b2bb13
|
||||
- name: github.com/hashicorp/hcl
|
||||
version: 630949a3c5fa3c613328e1b8256052cbc2327c9b
|
||||
subpackages:
|
||||
- hcl/ast
|
||||
- hcl/parser
|
||||
- hcl/scanner
|
||||
- hcl/strconv
|
||||
- hcl/token
|
||||
- json/parser
|
||||
- json/scanner
|
||||
- json/token
|
||||
- name: github.com/inconshreveable/mousetrap
|
||||
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
|
||||
- name: github.com/jmhodges/levigo
|
||||
version: c42d9e0ca023e2198120196f842701bb4c55d7b9
|
||||
- name: github.com/magiconair/properties
|
||||
version: 51463bfca2576e06c62a8504b5c0f06d61312647
|
||||
- name: github.com/mattn/go-colorable
|
||||
version: ded68f7a9561c023e790de24279db7ebf473ea80
|
||||
- name: github.com/mattn/go-isatty
|
||||
version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
|
||||
- name: github.com/mitchellh/mapstructure
|
||||
version: 53818660ed4955e899c0bcafa97299a388bd7c8e
|
||||
- name: github.com/pelletier/go-buffruneio
|
||||
version: c37440a7cf42ac63b919c752ca73a85067e05992
|
||||
- name: github.com/pelletier/go-toml
|
||||
version: 13d49d4606eb801b8f01ae542b4afc4c6ee3d84a
|
||||
- name: github.com/pkg/errors
|
||||
version: ff09b135c25aae272398c51a07235b90a75aa4f0
|
||||
- name: github.com/spf13/afero
|
||||
version: 9be650865eab0c12963d8753212f4f9c66cdcf12
|
||||
subpackages:
|
||||
- mem
|
||||
- name: github.com/spf13/cast
|
||||
version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4
|
||||
- name: github.com/spf13/cobra
|
||||
version: 10f6b9d7e1631a54ad07c5c0fb71c28a1abfd3c2
|
||||
- name: github.com/spf13/jwalterweatherman
|
||||
version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66
|
||||
- name: github.com/spf13/pflag
|
||||
version: 2300d0f8576fe575f71aaa5b9bbe4e1b0dc2eb51
|
||||
- name: github.com/spf13/viper
|
||||
version: 5d46e70da8c0b6f812e0b170b7a985753b5c63cb
|
||||
- name: github.com/syndtr/goleveldb
|
||||
version: 8c81ea47d4c41a385645e133e15510fc6a2a74b4
|
||||
subpackages:
|
||||
|
@ -50,7 +79,7 @@ imports:
|
|||
- leveldb/table
|
||||
- leveldb/util
|
||||
- name: github.com/tendermint/abci
|
||||
version: 56e13d87f4e3ec1ea756957d6b23caa6ebcf0998
|
||||
version: c709d3cc857929a8dd36a90da3640122d7e75770
|
||||
subpackages:
|
||||
- client
|
||||
- example/dummy
|
||||
|
@ -61,53 +90,24 @@ imports:
|
|||
subpackages:
|
||||
- edwards25519
|
||||
- extra25519
|
||||
- name: github.com/tendermint/go-autofile
|
||||
version: 48b17de82914e1ec2f134ce823ba426337d2c518
|
||||
- name: github.com/tendermint/go-clist
|
||||
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
|
||||
- name: github.com/tendermint/go-common
|
||||
version: f9e3db037330c8a8d61d3966de8473eaf01154fa
|
||||
- name: github.com/tendermint/go-config
|
||||
version: 620dcbbd7d587cf3599dedbf329b64311b0c307a
|
||||
- name: github.com/tendermint/go-crypto
|
||||
version: 0ca2c6fdb0706001ca4c4b9b80c9f428e8cf39da
|
||||
- name: github.com/tendermint/go-data
|
||||
version: e7fcc6d081ec8518912fcdc103188275f83a3ee5
|
||||
- name: github.com/tendermint/go-db
|
||||
version: 9643f60bc2578693844aacf380a7c32e4c029fee
|
||||
- name: github.com/tendermint/go-events
|
||||
version: f8ffbfb2be3483e9e7927495590a727f51c0c11f
|
||||
- name: github.com/tendermint/go-flowrate
|
||||
version: a20c98e61957faa93b4014fbd902f20ab9317a6a
|
||||
subpackages:
|
||||
- flowrate
|
||||
- name: github.com/tendermint/go-logger
|
||||
version: cefb3a45c0bf3c493a04e9bcd9b1540528be59f2
|
||||
- name: github.com/tendermint/go-merkle
|
||||
version: 714d4d04557fd068a7c2a1748241ce8428015a96
|
||||
- name: github.com/tendermint/go-p2p
|
||||
version: 17124989a93774833df33107fbf17157a7f8ef31
|
||||
subpackages:
|
||||
- upnp
|
||||
- name: github.com/tendermint/go-rpc
|
||||
version: 559613689d56eaa423b19a3a4158546beb4857de
|
||||
subpackages:
|
||||
- client
|
||||
- server
|
||||
- types
|
||||
version: 9b95da8fa4187f6799558d89b271dc8ab6485615
|
||||
- name: github.com/tendermint/go-wire
|
||||
version: c1c9a57ab8038448ddea1714c0698f8051e5748c
|
||||
version: 334005c236d19c632fb5f073f9de3b0fab6a522b
|
||||
subpackages:
|
||||
- data
|
||||
- name: github.com/tendermint/log15
|
||||
version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6
|
||||
subpackages:
|
||||
- term
|
||||
- name: github.com/tendermint/merkleeyes
|
||||
version: 9fb76efa5aebe773a598f97e68e75fe53d520e70
|
||||
version: 6fd69aa0871a4e685a5570aa7ab3d12e4068a722
|
||||
subpackages:
|
||||
- app
|
||||
- client
|
||||
- iavl
|
||||
- name: github.com/tendermint/tendermint
|
||||
version: 6bcd4242f1f336e2b2ef4f644fabaf56222b34d0
|
||||
version: 1310c7264750efa8939680536098ded9f9e8df74
|
||||
subpackages:
|
||||
- blockchain
|
||||
- cmd/tendermint/commands
|
||||
|
@ -115,16 +115,33 @@ imports:
|
|||
- consensus
|
||||
- mempool
|
||||
- node
|
||||
- p2p
|
||||
- p2p/upnp
|
||||
- proxy
|
||||
- rpc/core
|
||||
- rpc/core/types
|
||||
- rpc/grpc
|
||||
- rpc/lib
|
||||
- rpc/lib/client
|
||||
- rpc/lib/server
|
||||
- rpc/lib/types
|
||||
- state
|
||||
- state/txindex
|
||||
- state/txindex/kv
|
||||
- state/txindex/null
|
||||
- types
|
||||
- version
|
||||
- name: github.com/tendermint/tmlibs
|
||||
version: df250b69416a35a943a6e2a92118667e9ef031d4
|
||||
subpackages:
|
||||
- autofile
|
||||
- clist
|
||||
- common
|
||||
- db
|
||||
- events
|
||||
- flowrate
|
||||
- logger
|
||||
- merkle
|
||||
- name: golang.org/x/crypto
|
||||
version: 96846453c37f0876340a66a47f3f75b1f3a6cd2d
|
||||
subpackages:
|
||||
|
@ -176,6 +193,8 @@ imports:
|
|||
- status
|
||||
- tap
|
||||
- transport
|
||||
- name: gopkg.in/yaml.v2
|
||||
version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b
|
||||
testImports:
|
||||
- name: github.com/davecgh/go-spew
|
||||
version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
|
||||
|
|
44
glide.yaml
44
glide.yaml
|
@ -1,24 +1,44 @@
|
|||
package: github.com/tendermint/basecoin
|
||||
import:
|
||||
- package: github.com/tendermint/go-common
|
||||
- package: github.com/gorilla/websocket
|
||||
- package: github.com/pkg/errors
|
||||
- package: github.com/spf13/cobra
|
||||
- package: github.com/spf13/pflag
|
||||
- package: github.com/tendermint/abci
|
||||
version: develop
|
||||
subpackages:
|
||||
- server
|
||||
- types
|
||||
- package: github.com/tendermint/go-crypto
|
||||
version: develop
|
||||
- package: github.com/tendermint/go-events
|
||||
version: develop
|
||||
- package: github.com/tendermint/go-logger
|
||||
version: develop
|
||||
- package: github.com/tendermint/go-data
|
||||
version: develop
|
||||
- package: github.com/tendermint/go-rpc
|
||||
version: develop
|
||||
- package: github.com/tendermint/go-wire
|
||||
version: develop
|
||||
subpackages:
|
||||
- data
|
||||
- package: github.com/tendermint/merkleeyes
|
||||
version: develop
|
||||
subpackages:
|
||||
- client
|
||||
- iavl
|
||||
- package: github.com/tendermint/tendermint
|
||||
version: develop
|
||||
- package: github.com/tendermint/abci
|
||||
subpackages:
|
||||
- cmd/tendermint/commands
|
||||
- config/tendermint
|
||||
- node
|
||||
- proxy
|
||||
- rpc/core/types
|
||||
- rpc/lib/client
|
||||
- rpc/lib/types
|
||||
- types
|
||||
- package: github.com/tendermint/tmlibs
|
||||
version: develop
|
||||
- package: github.com/gorilla/websocket
|
||||
version: v1.1.0
|
||||
subpackages:
|
||||
- common
|
||||
- events
|
||||
- logger
|
||||
testImport:
|
||||
- package: github.com/stretchr/testify
|
||||
subpackages:
|
||||
- assert
|
||||
- require
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/basecoin/app"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyescli "github.com/tendermint/merkleeyes/client"
|
||||
)
|
||||
|
@ -52,8 +51,7 @@ func TestCounterPlugin(t *testing.T) {
|
|||
// Sign request
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
// t.Logf("Sign bytes: %X\n", signBytes)
|
||||
sig := test1PrivAcc.Sign(signBytes)
|
||||
tx.Input.Signature = crypto.SignatureS{sig}
|
||||
tx.Input.Signature = test1PrivAcc.Sign(signBytes)
|
||||
// t.Logf("Signed TX bytes: %X\n", wire.BinaryBytes(struct{ types.Tx }{tx}))
|
||||
|
||||
// Write request
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
merkle "github.com/tendermint/go-merkle"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
merkle "github.com/tendermint/merkleeyes/iavl"
|
||||
"github.com/tendermint/go-wire"
|
||||
tm "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyes "github.com/tendermint/merkleeyes/client"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
tm "github.com/tendermint/tendermint/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
// NOTE: PrivAccounts are sorted by Address,
|
||||
|
@ -30,7 +30,7 @@ func genGenesisDoc(chainID string, numVals int) (*tm.GenesisDoc, []types.PrivAcc
|
|||
name := cmn.Fmt("%v_val_%v", chainID, i)
|
||||
privAcc := types.PrivAccountFromSecret(name)
|
||||
genDoc.Validators = append(genDoc.Validators, tm.GenesisValidator{
|
||||
PubKey: privAcc.PubKey.PubKey,
|
||||
PubKey: privAcc.PubKey,
|
||||
Amount: 1,
|
||||
Name: name,
|
||||
})
|
||||
|
@ -192,7 +192,7 @@ func TestIBCPlugin(t *testing.T) {
|
|||
Prove: true,
|
||||
})
|
||||
assert.Nil(err)
|
||||
var proof *merkle.IAVLProof
|
||||
var proof *iavl.IAVLProof
|
||||
err = wire.ReadBinaryBytes(resQuery.Proof, &proof)
|
||||
assert.Nil(err)
|
||||
|
||||
|
@ -268,9 +268,9 @@ func TestIBCPluginBadCommit(t *testing.T) {
|
|||
|
||||
// Update a chain with a broken commit
|
||||
// Modify the first byte of the first signature
|
||||
sig := commit.Precommits[0].Signature.(crypto.SignatureEd25519)
|
||||
sig := commit.Precommits[0].Signature.Unwrap().(crypto.SignatureEd25519)
|
||||
sig[0] += 1
|
||||
commit.Precommits[0].Signature = sig
|
||||
commit.Precommits[0].Signature = sig.Wrap()
|
||||
res = ibcPlugin.RunTx(store, ctx, wire.BinaryBytes(struct{ IBCTx }{IBCUpdateChainTx{
|
||||
Header: header,
|
||||
Commit: commit,
|
||||
|
@ -379,7 +379,7 @@ func TestIBCPluginBadProof(t *testing.T) {
|
|||
Prove: true,
|
||||
})
|
||||
assert.Nil(err)
|
||||
var proof *merkle.IAVLProof
|
||||
var proof *iavl.IAVLProof
|
||||
err = wire.ReadBinaryBytes(resQuery.Proof, &proof)
|
||||
assert.Nil(err)
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-rpc/client"
|
||||
"github.com/tendermint/go-rpc/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/tendermint/rpc/lib/client"
|
||||
"github.com/tendermint/tendermint/rpc/lib/types"
|
||||
"github.com/tendermint/go-wire"
|
||||
_ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types
|
||||
)
|
||||
|
|
|
@ -3,8 +3,8 @@ package state
|
|||
import (
|
||||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-events"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/tmlibs/events"
|
||||
)
|
||||
|
||||
// If the tx is invalid, a TMSP error will be returned.
|
||||
|
@ -244,7 +244,7 @@ func validateInputAdvanced(acc *types.Account, signBytes []byte, in types.TxInpu
|
|||
return abci.ErrBaseInsufficientFunds.AppendLog(cmn.Fmt("balance is %v, tried to send %v", balance, in.Coins))
|
||||
}
|
||||
// Check signatures
|
||||
if !acc.PubKey.VerifyBytes(signBytes, in.Signature.Signature) {
|
||||
if !acc.PubKey.VerifyBytes(signBytes, in.Signature) {
|
||||
return abci.ErrBaseInvalidSignature.AppendLog(cmn.Fmt("SignBytes: %X", signBytes))
|
||||
}
|
||||
return abci.OK
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package state
|
||||
|
||||
import (
|
||||
"github.com/tendermint/go-logger"
|
||||
"github.com/tendermint/tmlibs/logger"
|
||||
)
|
||||
|
||||
var log = logger.New("module", "state")
|
||||
|
|
|
@ -3,7 +3,7 @@ package state
|
|||
import (
|
||||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
. "github.com/tendermint/go-common"
|
||||
. "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyes "github.com/tendermint/merkleeyes/client"
|
||||
)
|
||||
|
|
|
@ -6,10 +6,9 @@ import (
|
|||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
rpcclient "github.com/tendermint/go-rpc/client"
|
||||
"github.com/tendermint/go-rpc/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/tendermint/rpc/lib/client"
|
||||
"github.com/tendermint/tendermint/rpc/lib/types"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
_ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types
|
||||
)
|
||||
|
@ -67,7 +66,7 @@ func main() {
|
|||
// Sign request
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
sig := root.Sign(signBytes)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{sig}
|
||||
tx.Inputs[0].Signature = sig
|
||||
//fmt.Println("tx:", tx)
|
||||
|
||||
// Write request
|
||||
|
@ -118,7 +117,7 @@ func main() {
|
|||
// Sign request
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
sig := privAccountA.Sign(signBytes)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{sig}
|
||||
tx.Inputs[0].Signature = sig
|
||||
//fmt.Println("tx:", tx)
|
||||
|
||||
// Write request
|
||||
|
|
|
@ -8,8 +8,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/basecoin/app"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyescli "github.com/tendermint/merkleeyes/client"
|
||||
)
|
||||
|
@ -50,7 +49,7 @@ func TestSendTx(t *testing.T) {
|
|||
signBytes := tx.SignBytes(chainID)
|
||||
// t.Log("Sign bytes: %X\n", signBytes)
|
||||
sig := test1PrivAcc.Sign(signBytes)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{sig}
|
||||
tx.Inputs[0].Signature = sig
|
||||
// t.Log("Signed TX bytes: %X\n", wire.BinaryBytes(types.TxS{tx}))
|
||||
|
||||
// Write request
|
||||
|
@ -102,7 +101,7 @@ func TestSequence(t *testing.T) {
|
|||
// Sign request
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
sig := test1PrivAcc.Sign(signBytes)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{sig}
|
||||
tx.Inputs[0].Signature = sig
|
||||
// t.Log("ADDR: %X -> %X\n", tx.Inputs[0].Address, tx.Outputs[0].Address)
|
||||
|
||||
// Write request
|
||||
|
@ -146,7 +145,7 @@ func TestSequence(t *testing.T) {
|
|||
// Sign request
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
sig := privAccountA.Sign(signBytes)
|
||||
tx.Inputs[0].Signature = crypto.SignatureS{sig}
|
||||
tx.Inputs[0].Signature = sig
|
||||
// t.Log("ADDR: %X -> %X\n", tx.Inputs[0].Address, tx.Outputs[0].Address)
|
||||
|
||||
// Write request
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
)
|
||||
|
||||
type Account struct {
|
||||
PubKey crypto.PubKeyS `json:"pub_key"` // May be nil, if not known.
|
||||
Sequence int `json:"sequence"`
|
||||
Balance Coins `json:"coins"`
|
||||
PubKey crypto.PubKey `json:"pub_key"` // May be nil, if not known.
|
||||
Sequence int `json:"sequence"`
|
||||
Balance Coins `json:"coins"`
|
||||
}
|
||||
|
||||
func (acc *Account) Copy() *Account {
|
||||
|
@ -31,7 +31,7 @@ func (acc *Account) String() string {
|
|||
//----------------------------------------
|
||||
|
||||
type PrivAccount struct {
|
||||
crypto.PrivKeyS
|
||||
crypto.PrivKey
|
||||
Account
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"container/list"
|
||||
"fmt"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
. "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
type KVStore interface {
|
||||
|
|
|
@ -3,18 +3,19 @@ package types
|
|||
// Helper functions for testing
|
||||
|
||||
import (
|
||||
cmn "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
// Creates a PrivAccount from secret.
|
||||
// The amount is not set.
|
||||
func PrivAccountFromSecret(secret string) PrivAccount {
|
||||
privKey := crypto.GenPrivKeyEd25519FromSecret([]byte(secret))
|
||||
privKey :=
|
||||
crypto.GenPrivKeyEd25519FromSecret([]byte(secret)).Wrap()
|
||||
privAccount := PrivAccount{
|
||||
PrivKeyS: crypto.PrivKeyS{privKey},
|
||||
PrivKey: privKey,
|
||||
Account: Account{
|
||||
PubKey: crypto.PubKeyS{privKey.PubKey()},
|
||||
PubKey: privKey.PubKey(),
|
||||
},
|
||||
}
|
||||
return privAccount
|
||||
|
@ -30,10 +31,10 @@ func RandAccounts(num int, minAmount int64, maxAmount int64) []PrivAccount {
|
|||
balance += cmn.RandInt64() % (maxAmount - minAmount)
|
||||
}
|
||||
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
pubKey := crypto.PubKeyS{privKey.PubKey()}
|
||||
privKey := crypto.GenPrivKeyEd25519().Wrap()
|
||||
pubKey := privKey.PubKey()
|
||||
privAccs[i] = PrivAccount{
|
||||
PrivKeyS: crypto.PrivKeyS{privKey},
|
||||
PrivKey: privKey,
|
||||
Account: Account{
|
||||
PubKey: pubKey,
|
||||
Balance: Coins{Coin{"", balance}},
|
||||
|
@ -99,6 +100,6 @@ func GetTx(seq int, accOut PrivAccount, accsIn ...PrivAccount) *SendTx {
|
|||
func SignTx(chainID string, tx *SendTx, accs ...PrivAccount) {
|
||||
signBytes := tx.SignBytes(chainID)
|
||||
for i, _ := range tx.Inputs {
|
||||
tx.Inputs[i].Signature = crypto.SignatureS{accs[i].Sign(signBytes)}
|
||||
tx.Inputs[i].Signature = accs[i].Sign(signBytes)
|
||||
}
|
||||
}
|
||||
|
|
46
types/tx.go
46
types/tx.go
|
@ -5,9 +5,9 @@ import (
|
|||
"encoding/json"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
. "github.com/tendermint/go-common"
|
||||
. "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-data"
|
||||
"github.com/tendermint/go-wire/data"
|
||||
"github.com/tendermint/go-wire"
|
||||
)
|
||||
|
||||
|
@ -37,7 +37,7 @@ func (_ *AppTx) AssertIsTx() {}
|
|||
|
||||
var txMapper data.Mapper
|
||||
|
||||
// register both private key types with go-data (and thus go-wire)
|
||||
// register both private key types with go-wire/data (and thus go-wire)
|
||||
func init() {
|
||||
txMapper = data.NewMapper(TxS{}).
|
||||
RegisterImplementation(&SendTx{}, TxNameSend, TxTypeSend).
|
||||
|
@ -64,11 +64,11 @@ func (p *TxS) UnmarshalJSON(data []byte) (err error) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
type TxInput struct {
|
||||
Address data.Bytes `json:"address"` // Hash of the PubKey
|
||||
Coins Coins `json:"coins"` //
|
||||
Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput
|
||||
Signature crypto.SignatureS `json:"signature"` // Depends on the PubKey type and the whole Tx
|
||||
PubKey crypto.PubKeyS `json:"pub_key"` // Is present iff Sequence == 0
|
||||
Address data.Bytes `json:"address"` // Hash of the PubKey
|
||||
Coins Coins `json:"coins"` //
|
||||
Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput
|
||||
Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx
|
||||
PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0
|
||||
}
|
||||
|
||||
func (txIn TxInput) ValidateBasic() abci.Result {
|
||||
|
@ -104,13 +104,7 @@ func NewTxInput(pubKey crypto.PubKey, coins Coins, sequence int) TxInput {
|
|||
Sequence: sequence,
|
||||
}
|
||||
if sequence == 1 {
|
||||
// safely wrap if needed
|
||||
// TODO: extract this as utility function?
|
||||
ps, ok := pubKey.(crypto.PubKeyS)
|
||||
if !ok {
|
||||
ps = crypto.PubKeyS{pubKey}
|
||||
}
|
||||
input.PubKey = ps
|
||||
input.PubKey = pubKey
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
@ -151,25 +145,21 @@ type SendTx struct {
|
|||
func (tx *SendTx) SignBytes(chainID string) []byte {
|
||||
signBytes := wire.BinaryBytes(chainID)
|
||||
sigz := make([]crypto.Signature, len(tx.Inputs))
|
||||
for i, input := range tx.Inputs {
|
||||
sigz[i] = input.Signature.Signature
|
||||
tx.Inputs[i].Signature.Signature = nil
|
||||
for i := range tx.Inputs {
|
||||
sigz[i] = tx.Inputs[i].Signature
|
||||
tx.Inputs[i].Signature = crypto.Signature{}
|
||||
}
|
||||
signBytes = append(signBytes, wire.BinaryBytes(tx)...)
|
||||
for i := range tx.Inputs {
|
||||
tx.Inputs[i].Signature.Signature = sigz[i]
|
||||
tx.Inputs[i].Signature = sigz[i]
|
||||
}
|
||||
return signBytes
|
||||
}
|
||||
|
||||
func (tx *SendTx) SetSignature(addr []byte, sig crypto.Signature) bool {
|
||||
sigs, ok := sig.(crypto.SignatureS)
|
||||
if !ok {
|
||||
sigs = crypto.SignatureS{sig}
|
||||
}
|
||||
for i, input := range tx.Inputs {
|
||||
if bytes.Equal(input.Address, addr) {
|
||||
tx.Inputs[i].Signature = sigs
|
||||
tx.Inputs[i].Signature = sig
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -193,18 +183,14 @@ type AppTx struct {
|
|||
func (tx *AppTx) SignBytes(chainID string) []byte {
|
||||
signBytes := wire.BinaryBytes(chainID)
|
||||
sig := tx.Input.Signature
|
||||
tx.Input.Signature.Signature = nil
|
||||
tx.Input.Signature = crypto.Signature{}
|
||||
signBytes = append(signBytes, wire.BinaryBytes(tx)...)
|
||||
tx.Input.Signature = sig
|
||||
return signBytes
|
||||
}
|
||||
|
||||
func (tx *AppTx) SetSignature(sig crypto.Signature) bool {
|
||||
sigs, ok := sig.(crypto.SignatureS)
|
||||
if !ok {
|
||||
sigs = crypto.SignatureS{sig}
|
||||
}
|
||||
tx.Input.Signature = sigs
|
||||
tx.Input.Signature = sig
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
data "github.com/tendermint/go-data"
|
||||
data "github.com/tendermint/go-wire/data"
|
||||
)
|
||||
|
||||
var chainID string = "test_chain"
|
||||
|
@ -109,7 +108,7 @@ func TestSendTxJSON(t *testing.T) {
|
|||
sig := test1PrivAcc.Sign(signBytes)
|
||||
// we handle both raw sig and wrapped sig the same
|
||||
tx.SetSignature(test1PrivAcc.PubKey.Address(), sig)
|
||||
tx2.SetSignature(test1PrivAcc.PubKey.Address(), crypto.SignatureS{sig})
|
||||
tx2.SetSignature(test1PrivAcc.PubKey.Address(), sig)
|
||||
assert.Equal(tx, tx2)
|
||||
|
||||
// let's marshal / unmarshal this with signature
|
||||
|
|
Loading…
Reference in New Issue