Skip to content

Commit

Permalink
👌 Applied suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nagdahimanshu committed Jan 25, 2024
1 parent 9b0a0bf commit 81a3006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/chain/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/LiskHQ/op-fault-detector/pkg/encoding"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethclient"

"github.com/ethereum-optimism/optimism/op-bindings/bindings"
Expand Down Expand Up @@ -84,7 +85,7 @@ func (oc *OracleAccessor) GetL2Output(index *big.Int) (L2Output, error) {
}

return L2Output{
OutputRoot: "0x" + common.Bytes2Hex(l2Output.OutputRoot[:]),
OutputRoot: hexutil.Encode(l2Output.OutputRoot[:]),
L1Timestamp: encoding.ConvertBigIntToUint64(l2Output.Timestamp),
L2BlockNumber: encoding.ConvertBigIntToUint64(l2Output.L2BlockNumber),
L2OutputIndex: encoding.ConvertBigIntToUint64(index),
Expand Down
5 changes: 4 additions & 1 deletion pkg/encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import "math/big"

// ConvertBigIntToUint64 converts big integer to integer.
func ConvertBigIntToUint64(value *big.Int) uint64 {
valueToString, _ := new(big.Int).SetString(value.String(), 10)
valueToString, ok := new(big.Int).SetString(value.String(), 10)
if !ok {
panic("error while converting big integer to integer")
}
return valueToString.Uint64()
}

Expand Down

0 comments on commit 81a3006

Please sign in to comment.