forked from cosmos/ibc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
State and block execution (cosmos#58)
Resolves cosmos#65.
- Loading branch information
Showing
30 changed files
with
709 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package config | ||
|
||
// NodeConfig stores Optimint node configuration. | ||
type NodeConfig struct { | ||
P2P P2PConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package config | ||
|
||
const ( | ||
// DefaultListenAddress is a default listen address for P2P client. | ||
DefaultListenAddress = "/ip4/0.0.0.0/tcp/7676" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package abci | ||
|
||
import ( | ||
"time" | ||
|
||
tmproto "github.com/lazyledger/lazyledger-core/proto/tendermint/types" | ||
tmversion "github.com/lazyledger/lazyledger-core/proto/tendermint/version" | ||
|
||
"github.com/lazyledger/optimint/hash" | ||
"github.com/lazyledger/optimint/types" | ||
) | ||
|
||
// ToABCIHeader converts Optimint header to Header format defined in ABCI. | ||
func ToABCIHeader(header *types.Header) (tmproto.Header, error) { | ||
h, err := hash.Hash(header) | ||
if err != nil { | ||
return tmproto.Header{}, err | ||
} | ||
return tmproto.Header{ | ||
Version: tmversion.Consensus{ | ||
Block: uint64(header.Version.Block), | ||
App: uint64(header.Version.App), | ||
}, | ||
ChainID: "", // TODO(tzdybal) | ||
Height: int64(header.Height), | ||
Time: time.Unix(int64(header.Time), 0), | ||
LastBlockId: tmproto.BlockID{ | ||
Hash: h[:], | ||
PartSetHeader: tmproto.PartSetHeader{ | ||
Total: 0, | ||
Hash: nil, | ||
}, | ||
}, | ||
LastCommitHash: header.LastCommitHash[:], | ||
DataHash: header.DataHash[:], | ||
ValidatorsHash: nil, | ||
NextValidatorsHash: nil, | ||
ConsensusHash: header.ConsensusHash[:], | ||
AppHash: header.AppHash[:], | ||
LastResultsHash: header.LastResultsHash[:], | ||
EvidenceHash: nil, | ||
ProposerAddress: header.ProposerAddress, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,13 +40,13 @@ func TestTranslateAddresses(t *testing.T) { | |
"invalid listen address", | ||
config.NodeConfig{P2P: config.P2PConfig{ListenAddress: invalidCosmos}}, | ||
config.NodeConfig{}, | ||
ErrInvalidAddress.Error(), | ||
errInvalidAddress.Error(), | ||
}, | ||
{ | ||
"invalid seed address", | ||
config.NodeConfig{P2P: config.P2PConfig{Seeds: validCosmos + "," + invalidCosmos}}, | ||
config.NodeConfig{}, | ||
ErrInvalidAddress.Error(), | ||
errInvalidAddress.Error(), | ||
}, | ||
} | ||
|
||
|
@@ -79,9 +79,9 @@ func TestGetMultiaddr(t *testing.T) { | |
expected multiaddr.Multiaddr | ||
expectedErr string | ||
}{ | ||
{"empty", "", nil, ErrInvalidAddress.Error()}, | ||
{"empty", "", nil, errInvalidAddress.Error()}, | ||
{"no port", "127.0.0.1:", nil, "failed to parse multiaddr"}, | ||
{"ip only", "127.0.0.1", nil, ErrInvalidAddress.Error()}, | ||
{"ip only", "127.0.0.1", nil, errInvalidAddress.Error()}, | ||
{"with invalid id", "[email protected]:1234", nil, "failed to parse multiaddr"}, | ||
{"valid", "127.0.0.1:1234", valid, ""}, | ||
{"valid with id", "k2k4r8oqamigqdo6o7hsbfwd45y70oyynp98usk7zmyfrzpqxh1pohl7@127.0.0.1:1234", withID, ""}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.