-
Notifications
You must be signed in to change notification settings - Fork 1
Multi pool support #33
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
Conversation
Ryang-21
commented
Mar 4, 2025
- Implements support for multiple pools to be monitored
e3f490a to
363fdfd
Compare
f8b077f to
1fec978
Compare
66f8e12 to
34abc43
Compare
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 might be some argument as to create N bidder_submitters, one for each filler entry.
However, the odds this makes any meaningful difference to the ability for a bot to fill auctions is like 0, so IMO for now lets keep it like this. Just wanted to leave a comment here incase we opt to do this in the future.
src/utils/soroban_helper.ts
Outdated
| let cachedUser = this.user_cache.get(poolId + userId); | ||
| try { | ||
| if (cachedUser) { | ||
| if ('timeout' in cachedUser && cachedUser.timeout > Date.now()) throw cachedUser.error; |
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 don't need to use a timeout
per usage of this class, it caches everything until you rebuild it.
Most of our workflows are on a per ledger basis, so this is OK
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 applies for all the fns in this class
src/utils/soroban_helper.ts
Outdated
| export class SorobanHelper { | ||
| network: Network; | ||
| private pool_cache: Map<string, Pool | ErrorTimeout>; | ||
| private pool_cache: Map<string, Pool | Error>; |
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 this need an error?
Can't it just be a Map<string, Pool>?
if (cachedPool) {
if (cachedPool instanceof Pool) return cachedPool;
else throw cachedPool;
}
is a bit confusing to me. IMO it's fine as:
try {
let cachedPool = this.pool_cache.get(poolId);
if (cachedPool !== undefined) {
return cachedPool;
}
let pool: Pool = await PoolV1.load(this.network, poolId);
this.pool_cache.set(poolId, pool);
return pool;
} catch (e: any) {
logger.error(`Error loading ${poolId} pool: ${e}`);
throw e;
}
If this errors, whatever is being processed is gonna stop anyway and wait to be re-tried. If for some reason it doesn't before SorobanHelper is reconstructed, it probably should try and fetch the pool again.