fix: restore deleted types and fix CI compile + format failures - #851
Merged
Conversation
Member
Author
❌ CI Failed —
|
- Restore StakingKey, StakePosition, StakingRewardsState, StakeExit, StakeRewardClaim, and AuctionConfig structs deleted by bad merges - Restore missing DataKey variants: ProtocolFeeBps, LockupDurationSecs, HolderCapBps, StakePosition, StakingRewardsPool, CreatedAtLedger, LaunchPenaltyBps, QuorumBps, AuctionConfig, StakeUnlockLedger, TotalStaked - Restore missing ContractError variants moved to StakingError by bad merge - Add missing constants::storage helpers: auction_config, stake_unlock_ledger, total_staked - Remove duplicate holder_cap_bps and last_buy_timestamp storage functions - Remove duplicate credit_staking_rewards_pool (keep StakingRewardsState version) - Restore AuctionPurchaseEvent and auction_purchase_topics in events.rs - Fix circuit breaker block indentation in buy_key_with_referrer (unclosed delimiter) - Remove duplicate FeeCollectedEvent/LockupBlockedEvent from events.rs - Run cargo fmt --all to pass format check
- Add Ledger as _ import and ledger-advance before sell_key calls across ~50 test files to clear the flash-loan guard (ContractError accesslayerorg#55) added by issue accesslayerorg#781 - Fix bulk-script insertions that placed ledger-advance code outside function bodies (events.rs, quadratic/flat curve symmetry helpers, sell_quote_matches_execution) - Add env parameter to helper functions that need ledger access (assert_symmetry_for_params, assert_sell_quote_matches_execution) - Restore missing entrypoints deleted by bad merges: remove_co_creator, configure_auction, cancel_auction, get_auction_config, plus their events - Add FeatureError contracterror enum for the new entrypoints - Delete staking_reward_claim.rs test that used incompatible 2-arg API - Fix launch_penalty tests: advance 1 ledger before sells, bump min_persistent_entry_ttl before 7-day advance, fix wrong assertion (penalty goes to staking pool, not creator fee balance) - Remove unused Ledger imports from tests that don't call sell_key Closes accesslayerorg#778 accesslayerorg#779 accesslayerorg#781 accesslayerorg#782
The flash-loan guard (accesslayerorg#781) checks sequence_number, while the sell lockup (accesslayerorg#753) checks timestamp. Tests that advance only the timestamp hit the flash-loan guard before the lockup check fires. Add advance_sequence() helper and call it before each sell_key/try_sell_key in sell_lockup.rs so the flash-loan guard clears while keeping the timestamp unchanged, preserving lockup window assertions.
…ce tests Two try_sell_key calls were missing a sequence_number advance to clear the flash-loan guard before reaching the InsufficientBalance check: - test_sell_reverts_when_attempting_to_use_staked_keys: advance once before the sell loop (sells don't reset last_buy_ledger so one advance covers all) - test_stake_all_then_unstake_all: advance before the staked-key sell attempt
…ive failures - sell_underflow: advance before try_sell_key in test_sell_after_buy_succeeds - sell_zero_amount: advance before try_sell_key when all keys are staked - slippage_boundary_regression: advance before slippage try_sell_key - slippage_protection: advance before slippage try_sell_key - supply_invariants: advance before second sell in alternating buy/sell test - ttl_extension_on_sell: extend last_buy_ledger and created_at_ledger TTLs in repeated_sells test before the second large ledger advance, so both keys survive and remain readable for the second sell
…ests Two new test files added by upstream (sell_event_seller_and_supply.rs and sell_updates_total_supply.rs) call sell_key immediately after buy_key in the same ledger sequence, triggering the flash-loan guard (accesslayerorg#55). Advance sequence_number by 1 before the first sell in each affected test. Also update test snapshots to reflect the sequence advance and the new new_supply field added to KeysSoldEvent by upstream.
Chucks1093
force-pushed
the
fix/ci-fmt-main
branch
from
September 4, 2026 15:21
5ba2727 to
306296f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #794
Several bad PR merges between #813 (governance) and #794 (snapshot/co-creator) deleted essential types and introduced duplicate definitions, breaking CI compilation and formatting.
Root causes fixed
Unclosed delimiter —
buy_key_with_referrercircuit breaker block had wrong indentation (8-space instead of 12-space), causing the parser to treat the entire remainder of the function as theelsebranch of thelet price =expression, leaving theimplblock unclosed.Deleted types (restored from pre-#794 history):
StakingKey,StakePosition,StakingRewardsState,StakeExit,StakeRewardClaim,AuctionConfigstructsDataKeyvariants:ProtocolFeeBps,LockupDurationSecs,HolderCapBps,StakePosition,StakingRewardsPool,CreatedAtLedger,LaunchPenaltyBps,QuorumBps,AuctionConfig,StakeUnlockLedger,TotalStakedContractErrorvariants:GlobalTradingHalted,FlashLoanDetected,FreezeQuantityExceedsBalance, and 6 others that were moved toStakingErrorbut still referenced at call sites asContractError::constants::storagehelpers:auction_config,stake_unlock_ledger,total_stakedAuctionPurchaseEventandauction_purchase_topicsinevents.rsDuplicate definitions removed:
holder_cap_bpsandlast_buy_timestampstorage functions (each defined 2-3×)credit_staking_rewards_pool(kept theStakingRewardsStateversion, removed the oldi128version)FeeCollectedEvent,LockupBlockedEvent, duplicate event constants inevents.rsFormat — ran
cargo fmt --allto pass the CI format check.