Skip to content

Conversation

wjmelements
Copy link
Contributor

@wjmelements wjmelements commented Sep 27, 2025

Reviewer @ZenGround0
https://github.com/filecoin-project/fvm-solidity
I made this library to reuse the precompile code and its mocks across repositories, after demonstrating that the precompile native send method uses less gas.
See also the related filecoin-pay changeset: FilOzone/filecoin-pay#234

Changes

  • add fvm-solidity dependency for access to precompile
  • use FVMPay library for native burn and native payment
  • fix tests
  • use FVMRandom library for GetBeaconRandomness precompile

@FilOzzy FilOzzy added this to FS Sep 27, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Sep 27, 2025
@wjmelements wjmelements added the enhancement New feature or request label Sep 27, 2025
@wjmelements
Copy link
Contributor Author

This branch also has #206 because the fvm-solidity library currently requires 0.8.30.

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FS Sep 29, 2025
@rjan90 rjan90 moved this to 🔎 Awaiting review in PDP Sep 29, 2025

// Decode and return the result
return abi.decode(result, (uint256));
return epoch.getBeaconRandomness();
Copy link
Collaborator

@Kubuxu Kubuxu Oct 3, 2025

Choose a reason for hiding this comment

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

I'm not a huge fan of augmenting uint256 like this. It makes the source of this less clear. It feels a touch too clever.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function burnFee(uint256 amount) internal {
require(msg.value >= amount, "Incorrect fee amount");
(bool success,) = BURN_ACTOR.call{value: amount}("");
bool success = amount.burn();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing as with randomness, IM,O there is no harm in it being FVMPay.burn(amount) and it makes the code much more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wjmelements wjmelements requested a review from Kubuxu October 3, 2025 17:41
Copy link
Collaborator

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

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

SGTM, just got some conflicts

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FS Oct 6, 2025
@wjmelements wjmelements changed the title feat: use precompile for native payments and burn feat: use fvm precompiles for native payments, burn, beacon randomness Oct 6, 2025
@wjmelements wjmelements merged commit fc812ab into main Oct 6, 2025
3 checks passed
@wjmelements wjmelements deleted the fvm-solidity branch October 6, 2025 18:38
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to 🎉 Done in PDP Oct 6, 2025
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FS Oct 6, 2025
wjmelements added a commit to FilOzone/filecoin-services that referenced this pull request Oct 17, 2025
Reviewer @rvagg
Similar to FilOzone/pdp#207 and
FilOzone/filecoin-pay#234
#### Changes
* burn with fvm pay
* mock with MockFVMTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 🎉 Done
Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

2 participants