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

[feat]: Implement better bounty evaluation #29

Merged
merged 51 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f3fa4c4
feat: Bounty evaluation (untested)
jsanmigimeno May 1, 2024
92a258c
fix: Pricing service config and loading
jsanmigimeno May 1, 2024
0a49ee6
fix: Replace node-fetch with axios ('require' problem)
jsanmigimeno May 1, 2024
607760e
fix: Pricing provider fixes
jsanmigimeno May 1, 2024
4fea8db
fix: delivery 'gasUsed' logic for evaluation
jsanmigimeno May 1, 2024
269702f
chore: Improve evaluation logging
jsanmigimeno May 1, 2024
16b1787
chore: Fix pricing 'coinId's
jsanmigimeno May 1, 2024
dd811a6
chore: Add comments
jsanmigimeno May 2, 2024
45f850c
fix: Revert pricing coinIds to 'ethereum'
jsanmigimeno May 2, 2024
89b74c3
chore: Remove 'gasLimitBuffer'
jsanmigimeno May 2, 2024
818ee7b
fix: gas cost calculation
jsanmigimeno May 3, 2024
513d22b
chore: Improve pricing evaluation logging
jsanmigimeno May 3, 2024
058a62f
feat: Mainnet example configuration
jsanmigimeno May 20, 2024
80c7a7a
Merge branch 'jsanmi/new-escrow-events'
jsanmigimeno May 20, 2024
487bb64
feat: Update docker compose for mainnet
jsanmigimeno May 20, 2024
5f9686e
Revert "feat: Update docker compose for mainnet"
jsanmigimeno May 20, 2024
c969fe7
feat: Update docker compose for mainnet
jsanmigimeno May 20, 2024
793eff3
chore: Add some comments back to config.example.yaml
jsanmigimeno May 20, 2024
4c73a4c
fix: Relayer engine wormhole-sdk dependency
jsanmigimeno May 20, 2024
015f4da
Merge branch 'jsanmi/fix-relayer-engine-dependency' into mainnet
jsanmigimeno May 20, 2024
4612646
Merge pull request #11 from catalystdao/mainnet
reednaa May 21, 2024
2c5e0f0
fix: relayer-engine import
jsanmigimeno May 21, 2024
a9c4006
fix: Wormhole recovery api endpoint
jsanmigimeno May 21, 2024
152e02c
chore: Refactor wallet ports (route via wallet service)
jsanmigimeno May 23, 2024
775a194
feat: Wallet worker restart mechanism
jsanmigimeno May 25, 2024
6507633
Merge branch 'testnet' into jsanmi/pricing
jsanmigimeno May 28, 2024
0bc5341
Merge branch 'testnet' into jsanmi/pricing
jsanmigimeno May 31, 2024
67e11b2
fix: pnpm-lock after merge
jsanmigimeno May 31, 2024
92bdfad
feat: Take into account 'unrewarded' gas on bounty evaluation
jsanmigimeno Jun 3, 2024
db01791
fix: Variable name
jsanmigimeno Jun 3, 2024
a235165
fix: Variable name
jsanmigimeno Jun 3, 2024
4790da2
feat: Better structure wallet communication
jsanmigimeno Jun 4, 2024
74e3ab0
feat: Add 'getFeeData' query to wallet worker and overhaul gas calcul…
jsanmigimeno Jun 4, 2024
7d9083b
Merge branch 'jsanmi/enhance-wallet-port' into jsanmi/pricing
jsanmigimeno Jun 4, 2024
da8e8b0
chore: Overhaul relay eval (WIP)
jsanmigimeno Jun 5, 2024
d65a56d
chore: Overhaul and refactor the bounty evaluation logic
jsanmigimeno Jun 5, 2024
44bb35f
chore: Remove the 'evaluator' module
jsanmigimeno Jun 5, 2024
a60e77f
feat: Add order reevaluation logic
jsanmigimeno Jun 5, 2024
0381090
chore: Fix confusing log statement
jsanmigimeno Jun 5, 2024
243dc8a
feat: Implement a 'profitability factor'
jsanmigimeno Jun 6, 2024
bf7f0f6
feat: Add CoinGecko config validation
jsanmigimeno Jun 6, 2024
b014a87
chore: Recover testnet config
jsanmigimeno Jun 6, 2024
b64a98b
chore: Add 'coinId' to example config
jsanmigimeno Jun 7, 2024
17397b7
fix: Overhaul the max ack gas loss
jsanmigimeno Jun 10, 2024
0a87507
feat: Implement addtional fee estimation via resolvers
jsanmigimeno Jun 19, 2024
b84eec7
feat: Add OP and Base resolvers
jsanmigimeno Jun 19, 2024
5598c12
chore: Add 'additionalFeeEstimation' to eval logs
jsanmigimeno Jun 19, 2024
4419a59
chore: Improve delivery evaluation logging
jsanmigimeno Jun 20, 2024
502cceb
feat: Improve bounty evaluation on arbitrum-like chains
jsanmigimeno Jun 21, 2024
89552e5
Merge branch 'testnet' into jsanmi/pricing
jsanmigimeno Jun 21, 2024
00df820
Merge branch 'testnet' into jsanmi/pricing
jsanmigimeno Jun 25, 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
34 changes: 29 additions & 5 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,25 @@ global:
maxTries: 3 # Maximum tries for a transaction
maxPendingTransactions: 50 # Maximum number of transactions within the 'submit' pipeline.

# Gas properties
gasLimitBuffer: # Extra gasLimit buffer. Customizable per AMB.
default: 10000
mock: 50000
# Evaluation properties
evaluationRetryInterval: 3600000 # Interval at which to reevaluate whether to relay a message.
maxEvaluationDuration: 86400000 # Time after which to drop an undelivered message.
verificationDeliveryGas: '55000' # Gas amount used for packet verification upon delivery.
unrewardedDeliveryGas: '25000' # Gas amount that will be unrewarded on delivery submission.
minDeliveryReward: 0.001 # In the 'pricingDenomination' specified below
relativeMinDeliveryReward: 0.001
verificationAckGas: '55000' # Gas amount used for packet verification upon ack.
unrewardedAckGas: '25000' # Gas amount that will be unrewarded on ack submission.
minAckReward: 0.001 # In the 'pricingDenomination' specified below
relativeMinAckReward: 0.001
profitabilityFactor: 1.0 # Profitiability evaluation adjustment factor. A larger
# factor implies a larger profitability guarantee.

pricing:
provider: 'coin-gecko'
coinDecimals: 18
pricingDenomination: 'usd'


wallet:
retryInterval: 30000 # Time to wait before retrying a failed transaction
Expand Down Expand Up @@ -85,6 +100,9 @@ chains:
blockDelay: 2
interval: 5000

pricing:
coinId: 'ethereum' # coin-gecko pricing provider specific configuration

# AMB configuration
wormhole:
wormholeChainId: 10002
Expand All @@ -94,6 +112,8 @@ chains:
- chainId: 11155420
name: 'OP Sepolia'
rpc: 'https://sepolia.optimism.io'
pricing:
coinId: 'ethereum' # coin-gecko pricing provider specific configuration
wormhole:
wormholeChainId: 10005
incentivesAddress: '0x198cDD55d90277726f3222D5A8111AdB8b0af9ee'
Expand All @@ -102,6 +122,8 @@ chains:
- chainId: 84532
name: 'Base Sepolia'
rpc: 'https://sepolia.base.org'
pricing:
coinId: 'ethereum' # coin-gecko pricing provider specific configuration
wormhole:
wormholeChainId: 10004
incentivesAddress: '0x63B4E24DC9814fAcDe241fB4dEFcA04d5fc6d763'
Expand All @@ -110,7 +132,9 @@ chains:
- chainId: 168587773
name: 'Blast Testnet'
rpc: 'https://sepolia.blast.io'
pricing:
coinId: 'ethereum' # coin-gecko pricing provider specific configuration
wormhole:
wormholeChainId: 36
incentivesAddress: '0x9524ACA1fF46fAd177160F0a803189Cb552A3780'
bridgeAddress: '0x473e002D7add6fB67a4964F13bFd61280Ca46886'
bridgeAddress: '0x473e002D7add6fB67a4964F13bFd61280Ca46886'
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@typechain/ethers-v6": "^0.5.1",
"@wormhole-foundation/relayer-engine": "^0.3.2",
"ajv": "^8.12.0",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"drizzle-kit": "^0.20.6",
"drizzle-orm": "^0.29.1",
Expand All @@ -41,7 +42,8 @@
"pg": "^8.11.3",
"pino": "^8.15.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
"rxjs": "^7.8.1",
"viem": "^2.15.1"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
Expand Down
108 changes: 108 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { Module } from '@nestjs/common';
import { CollectorModule } from './collector/collector.module';
import { ConfigModule } from './config/config.module';
import { EvaluatorModule } from './evaluator/evaluator.module';
import { GetterModule } from './getter/getter.module';
import { LoggerModule } from './logger/logger.module';
import { SubmitterModule } from './submitter/submitter.module';
import { PersisterModule } from './store/persister/persister.module';
import { StoreModule } from './store/store.module';
import { MonitorModule } from './monitor/monitor.module';
import { PricingModule } from './pricing/pricing.module';

@Module({
imports: [
ConfigModule,
LoggerModule,
MonitorModule,
GetterModule,
EvaluatorModule,
CollectorModule,
PricingModule,
SubmitterModule,
PersisterModule,
StoreModule,
Expand Down
37 changes: 29 additions & 8 deletions src/config/config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const GLOBAL_SCHEMA = {

monitor: { $ref: "monitor-schema" },
getter: { $ref: "getter-schema" },
pricing: { $ref: "pricing-schema" },
submitter: { $ref: "submitter-schema" },
persister: { $ref: "persister-schema" },
wallet: { $ref: "wallet-schema" },
Expand Down Expand Up @@ -118,6 +119,20 @@ const GETTER_SCHEMA = {
additionalProperties: false
}

export const PRICING_SCHEMA = {
$id: "pricing-schema",
type: "object",
properties: {
provider: { $ref: "non-empty-string-schema" },
coinDecimals: { $ref: "positive-non-zero-integer-schema" },
pricingDenomination: { $ref: "non-empty-string-schema" },
cacheDuration: { $ref: "positive-number-schema" },
retryInterval: { $ref: "positive-number-schema" },
maxTries: { $ref: "positive-non-zero-integer-schema" },
},
additionalProperties: true // Allow for provider-specific configurations
}

const SUBMITTER_SCHEMA = {
$id: "submitter-schema",
type: "object",
Expand All @@ -131,14 +146,18 @@ const SUBMITTER_SCHEMA = {
maxTries: { $ref: "positive-number-schema" },
maxPendingTransactions: { $ref: "positive-number-schema" },

gasLimitBuffer: {
type: "object",
patternProperties: {
default: { $ref: "positive-number-schema" },
["^[a-zA-Z0-9_-]+$"]: { $ref: "positive-number-schema" },
},
additionalProperties: false
},
//TODO define 'evaluation' configuration somewhere else?
evaluationRetryInterval: { $ref: "positive-number-schema" },
maxEvaluationDuration: { $ref: "positive-number-schema" },
unrewardedDeliveryGas: { $ref: "gas-field-schema" },
verificationDeliveryGas: { $ref: "gas-field-schema" },
minDeliveryReward: { $ref: "positive-number-schema" },
relativeMinDeliveryReward: { $ref: "positive-number-schema" },
unrewardedAckGas: { $ref: "gas-field-schema" },
verificationAckGas: { $ref: "gas-field-schema" },
minAckReward: { $ref: "positive-number-schema" },
relativeMinAckReward: { $ref: "positive-number-schema" },
profitabilityFactor: { $ref: "positive-number-schema" },
},
additionalProperties: false
}
Expand Down Expand Up @@ -223,6 +242,7 @@ const CHAINS_SCHEMA = {

monitor: { $ref: "monitor-schema" },
getter: { $ref: "getter-schema" },
pricing: { $ref: "pricing-schema" },
submitter: { $ref: "submitter-schema" },
wallet: { $ref: "wallet-schema" },
},
Expand All @@ -246,6 +266,7 @@ export function getConfigValidator(): AnyValidateFunction<unknown> {
ajv.addSchema(GLOBAL_SCHEMA);
ajv.addSchema(MONITOR_SCHEMA);
ajv.addSchema(GETTER_SCHEMA);
ajv.addSchema(PRICING_SCHEMA);
ajv.addSchema(SUBMITTER_SCHEMA);
ajv.addSchema(PERSISTER_SCHEMA);
ajv.addSchema(WALLET_SCHEMA);
Expand Down
Loading