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

App <-> bridge #98

Merged
merged 8 commits into from
Jul 24, 2023
Merged

App <-> bridge #98

merged 8 commits into from
Jul 24, 2023

Conversation

vzotova
Copy link
Member

@vzotova vzotova commented Jul 10, 2023

Unifies communication between app and bridge(s) through interface. App can work without bridge, with StakeInfo in the same network, with bridge. Besides it's possible to implement manager of bridges without changing app.

  • Renames app to TACoApplication + methods to call interface
  • Add ACL to PolygonRoot
  • One interface for all xchain communications (app<->bridge<->StakeInfo)

@vzotova vzotova self-assigned this Jul 10, 2023
@vzotova vzotova force-pushed the cbd-pre-app branch 2 times, most recently from 96d0926 to 335494d Compare July 10, 2023 21:17
@vzotova vzotova changed the base branch from development to threshold-app July 14, 2023 20:32
@vzotova vzotova marked this pull request as ready for review July 14, 2023 21:34
Copy link
Contributor

@theref theref left a comment

Choose a reason for hiding this comment

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

Looks Great!

/**
* @dev Checks caller is source of data
*/
modifier onlySource()
Copy link
Contributor

Choose a reason for hiding this comment

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

love this

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

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

🎸 Looks pretty great to me

assert len(events) == 1
event = events[0]
assert event["stakingProvider"] == staking_provider
assert event["fromAmount"] == value // 2
assert event["toAmount"] == value

# Increase again witjout syncing with StakeInfo
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Increase again witjout syncing with StakeInfo
# Increase again without syncing with StakeInfo

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️


def test_authorization_increase(accounts, threshold_staking, pre_application):

def test_authorization_increase(accounts, threshold_staking, pre_cbd_application, stake_info):
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to just call pre_cbd_application -> taco_application? This and other test files.

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️

@vzotova vzotova changed the title [WIP] App <-> bridge App <-> bridge Jul 17, 2023


contract PolygonRoot is FxBaseRootTunnel {
contract PolygonRoot is FxBaseRootTunnel, IUpdatableStakeInfo {
Copy link
Member

Choose a reason for hiding this comment

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

Great idea to implement IUpdatableStakeInfo

require(address(_updatableStakeInfo) != address(updatableStakeInfo), "New address must not be equal to the current one");
if (address(_updatableStakeInfo) != address(0)) {
// trying to call contract to be sure that is correct address
_updatableStakeInfo.updateOperator(address(0), address(0));
Copy link
Member

Choose a reason for hiding this comment

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

So this is to implicitly check the source in PolygonRoot, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

and to check that contract is correct one in general

* @notice Set contract for multi-chain interactions
*/
function setUpdatableStakeInfo(IUpdatableStakeInfo _updatableStakeInfo) external onlyOwner {
require(address(_updatableStakeInfo) != address(updatableStakeInfo), "New address must not be equal to the current one");
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this check? What's the worst can happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

considering that is method for DAO - I prefer to more checks than less in any case



/**
* @title Adjudicator
* @notice Supervises operators' behavior and punishes when something's wrong.
* @dev |v3.1.1|
*/
abstract contract Adjudicator {
contract Adjudicator {
Copy link
Member

Choose a reason for hiding this comment

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

It seems Adjudicator is not upgradeable anymore, right? In that case, the uint256[50] private reservedSlots; in L46 should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, Adjudicator needs reincarnation but I guess it's not time. So I'll remove those fields but ideally make it upgradeable

Copy link
Member

Choose a reason for hiding this comment

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

Since we have a setAdjudicator() method in the app, do we really need it to be upgradeable? We can just deploy a new version and set it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adjudicator has some state that ideally to preserve. For example, history to not slash twice for the same misbehavior. That's main reason to make it upreadable with the current design

Copy link
Member

Choose a reason for hiding this comment

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

Tracking issue here: #100

Copy link
Member

@arjunhassard arjunhassard left a comment

Choose a reason for hiding this comment

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

Really flexible approach! Makes L2 extensibility much less painful – we can respond to external demand without massive delays

@cygnusv cygnusv merged commit 374af2c into nucypher:threshold-app Jul 24, 2023
2 checks passed
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.

5 participants