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

feat(contracts): implement OPSuccinctPermissionedFaultDisputeGame #370

Closed
wants to merge 3 commits into from

Conversation

fakedev9999
Copy link
Member

@fakedev9999 fakedev9999 commented Feb 5, 2025

The OPSuccinctPermissionedFaultDisputeGame is a specialized child contract of the OPSuccinctFaultDisputeGame that implements role-based access control to restrict who can participate in the game. This contract can serve as a fallback in cases where a permissionless system is undesirable or if the existing permissionless system encounters issues.

Overview

In a typical fault proof system, multiple entities may freely propose and challenge state roots in order to reach consensus. However, permissionless designs can introduce complexity and costs that some networks might prefer to avoid. By contrast, the OPSuccinctPermissionedFaultDisputeGame restricts participation via two new roles: a Proposer and a Challenger.

Each relevant interaction—including prove, challenge, resolve—is accessible only to addresses that have been granted one of these roles. Furthermore, the initialize() function is exclusively reserved for the Proposer.

In the event that you wish to switch back to a permissionless approach, the RESPECTED_GAME_TYPE parameter in the OptimismPortal can be changed to switch back.

Optimism's implementation

See PermissionedDisputeGame.sol

Copy link

github-actions bot commented Feb 5, 2025

Metric Value
Batch Start 23,462,730
Batch End 23,462,735
Witness Generation (seconds) 0
Execution Duration (seconds) 54
Total Instruction Count 2,513,717,967
Oracle Verify Cycles 384,152,718
Derivation Cycles 1,279,369,030
Block Execution Cycles 743,490,333
Blob Verification Cycles 179,282,718
Total SP1 Gas 0
Number of Blocks 5
Number of Transactions 54
Ethereum Gas Used 32,624,072
Cycles per Block 502,743,593
Cycles per Transaction 46,550,332
Transactions per Block 10
Gas Used per Block 6,524,814
Gas Used per Transaction 604,149
BN Pair Cycles 0
BN Add Cycles 0
BN Mul Cycles 0
KZG Eval Cycles 0
EC Recover Cycles 462,314
P256 Verify Cycles 0

Comment on lines +26 to +43
/// @notice An address that is allowed to challenge games.
address internal immutable CHALLENGER;
/// @notice An address that is allowed to propose games.
address internal immutable PROPOSER;

modifier onlyChallenger() {
if (msg.sender != CHALLENGER) {
revert BadAuth();
}
_;
}

modifier onlyProposer() {
if (msg.sender != PROPOSER) {
revert BadAuth();
}
_;
}
Copy link
Member

Choose a reason for hiding this comment

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

One concern I have with this design is that in most practical settings to reach Stage 1, you want to have multiple challengers and proposers.

Do you think it's better to have a pass-through contract where games can be created where this logic can be validated?

Or do you want to allow passing arrays for both of these arguments?

My worry with this design is that it's not easily extensible.

@fakedev9999
Copy link
Member Author

@ratankaliani made a very good point #370 (comment)

But in CWIA pattern, we can't have immutable args with types of array or mapping.
One alternative is to have a separate "Access Manager" contract and add another immutable arg ACCESS_MANAGER_ADDRESS to the constructor of the game contract and do the clone and initalize pattern.

However, it seems better to have an entrypoint contract that wraps over the Factory since:

  • it's easily extensible for permissioned games (we don't need to have a separate contract for permission control, but just an array or a mapping)
  • we can easily add the "Bank" contract feature at the same time without having a separate WETH kind of contract.

@fakedev9999 fakedev9999 closed this Feb 5, 2025
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