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
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: 🔎 Awaiting review
Status: 🔎 Awaiting review
Development

Successfully merging this pull request may close these issues.

2 participants