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

contracts-bedrock: delete dead typescript #6148

Merged
merged 13 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ jobs:
- persist_to_workspace:
root: "."
paths:
- "packages/*/dist"
- "packages/*/artifacts"
- "packages/**/dist"
- "packages/contracts-bedrock/forge-artifacts"

docker-build:
environment:
Expand Down Expand Up @@ -574,12 +574,12 @@ jobs:
steps:
- checkout
- attach_workspace: { at: "." }
- check-changed:
patterns: sdk,contracts-bedrock,contracts
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-v2-{{ checksum "yarn.lock" }}
- check-changed:
patterns: sdk,contracts-bedrock,contracts
- run:
name: anvil-l1
background: true
Expand Down
15 changes: 1 addition & 14 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"configsProject": [
"{projectRoot}/foundry.toml",
"{projectRoot}/tsconfig.json",
"{projectRoot}/hardhat.config.ts",
"{projectRoot}/package.json"
],
"default": ["{projectRoot}/**/*", "configsWorkspace"],
Expand All @@ -38,8 +37,6 @@
],
"productionSrc": [
"{projectRoot}/src/**/*",
"!{projectRoot}/src/contract-artifacts.ts",
"!{projectRoot}/src/contract-deployed-artifacts.ts",
"!{projectRoot}/src/**/*.spec.ts"
],
"productionContracts": ["{projectRoot}/contracts/**/*"],
Expand All @@ -63,24 +60,14 @@
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/artifacts", "{projectRoot}/forge-artifacts"]
},
"autogen:artifacts": {
"inputs": [
"configsWorkspace",
"configsProject",
"productionContracts",
"^productionContracts"
],
"dependsOn": ["^build", "build:contracts"],
"outputs": ["srcGenerated"]
},
"build": {
"inputs": [
"configsWorkspace",
"configsProject",
"production",
"^production"
],
"dependsOn": ["^build", "autogen:artifacts", "build:contracts"],
"dependsOn": ["^build", "build:contracts"],
"outputs": ["{projectRoot}/dist"]
}
}
Expand Down
2 changes: 1 addition & 1 deletion op-bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ version:
compile:
cd ../packages/contracts-bedrock/ && \
yarn clean && \
npx hardhat compile
yarn build

system-config-bindings: compile
./gen_bindings.sh contracts/L1/SystemConfig.sol:SystemConfig $(pkg)
Expand Down
34 changes: 20 additions & 14 deletions op-bindings/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"text/template"

"github.com/ethereum-optimism/optimism/op-bindings/ast"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/ethereum/go-ethereum/common/hexutil"
)

type flags struct {
Expand All @@ -33,14 +34,16 @@ type data struct {
}

type forgeArtifact struct {
StorageLayout *solc.StorageLayout `json:"storageLayout"`
DeployedBytecode struct {
SourceMap string `json:"sourceMap"`
SourceMap string `json:"sourceMap"`
Object hexutil.Bytes `json:"object"`
} `json:"deployedBytecode"`
}

func main() {
var f flags
flag.StringVar(&f.ArtifactsDir, "artifacts", "", "Comma-separated list of directories containing artifacts and build info")
flag.StringVar(&f.ArtifactsDir, "artifacts", "", "Comma-separated list of directories build info")
flag.StringVar(&f.ForgeArtifacts, "forge-artifacts", "", "Forge artifacts directory, to load sourcemaps from, if available")
flag.StringVar(&f.OutDir, "out", "", "Output directory to put code in")
flag.StringVar(&f.Contracts, "contracts", "", "Comma-separated list of contracts to generate code for")
Expand All @@ -64,25 +67,28 @@ func main() {
log.Fatalf("must define a list of contracts")
}

hh, err := hardhat.New("dummy", artifacts, nil)
if err != nil {
log.Fatalln("error reading artifacts:", err)
}

t := template.Must(template.New("artifact").Parse(tmpl))

for _, name := range contracts {
art, err := hh.GetArtifact(name)
if err != nil {
log.Fatalf("error reading artifact %s: %v\n", name, err)
forgeArtifactData, err := os.ReadFile(path.Join(f.ForgeArtifacts, name+".sol", name+".json"))
if errors.Is(err, os.ErrNotExist) {
log.Printf("cannot find forge-artifact with source-map data of %q\n", name)
}

storage, err := hh.GetStorageLayout(name)
var artifact forgeArtifact
if err := json.Unmarshal(forgeArtifactData, &artifact); err != nil {
log.Fatalf("failed to parse forge artifact of %q: %v\n", name, err)
}
if err != nil {
log.Fatalf("error reading storage layout %s: %v\n", name, err)
}
canonicalStorage := ast.CanonicalizeASTIDs(storage)

storage := artifact.StorageLayout
if storage == nil {
log.Fatalf("no storage layout for %s\n", name)
}

canonicalStorage := ast.CanonicalizeASTIDs(storage)
ser, err := json.Marshal(canonicalStorage)
if err != nil {
log.Fatalf("error marshaling storage: %v\n", err)
Expand All @@ -108,7 +114,7 @@ func main() {
d := data{
Name: name,
StorageLayout: serStr,
DeployedBin: art.DeployedBytecode.String(),
DeployedBin: artifact.DeployedBytecode.Object.String(),
Package: f.Package,
DeployedSourceMap: deployedSourceMap,
}
Expand Down
4 changes: 0 additions & 4 deletions packages/contracts-bedrock/deploy-config/devnetL1.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/contracts-bedrock/deploy-config/getting-started.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/contracts-bedrock/deploy-config/goerli-forked.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/contracts-bedrock/deploy-config/goerli.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/contracts-bedrock/deploy-config/hardhat.ts

This file was deleted.

57 changes: 0 additions & 57 deletions packages/contracts-bedrock/deploy-config/local.ts

This file was deleted.

26 changes: 0 additions & 26 deletions packages/contracts-bedrock/deploy-config/mainnet.ts

This file was deleted.

Loading