Skip to content

Commit

Permalink
Merge pull request ethereum#42 from maticnetwork/develop
Browse files Browse the repository at this point in the history
New release cs-2005
  • Loading branch information
jdkanani authored Apr 6, 2020
2 parents c69ad13 + 86a8696 commit ae28e0a
Show file tree
Hide file tree
Showing 37 changed files with 979 additions and 388 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
steps:
- checkout # check out source code to working directory
- run:
command: make bor
command: make all
- run:
command: make test
25 changes: 25 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Bor Docker Image CI

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Bor Docker image
env:
DOCKERHUB: ${{ secrets.DOCKERHUB }}
DOCKERHUB_KEY: ${{ secrets.DOCKERHUB_KEY }}
run: |
ls -l
echo "Docker login"
docker login -u $DOCKERHUB -p $DOCKERHUB_KEY
echo "running build"
docker build -t maticnetwork/bor:${GITHUB_REF/refs\/tags\//} .
echo "pushing image"
docker push maticnetwork/bor:${GITHUB_REF/refs\/tags\//}
echo "DONE!"
76 changes: 76 additions & 0 deletions .github/workflows/linuxpackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Linux package

on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.13

- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6

- name: Build package
run: |
set -x
sudo apt-get -yqq install libpq-dev build-essential
gem install --no-document fpm
fpm --version
make bor
cat > bor.service <<- "EOF"
[Unit]
Description=bor
[Service]
WorkingDirectory=/etc/bor/
EnvironmentFile=/etc/bor/metadata
ExecStartPre=/bin/mkdir -p /var/log/matic-logs/
ExecStart=/bin/bash -c "/usr/bin/bor --datadir /etc/bor/dataDir --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/geth.ipc --rpcapi 'bor,db,eth,net,web3,txpool' --networkid ${NETWORK_ID} --gasprice '0' --keystore /etc/bor/dataDir/keystore --unlock ${VALIDATOR_ADDRESS} --password /etc/bor/dataDir/password.txt --allow-insecure-unlock --maxpeers 150 --mine > /var/log/matic-logs/bor.log 2>&1"
Type=simple
User=root
EOF
cat > after_install.sh <<- "EOF"
#!/bin/bash
touch /etc/bor/metadata
EOF
cat > metadata <<- "EOF"
NETWORK_ID=
VALIDATOR_ADDRESS=
EOF
fpm -s dir -t deb --deb-user root --deb-group root -n matic-bor -v ${GITHUB_REF/refs\/tags\//} \
--after-install after_install.sh \
bor.service=/etc/systemd/system/ \
build/bin/bor=/usr/bin/ \
metadata=/etc/bor/
mkdir packages-${GITHUB_REF/refs\/tags\//}
mv matic-bor_${GITHUB_REF/refs\/tags\//}_amd64.deb packages-${GITHUB_REF/refs\/tags\//}/
ls packages-${GITHUB_REF/refs\/tags\//}/
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1
SOURCE_DIR: 'packages-${GITHUB_REF/refs\/tags\//}'
DEST_DIR: '${GITHUB_REF/refs\/tags\//}'
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Build Geth in a stock Go builder container
# Build Bor in a stock Go builder container
FROM golang:1.12-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

ADD . /go-ethereum
RUN cd /go-ethereum && make geth
ADD . /bor
RUN cd /bor && make bor

# Pull Geth into a second stage deploy alpine container
# Pull Bor into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
COPY --from=builder /bor/build/bin/bor /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
8 changes: 4 additions & 4 deletions Dockerfile.alltools
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Build Geth in a stock Go builder container
# Build Bor in a stock Go builder container
FROM golang:1.12-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

ADD . /go-ethereum
RUN cd /go-ethereum && make all
ADD . /bor
RUN cd /bor && make all

# Pull all binaries into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
COPY --from=builder /bor/build/bin/* /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
46 changes: 26 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@

GOBIN = $(shell pwd)/build/bin
GO ?= latest
GORUN = go run
GOPATH = $(shell go env GOPATH)

bor:
build/env.sh go run build/ci.go install ./cmd/bor
$(GORUN) build/ci.go install ./cmd/bor
mkdir -p $(GOPATH)/bin/
cp $(GOBIN)/bor $(GOPATH)/bin/
@echo "Done building."
@echo "Run \"$(GOBIN)/bor\" to launch bor."

all:
build/env.sh go run build/ci.go install
$(GORUN) build/ci.go install
mkdir -p $(GOPATH)/bin/
cp $(GOBIN)/* $(GOPATH)/bin/

android:
build/env.sh go run build/ci.go aar --local
$(GORUN) build/ci.go aar --local
@echo "Done building."
@echo "Import \"$(GOBIN)/bor.aar\" to use the library."

ios:
build/env.sh go run build/ci.go xcode --local
$(GORUN) build/ci.go xcode --local
@echo "Done building."
@echo "Import \"$(GOBIN)/bor.framework\" to use the library."

test: bor
go test github.com/maticnetwork/bor/consensus/bor_test
go test github.com/maticnetwork/bor/consensus/bor/bor_test

lint: ## Run linters.
build/env.sh go run build/ci.go lint
$(GORUN) build/ci.go lint

clean:
./build/clean_go_build_cache.sh
Expand Down Expand Up @@ -63,12 +69,12 @@ bor-linux: bor-linux-386 bor-linux-amd64 bor-linux-arm bor-linux-mips64 bor-linu
@ls -ld $(GOBIN)/bor-linux-*

bor-linux-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/bor
@echo "Linux 386 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep 386

bor-linux-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/bor
@echo "Linux amd64 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep amd64

Expand All @@ -77,42 +83,42 @@ bor-linux-arm: bor-linux-arm-5 bor-linux-arm-6 bor-linux-arm-7 bor-linux-arm64
@ls -ld $(GOBIN)/bor-linux-* | grep arm

bor-linux-arm-5:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/bor
@echo "Linux ARMv5 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep arm-5

bor-linux-arm-6:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/bor
@echo "Linux ARMv6 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep arm-6

bor-linux-arm-7:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/bor
@echo "Linux ARMv7 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep arm-7

bor-linux-arm64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/bor
@echo "Linux ARM64 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep arm64

bor-linux-mips:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/bor
@echo "Linux MIPS cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep mips

bor-linux-mipsle:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/bor
@echo "Linux MIPSle cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep mipsle

bor-linux-mips64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/bor
@echo "Linux MIPS64 cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep mips64

bor-linux-mips64le:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/bor
@echo "Linux MIPS64le cross compilation done:"
@ls -ld $(GOBIN)/bor-linux-* | grep mips64le

Expand All @@ -121,12 +127,12 @@ bor-darwin: bor-darwin-386 bor-darwin-amd64
@ls -ld $(GOBIN)/bor-darwin-*

bor-darwin-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/bor
@echo "Darwin 386 cross compilation done:"
@ls -ld $(GOBIN)/bor-darwin-* | grep 386

bor-darwin-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/bor
@echo "Darwin amd64 cross compilation done:"
@ls -ld $(GOBIN)/bor-darwin-* | grep amd64

Expand All @@ -135,11 +141,11 @@ bor-windows: bor-windows-386 bor-windows-amd64
@ls -ld $(GOBIN)/bor-windows-*

bor-windows-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/bor
@echo "Windows 386 cross compilation done:"
@ls -ld $(GOBIN)/bor-windows-* | grep 386

bor-windows-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/bor
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/bor
@echo "Windows amd64 cross compilation done:"
@ls -ld $(GOBIN)/bor-windows-* | grep amd64
16 changes: 9 additions & 7 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ func (abi ABI) UnpackIntoMap(v map[string]interface{}, name string, data []byte)
// UnmarshalJSON implements json.Unmarshaler interface
func (abi *ABI) UnmarshalJSON(data []byte) error {
var fields []struct {
Type string
Name string
Constant bool
Anonymous bool
Inputs []Argument
Outputs []Argument
Type string
Name string
Constant bool
StateMutability string
Anonymous bool
Inputs []Argument
Outputs []Argument
}

if err := json.Unmarshal(data, &fields); err != nil {
Expand All @@ -142,9 +143,10 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
name = fmt.Sprintf("%s%d", field.Name, idx)
_, ok = abi.Methods[name]
}
isConst := field.Constant || field.StateMutability == "pure" || field.StateMutability == "view"
abi.Methods[name] = Method{
Name: name,
Const: field.Constant,
Const: isConst,
Inputs: field.Inputs,
Outputs: field.Outputs,
}
Expand Down
3 changes: 3 additions & 0 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ func (fb *filterBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEve
func (fb *filterBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
return fb.bc.SubscribeLogsEvent(ch)
}
func (fb *filterBackend) SubscribeStateEvent(ch chan<- core.NewStateChangeEvent) event.Subscription {
return fb.bc.SubscribeStateEvent(ch)
}

func (fb *filterBackend) BloomStatus() (uint64, uint64) { return 4096, 0 }
func (fb *filterBackend) ServiceFilter(ctx context.Context, ms *bloombits.MatcherSession) {
Expand Down
Loading

0 comments on commit ae28e0a

Please sign in to comment.