Skip to content

Commit

Permalink
Revert some messaging changes just to get tests rolling
Browse files Browse the repository at this point in the history
  • Loading branch information
elffjs committed Jan 19, 2024
1 parent 8f8b0e5 commit 7b3c379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions connector/web3/web3.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package web3

import (
"errors"
"fmt"

"github.com/dexidp/dex/connector"
Expand Down Expand Up @@ -103,9 +104,9 @@ func (c *web3Connector) VerifyERC1271Signature(contractAddress common.Address, h
}

if c.ethClient == nil {
c.logger.Errorf("Eth client was not initialized successfully %v", err)
return identity, fmt.Errorf("error occurred completing authentication, please try again %w", err)
return identity, errors.New("can't attempt to validate signature, no Ethereum client available")
}

var msgHash [32]byte
copy(msgHash[:], hash)

Expand All @@ -120,7 +121,7 @@ func (c *web3Connector) VerifyERC1271Signature(contractAddress common.Address, h

result, err := ct.IsValidSignature(nil, msgHash, signature)
if err != nil {
return identity, fmt.Errorf("error calling isValidSignature on contract: %w", err)
return identity, fmt.Errorf("error occurred completing login %w", err)
}

if result != erc1271magicValue {
Expand Down
7 changes: 4 additions & 3 deletions connector/web3/web3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"crypto/ecdsa"
"errors"
"fmt"
"math/big"
"testing"

"github.com/dexidp/dex/connector"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand All @@ -14,8 +17,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"math/big"
"testing"
)

type BkTest struct {
Expand Down Expand Up @@ -260,7 +261,7 @@ func TestBlockchainBackend(t *testing.T) {
msgHash: emptyByte,
signedMessage: hexutil.Encode(emptyByte),
shouldErr: true,
err: errors.New("error occurred completing authentication, please try again"),
err: errors.New("no Ethereum client available"),
}
},
}
Expand Down

0 comments on commit 7b3c379

Please sign in to comment.