Skip to content

Commit

Permalink
refactor!: downgrade nightly to 0.50 (2/2) (#4524)
Browse files Browse the repository at this point in the history
* refactor!: downgrade nightly to 0.50 (2/2)

* unskip test

* lint

* updates

* remove placeholders

* wip

* sims

* cl + sims + re-add vesting

* fix

* fix linting

* lint
  • Loading branch information
julienrbrt authored Mar 2, 2025
1 parent 88bcca5 commit 794456a
Show file tree
Hide file tree
Showing 24 changed files with 184 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: golangci/golangci-lint-action@v6
with:
version: v1.60.3
version: v1.64.5
install-mode: goinstall
args: --timeout 10m
github-token: ${{ secrets.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ linters:
- stylecheck
- typecheck
- unconvert
- tenv
- usetesting
- thelper
- unused
- unparam
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- [#4326](https://github.com/ignite/cli/pull/4326) Add `buf.build` version to `ignite version` command
- [#4436](https://github.com/ignite/cli/pull/4436) Return tx hash to the faucet API
- [#4437](https://github.com/ignite/cli/pull/4437) Remove module placeholders
- [#4289](https://github.com/ignite/cli/pull/4289), [#4423](https://github.com/ignite/cli/pull/4423), [#4432](https://github.com/ignite/cli/pull/4432), [#4507](https://github.com/ignite/cli/pull/4507) Cosmos SDK v0.52 support and downgrade back to 0.50, while keeping latest improvements.
- [#4289](https://github.com/ignite/cli/pull/4289), [#4423](https://github.com/ignite/cli/pull/4423), [#4432](https://github.com/ignite/cli/pull/4432), [#4507](https://github.com/ignite/cli/pull/4507), [#4524](https://github.com/ignite/cli/pull/4524) Cosmos SDK v0.52 support and downgrade back to 0.50, while keeping latest improvements.
- [#4480](https://github.com/ignite/cli/pull/4480) Add field max length
- [#4477](https://github.com/ignite/cli/pull/4477) IBC v10 support
- [#4166](https://github.com/ignite/cli/issues/4166) Migrate buf config files to v2
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/testnet_multi_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func testnetMultiNode(cmd *cobra.Command, session *cliui.Session) error {
return err
}

ports, err := availableport.Find(uint(numVal))
ports, err := availableport.Find(uint(numVal)) //nolint:gosec,nolintlint // conversion is fine
if err != nil {
return err
}
Expand Down
7 changes: 3 additions & 4 deletions ignite/pkg/chaincmd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (b *buffer) JSONEnsuredBytes() ([]byte, error) {
return fallbackFormatDetection(bz)
}

// cleanAndValidateJSON attempts to extract valid JSON from potentially messy output
// cleanAndValidateJSON attempts to extract valid JSON from potentially messy output.
func cleanAndValidateJSON(bz []byte) ([]byte, error) {
// Find the first JSON opening character
startIndex := strings.IndexAny(string(bz), "{[")
Expand Down Expand Up @@ -212,8 +212,7 @@ func cleanAndValidateJSON(bz []byte) ([]byte, error) {
return bz[startIndex:], nil
}

// findMatchingCloseBracket finds the index of the matching closing bracket
// accounting for nested structures
// findMatchingCloseBracket returns the accounting for nested structures.
func findMatchingCloseBracket(data []byte, openChar, closeChar byte) int {
depth := 0
for i, b := range data {
Expand All @@ -229,7 +228,7 @@ func findMatchingCloseBracket(data []byte, openChar, closeChar byte) int {
return -1 // No matching bracket found
}

// fallbackFormatDetection tries different approaches to detect and convert format
// fallbackFormatDetection tries different approaches to detect and convert format.
func fallbackFormatDetection(bz []byte) ([]byte, error) {
// first try to find and extract JSON
startIndex := strings.IndexAny(string(bz), "{[")
Expand Down
4 changes: 2 additions & 2 deletions ignite/pkg/chaincmd/runner/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func (r Runner) Simulation(
chaincmd.SimappWithExportStatePath(config.ExportStatePath),
chaincmd.SimappWithExportStatsPath(config.ExportStatsPath),
chaincmd.SimappWithSeed(config.Seed),
chaincmd.SimappWithInitialBlockHeight(uint64(config.InitialBlockHeight)),
chaincmd.SimappWithNumBlocks(uint64(config.NumBlocks)),
chaincmd.SimappWithInitialBlockHeight(config.InitialBlockHeight),
chaincmd.SimappWithNumBlocks(config.NumBlocks),
chaincmd.SimappWithBlockSize(config.BlockSize),
chaincmd.SimappWithLean(config.Lean),
chaincmd.SimappWithCommit(config.Commit),
Expand Down
8 changes: 4 additions & 4 deletions ignite/pkg/chaincmd/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ func SimappWithSeed(seed int64) SimappOption {
}

// SimappWithInitialBlockHeight provides initialBlockHeight option for the simapp command.
func SimappWithInitialBlockHeight(initialBlockHeight uint64) SimappOption {
func SimappWithInitialBlockHeight(initialBlockHeight int) SimappOption {
return func(command []string) []string {
return append(command, optionSimappInitialBlockHeight, strconv.FormatUint(initialBlockHeight, 10))
return append(command, optionSimappBlockSize, strconv.Itoa(initialBlockHeight))
}
}

// SimappWithNumBlocks provides numBlocks option for the simapp command.
func SimappWithNumBlocks(numBlocks uint64) SimappOption {
func SimappWithNumBlocks(numBlocks int) SimappOption {
return func(command []string) []string {
return append(command, optionSimappNumBlocks, strconv.FormatUint(numBlocks, 10))
return append(command, optionSimappNumBlocks, strconv.Itoa(numBlocks))
}
}

Expand Down
61 changes: 30 additions & 31 deletions ignite/pkg/cosmosclient/cosmosclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type suite struct {

func newClient(t *testing.T, setup func(suite), opts ...cosmosclient.Option) cosmosclient.Client {
t.Helper()

s := suite{
rpcClient: mocks.NewRPCClient(t),
accountRetriever: mocks.NewAccountRetriever(t),
Expand Down Expand Up @@ -396,8 +397,6 @@ func TestClientStatus(t *testing.T) {
}

func TestClientCreateTx(t *testing.T) {
t.Skip() // TODO(@julienrbrt): Investigate timeout_timestamp fix need to by extended -> https://github.com/cosmos/cosmos-sdk/pull/22723. This will be done in a follow-up PR.

var (
ctx = context.Background()
accountName = "bob"
Expand Down Expand Up @@ -432,13 +431,13 @@ func TestClientCreateTx(t *testing.T) {
{
name: "ok: with default values",
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
},
Expand All @@ -449,13 +448,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithUseFaucet("localhost:1234", "", 0),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectMakeSureAccountHasToken(sdkaddr.String(), defaultFaucetMinAmount)

Expand All @@ -468,13 +467,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithUseFaucet("localhost:1234", "", 0),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectMakeSureAccountHasToken(sdkaddr.String(), defaultFaucetMinAmount-1)
s.expectPrepareFactory(sdkaddr)
Expand All @@ -486,13 +485,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithFees("10token"),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"10"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"10"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
},
Expand All @@ -504,13 +503,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGasPrices("3token"),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"900000"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"900000"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
},
Expand All @@ -523,8 +522,8 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGasAdjustment(2.1),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
Expand All @@ -540,13 +539,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGas(""),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
s.gasometer.EXPECT().
Expand All @@ -560,13 +559,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGas("auto"),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
s.gasometer.EXPECT().
Expand All @@ -580,13 +579,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGasAdjustment(2.4),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
},
Expand All @@ -598,13 +597,13 @@ func TestClientCreateTx(t *testing.T) {
cosmosclient.WithGasAdjustment(0),
},
msg: &banktypes.MsgSend{
FromAddress: "cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x",
ToAddress: "cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv",
FromAddress: "from",
ToAddress: "to",
Amount: sdktypes.NewCoins(
sdktypes.NewCoin("token", math.NewIntFromUint64(1)),
),
},
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1aew8dk9cs3uzzgeldatgzvm5ca2k4m98xhy20x","to_address":"cosmos1fhpcsxn0g8uask73xpcgwxlfxtuunn3ey5ptjv","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"0001-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}
expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}
`,
setup: func(s suite) {
s.expectPrepareFactory(sdkaddr)
Expand Down
7 changes: 2 additions & 5 deletions ignite/pkg/markdownviewer/markdownviewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ func View(path string) error {
func config(path string) (ui.Config, error) {
var width uint

fd := safeconverter.ToInt[uintptr](os.Stdout.Fd())
fd := safeconverter.ToInt(os.Stdout.Fd())
w, _, err := term.GetSize(fd)
if err != nil {
return ui.Config{}, err
}

width = uint(w)
if width > 120 {
width = 120
}
width = min(uint(w), 120) //nolint:gosec,nolintlint // conversion is fine

docTypes := ui.NewDocTypeSet()
docTypes.Add(ui.LocalDoc)
Expand Down
8 changes: 4 additions & 4 deletions ignite/pkg/protoanalysis/protoutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ func NextUniqueID(m *proto.Message) int {
// messages can embed other messages and the Apply could get
// hairy.
// if no elements exist => 1.
max := 0
maximum := 0
for _, el := range m.Elements {
if f, ok := el.(*proto.NormalField); ok {
if f.Sequence > max {
max = f.Sequence
if f.Sequence > maximum {
maximum = f.Sequence
}
}
}
return max + 1
return maximum + 1
}

// GetMessageByName returns the message with the given name or nil if not found.
Expand Down
4 changes: 2 additions & 2 deletions ignite/pkg/truncatedbuffer/truncatedbuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ type TruncatedBuffer struct {

// NewTruncatedBuffer returns a new TruncatedBuffer.
// If the provided cap is 0, the truncated buffer has no limit for truncating.
func NewTruncatedBuffer(cap int) *TruncatedBuffer {
func NewTruncatedBuffer(c int) *TruncatedBuffer {
return &TruncatedBuffer{
buf: &bytes.Buffer{},
cap: cap,
cap: c,
}
}

Expand Down
Loading

0 comments on commit 794456a

Please sign in to comment.