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

More events. Remove unnecessary bool return values #127

Merged
merged 2 commits into from
Dec 8, 2017
Merged

Conversation

yondonfu
Copy link
Member

@yondonfu yondonfu commented Dec 7, 2017

  • Added more events that I thought might be useful for a client interacting with the contracts
  • Removed unnecessary bool returns values for state mutating functions. Since our convention is to fail hard and fail early by reverting transactions upon any type of error, bool return values are never useful. There are some cases that a bool return value might be useful even if we're reverting, but I don't believe there are any cases of that in our code right now.
  • Removed the constructor and fallback function from LivepeerToken because they shouldn't be needed - no ETH can be sent to the contract if the fallback function is not payable and the fallback function is non-payable by default

Current list of events (excluding LivepeerVerifier and LivepeerToken):

ParameterUpdate
SetContract
SetController
TranscoderUpdate
TranscoderEvicted
TranscoderResigned
Bond
Unbond
Reward
NewRound
NewJob
NewClaim
Verify
DistributeFees
ReceivedVerification
NewInflation
SetCurrentRewardTokens

Let me know if there are any additional events in particular that anyone thinks might be particularly helpful. Maybe @jozanza has some thoughts relevant for the SDK?

Closes #31

@yondonfu yondonfu requested review from dob and ericxtang December 7, 2017 18:15
@dob
Copy link
Member

dob commented Dec 7, 2017

What about events for

  • WIthdrawing funds
  • Failing Verification
  • Slashing

Copy link
Member

@dob dob left a comment

Choose a reason for hiding this comment

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

Looking pretty good. Just a couple questions.

The current round was used pretty consistently throughout the events, but it seemed to be absent from the job/claim/verify loop events. Intentional? I don't have a strong opinion either way about whether it should be in every event...especially if it can be inferred from the block that the event was included in.

@@ -10,15 +10,15 @@ contract Migrations {
_;
}

function Migrations() {
function Migrations() public {
Copy link
Member

Choose a reason for hiding this comment

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

These methods that are marked public...they're public by default and we're just adding this to be explicit, right? Good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, the compiler also emits warnings if you don't add explicit visibility declarations - a non-functionality related todo is to do clean up any compiler warnings and make the CI fail if we have any warnings

@@ -282,7 +292,7 @@ contract BondingManager is ManagerProxyTarget, IBondingManager {
}
}

return true;
Bond(_to, msg.sender, currentRound);
Copy link
Member

Choose a reason for hiding this comment

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

Are we including currentRound in all the events for convenience and searchability on the frontend? Presumably the client would know which block or round it occured in based upon the event metadata itself, right...but this would just allow us to filter or easily view a timeline?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah good point - the current round can always be computed from the block number during which an event is received

@yondonfu
Copy link
Member Author

yondonfu commented Dec 8, 2017

Removed round values from events as they can always be recalculated using the block number associated with an event. Also added Withdraw, Deposit and verification events with more specific naming (PassedVerification and FailedVerification)

Copy link
Member

@dob dob left a comment

Choose a reason for hiding this comment

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

🚢

@yondonfu yondonfu merged commit a88c969 into master Dec 8, 2017
@yondonfu yondonfu deleted the yf/events branch December 8, 2017 16:10
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