Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lazer/contracts/evm): Add fees for verification #2163

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

darunrs
Copy link
Contributor

@darunrs darunrs commented Dec 3, 2024

No description provided.

Copy link

vercel bot commented Dec 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 5:47pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 5:47pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 5:47pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Dec 3, 2024 5:47pm
insights ⬜️ Ignored (Inspect) Visit Preview Dec 3, 2024 5:47pm

@@ -6,6 +6,7 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
TrustedSignerInfo[2] public trustedSigners;
uint256 public verification_fee = 0.00001 ether;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what is an appropriate fee. Changing this value does not impact the tests (Unless the fee is a fractional wei which I don't think is possible?) so we can just change this to whatever we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this 1 wei? I thought 1 eth was 10^18 wei

address bob = makeAddr("bob");
vm.deal(bob, 1 ether);

// Alice provides appropriate fee
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to just bunch these all together. I can also make them separate unit tests too, but I liked the idea of making more than one call on an account and confirming their balance changes as expected.

ali-bahjati
ali-bahjati previously approved these changes Dec 3, 2024
@@ -6,6 +6,7 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
TrustedSignerInfo[2] public trustedSigners;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The storage is incremental in EVM. I recommend we leave room for more signers here so we can add more signers. A better thing to do is to transition from having a list of signers to a map of addressSigner to expiresAt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just an FYI for this, by replacing it with a mapping, we seem to incur some costs:

  1. We take up semi-random storage slots for hashed items in the mapping instead of a linear sequence of slots. This means collisions become possible, though very unlikely.
  2. Scanning through the items in the mapping are basically impossible, especially considering gas fees. This means migrating the mapping in any way would be pretty difficult since modifying the struct changes the slots taken up by each item, and making a new map would be tricky since it would be hard to transfer the data over.

I would rather increase the size to a comfortable size like 100, rather than change to a map which we would have issues working with. This is based on what I've learned so far, so I could be wrong on some of these things. Please do let me know if something is wrong in my considerations above.

@ali-bahjati ali-bahjati dismissed their stale review December 3, 2024 18:23

i noticed something after review

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.

3 participants