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

Or 1948 make l1 contracts deploy script #309

Merged
merged 28 commits into from
Dec 18, 2024

Conversation

nguyenzung
Copy link
Member

@nguyenzung nguyenzung commented Dec 6, 2024

Script for deploy smart contract using configf file and .env file.
Deploying smart contracts includes some steps:

  • install and build software
  • Deploy smart contracts
  • Generate rollup and genesis files

Tested on: Ubuntu22.04, Debian:12
Arch: amd64

We can do the 3 steps above by one command:
./start-deploy.sh all -c /tokamak-thanos/packages/tokamak/contracts-bedrock/deploy-config/devnetL1.json -e .env

It is possible if there are issues happened. In these cases, we can retry each steps

  • Deploy contracts
    ./start-deploy.sh deploy -c /tokamak-thanos/packages/tokamak/contracts-bedrock/deploy-config/devnetL1.json -e .env

  • Generate rollup and genesis files
    ./start-deploy.sh generate -c /tokamak-thanos/packages/tokamak/contracts-bedrock/deploy-config/devnetL1.json -e .env

Thank you!

source ~/.bashrc
cd $projectRoot
pnpm install
make submodules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a dependency installation, Go appears to be installed fine, but Go is not found here. Can you please check?

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 updated it. Actually, there is no problem when I tested.
Please let me know if you still have this error.

Copy link
Member

@theo-learner theo-learner Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I found some error during make cannon-prestate and make op-node and the error log is here:

make[1]: *** [Makefile:24: op-program-host] Error 1
make[1]: Leaving directory '/tokamak-thanos/op-program'
make: *** [Makefile:138: op-program] Error 2
make -C ./op-node op-node
make[1]: Entering directory '/tokamak-thanos/op-node'
env GO111MODULE=on GOOS= GOARCH= go build -v -ldflags "-X main.GitCommit=1e6182502150c049ae354370a7d7165cf249cb0d -X main.GitDate=1733470411 -X github.com/ethereum-optimism/optimism/op-node/version.Version=untagged -X github.com/ethereum-optimism/optimism/op-node/version.Meta=" -o ./bin/op-node ./cmd/main.go
runtime/cgo
github.com/tokamak-network/tokamak-thanos/op-service/ioutil
# runtime/cgo
gcc: error: unrecognized command-line option '-m64'
github.com/tokamak-network/tokamak-thanos/op-service/jsonutil
make[1]: *** [Makefile:29: op-node] Error 1
make[1]: Leaving directory '/tokamak-thanos/op-node'
make: *** [Makefile:110: op-node] Error 2

However, we don't need to build whole packages to deploy contracts to L1. So we can remove this part if we need much time to resolve the issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the gcc version in my env:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/11/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 

Copy link
Member Author

@nguyenzung nguyenzung Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can start supporting AMD64 first, because it is enough for TRH project. Your problems relate to an ARM64 CPU.

We need op-node for generate L2 config files and cannon-prestate for compiling smart contracts related to Fault Proof

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we've already had this conversation. Thanks for checking in!

@nguyenzung nguyenzung marked this pull request as draft December 11, 2024 15:04
@nguyenzung nguyenzung requested a review from swywssaid December 11, 2024 15:12
@ohbyeongmin
Copy link
Collaborator

Which env file should we use?

@ohbyeongmin
Copy link
Collaborator

Is configFilePath an absolute path only?

@nguyenzung
Copy link
Member Author

nguyenzung commented Dec 12, 2024

Is configFilePath an absolute path only?

It can be relative!
Ah, yes, I need to update a case. Thank you!

@nguyenzung
Copy link
Member Author

Which env file should we use?

I added packages/tokamak/contracts-bedrock/scripts/env.example.deploy as an example env

@nguyenzung nguyenzung marked this pull request as ready for review December 13, 2024 03:40
@ohbyeongmin
Copy link
Collaborator

Can you rebase this branch from main?

@nguyenzung nguyenzung force-pushed the OR-1948-make-L1-contracts-deploy-script branch from d5a5e61 to 0d906c9 Compare December 13, 2024 06:53
@nguyenzung
Copy link
Member Author

Can you rebase this branch from main?

It is done.
Actually, this feature is isolated and contains new files, so it is ok if we would not rebase.


generateL2Genesis() {
echo "Generate L2 genesis"
deployResultFile=$projectRoot/packages/tokamak/contracts-bedrock/deployments/$(printf "%d-deploy.json" "$chainID")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run the deploy command, sometimes the deploy result file is generated as artifact.json instead of {chainID}-deploy.json.

Could you check this issue?

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 am checking, still not found anything. Could you give me the config file and the environment variables?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. i'm so sorry!!

echo $DEPLOYMENT_OUTFILE
deployments/artifact.json

The issue was due to an environment variable I had set earlier.
Now that this commit is in place, there’s no need to worry. Thank you!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your checking!

I fixed it randomly ^^

Copy link
Member

@theo-learner theo-learner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

source ~/.bashrc
cd $projectRoot
pnpm install
make submodules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we've already had this conversation. Thanks for checking in!

Copy link
Collaborator

@ohbyeongmin ohbyeongmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@nguyenzung nguyenzung merged commit f491301 into main Dec 18, 2024
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants