Comments (2)
Hi @ernestognw,
I wasn't familiar with this ERC, I just finished reading it and checked the links you sent.
Right now my best approach is to add an alternative test_deploy with the consecutive minting for ERC2309-compliant tokens, but I wanted to open a discussion before sending the PR.
I agree. I also don't think it's worth it doing a _mintConsecutive
benchmark outside of the constructor because it seem like it is not supposed to be used outside of it since it breaks the ERC721 standard like you mentioned. So if we're doing just the constructor benchmark, we can add a table below the deploy
table, maybe something like:
How much gas to deploy the ERC2309 compliant contracts when minting N tokens in the constructor?
Implementation | 1 | 100 | 1000 | 10000 |
---|---|---|---|---|
ERC721A | 1000 | 2000 | 3000 | 4000 |
OpenZeppelin Consecutive | 1000 | 2000 | 3000 | 4000 |
However, it fails because the _mintConsecutive(to, amount) is called outside the constructor, and I don't see an easy workaround.
For the tests we can have a mock that calls the _mintConsecutive
in the constructor e.g:
// ... imports
contract ERC721_OZConsecutive is ERC721Consecutive {
constructor(uint96 amount) ERC721("Name", "Sy") {
// Passing any random address so we don't have to do it in the test functions
_mintConsecutive(0x1000000000000000000000000000000000000000, amount);
}
}
then for the test functions we just create a new instance of that mock contract and pass the amount
// ...imports
contract ERC721_OZConsecutive_deploy_Test is ERC721Consecutive {
function test_deploy_1() public {
ERC721OZConsecutive sut = new ERC721OZConsecutive(1)
}
function test_deploy_1000() public {
ERC721OZConsecutive sut = new ERC721OZConsecutive(1000)
}
// ...
}
Le me know what you think!
from solidity-benchmarks.
Thank you very much @alephao, your explanation was really helpful. I started doing some experiments with what you suggested and I just sent a new PR including the ERC721-ERC2309 variations and updated the docs and scripts.
I have the feeling that is kinda complicated to follow the instructions for ERC2309 tokens, but I don't think it should be thought as a new variation (separated from ERC721). From your examples I assume you'd think the same.
Let me know your thoughts :D
from solidity-benchmarks.
Related Issues (9)
- Add benchmarks for solidity 0.8.14~0.8.17
- [Feature request] benchmark deployment costs HOT 1
- feat: benchmark by compiler version
- use gyb instead of stencil for codegen
- feat: add ERC721 burn HOT 3
- chore: hide/ignore inapplicable tests
- Provide a JSON file with all the data HOT 2
- explicitly state the features of a contract for a more fair comparison HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solidity-benchmarks.