Skip to content

governance v1#47

Open
sumoshi21 wants to merge 1 commit into
zenon-network:masterfrom
HyperCore-Team:master
Open

governance v1#47
sumoshi21 wants to merge 1 commit into
zenon-network:masterfrom
HyperCore-Team:master

Conversation

@sumoshi21

Copy link
Copy Markdown
Contributor

Implement the governance logic that is able to create and activate sporks and call administrative methods of other embedded contract.

@georgezgeorgez

Copy link
Copy Markdown
Collaborator

Hi,
I've created a set of maintainer criteria for myself to follow.
https://zenon.wiki/index.php/User:George

If you are looking for my approval on this PR, please answer the questions relevant to protocol changes.

@0x3639 0x3639 requested a review from Copilot May 25, 2026 21:57
@0x3639

0x3639 commented May 25, 2026

Copy link
Copy Markdown
Collaborator

@sumoshi21 do you want to fix the merge conflicts?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Implements a new embedded governance contract (behind a new governance spork) that allows proposing actions, pillar voting, and executing approved actions to call administrative methods on other embedded contracts.

Changes:

  • Added a new Governance embedded contract with ProposeAction / ExecuteAction logic and corresponding RPC API (embedded.governance).
  • Introduced a new governance spork enforcement gate and extended permission checks so the governance contract can call spork/bridge/liquidity administrative methods.
  • Added an end-to-end governance test that creates and activates a spork through the governance workflow.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
vm/vm_context/spork.go Adds governance spork enforcement check to VM context.
vm/vm_context/interfaces.go Extends AccountVmContext interface with governance spork enforcement method.
vm/embedded/tests/governance_test.go Adds end-to-end governance proposal/vote/execute test coverage.
vm/embedded/implementation/governance.go New embedded governance contract implementation (propose/execute + vote threshold logic).
vm/embedded/definition/governance.go Governance ABI + storage definition for actions.
vm/embedded/embedded.go Registers governance embedded contract and routes embedded method lookup based on governance spork.
rpc/apis.go Exposes embedded.governance RPC namespace.
rpc/api/embedded/governance.go Adds governance RPC API for listing/fetching actions + vote breakdown/expiry.
vm/embedded/implementation/spork.go Permits governance contract to create/activate sporks.
vm/embedded/implementation/liquidity.go Permits governance contract to call admin methods and spork-only methods.
vm/embedded/implementation/bridge.go Permits governance contract to call admin methods.
vm/constants/embedded.go Adds governance voting period/threshold constants.
vm/constants/errors.go Adds governance-specific error for unknown action type.
common/types/spork.go Introduces GovernanceSpork as an implemented spork (currently with a TODO placeholder id).
common/types/address.go Adds Governance contract address to embedded contract registry.
go.mod / go.sum Dependency tidying around protobuf modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread common/types/spork.go
Comment on lines 6 to 9
BridgeAndLiquiditySpork = NewImplementedSpork("ddd43466769461c5b5d109c639da0f50a7eeb96ad6e7274b1928a35c431d7b1b")
// todo change it
GovernanceSpork = NewImplementedSpork("ddd43466769461c5b5d109c639da0f50a7eeb96ad6e7274b1928a35c431d7b1c")

Comment thread vm/constants/errors.go
Comment on lines +105 to +107
// Governance

ErrUnkownActionType = errors.New("unknown action type")
Comment on lines +156 to +158
} else {
return nil, constants.ErrUnkownActionType
}
Comment on lines +49 to +52
} else {
// todo just return the action?
return nil, constants.ErrUnkownActionType
}
Comment on lines +74 to +78
func (a *GovernanceApi) GetAllActions(pageIndex, pageSize uint32) (*ActionList, error) {
_, context, err := api.GetFrontierContext(a.chain, types.GovernanceContract)
if err != nil {
return nil, err
}
Comment on lines +537 to 539
if sendBlock.Address.String() != bridgeInfo.Administrator.String() && sendBlock.Address.String() != types.GovernanceContract.String() {
return nil, constants.ErrPermissionDenied
}
Comment on lines +102 to +105
} else {
// todo just return the action?
return nil, constants.ErrUnkownActionType
}
Comment on lines +97 to 99
if block.Address != *types.SporkAddress && block.Address.String() != types.GovernanceContract.String() {
return constants.ErrPermissionDenied
}
Comment on lines +122 to 124
if block.Address != *types.SporkAddress && block.Address.String() != types.GovernanceContract.String() {
return constants.ErrPermissionDenied
}
Comment on lines +193 to 195
if block.Address != *types.SporkAddress && block.Address.String() != types.GovernanceContract.String() {
return constants.ErrPermissionDenied
}
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