-
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
boot script #429
boot script #429
Conversation
… breaks the get funtion
…amModAddress get the key back from tx rather then in events
``` | ||
I would take a deep breath here to allow for the 4 nodes to connect before running the next command bellow. On that note the deploy faucet script takes 3 arguments as you can see right now this script assumes you know what your doing if you are running it. So not a lot of bells and whitelist here. | ||
|
||
the first argument is the `endpoint` to target, the second is the `fundingSeed` and the third `faucetLookUpSeed` <!--yes seeds()! not mnemonic go play alone this script will never take a mnemonic maybe one day i'll make it preterite to use like asci fireworks or something else integrated with the cli--> |
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.
can't really decipher what youre trying to say here, so we can go through it when youre online
max_transfer_amount: 20000000000, | ||
genesis_hash: 'a4b29c6895ae775fd291377fde31882f66244eaecbdc81e017ebb64d13b27b72' | ||
}, | ||
'initial balance for funding account': 99999880954644628n, |
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.
are we able to update the report to show human readable numbers with commas and such?
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.
or just an inline comment here saying what that unit is. This doesn't need to be super pretty, it's diagnostic
genesis_hash: 'a4b29c6895ae775fd291377fde31882f66244eaecbdc81e017ebb64d13b27b72' | ||
}, | ||
'initial balance for funding account': 99999880954644628n, | ||
'initial funding faucet amount': 24999970238661157n, |
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.
same here, re: human readable numbers
dev/deploy-facuets.mjs
Outdated
if (!endpoint) throw new Error('please provide arguments for endpoint, fundingSeed, faucetLookUpSeed') | ||
if (!fundingSeed) throw new Error('please provide arguments for fundingSeed, faucetLookUpSeed') | ||
if (!faucetLookUpSeed) throw new Error('please provide arguments for faucetLookUpSeed') |
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.
if (!endpoint) throw new Error('please provide arguments for endpoint, fundingSeed, faucetLookUpSeed') | |
if (!fundingSeed) throw new Error('please provide arguments for fundingSeed, faucetLookUpSeed') | |
if (!faucetLookUpSeed) throw new Error('please provide arguments for faucetLookUpSeed') | |
if (!endpoint || !fundingSeed || !faucetLookUpSeed) throw new Error('endpoint, fundingSeed, and faucetLookupSeed are required arguments') |
Co-authored-by: Nayyir Jutha <nayyir.jutha@gmail.com>
Co-authored-by: Nayyir Jutha <nayyir.jutha@gmail.com>
…when running the script and move reporter proxy to a reusable function in testing-utils.mjs
…frankie/boot-script
dev/faucet_program.wasm
Outdated
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.
🌶️ Trade offs!
- this is a large file to include in repo / every CLI install?
- might be needed if
deploy-faucets.mjs
is gonna be exported?
just double checking before we commit to this.... I wonder if this "deploy faucets" would be better in an optional stand-alone. It's likely too late for this release (no desire to rush), fine to kick that question down the road
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.
i'm kicking down the road this one
@@ -78,7 +78,7 @@ export default class ProgramDev extends ExtrinsicBaseClass { | |||
const responseOption = await this.substrate.query.programs.programs(pointer) | |||
|
|||
const programInfo = responseOption.toJSON() | |||
|
|||
if (programInfo === null) return null |
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.
🌶️ why would it ever be null
?
That feels more like it should throw an Error
?
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.
I see your test, seems reasonable. I was worried it might have further reaching implications.
This is "new/ fixed" behaviour => CHANGELOG
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.
program info is null if the program doesn't exist, which is still a valid return type so i don;t believe it constitutes an error
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.
it's null if it's not on chain
src/registration/index.ts
Outdated
|
||
await registrationTxResult | ||
const verifyingKey = await dataFromEvents | ||
const result = await registrationTxResult |
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.
Recommend: consolidate with above line, i.e.
const result = await this.sendAndWaitFor(registerTx, {
src/registration/index.ts
Outdated
const verifyingKey = await dataFromEvents | ||
const result = await registrationTxResult | ||
// @ts-ignore: not sure where the void is coming from | ||
const verifyingKey = result.toHuman().event.data[1] |
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.
Something like this could more clearly document what's being pulled and why data[1]
const verifyingKey = result.toHuman().event.data[1] | |
const [ address, verifyingKey ] = result.toHuman().event.data |
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.
we don't use the address here, not sure if this is a valid updated for now
const endpoint = process.argv[2] | ||
const fundingSeed = process.argv[3] | ||
const faucetLookUpSeed = process.argv[4] |
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.
const endpoint = process.argv[2] | |
const fundingSeed = process.argv[3] | |
const faucetLookUpSeed = process.argv[4] | |
const [_, __, endpoint, fundingSeed, faucetLookupSeed] = process.argv |
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.
not sure if this is a necessary improvement at this moment, we can clean up the code after the initial release, and just push out a minor patch
if (!endpoint) throw new Error('please provide arguments for endpoint, fundingSeed, faucetLookUpSeed') | ||
if (!fundingSeed) throw new Error('please provide arguments for fundingSeed, faucetLookUpSeed') | ||
if (!faucetLookUpSeed) throw new Error('please provide arguments for faucetLookUpSeed') |
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.
move these into checkEndpoint
functions etc
dev/deploy-faucets.mjs
Outdated
const jumpStartStatus = (await moneyBags.substrate.query.stakingExtension.jumpStartProgress()).toHuman().jumpStartStatus | ||
report['jump start status at start'] = jumpStartStatus | ||
// deploy faucet program to chain if not already up | ||
if (jumpStartStatus === 'Ready') await jumpStartNetwork(moneyBags, true) |
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.
Break the steps up a bit more with space + comments?
const jumpStartStatus = (await moneyBags.substrate.query.stakingExtension.jumpStartProgress()).toHuman().jumpStartStatus | |
report['jump start status at start'] = jumpStartStatus | |
// deploy faucet program to chain if not already up | |
if (jumpStartStatus === 'Ready') await jumpStartNetwork(moneyBags, true) | |
// Jump Start | |
const jumpStartStatus = (await moneyBags.substrate.query.stakingExtension.jumpStartProgress()).toHuman().jumpStartStatus | |
report['jump start status at start'] = jumpStartStatus | |
if (jumpStartStatus === 'Ready') await jumpStartNetwork(moneyBags, true) | |
dev/deploy-faucets.mjs
Outdated
report['faucet program pointer from deployment'] = await moneyBags.programs.dev.deploy(faucetProgram, configurationSchema, auxDataSchema) | ||
} | ||
// transfer funds to faucet account "enough" to register (5 whole tokens) | ||
await sendMoney(moneyBags, faucetRing.accounts.registration.address, BigInt(5 * 10 ** 10)) |
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.
🔥
Do we have the 1e10
/ 10**10
constant defined anywhere in this Repo
I'd like to see at least at top of file
const BITS_PER_TOKEN = 1e10
await sendMoney(moneyBags, faucetRing.accounts.registration.address, BigInt(5 * 10 ** 10)) | |
await sendMoney(moneyBags, faucetRing.accounts.registration.address, BigInt(5 * BITS_PER_TOKEN)) |
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.
This number should be related to the FAUCET_COUNT
??
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.
done
dev/deploy-faucets.mjs
Outdated
const faucetCount = 3 | ||
// change me if you change the schemas! | ||
const pointer = '0x3a1d45fecdee990925286ccce71f78693ff2bb27eae62adf8cfb7d3d61e142aa' |
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.
style: I like these things as CONST so when I see them I know to look at top of file
const faucetCount = 3 | |
// change me if you change the schemas! | |
const pointer = '0x3a1d45fecdee990925286ccce71f78693ff2bb27eae62adf8cfb7d3d61e142aa' | |
const FAUCET_COUNT = 3 | |
// change me if you change the schemas! | |
const POINTER = '0x3a1d45fecdee990925286ccce71f78693ff2bb27eae62adf8cfb7d3d61e142aa' |
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.
i don't think style updates are needed right now to get this out the door, we can polish the boot script after the release sicne we don't really have that many devs that are going to be using the script at the moment
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.
falls in category "important but not urgent" - if we align our code styles a little we get faster parsing + code reviews.
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.
yes will do this my side so i can make sure it's every where
dev/deploy-faucets.mjs
Outdated
const modifiableKeys = await moneyBags.substrate.query.registry.modifiableKeys(faucetRing.accounts.registration.address) | ||
report['modifiableKeys on chain'] = modifiableKeys.toHuman() |
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.
const modifiableKeys = await moneyBags.substrate.query.registry.modifiableKeys(faucetRing.accounts.registration.address) | |
report['modifiableKeys on chain'] = modifiableKeys.toHuman() | |
const verifiyingKeys = await moneyBags.substrate.query.registry.modifiableKeys(faucetRing.accounts.registration.address) | |
report['verifyingKeys on chain'] = verifyingKeys.toHuman() | |
// These should be the same as faucets.map(faucet => faucet['verification key']) |
@@ -0,0 +1,20 @@ | |||
const monkeys = ['🙉 - pandemonium', '🙈 - chaos', '🙊 - anarchy', '🐵 - entropy'] |
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.
great addition
Co-authored-by: mix irving <mix@protozoa.nz>
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.
Looks good to me
This adds a sort of "boot script" to the
dev
dir. It will jump start and deploy and fund faucetsit also fixs a bug with registering where we were getting "stale" events for a previous registration attempt found while writing this script includes this doc add in the
dev/README.md
:sdk "boot script"
For convince at ./deploy-faucets.mjs is a script we use to "deploy" and fund the faucets for our entropy network you can refer to this section and the script itself to deploy your own faucets! Here is it running with a dev environment setup from the root of this project:
I would take a deep breath here to allow for the 4 nodes to connect before running the next command bellow. On that note the deploy faucet script takes 3 arguments as you can see right now this script assumes you know what your doing if you are running it. So not a lot of bells and whitelist here.
the first argument is the
endpoint
to target, the second is thefundingSeed
and the thirdfaucetLookUpSeed
this example above should run in a dev enviroment the funding seed is eve and the report looks something like this and will log to your console: