-
Notifications
You must be signed in to change notification settings - Fork 14
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(permit): with token name #312
Conversation
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
"recheckPermitInfo:mainnet": "ts-node src/permitInfo/fetchPermitInfo.ts 1 '' '' true", | ||
"recheckPermitInfo:gnosis": "ts-node src/permitInfo/fetchPermitInfo.ts 100 '' '' true", | ||
"recheckPermitInfo:goerli": "ts-node src/permitInfo/fetchPermitInfo.ts 5 '' '' true", |
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.
New helpers to recheck the ones that were previously marked as unsupported
// Fn can only be called 2x/second | ||
const throttle = pThrottle({ | ||
limit: 2, | ||
interval: 1000, | ||
}) | ||
|
||
const throttledGetTokenPermitInfo = throttle(getTokenPermitInfo) |
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.
Throttling the call to try and avoid RPC failures.
Still, every time I run the recheck, new tokens are identified as permittable.
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.
Does it fail a lot? I mean, how many calls w e do per token? shouldn't break if we use our RPC (nodereal)
Is not 2 per second too slow?
What do you mean with "Still, every time I run the recheck, new tokens are identified as permittable." is the script never finishing?
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.
Made the script more robust, and added retries.
Still found some new permittable tokens, but not after the retries were introduced.
{ | ||
"type": "boolean", | ||
"description": "When a token is known to not be permittable", | ||
"const": false |
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.
No longer have the type with only false
.
"name": { | ||
"type": "string", | ||
"description": "Token name as defined in the contract" |
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.
Added name
src/public/PermitInfo.1.json
Outdated
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 got a bit verbose...
But look, so many new permittable tokens!!
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.
Format seems fine to me. Sure, a bit more verbose means more bytes to transfer, but probably don't makes a big difference, so is not worth complicating the interface.
I couldn't test the PR, but i trust you say it worked for you. I don't fully get the part where you say new permeable tokens are detected in each run.
// Fn can only be called 2x/second | ||
const throttle = pThrottle({ | ||
limit: 2, | ||
interval: 1000, | ||
}) | ||
|
||
const throttledGetTokenPermitInfo = throttle(getTokenPermitInfo) |
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.
Does it fail a lot? I mean, how many calls w e do per token? shouldn't break if we use our RPC (nodereal)
Is not 2 per second too slow?
What do you mean with "Still, every time I run the recheck, new tokens are identified as permittable." is the script never finishing?
0e56c53
to
a025b96
Compare
… and avoid rpc failures
cf4c4bf
to
868f4e2
Compare
@@ -3,7 +3,7 @@ import { BASE_PATH } from '../const.ts' | |||
import { Token } from '../types.ts' | |||
import { join } from 'node:path' | |||
|
|||
export function getTokens(chainId: number, tokenListPath: string | undefined): Array<Token> { | |||
export function getTokensFromTokenList(chainId: number, tokenListPath: string | undefined): Array<Token> { |
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.
@alfetopito , i believe this method should also filter the tokens by chainId
.
I feel unsure if you omitted this on porpoise to discover tokens that are not listed for that specific chain but share the same address as one that is listed
As im unsure, i will play safe here and will NOT change this behaviour. Please, consider doing the filter when you are back
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 are right, it could as well filter tokens here.
Not a big problem though as they are filtered out later in the script.
This was meant as a simple fn to load tokens from a token list, taking into account that Goerli as a list of its own.
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.
Pk, thanks for checking
Summary
Addresses last part of #293
Depends on cowprotocol/cowswap#3374
✅
Will not work until @cowprotocol/permit-utils is published from cowprotocol/cowswap#3374Changes
Testing
Locally, I published @cowprotocol/permit-utils so I could run the script
With it, I updated all existing
PermitInfo
files