Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
50 changes: 0 additions & 50 deletions .github/workflows/changelog-check.yml

This file was deleted.

32 changes: 32 additions & 0 deletions CHANGELOG-UNRELEASED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Changelog Chunk
* fix: bug with ineffectual assignment
* fix: add suggestion from Cursor bot
* fix(evm-e2e): newer assertion is more lenient
* fix(evm): use geth efficiency improvements and improved BinSearch with lo bias
* fix(evm): add panic safety to eth_estimateGas. Fix usage of incorrect SDB context in successive estimation calls.
* docs(bank): README fixes
* docs(bank): improve documentation and add section on Nibiru changes in [#2421](https://github.com/NibiruChain/nibiru/pull/2421) - ([172c008](https://github.com/NibiruChain/nibiru/commit/172c008068f8436081ee571f2fb7c01f607297f3)) by @Unique-Divine
* feat: add recursive check for nested authz exec messages and enforce … in [#2420](https://github.com/NibiruChain/nibiru/pull/2420) - ([3cdc810](https://github.com/NibiruChain/nibiru/commit/3cdc8107069c149bbfc538a6e3b7b0dd17b9cf2e)) by @expertdicer
* ci: simplify Go caching in CI to prevent file collisions in [#2419](https://github.com/NibiruChain/nibiru/pull/2419) - ([b1d1c22](https://github.com/NibiruChain/nibiru/commit/b1d1c22319eed8af11152b460fca6d9f54ad067a)) by @Unique-Divine
* fix(evmstate/test): stabilize trace tx tests with deterministic ERC20 transfer recipient in [#2418](https://github.com/NibiruChain/nibiru/pull/2418) - ([b47e3bd](https://github.com/NibiruChain/nibiru/commit/b47e3bd8ef89e01134fe3e3e0d60bea3e34c9561)) by @Unique-Divine
* feat: custom ante NewDeductFeeDecorator allowing 0 fee for zero gas actors in [#2415](https://github.com/NibiruChain/nibiru/pull/2415) - ([09e58ab](https://github.com/NibiruChain/nibiru/commit/09e58abd5a636b18303434aa1d5d0a526a7e65cb)) by @onikonychev
* ci: add back coverage reporting using gocovmerge; bring README more up to date in [#2416](https://github.com/NibiruChain/nibiru/pull/2416) - ([63257f0](https://github.com/NibiruChain/nibiru/commit/63257f0c749543478e8ce7be4aebec899d906f2e)) by @Unique-Divine
* refactor(upgrades): simplify upgrade hanlder code to use less abstractions and combine micro-packages in [#2413](https://github.com/NibiruChain/nibiru/pull/2413) - ([74cb33e](https://github.com/NibiruChain/nibiru/commit/74cb33eee6854cf55be26b26f5a85e6542625071)) by @Unique-Divine
* fix(evm-rpc): remove unsafe debug API methods. in [#2412](https://github.com/NibiruChain/nibiru/pull/2412) - ([e2a1ee8](https://github.com/NibiruChain/nibiru/commit/e2a1ee84e651dff9202ba25b0b7b54b64036697a)) by @Unique-Divine
* chore: v2.8.0 upgrade handler in [#2411](https://github.com/NibiruChain/nibiru/pull/2411) - ([9000cf3](https://github.com/NibiruChain/nibiru/commit/9000cf3a16797670769643e4feae4f9d07f38518)) by @onikonychev
* fix(evm-trace-block): handle native tracer errors JSON-RPC errors for "debug_traceBlockByNumber". Fixes [Nibiru#2400 bug](https://github.com/NibiruChain/nibiru/issues/2400) in [#2409](https://github.com/NibiruChain/nibiru/pull/2409) - ([e44cbc5](https://github.com/NibiruChain/nibiru/commit/e44cbc5c4e2f8be3a6756baf6aa5866ef642e63a)) by @Unique-Divine
* docs: merge PR from @yinwenyu6 . Comments only
* feat(evm/grpc-query): Update the "/eth.evm.v1.Query/Balance" query to work with "0x" Ethereum hex and "nibi"-prefixed Bech32 address formats in [#2410](https://github.com/NibiruChain/nibiru/pull/2410) - ([1bfc24d](https://github.com/NibiruChain/nibiru/commit/1bfc24d35401fccf120d1e82e1d184b57ca989d4)) by @Unique-Divine
* feat(proto): REST API doc generation for bank, auth, and txs in [#2394](https://github.com/NibiruChain/nibiru/pull/2394) - ([5dbb398](https://github.com/NibiruChain/nibiru/commit/5dbb3984e86a87c4d91c984c4fcd96d36cde25f5)) by @expertdicer
* feat(sudo-ante): implement zero gas actors for invoking whitelisted contract in [#2407](https://github.com/NibiruChain/nibiru/pull/2407) - ([6316bcd](https://github.com/NibiruChain/nibiru/commit/6316bcd66593dcf2dd370e7a1f0daf5d4fef3676)) by @Unique-Divine
* chore: added monad logo svg in [#2406](https://github.com/NibiruChain/nibiru/pull/2406) - ([90b951c](https://github.com/NibiruChain/nibiru/commit/90b951c43f7ad0c793d6b84bd6d087fc767bb190)) by @onikonychev
* chore: additional coin logos which could be used externally in [#2405](https://github.com/NibiruChain/nibiru/pull/2405) - ([6bb649b](https://github.com/NibiruChain/nibiru/commit/6bb649b7c3d3f73a985914e55772f04bbbbc07c6)) by @onikonychev
* feat(epic-evm): rearchitecture for StateDB safety, fix for consensus failures, performance improvements, consistent simulations, and nonce resolution for pending txs in the mempool in [#2397](https://github.com/NibiruChain/nibiru/pull/2397) - ([a252c9b](https://github.com/NibiruChain/nibiru/commit/a252c9bcdf37faa99e60fc59088e2867bd6c461f)) by @Unique-Divine
* chore: erc20 token registry new token: ynETHx in [#2395](https://github.com/NibiruChain/nibiru/pull/2395) - ([9219a94](https://github.com/NibiruChain/nibiru/commit/9219a94448940c1835106cb3d82dc61f50948234)) by @onikonychev
* feat(proto): impl script for gRPC Gateway REST doc generation in [#2391](https://github.com/NibiruChain/nibiru/pull/2391) - ([eb4b67e](https://github.com/NibiruChain/nibiru/commit/eb4b67ea858f889fb996cf2248c225d03a090b17)) by @Unique-Divine
* chore: erc20 token registry new tokens: cbBTC, uBTC in [#2388](https://github.com/NibiruChain/nibiru/pull/2388) - ([c1229d0](https://github.com/NibiruChain/nibiru/commit/c1229d0547ef743c156295218896acdeaa89c008)) by @onikonychev
* feat(evm): 63/64 gas clamp for ERC20 calls. Improved VM error surfacing. Add composite Chainlink-like oracle in [#2385](https://github.com/NibiruChain/nibiru/pull/2385) - ([2f7dbb5](https://github.com/NibiruChain/nibiru/commit/2f7dbb5060e35dab4128a203b63cae3ed1821105)) by @Unique-Divine
* feat(.github/pr-title-lint): Enable "/", capital letters, and "evm" prefix in pull request titles in [#2387](https://github.com/NibiruChain/nibiru/pull/2387) - ([4d1e13d](https://github.com/NibiruChain/nibiru/commit/4d1e13d2fbae61b1a7f3a6dd18515872c125f8df)) by @Unique-Divine
* feat(ai): start .cursorignore and Gemini code reviews in [#2386](https://github.com/NibiruChain/nibiru/pull/2386) - ([412abe7](https://github.com/NibiruChain/nibiru/commit/412abe7ceb0acf6e68211bf494106d2d8b498aab)) by @Unique-Divine

<!-- custom git-cliff template -->
72 changes: 72 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[remote.github]
owner = "NibiruChain"
repo = "nibiru"
# token = ""

[changelog]
# A Tera template to be rendered for each release in the changelog.
# See https://keats.github.io/tera/docs/#introduction
body = """
## Changelog Chunk {%- if version %}- {{ version }} {%- endif -%}

{%- if version %} in {{ version | trim_start_matches(pat="v") }}{%- endif -%}
{% for commit in commits %}
{% if commit.remote.pr_title -%}
{%- set commit_message = commit.remote.pr_title -%}
{%- else -%}
{%- set commit_message = commit.message -%}
{%- endif -%}
* {{ commit_message | split(pat="\n") | first | trim }}\

{% if commit.remote.pr_number %} in \
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
- ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }})) \
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
{%- endif %}
{%- endfor -%}

{% if version %}
{% if previous.version %}
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
{% endif %}
{% else -%}
{% raw %}\n{% endraw %}
{% endif %}

{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
"""
# Remove leading and trailing whitespaces from the changelog's body.
trim = true
# A Tera template to be rendered as the changelog's footer.
# See https://keats.github.io/tera/docs/#introduction
footer = """
<!-- custom git-cliff template -->
"""
# An array of regex based postprocessors to modify the changelog.
# Replace the placeholder `<REPO>` with a URL.
postprocessors = []

[git]
# Parse commits according to the conventional commits specification.
# See https://www.conventionalcommits.org
conventional_commits = false
# Exclude commits that do not match the conventional commits specification.
filter_unconventional = true
# Split commits on newlines, treating each line as an individual commit.
split_commits = false
# An array of regex based parsers to modify commit messages prior to further processing.
commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }]
# Exclude commits that are not matched by any commit parser.
filter_commits = false
# Order releases topologically instead of chronologically.
topo_order = false
# Order of commits in each group/release within the changelog.
# Allowed values: newest, oldest
sort_commits = "newest"
# tag_pattern: Chooses which tags create their own sections.
tag_pattern = '^v\\d+\\.\\d+\\.\\d+$' # only vX.Y.Z count as releases
2 changes: 1 addition & 1 deletion evm-e2e/test/eth_queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("eth queries", () => {
}
const estimatedGas = await provider.estimateGas(tx)
expect(estimatedGas).toBeGreaterThan(BigInt(0))
expect(estimatedGas).toEqual(INTRINSIC_TX_GAS)
expect(estimatedGas - INTRINSIC_TX_GAS).toBeLessThan(INTRINSIC_TX_GAS / BigInt(20))
})

it("eth_feeHistory", async () => {
Expand Down
20 changes: 20 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ gen-embeds:
go run "gen-abi/main.go"
log_success "Saved ABI JSON files to $embeds_dir/abi for npm publishing"

# Generates CHANGELOG-UNRELEASED.md based on commits and pull requests.
gen-changelog:
#!/usr/bin/env bash
source contrib/bashlib.sh
which_ok cargo
if ! which_ok git-cliff; then
echo "Installing git-cliff with cargo"
cargo install git-cliff
fi

which_ok git-cliff

LAST_VER="v2.7.0"
start_branch="$(git branch --show-current)"
git checkout main
git-cliff "$LAST_VER.." -o CHANGELOG-UNRELEASED.md
git checkout "$start_branch"
Comment on lines +63 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add error handling for git checkout commands.

The git checkout commands lack error handling. If git checkout main fails (e.g., due to uncommitted changes or missing branch), the script continues and runs git-cliff on the wrong branch. If git checkout "$start_branch" fails, the user is left on the main branch unexpectedly.

Apply this diff to add error handling:

-  git checkout main
-  git-cliff "$LAST_VER.." -o CHANGELOG-UNRELEASED.md
-  git checkout "$start_branch"
+  git checkout main || { log_error "Failed to checkout main branch"; exit 1; }
+  git-cliff "$LAST_VER.." -o CHANGELOG-UNRELEASED.md || { log_error "git-cliff failed"; git checkout "$start_branch"; exit 1; }
+  git checkout "$start_branch" || { log_error "Failed to return to branch $start_branch"; exit 1; }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In justfile around lines 63-65, the two git checkout commands lack error
handling; ensure each git checkout is checked and the script aborts or restores
state on failure: after running git checkout main, verify it succeeded and if
not print a clear error and exit so git-cliff won't run on the wrong branch;
after running git checkout "$start_branch", verify it succeeded and if not print
an error and either attempt to return to the previous branch (if known) or exit
with a non-zero status so the user is not left on main unexpectedly.

log_success "Created CHANGELOG-UNRELEASED.md with changes since $LAST_VER"
git add CHANGELOG-UNRELEASED.md

# Generate the Nibiru Token Registry files
gen-token-registry:
go run token-registry/main/main.go
Expand Down
16 changes: 7 additions & 9 deletions x/evm/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ const (
Erc20GasLimitExecute uint64 = 200_000
)

type contextKey string

const (
CtxKeyEvmSimulation contextKey = "evm_simulation"
CtxKeyGasEstimateZeroTolerance contextKey = "gas_estimate_zero_tolerance"
)

// BASE_FEE_MICRONIBI is the global base fee value for the network. It has a
// constant value of 1 unibi (micronibi) == 10^12 wei.
var (
Expand Down Expand Up @@ -123,15 +130,6 @@ const (
updateParamsName = "evm/MsgUpdateParams"
)

type CallType int

const (
// CallTypeRPC call type is used on requests to eth_estimateGas rpc API endpoint
CallTypeRPC CallType = iota + 1
// CallTypeSmart call type is used in case of smart contract methods calls
CallTypeSmart
)

var (
EVM_MODULE_ADDRESS gethcommon.Address
EVM_MODULE_ADDRESS_NIBI sdk.AccAddress
Expand Down
34 changes: 0 additions & 34 deletions x/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package evm

import (
"fmt"
"strings"

"github.com/cometbft/cometbft/crypto/tmhash"
sdk "github.com/cosmos/cosmos-sdk/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/types"
gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"

"github.com/NibiruChain/nibiru/v2/eth"
)
Expand Down Expand Up @@ -114,38 +112,6 @@ func ValidateFunTokenBankMetadata(
return out, nil
}

// HandleOutOfGasPanic captures an sdk.ErrorOutOfGas panic and folds it into
// *errp, an error pointer.
// - If *errp is nil: sets *errp = vm.ErrOutOfGas
// - If *errp is non-nil: preserves it (do not overwrite)
// - Always applies `format` wrapping if *errp is non-nil after recovery
// - Re-panics for any non-OutOfGas panic
func HandleOutOfGasPanic(errp *error, format string) func() {
return func() {
if perr := recover(); perr != nil {
_, isOutOfGasPanic := perr.(sdk.ErrorOutOfGas)
switch {
case isOutOfGasPanic:
if errp != nil && *errp == nil {
*errp = vm.ErrOutOfGas
}
// else: preserve existing detailed error
case strings.Contains(fmt.Sprint(perr), vm.ErrOutOfGas.Error()):
if errp == nil {
errp = new(error)
}
*errp = fmt.Errorf("%s: %w", perr, vm.ErrOutOfGas)
default:
// Non-OOG panics are not handled here
panic(perr)
}
}
if errp != nil && *errp != nil && format != "" {
*errp = fmt.Errorf("%s: %w", format, *errp)
}
}
}

// Gracefully handles "out of gas"
func SafeConsumeGas(ctx sdk.Context, amount uint64, descriptor string) (err error) {
defer func() {
Expand Down
Loading