Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personal ECRecover validates sig as address #2377

Closed
LayneHaber opened this issue Feb 14, 2019 · 1 comment · Fixed by #2388
Closed

Personal ECRecover validates sig as address #2377

LayneHaber opened this issue Feb 14, 2019 · 1 comment · Fixed by #2388
Labels
Bug Addressing a bug

Comments

@LayneHaber
Copy link

LayneHaber commented Feb 14, 2019

Expected behavior

Using eth.personal.ecRecover, it should return an address when provided with signed data. noticed it was checking the signed data as an input address.

Actual behavior

The function seems to be verifying the signed data as an address

function EcRecoverMethod(utils, formatters) {
      _classCallCheck(this, EcRecoverMethod);

      return _possibleConstructorReturn(this, _getPrototypeOf(EcRecoverMethod).call(this, 'personal_ecRecover', 3, utils, formatters));
    }

    _createClass(EcRecoverMethod, [{
      key: "beforeExecution",
      value: function beforeExecution(moduleInstance) {
        this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]);
        this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]);
      }
    }]);

Steps to reproduce the behavior

  1. Sign some data const sig = await web3.eth.personal.sign(data)
  2. Try to recover your address const addr = await web3.eth.personal.ecRecover(data, sig)

Error Logs

function EcRecoverMethod(utils, formatters) {
      _classCallCheck(this, EcRecoverMethod);

      return _possibleConstructorReturn(this, _getPrototypeOf(EcRecoverMethod).call(this, 'personal_ecRecover', 3, utils, formatters));
    }

    _createClass(EcRecoverMethod, [{
      key: "beforeExecution",
      value: function beforeExecution(moduleInstance) {
        this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]);
        this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]);
      }
    }]);

Versions

Mac OS, Node 11.3, web3 version beta-46

@nivida nivida added the Bug Addressing a bug label Feb 18, 2019
@nivida
Copy link
Contributor

nivida commented Feb 18, 2019

Thanks for submitting this issue! I will fix and release it asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants