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 deployment alt gas token #20

Merged
merged 31 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a9e8d35
feat: add contracts for alternative gas token design
zimpha Jul 22, 2024
4be3001
fix: comments
zimpha Jul 22, 2024
0e62f08
feat: add scale to 18 decimals
zimpha Jul 24, 2024
a87c7d7
feat: l1 robust deployment script
yiweichi Jul 24, 2024
591b875
feat: l2 robust deployment script
yiweichi Jul 25, 2024
466c88a
feat: add more comments; use custom error
zimpha Jul 29, 2024
7620c50
merge: feat/alternative_gas_token
yiweichi Jul 29, 2024
1ffb7da
feat: add unit tests
zimpha Jul 29, 2024
b1f9ecf
merge: alternative gas token
yiweichi Jul 30, 2024
a06bb49
feat: alternative gas token deployment script
yiweichi Jul 30, 2024
a411597
fix: example gas token
yiweichi Jul 31, 2024
ab8002e
fix: deployment script L2_WETH_GATEWAY_PROXY_ADDR transfer ownership
yiweichi Aug 2, 2024
3082fc1
Merge branch 'feat-deterministic-deployment' into feat-deployment-alt…
yiweichi Aug 4, 2024
fbd92da
fix: SAFE_GAS_LIMIT in contract L1WrappedTokenGateway
yiweichi Aug 7, 2024
85cd399
Merge branch 'feat-deployment-alt-gas-token' of https://github.com/sc…
yiweichi Aug 7, 2024
b4d7694
feat: add gas_token_gateway to bridge-history config
yiweichi Aug 9, 2024
b4cc238
feat: config example gas token decimal
yiweichi Aug 9, 2024
61ebdd1
fit: add frontend config values
yiweichi Aug 12, 2024
4d2b3c6
fix: emit DepositWrappedToken event (#23)
yiweichi Aug 13, 2024
5489c1d
feat: chain-monitor config support alt-gas-token
yiweichi Aug 14, 2024
ca2acbe
Merge branch 'feat-deployment-alt-gas-token' of https://github.com/sc…
yiweichi Aug 14, 2024
429c441
fixt: load gas_token_gateway to config
yiweichi Aug 15, 2024
ee696f8
feat: lock tokens in bridge after deployment
Thegaram Aug 15, 2024
b8d6ec9
fix: restore chain monitor config confirm block
yiweichi Aug 15, 2024
161b2dd
Merge branch 'feat-deployment-alt-gas-token' into feat-lock-tokens-af…
yiweichi Aug 16, 2024
2f3e91e
fix: use transfer when lock tokens
yiweichi Aug 16, 2024
923ead9
fix: skip check funds if use test gas token
yiweichi Aug 18, 2024
18a483e
fix: remove redundant code from gen-configs.sh
yiweichi Aug 18, 2024
446bd8f
feat: lock tokens in bridge after deployment (#24)
Thegaram Aug 18, 2024
91aee29
fix: predict L1GasTokenGateway address issue
yiweichi Aug 18, 2024
e5bdf6f
Merge branch 'feat-deployment-alt-gas-token' of https://github.com/sc…
yiweichi Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker/config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ MAX_L1_MESSAGE_GAS_LIMIT = 10000000

L1_CONTRACT_DEPLOYMENT_BLOCK = 0

ALTERNATIVE_GAS_TOKEN_ENABLED = true
# EXAMPLE_GAS_TOKEN_DECIMAL = 6
Thegaram marked this conversation as resolved.
Show resolved Hide resolved

TEST_ENV_MOCK_FINALIZE_ENABLED = true
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = 3600

Expand Down Expand Up @@ -64,6 +67,7 @@ L1_PLONK_VERIFIER_ADDR = "0x0000000000000000000000000000000000000001"
[contracts.overrides]

# L1_WETH = "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"
# L1_GAS_TOKEN = "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"

L2_MESSAGE_QUEUE = "0x5300000000000000000000000000000000000000"
L1_GAS_PRICE_ORACLE = "0x5300000000000000000000000000000000000002"
Expand Down
5 changes: 0 additions & 5 deletions docker/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ if [ "$L2_RPC_ENDPOINT" = "" ]; then
L2_RPC_ENDPOINT="http://host.docker.internal:8545"
fi

if [ "${L1_RPC_ENDPOINT}" = "" ]; then
echo "L1_RPC_ENDPOINT is not set"
L1_RPC_ENDPOINT="http://host.docker.internal:8543"
fi

if [ "${BATCH_SIZE}" = "" ]; then
BATCH_SIZE="100"
fi
Expand Down
19 changes: 18 additions & 1 deletion docker/scripts/gen-configs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#!/bin/bash

# the deployment of the L1GasTokenGateway implementation necessitates fetching the gas token decimal
# in this case it requires the context of layer 1
gen_config_contracts_toml() {
config_file="./volume/config.toml"
gas_token_addr=$(grep -E "^L1_GAS_TOKEN =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
gas_token_enabled=$(grep -E "^ALTERNATIVE_GAS_TOKEN_ENABLED =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
l1_rpc_url=$(grep -E "^L1_RPC_ENDPOINT =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2- | sed 's/"//g')

if [[ "$gas_token_enabled" == "true" && "$gas_token_addr" != "" && "$gas_token_addr" != "0x0000000000000000000000000000000000000000" ]]; then
echo "gas token enabled and address provided"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --rpc-url "$l1_rpc_url" --sig "run(string,string)" "none" "write-config" || exit 1
else
echo "gas token disabled or address not provided"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
fi
}

echo ""
echo "generating config-contracts.toml"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
gen_config_contracts_toml

echo ""
echo "generating genesis.json"
Expand Down
4 changes: 3 additions & 1 deletion docker/templates/bridge-history-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"USDCGatewayAddr": "0x0000000000000000000000000000000000000000",
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000"
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000",
"GasTokenGatewayAddr": null,
"WrappedTokenGatewayAddr": null
},
"L2": {
"confirmation": 0,
Expand Down
8 changes: 5 additions & 3 deletions docker/templates/chain-monitor-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
"dai_gateway": "0x0000000000000000000000000000000000000000",
"usdc_gateway": "0x0000000000000000000000000000000000000000",
"lido_gateway": "0x0000000000000000000000000000000000000000",
"puffer_gateway": "0x0000000000000000000000000000000000000000"
"puffer_gateway": "0x0000000000000000000000000000000000000000",
"gas_token_gateway": null
},
"scroll_messenger": null,
"message_queue": null,
"scroll_chain": null
"scroll_chain": null,
"gas_token": null
},
"start_messenger_balance": null
"start_messenger_balance": 0
Comment on lines -23 to +25
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.

},
"l2_config": {
"l2_url": null,
Expand Down
4 changes: 4 additions & 0 deletions docker/templates/config-contracts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ L1_ERC721_GATEWAY_PROXY_ADDR = ""
L1_ERC1155_GATEWAY_PROXY_ADDR = ""
L2_MESSAGE_QUEUE_ADDR = ""
L1_GAS_PRICE_ORACLE_ADDR = ""
L1_GAS_TOKEN_ADDR = ""
L1_GAS_TOKEN_GATEWAY_IMPLEMENTATION_ADDR = ""
L1_GAS_TOKEN_GATEWAY_PROXY_ADDR = ""
L1_WRAPPED_TOKEN_GATEWAY_ADDR = ""
L2_WHITELIST_ADDR = ""
L2_WETH_ADDR = ""
L2_TX_FEE_VAULT_ADDR = ""
Expand Down
2 changes: 1 addition & 1 deletion docker/templates/rollup-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"gas_price_diff": 50000
},
"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.

"try_times": 5,
"base_url": "http://chain-monitor:8080"
Expand Down
4 changes: 4 additions & 0 deletions scripts/deterministic/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ abstract contract Configuration is Script {

uint256 internal L1_CONTRACT_DEPLOYMENT_BLOCK;

bool internal ALTERNATIVE_GAS_TOKEN_ENABLED;

bool internal TEST_ENV_MOCK_FINALIZE_ENABLED;
uint256 internal TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC;

Expand Down Expand Up @@ -110,6 +112,8 @@ abstract contract Configuration is Script {

L1_CONTRACT_DEPLOYMENT_BLOCK = cfg.readUint(".general.L1_CONTRACT_DEPLOYMENT_BLOCK");

ALTERNATIVE_GAS_TOKEN_ENABLED = cfg.readBool(".general.ALTERNATIVE_GAS_TOKEN_ENABLED");

TEST_ENV_MOCK_FINALIZE_ENABLED = cfg.readBool(".general.TEST_ENV_MOCK_FINALIZE_ENABLED");
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = cfg.readUint(".general.TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC");

Expand Down
Loading
Loading