Browse Source

Set bridge address via env variable

Change-Id: If301b31525dbe1d9f892f93ffbc1a35507be4625
Hendrik Hofstadt 4 years ago
parent
commit
d242fd0fa4
3 changed files with 16 additions and 18 deletions
  1. 1 0
      Dockerfile.client
  2. 1 0
      solana/Dockerfile
  3. 14 18
      solana/bridge/program/src/types.rs

+ 1 - 0
Dockerfile.client

@@ -32,6 +32,7 @@ ADD proto  /usr/src/proto
 
 WORKDIR /usr/src/solana
 ENV EMITTER_ADDRESS="11111111111111111111111111111115"
+ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
 
 RUN --mount=type=cache,target=/root/.cache \
     --mount=type=cache,target=target \

+ 1 - 0
solana/Dockerfile

@@ -42,6 +42,7 @@ ADD . .
 RUN mkdir -p /opt/solana/deps
 
 ENV EMITTER_ADDRESS="11111111111111111111111111111115"
+ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
 
 # Build Wormhole Solana progrms
 RUN --mount=type=cache,target=bridge/target \

+ 14 - 18
solana/bridge/program/src/types.rs

@@ -177,7 +177,7 @@ impl Owned for PostedMessageData {
 impl Owned for PostedMessageData {
     fn owner(&self) -> AccountOwner {
         AccountOwner::Other(
-            Pubkey::from_str("Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o").unwrap(),
+            Pubkey::from_str(env!("BRIDGE_ADDRESS")).unwrap(),
         )
     }
 }
@@ -271,7 +271,7 @@ impl Owned for PostedVAAData {
 impl Owned for PostedVAAData {
     fn owner(&self) -> AccountOwner {
         AccountOwner::Other(
-            Pubkey::from_str("Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o").unwrap(),
+            Pubkey::from_str(env!("BRIDGE_ADDRESS")).unwrap(),
         )
     }
 }
@@ -311,8 +311,8 @@ impl SerializePayload for GovernancePayloadUpgrade {
 }
 
 impl DeserializePayload for GovernancePayloadUpgrade
-where
-    Self: DeserializeGovernancePayload,
+    where
+        Self: DeserializeGovernancePayload,
 {
     fn deserialize(buf: &mut &[u8]) -> Result<Self, SolitaireError> {
         let mut c = Cursor::new(buf);
@@ -336,8 +336,7 @@ impl SerializeGovernancePayload for GovernancePayloadUpgrade {
     const ACTION: u8 = 1;
 }
 
-impl DeserializeGovernancePayload for GovernancePayloadUpgrade {
-}
+impl DeserializeGovernancePayload for GovernancePayloadUpgrade {}
 
 pub struct GovernancePayloadGuardianSetChange {
     // New GuardianSetIndex
@@ -360,8 +359,8 @@ impl SerializePayload for GovernancePayloadGuardianSetChange {
 }
 
 impl DeserializePayload for GovernancePayloadGuardianSetChange
-where
-    Self: DeserializeGovernancePayload,
+    where
+        Self: DeserializeGovernancePayload,
 {
     fn deserialize(buf: &mut &[u8]) -> Result<Self, SolitaireError> {
         let mut c = Cursor::new(buf);
@@ -393,8 +392,7 @@ impl SerializeGovernancePayload for GovernancePayloadGuardianSetChange {
     const ACTION: u8 = 2;
 }
 
-impl DeserializeGovernancePayload for GovernancePayloadGuardianSetChange {
-}
+impl DeserializeGovernancePayload for GovernancePayloadGuardianSetChange {}
 
 pub struct GovernancePayloadSetMessageFee {
     // New fee in lamports
@@ -412,8 +410,8 @@ impl SerializePayload for GovernancePayloadSetMessageFee {
 }
 
 impl DeserializePayload for GovernancePayloadSetMessageFee
-where
-    Self: DeserializeGovernancePayload,
+    where
+        Self: DeserializeGovernancePayload,
 {
     fn deserialize(buf: &mut &[u8]) -> Result<Self, SolitaireError> {
         let mut c = Cursor::new(buf);
@@ -436,8 +434,7 @@ impl SerializeGovernancePayload for GovernancePayloadSetMessageFee {
     const ACTION: u8 = 3;
 }
 
-impl DeserializeGovernancePayload for GovernancePayloadSetMessageFee {
-}
+impl DeserializeGovernancePayload for GovernancePayloadSetMessageFee {}
 
 pub struct GovernancePayloadTransferFees {
     // Amount to be transferred
@@ -458,8 +455,8 @@ impl SerializePayload for GovernancePayloadTransferFees {
 }
 
 impl DeserializePayload for GovernancePayloadTransferFees
-where
-    Self: DeserializeGovernancePayload,
+    where
+        Self: DeserializeGovernancePayload,
 {
     fn deserialize(buf: &mut &[u8]) -> Result<Self, SolitaireError> {
         let mut c = Cursor::new(buf);
@@ -485,8 +482,7 @@ impl SerializeGovernancePayload for GovernancePayloadTransferFees {
     const ACTION: u8 = 4;
 }
 
-impl DeserializeGovernancePayload for GovernancePayloadTransferFees {
-}
+impl DeserializeGovernancePayload for GovernancePayloadTransferFees {}
 
 #[repr(u8)]
 #[derive(BorshSerialize, BorshDeserialize, Clone, Serialize, Deserialize)]