Commit ada041a
set wormhole address in solana binary by patching it, to enable other SVM chains to work with the CLI (#658)
* cli: set wormhole address in solana binary by patching it
The problem: solana binaries contain program addresses embedded into
them. Specifically, NTT includes the address of the Wormhole program
it's linked against. Which Wormhole address to include is controlled via
feature flags in the wormhole-anchor-sdk crate, which supports one of
mainnet, devnet, and localhost. For other SVM chains, like Fogo, we
can't build this binary correctly, because there is no way to tell it
which core address to use.
One solution is to roll out an updated version of the
wormhole-anchor-sdk, which allows setting the Wormhole address via an
environment variable. That is likely the prudent solution, but it will
need to be backported to older NTT versions (in case a Fogo deployer
wants to deploy, say, 3.0.0, instead of the main HEAD).
Another solution, which we adopt in this commit, is simply patching the
binary. In other words: compile the binary with the solana flag, then
replace the solana address with the desired address. This seems to work
just fine, there is no checksum signing on the binaries or anything. It
also makes compilation a bit faster, because we don't need to recompile
anything between different targets.
Not sure if we should keep this, but will do for now.
* only apply patch if the used chain is not solana
---------
Co-authored-by: Csongor Kiss <kiss.csongor.kiss@gmail.com>1 parent 2b736b6 commit ada041a
1 file changed
Lines changed: 61 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1995 | 1995 | | |
1996 | 1996 | | |
1997 | 1997 | | |
1998 | | - | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
1999 | 2010 | | |
2000 | 2011 | | |
2001 | 2012 | | |
| |||
2557 | 2568 | | |
2558 | 2569 | | |
2559 | 2570 | | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
2560 | 2609 | | |
2561 | 2610 | | |
2562 | 2611 | | |
2563 | 2612 | | |
2564 | 2613 | | |
2565 | 2614 | | |
2566 | | - | |
2567 | 2615 | | |
2568 | | - | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
2572 | 2620 | | |
2573 | | - | |
| 2621 | + | |
2574 | 2622 | | |
2575 | 2623 | | |
2576 | 2624 | | |
2577 | | - | |
| 2625 | + | |
2578 | 2626 | | |
2579 | 2627 | | |
2580 | 2628 | | |
2581 | | - | |
| 2629 | + | |
2582 | 2630 | | |
2583 | 2631 | | |
2584 | 2632 | | |
2585 | 2633 | | |
2586 | 2634 | | |
2587 | 2635 | | |
2588 | | - | |
2589 | | - | |
2590 | | - | |
2591 | | - | |
2592 | | - | |
2593 | | - | |
2594 | | - | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
2595 | 2640 | | |
2596 | 2641 | | |
2597 | 2642 | | |
| |||
0 commit comments