Skip to content
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

Merge to master #126

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7921a89
Add jobs if not exists (#90)
defi-dev Mar 11, 2024
2ff3b6a
add IntervalNotReached as not suitable for blacklist error
defi-dev Mar 22, 2024
a39f803
Merge pull request #91 from powerpool-finance/add-IntervalNotReached
defi-dev Mar 26, 2024
4ed0a69
Add support of tx.origin worker in job resolvers (#92)
defi-dev Mar 26, 2024
7c5d456
Remove excess keeper stake check (#93)
defi-dev Mar 27, 2024
ca201a4
add from property to executor estimation (#94)
defi-dev Apr 2, 2024
7fe9c04
update agent abi (#95)
defi-dev Apr 3, 2024
b52482f
resend transaction on "could not replace" or "underpriced" errors (#96)
defi-dev Apr 11, 2024
f6236c6
resend transaction on "replacement fee too low" (#97)
defi-dev Apr 16, 2024
10973b8
add signature to error message (#98)
defi-dev Apr 25, 2024
54fc670
Offchain jobs (#99)
defi-dev May 18, 2024
aff4045
Add env config override (#100)
defi-dev May 18, 2024
2c00adc
add base network (#101)
defi-dev May 24, 2024
1174e61
add base multicall (#102)
defi-dev May 25, 2024
eb62794
update PPAgent abi (#103)
defi-dev May 27, 2024
7c502bc
Skip blocks (#104)
polipaul May 29, 2024
dd07001
Test vrf (#105)
defi-dev Jun 10, 2024
a78495b
Fix _executeTxEstimationFailedRewatch return (#106)
defi-dev Jun 18, 2024
b8b9bf7
Fix blocklogs problem (#107)
defi-dev Jun 21, 2024
e93b604
Fix event missing (#108)
defi-dev Jun 23, 2024
a745013
fix api host (#109)
defi-dev Jun 27, 2024
0b9988e
add gnosis vrf agent (#110)
defi-dev Jun 27, 2024
76972c8
add job resolver logs (#111)
defi-dev Jul 1, 2024
65ae7b2
add queryPollResolvers error log (#112)
defi-dev Jul 2, 2024
bb01dd5
Handle resolver decode error (#113)
defi-dev Jul 2, 2024
6e03922
handle offchain resolver's max execution time (#114)
defi-dev Jul 2, 2024
74655ec
add linea network constants (#115)
defi-dev Jul 17, 2024
e413c1a
debug resolver success callback (#116)
defi-dev Aug 5, 2024
8982422
Fix mix bigint and websocket reconnect initialization (#117)
defi-dev Aug 7, 2024
b089c2b
fix getBlocksDelay (#118)
defi-dev Aug 8, 2024
2a4c0a2
Query block in blocks delay (#119)
defi-dev Aug 9, 2024
c73bcd3
add linea and arbitrum agents (#120)
defi-dev Aug 13, 2024
577ea5c
fix queryJob
defi-dev Sep 25, 2024
67e6a4e
Merge pull request #121 from powerpool-finance/fix-subquery
defi-dev Sep 26, 2024
e18bb34
fix emitByBlockQuery timeout
defi-dev Oct 6, 2024
2285ab4
add "exceeds the configured cap" error handling
defi-dev Oct 6, 2024
f44fcc8
fix configPath
defi-dev Oct 9, 2024
1064051
Watch job in case of blockchain node lag
defi-dev Oct 13, 2024
73896d1
remove unused BigNumber
defi-dev Nov 24, 2024
2b9b621
Merge pull request #123 from powerpool-finance/fix-getLogs
defi-dev Nov 24, 2024
8ead1f6
add agent constants
defi-dev Dec 2, 2024
d462396
Merge pull request #124 from powerpool-finance/add-new-agents
defi-dev Dec 2, 2024
d18cd67
merge
defi-dev Dec 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ let app: App;
const version = await getVersion(__dirname);
console.log(`PowerPool Agent Node version: ${version}`);

let config: Config;
let configPath;
let config: Config, configPath: string;

try {
const configPath = process.env.CONFIG_PATH || path.resolve(__dirname, '../config/main.yaml');
configPath = process.env.CONFIG_PATH || path.resolve(__dirname, '../config/main.yaml');
logger.info(`CLI: Reading configuration from ${configPath} ...`);
config = YAML.parse(fs.readFileSync(configPath).toString()) as Config;
} catch (error) {
Expand Down
4 changes: 4 additions & 0 deletions app/ConfigGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export function getMaxBlocksSubgraphDelay(_ /*networkName*/) {
return 10000;
}

export function getMaxBlockEventsQuery(_ /*networkName*/) {
return 4900;
}

export function setConfigDefaultValues(config, defaultValues) {
Object.keys(defaultValues).forEach(name => {
if (typeof config[name] === 'undefined') {
Expand Down
50 changes: 50 additions & 0 deletions app/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ export const AGENT_HARDCODED_CONFIGS: { [network: string]: { [agent: string]: Ag
version: '2.5.0',
strategy: 'randao',
},
'0xD6d094a2a2dB8ceB9c00ae719E37011f22B7a8Ac': {
deployedAt: 37155151,
version: '2.5.0',
strategy: 'randao',
},
'0xa7Dabab40BAe7a920C437483549f42762815DBA2': {
deployedAt: 37312227,
version: '2.5.0',
strategy: 'randao',
},
},
arbitrumOne: {
'0xad1e507f8A0cB1B91421F3bb86BBE29f001CbcC6': {
Expand All @@ -63,20 +73,45 @@ export const AGENT_HARDCODED_CONFIGS: { [network: string]: { [agent: string]: Ag
version: '2.5.0',
strategy: 'randao',
},
'0x0eBcc7B676E2b29971173CECA72De79853124879': {
deployedAt: 280364988,
version: '2.5.0',
strategy: 'randao',
},
},
polygon: {
'0x20D4029c783D5c9f47569940c656Af4189e53799': {
deployedAt: 52818115,
version: '2.3.0',
strategy: 'randao',
},
'0xCDF80C73640a756D0810babA52F3d01280e5be32': {
deployedAt: 64973530,
version: '2.5.0',
strategy: 'randao',
},
'0xCB2A4200a0B42018FeAb87815B1AACB0eB2Ce638': {
deployedAt: 64973715,
version: '2.5.0',
strategy: 'randao',
},
},
base: {
'0x12e49CeDc34C4F455e0dfff7ec38cC535Cbd07C2': {
deployedAt: 14835289,
version: '2.3.0',
strategy: 'randao',
},
'0xcD7D8e8Fe442253Fa65A3BFcdF12cdCD0013631a': {
deployedAt: 22752546,
version: '2.5.0',
strategy: 'randao',
},
'0x59ad18f31Ad6AC183d136AF4d7aDAc01b6cC4421': {
deployedAt: 23155296,
version: '2.5.0',
strategy: 'randao',
},
},
linea: {
'0x20D4029c783D5c9f47569940c656Af4189e53799': {
Expand All @@ -89,6 +124,11 @@ export const AGENT_HARDCODED_CONFIGS: { [network: string]: { [agent: string]: Ag
version: '2.3.0',
strategy: 'randao',
},
'0x98D73653D64Ea1779C616A823064CA4da05dAD86': {
deployedAt: 12787200,
version: '2.5.0',
strategy: 'randao',
},
},
goerli: {
'0x96cb9B293eB7695904B4Ea0FA73eB3650e07e8E4': {
Expand Down Expand Up @@ -203,6 +243,16 @@ export const AGENT_HARDCODED_CONFIGS: { [network: string]: { [agent: string]: Ag
version: '2.3.0',
strategy: 'randao',
},
'0xd78521F50D252b6075B3c05C6A3043ea4bE0E52B': {
deployedAt: 7190875,
version: '2.5.0',
strategy: 'randao',
},
'0x518D1741F4B1bf1f859E64dd4B52047e9Dd2d499': {
deployedAt: 7190881,
version: '2.5.0',
strategy: 'randao',
},
},
};

Expand Down
18 changes: 15 additions & 3 deletions app/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getAverageBlockTime,
getDefaultNetworkConfig,
getExternalLensAddress,
getMaxBlockEventsQuery,
getMulticall2Address,
getResolverCallSkipBlocksNumber,
setConfigDefaultValues,
Expand Down Expand Up @@ -402,8 +403,8 @@ export class Network {

if (this.contractEventsEmitter.blockLogsMode) {
this.contractEventsEmitter.emitByBlockQuery({
fromBlock: Number(this.agentsStartBlockNumber) + 1,
toBlock: Number(this.agentsStartBlockNumber) + count,
fromBlock: startBlockNumber + 1,
toBlock: startBlockNumber + count,
});
}

Expand Down Expand Up @@ -484,7 +485,7 @@ export class Network {
blockNumber = BigInt(blockNumber.toString());
const before = this.nowMs();

const oldLatestBlockNumber = this.latestBlockNumber ? BigInt(this.latestBlockNumber) : null;
let oldLatestBlockNumber = this.latestBlockNumber ? BigInt(this.latestBlockNumber) : null;
if (this.latestBlockNumber && blockNumber <= this.latestBlockNumber) {
return null;
}
Expand All @@ -505,6 +506,9 @@ export class Network {

if (this.contractEventsEmitter.blockLogsMode) {
const blocksDiff = oldLatestBlockNumber ? blockNumber - oldLatestBlockNumber : 0n;
if (blocksDiff > getMaxBlockEventsQuery(this.name)) {
oldLatestBlockNumber = blockNumber - BigInt(getMaxBlockEventsQuery(this.name));
}
const fromBlock = bigintToHex(blocksDiff > 1n ? oldLatestBlockNumber + 1n : blockNumber);
const toBlock = bigintToHex(blockNumber);
this.contractEventsEmitter.emitByBlockQuery({ fromBlock, toBlock });
Expand Down Expand Up @@ -594,6 +598,7 @@ export class Network {
// TODO: protect from handlers queueing on the networks with < 3s block time
const resolversToCall = [];
const callbacks = [];

for (const [jobKey, jobData] of Object.entries(this.resolverJobData)) {
callbacks.push(jobData.callback);
resolversToCall.push({
Expand Down Expand Up @@ -622,6 +627,13 @@ export class Network {
for (let i = 0; i < results.length; i++) {
const { jobKey } = resolversToCall[i];
const agent = this.getAgent(jobKey.split('/')[0]);

// Watch job in case of blockchain node lag
if (!this.resolverJobData[jobKey]) {
const jobEntity = await agent.getJob(jobKey.split('/')[1]);
jobEntity.watch();
}

let decoded;
try {
decoded = results[i].success
Expand Down
1 change: 1 addition & 0 deletions app/jobs/AbstractJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export abstract class AbstractJob {
e.message.includes('Tx not mined, max attempts') ||
e.message.includes('Too many requests') ||
e.message.includes('InsufficientFunds') ||
e.message.includes('exceeds the configured cap') ||
e.message.toLowerCase().includes('insufficient funds') ||
e.message.includes('could not replace existing tx') ||
e.message.includes('replacement fee too low') ||
Expand Down
Loading