added admin functionality #7

Merged
ghe0 merged 1 commits from admin into main 2025-02-06 20:24:08 +00:00
Owner
No description provided.
ghe0 added 1 commit 2025-02-05 01:02:13 +00:00
ghe0 force-pushed admin from 457456fbe5 to 6489cc95c7 2025-02-05 02:04:58 +00:00 Compare
valy reviewed 2025-02-05 13:40:14 +00:00
snp.proto Outdated
@ -204,0 +214,4 @@
// admin commands
rpc Airdrop (AirdropReq) returns (Empty);
rpc ListAllContracts (Empty) returns (stream Contract);
rpc ListAccounts (Empty) returns (stream ListAccountsResp);
Collaborator

maybe we can call this message similarly to the previous, returns (stream Contract);

maybe we can call this message similarly to the previous, `returns (stream Contract);`
Author
Owner

So instead of calling it ListAccountsResp, maybe call it Account?

So instead of calling it `ListAccountsResp`, maybe call it `Account`?
Collaborator

yeah, it that would work

yeah, it that would work
ghe0 marked this conversation as resolved
src/grpc.rs Outdated
@ -17,1 +17,4 @@
const ADMIN_ACCOUNTS: &[&str] = &[
"x52w7jARC5erhWWK65VZmjdGXzBK6ZDgfv1A283d8XK",
"ThisIsNotARealWallet000000000000000000000000",
Collaborator

not sure this wallet will actually be able to sign stuff 😆

not sure this wallet will actually be able to sign stuff 😆
Author
Owner

Yes. I will need your address instead, so that you can give airdrops.

Yes. I will need your address instead, so that you can give airdrops.
ghe0 marked this conversation as resolved
src/grpc.rs Outdated
@ -273,0 +307,4 @@
) -> Result<Response<Self::ListAccountsStream>, Status> {
check_admin_key(&req)?;
let _ = check_sig_from_req(req)?;
let accounts = self.data.list_accounts();
Collaborator

did you consider to clone the data arc instead and pass it to the thread?

did you consider to clone the data arc instead and pass it to the thread?
Author
Owner

I don't know what you mean.

I don't know what you mean.
Collaborator

I think this operation will clone a full list of accounts, so I was thinking to just clone arc if the map of accounts is multithreaded

I think this operation will clone a full list of accounts, so I was thinking to just clone arc if the map of accounts is multithreaded
Author
Owner

Very good point, thank you! It's the same case for the contracts. I believe I can just pass the channel instead, so that each contract/account gets clone individually, instead of cloning the full list at once. Will submit a commit later today.

Very good point, thank you! It's the same case for the contracts. I believe I can just pass the channel instead, so that each contract/account gets clone individually, instead of cloning the full list at once. Will submit a commit later today.
ghe0 marked this conversation as resolved
ghe0 force-pushed admin from 6489cc95c7 to 0638590e16 2025-02-05 22:20:07 +00:00 Compare
ghe0 force-pushed admin from 0638590e16 to 64f892c174 2025-02-06 13:16:11 +00:00 Compare
ghe0 closed this pull request 2025-02-06 19:52:44 +00:00
ghe0 reopened this pull request 2025-02-06 20:23:50 +00:00
ghe0 merged commit 64f892c174 into main 2025-02-06 20:24:08 +00:00
ghe0 deleted branch admin 2025-02-06 20:24:08 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ghe0/brain-mock#7
No description provided.