Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
moved `op_contracts_release` from superchain.toml
to `validation/standard/standard-config.toml`
  • Loading branch information
Vinod Damle committed Sep 10, 2024
1 parent 4ba36b8 commit 35ba4db
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 29 deletions.
9 changes: 3 additions & 6 deletions superchain/configs/configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"L1": {
"ChainID": 1,
"PublicRPC": "https://ethereum-rpc.publicnode.com",
"Explorer": "https://etherscan.io",
"Versions": null
"Explorer": "https://etherscan.io"
},
"ContractsRelease": "op-contracts/v1.4.0",
"ProtocolVersionsAddr": "0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935",
Expand Down Expand Up @@ -600,8 +599,7 @@
"L1": {
"ChainID": 11155111,
"PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com",
"Explorer": "https://sepolia.etherscan.io",
"Versions": null
"Explorer": "https://sepolia.etherscan.io"
},
"ContractsRelease": "op-contracts/v1.4.0",
"ProtocolVersionsAddr": "0x79ADD5713B383DAa0a138d3C4780C7A1804a8090",
Expand Down Expand Up @@ -1002,8 +1000,7 @@
"L1": {
"ChainID": 11155111,
"PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com",
"Explorer": "https://sepolia.etherscan.io",
"Versions": null
"Explorer": "https://sepolia.etherscan.io"
},
"ContractsRelease": "",
"ProtocolVersionsAddr": "0x252CbE9517F731C618961D890D534183822dcC8d",
Expand Down
2 changes: 0 additions & 2 deletions superchain/configs/mainnet/superchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ecotone_time = 1710374401 # Thu 14 Mar 2024 00:00:01 UTC
fjord_time = 1720627201 # Wed 10 Jul 2024 16:00:01 UTC
granite_time = 1726070401 # Wed 11 Sep 2024 16:00:01 UTC

op_contracts_release = "op-contracts/v1.4.0"

[l1]
chain_id = 1
public_rpc = "https://ethereum-rpc.publicnode.com"
Expand Down
2 changes: 0 additions & 2 deletions superchain/configs/sepolia/superchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ecotone_time = 1708534800 # Wed 21 Feb 2024 17:00:00 UTC
fjord_time = 1716998400 # Wed 29 May 2024 16:00:00 UTC
granite_time = 1723478400 # Mon Aug 12 16:00:00 UTC

op_contracts_release = "op-contracts/v1.4.0"

[l1]
chain_id = 11155111
public_rpc = "https://ethereum-sepolia-rpc.publicnode.com"
Expand Down
12 changes: 5 additions & 7 deletions superchain/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,16 +540,14 @@ type Genesis struct {
}

type SuperchainL1Info struct {
ChainID uint64 `toml:"chain_id"`
PublicRPC string `toml:"public_rpc"`
Explorer string `toml:"explorer"`
Versions map[string]ContractVersions `toml:"ContractVersions"`
ChainID uint64 `toml:"chain_id"`
PublicRPC string `toml:"public_rpc"`
Explorer string `toml:"explorer"`
}

type SuperchainConfig struct {
Name string `toml:"name"`
L1 SuperchainL1Info `toml:"l1"`
ContractsRelease string `toml:"op_contracts_release"`
Name string `toml:"name"`
L1 SuperchainL1Info `toml:"l1"`

ProtocolVersionsAddr *Address `toml:"protocol_versions_addr,omitempty"`
SuperchainConfigAddr *Address `toml:"superchain_config_addr,omitempty"`
Expand Down
3 changes: 0 additions & 3 deletions superchain/superchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ canyon_time = 1
delta_time = 2
ecotone_time = 3
op_contracts_release = "op-contracts/v1.4.0"
[l1]
chain_id = 314
public_rpc = "https://disney.com"
Expand All @@ -221,7 +219,6 @@ op_contracts_release = "op-contracts/v1.4.0"

require.Equal(t, "0x252CbE9517F731C618961D890D534183822dcC8d", s.ProtocolVersionsAddr.String())
require.Equal(t, "0x02d91Cf852423640d93920BE0CAdceC0E7A00FA7", s.SuperchainConfigAddr.String())
require.Equal(t, "op-contracts/v1.4.0", s.ContractsRelease)
require.Equal(t, uint64Ptr(uint64(1)), s.hardForkDefaults.CanyonTime)
require.Equal(t, uint64Ptr(uint64(2)), s.hardForkDefaults.DeltaTime)
require.Equal(t, uint64Ptr(uint64(3)), s.hardForkDefaults.EcotoneTime)
Expand Down
2 changes: 1 addition & 1 deletion validation/standard/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func decodeTOMLFileIntoConfig[T Params | Roles | MultisigRoles | VersionTags | B
// LoadImmutableReferences parses standard-immutables.toml and stores it in a map. Needs to be invoked one-time only.
func LoadImmutableReferences() {
var bytecodeImmutables *ContractBytecodeImmutables
for tag := range Versions {
for tag := range Versions.Tags {
for contractVersion, immutables := range BytecodeImmutables {
if tag == contractVersion {
bytecodeImmutables = &immutables
Expand Down
10 changes: 7 additions & 3 deletions validation/standard/standard-versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
op_contracts_release = "op-contracts/v1.4.0"

[contract_tag]

# Fault Proofs https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.4.0
["op-contracts/v1.4.0"]
[contract_tag."op-contracts/v1.4.0"]
address_manager = { version = "" }
l1_cross_domain_messenger = { version = "2.3.0" }
l1_erc721_bridge = { version = "2.1.0" }
Expand All @@ -16,8 +20,8 @@ permissioned_dispute_game = { version = "1.2.0" }
mips = { version = "1.0.1" }
preimage_oracle = { version = "1.0.0" }

# Fault Proofs https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.4.0
["op-contracts/v1.3.0"]
# Fault Proofs https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.3.0
[contract_tag."op-contracts/v1.3.0"]
address_manager = { version = "1.0.0", address = "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F" }
l1_cross_domain_messenger = { version = "2.3.0", address = "0xD3494713A5cfaD3F5359379DfA074E2Ac8C6Fd65" }
l1_erc721_bridge = { version = "2.1.0", address = "0xAE2AF01232a6c4a4d3012C5eC5b1b35059caF10d" }
Expand Down
10 changes: 8 additions & 2 deletions validation/standard/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ import (
type Tag string

type (
VersionTags = map[Tag]superchain.ContractVersions
BytecodeHashTags = map[Tag]L1ContractBytecodeHashes
BytecodeImmutablesTags = map[Tag]ContractBytecodeImmutables
)

type VersionTags struct {
Tags map[Tag]superchain.ContractVersions `toml:"contract_tag"`
Version string `toml:"op_contracts_release,omitempty"`
}

var (
Versions VersionTags = make(VersionTags, 0)
Versions VersionTags = VersionTags{
Tags: make(map[Tag]superchain.ContractVersions, 0),
}
BytecodeHashes BytecodeHashTags = make(BytecodeHashTags, 0)
BytecodeImmutables BytecodeImmutablesTags = make(BytecodeImmutablesTags, 0)
)
6 changes: 3 additions & 3 deletions validation/superchain-version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ func findOPContractTagInVersions(versions ContractVersions, isTestnet bool) ([]s
return checkMatchOrTestnet(s, c, isTestnet)
}

for tag := range standard.Versions {
if matchesTag(standard.Versions[tag], versions) {
for tag := range standard.Versions.Tags {
if matchesTag(standard.Versions.Tags[tag], versions) {
matchingTags = append(matchingTags, tag)
err = nil
}
Expand Down Expand Up @@ -358,7 +358,7 @@ func findOPContractTagInByteCodeHashes(hashes standard.L1ContractBytecodeHashes)
return checkMatch(s, c)
}

for tag := range standard.Versions {
for tag := range standard.Versions.Tags {
if matchesTag(standard.BytecodeHashes[tag], hashes) {
matchingTags = append(matchingTags, tag)
err = nil
Expand Down

0 comments on commit 35ba4db

Please sign in to comment.