Skip to content

Commit

Permalink
attempt cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-cll committed Jan 9, 2025
1 parent cec7880 commit b3acadc
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 84 deletions.
2 changes: 1 addition & 1 deletion core/scripts/setup_testdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function exit_error {
}
# Create a new user and database for development
# This script is intended to be run on a local development machine
tdir=$(mktemp -d -t db-dev-user-XXXXXX)
tdir=$(mktemp -d -t db-dev-user)

username="chainlink_dev"
password="insecurepassword"
Expand Down
2 changes: 0 additions & 2 deletions deployment/ccip/changeset/cs_add_lane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
)

// TODO: Solana re-write

func TestAddLanesWithTestRouter(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t)
Expand Down
1 change: 0 additions & 1 deletion deployment/ccip/changeset/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,6 @@ func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
return nil
}

// TODO: can this handle solana stuff
func UpdateChainConfig(e deployment.Environment, cfg UpdateChainConfigConfig) (deployment.ChangesetOutput, error) {
if err := cfg.Validate(e); err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("%w: %w", deployment.ErrInvalidConfig, err)
Expand Down
1 change: 1 addition & 0 deletions deployment/ccip/changeset/cs_deploy_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ func deployChainContractsSolana(
if err != nil {
return fmt.Errorf("failed to save address: %v", err)
}
//TODO: SOLANA_CCIP deploy token pool contract

}

Expand Down
2 changes: 0 additions & 2 deletions deployment/ccip/changeset/cs_deploy_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ func TestHomeChainChangesetSolana(t *testing.T) {
solChainSelectors := e.Env.AllChainSelectorsSolana()
nodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain)
require.NoError(t, err)
// p2pIds := nodes.NonBootstraps().PeerIDs()
cfg := make(map[uint64]commontypes.MCMSWithTimelockConfig)
for _, chain := range e.Env.AllChainSelectors() {
cfg[chain] = proposalutils.SingleGroupTimelockConfig(t)
Expand Down Expand Up @@ -246,7 +245,6 @@ func TestDeployCCIPContracts(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t)
// Deploy all the CCIP contracts.
// TODO: not sure how this ends up deploying contracts ?
state, err := LoadOnchainState(e.Env)
require.NoError(t, err)
snap, err := state.View(e.Env.AllChainSelectors())
Expand Down
6 changes: 0 additions & 6 deletions deployment/ccip/changeset/cs_prerequisites.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ var (
_ deployment.ChangeSet[DeployPrerequisiteConfig] = DeployPrerequisites
)

// TODO: Solana re-write
// common.Address used
// LoadOnchainState used which wont work for solana
// deployPrerequisiteContracts needs to be re-written for solana
// basically everything

// DeployPrerequisites deploys the pre-requisite contracts for CCIP
// pre-requisite contracts are the contracts which can be reused from previous versions of CCIP
// Or the contracts which are already deployed on the chain ( for example, tokens, feeds, etc)
Expand Down
1 change: 0 additions & 1 deletion deployment/ccip/changeset/cs_prerequisites_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

// TODO: Solana re-write

func TestDeployPrerequisites(t *testing.T) {
t.Parallel()
Expand Down
2 changes: 0 additions & 2 deletions deployment/ccip/changeset/save_existing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

// TODO: Solana re-write

func TestSaveExistingCCIP(t *testing.T) {
t.Parallel()
lggr := logger.TestLogger(t)
Expand Down
9 changes: 3 additions & 6 deletions deployment/ccip/changeset/solana_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import (

ag_binary "github.com/gagliardetto/binary"
solana "github.com/gagliardetto/solana-go"
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_receiver"
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_router"
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/token_pool"
"github.com/smartcontractkit/chainlink/deployment"
)

Expand Down Expand Up @@ -79,15 +76,15 @@ func LoadChainStateSolana(chain deployment.SolChain, addresses map[string]deploy
switch tvStr.String() {
case deployment.NewTypeAndVersion(SolCcipRouter, deployment.Version1_0_0).String():
pub := solana.MustPublicKeyFromBase58(address)
ccip_router.SetProgramID(pub)
//ccip_router.SetProgramID(pub)
state.SolCcipRouter = pub
case deployment.NewTypeAndVersion(SolReceiver, deployment.Version1_0_0).String():
pub := solana.MustPublicKeyFromBase58(address)
ccip_receiver.SetProgramID(pub)
//ccip_receiver.SetProgramID(pub)
state.SolCcipReceiver = pub
case deployment.NewTypeAndVersion(SolTokenPool, deployment.Version1_0_0).String():
pub := solana.MustPublicKeyFromBase58(address)
token_pool.SetProgramID(pub)
//token_pool.SetProgramID(pub)
state.TokenPool = pub
case deployment.NewTypeAndVersion(LinkToken, deployment.Version1_0_0).String():
pub := solana.MustPublicKeyFromBase58(address)
Expand Down
4 changes: 0 additions & 4 deletions deployment/ccip/changeset/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,6 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro
return m, nil
}

// TODO: Solana re-write
// we can add logic here but cleaner just to call LoadOnchainState_Sol for now ?
// the state will need to be defined separately for solana
// and LoadChainState() is completely different
func LoadOnchainState(e deployment.Environment) (CCIPOnChainState, error) {
solState, err := LoadOnchainStateSolana(e)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions deployment/common/changeset/deploy_mcms_with_timelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (

var _ deployment.ChangeSet[map[uint64]types.MCMSWithTimelockConfig] = DeployMCMSWithTimelock

// TODO: solana re-write

func DeployMCMSWithTimelock(e deployment.Environment, cfgByChain map[uint64]types.MCMSWithTimelockConfig) (deployment.ChangesetOutput, error) {
newAddresses := deployment.NewMemoryAddressBook()
err := internal.DeployMCMSWithTimelockContractsBatch(
Expand Down
2 changes: 0 additions & 2 deletions deployment/common/changeset/internal/mcms.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/smartcontractkit/chainlink/deployment/common/view/v1_0"
)

// TODO: solana re-write

func DeployMCMSWithConfig(
contractType deployment.ContractType,
lggr logger.Logger,
Expand Down
2 changes: 0 additions & 2 deletions deployment/common/changeset/save_existing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var (
_ deployment.ChangeSet[ExistingContractsConfig] = SaveExistingContracts
)

// TODO: change for solana as Address needs to be ag_solanago.PublicKey
type Contract struct {
Address common.Address
TypeAndVersion deployment.TypeAndVersion
Expand Down Expand Up @@ -43,7 +42,6 @@ func (cfg ExistingContractsConfig) Validate() error {
return nil
}

// TODO: ExistingContractsConfig in params needs to change for solana as Address needs to be ag_solanago.PublicKey
// SaveExistingContracts saves the existing contracts to the address book.
// Caller should update the environment's address book with the returned addresses.
func SaveExistingContracts(env deployment.Environment, cfg ExistingContractsConfig) (deployment.ChangesetOutput, error) {
Expand Down
2 changes: 0 additions & 2 deletions deployment/common/changeset/save_existing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

// TODO: Solana re-write

func TestSaveExisting(t *testing.T) {
dummyEnv := deployment.Environment{
Name: "dummy",
Expand Down
49 changes: 0 additions & 49 deletions deployment/environment/devenv/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"

"github.com/gagliardetto/solana-go"
solRpc "github.com/gagliardetto/solana-go/rpc"

solCommomUtil "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/common"
"github.com/smartcontractkit/chainlink/deployment"
)

Expand Down Expand Up @@ -148,48 +144,3 @@ func NewChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployme
}
return chains, nil
}

// This is for devenv, I have not used it yet
func NewSolChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployment.SolChain, error) {
chains := make(map[uint64]deployment.SolChain)
for _, chainCfg := range configs {
selector, err := chainselectors.SelectorFromChainId(chainCfg.ChainID)
if err != nil {
return nil, fmt.Errorf("failed to get selector from chain id %d: %w", chainCfg.ChainID, err)
}

var ec *solRpc.Client
for _, rpc := range chainCfg.HTTPRPCs {
ec = solRpc.New(rpc)
// error handling for rpc init
logger.Infof("connected to http rpc %s", rpc)
break
}
if ec == nil {
return nil, fmt.Errorf("failed to connect to chain %s", chainCfg.ChainName)
}
// TODO: fetch this from chainConfig, together with KeypairPath
adminPrivateKey, err := solana.NewRandomPrivateKey()
if err != nil {
return nil, err
}
chains[selector] = deployment.SolChain{
Selector: selector,
Client: ec,
URL: chainCfg.HTTPRPCs[0],
WSURL: chainCfg.WSRPCs[0],
DeployerKey: &adminPrivateKey,
KeypairPath: "TODO",
Confirm: func(instructions []solana.Instruction, opts ...solCommomUtil.TxModifier) error {
_, err := solCommomUtil.SendAndConfirm(
context.Background(), ec, instructions, adminPrivateKey, solRpc.CommitmentConfirmed, opts...,
)
if err != nil {
return err
}
return nil
},
}
}
return chains, nil
}
2 changes: 0 additions & 2 deletions deployment/environment/memory/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func NewMemoryChain(t *testing.T, selector uint64) deployment.Chain {
// Needed for environment variables on the node which point to prexisitng addresses.
// i.e. CapReg.
func NewMemoryChains(t *testing.T, numChains int, numUsers int) (map[uint64]deployment.Chain, map[uint64][]*bind.TransactOpts) {
// TODO: add solana chain support
mchains := GenerateChains(t, numChains, numUsers)
users := make(map[uint64][]*bind.TransactOpts)
for id, chain := range mchains {
Expand Down Expand Up @@ -88,7 +87,6 @@ func generateMemoryChain(t *testing.T, inputs map[uint64]EVMChain) map[uint64]de
chainInfo, err := chainsel.GetChainDetailsByChainIDAndFamily(strconv.FormatUint(cid, 10), chainsel.FamilyEVM)
require.NoError(t, err)
backend := NewBackend(chain.Backend)
// TODO: add solana chain support
chains[chainInfo.ChainSelector] = deployment.Chain{
Selector: chainInfo.ChainSelector,
Client: backend,
Expand Down

0 comments on commit b3acadc

Please sign in to comment.