Fee Discount - Remove max duration restriction#3294
Fee Discount - Remove max duration restriction#3294davidli1997 wants to merge 4 commits intomainfrom
Conversation
WalkthroughThe changes remove the 90-day maximum duration constraint from fee discount parameters. The MaxFeeDiscountDuration constant is deleted, validation logic enforcing the limit is removed from the Validate function, and test cases are updated to permit durations of 365 days and beyond. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
protocol/x/feetiers/types/per_market_fee_discount_test.go (1)
243-243: Update stale comment referencing removed constant.The comment references
MaxFeeDiscountDurationconstant, which was removed as part of this PR. Update the comment to reflect that this test now validates duration edge cases without an upper bound.🔎 Proposed fix
-// Test for edge cases around the MaxFeeDiscountDuration constant +// Test for edge cases around different fee discount durations
🧹 Nitpick comments (1)
protocol/x/feetiers/types/per_market_fee_discount_test.go (1)
268-271: Good coverage for standard long-duration campaigns.The 365-day test case adequately validates that the duration restriction has been removed for typical long-term campaigns.
Optionally, consider adding a test case for very long durations (e.g., 5-10 years) to ensure there are no unforeseen issues with extremely long campaigns, though this is not critical given the current coverage.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
protocol/x/feetiers/keeper/msg_server_test.goprotocol/x/feetiers/types/per_market_fee_discount.goprotocol/x/feetiers/types/per_market_fee_discount_test.go
💤 Files with no reviewable changes (2)
- protocol/x/feetiers/keeper/msg_server_test.go
- protocol/x/feetiers/types/per_market_fee_discount.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-15T16:58:46.335Z
Learnt from: anmolagrawal345
Repo: dydxprotocol/v4-chain PR: 2780
File: protocol/x/clob/keeper/twap_order_state_test.go:191-209
Timestamp: 2025-04-15T16:58:46.335Z
Learning: For TWAP orders, message validation in message_place_order.go handles edge cases with comprehensive checks for parameters like durations and intervals, making it unnecessary to test invalid parameters in twap_order_state_test.go which only receives pre-validated inputs.
Applied to files:
protocol/x/feetiers/types/per_market_fee_discount_test.go
🧬 Code graph analysis (1)
protocol/x/feetiers/types/per_market_fee_discount_test.go (2)
indexer/packages/v4-protos/src/codegen/dydxprotocol/feetiers/per_market_fee_discount.ts (2)
PerMarketFeeDiscountParams(9-25)PerMarketFeeDiscountParams(58-122)protocol/x/feetiers/types/per_market_fee_discount.pb.go (3)
PerMarketFeeDiscountParams(32-43)PerMarketFeeDiscountParams(47-47)PerMarketFeeDiscountParams(48-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: (Mainnet) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Public Testnet) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: golangci-lint
- GitHub Check: test-coverage-upload
- GitHub Check: check-sample-pregenesis-up-to-date
- GitHub Check: container-tests
- GitHub Check: liveness-test
- GitHub Check: unit-end-to-end-and-integration
- GitHub Check: test-race
- GitHub Check: build-and-push-testnet
- GitHub Check: build
- GitHub Check: build-and-push-mainnet
- GitHub Check: benchmark
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Summary
🔇 Additional comments (1)
protocol/x/feetiers/types/per_market_fee_discount_test.go (1)
61-69: LGTM! Validates removal of duration restriction.The test case correctly validates that fee discount campaigns can now span 1 year, demonstrating the removal of the 90-day maximum duration restriction.
Changelist
Remove 90-day maximum duration restriction for market fee discount campaigns. This allows governance to set fee discounts for periods longer than 90 days without needing multiple proposals.
Context: Proposal 330 failed validation with a 92-day campaign (Nov 1 - Jan 31). The max duration limit was overly restrictive for legitimate governance use cases.
Test Plan
Author/Reviewer Checklist
state-breakinglabel.indexer-postgres-breakinglabel.PrepareProposalorProcessProposal, manually add the labelproposal-breaking.feature:[feature-name].backport/[branch-name].refactor,chore,bug.Summary by CodeRabbit
Improvements
Tests
✏️ Tip: You can customize this high-level summary in your review settings.