Skip to content

Conversation

@GuidoDipietro
Copy link
Member

@GuidoDipietro GuidoDipietro commented Dec 17, 2025

Adds Whitelist program, analogous to the Controller.sol.
Naming could change to align with EVM contracts.

Rust program and Typescript SDK were added, along with Typescript tests.


Instructions

This program manages entity permission, being able to whitelist and blacklist Validators, Solvers, and Axia addresses.
It is governed by an admin that can be changed with a cooldown period.

initialize

Initializes program global state, configuring the admin and cooldown period.

propose_admin

Proposes a new admin.

set_proposed_admin

Proposed admin can become admin, if cooldown period has elapsed.

set_entity_whitelist_status

Admin whitelists or blacklists an entity.

State

GlobalSettings

Holds global state of the program.

EntityRegistry

Serves as on-chain proof that a given address is whitelisted or blacklisted as a given entity type.
This proof is used on the Settler program (or any other program) to model permissions.


NOTE: Some files might have content from future PRs given this series of PRs come from a larger PR that was split (#41). I have tried to keep this to a minimum but bear this in mind.

@GuidoDipietro GuidoDipietro changed the base branch from main to solana/settler December 17, 2025 16:01
@GuidoDipietro GuidoDipietro self-assigned this Dec 17, 2025
@GuidoDipietro GuidoDipietro marked this pull request as ready for review December 18, 2025 15:49
@GuidoDipietro GuidoDipietro changed the title Add Whitelist program (1) Add Whitelist program Dec 18, 2025
Copy link
Member

@PedroAraoz PedroAraoz left a comment

Choose a reason for hiding this comment

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

The program should be renamed to match it's EVM counterpart

[package]
name = "whitelist"
version = "0.1.0"
description = "Created with Anchor"
Copy link
Member

Choose a reason for hiding this comment

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

I would update the description and also add the missing license

Copy link
Member Author

Choose a reason for hiding this comment

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

Please let me know which license we should use here.

Copy link
Member Author

@GuidoDipietro GuidoDipietro Dec 30, 2025

Choose a reason for hiding this comment

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

I added license = GPL-3.0-only as GPL-3.0 is not present as an identifier in this list. Let me know if that is fine.

Comment on lines +8 to +9
pub entity_type: EntityType,
pub entity_pubkey: Pubkey,
Copy link
Member

Choose a reason for hiding this comment

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

NIT:

Suggested change
pub entity_type: EntityType,
pub entity_pubkey: Pubkey,
pub type: EntityType,
pub pubkey: Pubkey,

Copy link
Member

Choose a reason for hiding this comment

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

rename to helpers.ts

Copy link
Member

Choose a reason for hiding this comment

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

is this file used in future PRs?

otherAdminSdk = new ControllerSDK(otherAdminProvider)
maliciousSdk = new ControllerSDK(maliciousProvider)

deployerProvider.client.airdrop(deployer.publicKey, BigInt(100_000_000_000))
Copy link
Member

Choose a reason for hiding this comment

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

NIT:
add Sol to Lamports helper function?
toLamports(10)

})
})

describe('set_admin', () => {
Copy link
Member

Choose a reason for hiding this comment

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

NIT

Suggested change
describe('set_admin', () => {
describe('set admin', () => {

Comment on lines +117 to +119
// Reset admin to original for subsequent tests
const resetIx = await otherAdminSdk.setAdmin(admin.publicKey)
await makeTxSignAndSend(otherAdminProvider, resetIx)
Copy link
Member

Choose a reason for hiding this comment

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

I would move this to an after()

let solver2: web3.PublicKey

before(() => {
validator = web3.Keypair.generate().publicKey
Copy link
Member

Choose a reason for hiding this comment

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

web3.Keypair.generate().publicKey I would create a helper function for this

instructions::set_admin(ctx, new_admin)
}

pub fn create_entity_registry(
Copy link
Member

Choose a reason for hiding this comment

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

rename to set_allowed_entity? To make it more clear on what it does

expect(entityRegistry.entityPubkey.toString()).to.be.eq(solver.toString())
})

it('should change admin for next tests', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

why?

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.

3 participants