-
Notifications
You must be signed in to change notification settings - Fork 0
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: validate horizon staking authorization during agent bootup #95
Conversation
…dress-to-config' into feat/grt-230-update-rpc-abis-and-behavior
…eat/grt-230-update-rpc-abis-and-behavior
…-behavior' into feat/grt-230-update-rpc-abis-and-behavior
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.
Nice!
apps/agent/config.tenderly.yml
Outdated
@@ -16,6 +16,7 @@ protocolProvider: | |||
eboRequestCreator: "0xa13318684281a820304C164427396385C306d870" | |||
bondEscalationModule: "0x52d7728fE87826FfF51b21b303e2FF7cB04F6Aec" | |||
horizonAccountingExtension: "0xbDAB27D1903da4e18B0D1BE873E18924514E52eC" | |||
horizonStaking: "0x1234567890123456789012345678901234567890" # TODO: Update address |
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.
This address should be fine for the moment (Sepolia's Horizon Staking contract address):
0x3F53F9f9a5d7F36dCC869f8D2F227499c411c0cf
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.
replaced 👍🏻
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.
looks good, just a few comments to double check some things 🫡
@@ -42,6 +42,7 @@ const contractsAddressesSchema = z.object({ | |||
horizonAccountingExtension: hexSchema | |||
.optional() | |||
.default("0x0000000000000000000000000000000000000000"), | |||
horizonStaking: hexSchema, |
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.
why we use hexSchema here but on config we use addressSchema?
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.
you're right, I ended up changing hexSchema to addressSchema. However I don't want to abstract out the zod types to the shared package or create a circular dependency so I have a duplicate addressSchema for these two packages for now
const authorized = await this.horizonStakingContract.read.isAuthorized([ | ||
serviceProvider, | ||
verifier, | ||
operator, | ||
]); | ||
return authorized; |
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.
const authorized = await this.horizonStakingContract.read.isAuthorized([ | |
serviceProvider, | |
verifier, | |
operator, | |
]); | |
return authorized; | |
return this.horizonStakingContract.read.isAuthorized([ | |
serviceProvider, | |
verifier, | |
operator, | |
]); |
picky here 😆 but given that you only return the result without logging or try/catch block
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.
refactored 👍🏻
if (!isAuth) { | ||
const errorMessage = `Authorization required: Operator ${operator} is not authorized for service provider ${serviceProvider}.`; | ||
this.logger.error(errorMessage); | ||
process.exit(1); |
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.
just double checking that we want to exit the process right away
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.
yepp
…zon-auth-during-bootup # Conflicts: # apps/agent/config.example.yml # packages/automated-dispute/src/providers/protocolProvider.ts # packages/automated-dispute/tests/services/protocolProvider.spec.ts
|
||
describe("start", () => { |
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.
Why was this describe
deleted? 🤔
🤖 Linear
Closes GRT-231
Description