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

feat(eth-rpc): RPC backend, Ethereum tracer, KV indexer, and RPC APIs #1861

Merged
merged 4 commits into from
May 6, 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
4 changes: 2 additions & 2 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ coverage:
status:
project:
default:
if_not_found: success
target: 66%
if_not_found: success
threshold: 1% # Allow coverage to drop by X%, posting a success status.
# removed_code_behavior: Takes values [off, removals_only, adjust_base]
removed_code_behavior: adjust_base
patch:
default:
target: 69%
target: 0%

comment: # this is a top-level key
layout: " diff, flags, files"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1841](https://github.com/NibiruChain/nibiru/pull/1841) - feat(eth): Collections encoders for bytes, Ethereum addresses, and Ethereum hashes
- [#1855](https://github.com/NibiruChain/nibiru/pull/1855) - feat(eth-pubsub): Implement in-memory EventBus for real-time topic management and event distribution
- [#1856](https://github.com/NibiruChain/nibiru/pull/1856) - feat(eth-rpc): Conversion types and functions between Ethereum txs and blocks and Tendermint ones.
- [#1861](https://github.com/NibiruChain/nibiru/pull/1861) - feat(eth-rpc): RPC backend, Ethereum tracer, KV indexer, and RPC APIs

#### Dapp modules: perp, spot, oracle, etc

Expand Down
20 changes: 10 additions & 10 deletions app/ante/fixed_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/NibiruChain/nibiru/app"
"github.com/NibiruChain/nibiru/app/ante"
"github.com/NibiruChain/nibiru/app/appconst"
"github.com/NibiruChain/nibiru/x/common/testutil"
"github.com/NibiruChain/nibiru/x/common/testutil/testapp"
oracletypes "github.com/NibiruChain/nibiru/x/oracle/types"
Expand Down Expand Up @@ -64,7 +64,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
},
expectedGas: 1042,
Expand All @@ -76,7 +76,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
&oracletypes.MsgAggregateExchangeRatePrevote{
Hash: "",
Expand All @@ -99,7 +99,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
},
expectedGas: 1042,
Expand All @@ -111,7 +111,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
&oracletypes.MsgAggregateExchangeRateVote{
Salt: "dummySalt",
Expand Down Expand Up @@ -171,7 +171,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
&oracletypes.MsgAggregateExchangeRatePrevote{
Hash: "",
Expand All @@ -188,12 +188,12 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 100)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)),
},
&types.MsgSend{
FromAddress: addr.String(),
ToAddress: addr.String(),
Amount: sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 200)),
Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 200)),
},
},
expectedGas: 62288,
Expand All @@ -208,7 +208,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {
suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder()

// msg and signatures
feeAmount := sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 150))
feeAmount := sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 150))
gasLimit := testdata.NewTestGasLimit()
suite.txBuilder.SetFeeAmount(feeAmount)
suite.txBuilder.SetGasLimit(gasLimit)
Expand All @@ -224,7 +224,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() {

err = testapp.FundAccount(
suite.app.BankKeeper, suite.ctx, addr,
sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 1000)),
sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 1000)),
)
suite.Require().NoError(err)

Expand Down
6 changes: 2 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ import (
)

const (
AccountAddressPrefix = "nibi"
appName = "Nibiru"
BondDenom = "unibi"
DisplayDenom = "NIBI"
appName = "Nibiru"
DisplayDenom = "NIBI"
)

var (
Expand Down
44 changes: 44 additions & 0 deletions app/appconst/appconst.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) 2023-2024 Nibi, Inc.
package appconst

import (
"fmt"
"runtime"
)

const (
BinaryName = "nibiru"
BondDenom = "unibi"
// AccountAddressPrefix: Bech32 prefix for Nibiru accounts.
AccountAddressPrefix = "nibi"
)

// Runtime version vars
var (
AppVersion = ""
GitCommit = ""
BuildDate = ""

GoVersion = ""
GoArch = ""
)

func init() {
if len(AppVersion) == 0 {
AppVersion = "dev"
}

GoVersion = runtime.Version()
GoArch = runtime.GOARCH
}

func Version() string {
return fmt.Sprintf(
"Version %s (%s)\nCompiled at %s using Go %s (%s)",
AppVersion,
GitCommit,
BuildDate,
GoVersion,
GoArch,
)
}
12 changes: 7 additions & 5 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/NibiruChain/nibiru/app/appconst"
)

// BankModule defines a custom wrapper around the x/bank module's AppModuleBasic
Expand All @@ -29,13 +31,13 @@ type BankModule struct {
func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
denomMetadata := banktypes.Metadata{
Description: "The native staking token of the Nibiru network.",
Base: BondDenom,
Base: appconst.BondDenom,
Name: DisplayDenom,
Display: DisplayDenom,
Symbol: DisplayDenom,
DenomUnits: []*banktypes.DenomUnit{
{
Denom: BondDenom,
Denom: appconst.BondDenom,
Exponent: 0,
Aliases: []string{
"micronibi",
Expand Down Expand Up @@ -65,7 +67,7 @@ var _ module.HasGenesisBasics = (*StakingModule)(nil)
// DefaultGenesis returns custom Nibiru x/staking module genesis state.
func (StakingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := stakingtypes.DefaultGenesisState()
genState.Params.BondDenom = BondDenom
genState.Params.BondDenom = appconst.BondDenom
genState.Params.MinCommissionRate = sdk.MustNewDecFromStr("0.05")
return cdc.MustMarshalJSON(genState)
}
Expand Down Expand Up @@ -99,7 +101,7 @@ type CrisisModule struct {
// DefaultGenesis returns custom Nibiru x/crisis module genesis state.
func (CrisisModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := crisistypes.DefaultGenesisState()
genState.ConstantFee = sdk.NewCoin(BondDenom, genState.ConstantFee.Amount)
genState.ConstantFee = sdk.NewCoin(appconst.BondDenom, genState.ConstantFee.Amount)
return cdc.MustMarshalJSON(genState)
}

Expand All @@ -113,7 +115,7 @@ type GovModule struct {
func (GovModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := govtypes.DefaultGenesisState()
genState.Params.MinDeposit = sdk.NewCoins(
sdk.NewCoin(BondDenom, govtypes.DefaultMinDepositTokens))
sdk.NewCoin(appconst.BondDenom, govtypes.DefaultMinDepositTokens))
return cdc.MustMarshalJSON(genState)
}

Expand Down
Loading
Loading