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

Variables that are assigned only once are changed to constants #83

Merged
merged 13 commits into from
May 15, 2024

Conversation

iteyelmp
Copy link
Contributor

@iteyelmp iteyelmp commented Apr 17, 2024

fix issues #70 : Because the contract is changed to upgradeable mode, immutables cannot be initialized in the constructor, so they are changed to constant format.
In the test script, a new solidity file is dynamically compiled to generate byteCode to replace the initial byteCode to achieve constant changes.

old constants

 17, // maxKvSizeBits, 131072
 39, // shardSizeBits ~ 512G
 2, // randomChecks
 4718592000, // minimumDiff 5 * 3 * 3600 * 1024 * 1024 / 12 = 4718592000 for 5 replicas that can have 1M IOs in one epoch
 7200, // cutoff = 2/3 * target internal (3 hours), 3 * 3600 * 2/3
 32, // diffAdjDivisor
 100, // treasuryShare, means 1%

 startTime, // startTime
 1500000000000000, // storageCost - 1,500,000Gwei forever per blob - https://ethresear.ch/t/ethstorage-scaling-ethereum-storage-via-l2-and-da/14223/6#incentivization-for-storing-m-physical-replicas-1
 340282366367469178095360967382638002176n, // dcfFactor, it mean 0.95 for yearly discount
 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s: 4k * 2(random checks) / 6144 = 1.3s
 treasuryAddress, // treasury
 3145728000000000000000n, // prepaidAmount - 50% * 2^39 / 131072 * 1500000Gwei, it also means 3145 ETH for half of the shard

gas used
https://dashboard.tenderly.co/lxs/project/tx/sepolia/0xd50f0758967e9826a748f9f76772eeb4be1700ffc37289649fa46eb16c0468b1/gas-usage

@iteyelmp iteyelmp requested review from qzhodl and qizhou April 17, 2024 07:12
@iteyelmp iteyelmp requested review from qzhodl and ping-ke April 19, 2024 05:52
@qzhodl qzhodl requested a review from syntrust April 19, 2024 10:05
scripts/deploy.js Outdated Show resolved Hide resolved
@qzhodl
Copy link
Contributor

qzhodl commented Apr 22, 2024

Because the contract is changed to upgradeable mode, immutables cannot be initialized in the constructor, so they are changed to constant format. In the test script, a new solidity file is dynamically compiled to generate byteCode to replace the initial byteCode to achieve constant changes.

Generally, a good practice for a PR explanation is to clarify which issue the PR is trying to fix, and what is your solution

@iteyelmp iteyelmp changed the base branch from main to develop April 23, 2024 06:37
@iteyelmp iteyelmp requested review from qzhodl, ping-ke and syntrust April 23, 2024 08:13
@syntrust
Copy link
Contributor

So we may need a brand new testnet to test the PR if we want use the code in the mainnet, right?

@iteyelmp iteyelmp changed the base branch from develop to main April 24, 2024 04:14
@iteyelmp
Copy link
Contributor Author

So we may need a brand new testnet to test the PR if we want use the code in the mainnet, right?

The "sepolia-test" branch was created to archive the currently used contract code.

package.json Outdated Show resolved Hide resolved
@iteyelmp iteyelmp requested a review from qzhodl April 24, 2024 06:14
hardhat.config.js Outdated Show resolved Hide resolved
@iteyelmp iteyelmp requested a review from qzhodl May 15, 2024 02:14
hardhat.config.js Outdated Show resolved Hide resolved
@iteyelmp iteyelmp requested a review from qzhodl May 15, 2024 10:34
@iteyelmp iteyelmp merged commit 7538b23 into main May 15, 2024
@iteyelmp iteyelmp deleted the overried branch May 16, 2024 02:25
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.

4 participants