Skip to content

Commit

Permalink
tracers ci: drop duktape engine (ethereum#24934) and add linux-arm bi…
Browse files Browse the repository at this point in the history
…naries to releases page (ethereum#1100)

# Conflicts:
#	.github/generate_change_log.sh
#	.github/workflows/pre-release.yml
#	.github/workflows/release.yml
#	Dockerfile
#	accounts/abi/bind/bind_test.go
#	core/state_transition.go
#	eth/tracers/js/tracer_test.go
#	go.mod
  • Loading branch information
maoueh committed Nov 29, 2022
1 parent efc7aa8 commit 6ac52b2
Show file tree
Hide file tree
Showing 28 changed files with 1,659 additions and 1,117 deletions.
12 changes: 10 additions & 2 deletions .github/generate_change_log.sh
Expand Up @@ -22,6 +22,10 @@ done < ${change_log_file}
LINUX_BIN_SUM="$(checksum ./linux/geth)"
MAC_BIN_SUM="$(checksum ./macos/geth)"
# WINDOWS_BIN_SUM="$(checksum ./windows/geth.exe)"
# ARM5_BIN_SUM="$(checksum ./arm5/geth-linux-arm-5)"
# ARM6_BIN_SUM="$(checksum ./arm6/geth-linux-arm-6)"
# ARM7_BIN_SUM="$(checksum ./arm7/geth-linux-arm-7)"
# ARM64_BIN_SUM="$(checksum ./arm64/geth-linux-arm64)"
OUTPUT=$(cat <<-END
## Changelog\n
${CHANGE_LOG}\n
Expand All @@ -31,7 +35,11 @@ ${CHANGE_LOG}\n
| geth_linux | ${LINUX_BIN_SUM} |\n
| geth_mac | ${MAC_BIN_SUM} |\n
END
#| geth_windows | ${WINDOWS_BIN_SUM} |\n
# | geth_windows | ${WINDOWS_BIN_SUM} |\n
# | geth_linux_arm-5 | ${ARM5_BIN_SUM} |\n
# | geth_linux_arm-6 | ${ARM6_BIN_SUM} |\n
# | geth_linux_arm-7 | ${ARM7_BIN_SUM} |\n
# | geth_linux_arm64 | ${ARM64_BIN_SUM} |\n
)

echo -e ${OUTPUT}
echo -e ${OUTPUT}
110 changes: 106 additions & 4 deletions .github/workflows/release.yml
Expand Up @@ -38,6 +38,19 @@ jobs:
- name: Build Binary for ${{matrix.os}}
run: make geth

# ==============================
# Cross Compile for ARM
# ==============================

# - name: Build Binary for ARM
# if: matrix.os == 'ubuntu-18.04'
# env:
# GOPATH: /home/runner/work/woodpecker/go
# run: |
# mkdir -p $GOPATH/src/github.com/bnb-chain/bsc/
# cp -r ./* $GOPATH/src/github.com/bnb-chain/bsc/
# cd $GOPATH/src/github.com/bnb-chain/bsc/ && make geth-linux-arm

# ==============================
# Upload artifacts
# ==============================
Expand All @@ -56,6 +69,34 @@ jobs:
name: macos
path: ./build/bin/geth

# - name: Upload ARM-5 Build
# uses: actions/upload-artifact@v2
# if: matrix.os == 'ubuntu-18.04'
# with:
# name: arm5
# path: /home/runner/work/woodpecker/go/src/github.com/bnb-chain/bsc/build/bin/geth-linux-arm-5

# - name: Upload ARM-6 Build
# uses: actions/upload-artifact@v2
# if: matrix.os == 'ubuntu-18.04'
# with:
# name: arm6
# path: /home/runner/work/woodpecker/go/src/github.com/bnb-chain/bsc/build/bin/geth-linux-arm-6

# - name: Upload ARM-7 Build
# uses: actions/upload-artifact@v2
# if: matrix.os == 'ubuntu-18.04'
# with:
# name: arm7
# path: /home/runner/work/woodpecker/go/src/github.com/bnb-chain/bsc/build/bin/geth-linux-arm-7

# - name: Upload ARM-64 Build
# uses: actions/upload-artifact@v2
# if: matrix.os == 'ubuntu-18.04'
# with:
# name: arm64
# path: /home/runner/work/woodpecker/go/src/github.com/bnb-chain/bsc/build/bin/geth-linux-arm64

release:
name: Release
needs: build
Expand Down Expand Up @@ -85,24 +126,45 @@ jobs:
# name: windows
# path: ./windows

# - name: Download Artifacts
# uses: actions/download-artifact@v2
# with:
# name: arm5
# path: ./arm5

# - name: Download Artifacts
# uses: actions/download-artifact@v2
# with:
# name: arm6
# path: ./arm6

# - name: Download Artifacts
# uses: actions/download-artifact@v2
# with:
# name: arm7
# path: ./arm7

# - name: Download Artifacts
# uses: actions/download-artifact@v2
# with:
# name: arm64
# path: ./arm64

- name: Download Config File
run: |
. ./.github/release.env
echo "mainnet.zip url: $MAINNET_FILE_URL"
echo "testnet.zip url: $TESTNET_FILE_URL"
curl -L $MAINNET_FILE_URL -o ./mainnet.zip
curl -L $TESTNET_FILE_URL -o ./testnet.zip
- name: Generate Change Log
id: changelog
run: |
chmod 755 ./.github/generate_change_log.sh
CHANGELOG=$(./.github/generate_change_log.sh ${{ env.RELEASE_VERSION}})
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@latest
Expand Down Expand Up @@ -149,6 +211,46 @@ jobs:
# asset_name: geth_windows.exe
# asset_content_type: application/octet-stream

# - name: Upload Release Asset - Linux ARM 5
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./arm5/geth-linux-arm-5
# asset_name: geth-linux-arm-5
# asset_content_type: application/octet-stream

# - name: Upload Release Asset - Linux ARM 6
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./arm6/geth-linux-arm-6
# asset_name: geth-linux-arm-6
# asset_content_type: application/octet-stream

# - name: Upload Release Asset - Linux ARM 7
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./arm7/geth-linux-arm-7
# asset_name: geth-linux-arm-7
# asset_content_type: application/octet-stream

# - name: Upload Release Asset - Linux ARM 64
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./arm64/geth-linux-arm64
# asset_name: geth-linux-arm64
# asset_content_type: application/octet-stream

- name: Upload Release Asset - MAINNET.ZIP
uses: actions/upload-release-asset@v1
env:
Expand All @@ -167,4 +269,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./testnet.zip
asset_name: testnet.zip
asset_content_type: application/zip
asset_content_type: application/zip
6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -26,9 +26,9 @@ ENV BSC_HOME=/bsc
ENV HOME=${BSC_HOME}
ENV DATA_DIR=/data

ENV PACKAGES ca-certificates~=20220614 jq~=1.6 \
bash~=5.1.16-r2 bind-tools tini~=0.19.0 \
grep~=3.7 curl~=7.83.1-r2 sed~=4.8-r0 curl~=7.83
ENV PACKAGES ca-certificates~=20220614-r0 jq~=1.6 \
bash~=5.1.16-r2 bind-tools~=9.16.33 tini~=0.19.0 \
grep~=3.7 curl~=7.83.1 sed~=4.8-r0

RUN apk add --no-cache $PACKAGES \
&& rm -rf /var/cache/apk/* \
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Expand Up @@ -2,8 +2,9 @@
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.

.PHONY: geth android ios geth-cross evm all test truffle-test clean
.PHONY: geth android ios evm all test truffle-test clean
.PHONY: docker
.PHONY: geth-linux-arm geth-linux-arm64 geth-linux-arm5 geth-linux-arm6 geth-linux-arm7

GOBIN = ./build/bin
GO ?= latest
Expand All @@ -14,6 +15,20 @@ geth:
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

geth-linux-arm: geth-linux-arm5 geth-linux-arm6 geth-linux-arm7 geth-linux-arm64

geth-linux-arm5:
env GO111MODULE=on GOARCH=arm GOARM=5 GOOS=linux go build -o build/bin/geth-linux-arm-5 ./cmd/geth

geth-linux-arm6:
env GO111MODULE=on GOARCH=arm GOARM=6 GOOS=linux go build -o build/bin/geth-linux-arm-6 ./cmd/geth

geth-linux-arm7:
env GO111MODULE=on GOARCH=arm GOARM=7 GOOS=linux go build -o build/bin/geth-linux-arm-7 ./cmd/geth

geth-linux-arm64:
env GO111MODULE=on GOARCH=arm64 GOOS=linux go build -o build/bin/geth-linux-arm64 ./cmd/geth

all:
$(GORUN) build/ci.go install

Expand Down
8 changes: 1 addition & 7 deletions accounts/abi/bind/bind_test.go
Expand Up @@ -2024,13 +2024,7 @@ func TestGolangBindings(t *testing.T) {
if out, err := replacer.CombinedOutput(); err != nil {
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
}

replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/tendermint/tendermint@v0.0.0", "-replace", "github.com/tendermint/tendermint=github.com/bnb-chain/tendermint@v0.31.12") // Repo root
replacer.Dir = pkg
if out, err := replacer.CombinedOutput(); err != nil {
t.Fatalf("failed to replace tendermint dependency to bnb-chain source: %v\n%s", err, out)
}
tidier := exec.Command(gocmd, "mod", "tidy")
tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.17")
tidier.Dir = pkg
if out, err := tidier.CombinedOutput(); err != nil {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
Expand Down
2 changes: 1 addition & 1 deletion console/console_test.go
Expand Up @@ -289,7 +289,7 @@ func TestPrettyError(t *testing.T) {
defer tester.Close(t)
tester.console.Evaluate("throw 'hello'")

want := jsre.ErrorColor("hello") + "\n\tat <eval>:1:7(1)\n\n"
want := jsre.ErrorColor("hello") + "\n\tat <eval>:1:1(1)\n\n"
if output := tester.output.String(); output != want {
t.Fatalf("pretty error mismatch: have %s, want %s", output, want)
}
Expand Down
56 changes: 28 additions & 28 deletions core/state_transition.go
Expand Up @@ -44,8 +44,10 @@ The state transitioning model does all the necessary work to work out a valid ne
3) Create a new state object if the recipient is \0*32
4) Value transfer
== If contract creation ==
4a) Attempt to run transaction data
4b) If valid, use result as code for the new state object
4a) Attempt to run transaction data
4b) If valid, use result as code for the new state object
== end ==
5) Run Script section
6) Derive new state root
Expand Down Expand Up @@ -267,13 +269,13 @@ func (st *StateTransition) preCheck() error {
// TransitionDb will transition the state by applying the current message and
// returning the evm execution result with following fields.
//
// - used gas:
// total gas used (including gas being refunded)
// - returndata:
// the returned data from evm
// - concrete execution error:
// various **EVM** error which aborts the execution,
// e.g. ErrOutOfGas, ErrExecutionReverted
// - used gas:
// total gas used (including gas being refunded)
// - returndata:
// the returned data from evm
// - concrete execution error:
// various **EVM** error which aborts the execution,
// e.g. ErrOutOfGas, ErrExecutionReverted
//
// However if any consensus issue encountered, return the error directly with
// nil evm execution result.
Expand All @@ -293,24 +295,22 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
return nil, err
}

msg := st.msg
sender := vm.AccountRef(msg.From())
if st.evm.ChainConfig().IsNano(st.evm.Context.BlockNumber) {
for _, blackListAddr := range types.NanoBlackList {
if blackListAddr == msg.From() {
return nil, fmt.Errorf("block blacklist account")
}
if msg.To() != nil && *msg.To() == blackListAddr {
return nil, fmt.Errorf("block blacklist account")
}
}
if st.evm.Config.Debug {
st.evm.Config.Tracer.CaptureTxStart(st.initialGas)
defer func() {
st.evm.Config.Tracer.CaptureTxEnd(st.gas)
}()
}
homestead := st.evm.ChainConfig().IsHomestead(st.evm.Context.BlockNumber)
istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.Context.BlockNumber)
london := st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber)
contractCreation := msg.To() == nil

var (
msg = st.msg
sender = vm.AccountRef(msg.From())
rules = st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber, st.evm.Context.Random != nil)
contractCreation = msg.To() == nil
)

// Check clauses 4-5, subtract intrinsic gas if everything is correct
gas, err := IntrinsicGas(st.data, st.msg.AccessList(), contractCreation, homestead, istanbul)
gas, err := IntrinsicGas(st.data, st.msg.AccessList(), contractCreation, rules.IsHomestead, rules.IsIstanbul)
if err != nil {
return nil, err
}
Expand All @@ -329,7 +329,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
}

// Set up the initial access list.
if rules := st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber, st.evm.Context.Random != nil); rules.IsBerlin {
if rules.IsBerlin {
st.state.PrepareAccessList(msg.From(), msg.To(), vm.ActivePrecompiles(rules), msg.AccessList())
}
var (
Expand All @@ -344,7 +344,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value)
}

if !london {
if !rules.IsLondon {
// Before EIP-3529: refunds were capped to gasUsed / 2
st.refundGas(params.RefundQuotient)
} else {
Expand All @@ -357,7 +357,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
st.state.AddBalance(consensus.SystemAddress, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice), false, st.firehoseContext, firehose.BalanceChangeReason("reward_transaction_fee"))
} else {
effectiveTip := st.gasPrice
if london {
if rules.IsLondon {
effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee))
}
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip), false, st.firehoseContext, firehose.BalanceChangeReason("reward_transaction_fee"))
Expand Down
10 changes: 8 additions & 2 deletions core/vm/logger.go
Expand Up @@ -29,10 +29,16 @@ import (
// Note that reference types are actual VM data structures; make copies
// if you need to retain them beyond the current call.
type EVMLogger interface {
// Transaction level
CaptureTxStart(gasLimit uint64)
CaptureTxEnd(restGas uint64)
// Top call frame
CaptureStart(env *EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
CaptureState(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, depth int, err error)
CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
// Rest of call frames
CaptureEnter(typ OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
CaptureExit(output []byte, gasUsed uint64, err error)
// Opcode level
CaptureState(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, depth int, err error)
CaptureFault(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, depth int, err error)
CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
}

0 comments on commit 6ac52b2

Please sign in to comment.