Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Apr 29, 2024
1 parent 0411208 commit d4fc6b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/handler/op_committer_stateroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func GetStateRootAndCommitStateRootProposal(ctx *svc.ServiceContext) {
if err != nil {
log.Errorf("[Handler.GetStateRootAndCommitStateRootProposal] constructing state root for ds is failed. err : %s", errors.WithStack(err))
}
dsJSON, err := stateRoots.MarshalJson()
dsJSON, err := stateRoots.ToJSONBytes()
if err != nil {
log.Errorf("[Handler.GetStateRootAndCommitStateRootProposal] Try to marshal ds proposal: %s", err.Error())
time.Sleep(3 * time.Second)
Expand Down
2 changes: 1 addition & 1 deletion internal/handler/op_committer_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func GetBlobsAndCommitTxsProposal(ctx *svc.ServiceContext) {
continue
}
dsProposal := types.NewDsTxsProposal(ctx.B2NodeConfig.ChainID, lastProposal.ProposalID, blobMerkleRoot, blobs)
dsJSON, err := dsProposal.MarshalJson()
dsJSON, err := dsProposal.ToJSONBytes()
if err != nil {
log.Errorf("[Handler.GetBlobsAndCommitProposal] Try to marshal ds proposal: %s", err.Error())
time.Sleep(3 * time.Second)
Expand Down
9 changes: 3 additions & 6 deletions internal/types/ds.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ func NewDsStateRootProposal(chainID int64, proposalID uint64, outputRoot string,
}, nil
}

// nolint: unparam
func convertBlobToDsBlob(blobs []schema.BlobInfo) []DsBlob {
var dsBlobs []DsBlob
dsBlobs := make([]DsBlob, len(blobs))
for i, blob := range blobs {
dsBlobs[i] = DsBlob{
BlockID: blob.BlockNumber,
Expand All @@ -70,17 +69,15 @@ func (b *DsTxsProposal) GetDBBlobInfos() ([]schema.BlobInfo, error) {
return dbBlobs, nil
}

// nolint: revive,stylecheck
func (b *DsTxsProposal) MarshalJson() ([]byte, error) {
func (b *DsTxsProposal) ToJSONBytes() ([]byte, error) {
marshal, err := json.Marshal(b)
if err != nil {
return nil, err
}
return marshal, nil
}

// nolint: revive,stylecheck
func (s *DsStateRootProposal) MarshalJson() ([]byte, error) {
func (s *DsStateRootProposal) ToJSONBytes() ([]byte, error) {
marshal, err := json.Marshal(s)
if err != nil {
return nil, err
Expand Down

0 comments on commit d4fc6b5

Please sign in to comment.