all: fix some typos in comments and names (#31023)

pull/31030/head
georgehao 2 weeks ago committed by GitHub
parent 37c0e6992e
commit 1843f27766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      accounts/accounts.go
  2. 1
      cmd/devp2p/internal/ethtest/protocol.go
  3. 18
      cmd/devp2p/internal/v4test/discv4tests.go
  4. 1
      consensus/clique/snapshot_test.go
  5. 2
      core/tracing/hooks.go
  6. 6
      core/txpool/legacypool/legacypool2_test.go
  7. 2
      core/types/deposit.go
  8. 6
      core/vm/eof_validation.go
  9. 5
      core/vm/program/program.go
  10. 8
      crypto/blake2b/blake2b.go
  11. 2
      crypto/bn256/gnark/pairing.go
  12. 12
      crypto/ecies/ecies.go
  13. 2
      eth/tracers/dir.go
  14. 1
      eth/tracers/internal/util.go
  15. 3
      internal/era/builder.go
  16. 25
      internal/jsre/jsre.go
  17. 1
      internal/reexec/reexec.go
  18. 1
      metrics/exp/exp.go
  19. 2
      metrics/gauge_info.go
  20. 2
      metrics/log.go
  21. 1
      metrics/metrics.go
  22. 6
      metrics/resetting_timer.go
  23. 2
      metrics/syslog.go
  24. 12
      p2p/discover/v5wire/encoding_test.go
  25. 2
      params/protocol_params.go
  26. 2
      signer/core/api.go
  27. 2
      signer/core/uiapi.go

@ -214,7 +214,9 @@ const (
// of starting any background processes such as automatic key derivation. // of starting any background processes such as automatic key derivation.
WalletOpened WalletOpened
// WalletDropped // WalletDropped is fired when a wallet is removed or disconnected, either via USB
// or due to a filesystem event in the keystore. This event indicates that the wallet
// is no longer available for operations.
WalletDropped WalletDropped
) )

@ -13,6 +13,7 @@
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package ethtest package ethtest
import ( import (

@ -194,7 +194,7 @@ func PingExtraData(t *utesting.T) {
} }
} }
// This test sends a PING packet with additional data and wrong 'from' field // PingExtraDataWrongFrom sends a PING packet with additional data and wrong 'from' field
// and expects a PONG response. // and expects a PONG response.
func PingExtraDataWrongFrom(t *utesting.T) { func PingExtraDataWrongFrom(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
@ -215,7 +215,7 @@ func PingExtraDataWrongFrom(t *utesting.T) {
} }
} }
// This test sends a PING packet with an expiration in the past. // PingPastExpiration sends a PING packet with an expiration in the past.
// The remote node should not respond. // The remote node should not respond.
func PingPastExpiration(t *utesting.T) { func PingPastExpiration(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
@ -234,7 +234,7 @@ func PingPastExpiration(t *utesting.T) {
} }
} }
// This test sends an invalid packet. The remote node should not respond. // WrongPacketType sends an invalid packet. The remote node should not respond.
func WrongPacketType(t *utesting.T) { func WrongPacketType(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
defer te.close() defer te.close()
@ -252,7 +252,7 @@ func WrongPacketType(t *utesting.T) {
} }
} }
// This test verifies that the default behaviour of ignoring 'from' fields is unaffected by // BondThenPingWithWrongFrom verifies that the default behaviour of ignoring 'from' fields is unaffected by
// the bonding process. After bonding, it pings the target with a different from endpoint. // the bonding process. After bonding, it pings the target with a different from endpoint.
func BondThenPingWithWrongFrom(t *utesting.T) { func BondThenPingWithWrongFrom(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
@ -289,7 +289,7 @@ waitForPong:
} }
} }
// This test just sends FINDNODE. The remote node should not reply // FindnodeWithoutEndpointProof sends FINDNODE. The remote node should not reply
// because the endpoint proof has not completed. // because the endpoint proof has not completed.
func FindnodeWithoutEndpointProof(t *utesting.T) { func FindnodeWithoutEndpointProof(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
@ -332,7 +332,7 @@ func BasicFindnode(t *utesting.T) {
} }
} }
// This test sends an unsolicited NEIGHBORS packet after the endpoint proof, then sends // UnsolicitedNeighbors sends an unsolicited NEIGHBORS packet after the endpoint proof, then sends
// FINDNODE to read the remote table. The remote node should not return the node contained // FINDNODE to read the remote table. The remote node should not return the node contained
// in the unsolicited NEIGHBORS packet. // in the unsolicited NEIGHBORS packet.
func UnsolicitedNeighbors(t *utesting.T) { func UnsolicitedNeighbors(t *utesting.T) {
@ -373,7 +373,7 @@ func UnsolicitedNeighbors(t *utesting.T) {
} }
} }
// This test sends FINDNODE with an expiration timestamp in the past. // FindnodePastExpiration sends FINDNODE with an expiration timestamp in the past.
// The remote node should not respond. // The remote node should not respond.
func FindnodePastExpiration(t *utesting.T) { func FindnodePastExpiration(t *utesting.T) {
te := newTestEnv(Remote, Listen1, Listen2) te := newTestEnv(Remote, Listen1, Listen2)
@ -426,7 +426,7 @@ func bond(t *utesting.T, te *testenv) {
} }
} }
// This test attempts to perform a traffic amplification attack against a // FindnodeAmplificationInvalidPongHash attempts to perform a traffic amplification attack against a
// 'victim' endpoint using FINDNODE. In this attack scenario, the attacker // 'victim' endpoint using FINDNODE. In this attack scenario, the attacker
// attempts to complete the endpoint proof non-interactively by sending a PONG // attempts to complete the endpoint proof non-interactively by sending a PONG
// with mismatching reply token from the 'victim' endpoint. The attack works if // with mismatching reply token from the 'victim' endpoint. The attack works if
@ -478,7 +478,7 @@ func FindnodeAmplificationInvalidPongHash(t *utesting.T) {
} }
} }
// This test attempts to perform a traffic amplification attack using FINDNODE. // FindnodeAmplificationWrongIP attempts to perform a traffic amplification attack using FINDNODE.
// The attack works if the remote node does not verify the IP address of FINDNODE // The attack works if the remote node does not verify the IP address of FINDNODE
// against the endpoint verification proof done by PING/PONG. // against the endpoint verification proof done by PING/PONG.
func FindnodeAmplificationWrongIP(t *utesting.T) { func FindnodeAmplificationWrongIP(t *utesting.T) {

@ -467,7 +467,6 @@ func (tt *cliqueTest) run(t *testing.T) {
for j := 0; j < len(batches)-1; j++ { for j := 0; j < len(batches)-1; j++ {
if k, err := chain.InsertChain(batches[j]); err != nil { if k, err := chain.InsertChain(batches[j]); err != nil {
t.Fatalf("failed to import batch %d, block %d: %v", j, k, err) t.Fatalf("failed to import batch %d, block %d: %v", j, k, err)
break
} }
} }
if _, err = chain.InsertChain(batches[len(batches)-1]); err != tt.failure { if _, err = chain.InsertChain(batches[len(batches)-1]); err != tt.failure {

@ -293,7 +293,7 @@ const (
GasChangeCallLeftOverRefunded GasChangeReason = 7 GasChangeCallLeftOverRefunded GasChangeReason = 7
// GasChangeCallContractCreation is the amount of gas that will be burned for a CREATE. // GasChangeCallContractCreation is the amount of gas that will be burned for a CREATE.
GasChangeCallContractCreation GasChangeReason = 8 GasChangeCallContractCreation GasChangeReason = 8
// GasChangeContractCreation is the amount of gas that will be burned for a CREATE2. // GasChangeCallContractCreation2 is the amount of gas that will be burned for a CREATE2.
GasChangeCallContractCreation2 GasChangeReason = 9 GasChangeCallContractCreation2 GasChangeReason = 9
// GasChangeCallCodeStorage is the amount of gas that will be charged for code storage. // GasChangeCallCodeStorage is the amount of gas that will be charged for code storage.
GasChangeCallCodeStorage GasChangeReason = 10 GasChangeCallCodeStorage GasChangeReason = 10

@ -162,12 +162,12 @@ func TestTransactionZAttack(t *testing.T) {
var ivpendingNum int var ivpendingNum int
pendingtxs, _ := pool.Content() pendingtxs, _ := pool.Content()
for account, txs := range pendingtxs { for account, txs := range pendingtxs {
cur_balance := new(big.Int).Set(pool.currentState.GetBalance(account).ToBig()) curBalance := new(big.Int).Set(pool.currentState.GetBalance(account).ToBig())
for _, tx := range txs { for _, tx := range txs {
if cur_balance.Cmp(tx.Value()) <= 0 { if curBalance.Cmp(tx.Value()) <= 0 {
ivpendingNum++ ivpendingNum++
} else { } else {
cur_balance.Sub(cur_balance, tx.Value()) curBalance.Sub(curBalance, tx.Value())
} }
} }
} }

@ -24,7 +24,7 @@ const (
depositRequestSize = 192 depositRequestSize = 192
) )
// UnpackIntoDeposit unpacks a serialized DepositEvent. // DepositLogToRequest unpacks a serialized DepositEvent.
func DepositLogToRequest(data []byte) ([]byte, error) { func DepositLogToRequest(data []byte) ([]byte, error) {
if len(data) != 576 { if len(data) != 576 {
return nil, fmt.Errorf("deposit wrong length: want 576, have %d", len(data)) return nil, fmt.Errorf("deposit wrong length: want 576, have %d", len(data))

@ -109,8 +109,8 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
return nil, err return nil, err
} }
case RJUMPV: case RJUMPV:
max_size := int(code[i+1]) maxSize := int(code[i+1])
length := max_size + 1 length := maxSize + 1
if len(code) <= i+length { if len(code) <= i+length {
return nil, fmt.Errorf("%w: jump table truncated, op %s, pos %d", errTruncatedImmediate, op, i) return nil, fmt.Errorf("%w: jump table truncated, op %s, pos %d", errTruncatedImmediate, op, i)
} }
@ -120,7 +120,7 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
return nil, err return nil, err
} }
} }
i += 2 * max_size i += 2 * maxSize
case CALLF: case CALLF:
arg, _ := parseUint16(code[i+1:]) arg, _ := parseUint16(code[i+1:])
if arg >= len(container.types) { if arg >= len(container.types) {

@ -19,6 +19,7 @@
// - There are not package guarantees. We might iterate heavily on this package, and do backwards-incompatible changes without warning // - There are not package guarantees. We might iterate heavily on this package, and do backwards-incompatible changes without warning
// - There are no quality-guarantees. These utilities may produce evm-code that is non-functional. YMMV. // - There are no quality-guarantees. These utilities may produce evm-code that is non-functional. YMMV.
// - There are no stability-guarantees. The utility will `panic` if the inputs do not align / make sense. // - There are no stability-guarantees. The utility will `panic` if the inputs do not align / make sense.
package program package program
import ( import (
@ -204,7 +205,7 @@ func (p *Program) StaticCall(gas *uint256.Int, address, inOffset, inSize, outOff
return p.Op(vm.STATICCALL) return p.Op(vm.STATICCALL)
} }
// StaticCall is a convenience function to make a callcode. If 'gas' is nil, the opcode GAS will // CallCode is a convenience function to make a callcode. If 'gas' is nil, the opcode GAS will
// be used to provide all gas. // be used to provide all gas.
func (p *Program) CallCode(gas *uint256.Int, address, value, inOffset, inSize, outOffset, outSize any) *Program { func (p *Program) CallCode(gas *uint256.Int, address, value, inOffset, inSize, outOffset, outSize any) *Program {
if outOffset == outSize && inSize == outSize && inOffset == outSize { if outOffset == outSize && inSize == outSize && inOffset == outSize {
@ -263,7 +264,7 @@ func (p *Program) InputAddressToStack(inputOffset uint32) *Program {
return p.Op(vm.AND) return p.Op(vm.AND)
} }
// MStore stores the provided data (into the memory area starting at memStart). // Mstore stores the provided data (into the memory area starting at memStart).
func (p *Program) Mstore(data []byte, memStart uint32) *Program { func (p *Program) Mstore(data []byte, memStart uint32) *Program {
var idx = 0 var idx = 0
// We need to store it in chunks of 32 bytes // We need to store it in chunks of 32 bytes

@ -23,13 +23,13 @@ import (
) )
const ( const (
// The blocksize of BLAKE2b in bytes. // BlockSize the blocksize of BLAKE2b in bytes.
BlockSize = 128 BlockSize = 128
// The hash size of BLAKE2b-512 in bytes. // Size the hash size of BLAKE2b-512 in bytes.
Size = 64 Size = 64
// The hash size of BLAKE2b-384 in bytes. // Size384 the hash size of BLAKE2b-384 in bytes.
Size384 = 48 Size384 = 48
// The hash size of BLAKE2b-256 in bytes. // Size256 the hash size of BLAKE2b-256 in bytes.
Size256 = 32 Size256 = 32
) )

@ -4,7 +4,7 @@ import (
"github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254"
) )
// Computes the following relation: ∏ᵢ e(Pᵢ, Qᵢ) =? 1 // PairingCheck computes the following relation: ∏ᵢ e(Pᵢ, Qᵢ) =? 1
// //
// To explain why gnark returns a (bool, error): // To explain why gnark returns a (bool, error):
// //

@ -60,12 +60,12 @@ type PublicKey struct {
Params *ECIESParams Params *ECIESParams
} }
// Export an ECIES public key as an ECDSA public key. // ExportECDSA exports an ECIES public key as an ECDSA public key.
func (pub *PublicKey) ExportECDSA() *ecdsa.PublicKey { func (pub *PublicKey) ExportECDSA() *ecdsa.PublicKey {
return &ecdsa.PublicKey{Curve: pub.Curve, X: pub.X, Y: pub.Y} return &ecdsa.PublicKey{Curve: pub.Curve, X: pub.X, Y: pub.Y}
} }
// Import an ECDSA public key as an ECIES public key. // ImportECDSAPublic imports an ECDSA public key as an ECIES public key.
func ImportECDSAPublic(pub *ecdsa.PublicKey) *PublicKey { func ImportECDSAPublic(pub *ecdsa.PublicKey) *PublicKey {
return &PublicKey{ return &PublicKey{
X: pub.X, X: pub.X,
@ -81,20 +81,20 @@ type PrivateKey struct {
D *big.Int D *big.Int
} }
// Export an ECIES private key as an ECDSA private key. // ExportECDSA exports an ECIES private key as an ECDSA private key.
func (prv *PrivateKey) ExportECDSA() *ecdsa.PrivateKey { func (prv *PrivateKey) ExportECDSA() *ecdsa.PrivateKey {
pub := &prv.PublicKey pub := &prv.PublicKey
pubECDSA := pub.ExportECDSA() pubECDSA := pub.ExportECDSA()
return &ecdsa.PrivateKey{PublicKey: *pubECDSA, D: prv.D} return &ecdsa.PrivateKey{PublicKey: *pubECDSA, D: prv.D}
} }
// Import an ECDSA private key as an ECIES private key. // ImportECDSA imports an ECDSA private key as an ECIES private key.
func ImportECDSA(prv *ecdsa.PrivateKey) *PrivateKey { func ImportECDSA(prv *ecdsa.PrivateKey) *PrivateKey {
pub := ImportECDSAPublic(&prv.PublicKey) pub := ImportECDSAPublic(&prv.PublicKey)
return &PrivateKey{*pub, prv.D} return &PrivateKey{*pub, prv.D}
} }
// Generate an elliptic curve public / private keypair. If params is nil, // GenerateKey generates an elliptic curve public / private keypair. If params is nil,
// the recommended default parameters for the key will be chosen. // the recommended default parameters for the key will be chosen.
func GenerateKey(rand io.Reader, curve elliptic.Curve, params *ECIESParams) (prv *PrivateKey, err error) { func GenerateKey(rand io.Reader, curve elliptic.Curve, params *ECIESParams) (prv *PrivateKey, err error) {
sk, err := ecdsa.GenerateKey(curve, rand) sk, err := ecdsa.GenerateKey(curve, rand)
@ -119,7 +119,7 @@ func MaxSharedKeyLength(pub *PublicKey) int {
return (pub.Curve.Params().BitSize + 7) / 8 return (pub.Curve.Params().BitSize + 7) / 8
} }
// ECDH key agreement method used to establish secret keys for encryption. // GenerateShared ECDH key agreement method used to establish secret keys for encryption.
func (prv *PrivateKey) GenerateShared(pub *PublicKey, skLen, macLen int) (sk []byte, err error) { func (prv *PrivateKey) GenerateShared(pub *PublicKey, skLen, macLen int) (sk []byte, err error) {
if prv.PublicKey.Curve != pub.Curve { if prv.PublicKey.Curve != pub.Curve {
return nil, ErrInvalidCurve return nil, ErrInvalidCurve

@ -34,7 +34,7 @@ type Context struct {
TxHash common.Hash // Hash of the transaction being traced (zero if dangling call) TxHash common.Hash // Hash of the transaction being traced (zero if dangling call)
} }
// The set of methods that must be exposed by a tracer // Tracer represents the set of methods that must be exposed by a tracer
// for it to be available through the RPC interface. // for it to be available through the RPC interface.
// This involves a method to retrieve results and one to // This involves a method to retrieve results and one to
// stop tracing. // stop tracing.

@ -13,6 +13,7 @@
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package internal package internal
import ( import (

@ -12,7 +12,8 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. // along with go-ethereum. If not, see <http//www.gnu.org/licenses/>.
package era package era
import ( import (

@ -67,7 +67,19 @@ type evalReq struct {
done chan bool done chan bool
} }
// runtime must be stopped with Stop() after use and cannot be used after stopping // New creates and initializes a new JavaScript runtime environment (JSRE).
// The runtime is configured with the provided assetPath for loading scripts and
// an output writer for logging or printing results.
//
// The returned JSRE must be stopped by calling Stop() after use to release resources.
// Attempting to use the JSRE after stopping it will result in undefined behavior.
//
// Parameters:
// - assetPath: The path to the directory containing script assets.
// - output: The writer used for logging or printing runtime output.
//
// Returns:
// - A pointer to the newly created JSRE instance.
func New(assetPath string, output io.Writer) *JSRE { func New(assetPath string, output io.Writer) *JSRE {
re := &JSRE{ re := &JSRE{
assetPath: assetPath, assetPath: assetPath,
@ -251,8 +263,15 @@ func (re *JSRE) Stop(waitForCallbacks bool) {
} }
} }
// Exec(file) loads and runs the contents of a file // Exec loads and executes the contents of a JavaScript file.
// if a relative path is given, the jsre's assetPath is used // If a relative path is provided, the file is resolved relative to the JSRE's assetPath.
// The file is read, compiled, and executed in the JSRE's runtime environment.
//
// Parameters:
// - file: The path to the JavaScript file to execute. Can be an absolute path or relative to assetPath.
//
// Returns:
// - error: An error if the file cannot be read, compiled, or executed.
func (re *JSRE) Exec(file string) error { func (re *JSRE) Exec(file string) error {
code, err := os.ReadFile(common.AbsolutePath(re.assetPath, file)) code, err := os.ReadFile(common.AbsolutePath(re.assetPath, file))
if err != nil { if err != nil {

@ -7,6 +7,7 @@
// we require because of the forking limitations of using Go. Handlers can be // we require because of the forking limitations of using Go. Handlers can be
// registered with a name and the argv 0 of the exec of the binary will be used // registered with a name and the argv 0 of the exec of the binary will be used
// to find and execute custom init paths. // to find and execute custom init paths.
package reexec package reexec
import ( import (

@ -1,5 +1,6 @@
// Hook go-metrics into expvar // Hook go-metrics into expvar
// on any /debug/metrics request, load all vars from the registry into expvar, and execute regular expvar handler // on any /debug/metrics request, load all vars from the registry into expvar, and execute regular expvar handler
package exp package exp
import ( import (

@ -39,7 +39,7 @@ func NewRegisteredGaugeInfo(name string, r Registry) *GaugeInfo {
return c return c
} }
// gaugeInfoSnapshot is a read-only copy of another GaugeInfo. // GaugeInfoSnapshot is a read-only copy of another GaugeInfo.
type GaugeInfoSnapshot GaugeInfoValue type GaugeInfoSnapshot GaugeInfoValue
// Value returns the value at the time the snapshot was taken. // Value returns the value at the time the snapshot was taken.

@ -12,7 +12,7 @@ func Log(r Registry, freq time.Duration, l Logger) {
LogScaled(r, freq, time.Nanosecond, l) LogScaled(r, freq, time.Nanosecond, l)
} }
// Output each metric in the given registry periodically using the given // LogScaled outputs each metric in the given registry periodically using the given
// logger. Print timings in `scale` units (eg time.Millisecond) rather than nanos. // logger. Print timings in `scale` units (eg time.Millisecond) rather than nanos.
func LogScaled(r Registry, freq time.Duration, scale time.Duration, l Logger) { func LogScaled(r Registry, freq time.Duration, scale time.Duration, l Logger) {
du := float64(scale) du := float64(scale)

@ -3,6 +3,7 @@
// <https://github.com/rcrowley/go-metrics> // <https://github.com/rcrowley/go-metrics>
// //
// Coda Hale's original work: <https://github.com/codahale/metrics> // Coda Hale's original work: <https://github.com/codahale/metrics>
package metrics package metrics
import ( import (

@ -53,14 +53,14 @@ func (t *ResettingTimer) Snapshot() *ResettingTimerSnapshot {
return snapshot return snapshot
} }
// Record the duration of the execution of the given function. // Time records the duration of the execution of the given function.
func (t *ResettingTimer) Time(f func()) { func (t *ResettingTimer) Time(f func()) {
ts := time.Now() ts := time.Now()
f() f()
t.Update(time.Since(ts)) t.Update(time.Since(ts))
} }
// Record the duration of an event. // Update records the duration of an event.
func (t *ResettingTimer) Update(d time.Duration) { func (t *ResettingTimer) Update(d time.Duration) {
if !metricsEnabled { if !metricsEnabled {
return return
@ -71,7 +71,7 @@ func (t *ResettingTimer) Update(d time.Duration) {
t.sum += int64(d) t.sum += int64(d)
} }
// Record the duration of an event that started at a time and ends now. // UpdateSince records the duration of an event that started at a time and ends now.
func (t *ResettingTimer) UpdateSince(ts time.Time) { func (t *ResettingTimer) UpdateSince(ts time.Time) {
t.Update(time.Since(ts)) t.Update(time.Since(ts))
} }

@ -9,7 +9,7 @@ import (
"time" "time"
) )
// Output each metric in the given registry to syslog periodically using // Syslog outputs each metric in the given registry to syslog periodically using
// the given syslogger. // the given syslogger.
func Syslog(r Registry, d time.Duration, w *syslog.Writer) { func Syslog(r Registry, d time.Duration, w *syslog.Writer) {
for range time.Tick(d) { for range time.Tick(d) {

@ -249,20 +249,20 @@ func TestHandshake_BadHandshakeAttack(t *testing.T) {
net.nodeA.expectDecode(t, WhoareyouPacket, whoareyou) net.nodeA.expectDecode(t, WhoareyouPacket, whoareyou)
// A -> B FINDNODE // A -> B FINDNODE
incorrect_challenge := &Whoareyou{ incorrectChallenge := &Whoareyou{
IDNonce: [16]byte{5, 6, 7, 8, 9, 6, 11, 12}, IDNonce: [16]byte{5, 6, 7, 8, 9, 6, 11, 12},
RecordSeq: challenge.RecordSeq, RecordSeq: challenge.RecordSeq,
Node: challenge.Node, Node: challenge.Node,
sent: challenge.sent, sent: challenge.sent,
} }
incorrect_findnode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, incorrect_challenge, &Findnode{}) incorrectFindNode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, incorrectChallenge, &Findnode{})
incorrect_findnode2 := make([]byte, len(incorrect_findnode)) incorrectFindNode2 := make([]byte, len(incorrectFindNode))
copy(incorrect_findnode2, incorrect_findnode) copy(incorrectFindNode2, incorrectFindNode)
net.nodeB.expectDecodeErr(t, errInvalidNonceSig, incorrect_findnode) net.nodeB.expectDecodeErr(t, errInvalidNonceSig, incorrectFindNode)
// Reject new findnode as previous handshake is now deleted. // Reject new findnode as previous handshake is now deleted.
net.nodeB.expectDecodeErr(t, errUnexpectedHandshake, incorrect_findnode2) net.nodeB.expectDecodeErr(t, errUnexpectedHandshake, incorrectFindNode2)
// The findnode packet is again rejected even with a valid challenge this time. // The findnode packet is again rejected even with a valid challenge this time.
findnode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, challenge, &Findnode{}) findnode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, challenge, &Findnode{})

@ -179,7 +179,7 @@ const (
HistoryServeWindow = 8192 // Number of blocks to serve historical block hashes for, EIP-2935. HistoryServeWindow = 8192 // Number of blocks to serve historical block hashes for, EIP-2935.
) )
// Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations // Bls12381MultiExpDiscountTable gas discount table for BLS12-381 G1 and G2 multi exponentiation operations
var Bls12381MultiExpDiscountTable = [128]uint64{1200, 888, 764, 641, 594, 547, 500, 453, 438, 423, 408, 394, 379, 364, 349, 334, 330, 326, 322, 318, 314, 310, 306, 302, 298, 294, 289, 285, 281, 277, 273, 269, 268, 266, 265, 263, 262, 260, 259, 257, 256, 254, 253, 251, 250, 248, 247, 245, 244, 242, 241, 239, 238, 236, 235, 233, 232, 231, 229, 228, 226, 225, 223, 222, 221, 220, 219, 219, 218, 217, 216, 216, 215, 214, 213, 213, 212, 211, 211, 210, 209, 208, 208, 207, 206, 205, 205, 204, 203, 202, 202, 201, 200, 199, 199, 198, 197, 196, 196, 195, 194, 193, 193, 192, 191, 191, 190, 189, 188, 188, 187, 186, 185, 185, 184, 183, 182, 182, 181, 180, 179, 179, 178, 177, 176, 176, 175, 174} var Bls12381MultiExpDiscountTable = [128]uint64{1200, 888, 764, 641, 594, 547, 500, 453, 438, 423, 408, 394, 379, 364, 349, 334, 330, 326, 322, 318, 314, 310, 306, 302, 298, 294, 289, 285, 281, 277, 273, 269, 268, 266, 265, 263, 262, 260, 259, 257, 256, 254, 253, 251, 250, 248, 247, 245, 244, 242, 241, 239, 238, 236, 235, 233, 232, 231, 229, 228, 226, 225, 223, 222, 221, 220, 219, 219, 218, 217, 216, 216, 215, 214, 213, 213, 212, 211, 211, 210, 209, 208, 208, 207, 206, 205, 205, 204, 203, 202, 202, 201, 200, 199, 199, 198, 197, 196, 196, 195, 194, 193, 193, 192, 191, 191, 190, 189, 188, 188, 187, 186, 185, 185, 184, 183, 182, 182, 181, 180, 179, 179, 178, 177, 176, 176, 175, 174}
// Difficulty parameters. // Difficulty parameters.

@ -664,7 +664,7 @@ func (api *SignerAPI) SignGnosisSafeTx(ctx context.Context, signerAddress common
return &gnosisTx, nil return &gnosisTx, nil
} }
// Returns the external api version. This method does not require user acceptance. Available methods are // Version returns the external api version. This method does not require user acceptance. Available methods are
// available via enumeration anyway, and this info does not contain user-specific data // available via enumeration anyway, and this info does not contain user-specific data
func (api *SignerAPI) Version(ctx context.Context) (string, error) { func (api *SignerAPI) Version(ctx context.Context) (string, error) {
return ExternalAPIVersion, nil return ExternalAPIVersion, nil

@ -48,7 +48,7 @@ func NewUIServerAPI(extapi *SignerAPI) *UIServerAPI {
return &UIServerAPI{extapi, extapi.am} return &UIServerAPI{extapi, extapi.am}
} }
// List available accounts. As opposed to the external API definition, this method delivers // ListAccounts lists available accounts. As opposed to the external API definition, this method delivers
// the full Account object and not only Address. // the full Account object and not only Address.
// Example call // Example call
// {"jsonrpc":"2.0","method":"clef_listAccounts","params":[], "id":4} // {"jsonrpc":"2.0","method":"clef_listAccounts","params":[], "id":4}

Loading…
Cancel
Save