From bd2303a4d2fe6a5c649dff4f209a4882d9bc092f Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 22 May 2023 14:02:16 +0800 Subject: [PATCH] Use abigen with new flag --contract --- common/bytecode/Makefile | 29 ++++++++++--------- .../{ethgateway => gateways}/L1ETHGateway.sol | 0 .../L1MessageQueue.sol | 0 .../L2GasPriceOracle.sol | 0 .../{scrollchain => rollup}/ScrollChain.sol | 0 .../{ethgateway => gateways}/L2ETHGateway.sol | 0 .../L1BlockContainer.sol | 0 .../L1GasPriceOracle.sol | 0 .../L2MessageQueue.sol | 0 .../{feevault => predeploys}/L2TxFeeVault.sol | 0 tests/integration-test/contracts_test.go | 16 +++++----- 11 files changed, 24 insertions(+), 21 deletions(-) rename common/bytecode/scroll/L1/{ethgateway => gateways}/L1ETHGateway.sol (100%) rename common/bytecode/scroll/L1/{messagequeue => rollup}/L1MessageQueue.sol (100%) rename common/bytecode/scroll/L1/{priceoracle => rollup}/L2GasPriceOracle.sol (100%) rename common/bytecode/scroll/L1/{scrollchain => rollup}/ScrollChain.sol (100%) rename common/bytecode/scroll/L2/{ethgateway => gateways}/L2ETHGateway.sol (100%) rename common/bytecode/scroll/L2/{container => predeploys}/L1BlockContainer.sol (100%) rename common/bytecode/scroll/L2/{priceoracle => predeploys}/L1GasPriceOracle.sol (100%) rename common/bytecode/scroll/L2/{messagequeue => predeploys}/L2MessageQueue.sol (100%) rename common/bytecode/scroll/L2/{feevault => predeploys}/L2TxFeeVault.sol (100%) diff --git a/common/bytecode/Makefile b/common/bytecode/Makefile index dab53d655..11979ba1b 100644 --- a/common/bytecode/Makefile +++ b/common/bytecode/Makefile @@ -1,31 +1,34 @@ .PHONY: all erc20 greeter scroll clean +# TODO: After `feat/upgrade_abigen` branch merged, change to use develop branch again. +abigen="go run github.com/scroll-tech/go-ethereum/cmd/abigen@14a21cc835017ee2c17aaab52c4454b0d49ec7ba" + all: erc20 greeter scroll erc20: - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol erc20/ERC20Mock.sol --pkg erc20 --out erc20/ERC20Mock.go + abigen --sol erc20/ERC20Mock.sol --pkg erc20 --out erc20/ERC20Mock.go --contract ERC20Mock greeter: - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./greeter/Greeter.sol --pkg greeter --out ./greeter/Greeter.go + abigen --sol ./greeter/Greeter.sol --pkg greeter --out ./greeter/Greeter.go --contract Greeter scroll: #L1/gateways - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol scroll/L1/ethgateway/L1ETHGateway.sol --pkg ethgateway --out scroll/L1/ethgateway/L1ETHGateway.go + abigen --sol scroll/L1/gateways/L1ETHGateway.sol --pkg gateways --out scroll/L1/gateways/L1ETHGateway.go --contract L1ETHGateway #L1/rollup - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L1/messagequeue/L1MessageQueue.sol --pkg messagequeue --out ./scroll/L1/messagequeue/L1MessageQueue.go - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L1/priceoracle/L2GasPriceOracle.sol --pkg priceoracle --out ./scroll/L1/priceoracle/L2GasPriceOracle.go - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L1/scrollchain/ScrollChain.sol --pkg scrollchain --out ./scroll/L1/scrollchain/ScrollChain.go + abigen --sol ./scroll/L1/rollup/L1MessageQueue.sol --pkg rollup --out ./scroll/L1/rollup/L1MessageQueue.go --contract L1MessageQueue + abigen --sol ./scroll/L1/rollup/L2GasPriceOracle.sol --pkg rollup --out ./scroll/L1/rollup/L2GasPriceOracle.go --contract L2GasPriceOracle + abigen --sol ./scroll/L1/rollup/ScrollChain.sol --pkg rollup --out ./scroll/L1/rollup/ScrollChain.go --contract ScrollChain #L1 - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L1/L1ScrollMessenger.sol --pkg l1 --out ./scroll/L1/L1ScrollMessenger.go + abigen --sol ./scroll/L1/L1ScrollMessenger.sol --pkg l1 --out ./scroll/L1/L1ScrollMessenger.go --contract L1ScrollMessenger #L2/gateways - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/ethgateway/L2ETHGateway.sol --pkg ethgateway --out ./scroll/L2/ethgateway/L2ETHGateway.go + abigen --sol ./scroll/L2/gateways/L2ETHGateway.sol --pkg gateways --out ./scroll/L2/gateways/L2ETHGateway.go --contract L2ETHGateway #L2/predeploys - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/container/L1BlockContainer.sol --pkg container --out ./scroll/L2/container/L1BlockContainer.go - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/priceoracle/L1GasPriceOracle.sol --pkg priceoracle --out ./scroll/L2/priceoracle/L1GasPriceOracle.go - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/messagequeue/L2MessageQueue.sol --pkg messagequeue --out ./scroll/L2/messagequeue/L2MessageQueue.go - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/feevault/L2TxFeeVault.sol --pkg feevault --out ./scroll/L2/feevault/L2TxFeeVault.go + abigen --sol ./scroll/L2/predeploys/L1BlockContainer.sol --pkg predeploys --out ./scroll/L2/predeploys/L1BlockContainer.go --contract L1BlockContainer + abigen --sol ./scroll/L2/predeploys/L1GasPriceOracle.sol --pkg predeploys --out ./scroll/L2/predeploys/L1GasPriceOracle.go --contract L1GasPriceOracle + abigen --sol ./scroll/L2/predeploys/L2MessageQueue.sol --pkg predeploys --out ./scroll/L2/predeploys/L2MessageQueue.go --contract L2MessageQueue + abigen --sol ./scroll/L2/predeploys/L2TxFeeVault.sol --pkg predeploys --out ./scroll/L2/predeploys/L2TxFeeVault.go --contract L2TxFeeVault #L2 - go run github.com/scroll-tech/go-ethereum/cmd/abigen --sol ./scroll/L2/L2ScrollMessenger.sol --pkg l2 --out ./scroll/L2/L2ScrollMessenger.go + abigen --sol ./scroll/L2/L2ScrollMessenger.sol --pkg l2 --out ./scroll/L2/L2ScrollMessenger.go --contract L2ScrollMessenger clean: find ./ -type f -name "*.go" | xargs rm -r diff --git a/common/bytecode/scroll/L1/ethgateway/L1ETHGateway.sol b/common/bytecode/scroll/L1/gateways/L1ETHGateway.sol similarity index 100% rename from common/bytecode/scroll/L1/ethgateway/L1ETHGateway.sol rename to common/bytecode/scroll/L1/gateways/L1ETHGateway.sol diff --git a/common/bytecode/scroll/L1/messagequeue/L1MessageQueue.sol b/common/bytecode/scroll/L1/rollup/L1MessageQueue.sol similarity index 100% rename from common/bytecode/scroll/L1/messagequeue/L1MessageQueue.sol rename to common/bytecode/scroll/L1/rollup/L1MessageQueue.sol diff --git a/common/bytecode/scroll/L1/priceoracle/L2GasPriceOracle.sol b/common/bytecode/scroll/L1/rollup/L2GasPriceOracle.sol similarity index 100% rename from common/bytecode/scroll/L1/priceoracle/L2GasPriceOracle.sol rename to common/bytecode/scroll/L1/rollup/L2GasPriceOracle.sol diff --git a/common/bytecode/scroll/L1/scrollchain/ScrollChain.sol b/common/bytecode/scroll/L1/rollup/ScrollChain.sol similarity index 100% rename from common/bytecode/scroll/L1/scrollchain/ScrollChain.sol rename to common/bytecode/scroll/L1/rollup/ScrollChain.sol diff --git a/common/bytecode/scroll/L2/ethgateway/L2ETHGateway.sol b/common/bytecode/scroll/L2/gateways/L2ETHGateway.sol similarity index 100% rename from common/bytecode/scroll/L2/ethgateway/L2ETHGateway.sol rename to common/bytecode/scroll/L2/gateways/L2ETHGateway.sol diff --git a/common/bytecode/scroll/L2/container/L1BlockContainer.sol b/common/bytecode/scroll/L2/predeploys/L1BlockContainer.sol similarity index 100% rename from common/bytecode/scroll/L2/container/L1BlockContainer.sol rename to common/bytecode/scroll/L2/predeploys/L1BlockContainer.sol diff --git a/common/bytecode/scroll/L2/priceoracle/L1GasPriceOracle.sol b/common/bytecode/scroll/L2/predeploys/L1GasPriceOracle.sol similarity index 100% rename from common/bytecode/scroll/L2/priceoracle/L1GasPriceOracle.sol rename to common/bytecode/scroll/L2/predeploys/L1GasPriceOracle.sol diff --git a/common/bytecode/scroll/L2/messagequeue/L2MessageQueue.sol b/common/bytecode/scroll/L2/predeploys/L2MessageQueue.sol similarity index 100% rename from common/bytecode/scroll/L2/messagequeue/L2MessageQueue.sol rename to common/bytecode/scroll/L2/predeploys/L2MessageQueue.sol diff --git a/common/bytecode/scroll/L2/feevault/L2TxFeeVault.sol b/common/bytecode/scroll/L2/predeploys/L2TxFeeVault.sol similarity index 100% rename from common/bytecode/scroll/L2/feevault/L2TxFeeVault.sol rename to common/bytecode/scroll/L2/predeploys/L2TxFeeVault.sol diff --git a/tests/integration-test/contracts_test.go b/tests/integration-test/contracts_test.go index cc9927604..f5abbe525 100644 --- a/tests/integration-test/contracts_test.go +++ b/tests/integration-test/contracts_test.go @@ -16,9 +16,9 @@ import ( "scroll-tech/common/bytecode/erc20" "scroll-tech/common/bytecode/greeter" - l1gateway "scroll-tech/common/bytecode/scroll/L1/ethgateway" - "scroll-tech/common/bytecode/scroll/L1/scrollchain" - l2gateway "scroll-tech/common/bytecode/scroll/L2/ethgateway" + l1gateway "scroll-tech/common/bytecode/scroll/L1/gateways" + "scroll-tech/common/bytecode/scroll/L1/rollup" + l2gateway "scroll-tech/common/bytecode/scroll/L2/gateways" ctypes "scroll-tech/common/types" "scroll-tech/common/utils" ) @@ -118,7 +118,7 @@ func testGenesisBatch(t *testing.T) { l2Cli, err := base.L2Client() assert.NoError(t, err) - scrollChain, err := scrollchain.NewScrollChain(base.L1Contracts.L1ScrollChain, l1Cli) + scrollChain, err := rollup.NewScrollChain(base.L1Contracts.L1ScrollChain, l1Cli) assert.NoError(t, err) // Create genesis batch. @@ -233,10 +233,10 @@ func testETHWithdraw(t *testing.T) { assert.True(t, bls.Cmp(value) >= 0) } -func translateBatch(batchData *ctypes.BatchData) scrollchain.IScrollChainBatch { +func translateBatch(batchData *ctypes.BatchData) rollup.IScrollChainBatch { batch := batchData.Batch - iBatchData := scrollchain.IScrollChainBatch{ - Blocks: make([]scrollchain.IScrollChainBlockContext, len(batch.Blocks)), + iBatchData := rollup.IScrollChainBatch{ + Blocks: make([]rollup.IScrollChainBlockContext, len(batch.Blocks)), PrevStateRoot: batch.PrevStateRoot, NewStateRoot: batch.NewStateRoot, WithdrawTrieRoot: batch.WithdrawTrieRoot, @@ -245,7 +245,7 @@ func translateBatch(batchData *ctypes.BatchData) scrollchain.IScrollChainBatch { L2Transactions: batch.L2Transactions, } for i, block0 := range batch.Blocks { - iBatchData.Blocks[i] = scrollchain.IScrollChainBlockContext{ + iBatchData.Blocks[i] = rollup.IScrollChainBlockContext{ BlockHash: block0.BlockHash, ParentHash: block0.ParentHash, BlockNumber: block0.BlockNumber,