Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: really remove globalfee #219

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/spawn/new_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var (

SupportedFeatures = append(ConsensusFeatures, items{
{ID: "tokenfactory", IsSelected: true, Details: "Native token minting, sending, and burning on the chain"},
{ID: "globalfee", IsSelected: true, Details: "Static minimum fee(s) for all transactions, controlled by governance"},
{ID: "ibc-packetforward", IsSelected: true, Details: "Packet forwarding"},
{ID: "ibc-ratelimit", IsSelected: false, Details: "Thresholds for outflow as a percent of total channel value"},
{ID: "cosmwasm", IsSelected: false, Details: "Cosmos smart contracts"},
Expand Down Expand Up @@ -81,7 +80,7 @@ var newChain = &cobra.Command{
Short: "Create a new project",
Example: fmt.Sprintf(
` - spawn new rollchain --consensus=proof-of-stake --%s=cosmos --%s=simd --%s=token --org=abcde
- spawn new rollchain --consensus=proof-of-authority --%s=tokenfactory,globalfee
- spawn new rollchain --consensus=proof-of-authority --%s=tokenfactory
- spawn new rollchain --consensus=interchain-security --%s=cosmwasm --%s
- spawn new rollchain --%s`,
FlagWalletPrefix, FlagBinDaemon, FlagTokenDenom, FlagDisabled, FlagDisabled, FlagNoGit, FlagBypassPrompt,
Expand Down
4 changes: 2 additions & 2 deletions cmd/spawn/new_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func TestDisabledGeneration(t *testing.T) {
},
{
Name: "stdmix1",
Disabled: []string{spawn.GlobalFee, spawn.Ignite, spawn.TokenFactory},
NotContainAny: []string{"TokenFactoryKeeper", "GlobalFeeKeeper"},
Disabled: []string{spawn.Ignite, spawn.TokenFactory},
NotContainAny: []string{"TokenFactoryKeeper"},
},
{
Name: "nocw",
Expand Down
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-v0.50.x/03-demos/01-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spawn new rollchain \
--bech32=roll \
--denom=uroll \
--bin=rolld \
--disabled=cosmwasm,globalfee,block-explorer \
--disabled=cosmwasm,block-explorer \
--org=${GITHUB_USERNAME}
```

Expand Down
7 changes: 3 additions & 4 deletions scripts/matrix_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

SupportedFeatures = [
"tokenfactory",
"globalfee",
"ibc-packetforward",
"ibc-ratelimit",
"cosmwasm",
Expand Down Expand Up @@ -84,7 +83,7 @@ def main():
CmdCreator(
"randmixone",
POS,
"globalfee,wasmlc,ignite".split(","),
"wasmlc,ignite".split(","),
random_string(5, True),
f"{random_string(6, True)}",
f"u{random_string(5, True)}",
Expand Down Expand Up @@ -130,7 +129,7 @@ def main():
CmdCreator(
"randmixfive",
POS,
"globalfee,ibc-ratelimit".split(","),
"ibc-ratelimit".split(","),
random_string(5, True),
f"{random_string(6, True)}",
f"u{random_string(5, True)}",
Expand All @@ -141,7 +140,7 @@ def main():
CmdCreator(
"mywlcnocw",
POS,
"tokenfactory,globalfee,ibc-packetforward,cosmwasm".split(","),
"tokenfactory,ibc-packetforward,cosmwasm".split(","),
random_string(5, True),
f"{random_string(6, True)}",
f"u{random_string(5, True)}",
Expand Down
22 changes: 11 additions & 11 deletions spawn/cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ func TestDisabled(t *testing.T) {
testCases := []tcase{
{
name: "same",
disabled: []string{"poa", "globalfee", "cosmwasm"},
expected: []string{"poa", "globalfee", "cosmwasm"},
disabled: []string{"poa", "cosmwasm"},
expected: []string{"poa", "cosmwasm"},
},
{
name: "remove poa duplicate",
disabled: []string{"poa", "globalfee", "cosmwasm", "poa"},
expected: []string{"poa", "globalfee", "cosmwasm"},
disabled: []string{"poa", "cosmwasm", "poa"},
expected: []string{"poa", "cosmwasm"},
},
{
name: "remove poa and globalfee duplicate",
disabled: []string{"poa", "globalfee", "cosmwasm", "poa", "globalfee"},
expected: []string{"poa", "globalfee", "cosmwasm"},
name: "remove poa duplicate",
disabled: []string{"poa", "cosmwasm", "poa"},
expected: []string{"poa", "cosmwasm"},
},
{
name: "panic due to invalid disabled feature",
Expand Down Expand Up @@ -87,13 +87,13 @@ func TestNormalizedNames(t *testing.T) {
testCases := []tcase{
{
name: "normal for both",
disabled: []string{spawn.POA, spawn.GlobalFee, spawn.CosmWasm},
expected: []string{spawn.POA, spawn.GlobalFee, spawn.CosmWasm},
disabled: []string{spawn.POA, spawn.CosmWasm},
expected: []string{spawn.POA, spawn.CosmWasm},
},
{
name: "fix-all",
disabled: []string{"proof-of-authority", "global-fee", "cw"},
expected: []string{spawn.POA, spawn.GlobalFee, spawn.CosmWasm},
disabled: []string{"proof-of-authority", "cw"},
expected: []string{spawn.POA, spawn.CosmWasm},
},
{
name: "remove duplicate",
Expand Down
24 changes: 1 addition & 23 deletions spawn/remove_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var (
TokenFactory = "tokenfactory"
POA = "poa"
POS = "staking" // if ICS is used, we remove staking
GlobalFee = "globalfee"
CosmWasm = "cosmwasm"
WasmLC = "wasmlc"
PacketForward = "packetforward"
Expand All @@ -30,7 +29,7 @@ var (

// used for fuzz testing
var AllFeatures = []string{
TokenFactory, POA, GlobalFee, CosmWasm, WasmLC,
TokenFactory, POA, CosmWasm, WasmLC,
PacketForward, IBCRateLimit, Ignite, InterchainSecurity, POS,
}

Expand All @@ -44,8 +43,6 @@ func AliasName(name string) string {
return POA
case POS, "proof-of-stake", "staking", "pos":
return POS
case GlobalFee, "global-fee":
return GlobalFee
case CosmWasm, "wasm", "cw":
return CosmWasm
case WasmLC, "wasm-lc", "cwlc", "cosmwasm-lc", "wasm-light-client",
Expand Down Expand Up @@ -85,8 +82,6 @@ func (fc *FileContent) RemoveDisabledFeatures(cfg *NewChainConfig) {
// modules
case TokenFactory:
fc.RemoveTokenFactory()
case GlobalFee:
fc.RemoveGlobalFee()
case CosmWasm:
fc.RemoveCosmWasm(!cfg.IsFeatureEnabled(WasmLC))
case WasmLC:
Expand Down Expand Up @@ -156,23 +151,6 @@ func (fc *FileContent) RemovePOA() {
fc.DeleteFile(path.Join("interchaintest", "poa.go")) // helpers
}

func (fc *FileContent) RemoveGlobalFee() {
text := "globalfee"
fc.RemoveGoModImport("github.com/strangelove-ventures/globalfee")

fc.HandleAllTagged(text)

fc.RemoveModuleFromText(text,
appGo,
appAnte,
path.Join("scripts", "test_node.sh"),
path.Join("scripts", "test_ics_node.sh"),
path.Join("interchaintest", "setup.go"),
)

fc.RemoveModuleFromText("GlobalFee", appGo)
}

func (fc *FileContent) RemoveCosmWasm(isWasmClientDisabled bool) {
text := "wasm"
fc.RemoveGoModImport("github.com/CosmWasm/wasmd")
Expand Down
Loading