-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mitch infra #4
Mitch infra #4
Changes from all commits
d220b80
fd7c4f2
0d8dbb8
02ed0a3
6bc0894
e04472f
bff96d8
898ea28
bcbe5d4
9f3c3f6
2ea13a1
e3a5a59
ea424a2
72c8aad
be2dc91
7bc9ea2
e61a247
6b5735d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
chain: "solana" | ||
cluster: "devnet" | ||
heartbeatInterval: "30" | ||
infisicalSecretKey: "SOLANA_KEY" | ||
infisicalSecretSlug: "dev" | ||
jupiterSwapApiKey: "3a3b41bc06d49f9c89a8550ff84072be" | ||
namespace: "devnet-pull" | ||
networkId: "devnet" | ||
pagerdutyEventKey: "redacted" | ||
rpcUrl: "https://switchbo-switchbo-6225.devnet.rpcpool.com/f6fb9f02-0777-498b-b8f5-67cbb1fc0d14" | ||
solanaMainnetRpc: "https://switchbo-switchbo-6225.devnet.rpcpool.com/f6fb9f02-0777-498b-b8f5-67cbb1fc0d14" | ||
wssUrl: "wss://switchbo-switchbo-6225.devnet.rpcpool.com/f6fb9f02-0777-498b-b8f5-67cbb1fc0d14" | ||
gateway: | ||
host: "pull-gateway.switchboard.xyz" | ||
image: "docker.io/switchboardlabs/pull-oracle:dev-RC_03_13_24_14_17" | ||
oracle: | ||
image: "docker.io/switchboardlabs/pull-oracle:dev-RC_03_13_24_14_17" | ||
authority: "2KgowxogBrGqRcgXQEmqFvC3PGtCu66qERNJevYW8Ajh" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Gitleaks has detected a secret with rule-id If this secret is a false positive, you can add the fingerprint below to your
|
||
guardian: | ||
queue: "71wi6H1ByDG9qnRd5Ef8PSKoKH8rJ7pve7NDvB7Y4tqi" | ||
key: "Ewq5ec637q9pvzZH5xBHtqxqUPSjo1j4sB1nXeeGNRHo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Gitleaks has detected a secret with rule-id If this secret is a false positive, you can add the fingerprint below to your
|
||
host: "guardian-oracle.switchboard.xyz" | ||
push: | ||
queue: "uPeRMdfPmrPqgRWSrjAnAkH78RqAhe5kXoW6vBYRqFX" | ||
key: "8AGNUUHphu8YevPoTGTbcbsJLKBe2F6byukfoPUWSHWm" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Gitleaks has detected a secret with rule-id If this secret is a false positive, you can add the fingerprint below to your
|
||
host: "push-oracle.switchboard.xyz" | ||
pull: | ||
queue: "5Qv744yu7DmEbU669GmYRqL9kpQsyYsaVKdR8YiBMTaP" | ||
key: "BfvoZHYSxgJe4P7jbt9HTqJHip7Lf3xRB1QNszEPrhCx" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Gitleaks has detected a secret with rule-id If this secret is a false positive, you can add the fingerprint below to your
|
||
host: "pull-oracle.switchboard.xyz" | ||
|
||
# command: shell | ||
sgx: | ||
type: "azure" | ||
memoryMiB: 32Mi | ||
cpu: 1500m | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import * as anchor from "@coral-xyz/anchor"; | ||
import * as spl from "@solana/spl-token"; | ||
import type { AccountInfo, AccountMeta } from "@solana/web3.js"; | ||
import { | ||
AddressLookupTableProgram, | ||
Connection, | ||
Keypair, | ||
MessageV0, | ||
PublicKey, | ||
sendAndConfirmTransaction, | ||
SystemProgram, | ||
Transaction, | ||
TransactionInstruction, | ||
TransactionMessage, | ||
VersionedTransaction, | ||
} from "@solana/web3.js"; | ||
import { Big, BigUtils, bs58 } from "@switchboard-xyz/common"; | ||
import { OracleJob } from "@switchboard-xyz/common"; | ||
import * as sb from "@switchboard-xyz/solana.js"; | ||
import { toBufferLE } from "bigint-buffer"; | ||
import * as crypto from "crypto"; | ||
import * as fs from "fs"; | ||
const assert = require("assert"); | ||
|
||
const walletFile = "your wallet file json here"; | ||
// example "/Users/mgild/switchboard_environments_v2/devnet/upgrade_authority/test.json" | ||
const payerFile = "your payer file json here" | ||
let PID = new PublicKey("sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"); | ||
// PID = new PublicKey("CR1hCrkKveeWrYYs5kk7rasRM2AH1vZy8s8fn42NBwkq"); | ||
const RPC_URL = "https://api.devnet.solana.com"; | ||
|
||
|
||
|
||
async function fetchLatestSlotHash( | ||
connection: Connection | ||
): Promise<[bigint, string]> { | ||
const slotHashesSysvarKey = new PublicKey( | ||
"SysvarS1otHashes111111111111111111111111111" | ||
); | ||
const accountInfo = await connection.getAccountInfo(slotHashesSysvarKey, { | ||
commitment: "confirmed", | ||
dataSlice: { length: 40, offset: 8 }, | ||
}); | ||
let buffer = accountInfo!.data; | ||
const slotNumber = buffer.readBigUInt64LE(); | ||
buffer = buffer.slice(8); | ||
return [slotNumber, bs58.encode(buffer)]; | ||
} | ||
|
||
async function initWalletFromFile(filePath: string): Promise<anchor.Wallet> { | ||
// Read the file | ||
const secretKeyString: string = fs.readFileSync(filePath, { | ||
encoding: "utf8", | ||
}); | ||
const secretKey: Uint8Array = Uint8Array.from(JSON.parse(secretKeyString)); | ||
|
||
// Create a keypair from the secret key | ||
const keypair: Keypair = Keypair.fromSecretKey(secretKey); | ||
|
||
// Create a wallet | ||
const wallet: anchor.Wallet = new anchor.Wallet(keypair); | ||
|
||
return wallet; | ||
} | ||
|
||
async function initKeypairFromFile(filePath: string): Promise<Keypair> { | ||
// Read the file | ||
const secretKeyString: string = fs.readFileSync(filePath, { | ||
encoding: "utf8", | ||
}); | ||
const secretKey: Uint8Array = Uint8Array.from(JSON.parse(secretKeyString)); | ||
|
||
// Create a keypair from the secret key | ||
const keypair: Keypair = Keypair.fromSecretKey(secretKey); | ||
|
||
return keypair; | ||
} | ||
|
||
async function keypairFromJson(secretKeyString: string): Promise<Keypair> { | ||
const secretKey: Uint8Array = Uint8Array.from(JSON.parse(secretKeyString)); | ||
|
||
// Create a keypair from the secret key | ||
return Keypair.fromSecretKey(secretKey); | ||
} | ||
|
||
export function logEnvVariables( | ||
env: Array<[string, string | anchor.web3.PublicKey]>, | ||
pre = "Make sure to add the following to your .env file:" | ||
) { | ||
console.log( | ||
`\n${pre}\n\t${env | ||
.map(([key, value]) => `${key.toUpperCase()}=${value}`) | ||
.join("\n\t")}\n` | ||
); | ||
} | ||
|
||
(async () => { | ||
const ORACLE_IP = "127.0.0.1"; | ||
|
||
let PID = new PublicKey("sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"); | ||
PID = sb.SB_ON_DEMAND_PID; | ||
const connection = new Connection( | ||
RPC_URL, | ||
"confirmed" | ||
); | ||
|
||
const wallet = await initWalletFromFile( | ||
walletFile | ||
); | ||
const devnetPayer = await initKeypairFromFile( | ||
payerFile | ||
); | ||
const provider = new anchor.AnchorProvider(connection, wallet, {}); | ||
const idl = await anchor.Program.fetchIdl(PID, provider); | ||
const program = new anchor.Program(idl!, PID, provider); | ||
const switchboardProgram = sb.SwitchboardProgram.from( | ||
connection, | ||
devnetPayer, | ||
sb.SB_V2_PID, | ||
PID | ||
); | ||
|
||
const [slotNumber, slotHash] = await fetchLatestSlotHash(connection); | ||
const bootstrappedQueue = (await sb.AttestationQueueAccount.bootstrapNewQueue( | ||
switchboardProgram | ||
)) as any; | ||
console.log(bootstrappedQueue); | ||
|
||
const attestationQueueAccount = bootstrappedQueue.attestationQueue.account; | ||
const verifierOracleAccount = bootstrappedQueue.verifier.account; | ||
const quoteKeypair2 = Keypair.generate(); | ||
|
||
const [verifier2, signature] = await attestationQueueAccount.createVerifier({ | ||
createPermissions: true, | ||
keypair: quoteKeypair2, | ||
enable: true, | ||
queueAuthorityPubkey: devnetPayer.publicKey, | ||
authority: devnetPayer.publicKey, | ||
queueAccount: attestationQueueAccount.publicKey, | ||
registryKey: new Uint8Array(64).fill(0), | ||
}); | ||
console.log(verifier2.publicKey); | ||
|
||
logEnvVariables([ | ||
["SWITCHBOARD_ATTESTATION_QUEUE_KEY", attestationQueueAccount.publicKey], | ||
["SWITCHBOARD_VERIFIER_ORACLE_KEY", verifierOracleAccount.publicKey], | ||
["SWITCHBOARD_VERIFIER_ORACLE_KEY2", verifier2.publicKey.toString()], | ||
]); | ||
|
||
const y = bootstrappedQueue.signatures.map((s: any, i: any): any => { | ||
return { name: `bootstrap_queue #${i + 1}`, tx: s }; | ||
}); | ||
console.log(y); | ||
return; | ||
})(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx || true | ||
helm upgrade -i ingress-nginx ingress-nginx/ingress-nginx \ | ||
--namespace ingress-nginx \ | ||
--create-namespace \ | ||
--timeout 600s \ | ||
--debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Gitleaks has detected a secret with rule-id
generic-api-key
in commit 02ed0a3.If this secret is a true positive, please rotate the secret ASAP.
If this secret is a false positive, you can add the fingerprint below to your
.gitleaksignore
file and commit the change to this branch.