Skip to content

Merge release/3.0 into main#137

Draft
ashishchandr70 wants to merge 32 commits intomainfrom
release/3.0
Draft

Merge release/3.0 into main#137
ashishchandr70 wants to merge 32 commits intomainfrom
release/3.0

Conversation

@ashishchandr70
Copy link
Contributor

Merge release/3.0 into main

ashishchandr70 and others added 30 commits November 13, 2025 12:35
* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

---------

Co-authored-by: ashishchandr70 <41921015+ashishchandr70@users.noreply.github.com>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#172 (#88)

Co-authored-by: Ashish Chandra <ashish@saga.xyz>

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#174 (#89)

Co-authored-by: Ashish Chandra <ashish@saga.xyz>

---------

Co-authored-by: ashishchandr70 <41921015+ashishchandr70@users.noreply.github.com>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#187

* Re-ran protocgen.sh to regenerate proto code

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#190

* Removed test for a single change.

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#196

* Updates based on Roman's comment

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
…History and GetKprValidatorPayoutHistory (#110)

* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#186

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#189

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
…ck version (#108)

* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#192

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
…vent emission (#106)

* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#193

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* fix(escrow): reset shares when pool is fully drained

Clear all funders and reset shares to zero when billing drains a pool's
balance to zero. Also add defensive check in deposit to handle invalid
pool states.

Fixes sherlock-audit/2025-11-saga-ssc-nov-14th#181

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#176

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
…ack (#111)

* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* Fix sherlock-audit/2025-11-saga-ssc-nov-14th#184

* Addressing Roman's change request.

* Fixed Roman's concern around using AdddVersion

* Updated code comment

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
* Release 1.0: Upgrade Handler and Module Improvements (#82)

* Upgrade to 1.0 and fix gosec issues

* Added acltypes.StoreKey to registered upgrade handlers

* Added more store upgrades

* Added remaining custom stores to storeUpgrades

* Removing ccvprovider types store key

* Changed genesis module init order

* use non-consumer modules

* WIP for handling the InitGenesis related error

* manually initialize provider module (#81)

* Renamed upgrade to match go proposal passed in staging

* Renamed upgrade back to 1.0

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>

* update params to match spc params (#84)

* fix: capture setup fee in escrow deposit calculation (#92)

The setup fee in LaunchChainlet() was added to deposit without capturing
the returned coin, so the escrow account was funded with only the epoch
deposit. This fix assigns the result of deposit.Add(setupfee) back to
deposit before calling NewChainletAccount.

* Use platform validator set for epoch reward distribution (#93)

* use platform validator set for chainlet token distributions

* Add fallback to staking validators when no platform validators configured

- If PlatformValidators param is empty, fall back to GetValidators()
- Add guard against division by zero if no validators exist
- Fixes potential panic when PlatformValidators is not set

* Fix lint errors in billing module

* Fix params test: use nil instead of empty slice for PlatformValidators default

* fix(escrow): use QuoTruncate for withdrawal to prevent over-withdrawal (#94)

* fix: complete genesis export/import for all modules (#95)

* fix: complete genesis export/import for all modules

Multiple custom modules only serialized params in ExportGenesis, leaving
their keeper KV state out of every exported genesis. This caused data loss
during export/import upgrades, state sync bootstraps, or genesis restarts.

Changes:
- x/chainlet: Export/import chainlets, chainlet stacks, and chainlet count
- x/escrow: Export/import chainlet accounts, denomination pools, and funders
- x/billing: Export/import billing history and validator payout history
- x/peers: Export/import peer data and chain counters

For each module:
- Extended genesis protobuf to include full KV store contents
- Updated ExportGenesis to iterate store prefixes and serialize data
- Updated InitGenesis to rehydrate from serialized data
- Added validation for duplicate entries
- Updated tests to cover new fields and validation

* x/peers: input validation

* x/chainlet: add IBC tests

* fix(escrow): reset shares when pool is fully drained (#113)

Clear all funders and reset shares to zero when billing drains a pool's
balance to zero. Also add defensive check in deposit to handle invalid
pool states.

Fixes sherlock-audit/2025-11-saga-ssc-nov-14th#181

* x/chainlet: non-CCV chainlet upgradeable by Saga

* x/chainlet: add upgrade restrictions and unit tests

* x/chainlet: make upgrade access check more readable

* x/chainlet: fix service chainlet not added as a consumer

* Missing commits from main. Updated failing mock test

* Update saga-sdk (#117)

Fixes x/peers access control in the ante handler.

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
Co-authored-by: Brian Luk <brian6.dev@gmail.com>
Co-authored-by: Brian <45702419+lukitsbrian@users.noreply.github.com>
Co-authored-by: Roman Kollár <10644651+rkollar@users.noreply.github.com>
Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Update interchaintest from v8 to v10
* Run e2e tests on every PR into release and main branches
* Added api endpoints test. Added logging to all tests.

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
* Release notes for v2.0.0

* Updates per Facu review

* Updates per Roman review

* Resolves all comments from reviewers

---------

Co-authored-by: Ashish Chandra <ashish@saga.xyz>
…ng (#132)

* fix: reorder GMP and PFM middleware stack for correct packet processing

The middleware stack had GMP wrapped by PFM, causing PFM to run first
on incoming packets. This meant when a GMP message with type=2
(TypeGeneralMessageWithToken) arrived:

1. PFM checked the memo first, didn't see {"forward":...}, passed through
2. GMP extracted the ABI payload and replaced memo with forward instructions
3. But PFM had already run, so the forward never happened

Reordered to GMP -> PFM -> Transfer so that:
1. GMP runs first, extracts payload, replaces memo with {"forward":...}
2. PFM sees forward instructions and initiates the forward
3. Transfer handles the final token transfer

* Trigger e2e tests in fix/** branches

* ci: add GMP e2e test to CI workflow

* Update app/app.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* add recovery for stuck funds

* oopsie

* update channels

* fix timeout

* lint
facundomedica and others added 2 commits January 22, 2026 21:50
* small fix

* CI access to private repos within org

---------

Co-authored-by: Konstantin Munichev <toobwn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants