Skip to content

feat: add view function for mint precompile allowlist#67

Merged
tac0turtle merged 1 commit into
evstack:mainfrom
noble-assets:john/mint-precompile-view-allowlist
Nov 2, 2025
Merged

feat: add view function for mint precompile allowlist#67
tac0turtle merged 1 commit into
evstack:mainfrom
noble-assets:john/mint-precompile-view-allowlist

Conversation

@johnletey

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring

Related Issues

Fixes #(issue)

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Testing

Additional Notes

@johnletey johnletey requested a review from a team as a code owner October 23, 2025 15:44
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @johnletey, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new read-only function to the mint precompile, allowing users to query the allowlist status of any given address. This enhancement improves transparency by providing a direct way to verify whether an account is permitted to perform minting operations, without altering the blockchain state.

Highlights

  • New View Function: A new allowlist view function has been added to the INativeToken interface, enabling external callers to check if a specific address is on the mint precompile's allowlist.
  • Precompile Implementation: The MintPrecompile now includes the implementation for the allowlist function, which queries the allowlist status and returns a boolean value.
  • Documentation Updates: The INativeToken interface definition has been updated in both the README.md and the ADR-0002-native-minting-precompile.md to reflect the addition of the new allowlist view function.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new view function, allowlist(address), to the mint precompile. This allows users to check if an account is on the minting allowlist. The changes include updating the Solidity interface in the documentation and implementing the corresponding logic in the Rust precompile. My review identifies a key issue where the new view function can potentially modify state, which violates EVM conventions. I've provided a detailed comment and a code suggestion to address this. The rest of the changes, including documentation, are correct and consistent.

Comment on lines +239 to +243
INativeToken::INativeTokenCalls::allowlist(call) => {
let is_allowed = Self::is_allowlisted(internals, call.account)?;
let result = is_allowed.abi_encode();
Ok(PrecompileOutput::new(0, result.into()))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The allowlist function is declared as view in the Solidity interface, which implies it must not modify blockchain state. The current implementation calls Self::is_allowlisted, which in turn calls Self::ensure_account_created. This can cause a state modification by creating the precompile's account if it doesn't already exist. This side effect violates the read-only guarantee of a view function and can lead to inconsistent behavior across different EVM clients and tools.

To fix this, the read-only logic from is_allowlisted should be inlined here, avoiding the state-mutating call. For consistent logging, you should also duplicate the tracing::debug! call from is_allowlisted.

            INativeToken::INativeTokenCalls::allowlist(call) => {
                // This is a view function; avoid state modifications from `is_allowlisted`.
                let key = Self::allowlist_key(call.account);
                let value = internals
                    .sload(MINT_PRECOMPILE_ADDR, key)
                    .map_err(Self::map_internals_error)?;
                let is_allowed = !value.is_zero();
                let result = is_allowed.abi_encode();
                Ok(PrecompileOutput::new(0, result.into()))
            }

@tac0turtle tac0turtle merged commit d2f9e64 into evstack:main Nov 2, 2025
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants