-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feat/675 on chain ouis devaddrs #909
base: main
Are you sure you want to change the base?
Conversation
iot_config/migrations/20241203193310_add_organization_locks.sql
Outdated
Show resolved
Hide resolved
iot_config/migrations/20241203193310_add_organization_locks.sql
Outdated
Show resolved
Hide resolved
approved BOOLEAN NOT NULL | ||
); | ||
|
||
CREATE OR REPLACE FUNCTION delete_routes_on_solana_organizations_delete() RETURNS trigger AS $$ |
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 think this could be replaced by an ON DELETE CASCADE
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.
At the indexer I dont have control to say oui is a unique key so I cant cascade delete on that. Need to do this trigger route
net_id TEXT NOT NULL, | ||
authority TEXT NOT NULL, | ||
oui BIGINT NOT NULL, | ||
escrow_key TEXT NOT 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.
Is this the key where the funds are coming from? aka why not keeping it payer_key
?
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.
Yeah this is the key used to infer the escrow pda. The struct on chain has it as escrow_key
and a string. payer_key
to me sounds like its an actual publickey of a wallet
// Reduce the pending burn amount and the payer's balance by the amount | ||
// we've burned. | ||
payer_account.burned = payer_account.burned.saturating_sub(amount); | ||
payer_account.balance = payer_account.balance.saturating_sub(amount); | ||
|
||
metrics::counter!("burned", "payer" => payer.to_string()).increment(amount); | ||
metrics::counter!("burned", "payer" => escrow_key.to_string()).increment(amount); |
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.
metrics::counter!("burned", "payer" => escrow_key.to_string()).increment(amount); | |
metrics::counter!("burned", "payer" => %escrow_key).increment(amount); |
this should already be a string now, no?
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 didn't update any of the logic in mobile_packet_verifier/burner.rs or its pending_burns.rs as I was only running an instance of iot_config. But this change will make it work with the new pda getter that expects a string. Think I should take a pass at that and also update where payer is a PublicKeyBinary
?
After helium/helium-program-library#745 is merged/deployed and a backfill is ran, creation of orgs and devaddrs will have been moved to solana instructions/structs.
•
payer
is renamed toescrow_key
and is just a string•
helium_netids
logic has been copied over to the cli where it will be utilized in constructing instructions• Test migrations stubbed out with bare minimum fields. Indexer service will alter these with full struct fields
• Updated all read operations to read form new indexer tables