Skip to content

Commit

Permalink
Lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Mar 20, 2024
1 parent d4a643a commit 8f97085
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions e2e-polybft/e2e/jsonrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,13 @@ func TestE2E_JsonRPC_NewEthClient(t *testing.T) {
require.NoError(t, err)

t.Run("eth_blockNumber", func(t *testing.T) {
cluster.WaitForBlock(epochSize, 15*time.Second)
require.NoError(t, cluster.WaitForBlock(epochSize, 15*time.Second))

blockNumber, err := newEthClient.BlockNumber()
require.NoError(t, err)
require.GreaterOrEqual(t, blockNumber, epochSize)

cluster.WaitForBlock(blockNumber+1, 5*time.Second)
require.NoError(t, cluster.WaitForBlock(blockNumber+1, 5*time.Second))

blockNumber, err = newEthClient.BlockNumber()
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions jsonrpc/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ type BlockNumberOrHash struct {
}

// String returns the string representation of the block number or hash
func (b BlockNumberOrHash) String() string {
if b.BlockNumber != nil {
return b.BlockNumber.String()
func (bnh BlockNumberOrHash) String() string {
if bnh.BlockNumber != nil {
return bnh.BlockNumber.String()
}

return b.BlockHash.String()
return bnh.BlockHash.String()
}

// UnmarshalJSON will try to extract the filter's data.
Expand Down
3 changes: 3 additions & 0 deletions jsonrpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ func (s StateOverride) MarshalJSON() ([]byte, error) {
defer a.Reset()

o := a.NewObject()

for addr, obj := range s {
oo := a.NewObject()
if obj.Nonce != nil {
Expand Down Expand Up @@ -512,6 +513,7 @@ func (s StateOverride) MarshalJSON() ([]byte, error) {
}

res := o.MarshalTo(nil)

defaultArena.Put(a)

return res, nil
Expand Down Expand Up @@ -569,6 +571,7 @@ func (c *CallMsg) MarshalJSON() ([]byte, error) {
}

res := o.MarshalTo(nil)

defaultArena.Put(a)

return res, nil
Expand Down
2 changes: 2 additions & 0 deletions types/access_list_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (t *TxAccessList) unmarshalJSON(v *fastjson.Value) error {

for _, elem := range elems {
accessTuple := AccessTuple{}

addr, err := unmarshalJSONAddr(elem, "address")
if err != nil {
return err
Expand All @@ -146,6 +147,7 @@ func (t *TxAccessList) unmarshalJSON(v *fastjson.Value) error {
}

accessTuple.StorageKeys = make([]Hash, len(storage))

for indx, stg := range storage {
b, err := stg.StringBytes()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions types/base_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (tx *BaseTx) unmarshalJSON(v *fastjson.Value) error {
if hasKey(v, "to") {
if v.Get("to").String() != "null" {
var to Address

if to, err = unmarshalJSONAddr(v, "to"); err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions types/json_unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ func (r *Receipt) UnmarshalJSON(buf []byte) error {

// logs
r.Logs = r.Logs[:0]

for _, elem := range v.GetArray("logs") {
log := new(Log)
if err := log.unmarshalJSON(elem); err != nil {
Expand Down Expand Up @@ -269,6 +270,7 @@ func (r *Log) unmarshalJSON(v *fastjson.Value) error {
}

r.Topics = r.Topics[:0]

for _, topic := range v.GetArray("topics") {
b, err := topic.StringBytes()
if err != nil {
Expand Down

0 comments on commit 8f97085

Please sign in to comment.