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

BeefyClient Improvements #1165

Closed
wants to merge 4 commits into from
Closed

BeefyClient Improvements #1165

wants to merge 4 commits into from

Conversation

vgeddes
Copy link
Collaborator

@vgeddes vgeddes commented Mar 28, 2024

Adds two important & necessary improvements:

  1. The ability for a trusted operator to set an initial checkpoint after the contract has already been deployed. This is necessary so that we can parallelize the deployment of the bridge. We need to deploy the contracts next week, however BEEFY is only being activated on Polkadot at the end of April

  2. The submitInitial step emits a NewTicket(relayer, beefyBlockNumber) event after completing successfully. As discussed with W3F in yesterday's call, this allows relayers to know that there is an ongoing interactive submission, and that they should not waste gas trying to submit themselves.

Resolve: SNO-949

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.55%. Comparing base (cc6f123) to head (013f637).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1165      +/-   ##
==========================================
+ Coverage   77.83%   78.55%   +0.72%     
==========================================
  Files          14       14              
  Lines         415      429      +14     
  Branches       76       77       +1     
==========================================
+ Hits          323      337      +14     
  Misses         75       75              
  Partials       17       17              
Flag Coverage Δ
solidity 78.55% <100.00%> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -9,6 +9,7 @@ import {Uint16Array, createUint16Array} from "./utils/Uint16Array.sol";
import {Math} from "./utils/Math.sol";
import {MMRProof} from "./utils/MMRProof.sol";
import {ScaleCodec} from "./utils/ScaleCodec.sol";
import "forge-std/console.sol";
Copy link
Contributor

Choose a reason for hiding this comment

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

This import is probably not needed.

contracts/src/BeefyClient.sol Outdated Show resolved Hide resolved
contracts/src/BeefyClient.sol Outdated Show resolved Hide resolved
@@ -289,6 +302,8 @@ contract BeefyClient {
prevRandao: 0,
bitfieldHash: keccak256(abi.encodePacked(bitfield))
});

emit NewTicket(msg.sender, commitment.blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add the ticketId to NewTicket and NewMMRRoot events to be able to link them.

Comment on lines 469 to 472
/// @dev Renounce all administrative privileges
function renounce() external {
delete forceCheckpointOperator;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure fully understand why we provide an external renounce here.

I would assume in the interim period we just make BeefyClient inherited from
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol for access control and after production and stable for a while we remove the owner control with an upgrade.

@yrong
Copy link
Contributor

yrong commented Apr 3, 2024

Another concern is do we still wanna make BEEFY_CLIENT immutable?

@vgeddes
Copy link
Collaborator Author

vgeddes commented Apr 6, 2024

Another concern is do we still wanna make BEEFY_CLIENT immutable?

This is by design, the beefy client and agent executor are so critically important that they should only be changed via a contract upgrade of Gateway.sol. It also reduces gas costs when referencing those contracts.

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.

4 participants