-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(x/market): implement resource offer in bid (#1898)
Signed-off-by: Artur Troian <[email protected]>
- Loading branch information
Showing
52 changed files
with
499 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"migrations": { | ||
"market": { | ||
"from": "3", | ||
"to": "4" | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Package v0_28_0 | ||
// nolint revive | ||
package v0_28_0 | ||
|
||
import ( | ||
mv1beta4 "github.com/akash-network/akash-api/go/node/market/v1beta4" | ||
|
||
utypes "github.com/akash-network/node/upgrades/types" | ||
) | ||
|
||
func init() { | ||
utypes.RegisterUpgrade(UpgradeName, initUpgrade) | ||
utypes.RegisterMigration(mv1beta4.ModuleName, 3, newMarketMigration) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Package v0_28_0 | ||
// nolint revive | ||
package v0_28_0 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkmodule "github.com/cosmos/cosmos-sdk/types/module" | ||
|
||
mv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" | ||
mmigrate "github.com/akash-network/akash-api/go/node/market/v1beta4/migrate" | ||
|
||
utypes "github.com/akash-network/node/upgrades/types" | ||
) | ||
|
||
type marketMigrations struct { | ||
utypes.Migrator | ||
} | ||
|
||
func newMarketMigration(m utypes.Migrator) utypes.Migration { | ||
return marketMigrations{Migrator: m} | ||
} | ||
|
||
func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler { | ||
return m.handler | ||
} | ||
|
||
// handler migrates deployment from version 2 to 3. | ||
func (m marketMigrations) handler(ctx sdk.Context) error { | ||
store := ctx.KVStore(m.StoreKey()) | ||
|
||
err := utypes.MigrateValue(store, m.Codec(), mv1beta3.BidPrefix(), migrateBid) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func migrateBid(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { | ||
var oldObject mv1beta3.Bid | ||
cdc.MustUnmarshal(fromBz, &oldObject) | ||
|
||
to := mmigrate.BidFromV1beta3(oldObject) | ||
|
||
return &to | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Package v0_28_0 | ||
// nolint revive | ||
package v0_28_0 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/tendermint/tendermint/libs/log" | ||
|
||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
"github.com/cosmos/cosmos-sdk/x/authz" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
apptypes "github.com/akash-network/node/app/types" | ||
utypes "github.com/akash-network/node/upgrades/types" | ||
) | ||
|
||
const ( | ||
UpgradeName = "v0.28.0" | ||
) | ||
|
||
type upgrade struct { | ||
*apptypes.App | ||
log log.Logger | ||
} | ||
|
||
var _ utypes.IUpgrade = (*upgrade)(nil) | ||
|
||
func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { | ||
up := &upgrade{ | ||
App: app, | ||
log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), | ||
} | ||
|
||
return up, nil | ||
} | ||
|
||
func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { | ||
return &storetypes.StoreUpgrades{} | ||
} | ||
|
||
func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
return up.MM.RunMigrations(ctx, up.Configurator, fromVM) | ||
} | ||
} | ||
|
||
type grantBackup struct { | ||
granter sdk.AccAddress | ||
grantee sdk.AccAddress | ||
grant authz.Grant | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.