Skip to content

Commit a6074a7

Browse files
tynes0xfuturistic
andauthored
feat: custom gas token (#10143)
* contracts-bedrock: custom gas token L1 contracts Implement the L1 contract diff of the custom gas token spec Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * contracts-bedrock: custom gas token L2 contracts Implement the L2 contract diff of the custom gas token spec Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * contracts-bedrock: custom gas token contracts Libraries and universal contracts in the custom gas token spec Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * contracts-bedrock: custom gas token scripts Implement the scripts for the custom gas token spec Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * contracts-bedrock: custom gas token tests Implement tests for the custom gas token spec Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * op-bindings: update with custom gas token Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * op-chain-ops: fixup tests Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * contracts-bedrock: snapshots Update snapshots Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * cleanup: get tests passing * contracts-bedrock: cleanup tests * contracts-bedrock: cleanup custom gas token * op-bindings: regenerate * codesize: fix * contracts-bedrock: custom gas token cleanup Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com> * build: fix * custom-gas-token: fix build * custom-gas-token: cleanup, final spec nits * gas-snapshot: fix * contracts-bedrock: cleanup * contracts-bedrock: semver lock * invariant-docs: fixup * storage-layout: address * bindings: remove preview * bindings: add back bindingspreview * weth: remove weth9 Migrate to WETH based on weth98 * contracts-bedrock: cleanup * custom-gas-token: more cleanup Fix abi * contracts-bedrock: test case * custom-gas-token: cleanup, tests * lint: fix * custom-gas-token: address review comments * snapshots: regenerate * lint: fix * contracts-bedrock: clean up semantics of cgt Custom gas token semantics are strengthened and cleaned up to ensure invariants in spec are held true. * snapshots: regenerate * snapshots: gas snapshot * semver-lock: regenerate * comments: address * semver: calculate * ctb: revert in test * tests: fix flake * portal: better comment * test: fixup * lint: fix * snapshot: gas --------- Co-authored-by: Diego <105765223+0xfuturistic@users.noreply.github.com>
1 parent e21d8fd commit a6074a7

File tree

69 files changed

+5006
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+5006
-1370
lines changed

op-bindings/bindings/l1block.go

Lines changed: 316 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l1crossdomainmessenger.go

Lines changed: 45 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l1standardbridge.go

Lines changed: 45 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l2crossdomainmessenger.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l2standardbridge.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/optimismportal.go

Lines changed: 120 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/systemconfig.go

Lines changed: 147 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/weth.go

Lines changed: 1133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/predeploys/addresses.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "github.com/ethereum/go-ethereum/common"
88
const (
99
L2ToL1MessagePasser = "0x4200000000000000000000000000000000000016"
1010
DeployerWhitelist = "0x4200000000000000000000000000000000000002"
11-
WETH9 = "0x4200000000000000000000000000000000000006"
11+
WETH = "0x4200000000000000000000000000000000000006"
1212
L2CrossDomainMessenger = "0x4200000000000000000000000000000000000007"
1313
L2StandardBridge = "0x4200000000000000000000000000000000000010"
1414
SequencerFeeVault = "0x4200000000000000000000000000000000000011"
@@ -41,7 +41,7 @@ const (
4141
var (
4242
L2ToL1MessagePasserAddr = common.HexToAddress(L2ToL1MessagePasser)
4343
DeployerWhitelistAddr = common.HexToAddress(DeployerWhitelist)
44-
WETH9Addr = common.HexToAddress(WETH9)
44+
WETHAddr = common.HexToAddress(WETH)
4545
L2CrossDomainMessengerAddr = common.HexToAddress(L2CrossDomainMessenger)
4646
L2StandardBridgeAddr = common.HexToAddress(L2StandardBridge)
4747
SequencerFeeVaultAddr = common.HexToAddress(SequencerFeeVault)
@@ -77,7 +77,7 @@ var (
7777
func init() {
7878
Predeploys["L2ToL1MessagePasser"] = &Predeploy{Address: L2ToL1MessagePasserAddr}
7979
Predeploys["DeployerWhitelist"] = &Predeploy{Address: DeployerWhitelistAddr}
80-
Predeploys["WETH9"] = &Predeploy{Address: WETH9Addr, ProxyDisabled: true}
80+
Predeploys["WETH"] = &Predeploy{Address: WETHAddr, ProxyDisabled: true}
8181
Predeploys["L2CrossDomainMessenger"] = &Predeploy{Address: L2CrossDomainMessengerAddr}
8282
Predeploys["L2StandardBridge"] = &Predeploy{Address: L2StandardBridgeAddr}
8383
Predeploys["SequencerFeeVault"] = &Predeploy{Address: SequencerFeeVaultAddr}

op-chain-ops/genesis/config.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ type DeployConfig struct {
248248
// UseFaultProofs is a flag that indicates if the system is using fault
249249
// proofs instead of the older output oracle mechanism.
250250
UseFaultProofs bool `json:"useFaultProofs"`
251-
251+
// UseCustomGasToken is a flag to indicate that a custom gas token should be used
252+
UseCustomGasToken bool `json:"useCustomGasToken"`
253+
// CustomGasTokenAddress is the address of the ERC20 token to be used to pay for gas on L2.
254+
CustomGasTokenAddress common.Address `json:"customGasTokenAddress"`
252255
// UsePlasma is a flag that indicates if the system is using op-plasma
253256
UsePlasma bool `json:"usePlasma"`
254257
// DAChallengeWindow represents the block interval during which the availability of a data commitment can be challenged.
@@ -427,6 +430,12 @@ func (d *DeployConfig) Check() error {
427430
return fmt.Errorf("%w: DAResolveWindow cannot be 0 when using plasma mode", ErrInvalidDeployConfig)
428431
}
429432
}
433+
if d.UseCustomGasToken {
434+
if d.CustomGasTokenAddress == (common.Address{}) {
435+
return fmt.Errorf("%w: CustomGasTokenAddress cannot be address(0)", ErrInvalidDeployConfig)
436+
}
437+
log.Info("Using custom gas token", "address", d.CustomGasTokenAddress)
438+
}
430439
// checkFork checks that fork A is before or at the same time as fork B
431440
checkFork := func(a, b *hexutil.Uint64, aName, bName string) error {
432441
if a == nil && b == nil {

0 commit comments

Comments
 (0)