Skip to content

Commit

Permalink
Merge branch 'master' into kriskowal-and-fudco-hackathon
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal authored Jan 3, 2024
2 parents 68235ec + 92855b2 commit 5b9ac06
Show file tree
Hide file tree
Showing 280 changed files with 2,905 additions and 1,658 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ jobs:
path: ./agoric-sdk
- uses: ./agoric-sdk/.github/actions/restore-node
with:
node-version: 18.x
# XXX loadgen not compatible with 18.19 https://github.com/Agoric/agoric-sdk/pull/8365#issuecomment-1848003597
node-version: 18.18
path: ./agoric-sdk
# Forces xsnap to initialize all memory to random data, which increases
# the chances the content of snapshots may deviate between validators
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ prior=$(git tag -l | sed -ne 's!^@agoric/sdk@\([0-9]*\).*!\1!p' | sort -n | tail
SDKVER=$(( prior + 1 ))
git tag @agoric/sdk@$SDKVER
# Push the branch.
git push -u origin release-$now
git push -u origin prepare-release-$now
# Tell which packages have actual news.
scripts/have-news HEAD^ > have-news.md
```
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ layers of the Agoric platform, with
providing the lower layers.
If you want to build on top of this platform, you don't need these
repositories: instead you should
[follow our instructions for getting started](https://agoric.com/documentation/getting-started/)
[follow our instructions for getting started](https://docs.agoric.com/guides/getting-started/)
with the Agoric SDK.

But if you are improving the platform itself, these are the repositories
Expand Down Expand Up @@ -89,7 +89,7 @@ To run the unit tests of just a single package (e.g. `eventual-send`):

## Run the larger demo

Visit [https://agoric.com/documentation/](https://agoric.com/documentation/getting-started/before-using-agoric.html) for getting started instructions.
Visit [https://docs.agoric.com](https://docs.agoric.com/guides/getting-started/) for getting started instructions.

TL;DR:

Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ t:

TM_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/tendermint/tendermint)/proto/tendermint
GOGO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/gogo/protobuf)
IBC_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v3)/proto/ibc/core
IBC_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v4)/proto/ibc/core
COSMOS_SDK_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-sdk)/proto/cosmos

GOGO_PROTO_TYPES = third_party/proto/gogoproto
Expand Down
8 changes: 8 additions & 0 deletions golang/cosmos/ante/inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,11 @@ func (msk mockSwingsetKeeper) GetBeansPerUnit(ctx sdk.Context) map[string]sdk.Ui
func (msk mockSwingsetKeeper) ChargeBeans(ctx sdk.Context, addr sdk.AccAddress, beans sdk.Uint) error {
return fmt.Errorf("not implemented")
}

func (msk mockSwingsetKeeper) GetSmartWalletState(ctx sdk.Context, addr sdk.AccAddress) swingtypes.SmartWalletState {
panic(fmt.Errorf("not implemented"))
}

func (msk mockSwingsetKeeper) ChargeForSmartWallet(ctx sdk.Context, addr sdk.AccAddress) error {
return fmt.Errorf("not implemented")
}
39 changes: 22 additions & 17 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -44,8 +45,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/capability"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
Expand Down Expand Up @@ -160,7 +159,6 @@ var (
swingsetclient.CoreEvalProposalHandler,
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
authzmodule.AppModuleBasic{},
Expand Down Expand Up @@ -234,7 +232,6 @@ type GaiaApp struct { // nolint: golint
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
// IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
Expand Down Expand Up @@ -415,12 +412,6 @@ func NewAgoricApp(
&stakingKeeper,
app.GetSubspace(slashingtypes.ModuleName),
)
app.CrisisKeeper = crisiskeeper.NewKeeper(
app.GetSubspace(crisistypes.ModuleName),
invCheckPeriod,
app.BankKeeper,
vbanktypes.ReservePoolName,
)
app.UpgradeKeeper = upgradekeeper.NewKeeper(
skipUpgradeHeights,
keys[upgradetypes.StoreKey],
Expand Down Expand Up @@ -596,7 +587,6 @@ func NewAgoricApp(

app.EvidenceKeeper = *evidenceKeeper

skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))
swingStoreExportDir := cast.ToString(appOpts.Get(FlagSwingStoreExportDir))

// NOTE: Any module instantiated in the module manager that is later modified
Expand All @@ -612,7 +602,6 @@ func NewAgoricApp(
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
Expand Down Expand Up @@ -642,7 +631,6 @@ func NewAgoricApp(
// upgrades should be run first
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -671,7 +659,6 @@ func NewAgoricApp(
vibc.ModuleName,
vbank.ModuleName,
lien.ModuleName,
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -712,7 +699,6 @@ func NewAgoricApp(
slashingtypes.ModuleName,
govtypes.ModuleName,
minttypes.ModuleName,
crisistypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
icatypes.ModuleName,
Expand All @@ -733,7 +719,6 @@ func NewAgoricApp(
app.mm.SetOrderInitGenesis(moduleOrderForGenesisAndUpgrade...)
app.mm.SetOrderMigrations(moduleOrderForGenesisAndUpgrade...)

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)

app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
Expand Down Expand Up @@ -805,6 +790,21 @@ func NewAgoricApp(
unreleasedUpgradeHandler(app, upgradeNameTest),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if (upgradeInfo.Name == upgradeName || upgradeInfo.Name == upgradeNameTest) && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{
crisistypes.ModuleName, // The SDK discontinued the crisis module in v0.51.0
},
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
Expand Down Expand Up @@ -838,6 +838,12 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
return mvm, err
}

m := swingsetkeeper.NewMigrator(app.SwingSetKeeper)
err = m.MigrateParams(ctx)
if err != nil {
return mvm, err
}

return mvm, nil
}
}
Expand Down Expand Up @@ -1172,7 +1178,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
Expand Down
3 changes: 0 additions & 3 deletions golang/cosmos/app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
allowedAddrsMap[addr] = true
}

/* Just to be safe, assert the invariants on current state. */
app.CrisisKeeper.AssertInvariants(ctx)

/* Handle fee distribution state. */

// withdraw all validator commission
Expand Down
2 changes: 0 additions & 2 deletions golang/cosmos/daemon/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cast"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -177,7 +176,6 @@ func addAgoricVMFlags(cmd *cobra.Command) {
}

func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
addAgoricVMFlags(startCmd)
}

Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
replace github.com/tendermint/tendermint => github.com/agoric-labs/cometbft v0.34.27-alpha.agoric.3

// We need a fork of cosmos-sdk until all of the differences are merged.
replace github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.2
replace github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.3

// For testing against a local cosmos-sdk or tendermint
// replace github.com/cosmos/cosmos-sdk => ../../../forks/cosmos-sdk
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/agoric-labs/cometbft v0.34.27-alpha.agoric.3 h1:RrKcZClqKav60DA4XEEskEwSsNB3l4ENkBVR66jORvQ=
github.com/agoric-labs/cometbft v0.34.27-alpha.agoric.3/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw=
github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.2 h1:zwYWlYI1le3ctFlgnOX0tFDnTa5jCxKaLfFfNbTJuOg=
github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.2/go.mod h1:T0VCPrAAeps81/pnD8b0+oBCMDxrkrD48W1t/XYYUeI=
github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.3 h1:kEcWMDCGVHOrk9FBvHPCgpVK4uCjHtoKDbRQqj5T4Og=
github.com/agoric-labs/cosmos-sdk v0.45.16-alpha.agoric.3/go.mod h1:T0VCPrAAeps81/pnD8b0+oBCMDxrkrD48W1t/XYYUeI=
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1 h1:2jvHI/2d+psWAZy6FQ0vXJCHUtfU3ZbbW+pQFL04arQ=
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
Expand Down
21 changes: 13 additions & 8 deletions golang/cosmos/x/lien/keeper/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import (
// In addition to the methods declared in authtypes.AccountI, additional
// expectations are enforced dynamically through casting and reflection:
//
// - non-module accounts are expected to obey the GenesisAccount interface,
// i.e. to have a Validate() method;
// - non-module accounts are expected to obey the GenesisAccount interface,
// i.e. to have a Validate() method;
//
// - UnpackInterfacesMessage is needed for unpacking accounts embedded
// in an Any message;
// - UnpackInterfacesMessage is needed for unpacking accounts embedded
// in an Any message;
//
// - MarshalYAML() is used for String rendering;
// - MarshalYAML() is used for String rendering;
//
// - protobuf Messages are expected to implement a number of "XXX"-prefixed
// methods not visible in the Message interface.
// - protobuf Messages are expected to implement a number of "XXX"-prefixed
// methods not visible in the Message interface.
//
// Declaring the expected methods here allows them to implicitly fall through
// to an embedded omniAccount.
Expand Down Expand Up @@ -116,7 +116,7 @@ func (uva unlockedVestingAccount) GetOriginalVesting() sdk.Coins {
return sdk.NewCoins()
}

//GetDelegatedFree implements the vestexported.VestingAccount interface.
// GetDelegatedFree implements the vestexported.VestingAccount interface.
func (uva unlockedVestingAccount) GetDelegatedFree() sdk.Coins {
return uva.lien.Delegated
}
Expand Down Expand Up @@ -172,6 +172,11 @@ func (fca fakeClawbackAccount) PostReward(ctx sdk.Context, reward sdk.Coins, act
return nil
}

// ReturnGrants implements the vestexported.ClawbackVestingAccountI interface.
func (fca fakeClawbackAccount) ReturnGrants(ctx sdk.Context, action vestexported.ReturnGrantAction) error {
return action.TakeGrants(ctx, fca.omniGrantAccount) // XXX or just fail here
}

// LienAccount wraps an omniClawbackAccount to implement lien encumbrance.
// The LockedCoins() method is the maximum of the coins locked for
// liens, and the coins locked in the underlying VestingAccount.
Expand Down
47 changes: 23 additions & 24 deletions golang/cosmos/x/swingset/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"fmt"
"io"
"os"
"strings"

Expand Down Expand Up @@ -56,20 +57,18 @@ func GetCmdDeliver() *cobra.Command {
}

jsonIn := args[0]
if jsonIn[0] == '@' {
fname := args[0][1:]
if strings.HasPrefix(jsonIn, "@") {
var jsonBytes []byte
fname := jsonIn[1:]
if fname == "-" {
// Reading from stdin.
if _, err := fmt.Scanln(&jsonIn); err != nil {
return err
}
jsonBytes, err = io.ReadAll(os.Stdin)
} else {
jsonBytes, err := os.ReadFile(fname)
if err != nil {
return err
}
jsonIn = string(jsonBytes)
jsonBytes, err = os.ReadFile(fname)
}
if err != nil {
return err
}
jsonIn = string(jsonBytes)
}
msgs, err := types.UnmarshalMessagesJSON(jsonIn)
if err != nil {
Expand Down Expand Up @@ -102,20 +101,18 @@ func GetCmdInstallBundle() *cobra.Command {
}

jsonIn := args[0]
if jsonIn[0] == '@' {
fname := args[0][1:]
if strings.HasPrefix(jsonIn, "@") {
var jsonBytes []byte
fname := jsonIn[1:]
if fname == "-" {
// Reading from stdin.
if _, err := fmt.Scanln(&jsonIn); err != nil {
return err
}
jsonBytes, err = io.ReadAll(os.Stdin)
} else {
jsonBytes, err := os.ReadFile(fname)
if err != nil {
return err
}
jsonIn = string(jsonBytes)
jsonBytes, err = os.ReadFile(fname)
}
if err != nil {
return err
}
jsonIn = string(jsonBytes)
}

msg := types.NewMsgInstallBundle(jsonIn, cctx.GetFromAddress())
Expand Down Expand Up @@ -160,6 +157,8 @@ func GetCmdProvisionOne() *cobra.Command {
return err
}

nickname := args[0]

addr, err := sdk.AccAddressFromBech32(args[1])
if err != nil {
return err
Expand All @@ -170,7 +169,7 @@ func GetCmdProvisionOne() *cobra.Command {
powerFlags = strings.Split(args[2], ",")
}

msg := types.NewMsgProvision(args[0], addr, powerFlags, cctx.GetFromAddress())
msg := types.NewMsgProvision(nickname, addr, powerFlags, cctx.GetFromAddress())
if err := msg.ValidateBasic(); err != nil {
return err
}
Expand Down Expand Up @@ -230,7 +229,7 @@ func NewCmdSubmitCoreEvalProposal() *cobra.Command {
Specify at least one pair of permit.json and code.js files`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args)%2 != 0 {
return fmt.Errorf("must specify an even number of permit.json and code.js files")
return fmt.Errorf("must specify paired permit.json and code.js files")
}

clientCtx, err := client.GetClientTxContext(cmd)
Expand Down
Loading

0 comments on commit 5b9ac06

Please sign in to comment.