@helium/helium-admin-cli 0.11.17 → 0.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/close-council-fanout.js +142 -0
- package/lib/cjs/close-council-fanout.js.map +1 -0
- package/lib/cjs/create-council-fanout.js +25 -7
- package/lib/cjs/create-council-fanout.js.map +1 -1
- package/lib/cjs/mini-fanout-utils.js +57 -0
- package/lib/cjs/mini-fanout-utils.js.map +1 -0
- package/lib/cjs/reschedule-all-mini-fanouts.js +38 -14
- package/lib/cjs/reschedule-all-mini-fanouts.js.map +1 -1
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/cjs/update-council-fanout.js +177 -0
- package/lib/cjs/update-council-fanout.js.map +1 -0
- package/lib/cjs/update-data-credits.js +12 -12
- package/lib/esm/src/close-council-fanout.js +92 -0
- package/lib/esm/src/close-council-fanout.js.map +1 -0
- package/lib/esm/src/create-council-fanout.js +25 -7
- package/lib/esm/src/create-council-fanout.js.map +1 -1
- package/lib/esm/src/mini-fanout-utils.js +40 -0
- package/lib/esm/src/mini-fanout-utils.js.map +1 -0
- package/lib/esm/src/reschedule-all-mini-fanouts.js +39 -15
- package/lib/esm/src/reschedule-all-mini-fanouts.js.map +1 -1
- package/lib/esm/src/update-council-fanout.js +126 -0
- package/lib/esm/src/update-council-fanout.js.map +1 -0
- package/lib/esm/src/update-data-credits.js +18 -18
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/close-council-fanout.d.ts +2 -0
- package/lib/types/src/close-council-fanout.d.ts.map +1 -0
- package/lib/types/src/create-council-fanout.d.ts.map +1 -1
- package/lib/types/src/mini-fanout-utils.d.ts +25 -0
- package/lib/types/src/mini-fanout-utils.d.ts.map +1 -0
- package/lib/types/src/reschedule-all-mini-fanouts.d.ts.map +1 -1
- package/lib/types/src/update-council-fanout.d.ts +2 -0
- package/lib/types/src/update-council-fanout.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.run = run;
|
|
49
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
50
|
+
const mini_fanout_sdk_1 = require("@helium/mini-fanout-sdk");
|
|
51
|
+
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
52
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
53
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
54
|
+
const os_1 = __importDefault(require("os"));
|
|
55
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
56
|
+
const mini_fanout_utils_1 = require("./mini-fanout-utils");
|
|
57
|
+
const utils_1 = require("./utils");
|
|
58
|
+
// HIP 149 Decision 4: permanently stop and reclaim the Advisory Council
|
|
59
|
+
// compensation fanout created by create-council-fanout.ts. Closing:
|
|
60
|
+
// - sweeps any HNT still sitting in the fanout's own token account to the
|
|
61
|
+
// owner's HNT ATA (creating it if needed);
|
|
62
|
+
// - dequeues whatever distribution task is currently scheduled;
|
|
63
|
+
// - closes the fanout account itself, refunding its rent to `rent_refund`
|
|
64
|
+
// (the address recorded at creation time — see the fanout's own
|
|
65
|
+
// `rentRefund` field, not necessarily the current owner).
|
|
66
|
+
//
|
|
67
|
+
// This is a one-way operation: there is no "un-close". If the intent is only
|
|
68
|
+
// to change members, the schedule, or pause temporarily, use
|
|
69
|
+
// update-council-fanout.ts instead.
|
|
70
|
+
//
|
|
71
|
+
// The fanout's `owner` (the governance multisig vault) must sign this. Pass
|
|
72
|
+
// `--multisig <governance multisig address>` to route it through Squads V4 as
|
|
73
|
+
// a proposal instead of trying to send it directly.
|
|
74
|
+
//
|
|
75
|
+
// This instruction bakes in the fanout's *current* next_task/next_pre_task
|
|
76
|
+
// (has_one-checked on-chain) at build time, which can go stale while a Squads
|
|
77
|
+
// proposal sits waiting for approval -- the cron can self-reschedule to a new
|
|
78
|
+
// next_task in the meantime. That makes execution fail on-chain (has_one
|
|
79
|
+
// mismatch) rather than corrupt anything, but the proposal is then
|
|
80
|
+
// permanently dead and must be rebuilt. Get proposals approved promptly; if
|
|
81
|
+
// one sits for a while, re-run this script and re-propose.
|
|
82
|
+
function run() {
|
|
83
|
+
return __awaiter(this, arguments, void 0, function* (args = process.argv) {
|
|
84
|
+
const yarg = (0, yargs_1.default)(args).options({
|
|
85
|
+
wallet: {
|
|
86
|
+
alias: "k",
|
|
87
|
+
describe: "Anchor wallet keypair (payer; proposer if using --multisig)",
|
|
88
|
+
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
89
|
+
},
|
|
90
|
+
url: {
|
|
91
|
+
alias: "u",
|
|
92
|
+
default: "http://127.0.0.1:8899",
|
|
93
|
+
describe: "The solana url",
|
|
94
|
+
},
|
|
95
|
+
miniFanout: {
|
|
96
|
+
type: "string",
|
|
97
|
+
required: true,
|
|
98
|
+
describe: "Address of the mini fanout to close",
|
|
99
|
+
},
|
|
100
|
+
multisig: {
|
|
101
|
+
type: "string",
|
|
102
|
+
describe: "Address of the squads multisig to propose through. Required in practice, since the fanout owner is the governance multisig and must sign this.",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const argv = yield yarg.argv;
|
|
106
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
107
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
108
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
109
|
+
const provider = anchor.getProvider();
|
|
110
|
+
const wallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.wallet));
|
|
111
|
+
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
112
|
+
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
113
|
+
const miniFanout = new web3_js_1.PublicKey(argv.miniFanout);
|
|
114
|
+
const miniFanoutAcc = yield program.account.miniFanoutV0.fetch(miniFanout);
|
|
115
|
+
const taskRentRefund = yield (0, mini_fanout_utils_1.resolveTaskRentRefund)(tuktukProgram, miniFanoutAcc.nextTask, miniFanout, program.programId, wallet.publicKey);
|
|
116
|
+
const ownerTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(miniFanoutAcc.mint, miniFanoutAcc.owner, true);
|
|
117
|
+
const closeIx = yield program.methods
|
|
118
|
+
.closeMiniFanoutV0()
|
|
119
|
+
.accountsPartial({
|
|
120
|
+
owner: miniFanoutAcc.owner,
|
|
121
|
+
miniFanout,
|
|
122
|
+
mint: miniFanoutAcc.mint,
|
|
123
|
+
rentRefund: miniFanoutAcc.rentRefund,
|
|
124
|
+
taskQueue: miniFanoutAcc.taskQueue,
|
|
125
|
+
tokenAccount: miniFanoutAcc.tokenAccount,
|
|
126
|
+
ownerTokenAccount,
|
|
127
|
+
taskRentRefund,
|
|
128
|
+
})
|
|
129
|
+
.instruction();
|
|
130
|
+
yield (0, utils_1.sendInstructionsOrSquadsV4)({
|
|
131
|
+
provider,
|
|
132
|
+
instructions: [closeIx],
|
|
133
|
+
multisig: argv.multisig ? new web3_js_1.PublicKey(argv.multisig) : undefined,
|
|
134
|
+
signers: [],
|
|
135
|
+
});
|
|
136
|
+
console.log("Council fanout closed.");
|
|
137
|
+
console.log(` mini fanout: ${miniFanout.toBase58()}`);
|
|
138
|
+
console.log(` HNT swept to: ${ownerTokenAccount.toBase58()}`);
|
|
139
|
+
console.log(` rent refunded: ${miniFanoutAcc.rentRefund.toBase58()}`);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=close-council-fanout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-council-fanout.js","sourceRoot":"","sources":["../../src/close-council-fanout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,kBA2EC;AA7GD,0DAA4C;AAC5C,6DAA2D;AAC3D,mDAAwD;AACxD,iDAAkE;AAClE,6CAA4C;AAC5C,4CAAoB;AACpB,wDAAgC;AAChC,2DAA4D;AAC5D,mCAAkE;AAElE,wEAAwE;AACxE,oEAAoE;AACpE,4EAA4E;AAC5E,+CAA+C;AAC/C,kEAAkE;AAClE,4EAA4E;AAC5E,oEAAoE;AACpE,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,6DAA6D;AAC7D,oCAAoC;AACpC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,mEAAmE;AACnE,4EAA4E;AAC5E,2DAA2D;AAC3D,SAAsB,GAAG;yDAAC,OAAY,OAAO,CAAC,IAAI;QAChD,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE;gBACN,KAAK,EAAE,GAAG;gBACV,QAAQ,EAAE,6DAA6D;gBACvE,OAAO,EAAE,GAAG,YAAE,CAAC,OAAO,EAAE,yBAAyB;aAClD;YACD,GAAG,EAAE;gBACH,KAAK,EAAE,GAAG;gBACV,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,gBAAgB;aAC3B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,qCAAqC;aAChD;YACD,QAAQ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AAC,KAAK;YAC1B,UAAU;YACV,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,UAAU,EAAE,aAAa,CAAC,UAAU;YACpC,SAAS,EAAE,aAAa,CAAC,SAAS;YAClC,YAAY,EAAE,aAAa,CAAC,YAAY;YACxC,iBAAiB;YACjB,cAAc;SACf,CAAC;aACD,WAAW,EAAE,CAAC;QAEjB,MAAM,IAAA,kCAA0B,EAAC;YAC/B,QAAQ;YACR,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,mBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;YAClE,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,oBAAoB,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,oBAAoB,iBAAiB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,oBAAoB,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC;CAAA"}
|
|
@@ -53,6 +53,7 @@ const spl_utils_1 = require("@helium/spl-utils");
|
|
|
53
53
|
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
54
54
|
const spl_token_1 = require("@solana/spl-token");
|
|
55
55
|
const web3_js_1 = require("@solana/web3.js");
|
|
56
|
+
const multisig = __importStar(require("@sqds/multisig"));
|
|
56
57
|
const os_1 = __importDefault(require("os"));
|
|
57
58
|
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
58
59
|
const utils_1 = require("./utils");
|
|
@@ -65,9 +66,11 @@ const utils_1 = require("./utils");
|
|
|
65
66
|
// patch-time edit that sets INFLATION_START), then set the cron's council_vault to it.
|
|
66
67
|
//
|
|
67
68
|
// Operational rules (see HIP 149 Decision 4):
|
|
68
|
-
// - `owner` MUST be the governance multisig, never the Receiving Entity. It is the
|
|
69
|
-
// authority that can edit the seated-member set; the community seats/removes members
|
|
70
|
-
// vote and the multisig executes the corresponding update.
|
|
69
|
+
// - `owner` MUST be the governance multisig's vault, never the Receiving Entity. It is the
|
|
70
|
+
// only authority that can edit the seated-member set; the community seats/removes members
|
|
71
|
+
// by vote and the multisig executes the corresponding update. Prefer --multisig over
|
|
72
|
+
// --owner: it derives the vault the same way update-council-fanout.ts and
|
|
73
|
+
// close-council-fanout.ts do, instead of relying on a manually-typed vault address.
|
|
71
74
|
// - On a seat change, CRANK before updating the member vec, so accrual maps to the set that
|
|
72
75
|
// was seated when it accrued (a vacant seat's share then redistributes to the seated
|
|
73
76
|
// members from that point forward, per the HIP).
|
|
@@ -88,8 +91,11 @@ function run() {
|
|
|
88
91
|
},
|
|
89
92
|
owner: {
|
|
90
93
|
type: "string",
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
describe: "Fanout owner = governance multisig (Squads vault) address directly. Edits the seated-member set. NEVER the Receiving Entity. Prefer --multisig, which derives this the same way update-council-fanout.ts and close-council-fanout.ts do; use --owner only to bypass that derivation.",
|
|
95
|
+
},
|
|
96
|
+
multisig: {
|
|
97
|
+
type: "string",
|
|
98
|
+
describe: "Address of the squads multisig whose vault (index 0) should own the fanout. Derives --owner for you, the same way update-council-fanout.ts and close-council-fanout.ts derive it from --multisig. Exactly one of --owner / --multisig is required.",
|
|
93
99
|
},
|
|
94
100
|
members: {
|
|
95
101
|
type: "string",
|
|
@@ -120,7 +126,16 @@ function run() {
|
|
|
120
126
|
const wallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.wallet));
|
|
121
127
|
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
122
128
|
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
123
|
-
|
|
129
|
+
if (Boolean(argv.owner) === Boolean(argv.multisig)) {
|
|
130
|
+
throw new Error("exactly one of --owner / --multisig is required");
|
|
131
|
+
}
|
|
132
|
+
const owner = argv.multisig
|
|
133
|
+
? (yield multisig.getVaultPda({
|
|
134
|
+
multisigPda: new web3_js_1.PublicKey(argv.multisig),
|
|
135
|
+
index: 0,
|
|
136
|
+
programId: multisig.PROGRAM_ID,
|
|
137
|
+
}))[0]
|
|
138
|
+
: new web3_js_1.PublicKey(argv.owner); // validated above: exactly one of owner/multisig is set
|
|
124
139
|
const members = argv.members
|
|
125
140
|
.split(",")
|
|
126
141
|
.map((m) => m.trim())
|
|
@@ -175,7 +190,10 @@ function run() {
|
|
|
175
190
|
});
|
|
176
191
|
const tokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(spl_utils_1.HNT_MINT, miniFanout, true);
|
|
177
192
|
console.log("Council fanout created.");
|
|
178
|
-
|
|
193
|
+
if (argv.multisig) {
|
|
194
|
+
console.log(` multisig: ${argv.multisig}`);
|
|
195
|
+
}
|
|
196
|
+
console.log(` owner (governance multisig vault): ${owner.toBase58()}`);
|
|
179
197
|
console.log(` mini fanout: ${miniFanout.toBase58()}`);
|
|
180
198
|
console.log(` schedule: ${argv.schedule}`);
|
|
181
199
|
console.log(` members (${members.length}):`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-council-fanout.js","sourceRoot":"","sources":["../../src/create-council-fanout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"create-council-fanout.js","sourceRoot":"","sources":["../../src/create-council-fanout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,kBA4JC;AAnMD,0DAA4C;AAC5C,yDAAsD;AACtD,6DAA2D;AAC3D,iDAA8E;AAC9E,mDAI4B;AAC5B,iDAAkE;AAClE,6CAIyB;AACzB,yDAA2C;AAC3C,4CAAoB;AAC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AO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,SAAS,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC;CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.allocateNextTasks = allocateNextTasks;
|
|
13
|
+
exports.resolveTaskRentRefund = resolveTaskRentRefund;
|
|
14
|
+
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
15
|
+
// Shared helpers for admin scripts that create, update, reschedule, or close a
|
|
16
|
+
// mini-fanout (see create-council-fanout.ts, update-council-fanout.ts,
|
|
17
|
+
// close-council-fanout.ts). Kept separate from utils.ts because these only
|
|
18
|
+
// make sense in the context of the mini-fanout program's task-queue plumbing.
|
|
19
|
+
/**
|
|
20
|
+
* Allocate a fresh (task, preTask) id/pubkey pair from the given tuktuk task
|
|
21
|
+
* queue, for scheduling a mini-fanout's next distribution.
|
|
22
|
+
*/
|
|
23
|
+
function allocateNextTasks(tuktukProgram, taskQueue) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const taskQueueAcc = yield tuktukProgram.account.taskQueueV0.fetch(taskQueue);
|
|
26
|
+
const [taskId, preTaskId] = (0, tuktuk_sdk_1.nextAvailableTaskIds)(taskQueueAcc.taskBitmap, 2);
|
|
27
|
+
return {
|
|
28
|
+
taskId,
|
|
29
|
+
preTaskId,
|
|
30
|
+
task: (0, tuktuk_sdk_1.taskKey)(taskQueue, taskId)[0],
|
|
31
|
+
preTask: (0, tuktuk_sdk_1.taskKey)(taskQueue, preTaskId)[0],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The tuktuk program's dequeue_task_v0 requires the passed-in rent_refund
|
|
37
|
+
* account to match the task's own `rent_refund` field exactly (it's a
|
|
38
|
+
* `has_one` constraint), which is set at queue time to whoever paid to queue
|
|
39
|
+
* it — not necessarily the wallet running this script. Resolve it from the
|
|
40
|
+
* on-chain task rather than assuming it's the current payer.
|
|
41
|
+
*
|
|
42
|
+
* A mini-fanout with nothing currently scheduled points `next_task` /
|
|
43
|
+
* `next_pre_task` back at itself (or at the program id, legacy); in that case
|
|
44
|
+
* there's nothing to dequeue, so the returned value is unused by the caller
|
|
45
|
+
* and any pubkey is safe to pass through.
|
|
46
|
+
*/
|
|
47
|
+
function resolveTaskRentRefund(tuktukProgram, taskPubkey, miniFanoutPubkey, miniFanoutProgramId, fallback) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (taskPubkey.equals(miniFanoutPubkey) ||
|
|
50
|
+
taskPubkey.equals(miniFanoutProgramId)) {
|
|
51
|
+
return fallback;
|
|
52
|
+
}
|
|
53
|
+
const task = yield tuktukProgram.account.taskV0.fetchNullable(taskPubkey);
|
|
54
|
+
return task ? task.rentRefund : fallback;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=mini-fanout-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mini-fanout-utils.js","sourceRoot":"","sources":["../../src/mini-fanout-utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAcA,8CAmBC;AAcD,sDAeC;AA5DD,mDAAmE;AAGnE,+EAA+E;AAC/E,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAE9E;;;GAGG;AACH,SAAsB,iBAAiB,CACrC,aAAkB,EAClB,SAAoB;;QAOpB,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAChE,SAAS,CACV,CAAC;QACF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,iCAAoB,EAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC7E,OAAO;YACL,MAAM;YACN,SAAS;YACT,IAAI,EAAE,IAAA,oBAAO,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YACnC,OAAO,EAAE,IAAA,oBAAO,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;SAC1C,CAAC;IACJ,CAAC;CAAA;AAED;;;;;;;;;;;GAWG;AACH,SAAsB,qBAAqB,CACzC,aAAkB,EAClB,UAAqB,EACrB,gBAA2B,EAC3B,mBAA8B,EAC9B,QAAmB;;QAEnB,IACE,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACnC,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,EACtC,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,CAAC,CAAE,IAAI,CAAC,UAAwB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC1D,CAAC;CAAA"}
|
|
@@ -51,6 +51,7 @@ const hpl_crons_sdk_1 = require("@helium/hpl-crons-sdk");
|
|
|
51
51
|
const mini_fanout_sdk_1 = require("@helium/mini-fanout-sdk");
|
|
52
52
|
const spl_utils_1 = require("@helium/spl-utils");
|
|
53
53
|
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
54
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
54
55
|
const os_1 = __importDefault(require("os"));
|
|
55
56
|
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
56
57
|
const utils_1 = require("./utils");
|
|
@@ -67,6 +68,10 @@ function run() {
|
|
|
67
68
|
default: "http://127.0.0.1:8899",
|
|
68
69
|
describe: "The solana url",
|
|
69
70
|
},
|
|
71
|
+
miniFanout: {
|
|
72
|
+
type: "string",
|
|
73
|
+
describe: "Reschedule only this mini fanout instead of every mini fanout on the network. Use this to recover a single fanout (e.g. the council fanout) that went idle after running out of lamports, without touching anyone else's.",
|
|
74
|
+
},
|
|
70
75
|
});
|
|
71
76
|
const argv = yield yarg.argv;
|
|
72
77
|
process.env.ANCHOR_WALLET = argv.wallet;
|
|
@@ -77,28 +82,47 @@ function run() {
|
|
|
77
82
|
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
78
83
|
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
79
84
|
const instructions = [];
|
|
80
|
-
const
|
|
85
|
+
const allMiniFanouts = yield program.account.miniFanoutV0.all();
|
|
86
|
+
const miniFanouts = argv.miniFanout
|
|
87
|
+
? allMiniFanouts.filter((mf) => mf.publicKey.equals(new web3_js_1.PublicKey(argv.miniFanout)))
|
|
88
|
+
: allMiniFanouts;
|
|
89
|
+
if (argv.miniFanout && miniFanouts.length === 0) {
|
|
90
|
+
throw new Error(`No mini fanout found at ${argv.miniFanout}`);
|
|
91
|
+
}
|
|
92
|
+
// scheduleTaskV0 only accepts a fanout whose next_task/next_pre_task are
|
|
93
|
+
// already the "nothing scheduled" sentinel (pointing at the fanout itself,
|
|
94
|
+
// or legacy: at the program id) -- see its on-chain constraint. Anything
|
|
95
|
+
// else means a task is genuinely still live, and dequeuing a live task
|
|
96
|
+
// requires a CPI signature from the mini-fanout program's own
|
|
97
|
+
// queue_authority PDA (see queue_authority_seeds! in state.rs), which only
|
|
98
|
+
// update_mini_fanout_v0 / close_mini_fanout_v0 can produce -- both of which
|
|
99
|
+
// require the owner (governance multisig) to sign. There is no way to
|
|
100
|
+
// dequeue a live task from a bare client instruction, so don't try; skip
|
|
101
|
+
// and say so instead of submitting a transaction guaranteed to fail on a
|
|
102
|
+
// missing signature.
|
|
103
|
+
const isIdleSentinel = (miniFanout, task) => task.equals(program.programId) || task.equals(miniFanout.publicKey);
|
|
104
|
+
const idle = miniFanouts.filter((mf) => {
|
|
105
|
+
const ok = isIdleSentinel(mf, mf.account.nextTask) &&
|
|
106
|
+
isIdleSentinel(mf, mf.account.nextPreTask);
|
|
107
|
+
if (!ok) {
|
|
108
|
+
console.log(`Skipping ${mf.publicKey.toBase58()}: still has a live scheduled task; ` +
|
|
109
|
+
`use update-council-fanout.ts (owner-signed) to reschedule it instead.`);
|
|
110
|
+
}
|
|
111
|
+
return ok;
|
|
112
|
+
});
|
|
81
113
|
const batchSize = 10;
|
|
82
114
|
const taskQueue = yield tuktukProgram.account.taskQueueV0.fetch(hpl_crons_sdk_1.TASK_QUEUE_ID);
|
|
83
|
-
const freeTasks = (0, tuktuk_sdk_1.nextAvailableTaskIds)(taskQueue.taskBitmap,
|
|
84
|
-
for (let i = 0; i <
|
|
115
|
+
const freeTasks = (0, tuktuk_sdk_1.nextAvailableTaskIds)(taskQueue.taskBitmap, idle.length * 2);
|
|
116
|
+
for (let i = 0; i < idle.length; i += batchSize) {
|
|
85
117
|
// Log progress every 100 positions
|
|
86
118
|
if (i > 0 && i % 100 === 0) {
|
|
87
119
|
console.log(`Processed ${i} mini fanouts`);
|
|
88
120
|
}
|
|
89
|
-
const batch =
|
|
121
|
+
const batch = idle.slice(i, i + batchSize);
|
|
90
122
|
yield Promise.all(batch.map((miniFanout) => __awaiter(this, void 0, void 0, function* () {
|
|
91
123
|
const nextTask = freeTasks.pop();
|
|
92
124
|
const nextPreTask = freeTasks.pop();
|
|
93
|
-
const nextTaskAcc = miniFanout.account.nextTask.equals(program.programId) || miniFanout.account.nextTask.equals(miniFanout.publicKey) ? undefined : yield tuktukProgram.account.taskV0.fetchNullable(miniFanout.account.nextTask);
|
|
94
|
-
const nextPreTaskAcc = miniFanout.account.nextPreTask.equals(program.programId) || miniFanout.account.nextPreTask.equals(miniFanout.publicKey) ? undefined : yield tuktukProgram.account.taskV0.fetchNullable(miniFanout.account.nextPreTask);
|
|
95
125
|
instructions.push([
|
|
96
|
-
nextTaskAcc ? yield tuktukProgram.methods.dequeueTaskV0().accounts({
|
|
97
|
-
task: miniFanout.account.nextTask,
|
|
98
|
-
}).instruction() : undefined,
|
|
99
|
-
nextPreTaskAcc ? yield tuktukProgram.methods.dequeueTaskV0().accounts({
|
|
100
|
-
task: miniFanout.account.nextPreTask,
|
|
101
|
-
}).instruction() : undefined,
|
|
102
126
|
yield program.methods.scheduleTaskV0({
|
|
103
127
|
taskId: nextTask,
|
|
104
128
|
preTaskId: nextPreTask,
|
|
@@ -110,10 +134,10 @@ function run() {
|
|
|
110
134
|
preTask: (0, tuktuk_sdk_1.taskKey)(hpl_crons_sdk_1.TASK_QUEUE_ID, nextPreTask)[0],
|
|
111
135
|
})
|
|
112
136
|
.instruction()
|
|
113
|
-
]
|
|
137
|
+
]);
|
|
114
138
|
})));
|
|
115
139
|
}
|
|
116
|
-
console.log(`Finished processing ${
|
|
140
|
+
console.log(`Finished processing ${idle.length} mini fanouts (${miniFanouts.length - idle.length} skipped as not idle)`);
|
|
117
141
|
const transactions = yield (0, spl_utils_1.batchInstructionsToTxsWithPriorityFee)(provider, instructions, {
|
|
118
142
|
useFirstEstimateForAll: true,
|
|
119
143
|
computeUnitLimit: 1200000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reschedule-all-mini-fanouts.js","sourceRoot":"","sources":["../../src/reschedule-all-mini-fanouts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"reschedule-all-mini-fanouts.js","sourceRoot":"","sources":["../../src/reschedule-all-mini-fanouts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,kBA6GC;AAvHD,0DAA4C;AAC5C,yDAAsD;AACtD,6DAA2D;AAC3D,iDAAgG;AAChG,mDAAuF;AACvF,6CAAoE;AACpE,4CAAoB;AACpB,wDAAgC;AAChC,mCAAsC;AAEtC,SAAsB,GAAG;yDAAC,OAAY,OAAO,CAAC,IAAI;QAChD,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE;gBACN,KAAK,EAAE,GAAG;gBACV,QAAQ,EAAE,uBAAuB;gBACjC,OAAO,EAAE,GAAG,YAAE,CAAC,OAAO,EAAE,yBAAyB;aAClD;YACD,GAAG,EAAE;gBACH,KAAK,EAAE,GAAG;gBACV,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,gBAAgB;aAC3B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EACN,2NAA2N;aAC9N;SACF,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,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EAAG,CAAC;gBAErC,YAAY,CAAC,IAAI,CAAC;oBAChB,MAAM,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;wBACnC,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,WAAW;qBACvB,CAAC;yBACC,QAAQ,CAAC;wBACR,KAAK,EAAE,MAAM,CAAC,SAAS;wBACvB,UAAU,EAAE,UAAU,CAAC,SAAS;wBAChC,IAAI,EAAE,IAAA,oBAAO,EAAC,6BAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;wBACzC,OAAO,EAAE,IAAA,oBAAO,EAAC,6BAAa,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;qBAChD,CAAC;yBACD,WAAW,EAAE;iBACjB,CAAC,CAAC;YACL,CAAC,CAAA,CAAC,CAAC,CAAC;QACN,CAAC;QACD,OAAO,CAAC,GAAG,CACT,uBAAuB,IAAI,CAAC,MAAM,kBAChC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,MAC5B,uBAAuB,CACxB,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,IAAA,iDAAqC,EAC9D,QAAQ,EACR,YAAY,EACZ;YACE,sBAAsB,EAAE,IAAI;YAC5B,gBAAgB,EAAE,OAAO;SAC1B,CACF,CAAC;QAEF,MAAM,IAAA,gCAAoB,EAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../src/add-expiration-to-delegations.ts","../../src/add-squads-proposer.ts","../../src/approve-carrier.ts","../../src/approve-maker.ts","../../src/approve-program.ts","../../src/backfill-mobile-deployment-infos.ts","../../src/backfill-recent-proposals.ts","../../src/backfill-vote-markers.ts","../../src/claim-rewards.ts","../../src/close-auto-topoff.ts","../../src/close-buffers.ts","../../src/close-canopy.ts","../../src/close-expired-boosts.ts","../../src/close-lazy-transaction-markers.ts","../../src/close-legacy-auto-topoff.ts","../../src/correct-router-dc.ts","../../src/count-active-hotspots.ts","../../src/create-and-approve-makers.ts","../../src/create-boost-config.ts","../../src/create-carrier.ts","../../src/create-common-lut.ts","../../src/create-council-fanout.ts","../../src/create-dao.ts","../../src/create-data-only-config.ts","../../src/create-maker.ts","../../src/create-price-oracle.ts","../../src/create-subdao.ts","../../src/create-tuktuk-dca-lut.ts","../../src/distribute-hst.ts","../../src/distribute-iot-operations-fund.ts","../../src/dump-vote-markers.ts","../../src/ecc-gen.ts","../../src/end-epoch.ts","../../src/execute-vault-transaction.ts","../../src/extend-common-lut.ts","../../src/get-merkle-depths.ts","../../src/get-staked-wallets.ts","../../src/initialize-tuktuk-dca.ts","../../src/is-executed.ts","../../src/issue-carrier-nft.ts","../../src/issue-iot-operations-fund.ts","../../src/issue-mapping-rewards-nft.ts","../../src/issue-service-rewards-nft.ts","../../src/issue-test-hotspot.ts","../../src/log-coingecko-price.ts","../../src/log-hotspot.ts","../../src/log-router-balance.ts","../../src/log-treasury-price.ts","../../src/mint-dc.ts","../../src/queue-hotspot-claims.ts","../../src/queue-position-claims.ts","../../src/queue-proxy-jobs.ts","../../src/queue-wallet-claims.ts","../../src/release-iot-mobile-positions.ts","../../src/repair-all-position-claims.ts","../../src/requeue-hotspot-claims.ts","../../src/reschedule-all-mini-fanouts.ts","../../src/reset-vsr-voting-mint.ts","../../src/revoke-maker.ts","../../src/set-dc-onboarding-fees-paid-epoch-info.ts","../../src/set-dc-onboarding-fees-paid.ts","../../src/set-proxy-config.ts","../../src/setup-dc-auto-topoff.ts","../../src/setup-hst.ts","../../src/squads-batch-optimizer.ts","../../src/start-cron.ts","../../src/submit-price.ts","../../src/sum-tokens.ts","../../src/swap-carrier-stake.ts","../../src/swap-maker-stake.ts","../../src/switch-mobile-ops-fund.ts","../../src/take-snapshot.ts","../../src/transfer-program-authorities.ts","../../src/unrug-hotspots.ts","../../src/update-account-circuit-breaker.ts","../../src/update-boost-config.ts","../../src/update-carrier.ts","../../src/update-dao.ts","../../src/update-data-credits.ts","../../src/update-delegated-dc-subdao.ts","../../src/update-destinations.ts","../../src/update-lazy-distributor.ts","../../src/update-lazy-transactions.ts","../../src/update-maker.ts","../../src/update-matching-destinations.ts","../../src/update-mint-circuit-breaker.ts","../../src/update-organization.ts","../../src/update-price-oracle.ts","../../src/update-proxy-config.ts","../../src/update-registrar-authorities.ts","../../src/update-rewardable-entity-config.ts","../../src/update-subdao-vehnt.ts","../../src/update-subdao.ts","../../src/update-token-metadata.ts","../../src/upgrade-idl.ts","../../src/upsert-incentive-program.ts","../../src/utils.ts","../../src/write-merkle-canopy-depths.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../../src/add-expiration-to-delegations.ts","../../src/add-squads-proposer.ts","../../src/approve-carrier.ts","../../src/approve-maker.ts","../../src/approve-program.ts","../../src/backfill-mobile-deployment-infos.ts","../../src/backfill-recent-proposals.ts","../../src/backfill-vote-markers.ts","../../src/claim-rewards.ts","../../src/close-auto-topoff.ts","../../src/close-buffers.ts","../../src/close-canopy.ts","../../src/close-council-fanout.ts","../../src/close-expired-boosts.ts","../../src/close-lazy-transaction-markers.ts","../../src/close-legacy-auto-topoff.ts","../../src/correct-router-dc.ts","../../src/count-active-hotspots.ts","../../src/create-and-approve-makers.ts","../../src/create-boost-config.ts","../../src/create-carrier.ts","../../src/create-common-lut.ts","../../src/create-council-fanout.ts","../../src/create-dao.ts","../../src/create-data-only-config.ts","../../src/create-maker.ts","../../src/create-price-oracle.ts","../../src/create-subdao.ts","../../src/create-tuktuk-dca-lut.ts","../../src/distribute-hst.ts","../../src/distribute-iot-operations-fund.ts","../../src/dump-vote-markers.ts","../../src/ecc-gen.ts","../../src/end-epoch.ts","../../src/execute-vault-transaction.ts","../../src/extend-common-lut.ts","../../src/get-merkle-depths.ts","../../src/get-staked-wallets.ts","../../src/initialize-tuktuk-dca.ts","../../src/is-executed.ts","../../src/issue-carrier-nft.ts","../../src/issue-iot-operations-fund.ts","../../src/issue-mapping-rewards-nft.ts","../../src/issue-service-rewards-nft.ts","../../src/issue-test-hotspot.ts","../../src/log-coingecko-price.ts","../../src/log-hotspot.ts","../../src/log-router-balance.ts","../../src/log-treasury-price.ts","../../src/mini-fanout-utils.ts","../../src/mint-dc.ts","../../src/queue-hotspot-claims.ts","../../src/queue-position-claims.ts","../../src/queue-proxy-jobs.ts","../../src/queue-wallet-claims.ts","../../src/release-iot-mobile-positions.ts","../../src/repair-all-position-claims.ts","../../src/requeue-hotspot-claims.ts","../../src/reschedule-all-mini-fanouts.ts","../../src/reset-vsr-voting-mint.ts","../../src/revoke-maker.ts","../../src/set-dc-onboarding-fees-paid-epoch-info.ts","../../src/set-dc-onboarding-fees-paid.ts","../../src/set-proxy-config.ts","../../src/setup-dc-auto-topoff.ts","../../src/setup-hst.ts","../../src/squads-batch-optimizer.ts","../../src/start-cron.ts","../../src/submit-price.ts","../../src/sum-tokens.ts","../../src/swap-carrier-stake.ts","../../src/swap-maker-stake.ts","../../src/switch-mobile-ops-fund.ts","../../src/take-snapshot.ts","../../src/transfer-program-authorities.ts","../../src/unrug-hotspots.ts","../../src/update-account-circuit-breaker.ts","../../src/update-boost-config.ts","../../src/update-carrier.ts","../../src/update-council-fanout.ts","../../src/update-dao.ts","../../src/update-data-credits.ts","../../src/update-delegated-dc-subdao.ts","../../src/update-destinations.ts","../../src/update-lazy-distributor.ts","../../src/update-lazy-transactions.ts","../../src/update-maker.ts","../../src/update-matching-destinations.ts","../../src/update-mint-circuit-breaker.ts","../../src/update-organization.ts","../../src/update-price-oracle.ts","../../src/update-proxy-config.ts","../../src/update-registrar-authorities.ts","../../src/update-rewardable-entity-config.ts","../../src/update-subdao-vehnt.ts","../../src/update-subdao.ts","../../src/update-token-metadata.ts","../../src/upgrade-idl.ts","../../src/upsert-incentive-program.ts","../../src/utils.ts","../../src/write-merkle-canopy-depths.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.run = run;
|
|
49
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
50
|
+
const mini_fanout_sdk_1 = require("@helium/mini-fanout-sdk");
|
|
51
|
+
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
52
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
53
|
+
const os_1 = __importDefault(require("os"));
|
|
54
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
55
|
+
const mini_fanout_utils_1 = require("./mini-fanout-utils");
|
|
56
|
+
const utils_1 = require("./utils");
|
|
57
|
+
// HIP 149 Decision 4: update the Advisory Council compensation fanout created by
|
|
58
|
+
// create-council-fanout.ts. Use this on a seat change (add/remove a member) or to
|
|
59
|
+
// change the distribution schedule.
|
|
60
|
+
//
|
|
61
|
+
// Operational rules (see HIP 149 Decision 4, and the header comment on
|
|
62
|
+
// create-council-fanout.ts):
|
|
63
|
+
// - CRANK before running this on a seat change. `update_mini_fanout_v0` replaces
|
|
64
|
+
// the share vec wholesale, so accrual (total_owed) for members not carried
|
|
65
|
+
// forward is lost. Let the current period's distribution run first so accrual
|
|
66
|
+
// maps to the set that was actually seated when it accrued, then update.
|
|
67
|
+
// - The fanout's `owner` (a governance multisig vault) must sign this. Pass
|
|
68
|
+
// `--multisig <governance multisig address>` to route it through Squads V4
|
|
69
|
+
// as a proposal instead of trying to send it directly.
|
|
70
|
+
// - Omitting --members leaves the current share set untouched (only the
|
|
71
|
+
// schedule changes, if given). Omitting --schedule leaves the cron
|
|
72
|
+
// untouched. Passing neither still re-queues the next distribution task,
|
|
73
|
+
// which is a valid way to force a reschedule on an already-scheduled fanout
|
|
74
|
+
// (an idle/unscheduled one should use reschedule-all-mini-fanouts.ts instead,
|
|
75
|
+
// since that path doesn't need the owner's signature).
|
|
76
|
+
// - This instruction bakes in the fanout's *current* next_task/next_pre_task
|
|
77
|
+
// (has_one-checked on-chain) and a task id claimed from the queue's current
|
|
78
|
+
// bitmap at build time -- both can go stale while a Squads proposal sits
|
|
79
|
+
// waiting for approval (the cron can self-reschedule to a new next_task, or
|
|
80
|
+
// another queue_task_v0 call can claim the same id first). Either makes
|
|
81
|
+
// execution fail on-chain (has_one mismatch or TaskAlreadyExists) rather
|
|
82
|
+
// than corrupt anything, but the proposal is then permanently dead and must
|
|
83
|
+
// be rebuilt from a fresh run of this script. Get proposals approved
|
|
84
|
+
// promptly; if one sits for a while, re-run this script and re-propose
|
|
85
|
+
// rather than trusting a stale one to still execute.
|
|
86
|
+
function run() {
|
|
87
|
+
return __awaiter(this, arguments, void 0, function* (args = process.argv) {
|
|
88
|
+
var _a;
|
|
89
|
+
const yarg = (0, yargs_1.default)(args).options({
|
|
90
|
+
wallet: {
|
|
91
|
+
alias: "k",
|
|
92
|
+
describe: "Anchor wallet keypair (payer; proposer if using --multisig)",
|
|
93
|
+
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
94
|
+
},
|
|
95
|
+
url: {
|
|
96
|
+
alias: "u",
|
|
97
|
+
default: "http://127.0.0.1:8899",
|
|
98
|
+
describe: "The solana url",
|
|
99
|
+
},
|
|
100
|
+
miniFanout: {
|
|
101
|
+
type: "string",
|
|
102
|
+
required: true,
|
|
103
|
+
describe: "Address of the mini fanout to update",
|
|
104
|
+
},
|
|
105
|
+
members: {
|
|
106
|
+
type: "string",
|
|
107
|
+
describe: "Comma-separated seated community-member wallet addresses to replace the current share set with (each gets an equal share). Omit to leave shares unchanged.",
|
|
108
|
+
},
|
|
109
|
+
schedule: {
|
|
110
|
+
type: "string",
|
|
111
|
+
describe: "New cron schedule (sec min hour day month dow) for the distribution crank. Omit to leave the schedule unchanged.",
|
|
112
|
+
},
|
|
113
|
+
multisig: {
|
|
114
|
+
type: "string",
|
|
115
|
+
describe: "Address of the squads multisig to propose through. Required in practice, since the fanout owner is the governance multisig and must sign this update.",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
const argv = yield yarg.argv;
|
|
119
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
120
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
121
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
122
|
+
const provider = anchor.getProvider();
|
|
123
|
+
const wallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.wallet));
|
|
124
|
+
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
125
|
+
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
126
|
+
const miniFanout = new web3_js_1.PublicKey(argv.miniFanout);
|
|
127
|
+
const miniFanoutAcc = yield program.account.miniFanoutV0.fetch(miniFanout);
|
|
128
|
+
const shares = argv.members
|
|
129
|
+
? argv.members
|
|
130
|
+
.split(",")
|
|
131
|
+
.map((m) => m.trim())
|
|
132
|
+
.filter(Boolean)
|
|
133
|
+
.map((m) => ({
|
|
134
|
+
wallet: new web3_js_1.PublicKey(m),
|
|
135
|
+
share: { share: { amount: 1 } },
|
|
136
|
+
}))
|
|
137
|
+
: null;
|
|
138
|
+
if (argv.members && shares.length === 0) {
|
|
139
|
+
throw new Error("--members was given but resolved to zero wallets");
|
|
140
|
+
}
|
|
141
|
+
const { taskId, preTaskId, task, preTask } = yield (0, mini_fanout_utils_1.allocateNextTasks)(tuktukProgram, miniFanoutAcc.taskQueue);
|
|
142
|
+
const taskRentRefund = yield (0, mini_fanout_utils_1.resolveTaskRentRefund)(tuktukProgram, miniFanoutAcc.nextTask, miniFanout, program.programId, wallet.publicKey);
|
|
143
|
+
const updateIx = yield program.methods
|
|
144
|
+
.updateMiniFanoutV0({
|
|
145
|
+
newTaskId: taskId,
|
|
146
|
+
newPreTaskId: preTaskId,
|
|
147
|
+
shares,
|
|
148
|
+
schedule: (_a = argv.schedule) !== null && _a !== void 0 ? _a : null,
|
|
149
|
+
})
|
|
150
|
+
.accountsPartial({
|
|
151
|
+
owner: miniFanoutAcc.owner,
|
|
152
|
+
payer: wallet.publicKey,
|
|
153
|
+
miniFanout,
|
|
154
|
+
taskQueue: miniFanoutAcc.taskQueue,
|
|
155
|
+
newTask: task,
|
|
156
|
+
newPreTask: preTask,
|
|
157
|
+
taskRentRefund,
|
|
158
|
+
})
|
|
159
|
+
.instruction();
|
|
160
|
+
yield (0, utils_1.sendInstructionsOrSquadsV4)({
|
|
161
|
+
provider,
|
|
162
|
+
instructions: [updateIx],
|
|
163
|
+
multisig: argv.multisig ? new web3_js_1.PublicKey(argv.multisig) : undefined,
|
|
164
|
+
signers: [],
|
|
165
|
+
});
|
|
166
|
+
console.log("Council fanout updated.");
|
|
167
|
+
console.log(` mini fanout: ${miniFanout.toBase58()}`);
|
|
168
|
+
if (shares) {
|
|
169
|
+
console.log(` members (${shares.length}):`);
|
|
170
|
+
shares.forEach((s) => console.log(` - ${s.wallet.toBase58()}`));
|
|
171
|
+
}
|
|
172
|
+
if (argv.schedule) {
|
|
173
|
+
console.log(` schedule: ${argv.schedule}`);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=update-council-fanout.js.map
|