OptimismPortal2 set initial _balance through StorageSetter pattern#254
OptimismPortal2 set initial _balance through StorageSetter pattern#254
_balance through StorageSetter pattern#254Conversation
op-e2e/celo/src/chain.js
Outdated
| @@ -1,8 +1,8 @@ | |||
| import { chainConfig } from 'viem/op-stack' | |||
| import { defineChain } from 'viem' | |||
| import { chainConfig } from "viem/op-stack"; | |||
There was a problem hiding this comment.
Why the switch from single to double quotes here? The other js files in this dir seem to all be using single quotes
There was a problem hiding this comment.
You're right - this was mainly due to my editor doing automatic formats on save.
I now added a .prettierrc.toml config and formatted all files consistently.
There was a problem hiding this comment.
Looks like the tab width of 4 is not working out here, there are now about 7k lines of changed code, I think 2 is probably the right value, or whatever doesn't reformat any of the codebase.
There was a problem hiding this comment.
Also, let's move out the re-formatting to a separate PR if needed.
| uint256 initialBalance = 0; | ||
| customGasTokenAddress = cfg.customGasTokenAddress(); | ||
| IERC20 token = IERC20(customGasTokenAddress); | ||
| initialBalance = token.balanceOf(optimismPortalProxy); |
There was a problem hiding this comment.
Where is the balance of the optimismPortalProxy set?
There was a problem hiding this comment.
This is set within the Deploy.s.sol script:
Our Celo L1 Token contract takes the Portal address as an initializer argument:
optimism/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Lines 1693 to 1697 in 981f87f
And then mints the whole market cap to the provided addresses balance:
optimism/packages/contracts-bedrock/src/celo/CeloTokenL1.sol
Lines 8 to 14 in 981f87f
op-e2e/celo/src/withdraw.js
Outdated
|
|
||
| const l2GasPayment = | ||
| receipt.gasUsed * receipt.effectiveGasPrice + receipt.l1Fee | ||
| const l2GasPayment = receipt.gasUsed * receipt.effectiveGasPrice; |
There was a problem hiding this comment.
I thought we want to keep the l1Fee, just have it 0 everywhere, maybe doesn't make sense to remove it here.
There was a problem hiding this comment.
True, but it seems this is not yet reflected in the code. This means that receipt values do not align with deducted values.
This should only happen when the blobbasefeeScalar and basefeeScalar are not set to 0.
I opened an issue for it, I don't know if we were aware of this behavior already.
A hot-fix to make the test pass would be to set the blobbasefeeScalar and basefeeScalar values to 0 in the devnet deploy-config - currently the default values are used.
There was a problem hiding this comment.
The change is in op-geth and we didn't update the dependency yet. I'll probably do it as part of the optimism repo rebase.
981f87f to
e68c0e3
Compare
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/viem@2.17.4 |
|
So I added the However the I checked the https://go.dev/play/p/8PN2lhQ-QGE This is the same value that I could observe in the transaction receipts. For now I don't know what's wrong here, but this is likely something that happens in the payload building in the L2 node. I suggest we postpone fixing the tests for now and review this PR mainly for the changes to the @pahor167 , could you have a look at this part of the PR? |
There was a problem hiding this comment.
Does your editor change the indentation or did npm change in this respect? If it's your editor, please avoid the additional diff (for this and the other json files).
There was a problem hiding this comment.
Ah, it is probably prettier. We should avoid having npm and prettier fight over the formatting.
There was a problem hiding this comment.
I think npm doesn't have auto-formatting included. Before, the code probably has been formatted by an editor's global settings of prettier or the LanguageServer.
The problem with the diff was the tab-width setting in prettier - I changed it to 2, which seem to have been the setting the code has been formatted with previously. This got rid of most of the diff.
I added the npm run format script that calls prettier in write mode with the checked in prettier config file.
Like that we can have an opinionated formatter for the e2e tests from now on and avoid larger formatting diffs in the future. Maybe we can include this in a pre-commit config or CI run as well.
There was a problem hiding this comment.
Just for comparison the formatting instructions in our op-geth e2e tests: https://github.com/celo-org/op-geth/blob/celo8/e2e_test/js-tests/Makefile
We could adjust them to be the same (same formatter, same config and called int the same way), but we can do that later.
8762b47 to
72e56e4
Compare
Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs.
72e56e4 to
7009efb
Compare
| commands[2] = string.concat("[[ -f ", filePath, " ]] && echo \"present\""); | ||
| commands[2] = string.concat("[[ -f ", filePath, ' ]] && echo "present"'); |
There was a problem hiding this comment.
This looks like an unnecessary change. Did you do it intentionally or did an autoformatter do this?
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
…254) * OptimismPortal2 set initial `_balance` through StorageSetter pattern Fixes #239 The custom gas-token feature adaptation for the fault-proof system using the `OptimismPortal2` contract has been merged recently upstream. We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's `_balance` value to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2. Those changes are now adapted also to the `OptimismPortal2`, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs. * Adapt withdraw e2e-tests to work with fault-proofs * Use prettier for formatting e2e tests * Fix typo Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com> * Set L1-fee scalars to zero in devnet --------- Co-authored-by: Valentin Rodygin <20768968+carterqw2@users.noreply.github.com>
Fixes #239
The custom gas-token feature adaptation for the fault-proof system using the
OptimismPortal2contract has been merged recently upstream.We are using the custom-gas-token feature and additionally require a modification of the OptimismPortal's
_balancevalue to be set to the entire allocation of Celo on the L2 - meaning that all L1 token is initially locked in the bridge and only usable on the L2.Those changes are now adapted also to the
OptimismPortal2, which was a requirement to make our custom-gas-token pre-locked balance feature work in conjunction with fault-proofs.