diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cae87b2c..5a2eda03b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '^1.15.4' + go-version: "^1.15.4" - uses: actions/checkout@v2 - uses: technote-space/get-diff-action@v4 with: @@ -33,9 +33,6 @@ jobs: **/**.go go.mod go.sum - - name: Set GOBIN - run: | - echo "::add-path::$(go env GOPATH)/bin" - name: install run: make install install_abci if: "env.GIT_DIFF != ''" @@ -60,7 +57,7 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '^1.15.4' + go-version: "^1.15.4" - uses: actions/checkout@v2 - uses: technote-space/get-diff-action@v4 with: @@ -68,10 +65,7 @@ jobs: **/**.go go.mod go.sum - - name: Set GOBIN - run: | - echo "::add-path::$(go env GOPATH)/bin" - - uses: actions/cache@v2.1.2 + - uses: actions/cache@v2.1.3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -95,7 +89,7 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '^1.15.4' + go-version: "^1.15.4" - uses: actions/checkout@v2 - uses: technote-space/get-diff-action@v4 with: @@ -103,10 +97,7 @@ jobs: **/**.go go.mod go.sum - - name: Set GOBIN - run: | - echo "::add-path::$(go env GOPATH)/bin" - - uses: actions/cache@v2.1.2 + - uses: actions/cache@v2.1.3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -129,7 +120,7 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '^1.15.4' + go-version: "^1.15.4" - uses: actions/checkout@v2 - uses: technote-space/get-diff-action@v4 with: @@ -137,10 +128,7 @@ jobs: **/**.go go.mod go.sum - - name: Set GOBIN - run: | - echo "::add-path::$(go env GOPATH)/bin" - - uses: actions/cache@v2.1.2 + - uses: actions/cache@v2.1.3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index 8316e57e6..3fbf14558 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -46,6 +46,10 @@ type Manifest struct { // Nodes specifies the network nodes. At least one node must be given. Nodes map[string]*ManifestNode `toml:"node"` + + // KeyType sets the curve that will be used by validators. + // Options are ed25519 & secp256k1 + KeyType string `toml:"key_type"` } // ManifestNode represents a node in a testnet manifest. diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index d4f788dbc..90f2cff5e 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -14,6 +14,7 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + "github.com/tendermint/tendermint/crypto/secp256k1" rpchttp "github.com/tendermint/tendermint/rpc/client/http" mcs "github.com/tendermint/tendermint/test/maverick/consensus" ) @@ -57,6 +58,7 @@ type Testnet struct { Validators map[*Node]int64 ValidatorUpdates map[int64]map[*Node]int64 Nodes []*Node + KeyType string } // Node represents a Tendermint node in a testnet. @@ -468,15 +470,21 @@ func newKeyGenerator(seed int64) *keyGenerator { } } -func (g *keyGenerator) Generate() crypto.PrivKey { +func (g *keyGenerator) Generate(keyType string) crypto.PrivKey { seed := make([]byte, ed25519.SeedSize) _, err := io.ReadFull(g.random, seed) if err != nil { panic(err) // this shouldn't happen } - - return ed25519.GenPrivKeyFromSecret(seed) + switch keyType { + case "secp256k1": + return secp256k1.GenPrivKeySecp256k1(seed) + case "", "ed25519": + return ed25519.GenPrivKeyFromSecret(seed) + default: + panic("KeyType not supported") // should not make it this far + } } // portGenerator generates local Docker proxy ports for each node.