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

TokenPool split and other QOL #16472

Merged
merged 36 commits into from
Feb 24, 2025
Merged

TokenPool split and other QOL #16472

merged 36 commits into from
Feb 24, 2025

Conversation

yashnevatia
Copy link
Contributor

@yashnevatia yashnevatia commented Feb 19, 2025

  • Modularising Billing and calling it during chain setup
  • Making onRampByte part of CCIPOnChainState
  • Renaming GetOffRampAddress to GetOffRampAddressBytes
  • Adding solRouter.NewAddOfframpInstruction instruction during remote chain setup
  • calling AddBillingTokenForRemoteChain when setting up transferable token for solana <-> evm
  • Token pool split
  • use solana specific config for cs_deploy_chain
  • abstract deployToken for tests
  • take in TokenSymbol input
  • consistent package naming

@yashnevatia yashnevatia requested review from a team as code owners February 19, 2025 11:46
@yashnevatia yashnevatia requested a review from a team as a code owner February 20, 2025 15:31
if err != nil {
return fmt.Errorf("failed to generate instructions: %w", err)
}

err = chain.Confirm([]solana.Instruction{routerIx, feeQuoterIx, offRampIx})
err = chain.Confirm([]solana.Instruction{routerIx, routerOfframpIx, feeQuoterIx, offRampIx})
Copy link
Contributor

Choose a reason for hiding this comment

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

just a mental note that I believe we'll have to split this up when we support MCMS. On the initial deploy this will be fine because we will not have transferred ownership yet. However, when we do an upgrade, by that point router and fee quoter will be owned by timelock and we'll have to wrap these. We don't have to solve this here, but it's something to think about

tt-cll
tt-cll previously approved these changes Feb 21, 2025
@tt-cll tt-cll enabled auto-merge February 24, 2025 12:56
Copy link
Contributor

@ecPablo ecPablo left a comment

Choose a reason for hiding this comment

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

LGTM, left some comments but nothing blocking

case chainsel.FamilyEVM:
addressBytes, _ = s.Chains[remoteChainSel].OnRampBytes()
}
addressBytes, _ := s.GetOnRampAddressBytes(remoteChainSel)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe worth renaming to onRampBytes to make it more explicit?

Comment on lines +65 to +75
var poolConfigAccount interface{}

switch cfg.PoolType {
case solTestTokenPool.BurnAndMint_PoolType:
tokenPool = chainState.BurnMintTokenPool
poolConfigAccount = solBurnMintTokenPool.State{}
case solTestTokenPool.LockAndRelease_PoolType:
tokenPool = chainState.LockReleaseTokenPool
poolConfigAccount = solLockReleaseTokenPool.State{}
default:
return fmt.Errorf("invalid pool type: %s", cfg.PoolType)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe worth to move this to a small helper similar to validatePoolDeployment, like initPoolStateType?

chainState := state.SolChains[cfg.ChainSelector]
authorityPubKey := solana.MustPublicKeyFromBase58(cfg.Authority)
tokenPubKey := solana.MustPublicKeyFromBase58(cfg.TokenPubKey)
tokenPool := solana.PublicKey{}

if cfg.PoolType == solTestTokenPool.BurnAndMint_PoolType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if it might be worth just creating 2 separate helpers for addBurnAndMintTokenPool and addLockAndReleaseTokenPool and just do an initial switch at the beginning of this function instead of adding multiple switches on this larger function? It' s just for making it a bit easier to follow but not blocking anything

@@ -179,6 +188,12 @@ func LoadChainStateSolana(chain deployment.SolChain, addresses map[string]deploy
case FeeAggregator:
pub := solana.MustPublicKeyFromBase58(address)
state.FeeAggregator = pub
case BurnMintTokenPool:
pub := solana.MustPublicKeyFromBase58(address)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use pub, err := PublicKeyFromBase58()to avoid panics here?

@tt-cll tt-cll added this pull request to the merge queue Feb 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2025
@tt-cll tt-cll added this pull request to the merge queue Feb 24, 2025
Merged via the queue into develop with commit aefb2b7 Feb 24, 2025
181 of 182 checks passed
@tt-cll tt-cll deleted the solana-updates-v2 branch February 24, 2025 14:16
krehermann pushed a commit that referenced this pull request Feb 27, 2025
* modularising billing to be reused in cs_deploy

* adding offramp instruction

* adding remote billing for token transfers

* loading bytes

* Adding tp types to state

* deploy and preload tps

* bug fix

* adding spltokens array and func to map tokenaddress to program

* token pool split in changesets

* deprecating old token pool, just commenting first

* lint

* adding wsol to spltokens

* removing consts

* using same type

* changes

* removing token program name from billinh

* removing old consts

* changing type and using index 1

* renaming and adding config

* cascading changes

* removing redundant const

* cascading changes and adding billing through config

* adding validate

* renaming packages

* linting

* include spltokens in validation

* abstract deployToken in test

* fix logging

* dont add link and wsol to token array

* use token symbol as input

* lint and bug

* bug

* lint

* fix
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