validator-gauges-manager-ts-sdk
v0.0.3
Published
Marinade Validator Gauges Manager SDK for Typescript
Downloads
6
Maintainers
Readme
= Validator Gauges Manager
Contract to serve as a intermediary on creation proposals for SPL Gov realms. The SPL governance contract is at: https://github.com/solana-labs/solana-program-library/tree/master/governance Marinade fork of the SPL GOV contract is at: https://github.com/marinade-finance/solana-program-library
The main reason for creation of this contract is to have an option to renew the proposal voting of validator gauges, i.e., to create the reocurance voting. The reason is the SPL GOV limitation that the votins is some end time and there is not possible to reopen same voting automatically in current version (v3.1).
== Design
The base flow consists of:
. creating a proposal template (init) . allocate more space for Solana account to be possible to fill in records of template data . adding template data records (permissionless, those are records consisting PublicKey that's used as SPL-GOV option description for a proposal) . create a proposal (the Validator Gauges Manager PDA can be named as authority of governance) . insert proposal options from template data to SPL-GOV proposal (in chunks; because of CU and memory limitations) . signing-off the proposal
Additional flow:
- [permissionless] template data records (option template) may be added (when not in state of inserting proposal options)
- template data records may be removed from the contract
- when stuck in constraint of creation admin may erase constraint checks for proposal creation
- admin account that is the only permitted to do authorized operations can be changed
== Program data structure
Accounts definition is at:./programs/validator-gauges-manager/src/state/proposal_template.rs[accounts]. Two account types are created for proposal creation:
- account with metadata for template
- account with template data (options used as a template) consisting of proposal option description used for SPL-GOV proposal
image::./res/validator-gauges-manager-accounts.png[]
== Constraints
- creation of proposal template (main PDA account of Validator Gauges Manager contract) is limited one per state of Marinade liquid-staking-program
- creation of proposal template is bound to a Realm; only Realm authority may create the proposal template account (PDA)
- the most of the operations are permitted only for admin with exceptions of adding/removing template data records (consisting the validtor PublicKey for gauges voting), those are permissionless but it's required the validator account is part of the linked Marinade state
- a new proposal can be created only once per epoch (within the epoch)
== Testing
The Anchor tests do not contain the Marinade liquidity-state-program
and it's needed to be run without that feature.
[source,sh]
anchor test -- --no-default-features
=== Testing and typescript
At the development phase the tests uses the https://github.com/solana-labs/oyster[Oyster SDK] of governance that's forked to Marinade repository at https://github.com/marinade-finance/oyster/tree/governance-multichoice/packages/governance-sdk
The Marinade forked Oyster repo contains changes that are needed to work with the
https://github.com/marinade-finance/solana-program-library[Marinade SPL GOV] contract.
The package.json
links the github repository and it contains Typescript.
For the node_modules
dependency to work it's needed to build the JS
first.
There is used the gitpkg.now.sh
that takes repository in particular branch,
it switches to a directory and creates .tgz
package.
Then there could be placed a postinstall script that do some building
(the site places package.json
scripts
stuff as added in URL argument).
NOTE: yarn
postinstall
somehow does not work, npm
is used intentionally
see something at https://github.com/yarnpkg/yarn/issues/5476
To get upgraded source code from github currently I have no other idea than