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

feat: any.sender #584

Closed
wants to merge 3 commits into from
Closed

feat: any.sender #584

wants to merge 3 commits into from

Conversation

robdefeo
Copy link
Member

@robdefeo robdefeo commented Mar 7, 2020

ref #580

hash := sha256.Sum256(message)
return ethcrypto.Sign(hash[:], &pk.ecdsa)
func (pk PrivateKey) Sign(hash []byte) (signature []byte, err error) {
// hash := sha256.Sum256(message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commentedOutCode: may want to remove commented-out code (from gocritic)

"relayContractAddress": encoding.EncodeHexZeroX(relayContractAddress),
"signature": encoding.EncodeHexZeroX(signature),
}).
// SetBody(sendReq{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commentedOutCode: may want to remove commented-out code (from gocritic)

}
if response.StatusCode() != 200 {
return errors.Errorf("request: %+v\nresponse: %+v\n", req.Body, response.String())
// return errors.New(response.String())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commentedOutCode: may want to remove commented-out code (from gocritic)

)

// NewSender create new API client
func NewSender(address string, relayContractAddress, rpcURL string) (*Sender, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paramTypeCombine: func(address string, relayContractAddress, rpcURL string) (*Sender, error) could be replaced with func(address, relayContractAddress, rpcURL string) (*Sender, error) (from gocritic)

return nil
}

func (e Sender) encode(to []byte, from []byte, data []byte, deadline int64, refund int64, gas int64, relayContract []byte) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paramTypeCombine: func(to []byte, from []byte, data []byte, deadline int64, refund int64, gas int64, relayContract []byte) ([]byte, error) could be replaced with func(to, from, data []byte, deadline, refund, gas int64, relayContract []byte) ([]byte, error) (from gocritic)

return err
}
currentBlock, err := ethClient.BlockByNumber(ctx, nil)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one cuddle assignment allowed before if statement (from wsl)

if err != nil {
return err
}
toAddress := common.BytesToAddress(to)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignments should only be cuddled with other assignments (from wsl)

if err != nil {
return err
}
deadline := currentBlock.Number().Int64() + 500 // this is an arbitrary number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignments should only be cuddled with other assignments (from wsl)

if response.StatusCode() != 200 {
return errors.Errorf("request: %+v\nresponse: %+v\n", req.Body, response.String())
// return errors.New(response.String())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block should not end with a whitespace (or comment) (from wsl)

println(fmt.Sprintf("%+v", req.Body))
return errors.WithStack(err)
}
if response.StatusCode() != 200 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if statements should only be cuddled with assignments (from wsl)

@stale
Copy link

stale bot commented Jul 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Mailchain team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please reply in order to keep the issue open. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jul 5, 2020
@robdefeo robdefeo removed the Stale label Feb 7, 2021
@robdefeo robdefeo closed this Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants