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

queued in CSM status check #2104

Merged
merged 3 commits into from
Nov 11, 2024
Merged

queued in CSM status check #2104

merged 3 commits into from
Nov 11, 2024

Conversation

M4r71nW
Copy link
Contributor

@M4r71nW M4r71nW commented Nov 7, 2024

queued in CSM status check:

implementation of "csm-status-draft.pdf"

// Example usage

const { checkSigningKeys } = require('./csmodule');

(async () => {
  const nodeOperatorId = 43; // ID you want to check
  const keysArray = ['0xa86f4444b19220782de8127af0cf2be0b2ab58a441956224b52058090198e2a97c0b3548a9d0722a1c5cf46e7c275163',
  '0x8efdbef6c5faf5e7dc5bfcc39979d355e5c86ca6230533c959450ba8285172b1f5a64a03fdc1745ea86efb5f9491b930',
  '0xaab211983b5ac07ba73daa26aac14084af6a0e5483370aee95b1402af0615b38b47c90a7366ff6337290d0c25264e15e']; // keys you want to check

  const result = await checkSigningKeys(nodeOperatorId, keysArray);
  if (result === false) {
    console.log("No matches found for the provided keys.");
  } else if (result === null) {
    console.log("An error occurred while checking keys.");
  } else {
    console.log("Matching keys:", result);
  }
})();

/* Example 1 Output:
Loaded csm_abi successfully
Connected to Mainnet. ID = 1
Node is in sync ... 
Node Operator is active: true
Matching keys: [
  '0xa86f4444b19220782de8127af0cf2be0b2ab58a441956224b52058090198e2a97c0b3548a9d0722a1c5cf46e7c275163',
  '0x8efdbef6c5faf5e7dc5bfcc39979d355e5c86ca6230533c959450ba8285172b1f5a64a03fdc1745ea86efb5f9491b930',
  '0xaab211983b5ac07ba73daa26aac14084af6a0e5483370aee95b1402af0615b38b47c90a7366ff6337290d0c25264e15e'
]

Example 2 Output:
Loaded csm_abi successfully
Connected to Holesky. ID = 17000
Node is in sync ... 
Node Operator is active: true
No enqueued validators for this Node Operator.
No matches found for the provided keys.
*/

@NeoPlays
Copy link
Member

NeoPlays commented Nov 8, 2024

i think we should be able to implement this in ControlService as your functions need to run in the renderer process to have access to the window object. for this we may want to move the ControlService to a separate folder named renderer or something like this so we keep this structured

@NeoPlays
Copy link
Member

With await ControlService.getCSMQueue(<ArrayOfKeysToCheck>) you can check for the queue status.

it will return:

  • an Array with keys in queue (pubkeys)
  • false if no passed key is in queue
  • null if there was an error

@NeoPlays NeoPlays marked this pull request as ready for review November 11, 2024 13:22
Copy link
Contributor

@MaxTheGeeek MaxTheGeeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@MaxTheGeeek MaxTheGeeek merged commit 37937be into stereum-dev:main Nov 11, 2024
4 checks passed
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.

4 participants