Skip to content

Conversation

SurfingBowser
Copy link
Contributor

@SurfingBowser SurfingBowser commented Jul 25, 2025

Inferara Grant application

Project Abstract

This project is an R&D initiative to further secure Polkadot and subsequent parachains. With the recent increase in discussions of stablecoins across all ecosystem, we observed the benefit of gaining mathematical assurance for the safety of functions within pallet_assets for future integration of Circle’s CCTP (Cross Chain Transfer Protocol).
Since pallets are an essential part of the Polkadot infrastructure, we want to take a deep look at exactly how the current logic functions. pallet_balances is used by every token on Polkadot. Within pallet_balances, the fungible traits are what will be researched specifically.
We plan how to apply our Rocq-based framework Inference to Polkadot’s fungible trait set.
Adaptation of the fungible trait set for formal verifications within our non-deterministic WASM framework will enable complete trait extraction with validated semantic mapping ready for formal specification.

Grant level

  • Level 1: Up to $10,000, 2 approvals
  • Level 2: Up to $30,000, 3 approvals
  • Level 3: Unlimited, 5 approvals (for >$100k: Web3 Foundation Council approval)

Application Checklist

  • The application template has been copied and aptly renamed (project_name.md).
  • I have read the application guidelines.
  • Payment details have been provided (Polkadot AssetHub (USDC & DOT) address in the application and bank details via email, if applicable).
  • I understand that an agreed upon percentage of each milestone will be paid in vested DOT, to the Polkadot address listed in the application.
  • I am aware that, in order to receive a grant, I (and the entity I represent) have to successfully complete a KYC/KYB check.
  • The software delivered for this grant will be released under an open-source license specified in the application.
  • The initial PR contains only one commit (squash and force-push if needed).
  • The grant will only be announced once the first milestone has been accepted (see the announcement guidelines).
  • I prefer the discussion of this application to take place in a private Element/Matrix channel. My username is: @_______:matrix.org (change the homeserver if you use a different one)

@github-actions github-actions bot added the admin-review This application requires a review from an admin. label Jul 25, 2025
@SurfingBowser SurfingBowser marked this pull request as ready for review July 25, 2025 07:56
@SurfingBowser
Copy link
Contributor Author

I have read and hereby sign the Contributor License Agreement.

@takahser takahser self-requested a review July 31, 2025 07:06
Copy link
Contributor

@takahser takahser left a comment

Choose a reason for hiding this comment

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

@SurfingBowser thanks for your interest in our grant program.

I've got a few questions regarding your application:

  • You mention both pallet_balances and pallet_assets in your doc; is this proposal focused on one of the two, or on both of them?
  • The deliverables are currently very vague, could you add more details on what we can expect? For example, "research findings and results" sounds rather generic.
  • If we would sign the grant, what would you envision to be the next step(s) after its completion? Would you continue to work on this, and if yes, in what capacity?

@takahser takahser added the changes requested The team needs to clarify a few things first. label Jul 31, 2025
Copy link
Contributor

github-actions bot commented Aug 1, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@SurfingBowser
Copy link
Contributor Author

@takahser Thank you for the comment and questions.
I've updated the .md file with the following changes

You mention both pallet_balances and pallet_assets in your doc; is this proposal focused on one of the two, or on both of them?

Our initial interest began with pallet_assets but we will only be focused on pallet_balances

The deliverables are currently very vague, could you add more details on what we can expect? For example, "research findings and results" sounds rather generic.

We have updated the deliverables to include more details. We have notably merged 0d & 0e into one Final Research Article.

Number Deliverable Specification
0a. License MIT.
0b. Documentation We will provide informative documentation on our research process and findings. This will be in a dedicated GitHub repository. Will also include 0c-0d deliverables and research artifacts.
0c. Reproducibility We will provide step-by-step guides for the grants team to know what we have done. Includes rust code of the functionality that has been researched and resulting byte code.
0d. Final Research Article We will publish a detailed research article to the Github repository and our website that explains our research findings and results. This includes the reproducibility guide of the 0c deliverable, notably WASM binary compilation artifacts. Textual description of fungible traits specification along with discovered assumptions regarding execution environment, required for its implementation. This article will include a cleaned up and annotated WASM module of pallet_balances. Includes Rust code that is distilled and ready to reason about. Ordinary unit tests to confirm its faithfulness to the original in a classical sense. This prepares pallet_balances for future reasoning.

If we would sign the grant, what would you envision to be the next step(s) after its completion? Would you continue to work on this, and if yes, in what capacity?

Here is a detailed description of how we envision the research steps:

Research findings and next steps.

Our general plan for the complete research consists of three major phases:

  1. Land clearing. Our in-development methodology for program verification relies on reasoning about already compiled WASM modules, so we can not treat them as black-box objects that just need to work somehow. It is important to isolate meaningful code, that specification should be covering, from the surrounding elements of infrastructure, that may slip into compiled modules due to the uncontrollable complexities of build process. To be properly specified, pallet_balances must be first stripped of everything not directly related to its core functionality. If there are any algorithm subtasks, currently delegated to external frameworks, they must be either re-implemented inline, or comprehensively annotated to become explicit suppositions of future spec. Basically, pallet_balances should start looking like it was hand-written with a systematically minimalist approach.
  2. Specification design. Using our in-development language Inference, we write formal specification of traits implemented in subject module, with regard to suppositions, discovered in the previous step. By nature of our tool-chain, this formal specification itself targets a variety of WASM for compilation, though the resulting module is not executable due to its reliance on the controllable non-determinism to express para-virtual branching.
  3. Formal verification. We link together WASM modules of the covered pallet and its formal specification in our in-development Coq-based reasoning environment. Such linking produces Coq theories, that can be roughly summarized as "If non-deterministic execution was possible, this code would terminate successfully". Proving resulting theories by logical means essentially implies, that subject module adheres to the specification in all cases.
    This particular grant application covers only the first point of this plan (Land Clearing), but we are looking forward to continuing our work on the next steps, depending on eligibility of results and your concernment.

As for capacity, for any future grants we hope to increase the existing team capacity. Such an increase would be from FTE of 1.25 to 2. The increase of capacity opens up the opportunity to involve more individuals into the research project. The scale of the team depends on the grant size of course.

@SurfingBowser
Copy link
Contributor Author

I have read and hereby sign the Contributor License Agreement.

@SurfingBowser SurfingBowser requested a review from takahser August 13, 2025 09:21
@SurfingBowser
Copy link
Contributor Author

I just re-requested for review.

@takahser
Copy link
Contributor

@SurfingBowser thx for flagging, I'll reply be tomorrow EOD. Sorry for the delay.

Copy link
Contributor

@takahser takahser left a comment

Choose a reason for hiding this comment

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

@SurfingBowser thanks for the updates and your patience on this.

The scope is a bit clearer now, but the deliverables are still a bit too abstract. Could you add more details to make it easier for other reviewers to evaluate the milestone later?

In particular, feel free to:

  1. Provide concrete examples of what exactly will be delivered.

    • e.g. what invariants or properties of pallet_balances you will verify or prepare for verification.
    • What the annotated WASM module will look like (e.g. how heavily annotated, with what kind of commentary, etc.)
  2. Define clear acceptance criteria so the reviewer of the delivery can confirm when the deliverable is complete later.

    • e.g., “grants team can reproduce bytecode from provided steps and match it against the compiled WASM” or similar.

This would make it much easier to assess the success of the milestone and ensure alignment on expectations.

That said, I think it's worth to try your approach, and I'd be willing to add my approval and open your proposal up to other reviewers, once the deliverables are specific enough.

@SurfingBowser
Copy link
Contributor Author

SurfingBowser commented Aug 26, 2025

Hello, and thanks again @takahser

I have updated the .md file

I've added the Specific Deliverables section as seen below.

Specific Deliverables

We are aiming to prepare verification of pallet_balances adherence to some of the following properties (preliminary list, subject to changes depending on research progress):

  1. Conservation of Total Issuance
    The total issuance must always equal the sum of all account balances (free + held) plus any imbalances (credits/debts) that haven't been handled.
  2. Non-Negative Balances
    No account should ever have a negative free or held balance.
  3. Existential Deposit (ED) Invariant
    No account should have a total balance (free + held) strictly between 0 and ED (exclusive). If it does, the account should be reaped.
  4. Spendable Balance Constraint
    The spendable balance (free minus holds and freezes) should never be negative.
  5. Hold and Freeze Consistency
    Holds are cumulative: the total held is the sum of all holds. Freezes are not cumulative: the effective freeze is the maximum of all freezes.
  6. Transfer Properties
    Accounting preconditions and postconditions.
  7. Slashing Invariant
    When slashing a hold from an account, the held balance and total issuance is reduced by given amount.
  8. Imbalance Handling
    When an imbalance (credit or debt) is dropped, it should adjust total issuance.

The finalized list of formal properties will be refined and re-defined in research artifacts.

Regarding compiled module our primary targets for annotation are points of interaction between pallet_balances and its execution environment. In WASM architecture this would be imported and exported function references. All meaningful externally callable routines of the module will be properly documented, including their calling conventions (in most generic sense, as in "what needs to be done to form arguments and parse results if we manually call WASM?") and conceptual relations to the fungible trait set. Also, every external routine that is called from inside of the module will receive the same treatment, with comprehensive description of its suppositions, adherence to which is required for correct execution.

As for acceptance criteria we propose to use fungible conformance tests that will be executed with the logic preserved and included into the the research repository with the prepared for formal reasoning pallet_balances code. That said, the reasoning ready palette code must pass all conformance tests. As this testing module can not be backported to support the new version of pallet balances we will recreate a full semantic equivalent of this test-suite for manual linkage.

Below is the updated milestone deliverables table:

Number Deliverable Specification
0a. License MIT.
0b. Documentation We will provide informative documentation on our research process and findings. This will be in a dedicated GitHub repository. Will also include 0c-0d deliverables and research artifacts.
0c. Reproducibility We will provide step-by-step guides for the grants team to know what we have done. Includes rust code of the functionality that has been researched and resulting byte code. We will provide .rs files for the fungible conformance tests.
0d. Final Research Article We will publish a detailed research article to the Github repository and our website that explains our research findings and results. This includes the reproducibility guide of the 0c deliverable, notably WASM binary compilation artifacts. Textual description of fungible traits specification along with discovered assumptions regarding execution environment, required for its implementation. All public functions, involved in implementation of traits Inspect, Unbalanced, UnbalancedHold, Mutate, InspectHold, MutateHold, UnbalancedHold, InspectFreeze, MutateFreeze and Balanced. This article will include a cleaned up and annotated WASM module of pallet_balances. Includes Rust code that is distilled and ready to reason about. Ordinary unit tests to confirm its faithfulness to the original in a classical sense. This prepares pallet_balances for future reasoning.

Thank you for your support, if there is anything else we can further clarify please let us know.

@SurfingBowser SurfingBowser requested a review from takahser August 26, 2025 08:31
Copy link
Contributor

@takahser takahser left a comment

Choose a reason for hiding this comment

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

@SurfingBowser thanks for the update.

Scope and deliverables are now much better defined. Happy to add my approval here.

@takahser takahser added ready for review The project is ready to be reviewed by the committee members. and removed changes requested The team needs to clarify a few things first. labels Aug 28, 2025
@takahser
Copy link
Contributor

@SurfingBowser your application has reached enough votes to get accepted, congratulations! 🎉

In connection with your participation in an ecosystem initiative organised by Web 3.0 Technologies Foundation, you agree to the processing of your personal data for identity verification, in order to prevent fraud, ensure eligibility, and maintain the integrity of our processes. This processing is based on legitimate interests under the EU General Data Protection Regulation and on justified organisational needs under the Swiss Federal Act on Data Protection. Please follow this link to complete the KYB (Know Your Business) process. Your information will be handled in line with the Web3 Foundation Privacy and Cookies Policy and the Sumsub Privacy Notice.

@SurfingBowser
Copy link
Contributor Author

@takahser Thank you very much for the opportunity to apply our expertise in this research endeavor.

I do have one more question. I have seen that the W3F has offered direct fiat payments for grants in the past. Is it still possible to receive payment this way, or is it restricted to private grants?

Once again we are looking forward to begin this research. We have begun the KYB process. Is there anything else our team needs to do before proceeding with the grant?

@SurfingBowser
Copy link
Contributor Author

Also we have passed the KYB screening process 😀

@keeganquigley keeganquigley merged commit 877d080 into w3f:master Sep 9, 2025
8 of 12 checks passed
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section on our website for more ways to find answers to your questions.

Before you start, take a moment to read through our announcement guidelines for all communications related to the grant or make them known to the right person in your organisation. In particular, please don't announce the grant publicly before at least the first milestone of your project has been approved. At that point or shortly before, you can get in touch with us at grantsPR@web3.foundation and we'll be happy to collaborate on an announcement about the work you’re doing.

Also, if you haven't yet, consider signing up for the Polkadot Alpha Program. The program offers plenty of resources for people building on Polkadot. Lastly, please remember to let us know in case you run into any delays or deviate from the deliverables in your application. You can either leave a comment here or directly request to amend your application via PR. We wish you luck with your project! 🚀

@keeganquigley keeganquigley removed the admin-review This application requires a review from an admin. label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The project is ready to be reviewed by the committee members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants