Skip to content
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.

Add support for validator linked roles #81

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ryanchern
Copy link

@ryanchern ryanchern commented Aug 6, 2023

Adds support for the validator Discord linked role-related controller and endpoints:

  • Adds a /verify-gossip-keypair/:publicKey/:discordAuthorizationCode endpoint for handling new requests to be verified for the linked roles
  • Adds real-time Solana validator-related metadata

The following roles are available:

  • is_testnet_validator -- true if the validator is currently a validator on testnet
  • is_active_testnet_validator -- true if the validator has voted within the last epoch (with respect to slot number differentials, not discrete epochs) on testnet
  • is_mainnet_validator -- true if the validator is currently a validator on testnet
  • is_active_mainnet_validator -- true if the validator has voted within the last epoch (with respect to slot number differentials, not discrete epochs) on mainnet
  • mainnet_activated_stake_threshold -- true if the stake weight associated with this account on mainnet is greater than or equal to a given threshold, currently 5,000 SOL

Example Discord user role:

Screenshot 2023-08-03 at 9 10 28 PM

Metadata information is refreshed once every 2 days, approximately the duration of each Solana epoch.

Requires 4 new environment variables:

  • DISCORD_VALIDATOR_CONNECTION_CLIENT_ID
  • DISCORD_VALIDATOR_CONNECTION_CLIENT_SECRET
  • DISCORD_VALIDATOR_APPLICATION_PUBLIC_KEY
  • DISCORD_VALIDATOR_OAUTH_REDIRECT_URI

@ryanchern ryanchern marked this pull request as ready for review August 6, 2023 05:30
@ryanchern ryanchern closed this Aug 6, 2023
@ryanchern ryanchern reopened this Aug 6, 2023
@ryanchern ryanchern marked this pull request as draft August 14, 2023 20:28
@ryanchern ryanchern marked this pull request as ready for review August 14, 2023 20:28
@@ -30,7 +30,7 @@ export class MatchdayDiscordUserController {
constructor(
private readonly matchdayDiscordUserService: MatchdayDiscordUserService,
private readonly configService: ConfigService,
) {}
) {}

Choose a reason for hiding this comment

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

if this wasn't an intended change I'd revert.

validatorDiscordUsers.forEach(async (user) => {
const publicKey = user.publicKeyStr;
try {
await axios.post(`http://localhost:3001/verify-gossip-keypair/${publicKey}/identitykeyplacerholder/discordauthplaceholder`);

Choose a reason for hiding this comment

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

Can you use relative paths here? Local host won't work in production.

Copy link

@Benhawkins18 Benhawkins18 Aug 22, 2023

Choose a reason for hiding this comment

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

Are there any ENV variables you could use to populate this if a relative link won't work?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants