Skip to content
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

Updates for Oracles to transition to helium-lib #401

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michaeldjeffrey
Copy link
Contributor

Companion Oracles PR helium/oracles#850

dc::burn_delegated()

The iot_packet_verifier and mobile_packet_verifier in Oracles burn DC on behalf of OUI operators and Data Users respectively.

boosting::start_boost()

The boost_manager starts the clock for boosted hexes when they have yielded their first rewards in an epoch.

Because helium_lib also re-exports helium_anchor_gen::hexboosting, I named the module boosting to hopefully be different enough to avoid confusion.

Multiple hexes can have their boost periods started in a single transaction. Currently, whoever is calling start_boost() needs to make sure to restrict the number of boosted hexes it is providing. It would make sense to me to put that in helium-lib and potentially return multiple transactions for the caller to submit, but I haven't gotten there yet, and have not been able to think of a nice way to provide control over transaction sizes.


Added Keypair conversion

In trying to keep the separation between solana_sdk::signer::keypair::Keypair and helium_lib::keypair::Keypair, rather than providing a helium_lib version of solana_sdk::signature::read_keypair_file, I added a From impl to go from solana to helium-lib.

solana_sdk::signature::read_keypair_file returns a Box<dyn std::error::Error> to cover io::Error and a serde_json::Error. I wasn't sure of a nice way to add this error to helium_lib::error::Error, so I opted for the conversion.

The Data Credits Key is not SubDao specific.
The solana_sdk provides a `read_keypair_file` function, but it returns a
Result with a Box<dyn Error>. Rather than recreate all those functions
for a wrapped Keypair, I thought to start with an easy conversion from
one to the other. So you can read the keypair with the solana_sdk, then
very quickly turn it into a helium-lib keypair.

Bring the discussion!!!
The module is named boosting so there is hopefully less confusion with
the existance of `helium_anchor_lang::hexboosting` that is autogenerated.
@michaeldjeffrey
Copy link
Contributor Author

There is a ReadWrite trait in helium-wallet that might make my pubkey conversion unnecessary.

@madninja
Copy link
Member

There is a ReadWrite trait in helium-wallet that might make my pubkey conversion unnecessary.

You going to fix that up? This PR got lost in an ocean of noise but I'm spending some time in helium-lib again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants