-
Notifications
You must be signed in to change notification settings - Fork 72
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
Implement RequesterAuthorizerWithErc721 authorizers #1670
Conversation
I've made the e2e test work (hacky way) in 950f5ec The proper implementation requires a small refactor. |
👍 for the config format |
Previously requesterEndpointAuthorizers being empty would result in all requests being authorized, independent of whether the other authorizer arrays were nonempty
@Siegrift thanks for such a huge help, I really appreciate it.
Unfortunately due to a legacy subtlety in For isAuthorized() within this new authorizer, it appears an NFT (token) has to be deposited... Still working through understanding that |
Yeah, sorry. I mainly focused on how to make the deployments (NFT and the respective authorizer) work. I thought that was the challenging part. Anyway, I think know how to make it work with token deposit. I'll try to fix the test today. |
Co-authored-by: Derek Croote <[email protected]>
expect(logs).toEqual([ | ||
{ | ||
level: 'DEBUG', | ||
message: 'Requester:requesterAddress is authorized to access Endpoint ID:endpointId for Request ID:0xapiCallId', |
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.
It would also be nice debug level info which requester authorized the given call.
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.
We previously had no logging when a request was authorized, so even this is an upgrade 😅. I looked into adding the originating authorizer to the log, but that is not trivial to do based on how authorization fetching currently occurs. I think it's doable, but outside the scope of this PR. Happy to open a separate issue though.
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, I feel you. We can open an issue.
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.
packages/airnode-node/src/evm/authorization/authorization-fetching.test.ts
Show resolved
Hide resolved
packages/airnode-protocol/contracts/authorizers/mock/MockRequesterAuthorizerWithErc721.sol
Outdated
Show resolved
Hide resolved
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.17; | ||
|
||
import "../../dev/RequesterAuthorizerWithErc721.sol"; |
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 wonder if we want to copy the contents to the Airnode repo or use it as a dependency. Dependency soundsw better to me.
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.
Burak suggested copy the contents:https://api3workspace.slack.com/archives/C0436H2BJKE/p1677057747622019?thread_ts=1676612819.041809&cid=C0436H2BJKE
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 can temporarily publish https://github.com/api3dao/nft-authorizer separately if you want, but to me these feel like equivalent solutions
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 was convinced by the argument that these will eventually be in this repo anyway.
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, if it's going to be moved I am ok with it. An issue in the Airnode repo would be nice though.
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.
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.
👍 LGTM
Closes #1632 by adding two new authorizers (same chain and cross chain). In each,
RequesterAuthorizerWithErc721
corresponds to the address of the authorizer contract we deploy (from here, incorporated completely herein along with other necessary contracts fromairnode-protocol-v1
), anderc721s
is an array of NFTs that serve as tokens to authorize requesters.@bbenligiray I'm still struggling a bit on the e2e test, see the second commit