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

[Proposed] ACP-99: Implement using composition v2 - SecurityModule as entry point #674

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cam-schultz
Copy link
Contributor

@cam-schultz cam-schultz commented Dec 6, 2024

Why this should be merged

This should not necessarily be merged. It is intended to demonstrate a composition-based architecture that aligns with the proposed ACP-99 spec.

How this works

classDiagram

class IACP99ValidatorManager {
    initializeValidatorSet()
    initializeValidatorRegistration()
    completeValidatorRegistration()
    initializeEndValidation()
    completeEndValidation()
    initializeValidatorWeightChange()
    completeValidatorWeightChange()
}
<<interface>> IACP99ValidatorManager

class PoSSecurityModule
<<abstract>> PoSSecurityModule

class ERC20SecurityModule
class NativeTokenSecurityModule
class PoASecurityModule
class ValidatorManager

PoSSecurityModule *-- IACP99ValidatorManager
PoASecurityModule *-- IACP99ValidatorManager
IACP99ValidatorManager <|-- ValidatorManager

PoSSecurityModule <|-- ERC20SecurityModule
PoSSecurityModule <|-- NativeTokenSecurityModule
Loading

In this implementation, the SecurityModule is the contract that the end user interacts with to manage the validator set. The SecurityModule performs two functions:

  1. It validates actions taken on the validator set according to the staking model (PoS, PoA, etc), and
  2. it performs any side effects that the staking model requires (e.g. locking stake in the contract for PoS)

All actions are routed through the SecurityModule to the ValidatorManager. The ValidatorManager is responsible for keeping the validator set up-to-date and attesting to it via ICM messages that are delivered to the P-Chain.

Comparison with the proposed ACP-99 spec

Compared to the proposed ACP-99 spec as written, this implementation removes IACP99SecurityModule altogether, as the exact function signatures depend on the implementation. For example, PoA SecurityModules don't need to lock assets, worry about delegation fees, or staking duration enforcement. The ACP-99 spec does account for this, but at the cost of requiring the user to interact with both the SecurityModule and the ValidatorManager.

How this was tested

ERC20 e2e test case with validator registration and removal passing.

How is this documented

@cam-schultz cam-schultz changed the title Acp 99 exp composition v2 ACP-99: Implement using composition v2 - single entry point Dec 6, 2024
@cam-schultz cam-schultz changed the title ACP-99: Implement using composition v2 - single entry point ACP-99: Implement using composition v2 - SecurityModule as entry point Dec 6, 2024
@cam-schultz cam-schultz changed the title ACP-99: Implement using composition v2 - SecurityModule as entry point [Proposed] ACP-99: Implement using composition v2 - SecurityModule as entry point Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog 🗄️
Development

Successfully merging this pull request may close these issues.

1 participant