@@ -22,7 +22,7 @@ import "@wormhole-foundation/sdk-solana-ntt";
22
22
import "@wormhole-foundation/sdk-definitions-ntt" ;
23
23
import type { Ntt , NttTransceiver } from "@wormhole-foundation/sdk-definitions-ntt" ;
24
24
25
- import { type SolanaChains } from "@wormhole-foundation/sdk-solana" ;
25
+ import { type SolanaChains , SolanaAddress } from "@wormhole-foundation/sdk-solana" ;
26
26
27
27
import { colorizeDiff , diffObjects } from "./diff" ;
28
28
import { forgeSignerArgs , getSigner , type SignerType } from "./getSigner" ;
@@ -693,6 +693,19 @@ yargs(hideBin(process.argv))
693
693
console . error ( e . logs ) ;
694
694
}
695
695
}
696
+ if ( missingConfig . solanaUpdateLUT ) {
697
+ if ( chainToPlatform ( chain ) !== "Solana" ) {
698
+ console . error ( "Solana update LUT can only be set on Solana chains" ) ;
699
+ continue ;
700
+ }
701
+ const solanaNtt = ntt as SolanaNtt < Network , SolanaChains > ;
702
+ const tx = solanaNtt . initializeOrUpdateLUT ( { payer : new SolanaAddress ( signer . address . address ) . unwrap ( ) } )
703
+ try {
704
+ await signSendWait ( ctx , tx , signer . signer )
705
+ } catch ( e : any ) {
706
+ console . error ( e . logs ) ;
707
+ }
708
+ }
696
709
}
697
710
698
711
// pull deps again
@@ -750,7 +763,7 @@ yargs(hideBin(process.argv))
750
763
}
751
764
}
752
765
753
- if ( extraInfo ) {
766
+ if ( Object . keys ( extraInfo ) . length > 0 ) {
754
767
console . log ( chalk . yellow ( JSON . stringify ( extraInfo , null , 2 ) ) ) ;
755
768
}
756
769
@@ -761,23 +774,26 @@ yargs(hideBin(process.argv))
761
774
errors ++ ;
762
775
}
763
776
764
- for ( const [ chain , peers ] of Object . entries ( missing ) ) {
765
- console . error ( `Peer errors for ${ chain } :` ) ;
766
- for ( const manager of peers . managerPeers ) {
777
+ for ( const [ chain , missingConfig ] of Object . entries ( missing ) ) {
778
+ console . error ( `${ chain } status :` ) ;
779
+ for ( const manager of missingConfig . managerPeers ) {
767
780
console . error ( ` Missing manager peer: ${ manager . address . chain } ` ) ;
768
781
}
769
- for ( const transceiver of peers . transceiverPeers ) {
782
+ for ( const transceiver of missingConfig . transceiverPeers ) {
770
783
console . error ( ` Missing transceiver peer: ${ transceiver . chain } ` ) ;
771
784
}
772
- for ( const evmChain of peers . evmChains ) {
773
- console . error ( ` Missing EVM chain: ${ evmChain } ` ) ;
785
+ for ( const evmChain of missingConfig . evmChains ) {
786
+ console . error ( ` ${ evmChain } needs to be configured as an EVM chain ` ) ;
774
787
}
775
- for ( const relaying of peers . standardRelaying ) {
788
+ for ( const relaying of missingConfig . standardRelaying ) {
776
789
console . warn ( ` No standard relaying: ${ relaying } ` ) ;
777
790
}
778
- if ( peers . solanaWormholeTransceiver ) {
791
+ if ( missingConfig . solanaWormholeTransceiver ) {
779
792
console . error ( " Missing Solana wormhole transceiver" ) ;
780
793
}
794
+ if ( missingConfig . solanaUpdateLUT ) {
795
+ console . error ( " Missing or outdated LUT" ) ;
796
+ }
781
797
}
782
798
783
799
if ( errors > 0 ) {
@@ -838,6 +854,7 @@ type MissingImplicitConfig = {
838
854
evmChains : Chain [ ] ;
839
855
standardRelaying : Chain [ ] ;
840
856
solanaWormholeTransceiver : boolean ;
857
+ solanaUpdateLUT : boolean ;
841
858
}
842
859
843
860
function createWorkTree ( platform : Platform , version : string ) : string {
@@ -964,6 +981,7 @@ async function upgradeSolana<N extends Network, C extends SolanaChains>(
964
981
}
965
982
const mint = ( await ( ntt . getConfig ( ) ) ) . mint ;
966
983
await deploySolana ( pwd , version , await ntt . getMode ( ) , ctx , mint . toBase58 ( ) , payer , false , programKeyPath , binaryPath ) ;
984
+ // TODO: call initializeOrUpdateLUT. currently it's done in the following 'ntt push' step.
967
985
}
968
986
969
987
async function deploy < N extends Network , C extends Chain > (
@@ -1332,6 +1350,7 @@ async function missingConfigs(
1332
1350
evmChains : [ ] ,
1333
1351
standardRelaying : [ ] ,
1334
1352
solanaWormholeTransceiver : false ,
1353
+ solanaUpdateLUT : false ,
1335
1354
} ;
1336
1355
1337
1356
if ( chainToPlatform ( fromChain ) === "Solana" ) {
@@ -1342,6 +1361,17 @@ async function missingConfigs(
1342
1361
count ++ ;
1343
1362
missing . solanaWormholeTransceiver = true ;
1344
1363
}
1364
+
1365
+ // here we just check if the LUT update function returns an instruction.
1366
+ // if it does, it means the LUT is missing or outdated. notice that
1367
+ // we're not actually updating the LUT here, just checking if it's
1368
+ // missing, so it's ok to use the 0 pubkey as the payer.
1369
+ const updateLUT = solanaNtt . initializeOrUpdateLUT ( { payer : new PublicKey ( 0 ) } ) ;
1370
+ // check if async generator is non-empty
1371
+ if ( ! ( await updateLUT . next ( ) ) . done ) {
1372
+ count ++ ;
1373
+ missing . solanaUpdateLUT = true ;
1374
+ }
1345
1375
}
1346
1376
1347
1377
for ( const [ toChain , to ] of Object . entries ( deps ) ) {
0 commit comments