Skip to content

cmd, eth, server, pm: Streamflow client compatibility#1114

Merged
kyriediculous merged 8 commits intomasterfrom
nv/remove-frozen-reserve
Oct 22, 2019
Merged

cmd, eth, server, pm: Streamflow client compatibility#1114
kyriediculous merged 8 commits intomasterfrom
nv/remove-frozen-reserve

Conversation

@kyriediculous
Copy link
Copy Markdown
Contributor

@kyriediculous kyriediculous commented Oct 4, 2019

What does this pull request do? Explain your changes. (required)
This PR addresses some of the compatibility issues the current go-livepeer client has with the new. protocol/streamflow branch after regenerating the contract bindings.

For a detailed list of the updates see specific upgrades

Specific updates (required)

  • e397e0c: Regenerate the contract bindings using abigen. Created a wrapper arround the TicketBroker session because abigen does not generate client side structs for all contract types. abigen: Does not include all structs in binding ethereum/go-ethereum#20148

  • 3184658: Removes any reference to/usage of pricePerSegment, pendingRewardCut and pendingFeeShare and update the CLI implementation and user facing language.

  • 63fab12: Removes the usage of NumActiveTranscoders as the generated function from the public variable numActiveTranscoders on the contracts is now deprecated. Instead we'll use GetTranscoderPoolMaxSize.

  • 7174eb1: update isActiveTranscoder usage to reflect its implementation on the protocol/streamflow branch, meaning it doesn't take a second round argument anymore. Instead IsActiveTranscoder will return the active status for a transcoder for the current round

  • 34d7c28: Change the definition of pm.SenderInfo to remove ReserveState and ThawRound references

  • 34d7c28: Change the definition of pm.SenderInfo to use WithdrawRound instead of WithdrawBlock

  • 34d7c28: Change the definition of pm.SenderInfo to use a new pm.ReserveInfo type instead of a SenderInfo.Reserve *big.Int type. pm.ReserveInfo holds ReserveInfo.FundsRemaining and ReserveInfo.ClaimedInCurrentRound from which a sender's total available reserve for a round is calculated by adding these two values.

  • 2c9e40f: Adds a dependency to the RoundsWatcher to SenderWatcher through an EventWatcher interface which exposes a single Subscribe method. This allows the SenderWatcher to describe to NewRound events. This is needed because since removing ReserveState , amounts claimed from a reserve are reset on a per-round basis rather than when the reserveNonce increases due to funding a thawed reserve.

  • c82f82d Removes LivepeerVerifier references in the eth package since Streamflow will not contain on-chain verification components in it's initial release. The contract itself has also been deleted in the Streamflow branch for the protocol repo.

TODO: Look into the subscription mechanism used for the blockwatch package.

How did you test each of these updates (required)
Adjusted & ran unit tests

Does this pull request close any open issues?
Fixes #1089
Fixes #1090

Checklist:

  • README and other documentation updated
  • Node runs in OSX and devenv
  • All tests in ./test.sh pass

@kyriediculous kyriediculous requested a review from yondonfu October 4, 2019 15:00
@kyriediculous
Copy link
Copy Markdown
Contributor Author

kyriediculous commented Oct 5, 2019

4f0febe refactors the subscription mechanism for RoundsWatcher to use the go-ethereum event package

This adds two fields to the RoundsWatcher struct

  • subScope

SubscriptionScope provides a facility to unsubscribe multiple subscriptions at once.

Subscriptions created and tracked through subScope are tied to the lifetime of RoundsWatcher (see c6b4218)

  • subFeed

Feed implements one-to-many subscriptions where the carrier of events is a channel. Values sent to a Feed are delivered to all subscribed channels simultaneously.
Feeds can only be used with a single type. The type is determined by the first Send or Subscribe operation. Subsequent calls to these methods panic if the type does not match.
The zero value is ready to use.

The sink channel is of type event.Log rather than a slice of blockwatch.Event because we only care about the NewRound logs emitted by the RoundsWatcher, thus the feed can only be used with type event.Log for all subscriptions.

Comment thread cmd/livepeer_cli/wizard_ticketbroker.go Outdated
Comment thread cmd/livepeer_cli/wizard_ticketbroker.go Outdated
Comment thread cmd/livepeer_cli/wizard_ticketbroker.go Outdated
Comment thread cmd/livepeer_cli/wizard_ticketbroker.go Outdated
Comment thread cmd/livepeer_cli/wizard_ticketbroker.go Outdated
Comment thread eth/watchers/roundswatcher.go Outdated
Comment thread eth/watchers/roundswatcher.go Outdated
Comment thread eth/watchers/roundswatcher.go
Comment thread eth/watchers/senderwatcher_test.go Outdated
Comment thread eth/watchers/senderwatcher_test.go Outdated
@kyriediculous
Copy link
Copy Markdown
Contributor Author

removed ticketBrokerWrapper in 1cf132e and use a lower level implementation of contract calls in client_ticketBroker.GetSenderInfo

Changed RoundsWatcher for a stubRoundsWatcher in the SenderWatcher tests in 91ea296

CLI wizard & other small fixups in 0f33adc

@kyriediculous
Copy link
Copy Markdown
Contributor Author

Fixed a small issue whereby the test harness would panic when calling GetSenderInfo since the context used in client_ticketBroker.GetSenderInfo was nil because we use it from TicketBrokerSession.CallOpts.

If TicketBrokerSession.CallOpts.Context is nil we will use a new Context.Background() instead.

Comment thread cmd/livepeer_cli/wizard_stats.go Outdated
Comment thread cmd/livepeer_cli/wizard_rounds.go
Comment thread eth/client_ticketbroker.go
Comment thread eth/client_ticketbroker.go
Copy link
Copy Markdown
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

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

Changes look good. Let's rebase!

@kyriediculous kyriediculous force-pushed the nv/remove-frozen-reserve branch from 583a3b5 to ebdaed8 Compare October 21, 2019 21:53
@kyriediculous
Copy link
Copy Markdown
Contributor Author

rebase done !

Copy link
Copy Markdown
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@kyriediculous kyriediculous merged commit 2675094 into master Oct 22, 2019
@wohlner
Copy link
Copy Markdown

wohlner commented Dec 16, 2019

Can you please delete this closed branch?

@kyriediculous kyriediculous deleted the nv/remove-frozen-reserve branch December 16, 2019 17:51
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.

Update TicketBroker unlocking code to use rounds Remove frozen reserve handling and recalculate reserve alloc at start of round

3 participants