Skip to content

Conversation

@yiweichi
Copy link
Member

@yiweichi yiweichi commented Aug 3, 2024

Add alternative gas token contracts and deployment scripts.

@yiweichi yiweichi requested review from Thegaram, dghelm and zimpha August 4, 2024 18:34
@yiweichi yiweichi force-pushed the feat-deployment-alt-gas-token branch from 3b4e1fd to 61ebdd1 Compare August 12, 2024 16:32
Comment on lines -23 to +25
"start_messenger_balance": null
"start_messenger_balance": 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 0? L1 messenger balance will not be 0 in a real deployment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized it's missing. Added a draft here: #24 probably needs some adjustments.

Copy link
Member

Choose a reason for hiding this comment

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

I think contracts don't need chain_monitor config, also the bridge-history-config.json

Copy link
Member Author

Choose a reason for hiding this comment

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

I think contracts don't need chain_monitor config, also the bridge-history-config.json

Yes, this is mainly because we want to have a single command to generate all config files for scroll-sdk, so here the file https://github.com/scroll-tech/scroll-contracts/blob/feat-deployment-alt-gas-token/docker/scripts/gen-configs.sh will help to do so.

Copy link
Member

Choose a reason for hiding this comment

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

i see. but i don't like this way. why not generate the configs in scroll-sdk repo?

Copy link
Member Author

@yiweichi yiweichi Aug 15, 2024

Choose a reason for hiding this comment

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

Not sure, I guess that because lots of config files need contracts addresses. generate the config files here would be convenient to get/predict those addresses?
Need @Thegaram to confirm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is a convenient way to generate the configs before actually deploying the contracts. But I'm fine with moving the GenerateConfigs logic into scroll-sdk, or maybe add it to Daniel's cli.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why 0? L1 messenger balance will not be 0 in a real deployment.

For this, my original thinking is to burn rest of the deployer balance to all zero address, so we can set chain monitor start_messenger_balance to 0. but in this way L2 contracts deployment gas fee may not be burned.

but with #24 , would be better.

"chain_monitor": {
"enabled": false,
"enabled": true,
"timeout": 3,
Copy link
Member

@georgehao georgehao Aug 15, 2024

Choose a reason for hiding this comment

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

Why contract need bridge-history-api, rollup, chain-monitor config @zimpha

Copy link
Member Author

Choose a reason for hiding this comment

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

This is mainly because we want to have a single command to generate all config files for scroll-sdk, so here the file https://github.com/scroll-tech/scroll-contracts/blob/feat-deployment-alt-gas-token/docker/scripts/gen-configs.sh will help to do so.


/// @dev Only execute block if it's requied by alternative gas token mode.
modifier gasToken(bool gasTokenRequire) {
if (ALTERNATIVE_GAS_TOKEN_ENABLED != gasTokenRequire) {
Copy link
Member

Choose a reason for hiding this comment

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

weird, IMO, if set ALTERNATIVE_GAS_TOKEN_ENABLED=true represents alternative gas token enabled, why need pass gasTokenRequire to check the consistency. if ALTERNATIVE_GAS_TOKEN_ENABLED=fase && gasTokenRequire == false, this check (ALTERNATIVE_GAS_TOKEN_ENABLED != gasTokenRequire) will also verify pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

Some functions are only run when alternative gas token is enabled: gasToken(true). Others are run when alternative gas token is disabled: gasToken(false).

You need both, ALTERNATIVE_GAS_TOKEN_ENABLED is the user config for the rollup, while gasTokenRequire is for the script to decide to enable/disable certain functions.

If both are false then the check will evaluate to false (false != false is false), i.e. we will run the function instead of returning early.

@yiweichi yiweichi merged commit 187563f into feat-deterministic-deployment Aug 20, 2024
@yiweichi yiweichi deleted the feat-deployment-alt-gas-token branch August 20, 2024 17:15
yiweichi added a commit that referenced this pull request Aug 20, 2024
Co-authored-by: zimpha <[email protected]>
Co-authored-by: Péter Garamvölgyi <[email protected]>
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.

5 participants