mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-31 15:31:20 +00:00
Print a better copy/paste version of the deposit data (#1629)
This commit is contained in:
parent
650372915f
commit
c9bfa52119
@ -19,11 +19,8 @@ go_test(
|
||||
srcs = ["account_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//shared/keystore:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/ssz:go_default_library",
|
||||
"//shared/testutil:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -84,6 +84,12 @@ func NewValidatorAccount(directory string, password string) error {
|
||||
return fmt.Errorf("could not serialize deposit data: %v", err)
|
||||
}
|
||||
log.Info(`Account creation complete! Copy and paste the deposit data shown below when issuing a transaction into the ETH1.0 deposit contract to activate your validator client`)
|
||||
log.Infof("%#x", serializedData)
|
||||
fmt.Printf(`
|
||||
========================Deposit Data=======================
|
||||
|
||||
%#x
|
||||
|
||||
===========================================================
|
||||
`, serializedData)
|
||||
return nil
|
||||
}
|
||||
|
@ -1,19 +1,14 @@
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/keystore"
|
||||
"github.com/prysmaticlabs/prysm/shared/ssz"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
)
|
||||
|
||||
func TestNewValidatorAccount_AccountExists(t *testing.T) {
|
||||
@ -34,31 +29,3 @@ func TestNewValidatorAccount_AccountExists(t *testing.T) {
|
||||
t.Fatalf("Could not remove directory: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewValidatorAccount_PrintsDepositData(t *testing.T) {
|
||||
hook := logTest.NewGlobal()
|
||||
directory := testutil.TempDir() + "/testkeystore"
|
||||
defer os.RemoveAll(directory)
|
||||
if err := NewValidatorAccount(directory, "1234"); err != nil {
|
||||
t.Errorf("Expected new account to be created: %v", err)
|
||||
}
|
||||
ks := keystore.NewKeystore(directory)
|
||||
valKey, err := ks.GetKey(directory+params.BeaconConfig().ValidatorPrivkeyFileName, "1234")
|
||||
if err != nil {
|
||||
t.Fatalf("Could not retrieve key: %v", err)
|
||||
}
|
||||
data := &pb.DepositInput{
|
||||
Pubkey: valKey.SecretKey.K.Bytes(), // TODO(#1367): Use real BLS public key here.
|
||||
ProofOfPossession: []byte("pop"),
|
||||
WithdrawalCredentialsHash32: []byte("withdraw"),
|
||||
}
|
||||
|
||||
serializedData := new(bytes.Buffer)
|
||||
if err := ssz.Encode(serializedData, data); err != nil {
|
||||
t.Fatalf("Could not serialize deposit data: %v", err)
|
||||
}
|
||||
testutil.AssertLogsContain(t, hook, fmt.Sprintf("%#x", serializedData))
|
||||
if err := os.RemoveAll(directory); err != nil {
|
||||
t.Fatalf("Could not remove directory: %v", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user