-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR #41: refactor testnet for better fit in CI
* wip * first pass go based test net * cleanup * accounts genesis * generating keys, accounts, and ethereum genesis * generating and signing gentx * go mod files * trying to bring up containers * bringing up containers * validators failing to connect * disable state sync * all validators up, miscommunicating * nodes signing, contracts deploying * orchestators failing on delegate keys * no need to give orchestrator consensus key * adding debuging rpc * delegate keys dump * failing keygen test * failing test for mnemonic mismatch * unused code * use fundraiser paths in key gen * happy path 2 * auto remove containers * cleanup * desperate attempt to keep containers clean * deterministic test * happy path passes * use go test for integration test * debug proto check breaking * build binary before test * check out put * short circuit on failed contract deploy * proto breaking debugging * fix integration test action * checkout project * maybe they intended to use an env * build test in step * cmd typo * attempting to read logs from tet runner * only pull stderr
- Loading branch information
Showing
25 changed files
with
3,518 additions
and
160 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"github.com/cosmos/cosmos-sdk/client/keys" | ||
"github.com/cosmos/cosmos-sdk/crypto/hd" | ||
"github.com/cosmos/cosmos-sdk/crypto/keyring" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tendermint/tendermint/libs/cli" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
type KeyOutput struct { | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
Address string `json:"address"` | ||
PubKey string `json:"pubkey"` | ||
} | ||
|
||
func TestKeyGen(t *testing.T) { | ||
mnemonic := "weasel lunch attack blossom tone drum unfair worry risk level negative height sight nation inside task oyster client shiver aware neck mansion gun dune" | ||
|
||
// generate key from binary | ||
keyCmd := keys.AddKeyCommand() | ||
keyCmd.Flags().String(cli.OutputFlag, "json", "output flag") | ||
keyCmd.SetArgs([]string{"--dry-run=true", "--output=json", "--recover=true", "orch"}) | ||
keyCmd.SetIn(strings.NewReader(mnemonic + "\n")) | ||
|
||
buf := bytes.NewBuffer(nil) | ||
keyCmd.SetOut(buf) | ||
keyCmd.SetErr(buf) | ||
|
||
err := Execute(keyCmd) | ||
require.NoError(t, err) | ||
|
||
var key KeyOutput | ||
output := buf.Bytes() | ||
t.Log("outputs: ", string(output)) | ||
err = json.Unmarshal(output, &key) | ||
require.NoError(t, err) | ||
|
||
// generate a memory key directly | ||
kb, err := keyring.New("testnet", keyring.BackendMemory, "", nil) | ||
if err != nil { | ||
return | ||
} | ||
|
||
keyringAlgos, _ := kb.SupportedAlgorithms() | ||
algo, err := keyring.NewSigningAlgoFromString(string(hd.Secp256k1Type), keyringAlgos) | ||
if err != nil { | ||
return | ||
} | ||
|
||
account, err := kb.NewAccount("", mnemonic, "", "m/44'/118'/0'/0/0", algo) | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, account.GetAddress().String(), key.Address) | ||
} |
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.