Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dd25a4f5
Unverified
Commit
dd25a4f5
authored
1 year ago
by
Delweng
Committed by
GitHub
1 year ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les, signer, light: replace noarg fmt.Errorf with errors.New (#27336)
Signed-off-by:
jsvisa
<
delweng@gmail.com
>
parent
21c87e0f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
16 deletions
+18
-16
benchmark.go
les/benchmark.go
+4
-4
api.go
les/catalyst/api.go
+1
-1
client.go
les/client.go
+3
-3
retrieve.go
les/retrieve.go
+2
-2
trie_test.go
light/trie_test.go
+3
-2
signed_data.go
signer/core/signed_data.go
+2
-2
uiapi.go
signer/core/uiapi.go
+1
-1
rules.go
signer/rules/rules.go
+2
-1
No files found.
les/benchmark.go
View file @
dd25a4f5
...
...
@@ -19,7 +19,7 @@ package les
import
(
crand
"crypto/rand"
"encoding/binary"
"
fmt
"
"
errors
"
"math/big"
"math/rand"
"sync"
...
...
@@ -59,7 +59,7 @@ func (b *benchmarkBlockHeaders) init(h *serverHandler, count int) error {
b
.
offset
=
0
b
.
randMax
=
h
.
blockchain
.
CurrentHeader
()
.
Number
.
Int64
()
+
1
-
d
if
b
.
randMax
<
0
{
return
fmt
.
Errorf
(
"chain is too short"
)
return
errors
.
New
(
"chain is too short"
)
}
if
b
.
reverse
{
b
.
offset
=
d
...
...
@@ -137,7 +137,7 @@ func (b *benchmarkHelperTrie) init(h *serverHandler, count int) error {
b
.
headNum
=
b
.
sectionCount
*
params
.
CHTFrequency
-
1
}
if
b
.
sectionCount
==
0
{
return
fmt
.
Errorf
(
"no processed sections available"
)
return
errors
.
New
(
"no processed sections available"
)
}
return
nil
}
...
...
@@ -338,7 +338,7 @@ func (h *serverHandler) measure(setup *benchmarkSetup, count int) error {
case
<-
h
.
closeCh
:
clientPipe
.
Close
()
serverPipe
.
Close
()
return
fmt
.
Errorf
(
"Benchmark cancelled"
)
return
errors
.
New
(
"Benchmark cancelled"
)
}
setup
.
totalTime
+=
time
.
Duration
(
mclock
.
Now
()
-
start
)
...
...
This diff is collapsed.
Click to expand it.
les/catalyst/api.go
View file @
dd25a4f5
...
...
@@ -213,7 +213,7 @@ func (api *ConsensusAPI) ExchangeTransitionConfigurationV1(config engine.Transit
TerminalBlockNumber
:
config
.
TerminalBlockNumber
,
},
nil
}
return
nil
,
fmt
.
Errorf
(
"invalid terminal block hash"
)
return
nil
,
errors
.
New
(
"invalid terminal block hash"
)
}
return
&
engine
.
TransitionConfigurationV1
{
TerminalTotalDifficulty
:
(
*
hexutil
.
Big
)(
ttd
)},
nil
...
...
This diff is collapsed.
Click to expand it.
les/client.go
View file @
dd25a4f5
...
...
@@ -18,7 +18,7 @@
package
les
import
(
"
fmt
"
"
errors
"
"strings"
"time"
...
...
@@ -268,12 +268,12 @@ type LightDummyAPI struct{}
// Etherbase is the address that mining rewards will be send to
func
(
s
*
LightDummyAPI
)
Etherbase
()
(
common
.
Address
,
error
)
{
return
common
.
Address
{},
fmt
.
Errorf
(
"mining is not supported in light mode"
)
return
common
.
Address
{},
errors
.
New
(
"mining is not supported in light mode"
)
}
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func
(
s
*
LightDummyAPI
)
Coinbase
()
(
common
.
Address
,
error
)
{
return
common
.
Address
{},
fmt
.
Errorf
(
"mining is not supported in light mode"
)
return
common
.
Address
{},
errors
.
New
(
"mining is not supported in light mode"
)
}
// Hashrate returns the POW hashrate
...
...
This diff is collapsed.
Click to expand it.
les/retrieve.go
View file @
dd25a4f5
...
...
@@ -18,7 +18,7 @@ package les
import
(
"context"
"
fmt
"
"
errors
"
"sync"
"time"
...
...
@@ -110,7 +110,7 @@ func (rm *retrieveManager) retrieve(ctx context.Context, reqID uint64, req *dist
case
<-
ctx
.
Done
()
:
sentReq
.
stop
(
ctx
.
Err
())
case
<-
shutdown
:
sentReq
.
stop
(
fmt
.
Errorf
(
"client is shutting down"
))
sentReq
.
stop
(
errors
.
New
(
"client is shutting down"
))
}
return
sentReq
.
getError
()
}
...
...
This diff is collapsed.
Click to expand it.
light/trie_test.go
View file @
dd25a4f5
...
...
@@ -19,6 +19,7 @@ package light
import
(
"bytes"
"context"
"errors"
"fmt"
"math/big"
"testing"
...
...
@@ -78,9 +79,9 @@ func diffTries(t1, t2 state.Trie) error {
case
i2
.
Err
!=
nil
:
return
fmt
.
Errorf
(
"light trie iterator error: %v"
,
i2
.
Err
)
case
i1
.
Next
()
:
return
fmt
.
Errorf
(
"full trie iterator has more k/v pairs"
)
return
errors
.
New
(
"full trie iterator has more k/v pairs"
)
case
i2
.
Next
()
:
return
fmt
.
Errorf
(
"light trie iterator has more k/v pairs"
)
return
errors
.
New
(
"light trie iterator has more k/v pairs"
)
}
return
nil
}
This diff is collapsed.
Click to expand it.
signer/core/signed_data.go
View file @
dd25a4f5
...
...
@@ -304,10 +304,10 @@ func (api *SignerAPI) EcRecover(ctx context.Context, data hexutil.Bytes, sig hex
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
if
len
(
sig
)
!=
65
{
return
common
.
Address
{},
fmt
.
Errorf
(
"signature must be 65 bytes long"
)
return
common
.
Address
{},
errors
.
New
(
"signature must be 65 bytes long"
)
}
if
sig
[
64
]
!=
27
&&
sig
[
64
]
!=
28
{
return
common
.
Address
{},
fmt
.
Errorf
(
"invalid Ethereum signature (V is not 27 or 28)"
)
return
common
.
Address
{},
errors
.
New
(
"invalid Ethereum signature (V is not 27 or 28)"
)
}
sig
[
64
]
-=
27
// Transform yellow paper V from 27/28 to 0/1
hash
:=
accounts
.
TextHash
(
data
)
...
...
This diff is collapsed.
Click to expand it.
signer/core/uiapi.go
View file @
dd25a4f5
...
...
@@ -177,7 +177,7 @@ func (s *UIServerAPI) Export(ctx context.Context, addr common.Address) (json.Raw
return
nil
,
err
}
if
wallet
.
URL
()
.
Scheme
!=
keystore
.
KeyStoreScheme
{
return
nil
,
fmt
.
Errorf
(
"account is not a keystore-account"
)
return
nil
,
errors
.
New
(
"account is not a keystore-account"
)
}
return
os
.
ReadFile
(
wallet
.
URL
()
.
Path
)
}
...
...
This diff is collapsed.
Click to expand it.
signer/rules/rules.go
View file @
dd25a4f5
...
...
@@ -18,6 +18,7 @@ package rules
import
(
"encoding/json"
"errors"
"fmt"
"os"
"strings"
...
...
@@ -146,7 +147,7 @@ func (r *rulesetUI) checkApproval(jsfunc string, jsarg []byte, err error) (bool,
log
.
Info
(
"Op rejected"
)
return
false
,
nil
}
return
false
,
fmt
.
Errorf
(
"unknown response"
)
return
false
,
errors
.
New
(
"unknown response"
)
}
func
(
r
*
rulesetUI
)
ApproveTx
(
request
*
core
.
SignTxRequest
)
(
core
.
SignTxResponse
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment