Skip to content

Commit

Permalink
Revert "Add support for data only hotspots (#246)"
Browse files Browse the repository at this point in the history
This reverts commit 91b49fa.
  • Loading branch information
ChewingGlass committed Jun 2, 2023
1 parent 296f3eb commit 1728939
Show file tree
Hide file tree
Showing 26 changed files with 206 additions and 1,332 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/develop-release-program.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Deploy Programs to devnet
name: Deploy Programs on Develop Push

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
detect_changed_programs:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'deploy-to-devnet')
runs-on: ubuntu-latest
outputs:
programs_with_changes: ${{ steps.list_changed_programs.outputs.programs_with_changes }}
Expand All @@ -24,7 +20,7 @@ jobs:
run: |
echo "Detecting changes in programs"
# Use git diff to get a list of changed programs and output it as JSON
changed_files=$(git diff --name-only ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.sha) || github.event.before }} ${{ github.event.after }})
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
changed_programs=($(echo "$changed_files" | grep "^programs/" | cut -d '/' -f 2 | sort -u))
echo "${changed_programs[@]}"
json="[$(printf "'%s'", "${changed_programs[@]}" | sed 's/,$//')]"
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,6 @@ jobs:
with:
testing: true

test-devflow:
needs: build
name: Test Development Workflow
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-anchor/
with:
testing: true
- name: Start Anchor Localnet
run: ~/.cargo/bin/anchor localnet --skip-build --provider.wallet ~/.config/solana/id.json & sleep 2
- name: Wait for localnet to start
run: |
while [[ "$(curl -s http://localhost:8899/health)" != "ok" ]]; do
echo "Waiting for local Anchor network to start..."
sleep 5
done
- name: Run bootstrap script
run: ./scripts/bootstrap.sh

test-contracts:
needs: build
name: Test Anchor Contracts
Expand Down
5 changes: 0 additions & 5 deletions packages/helium-admin-cli/assets/data-only.json

This file was deleted.

76 changes: 0 additions & 76 deletions packages/helium-admin-cli/src/create-dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import {
PROGRAM_ID,
accountPayerKey,
} from "@helium/data-credits-sdk";
import {
init as initHem,
dataOnlyConfigKey,
} from "@helium/helium-entity-manager-sdk";
import { fanoutKey } from "@helium/fanout-sdk";
import {
daoKey,
Expand Down Expand Up @@ -39,7 +35,6 @@ import {
import {
ComputeBudgetProgram,
Connection,
Keypair,
LAMPORTS_PER_SOL,
PublicKey,
SystemProgram,
Expand All @@ -58,9 +53,6 @@ import {
parseEmissionsSchedule,
sendInstructionsOrSquads,
} from "./utils";
import fs from "fs";
import { BN } from "bn.js";
import { getConcurrentMerkleTreeAccountSize, SPL_ACCOUNT_COMPRESSION_PROGRAM_ID } from "@solana/spl-account-compression";

const { hideBin } = require("yargs/helpers");

Expand Down Expand Up @@ -178,11 +170,6 @@ export async function run(args: any = process.argv) {
"Number of HST tokens to pre mint before assigning authority to lazy distributor",
default: 0,
},
merklePath: {
type: "string",
describe: "Path to the merkle keypair",
default: `${__dirname}/../../keypairs/data-only-merkle.json`,
}
});

const argv = await yarg.argv;
Expand All @@ -194,8 +181,6 @@ export async function run(args: any = process.argv) {
const dataCreditsProgram = await initDc(provider);
const heliumSubDaosProgram = await initDao(provider);
const heliumVsrProgram = await initVsr(provider);
const hemProgram = await initHem(provider);


const govProgramId = new PublicKey(argv.govProgramId);
const councilKeypair = await loadKeypair(argv.councilKeypair);
Expand Down Expand Up @@ -490,65 +475,4 @@ export async function run(args: any = process.argv) {
signers: [],
});
}

if (!(await exists(conn, dataOnlyConfigKey(dao)[0]))) {
console.log(`Initializing DataOnly Config`);
let merkle: Keypair;
if (fs.existsSync(argv.merklePath)) {
merkle = loadKeypair(argv.merklePath);
} else {
merkle = Keypair.generate();
fs.writeFileSync(
argv.merklePath,
JSON.stringify(Array.from(merkle.secretKey))
);
}
const [size, buffer, canopy] = [14, 64, 11];
const space = getConcurrentMerkleTreeAccountSize(size, buffer, canopy);
const cost = await provider.connection.getMinimumBalanceForRentExemption(
space
);
if (!(await exists(conn, merkle.publicKey))) {
await sendInstructions(
provider,
[
SystemProgram.createAccount({
fromPubkey: provider.wallet.publicKey,
newAccountPubkey: merkle.publicKey,
lamports: cost,
space: space,
programId: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID,
}),
],
[merkle]
);
}
await sendInstructionsOrSquads({
provider,
instructions: [
ComputeBudgetProgram.setComputeUnitLimit({ units: 400000 }),
await hemProgram.methods
.initializeDataOnlyV0({
authority,
newTreeDepth: size,
newTreeBufferSize: buffer,
newTreeSpace: new BN(getConcurrentMerkleTreeAccountSize(size, buffer, canopy)),
newTreeFeeLamports: new BN(cost / 2 ** size),
name: "DATAONLY",
metadataUrl: "https://shdw-drive.genesysgo.net/H8b1gZmA2aBqDYxicxawGpznCaNbFSEJ3YnJuawGQ2EQ/data-only.json",
})
.accounts({
dao,
authority,
merkleTree: merkle.publicKey,
})
.instruction()
],
executeTransaction: false,
squads,
multisig: argv.multisig ? new PublicKey(argv.multisig) : undefined,
authorityIndex: argv.authorityIndex,
signers: [],
});
}
}
2 changes: 0 additions & 2 deletions packages/helium-admin-cli/src/create-subdao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ export async function run(args: any = process.argv) {
// $40 for iot, $0 for mobile
onboardingDcFee:
name.toUpperCase() == "IOT" ? toBN(4000000, 0) : toBN(0, 0),
onboardingDataOnlyDcFee: name.toUpperCase() == "IOT" ? toBN(1000000, 0) : toBN(0, 0),
delegatorRewardsPercent: delegatorRewardsPercent(
argv.delegatorRewardsPercent
),
Expand Down Expand Up @@ -538,7 +537,6 @@ export async function run(args: any = process.argv) {
emissionSchedule,
dcBurnAuthority: null,
onboardingDcFee: null,
onboardingDataOnlyDcFee: null,
activeDeviceAggregator: null,
registrar: null,
delegatorRewardsPercent: null,
Expand Down
7 changes: 0 additions & 7 deletions packages/helium-admin-cli/src/update-subdao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ export async function run(args: any = process.argv) {
"Percentage of rewards allocated to delegators. Must be between 0-100 and can have 8 decimal places.",
default: null,
},
onboardingDataOnlyDcFee: {
type: "number",
required: false,
describe: "The data credits fee for onboarding data only hotspots",
default: null,
}
});
const argv = await yarg.argv;
process.env.ANCHOR_WALLET = argv.wallet;
Expand Down Expand Up @@ -223,7 +217,6 @@ export async function run(args: any = process.argv) {
? new PublicKey(argv.newDcBurnAuthority)
: null,
onboardingDcFee: null,
onboardingDataOnlyDcFee: argv.onboardingDataOnlyDcFee ? new BN(argv.onboardingDataOnlyDcFee) : null,
activeDeviceAggregator: argv.newActiveDeviceAggregator
? new PublicKey(argv.newActiveDeviceAggregator)
: null,
Expand Down
16 changes: 2 additions & 14 deletions packages/helium-entity-manager-sdk/src/pdas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,14 @@ export const rewardableEntityConfigKey = (
);

export const hotspotCollectionKey = (
makerOrDataOnly: PublicKey,
maker: PublicKey,
programId: PublicKey = PROGRAM_ID
) =>
PublicKey.findProgramAddressSync(
[Buffer.from("collection", "utf-8"), makerOrDataOnly.toBuffer()],
[Buffer.from("collection", "utf-8"), maker.toBuffer()],
programId
);

export const dataOnlyConfigKey = (dao: PublicKey, programId: PublicKey = PROGRAM_ID) =>
PublicKey.findProgramAddressSync(
[Buffer.from("data_only_config", "utf-8"), dao.toBuffer()],
programId,
);

export const dataOnlyEscrowKey = (dataOnly: PublicKey, programId: PublicKey = PROGRAM_ID) =>
PublicKey.findProgramAddressSync(
[Buffer.from("data_only_escrow", "utf-8"), dataOnly.toBuffer()],
programId,
);

export const makerKey = (dao: PublicKey, name: String, programId: PublicKey = PROGRAM_ID) =>
PublicKey.findProgramAddressSync(
[Buffer.from("maker", "utf-8"), dao.toBuffer(), Buffer.from(name, "utf-8")],
Expand Down
6 changes: 0 additions & 6 deletions packages/helium-entity-manager-sdk/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ export const heliumEntityManagerResolvers = combineResolvers(
mint: "collection",
owner: "maker",
}),
ataResolver({
instruction: "initializeDataOnlyV0",
account: "tokenAccount",
mint: "collection",
owner: "dataOnlyConfig",
}),
resolveIndividual(async ({ path, args, accounts, provider }) => {
if (path[path.length - 1] == "programApproval" && accounts.dao) {
let programId = args[args.length - 1] && args[args.length - 1].programId;
Expand Down
6 changes: 0 additions & 6 deletions programs/helium-entity-manager/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ pub enum ErrorCode {
#[msg("Genesis endpoints are currently disabled")]
NoGenesis,

#[msg("The tree can only be replaced when it is close to full")]
TreeNotFull,

#[msg("The provided tree is an invalid size")]
InvalidTreeSpace,

#[msg("Invalid seeds provided")]
InvalidSeeds,
}
Loading

0 comments on commit 1728939

Please sign in to comment.