Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
e396bbbc
Commit
e396bbbc
authored
9 years ago
by
Ethan Buchman
Browse files
Options
Downloads
Patches
Plain Diff
use eris-keys for validator signing
parent
998a01b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
erisdb/pipe/consensus.go
+1
-1
1 addition, 1 deletion
erisdb/pipe/consensus.go
erisdb/serve.go
+54
-4
54 additions, 4 deletions
erisdb/serve.go
with
55 additions
and
5 deletions
erisdb/pipe/consensus.go
+
1
−
1
View file @
e396bbbc
...
...
@@ -23,7 +23,7 @@ func (this *consensus) State() (*ConsensusState, error) {
peerRoundStates
:=
[]
string
{}
for
_
,
peer
:=
range
this
.
p2pSwitch
.
Peers
()
.
List
()
{
// TODO: clean this up?
peerState
:=
peer
.
Data
.
Get
(
cm
.
PeerStateKey
)
.
(
*
cm
.
PeerState
)
peerState
:=
peer
.
Data
.
Get
(
types
.
PeerStateKey
)
.
(
*
cm
.
PeerState
)
peerRoundState
:=
peerState
.
GetRoundState
()
peerRoundStateStr
:=
peer
.
Key
+
":"
+
string
(
wire
.
JSONBytes
(
peerRoundState
))
peerRoundStates
=
append
(
peerRoundStates
,
peerRoundStateStr
)
...
...
This diff is collapsed.
Click to expand it.
erisdb/serve.go
+
54
−
4
View file @
e396bbbc
...
...
@@ -3,15 +3,24 @@
package
erisdb
import
(
"encoding/hex"
"fmt"
"path"
"strings"
ep
"github.com/eris-ltd/eris-db/erisdb/pipe"
"github.com/eris-ltd/eris-db/server"
"github.com/eris-ltd/mint-client/mintx/core"
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/log15"
acm
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/account"
.
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/common"
cfg
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/config"
tmcfg
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/config/tendermint"
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/node"
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/p2p"
ep
"github.com/eris-ltd/eris-db/erisdb/pipe"
"github.com/eris-ltd/eris-db/server"
"path"
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/types"
)
const
ERISDB_VERSION
=
"0.11.5"
...
...
@@ -56,9 +65,28 @@ func ServeErisDB(workDir string) (*server.ServeProcess, error) {
tmConfig
.
Set
(
"version"
,
TENDERMINT_VERSION
)
cfg
.
ApplyConfig
(
tmConfig
)
// Notify modules of new config
// load the priv validator
privVal
:=
types
.
LoadPrivValidator
(
tmConfig
.
GetString
(
"priv_validator_file"
))
// possibly set the signer to use eris-keys
signerCfg
:=
tmConfig
.
GetString
(
"signer"
)
if
!
(
signerCfg
==
"default"
||
signerCfg
==
""
)
{
spl
:=
strings
.
Split
(
signerCfg
,
":"
)
if
len
(
spl
)
!=
2
{
panic
(
`"signer" field in config.toml should be "default" or "ERIS_KEYS_HOST:ERIS_KEYS_PORT"`
)
}
// TODO: if a privKey is found in the privVal, warn the user that we want to import it to eris-keys and delete it
host
:=
signerCfg
addr
:=
hex
.
EncodeToString
(
privVal
.
Address
)
signer
:=
NewErisSigner
(
host
,
addr
)
privVal
.
SetSigner
(
signer
)
}
// Set the node up.
nodeRd
:=
make
(
chan
struct
{})
nd
:=
node
.
NewNode
()
nd
:=
node
.
NewNode
(
privVal
)
// Load the supporting objects.
pipe
:=
ep
.
NewPipe
(
nd
)
codec
:=
&
TCodec
{}
...
...
@@ -103,3 +131,25 @@ func startNode(nd *node.Node, ready chan struct{}, shutDown <-chan struct{}) {
<-
shutDown
nd
.
Stop
()
}
type
ErisSigner
struct
{
Host
string
Address
string
SessionKey
string
}
func
NewErisSigner
(
host
,
address
string
)
*
ErisSigner
{
if
!
strings
.
HasPrefix
(
host
,
"http://"
)
{
host
=
fmt
.
Sprintf
(
"http://%s"
,
host
)
}
return
&
ErisSigner
{
Host
:
host
,
Address
:
address
}
}
func
(
es
*
ErisSigner
)
Sign
(
msg
[]
byte
)
acm
.
SignatureEd25519
{
msgHex
:=
hex
.
EncodeToString
(
msg
)
sig
,
err
:=
core
.
Sign
(
msgHex
,
es
.
Address
,
es
.
Host
)
if
err
!=
nil
{
panic
(
err
)
}
return
acm
.
SignatureEd25519
(
sig
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment