Skip to content

Commit 044d70b

Browse files
committed
Merge branch 'main' into releases/v2.0.0
2 parents a58899e + ecda4c1 commit 044d70b

38 files changed

+956
-585
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ needed to include double quotes around the hexadecimal string.
8686
- [#2170](https://github.com/NibiruChain/nibiru/pull/2170) - chore: Remove redundant allowUnprotectedTxs
8787
- [#2172](https://github.com/NibiruChain/nibiru/pull/2172) - chore: close iterator in IterateEpochInfo
8888
- [#2173](https://github.com/NibiruChain/nibiru/pull/2173) - fix(evm): clear `StateDB` between calls
89-
89+
- [#2177](https://github.com/NibiruChain/nibiru/pull/2177) - fix(cmd): Continue from #2127 and unwire vesting flags and logic from genaccounts.go
90+
- [#2176](https://github.com/NibiruChain/nibiru/pull/2176) - tests(evm): add dirty state tests from code4rena audit
91+
- [#2180](https://github.com/NibiruChain/nibiru/pull/2180) - fix(evm): apply gas consumption across the entire EVM codebase at `CallContractWithInput`
92+
- [#2183](https://github.com/NibiruChain/nibiru/pull/2183) - fix(evm): bank keeper extension gas meter type
93+
-
9094
#### Nibiru EVM | Before Audit 2 - 2024-12-06
9195

9296
The codebase went through a third-party [Code4rena
@@ -298,7 +302,7 @@ about the expected resulting balance for the transfer recipient.
298302
- Bump `actions/setup-go` from 4 to 5 ([#1696](https://github.com/NibiruChain/nibiru/pull/1696))
299303
- Bump `golang` from 1.19 to 1.21 ([#1698](https://github.com/NibiruChain/nibiru/pull/1698))
300304
- [#1678](https://github.com/NibiruChain/nibiru/pull/1678) - chore(deps): collections to v0.4.0 for math.Int value encoder
301-
- Bump `golang.org/x/net` from 0.0.0-20220607020251-c690dde0001d to 0.23.0 in /geth ([#1849](https://github.com/NibiruChain/nibiru/pull/1849))
305+
- Bump `golang.org/x/net` from 0.0.0-20220607020251-c690dde0001d to 0.33.0 ([#1849](https://github.com/NibiruChain/nibiru/pull/1849), [#2175](https://github.com/NibiruChain/nibiru/pull/2175))
302306
- Bump `golang.org/x/net` from 0.20.0 to 0.23.0 ([#1850](https://github.com/NibiruChain/nibiru/pull/1850))
303307
- Bump `github.com/supranational/blst` from 0.3.8-0.20220526154634-513d2456b344 to 0.3.11 ([#1851](https://github.com/NibiruChain/nibiru/pull/1851))
304308
- Bump `golangci/golangci-lint-action` from 4 to 6 ([#1854](https://github.com/NibiruChain/nibiru/pull/1854), [#1867](https://github.com/NibiruChain/nibiru/pull/1867))
@@ -310,6 +314,7 @@ about the expected resulting balance for the transfer recipient.
310314
- Bump `github.com/CosmWasm/wasmvm` from 1.5.0 to 1.5.5 ([#2047](https://github.com/NibiruChain/nibiru/pull/2047))
311315
- Bump `docker/build-push-action` from 5 to 6 ([#1924](https://github.com/NibiruChain/nibiru/pull/1924))
312316
- Bump `codecov/codecov-action` from 4 to 5 ([#2112](https://github.com/NibiruChain/nibiru/pull/2112))
317+
- Bump `undici` from 5.28.4 to 5.28.5 ([#2174](https://github.com/NibiruChain/nibiru/pull/2174))
313318

314319
## [v1.5.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.5.0) - 2024-06-21
315320

cmd/nibid/cmd/genaccounts.go

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package cmd
33
import (
44
"bufio"
55
"encoding/json"
6-
"errors"
76
"fmt"
87

8+
"github.com/MakeNowJust/heredoc/v2"
99
"github.com/spf13/cobra"
1010

1111
"github.com/cosmos/cosmos-sdk/client"
@@ -14,28 +14,21 @@ import (
1414
"github.com/cosmos/cosmos-sdk/server"
1515
sdk "github.com/cosmos/cosmos-sdk/types"
1616
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
17-
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
1817
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
1918
"github.com/cosmos/cosmos-sdk/x/genutil"
2019
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
2120
)
2221

23-
const (
24-
flagVestingStart = "vesting-start-time"
25-
flagVestingEnd = "vesting-end-time"
26-
flagVestingAmt = "vesting-amount"
27-
)
28-
2922
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
3023
func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
3124
cmd := &cobra.Command{
3225
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
3326
Short: "Add a genesis account to genesis.json",
34-
Long: `Add a genesis account to genesis.json. The provided account must specify
27+
Long: heredoc.Doc(`Add a genesis account to genesis.json. The provided account must specify
3528
the account address or key name and a list of initial coins. If a key name is given,
3629
the address will be looked up in the local Keybase. The list of initial tokens must
37-
contain valid denominations. Accounts may optionally be supplied with vesting parameters.
38-
`,
30+
contain valid denominations.
31+
`),
3932
Args: cobra.ExactArgs(2),
4033
RunE: func(cmd *cobra.Command, args []string) error {
4134
clientCtx := client.GetClientContextFromCmd(cmd)
@@ -74,42 +67,11 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
7467
return fmt.Errorf("failed to parse coins: %w", err)
7568
}
7669

77-
vestingStart, _ := cmd.Flags().GetInt64(flagVestingStart)
78-
vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd)
79-
vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt)
80-
81-
vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr)
82-
if err != nil {
83-
return fmt.Errorf("failed to parse vesting amount: %w", err)
84-
}
85-
8670
// create concrete account type based on input parameters
8771
var genAccount authtypes.GenesisAccount
8872

8973
balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}
90-
baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0)
91-
92-
if !vestingAmt.IsZero() {
93-
baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
94-
95-
if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
96-
baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
97-
return errors.New("vesting amount cannot be greater than total amount")
98-
}
99-
100-
switch {
101-
case vestingStart != 0 && vestingEnd != 0:
102-
genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart)
103-
104-
case vestingEnd != 0:
105-
genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
106-
107-
default:
108-
return errors.New("invalid vesting parameters; must supply start and end time or end time")
109-
}
110-
} else {
111-
genAccount = baseAccount
112-
}
74+
genAccount = authtypes.NewBaseAccount(addr, nil, 0, 0)
11375

11476
if err := genAccount.Validate(); err != nil {
11577
return fmt.Errorf("failed to validate new genesis account: %w", err)
@@ -174,9 +136,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
174136

175137
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
176138
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
177-
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
178-
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
179-
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
180139
flags.AddQueryFlagsToCmd(cmd)
181140

182141
return cmd

eth/rpc/backend/backend_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (s *BackendSuite) buildContractCallTx(
252252
nonce uint64,
253253
gasLimit uint64,
254254
) gethcore.Transaction {
255-
//recipient := crypto.CreateAddress(s.fundedAccEthAddr, 29381)
255+
// recipient := crypto.CreateAddress(s.fundedAccEthAddr, 29381)
256256
transferAmount := big.NewInt(100)
257257

258258
packedArgs, err := embeds.SmartContract_TestERC20.ABI.Pack(

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ require (
6464
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
6565
golang.org/x/crypto v0.31.0
6666
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
67-
golang.org/x/net v0.23.0
67+
golang.org/x/net v0.33.0
6868
golang.org/x/text v0.21.0
6969
)
7070

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,9 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
14461446
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
14471447
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
14481448
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
1449-
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
14501449
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
1450+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
1451+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
14511452
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
14521453
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
14531454
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

x/common/testutil/testapp/test_util.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
1717

1818
nibiruapp "github.com/NibiruChain/nibiru/v2/app"
19+
"github.com/NibiruChain/nibiru/v2/app/appconst"
1920
)
2021

2122
// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts
@@ -41,7 +42,7 @@ func GenesisStateWithSingleValidator(codec codec.Codec, genesisState nibiruapp.G
4142

4243
balances = append(balances, banktypes.Balance{
4344
Address: acc.GetAddress().String(),
44-
Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000000000000))),
45+
Coins: sdk.NewCoins(sdk.NewCoin(appconst.BondDenom, math.NewIntFromUint64(1e14))),
4546
})
4647

4748
genesisState, err = genesisStateWithValSet(codec, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...)
@@ -93,7 +94,9 @@ func genesisStateWithValSet(
9394
delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), math.LegacyOneDec()))
9495
}
9596
// set validators and delegations
96-
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
97+
stakingParams := stakingtypes.DefaultParams()
98+
stakingParams.BondDenom = appconst.BondDenom
99+
stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations)
97100
genesisState[stakingtypes.ModuleName] = cdc.MustMarshalJSON(stakingGenesis)
98101

99102
totalSupply := sdk.NewCoins()
@@ -104,13 +107,13 @@ func genesisStateWithValSet(
104107

105108
for range delegations {
106109
// add delegated tokens to total supply
107-
totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt))
110+
totalSupply = totalSupply.Add(sdk.NewCoin(appconst.BondDenom, bondAmt))
108111
}
109112

110113
// add bonded amount to bonded pool module account
111114
balances = append(balances, banktypes.Balance{
112115
Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
113-
Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
116+
Coins: sdk.Coins{sdk.NewCoin(appconst.BondDenom, bondAmt)},
114117
})
115118

116119
// update total supply

x/common/testutil/testapp/testapp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/NibiruChain/nibiru/v2/app"
1919
"github.com/NibiruChain/nibiru/v2/app/appconst"
20+
cryptocodec "github.com/NibiruChain/nibiru/v2/eth/crypto/codec"
2021
"github.com/NibiruChain/nibiru/v2/x/common/asset"
2122
"github.com/NibiruChain/nibiru/v2/x/common/denoms"
2223
"github.com/NibiruChain/nibiru/v2/x/common/testutil"
@@ -126,6 +127,7 @@ func NewNibiruTestApp(gen app.GenesisState, baseAppOptions ...func(*baseapp.Base
126127
logger := log.NewNopLogger()
127128

128129
encoding := app.MakeEncodingConfig()
130+
cryptocodec.RegisterInterfaces(encoding.InterfaceRegistry)
129131
SetDefaultSudoGenesis(gen)
130132

131133
app := app.NewNibiruApp(

0 commit comments

Comments
 (0)