Skip to content

Commit

Permalink
Merge branch 'develop' into shivam/upstream-geth-1.13.5
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsharma committed Jan 11, 2024
2 parents c816d0f + 20f9295 commit 34ed099
Show file tree
Hide file tree
Showing 8 changed files with 480 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:

- name: Test
run: make test

- uses: actions/upload-artifact@v2
with:
name: unitTest-coverage
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '16.17.1'
node-version: '18.19.0'
cache: 'npm'
cache-dependency-path: |
matic-cli/package-lock.json
Expand All @@ -231,7 +231,7 @@ jobs:
npm install --prefer-offline --no-audit --progress=false
mkdir devnet
cd devnet
../bin/matic-cli setup devnet -c ../../bor/.github/matic-cli-config.yml
../bin/matic-cli.js setup devnet -c ../../bor/.github/matic-cli-config.yml
- name: Launch devnet
run: |
Expand Down
15 changes: 0 additions & 15 deletions eth/bor_api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,6 @@ func (b *EthAPIBackend) GetVoteOnHash(ctx context.Context, starBlockNr uint64, e
return false, fmt.Errorf("Hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
}

ethHandler := (*ethHandler)(b.eth.handler)

bor, ok := ethHandler.chain.Engine().(*bor.Bor)

if !ok {
return false, fmt.Errorf("Bor not available")
}

err = bor.HeimdallClient.FetchMilestoneID(ctx, milestoneId)

if err != nil {
downloader.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, fmt.Errorf("Milestone ID doesn't exist in Heimdall")
}

downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())

return true, nil
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.25.7
go.uber.org/automaxprocs v1.5.2
golang.org/x/crypto v0.14.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad
golang.org/x/sync v0.3.0
golang.org/x/sys v0.13.0
golang.org/x/text v0.13.0
golang.org/x/sys v0.15.0
golang.org/x/text v0.14.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.10.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2287,8 +2287,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -2649,8 +2649,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down Expand Up @@ -2682,8 +2682,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
19 changes: 19 additions & 0 deletions internal/cli/server/config_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,22 @@ func TestConfigLegacy(t *testing.T) {
readFile("./testdata/test.toml")
})
}

func TestDefaultConfigLegacy(t *testing.T) {
readFile := func(path string) {
expectedConfig, err := readLegacyConfig(path)
assert.NoError(t, err)

testConfig := DefaultConfig()

testConfig.Identity = "Polygon-Devs"
testConfig.DataDir = "/var/lib/bor"

assert.Equal(t, expectedConfig, testConfig)
}

// read file in hcl format
t.Run("toml", func(t *testing.T) {
readFile("./testdata/default.toml")
})
}
193 changes: 193 additions & 0 deletions internal/cli/server/testdata/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
chain = "mainnet"
identity = "Polygon-Devs"
verbosity = 3
log-level = ""
vmdebug = false
datadir = "/var/lib/bor"
ancient = ""
"db.engine" = "leveldb"
keystore = ""
"rpc.batchlimit" = 100
"rpc.returndatalimit" = 100000
syncmode = "full"
gcmode = "full"
snapshot = true
"bor.logs" = false
ethstats = ""
devfakeauthor = false

["eth.requiredblocks"]

[log]
vmodule = ""
json = false
backtrace = ""
debug = false

[p2p]
maxpeers = 50
maxpendpeers = 50
bind = "0.0.0.0"
port = 30303
nodiscover = false
nat = "any"
netrestrict = ""
nodekey = ""
nodekeyhex = ""
txarrivalwait = "500ms"
[p2p.discovery]
v4disc = true
v5disc = false
bootnodes = []
bootnodesv4 = []
bootnodesv5 = []
static-nodes = []
trusted-nodes = []
dns = []

[heimdall]
url = "http://localhost:1317"
"bor.without" = false
grpc-address = ""
"bor.runheimdall" = false
"bor.runheimdallargs" = ""
"bor.useheimdallapp" = false

[txpool]
locals = []
nolocals = false
journal = "transactions.rlp"
rejournal = "1h0m0s"
pricelimit = 1
pricebump = 10
accountslots = 16
globalslots = 32768
accountqueue = 16
globalqueue = 32768
lifetime = "3h0m0s"

[miner]
mine = false
etherbase = ""
extradata = ""
gaslimit = 30000000
gasprice = "1000000000"
recommit = "2m5s"
commitinterrupt = true

[jsonrpc]
ipcdisable = false
ipcpath = ""
gascap = 50000000
evmtimeout = "5s"
txfeecap = 1.0
allow-unprotected-txs = false
enabledeprecatedpersonal = false
[jsonrpc.http]
enabled = false
port = 8545
prefix = ""
host = "localhost"
api = ["eth", "net", "web3", "txpool", "bor"]
vhosts = ["localhost"]
corsdomain = ["localhost"]
ep-size = 40
ep-requesttimeout = "0s"
[jsonrpc.ws]
enabled = false
port = 8546
prefix = ""
host = "localhost"
api = ["net", "web3"]
origins = ["localhost"]
ep-size = 40
ep-requesttimeout = "0s"
[jsonrpc.graphql]
enabled = false
port = 0
prefix = ""
host = ""
vhosts = ["localhost"]
corsdomain = ["localhost"]
ep-size = 0
ep-requesttimeout = ""
[jsonrpc.auth]
jwtsecret = ""
addr = "localhost"
port = 8551
vhosts = ["localhost"]
[jsonrpc.timeouts]
read = "10s"
write = "30s"
idle = "2m0s"

[gpo]
blocks = 20
percentile = 60
maxheaderhistory = 1024
maxblockhistory = 1024
maxprice = "500000000000"
ignoreprice = "2"

[telemetry]
metrics = false
expensive = false
prometheus-addr = "127.0.0.1:7071"
opencollector-endpoint = ""
[telemetry.influx]
influxdb = false
endpoint = ""
database = ""
username = ""
password = ""
influxdbv2 = false
token = ""
bucket = ""
organization = ""
[telemetry.influx.tags]

[cache]
cache = 1024
gc = 25
snapshot = 10
database = 50
trie = 15
noprefetch = false
preimages = false
txlookuplimit = 2350000
triesinmemory = 128
blocklogs = 32
timeout = "1h0m0s"
fdlimit = 0

[leveldb]
compactiontablesize = 2
compactiontablesizemultiplier = 1.0
compactiontotalsize = 10
compactiontotalsizemultiplier = 10.0

[accounts]
unlock = []
password = ""
allow-insecure-unlock = false
lightkdf = false
disable-bor-wallet = true

[grpc]
addr = ":3131"

[developer]
dev = false
period = 0
gaslimit = 11500000

[parallelevm]
enable = true
procs = 8

[pprof]
pprof = false
port = 6060
addr = "127.0.0.1"
memprofilerate = 524288
blockprofilerate = 0
15 changes: 8 additions & 7 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,8 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
for idx, receipt := range receipts {
tx := txs[idx]

var signer types.Signer = types.FrontierSigner{}

if tx.Protected() {
signer = types.NewEIP155Signer(tx.ChainId())
}

// Derive the sender.
signer := types.MakeSigner(s.b.ChainConfig(), block.Number(), block.Time())
from, _ := types.Sender(signer, tx)

fields := map[string]interface{}{
Expand All @@ -724,6 +720,11 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
"logs": receipt.Logs,
"logsBloom": receipt.Bloom,
"type": hexutil.Uint(tx.Type()),
"effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice),
}

if receipt.EffectiveGasPrice == nil {
fields["effectiveGasPrice"] = new(hexutil.Big)
}

// Assign receipt status or post state.
Expand All @@ -734,7 +735,7 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
}

if receipt.Logs == nil {
fields["logs"] = [][]*types.Log{}
fields["logs"] = []*types.Log{}
}

if borReceipt != nil && idx == len(receipts)-1 {
Expand Down
Loading

0 comments on commit 34ed099

Please sign in to comment.