Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
tkporter committed Dec 13, 2024
1 parent b98678c commit 356c107
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 30 deletions.
22 changes: 0 additions & 22 deletions rust/main/chains/hyperlane-sealevel/src/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,6 @@ use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};
const SYSTEM_PROGRAM: &str = "11111111111111111111111111111111";
const SPL_NOOP: &str = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";

// The max amount of compute units for a transaction.
// TODO: consider a more sane value and/or use IGP gas payments instead.
const PROCESS_COMPUTE_UNITS: u32 = 1_400_000;

/// 0.0005 SOL, in lamports.
/// A typical tx fee without a prioritization fee is 0.000005 SOL, or
/// 5000 lamports. (Example: https://explorer.solana.com/tx/fNd3xVeBzFHeuzr8dXQxLGiHMzTeYpykSV25xWzNRaHtzzjvY9A3MzXh1ZsK2JncRHkwtuWrGEwGXVhFaUCYhtx)
/// See average priority fees here https://solanacompass.com/statistics/fees
/// to inform what to spend here.
const PROCESS_DESIRED_PRIORITIZATION_FEE_LAMPORTS_PER_TX: u64 = 500000;

/// In micro-lamports. Multiply this by the compute units to figure out
/// the additional cost of processing a message, in addition to the mandatory
/// "base" cost of signature verification.
/// Unused at the moment, but kept for future reference.
#[allow(dead_code)]
const PROCESS_COMPUTE_UNIT_PRICE_MICRO_LAMPORTS: u64 =
// Convert to micro-lamports
(PROCESS_DESIRED_PRIORITIZATION_FEE_LAMPORTS_PER_TX * 1_000_000)
// Divide by the max compute units
/ PROCESS_COMPUTE_UNITS as u64;

// Earlier versions of collateral warp routes were deployed off a version where the mint
// was requested as a writeable account for handle instruction. This is not necessary,
// and generally requires a higher priority fee to be paid.
Expand Down
13 changes: 9 additions & 4 deletions rust/main/chains/hyperlane-sealevel/src/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ impl SealevelRpcClient {
.map_err(ChainCommunicationError::from_other)
}

// Standalone logic stolen from Solana's non-blocking client,
// decoupled from the sending of a transaction.
/// Polls the RPC until the transaction is confirmed or the blockhash
/// expires.
/// Standalone logic stolen from Solana's non-blocking client,
/// decoupled from the sending of a transaction.
pub async fn wait_for_transaction_confirmation(
&self,
transaction: &impl SerializableTransaction,
Expand Down Expand Up @@ -440,7 +442,7 @@ impl SealevelRpcClient {
}

/// Creates a transaction for a given instruction, compute unit limit, and compute unit price.
/// If `blockhash` is `None`, the latest blockhash is fetched from the RPC.
/// If `sign` is true, the transaction will be signed.
pub async fn create_transaction_for_instruction(
&self,
compute_unit_limit: u32,
Expand All @@ -463,8 +465,11 @@ impl SealevelRpcClient {
];

let tx = if sign {
// Getting the finalized blockhash eliminates the chance the blockhash
// gets reorged out, causing the tx to be invalid. The tradeoff is this
// will cause the tx to expire in about 47 seconds (instead of the typical 60).
let recent_blockhash = self
.get_latest_blockhash_with_commitment(CommitmentConfig::processed())
.get_latest_blockhash_with_commitment(CommitmentConfig::finalized())
.await
.map_err(ChainCommunicationError::from_other)?;

Expand Down
9 changes: 7 additions & 2 deletions rust/main/helm/hyperlane-agent/templates/external-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ spec:
{{- if eq .protocol "cosmos" }}
HYP_CHAINS_{{ .name | upper }}_CUSTOMGRPCURLS: {{ printf "'{{ .%s_grpcs | mustFromJson | join \",\" }}'" .name }}
{{- end }}
{{- if and (eq .protocol "sealevel") (eq ((.priorityFeeOracle).type) "helius") }}
{{- if eq .protocol "sealevel" }}
{{- if eq ((.priorityFeeOracle).type) "helius" }}
HYP_CHAINS_{{ .name | upper }}_PRIORITYFEEORACLE_URL: {{ printf "'{{ .%s_helius }}'" .name }}
{{- end }}
{{- if eq ((.transactionSubmitter).url) "helius" }}
HYP_CHAINS_{{ .name | upper }}_TRANSACTIONSUBMITTER_URL: {{ printf "'{{ .%s_helius }}'" .name }}
{{- end }}
{{- end }}
{{- end }}
data:
{{- /*
Expand All @@ -48,7 +53,7 @@ spec:
remoteRef:
key: {{ printf "%s-grpc-endpoints-%s" $.Values.hyperlane.runEnv .name }}
{{- end }}
{{- if and (eq .protocol "sealevel") (eq ((.priorityFeeOracle).type) "helius") }}
{{- if and (eq .protocol "sealevel") (or (eq ((.priorityFeeOracle).type) "helius") (eq ((.transactionSubmitter).url) "helius")) }}
- secretKey: {{ printf "%s_helius" .name }}
remoteRef:
key: {{ printf "%s-rpc-endpoint-helius-%s" $.Values.hyperlane.runEnv .name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ spec:
metadata:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/external-secret: {{ include (print $.Template.BasePath "/external-secret.yaml") . | sha256sum }}
checksum/relayer-configmap: {{ include (print $.Template.BasePath "/relayer-configmap.yaml") . | sha256sum }}
checksum/relayer-external-secret: {{ include (print $.Template.BasePath "/relayer-external-secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spec:
metadata:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/external-secret: {{ include (print $.Template.BasePath "/external-secret.yaml") . | sha256sum }}
checksum/scraper-external-secret: {{ include (print $.Template.BasePath "/scraper-external-secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ spec:
metadata:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/external-secret: {{ include (print $.Template.BasePath "/external-secret.yaml") . | sha256sum }}
checksum/validator-configmap: {{ include (print $.Template.BasePath "/validator-configmap.yaml") . | sha256sum }}
checksum/scraper-external-secret: {{ include (print $.Template.BasePath "/scraper-external-secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
6 changes: 4 additions & 2 deletions typescript/infra/config/environments/mainnet3/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {

import {
AgentChainConfig,
HELIUS_SECRET_URL_MARKER,
RootAgentConfig,
getAgentChainNamesFromConfig,
} from '../../../src/config/agent/agent.js';
Expand Down Expand Up @@ -388,7 +389,8 @@ const sealevelTransactionSubmitterConfigGetter = (
// Special case for Solana mainnet
if (chain === 'solanamainnet') {
return {
type: AgentSealevelTransactionSubmitterType.Jito,
type: AgentSealevelTransactionSubmitterType.Rpc,
url: HELIUS_SECRET_URL_MARKER,
};
}

Expand Down Expand Up @@ -548,7 +550,7 @@ const releaseCandidate: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: '0b61be6-20241211-051755',
tag: 'b98678c-20241213-043725',
},
// We're temporarily (ab)using the RC relayer as a way to increase
// message throughput.
Expand Down
3 changes: 3 additions & 0 deletions typescript/infra/src/config/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export interface SealevelAgentConfig {
) => AgentSealevelTransactionSubmitter;
}

// An ugly way to mark a URL as a the secret Helius URL when Helm templating
export const HELIUS_SECRET_URL_MARKER = 'helius';

// incomplete common agent configuration for a role
interface AgentRoleConfig {
// K8s-specific
Expand Down

0 comments on commit 356c107

Please sign in to comment.