-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement proof of validation (#304)
* Implement signDappnodeProofOfValidation * split cron * implement proover * fix cron test imports * use of modules exports * add envs * fix apis * add typ cast * fix proof of attestation cron * add headers to api standard * add pubkey to sign request * object destructuring * implement network as query paramter * fix typo * remove log * fix send query parameter * mark review fixes: rename proofOfValidation and timeout * rename to validation and collect stader tag * rename to DappnodeSignatureVerifier * move endpoint to params * add public to cron methods * add interval positive number check * add log if return in send proof of validation * do not throw error in loading envs * convert reloadValidators to function * fix test * remove path module * only send stakder keys
- Loading branch information
1 parent
bfc784d
commit f098fe2
Showing
18 changed files
with
698 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/brain/src/modules/apiClients/DappnodeSignatureVerifier.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { StandardApi } from "./index.js"; | ||
import { | ||
Network, | ||
DappnodeSignatureVerifierPostRequest, | ||
} from "@stakingbrain/common"; | ||
|
||
export class DappnodeSignatureVerifier extends StandardApi { | ||
private dappnodeSignEndpoint = "/signatures"; | ||
|
||
constructor(network: Network, validatorsMonitorUrl: string) { | ||
super( | ||
{ | ||
baseUrl: validatorsMonitorUrl, | ||
}, | ||
network | ||
); | ||
} | ||
|
||
public async sendProofsOfValidation( | ||
proofOfValidations: DappnodeSignatureVerifierPostRequest[] | ||
): Promise<void> { | ||
await this.request({ | ||
method: "POST", | ||
endpoint: `${this.dappnodeSignEndpoint}?network=${encodeURIComponent( | ||
this.network.toString() | ||
)}`, | ||
body: JSON.stringify(proofOfValidations), | ||
timeout: 10000, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.