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
15dbb14a
Unverified
Commit
15dbb14a
authored
8 years ago
by
Benjamin Bollen
Browse files
Options
Downloads
Patches
Plain Diff
docker; eris-mint/pipe: correct for glide and chaindId assertion
parent
b5b51064
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
DOCKER/Dockerfile
+2
-2
2 additions, 2 deletions
DOCKER/Dockerfile
manager/eris-mint/pipe.go
+122
-118
122 additions, 118 deletions
manager/eris-mint/pipe.go
with
124 additions
and
120 deletions
DOCKER/Dockerfile
+
2
−
2
View file @
15dbb14a
...
@@ -9,7 +9,7 @@ MAINTAINER Eris Industries <support@erisindustries.com>
...
@@ -9,7 +9,7 @@ MAINTAINER Eris Industries <support@erisindustries.com>
ENV
GO15VENDOREXPERIMENT 1
ENV
GO15VENDOREXPERIMENT 1
# install glide for dependency management
# install glide for dependency management
RUN
go
install
github.com/Masterminds/glide
RUN
go
get
github.com/Masterminds/glide
# set the repo and install erisdb
# set the repo and install erisdb
ENV
REPO $GOPATH/src/github.com/eris-ltd/eris-db
ENV
REPO $GOPATH/src/github.com/eris-ltd/eris-db
...
@@ -77,4 +77,4 @@ EXPOSE 1337
...
@@ -77,4 +77,4 @@ EXPOSE 1337
EXPOSE
46656
EXPOSE
46656
EXPOSE
46657
EXPOSE
46657
ENTRYPOINT
["eris-db", "serve"]
ENTRYPOINT
["eris-db", "serve"]
CMD
["--work-dir $CHAINROOT"]
#
CMD["--work-dir $CHAINROOT"]
This diff is collapsed.
Click to expand it.
manager/eris-mint/pipe.go
+
122
−
118
View file @
15dbb14a
...
@@ -17,48 +17,48 @@
...
@@ -17,48 +17,48 @@
package
erismint
package
erismint
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
crypto
"github.com/tendermint/go-crypto"
db
"github.com/tendermint/go-db"
tendermint_common
"github.com/tendermint/go-common"
tendermint_common
"github.com/tendermint/go-common"
crypto
"github.com/tendermint/go-crypto"
db
"github.com/tendermint/go-db"
tendermint_events
"github.com/tendermint/go-events"
tendermint_events
"github.com/tendermint/go-events"
tendermint_types
"github.com/tendermint/tendermint/types"
wire
"github.com/tendermint/go-wire"
tmsp_types
"github.com/tendermint/tmsp/types"
tendermint_types
"github.com/tendermint/tendermint/types"
wire
"github.com/tendermint/go-wire"
tmsp_types
"github.com/tendermint/tmsp/types"
log
"github.com/eris-ltd/eris-logger"
log
"github.com/eris-ltd/eris-logger"
account
"github.com/eris-ltd/eris-db/account"
account
"github.com/eris-ltd/eris-db/account"
config
"github.com/eris-ltd/eris-db/config"
config
"github.com/eris-ltd/eris-db/config"
definitions
"github.com/eris-ltd/eris-db/definitions"
definitions
"github.com/eris-ltd/eris-db/definitions"
event
"github.com/eris-ltd/eris-db/event"
event
"github.com/eris-ltd/eris-db/event"
manager_types
"github.com/eris-ltd/eris-db/manager/types"
vm
"github.com/eris-ltd/eris-db/manager/eris-mint/evm"
state
"github.com/eris-ltd/eris-db/manager/eris-mint/state"
state_types
"github.com/eris-ltd/eris-db/manager/eris-mint/state/types"
manager_types
"github.com/eris-ltd/eris-db/manager/types"
rpc_tendermint_types
"github.com/eris-ltd/eris-db/rpc/tendermint/core/types"
rpc_tendermint_types
"github.com/eris-ltd/eris-db/rpc/tendermint/core/types"
state
"github.com/eris-ltd/eris-db/manager/eris-mint/state"
transaction
"github.com/eris-ltd/eris-db/txs"
state_types
"github.com/eris-ltd/eris-db/manager/eris-mint/state/types"
transaction
"github.com/eris-ltd/eris-db/txs"
vm
"github.com/eris-ltd/eris-db/manager/eris-mint/evm"
)
)
type
ErisMintPipe
struct
{
type
ErisMintPipe
struct
{
erisMintState
*
state
.
State
erisMintState
*
state
.
State
eventSwitch
*
tendermint_events
.
EventSwitch
eventSwitch
*
tendermint_events
.
EventSwitch
erisMint
*
ErisMint
erisMint
*
ErisMint
// Pipe implementations
// Pipe implementations
accounts
*
accounts
accounts
*
accounts
blockchain
*
blockchain
blockchain
*
blockchain
consensus
*
consensus
consensus
*
consensus
events
event
.
EventEmitter
events
event
.
EventEmitter
namereg
*
namereg
namereg
*
namereg
network
*
network
network
*
network
transactor
*
transactor
transactor
*
transactor
// Consensus interface
// Consensus interface
consensusEngine
definitions
.
ConsensusEngine
consensusEngine
definitions
.
ConsensusEngine
// Genesis cache
// Genesis cache
genesisDoc
*
state_types
.
GenesisDoc
genesisDoc
*
state_types
.
GenesisDoc
genesisState
*
state
.
State
genesisState
*
state
.
State
}
}
// NOTE [ben] Compiler check to ensure ErisMintPipe successfully implements
// NOTE [ben] Compiler check to ensure ErisMintPipe successfully implements
...
@@ -70,54 +70,54 @@ var _ definitions.Pipe = (*ErisMintPipe)(nil)
...
@@ -70,54 +70,54 @@ var _ definitions.Pipe = (*ErisMintPipe)(nil)
var
_
definitions
.
TendermintPipe
=
(
*
ErisMintPipe
)(
nil
)
var
_
definitions
.
TendermintPipe
=
(
*
ErisMintPipe
)(
nil
)
func
NewErisMintPipe
(
moduleConfig
*
config
.
ModuleConfig
,
func
NewErisMintPipe
(
moduleConfig
*
config
.
ModuleConfig
,
eventSwitch
*
tendermint_events
.
EventSwitch
)
(
*
ErisMintPipe
,
error
)
{
eventSwitch
*
tendermint_events
.
EventSwitch
)
(
*
ErisMintPipe
,
error
)
{
startedState
,
genesisDoc
,
err
:=
startState
(
moduleConfig
.
DataDir
,
startedState
,
genesisDoc
,
err
:=
startState
(
moduleConfig
.
DataDir
,
moduleConfig
.
Config
.
GetString
(
"db_backend"
),
moduleConfig
.
GenesisFile
,
moduleConfig
.
Config
.
GetString
(
"db_backend"
),
moduleConfig
.
GenesisFile
,
moduleConfig
.
ChainId
)
moduleConfig
.
ChainId
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to start state: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"Failed to start state: %v"
,
err
)
}
}
// assert ChainId matches genesis ChainId
// assert ChainId matches genesis ChainId
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"chainId"
:
startedState
.
ChainID
,
"chainId"
:
startedState
.
ChainID
,
"lastBlockHeight"
:
startedState
.
LastBlockHeight
,
"lastBlockHeight"
:
startedState
.
LastBlockHeight
,
"lastBlockHash"
:
startedState
.
LastBlockHash
,
"lastBlockHash"
:
startedState
.
LastBlockHash
,
})
.
Debug
(
"Loaded state"
)
})
.
Debug
(
"Loaded state"
)
// start the application
// start the application
erisMint
:=
NewErisMint
(
startedState
,
eventSwitch
)
erisMint
:=
NewErisMint
(
startedState
,
eventSwitch
)
// NOTE: [ben] Set Host opens an RPC pipe to Tendermint; this is a remnant
// NOTE: [ben] Set Host opens an RPC pipe to Tendermint; this is a remnant
// of the old Eris-DB / Tendermint and should be considered as an in-process
// of the old Eris-DB / Tendermint and should be considered as an in-process
// call when possible
// call when possible
tendermintHost
:=
moduleConfig
.
Config
.
GetString
(
"tendermint_host"
)
tendermintHost
:=
moduleConfig
.
Config
.
GetString
(
"tendermint_host"
)
erisMint
.
SetHostAddress
(
tendermintHost
)
erisMint
.
SetHostAddress
(
tendermintHost
)
// initialise the components of the pipe
// initialise the components of the pipe
events
:=
newEvents
(
eventSwitch
)
events
:=
newEvents
(
eventSwitch
)
accounts
:=
newAccounts
(
erisMint
)
accounts
:=
newAccounts
(
erisMint
)
namereg
:=
newNameReg
(
erisMint
)
namereg
:=
newNameReg
(
erisMint
)
transactor
:=
newTransactor
(
moduleConfig
.
ChainId
,
eventSwitch
,
erisMint
,
transactor
:=
newTransactor
(
moduleConfig
.
ChainId
,
eventSwitch
,
erisMint
,
events
)
events
)
// TODO: make interface to tendermint core's rpc for these
// TODO: make interface to tendermint core's rpc for these
// blockchain := newBlockchain(chainID, genDocFile, blockStore)
// blockchain := newBlockchain(chainID, genDocFile, blockStore)
// consensus := newConsensus(erisdbApp)
// consensus := newConsensus(erisdbApp)
// net := newNetwork(erisdbApp)
// net := newNetwork(erisdbApp)
return
&
ErisMintPipe
{
return
&
ErisMintPipe
{
erisMintState
:
startedState
,
erisMintState
:
startedState
,
eventSwitch
:
eventSwitch
,
eventSwitch
:
eventSwitch
,
erisMint
:
erisMint
,
erisMint
:
erisMint
,
accounts
:
accounts
,
accounts
:
accounts
,
events
:
events
,
events
:
events
,
namereg
:
namereg
,
namereg
:
namereg
,
transactor
:
transactor
,
transactor
:
transactor
,
network
:
newNetwork
(),
network
:
newNetwork
(),
consensus
:
nil
,
consensus
:
nil
,
// genesis cache
// genesis cache
genesisDoc
:
genesisDoc
,
genesisDoc
:
genesisDoc
,
genesisState
:
nil
,
genesisState
:
nil
,
},
nil
},
nil
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -129,18 +129,18 @@ func NewErisMintPipe(moduleConfig *config.ModuleConfig,
...
@@ -129,18 +129,18 @@ func NewErisMintPipe(moduleConfig *config.ModuleConfig,
// If no state can be loaded, the JSON genesis file will be loaded into the
// If no state can be loaded, the JSON genesis file will be loaded into the
// state database as the zero state.
// state database as the zero state.
func
startState
(
dataDir
,
backend
,
genesisFile
,
chainId
string
)
(
*
state
.
State
,
func
startState
(
dataDir
,
backend
,
genesisFile
,
chainId
string
)
(
*
state
.
State
,
*
state_types
.
GenesisDoc
,
error
)
{
*
state_types
.
GenesisDoc
,
error
)
{
// avoid Tendermints PanicSanity and return a clean error
// avoid Tendermints PanicSanity and return a clean error
if
backend
!=
db
.
DBBackendMemDB
&&
if
backend
!=
db
.
DBBackendMemDB
&&
backend
!=
db
.
DBBackendLevelDB
{
backend
!=
db
.
DBBackendLevelDB
{
return
nil
,
nil
,
fmt
.
Errorf
(
"Database backend %s is not supported by %s"
,
return
nil
,
nil
,
fmt
.
Errorf
(
"Database backend %s is not supported by %s"
,
backend
,
GetErisMintVersion
)
backend
,
GetErisMintVersion
)
}
}
stateDB
:=
db
.
NewDB
(
"erismint"
,
backend
,
dataDir
)
stateDB
:=
db
.
NewDB
(
"erismint"
,
backend
,
dataDir
)
newState
:=
state
.
LoadState
(
stateDB
)
newState
:=
state
.
LoadState
(
stateDB
)
var
genesisDoc
*
state_types
.
GenesisDoc
var
genesisDoc
*
state_types
.
GenesisDoc
if
newState
==
nil
{
if
newState
==
nil
{
genesisDoc
,
newState
=
state
.
MakeGenesisStateFromFile
(
stateDB
,
genesisFile
)
genesisDoc
,
newState
=
state
.
MakeGenesisStateFromFile
(
stateDB
,
genesisFile
)
newState
.
Save
()
newState
.
Save
()
buf
,
n
,
err
:=
new
(
bytes
.
Buffer
),
new
(
int
),
new
(
error
)
buf
,
n
,
err
:=
new
(
bytes
.
Buffer
),
new
(
int
),
new
(
error
)
...
@@ -156,59 +156,63 @@ func startState(dataDir, backend, genesisFile, chainId string) (*state.State,
...
@@ -156,59 +156,63 @@ func startState(dataDir, backend, genesisFile, chainId string) (*state.State,
if
*
err
!=
nil
{
if
*
err
!=
nil
{
return
nil
,
nil
,
fmt
.
Errorf
(
"Unable to read genesisDoc from db on startState: %v"
,
err
)
return
nil
,
nil
,
fmt
.
Errorf
(
"Unable to read genesisDoc from db on startState: %v"
,
err
)
}
}
// assert loaded genesis doc has the same chainId as the provided chainId
// assert loaded genesis doc has the same chainId as the provided chainId
if
genesisDoc
.
ChainID
!=
chainId
{
if
genesisDoc
.
ChainID
!=
chainId
{
return
nil
,
nil
,
fmt
.
Errorf
(
"ChainId (%s) loaded from genesis document in existing database does not match configuration chainId (%s)."
,
log
.
WithFields
(
log
.
Fields
{
genesisDoc
.
ChainID
,
chainId
)
"chainId from loaded genesis"
:
genesisDoc
.
ChainID
,
}
"chainId from configuration"
:
chainId
,
})
.
Warn
(
"Conflicting chainIds"
)
// return nil, nil, fmt.Errorf("ChainId (%s) loaded from genesis document in existing database does not match configuration chainId (%s).",
// genesisDoc.ChainID, chainId)
}
}
}
return
newState
,
genesisDoc
,
nil
return
newState
,
genesisDoc
,
nil
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Implement definitions.Pipe for ErisMintPipe
// Implement definitions.Pipe for ErisMintPipe
func
(
pipe
*
ErisMintPipe
)
Accounts
()
definitions
.
Accounts
{
func
(
pipe
*
ErisMintPipe
)
Accounts
()
definitions
.
Accounts
{
return
pipe
.
accounts
return
pipe
.
accounts
}
}
func
(
pipe
*
ErisMintPipe
)
Blockchain
()
definitions
.
Blockchain
{
func
(
pipe
*
ErisMintPipe
)
Blockchain
()
definitions
.
Blockchain
{
return
pipe
.
blockchain
return
pipe
.
blockchain
}
}
func
(
pipe
*
ErisMintPipe
)
Consensus
()
definitions
.
Consensus
{
func
(
pipe
*
ErisMintPipe
)
Consensus
()
definitions
.
Consensus
{
return
pipe
.
consensus
return
pipe
.
consensus
}
}
func
(
pipe
*
ErisMintPipe
)
Events
()
event
.
EventEmitter
{
func
(
pipe
*
ErisMintPipe
)
Events
()
event
.
EventEmitter
{
return
pipe
.
events
return
pipe
.
events
}
}
func
(
pipe
*
ErisMintPipe
)
NameReg
()
definitions
.
NameReg
{
func
(
pipe
*
ErisMintPipe
)
NameReg
()
definitions
.
NameReg
{
return
pipe
.
namereg
return
pipe
.
namereg
}
}
func
(
pipe
*
ErisMintPipe
)
Net
()
definitions
.
Net
{
func
(
pipe
*
ErisMintPipe
)
Net
()
definitions
.
Net
{
return
pipe
.
network
return
pipe
.
network
}
}
func
(
pipe
*
ErisMintPipe
)
Transactor
()
definitions
.
Transactor
{
func
(
pipe
*
ErisMintPipe
)
Transactor
()
definitions
.
Transactor
{
return
pipe
.
transactor
return
pipe
.
transactor
}
}
func
(
pipe
*
ErisMintPipe
)
GetApplication
()
manager_types
.
Application
{
func
(
pipe
*
ErisMintPipe
)
GetApplication
()
manager_types
.
Application
{
return
pipe
.
erisMint
return
pipe
.
erisMint
}
}
func
(
pipe
*
ErisMintPipe
)
SetConsensusEngine
(
func
(
pipe
*
ErisMintPipe
)
SetConsensusEngine
(
consensus
definitions
.
ConsensusEngine
)
error
{
consensus
definitions
.
ConsensusEngine
)
error
{
if
pipe
.
consensusEngine
==
nil
{
if
pipe
.
consensusEngine
==
nil
{
pipe
.
consensusEngine
=
consensus
pipe
.
consensusEngine
=
consensus
}
else
{
}
else
{
return
fmt
.
Errorf
(
"Failed to set consensus engine for pipe; already set"
)
return
fmt
.
Errorf
(
"Failed to set consensus engine for pipe; already set"
)
}
}
return
nil
return
nil
}
}
func
(
pipe
*
ErisMintPipe
)
GetTendermintPipe
()
(
definitions
.
TendermintPipe
,
func
(
pipe
*
ErisMintPipe
)
GetTendermintPipe
()
(
definitions
.
TendermintPipe
,
...
@@ -254,7 +258,7 @@ func (pipe *ErisMintPipe) NetInfo() (*rpc_tendermint_types.ResultNetInfo, error)
...
@@ -254,7 +258,7 @@ func (pipe *ErisMintPipe) NetInfo() (*rpc_tendermint_types.ResultNetInfo, error)
for
_
,
listener
:=
range
pipe
.
consensusEngine
.
Listeners
()
{
for
_
,
listener
:=
range
pipe
.
consensusEngine
.
Listeners
()
{
listeners
=
append
(
listeners
,
listener
.
String
())
listeners
=
append
(
listeners
,
listener
.
String
())
}
}
peers
:=
pipe
.
consensusEngine
.
Peers
()
peers
:=
pipe
.
consensusEngine
.
Peers
()
return
&
rpc_tendermint_types
.
ResultNetInfo
{
return
&
rpc_tendermint_types
.
ResultNetInfo
{
Listening
:
listening
,
Listening
:
listening
,
Listeners
:
listeners
,
Listeners
:
listeners
,
...
@@ -263,7 +267,7 @@ func (pipe *ErisMintPipe) NetInfo() (*rpc_tendermint_types.ResultNetInfo, error)
...
@@ -263,7 +267,7 @@ func (pipe *ErisMintPipe) NetInfo() (*rpc_tendermint_types.ResultNetInfo, error)
}
}
func
(
pipe
*
ErisMintPipe
)
Genesis
()
(
*
rpc_tendermint_types
.
ResultGenesis
,
error
)
{
func
(
pipe
*
ErisMintPipe
)
Genesis
()
(
*
rpc_tendermint_types
.
ResultGenesis
,
error
)
{
return
&
rpc_tendermint_types
.
ResultGenesis
{
return
&
rpc_tendermint_types
.
ResultGenesis
{
// TODO: [ben] sharing pointer to unmutated GenesisDoc, but is not immutable
// TODO: [ben] sharing pointer to unmutated GenesisDoc, but is not immutable
Genesis
:
pipe
.
genesisDoc
,
Genesis
:
pipe
.
genesisDoc
,
},
nil
},
nil
...
@@ -461,7 +465,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
...
@@ -461,7 +465,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
error
)
{
error
)
{
responseChannel
:=
make
(
chan
*
tmsp_types
.
Response
,
1
)
responseChannel
:=
make
(
chan
*
tmsp_types
.
Response
,
1
)
err
:=
pipe
.
consensusEngine
.
BroadcastTransaction
(
transaction
.
EncodeTx
(
tx
),
err
:=
pipe
.
consensusEngine
.
BroadcastTransaction
(
transaction
.
EncodeTx
(
tx
),
func
(
res
*
tmsp_types
.
Response
)
{
responseChannel
<-
res
})
func
(
res
*
tmsp_types
.
Response
)
{
responseChannel
<-
res
})
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Error broadcasting transaction: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"Error broadcasting transaction: %v"
,
err
)
}
}
...
@@ -475,7 +479,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
...
@@ -475,7 +479,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
if
responseCheckTx
==
nil
{
if
responseCheckTx
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Error, application did not return CheckTx response."
)
return
nil
,
fmt
.
Errorf
(
"Error, application did not return CheckTx response."
)
}
}
resultBroadCastTx
:=
&
rpc_tendermint_types
.
ResultBroadcastTx
{
resultBroadCastTx
:=
&
rpc_tendermint_types
.
ResultBroadcastTx
{
Code
:
responseCheckTx
.
Code
,
Code
:
responseCheckTx
.
Code
,
Data
:
responseCheckTx
.
Data
,
Data
:
responseCheckTx
.
Data
,
Log
:
responseCheckTx
.
Log
,
Log
:
responseCheckTx
.
Log
,
...
@@ -489,7 +493,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
...
@@ -489,7 +493,7 @@ func (pipe *ErisMintPipe) BroadcastTxSync(tx transaction.Tx) (*rpc_tendermint_ty
return
resultBroadCastTx
,
fmt
.
Errorf
(
resultBroadCastTx
.
Log
)
return
resultBroadCastTx
,
fmt
.
Errorf
(
resultBroadCastTx
.
Log
)
default
:
default
:
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"application"
:
GetErisMintVersion
()
.
GetVersionString
(),
"application"
:
GetErisMintVersion
()
.
GetVersionString
(),
"TMSP_code_type"
:
responseCheckTx
.
Code
,
"TMSP_code_type"
:
responseCheckTx
.
Code
,
})
.
Warn
(
"Unknown error returned from Tendermint CheckTx on BroadcastTxSync"
)
})
.
Warn
(
"Unknown error returned from Tendermint CheckTx on BroadcastTxSync"
)
return
resultBroadCastTx
,
fmt
.
Errorf
(
"Unknown error returned: "
+
responseCheckTx
.
Log
)
return
resultBroadCastTx
,
fmt
.
Errorf
(
"Unknown error returned: "
+
responseCheckTx
.
Log
)
...
...
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