Files
evm/scripts/format_as_fork.sh
zeekay 028e0a5ca0 feat: update EVM implementation with latest improvements
- Update import paths to use luxfi/consensus instead of luxfi/snow
- Add protocol parameters for EIP-4844 blob gas support
- Improve database handling with proper metrics and caching
- Update dependency management scripts for better fork maintenance
- Fix various import paths and test references
2025-08-04 01:45:45 -05:00

53 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
set -x
script_dir=$(dirname "$0")
commit_msg_remove_header="format: remove lux header"
commit_msg_remove_upstream="format: remove upstream go-ethereum"
commit_msg_rename_packages_as_fork="format: rename packages as fork"
make_commit() {
if git diff-index --cached --quiet HEAD --; then
echo "No changes to commit."
else
git commit -m "$1"
fi
}
revert_by_message() {
hash=$(git log --grep="$1" --format="%H" -n 1)
git revert --no-edit "$hash"
}
if git status --porcelain | grep -q '^ M'; then
echo "There are edited files in the repository. Please commit or stash them before running this script."
exit 1
fi
upstream_dirs=$(sed -e 's/"github.com\/ethereum\/go-ethereum\/\(.*\)"/\1/' "${script_dir}"/geth-allowed-packages.txt | xargs)
for dir in ${upstream_dirs}; do
if [ -d "${dir}" ]; then
git rm -r "${dir}"
fi
done
git clean -df -- "${upstream_dirs}"
make_commit "${commit_msg_remove_upstream}"
sed_command='s!\([^/]\)github.com/luxfi/geth!\1github.com/luxfi/evm!g'
find . \( -name '*.go' -o -name 'go.mod' -o -name 'build_test.sh' \) -exec sed -i '' -e "${sed_command}" {} \;
for dir in ${upstream_dirs}; do
sed_command="s!\"github.com/luxfi/evm/${dir}\"!\"github.com/luxfi/geth/${dir}\"!g"
find . -name '*.go' -exec sed -i '' -e "${sed_command}" {} \;
done
go get github.com/luxfi/geth@"$1"
gofmt -w .
go mod tidy
git add -u .
make_commit "${commit_msg_rename_packages_as_fork}"
revert_by_message "${commit_msg_remove_header}"