You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. package eth
  2. import (
  3. "io/ioutil"
  4. "testing"
  5. "github.com/ethereum/go-ethereum/accounts/keystore"
  6. "github.com/ethereum/go-ethereum/crypto"
  7. "github.com/ethereum/go-ethereum/ethclient"
  8. "github.com/stretchr/testify/require"
  9. )
  10. var rollupClient *RollupClient
  11. func TestNewRollupClient(t *testing.T) {
  12. key, err := crypto.HexToECDSA(governancePrivateKey)
  13. require.Nil(t, err)
  14. dir, err := ioutil.TempDir("", "tmpks")
  15. require.Nil(t, err)
  16. ks := keystore.NewKeyStore(dir, keystore.StandardScryptN, keystore.StandardScryptP)
  17. account, err := ks.ImportECDSA(key, password)
  18. require.Nil(t, err)
  19. err = ks.Unlock(account, password)
  20. require.Nil(t, err)
  21. // Init eth client
  22. ethClient, err := ethclient.Dial(ehtClientDialURL)
  23. require.Nil(t, err)
  24. ethereumClient := NewEthereumClient(ethClient, &account, ks, nil)
  25. if integration != "" {
  26. rollupClient = NewRollupClient(ethereumClient, HERMEZROLLUP)
  27. }
  28. }
  29. func TestRollupConstants(t *testing.T) {
  30. if rollupClient != nil {
  31. _, err := rollupClient.RollupConstants()
  32. require.Nil(t, err)
  33. }
  34. }