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

Execute payout transactions #127

Merged
merged 30 commits into from
Dec 4, 2020
Merged

Execute payout transactions #127

merged 30 commits into from
Dec 4, 2020

Conversation

MakMuftic
Copy link
Member

@MakMuftic MakMuftic commented Nov 13, 2020

Expand payout command so it executes all payout transactions

⚠️ This still works only if subkey is installed

PR Checklist

  • I have run linter localy
  • I have run unit and integration tests locally
  • Rebased to master branch / merged master
  • Updated CHANGELOG.md

Changes

  • Added function for executing payout transaction using github.com/centrifuge/go-substrate-rpc-client
  • Support manual and automatic (scheduled) payout
  • Display transactions statuses in a table-like fashion after execution is finished

Issues

Closes #107
Closes #121

TODO

I am working on our fork of github.com/centrifuge/go-substrate-rpc-client as I realized it is still less work to refactor this to use go port of subkey than to write everything from scratch.

Sorry, something went wrong.

Mak Muftic added 5 commits November 11, 2020 13:40

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@MakMuftic MakMuftic changed the title Mmuftic/execute transactions Execute payout transactions Nov 13, 2020
@MakMuftic
Copy link
Member Author

@mpetrun5 @mpetrunic I made PR on github.com/centrifuge/go-substrate-rpc-client to solve a problem that is breaking our CI build.

@mpetrunic
Copy link
Member

Can we have same changes in our fork so that we dont depend on upstream?

@mpetrunic
Copy link
Member

@MakMuftic Is this still draft?

Copy link
Member

@mpetrunic mpetrunic left a comment

Choose a reason for hiding this comment

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

We need better docs, add following to readme:

  • where to obtain test dots, to what address they need to be sent
  • how to trigger payment early payment
  • how to set periodic payments

What happens if node sent invalid address? Is fail tx reported with address, node and amount?

@MakMuftic MakMuftic requested a review from mpetrun5 December 1, 2020 08:01
Copy link
Member

@mpetrun5 mpetrun5 left a comment

Choose a reason for hiding this comment

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

Probably will be easier to test some stuff when refactored

internal/payout/transaction.go Outdated Show resolved Hide resolved
internal/payout/transaction.go Outdated Show resolved Hide resolved
internal/payout/transaction.go Outdated Show resolved Hide resolved
@mpetrunic
Copy link
Member

ready for review? @MakMuftic

@MakMuftic
Copy link
Member Author

ready for review? @MakMuftic

I think it is, additional testing is definitely going to be needed but I think we can merge this and resolve any additional problems in separate PRs.

@MakMuftic MakMuftic marked this pull request as ready for review December 3, 2020 15:08
cmd/start.go Outdated Show resolved Hide resolved
cmd/start.go Outdated Show resolved Hide resolved
internal/payout/txdetails.go Show resolved Hide resolved
internal/payout/txpayout.go Show resolved Hide resolved
Copy link
Member

@mpetrunic mpetrunic left a comment

Choose a reason for hiding this comment

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

When starting add log with some human readable date when next payout will be. If you have some regular checks whether payout should be maybe, you could add that log there as well. Critical log if for some reason payout wasn't made

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: Matija Petrunić <[email protected]>
@MakMuftic
Copy link
Member Author

When starting add log with some human readable date when next payout will be. If you have some regular checks whether payout should be maybe, you could add that log there as well. Critical log if for some reason payout wasn't made

I extended payout logs a bit. I like this idea of a regular log for when will the next payout be and I will add it when resolving #134 as this is tightly connected (I added a reminder for this in issue)

If the payout fails here is a snippet of what is being logged

transactionDetails, err := script.ExecutePayout(secret, reward, loadBalancerUrl)
if transactionDetails != nil {
	// display even if only part of transactions executed
	ui.DisplayTransactionsStatus(transactionDetails)
}
if err != nil {
	log.Errorf("Unable to execute payout, because of: %v", err)
	return
} else {
	log.Info("Payout execution finished")
}

I think this is enough information @mpetrunic ?, but what is a problem (edge case) that we are still not addressing is this one: What if something fails while the payout is being executed, then we could have a scenario where only a subset of payout transaction was executed. Just something to think about, we will not handle this in this PR.

@mpetrunic mpetrunic merged commit 7468381 into dev Dec 4, 2020
@mpetrunic mpetrunic deleted the mmuftic/execute-transactions branch December 4, 2020 14:46
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.

Improve output information on the executed payout transactions Implement payout script
3 participants