Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi committed Dec 9, 2024
1 parent a9b6686 commit 46f9ea2
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 103 deletions.
6 changes: 3 additions & 3 deletions arbitrum/apibackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,10 @@ func (a *APIBackend) Engine() consensus.Engine {
return a.b.Engine()
}

func (b *APIBackend) Pending() (*types.Block, types.Receipts, *state.StateDB) {
func (a *APIBackend) Pending() (*types.Block, types.Receipts, *state.StateDB) {
return nil, nil, nil
}

func (b *APIBackend) FallbackClient() types.FallbackClient {
return b.fallbackClient
func (a *APIBackend) FallbackClient() types.FallbackClient {
return a.fallbackClient
}
8 changes: 4 additions & 4 deletions core/types/arb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (d *ArbitrumDepositTx) setSignatureValues(chainID, v, r, s *big.Int) {

}

func (tx *ArbitrumDepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
func (d *ArbitrumDepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
return dst.Set(bigZero)
}

Expand Down Expand Up @@ -490,15 +490,15 @@ func (t *ArbitrumInternalTx) decode(input []byte) error {
return rlp.DecodeBytes(input, t)
}

func (d *ArbitrumInternalTx) rawSignatureValues() (v, r, s *big.Int) {
func (t *ArbitrumInternalTx) rawSignatureValues() (v, r, s *big.Int) {
return bigZero, bigZero, bigZero
}

func (d *ArbitrumInternalTx) setSignatureValues(chainID, v, r, s *big.Int) {
func (t *ArbitrumInternalTx) setSignatureValues(chainID, v, r, s *big.Int) {

}

func (tx *ArbitrumInternalTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
func (t *ArbitrumInternalTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
return dst.Set(bigZero)
}

Expand Down
144 changes: 72 additions & 72 deletions crypto/bls12381/field_element.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type fe6 [3]fe2
// Representation follows c[0] + c[1] * w encoding order.
type fe12 [2]fe6

func (fe *fe) setBytes(in []byte) *fe {
func (f *fe) setBytes(in []byte) *fe {
size := 48
l := len(in)
if l >= size {
Expand All @@ -50,149 +50,149 @@ func (fe *fe) setBytes(in []byte) *fe {
var a int
for i := 0; i < 6; i++ {
a = size - i*8
fe[i] = uint64(padded[a-1]) | uint64(padded[a-2])<<8 |
f[i] = uint64(padded[a-1]) | uint64(padded[a-2])<<8 |
uint64(padded[a-3])<<16 | uint64(padded[a-4])<<24 |
uint64(padded[a-5])<<32 | uint64(padded[a-6])<<40 |
uint64(padded[a-7])<<48 | uint64(padded[a-8])<<56
}
return fe
return f
}

func (fe *fe) setBig(a *big.Int) *fe {
return fe.setBytes(a.Bytes())
func (f *fe) setBig(a *big.Int) *fe {
return f.setBytes(a.Bytes())
}

func (fe *fe) setString(s string) (*fe, error) {
func (f *fe) setString(s string) (*fe, error) {
if s[:2] == "0x" {
s = s[2:]
}
bytes, err := hex.DecodeString(s)
if err != nil {
return nil, err
}
return fe.setBytes(bytes), nil
return f.setBytes(bytes), nil
}

func (fe *fe) set(fe2 *fe) *fe {
fe[0] = fe2[0]
fe[1] = fe2[1]
fe[2] = fe2[2]
fe[3] = fe2[3]
fe[4] = fe2[4]
fe[5] = fe2[5]
return fe
func (f *fe) set(fe2 *fe) *fe {
f[0] = fe2[0]
f[1] = fe2[1]
f[2] = fe2[2]
f[3] = fe2[3]
f[4] = fe2[4]
f[5] = fe2[5]
return f
}

func (fe *fe) bytes() []byte {
func (f *fe) bytes() []byte {
out := make([]byte, 48)
var a int
for i := 0; i < 6; i++ {
a = 48 - i*8
out[a-1] = byte(fe[i])
out[a-2] = byte(fe[i] >> 8)
out[a-3] = byte(fe[i] >> 16)
out[a-4] = byte(fe[i] >> 24)
out[a-5] = byte(fe[i] >> 32)
out[a-6] = byte(fe[i] >> 40)
out[a-7] = byte(fe[i] >> 48)
out[a-8] = byte(fe[i] >> 56)
out[a-1] = byte(f[i])
out[a-2] = byte(f[i] >> 8)
out[a-3] = byte(f[i] >> 16)
out[a-4] = byte(f[i] >> 24)
out[a-5] = byte(f[i] >> 32)
out[a-6] = byte(f[i] >> 40)
out[a-7] = byte(f[i] >> 48)
out[a-8] = byte(f[i] >> 56)
}
return out
}

func (fe *fe) big() *big.Int {
return new(big.Int).SetBytes(fe.bytes())
func (f *fe) big() *big.Int {
return new(big.Int).SetBytes(f.bytes())
}

func (fe *fe) string() (s string) {
func (f *fe) string() (s string) {
for i := 5; i >= 0; i-- {
s = fmt.Sprintf("%s%16.16x", s, fe[i])
s = fmt.Sprintf("%s%16.16x", s, f[i])
}
return "0x" + s
}

func (fe *fe) zero() *fe {
fe[0] = 0
fe[1] = 0
fe[2] = 0
fe[3] = 0
fe[4] = 0
fe[5] = 0
return fe
func (f *fe) zero() *fe {
f[0] = 0
f[1] = 0
f[2] = 0
f[3] = 0
f[4] = 0
f[5] = 0
return f
}

func (fe *fe) one() *fe {
return fe.set(r1)
func (f *fe) one() *fe {
return f.set(r1)
}

func (fe *fe) rand(r io.Reader) (*fe, error) {
func (f *fe) rand(r io.Reader) (*fe, error) {
bi, err := rand.Int(r, modulus.big())
if err != nil {
return nil, err
}
return fe.setBig(bi), nil
return f.setBig(bi), nil
}

func (fe *fe) isValid() bool {
return fe.cmp(&modulus) < 0
func (f *fe) isValid() bool {
return f.cmp(&modulus) < 0
}

func (fe *fe) isOdd() bool {
func (f *fe) isOdd() bool {
var mask uint64 = 1
return fe[0]&mask != 0
return f[0]&mask != 0
}

func (fe *fe) isEven() bool {
func (f *fe) isEven() bool {
var mask uint64 = 1
return fe[0]&mask == 0
return f[0]&mask == 0
}

func (fe *fe) isZero() bool {
return (fe[5] | fe[4] | fe[3] | fe[2] | fe[1] | fe[0]) == 0
func (f *fe) isZero() bool {
return (f[5] | f[4] | f[3] | f[2] | f[1] | f[0]) == 0
}

func (fe *fe) isOne() bool {
return fe.equal(r1)
func (f *fe) isOne() bool {
return f.equal(r1)
}

func (fe *fe) cmp(fe2 *fe) int {
func (f *fe) cmp(fe2 *fe) int {
for i := 5; i >= 0; i-- {
if fe[i] > fe2[i] {
if f[i] > fe2[i] {
return 1
} else if fe[i] < fe2[i] {
} else if f[i] < fe2[i] {
return -1
}
}
return 0
}

func (fe *fe) equal(fe2 *fe) bool {
return fe2[0] == fe[0] && fe2[1] == fe[1] && fe2[2] == fe[2] && fe2[3] == fe[3] && fe2[4] == fe[4] && fe2[5] == fe[5]
func (f *fe) equal(fe2 *fe) bool {
return fe2[0] == f[0] && fe2[1] == f[1] && fe2[2] == f[2] && fe2[3] == f[3] && fe2[4] == f[4] && fe2[5] == f[5]
}

func (e *fe) sign() bool {
func (f *fe) sign() bool {
r := new(fe)
fromMont(r, e)
fromMont(r, f)
return r[0]&1 == 0
}

func (fe *fe) div2(e uint64) {
fe[0] = fe[0]>>1 | fe[1]<<63
fe[1] = fe[1]>>1 | fe[2]<<63
fe[2] = fe[2]>>1 | fe[3]<<63
fe[3] = fe[3]>>1 | fe[4]<<63
fe[4] = fe[4]>>1 | fe[5]<<63
fe[5] = fe[5]>>1 | e<<63
func (f *fe) div2(e uint64) {
f[0] = f[0]>>1 | f[1]<<63
f[1] = f[1]>>1 | f[2]<<63
f[2] = f[2]>>1 | f[3]<<63
f[3] = f[3]>>1 | f[4]<<63
f[4] = f[4]>>1 | f[5]<<63
f[5] = f[5]>>1 | e<<63
}

func (fe *fe) mul2() uint64 {
e := fe[5] >> 63
fe[5] = fe[5]<<1 | fe[4]>>63
fe[4] = fe[4]<<1 | fe[3]>>63
fe[3] = fe[3]<<1 | fe[2]>>63
fe[2] = fe[2]<<1 | fe[1]>>63
fe[1] = fe[1]<<1 | fe[0]>>63
fe[0] = fe[0] << 1
func (f *fe) mul2() uint64 {
e := f[5] >> 63
f[5] = f[5]<<1 | f[4]>>63
f[4] = f[4]<<1 | f[3]>>63
f[3] = f[3]<<1 | f[2]>>63
f[2] = f[2]<<1 | f[1]>>63
f[1] = f[1]<<1 | f[0]>>63
f[0] = f[0] << 1
return e
}

Expand Down
4 changes: 2 additions & 2 deletions crypto/bls12381/gt.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func (e *E) IsOne() bool {
}

// Equal returns true if given two element is equal, otherwise returns false
func (g *E) Equal(g2 *E) bool {
return g.equal(g2)
func (e *E) Equal(g2 *E) bool {
return e.equal(g2)
}

// NewGT constructs new target group instance.
Expand Down
6 changes: 3 additions & 3 deletions ethdb/remotedb/remotedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func (db *Database) Has(key []byte) (bool, error) {
return true, nil
}

func (t *Database) WasmDataBase() (ethdb.KeyValueStore, uint32) {
return t, 0
func (db *Database) WasmDataBase() (ethdb.KeyValueStore, uint32) {
return db, 0
}

func (t *Database) WasmTargets() []ethdb.WasmTarget {
func (db *Database) WasmTargets() []ethdb.WasmTarget {
return nil
}

Expand Down
34 changes: 17 additions & 17 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,27 @@ func (prog SyncProgress) Done() bool {
return prog.TxIndexRemainingBlocks == 0
}

func (progress SyncProgress) ToMap() map[string]interface{} {
if progress.CurrentBlock >= progress.HighestBlock {
func (prog SyncProgress) ToMap() map[string]interface{} {
if prog.CurrentBlock >= prog.HighestBlock {
return nil
}
// Otherwise gather the block sync stats
return map[string]interface{}{
"startingBlock": hexutil.Uint64(progress.StartingBlock),
"currentBlock": hexutil.Uint64(progress.CurrentBlock),
"highestBlock": hexutil.Uint64(progress.HighestBlock),
"syncedAccounts": hexutil.Uint64(progress.SyncedAccounts),
"syncedAccountBytes": hexutil.Uint64(progress.SyncedAccountBytes),
"syncedBytecodes": hexutil.Uint64(progress.SyncedBytecodes),
"syncedBytecodeBytes": hexutil.Uint64(progress.SyncedBytecodeBytes),
"syncedStorage": hexutil.Uint64(progress.SyncedStorage),
"syncedStorageBytes": hexutil.Uint64(progress.SyncedStorageBytes),
"healedTrienodes": hexutil.Uint64(progress.HealedTrienodes),
"healedTrienodeBytes": hexutil.Uint64(progress.HealedTrienodeBytes),
"healedBytecodes": hexutil.Uint64(progress.HealedBytecodes),
"healedBytecodeBytes": hexutil.Uint64(progress.HealedBytecodeBytes),
"healingTrienodes": hexutil.Uint64(progress.HealingTrienodes),
"healingBytecode": hexutil.Uint64(progress.HealingBytecode),
"startingBlock": hexutil.Uint64(prog.StartingBlock),
"currentBlock": hexutil.Uint64(prog.CurrentBlock),
"highestBlock": hexutil.Uint64(prog.HighestBlock),
"syncedAccounts": hexutil.Uint64(prog.SyncedAccounts),
"syncedAccountBytes": hexutil.Uint64(prog.SyncedAccountBytes),
"syncedBytecodes": hexutil.Uint64(prog.SyncedBytecodes),
"syncedBytecodeBytes": hexutil.Uint64(prog.SyncedBytecodeBytes),
"syncedStorage": hexutil.Uint64(prog.SyncedStorage),
"syncedStorageBytes": hexutil.Uint64(prog.SyncedStorageBytes),
"healedTrienodes": hexutil.Uint64(prog.HealedTrienodes),
"healedTrienodeBytes": hexutil.Uint64(prog.HealedTrienodeBytes),
"healedBytecodes": hexutil.Uint64(prog.HealedBytecodes),
"healedBytecodeBytes": hexutil.Uint64(prog.HealedBytecodeBytes),
"healingTrienodes": hexutil.Uint64(prog.HealingTrienodes),
"healingBytecode": hexutil.Uint64(prog.HealingBytecode),
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ func (api *BlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.He
return fields
}

func (s *BlockChainAPI) arbClassicL1BlockNumber(ctx context.Context, block *types.Block) (hexutil.Uint64, error) {
func (api *BlockChainAPI) arbClassicL1BlockNumber(ctx context.Context, block *types.Block) (hexutil.Uint64, error) {
startBlockNum := block.Number().Int64()
blockNum := startBlockNum
i := int64(0)
Expand All @@ -1467,7 +1467,7 @@ func (s *BlockChainAPI) arbClassicL1BlockNumber(ctx context.Context, block *type
return 0, fmt.Errorf("couldn't find block with transactions. Reached %d", blockNum)
}
var err error
block, err = s.b.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
block, err = api.b.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
if err != nil {
return 0, err
}
Expand Down

0 comments on commit 46f9ea2

Please sign in to comment.