Skip to content

Commit 7db8c14

Browse files
authored
Merge pull request #767 from cffls/jerryc/v0.3.5
v0.3.5
2 parents 4561012 + 318b7fa commit 7db8c14

20 files changed

+125
-124
lines changed

.github/workflows/ci.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
3030
- uses: actions/setup-go@v3
3131
with:
32-
go-version: 1.20.x
32+
go-version: 1.19.x
3333

3434
- name: Install dependencies on Linux
3535
if: runner.os == 'Linux'
@@ -51,10 +51,9 @@ jobs:
5151
- name: Build
5252
run: make all
5353

54-
# # TODO: fix LINT not working with go 1.20.x
55-
# - name: Lint
56-
# if: runner.os == 'Linux'
57-
# run: make lint
54+
- name: Lint
55+
if: runner.os == 'Linux'
56+
run: make lint
5857

5958
- name: Test
6059
run: make test
@@ -99,7 +98,7 @@ jobs:
9998
10099
- uses: actions/setup-go@v3
101100
with:
102-
go-version: 1.20.x
101+
go-version: 1.18.x
103102

104103
- name: Checkout matic-cli
105104
uses: actions/checkout@v3

.github/workflows/packager.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Go
2222
uses: actions/setup-go@master
2323
with:
24-
go-version: 1.20
24+
go-version: 1.19
2525
- name: Adding TAG to ENV
2626
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
2727

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Go
2222
uses: actions/setup-go@master
2323
with:
24-
go-version: 1.20.x
24+
go-version: 1.19.x
2525

2626
- name: Prepare
2727
id: prepare

.golangci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file configures github.com/golangci/golangci-lint.
22

33
run:
4-
go: '1.20'
4+
go: '1.18'
55
timeout: 20m
66
tests: true
77
# default is true. Enables skipping of directories:
@@ -185,4 +185,4 @@ issues:
185185
max-issues-per-linter: 0
186186
max-same-issues: 0
187187
#new: true
188-
new-from-rev: origin/master
188+
new-from-rev: origin/master

.travis.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- stage: lint
1717
os: linux
1818
dist: bionic
19-
go: 1.20.x
19+
go: 1.18.x
2020
env:
2121
- lint
2222
git:
@@ -31,7 +31,7 @@ jobs:
3131
os: linux
3232
arch: amd64
3333
dist: bionic
34-
go: 1.20.x
34+
go: 1.18.x
3535
env:
3636
- docker
3737
services:
@@ -48,7 +48,7 @@ jobs:
4848
os: linux
4949
arch: arm64
5050
dist: bionic
51-
go: 1.20.x
51+
go: 1.18.x
5252
env:
5353
- docker
5454
services:
@@ -65,7 +65,7 @@ jobs:
6565
if: type = push
6666
os: linux
6767
dist: bionic
68-
go: 1.20.x
68+
go: 1.18.x
6969
env:
7070
- ubuntu-ppa
7171
- GO111MODULE=on
@@ -90,7 +90,7 @@ jobs:
9090
os: linux
9191
dist: bionic
9292
sudo: required
93-
go: 1.20.x
93+
go: 1.18.x
9494
env:
9595
- azure-linux
9696
- GO111MODULE=on
@@ -148,7 +148,7 @@ jobs:
148148
- sdkmanager "platform-tools" "platforms;android-15" "platforms;android-19" "platforms;android-24" "ndk-bundle"
149149

150150
# Install Go to allow building with
151-
- curl https://dl.google.com/go/go1.20.linux-amd64.tar.gz | tar -xz
151+
- curl https://dl.google.com/go/go1.18.linux-amd64.tar.gz | tar -xz
152152
- export PATH=`pwd`/go/bin:$PATH
153153
- export GOROOT=`pwd`/go
154154
- export GOPATH=$HOME/go
@@ -162,7 +162,7 @@ jobs:
162162
- stage: build
163163
if: type = push
164164
os: osx
165-
go: 1.20.x
165+
go: 1.18.x
166166
env:
167167
- azure-osx
168168
- azure-ios
@@ -194,7 +194,7 @@ jobs:
194194
os: linux
195195
arch: amd64
196196
dist: bionic
197-
go: 1.20.x
197+
go: 1.18.x
198198
env:
199199
- GO111MODULE=on
200200
script:
@@ -205,7 +205,7 @@ jobs:
205205
os: linux
206206
arch: arm64
207207
dist: bionic
208-
go: 1.20.x
208+
go: 1.18.x
209209
env:
210210
- GO111MODULE=on
211211
script:
@@ -225,7 +225,7 @@ jobs:
225225
if: type = cron
226226
os: linux
227227
dist: bionic
228-
go: 1.20.x
228+
go: 1.18.x
229229
env:
230230
- azure-purge
231231
- GO111MODULE=on
@@ -239,7 +239,7 @@ jobs:
239239
if: type = cron
240240
os: linux
241241
dist: bionic
242-
go: 1.20.x
242+
go: 1.18.x
243243
env:
244244
- GO111MODULE=on
245245
script:

Dockerfile.alltools

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build Geth in a stock Go builder container
2-
FROM golang:1.20-alpine as builder
2+
FROM golang:1.18.1-alpine as builder
33

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

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ geth-windows-amd64:
196196
@ls -ld $(GOBIN)/geth-windows-* | grep amd64
197197

198198
PACKAGE_NAME := github.com/maticnetwork/bor
199-
GOLANG_CROSS_VERSION ?= v1.20.1
199+
GOLANG_CROSS_VERSION ?= v1.19.1
200200

201201
.PHONY: release-dry-run
202202
release-dry-run:

build/ci.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ Usage: go run build/ci.go <command> <command flags/arguments>
2424
2525
Available commands are:
2626
27-
install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
28-
test [ -coverage ] [ packages... ] -- runs the tests
29-
lint -- runs certain pre-selected linters
30-
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
31-
importkeys -- imports signing keys from env
32-
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
33-
nsis -- creates a Windows NSIS installer
34-
aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
35-
xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
36-
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
27+
install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
28+
test [ -coverage ] [ packages... ] -- runs the tests
29+
lint -- runs certain pre-selected linters
30+
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
31+
importkeys -- imports signing keys from env
32+
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
33+
nsis -- creates a Windows NSIS installer
34+
aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
35+
xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
36+
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
3737
3838
For all commands, -n prevents execution of external programs (dry run mode).
39+
3940
*/
4041
package main
4142

@@ -147,7 +148,7 @@ var (
147148
// This is the version of go that will be downloaded by
148149
//
149150
// go run ci.go install -dlgo
150-
dlgoVersion = "1.20.1"
151+
dlgoVersion = "1.18"
151152
)
152153

153154
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))

core/vm/contracts.go

+19-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/ethereum/go-ethereum/crypto/bn256"
3131
"github.com/ethereum/go-ethereum/params"
3232

33-
//lint:ignore SA1019 Needed for precompile
33+
big2 "github.com/holiman/big"
3434
"golang.org/x/crypto/ripemd160"
3535
)
3636

@@ -266,9 +266,10 @@ var (
266266
// modexpMultComplexity implements bigModexp multComplexity formula, as defined in EIP-198
267267
//
268268
// def mult_complexity(x):
269-
// if x <= 64: return x ** 2
270-
// elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072
271-
// else: return x ** 2 // 16 + 480 * x - 199680
269+
//
270+
// if x <= 64: return x ** 2
271+
// elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072
272+
// else: return x ** 2 // 16 + 480 * x - 199680
272273
//
273274
// where is x is max(length_of_MODULUS, length_of_BASE)
274275
func modexpMultComplexity(x *big.Int) *big.Int {
@@ -379,15 +380,24 @@ func (c *bigModExp) Run(input []byte) ([]byte, error) {
379380
}
380381
// Retrieve the operands and execute the exponentiation
381382
var (
382-
base = new(big.Int).SetBytes(getData(input, 0, baseLen))
383-
exp = new(big.Int).SetBytes(getData(input, baseLen, expLen))
384-
mod = new(big.Int).SetBytes(getData(input, baseLen+expLen, modLen))
383+
base = new(big2.Int).SetBytes(getData(input, 0, baseLen))
384+
exp = new(big2.Int).SetBytes(getData(input, baseLen, expLen))
385+
mod = new(big2.Int).SetBytes(getData(input, baseLen+expLen, modLen))
386+
v []byte
385387
)
386-
if mod.BitLen() == 0 {
388+
389+
switch {
390+
case mod.BitLen() == 0:
387391
// Modulo 0 is undefined, return zero
388392
return common.LeftPadBytes([]byte{}, int(modLen)), nil
393+
case base.BitLen() == 1: // a bit length of 1 means it's 1 (or -1).
394+
//If base == 1, then we can just return base % mod (if mod >= 1, which it is)
395+
v = base.Mod(base, mod).Bytes()
396+
default:
397+
v = base.Exp(base, exp, mod).Bytes()
389398
}
390-
return common.LeftPadBytes(base.Exp(base, exp, mod).Bytes(), int(modLen)), nil
399+
400+
return common.LeftPadBytes(v, int(modLen)), nil
391401
}
392402

393403
// newCurvePoint unmarshals a binary blob into a bn256 elliptic curve point,

go.mod

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ethereum/go-ethereum
22

3-
go 1.20
3+
go 1.19
44

55
require (
66
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0
@@ -71,7 +71,7 @@ require (
7171
go.uber.org/goleak v1.1.12
7272
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122
7373
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
74-
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
74+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43
7575
golang.org/x/text v0.3.7
7676
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
7777
golang.org/x/tools v0.1.12
@@ -85,7 +85,10 @@ require (
8585
pgregory.net/rapid v0.4.8
8686
)
8787

88-
require github.com/gammazero/deque v0.2.1 // indirect
88+
require (
89+
github.com/gammazero/deque v0.2.1 // indirect
90+
github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e // indirect
91+
)
8992

9093
require (
9194
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuW
275275
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
276276
github.com/hashicorp/hcl/v2 v2.10.1 h1:h4Xx4fsrRE26ohAk/1iGF/JBqRQbyUqu5Lvj60U54ys=
277277
github.com/hashicorp/hcl/v2 v2.10.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
278+
github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e h1:pIYdhNkDh+YENVNi3gto8n9hAmRxKxoar0iE6BLucjw=
279+
github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e/go.mod h1:j9cQbcqHQujT0oKJ38PylVfqohClLr3CvDC+Qcg+lhU=
278280
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
279281
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
280282
github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM=
@@ -660,6 +662,8 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w
660662
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
661663
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
662664
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
665+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 h1:OK7RB6t2WQX54srQQYSXMW8dF5C6/8+oA/s5QBmmto4=
666+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
663667
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
664668
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
665669
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=

0 commit comments

Comments
 (0)