66 "fmt"
77 blobutils "github.com/crustio/blob-utils"
88 "github.com/ethereum/go-ethereum/common"
9+ "github.com/ethereum/go-ethereum/crypto"
10+ solsha3 "github.com/miguelmota/go-solidity-sha3"
911 "math/big"
1012)
1113
@@ -55,7 +57,25 @@ func (d *EthdaBackend) PostSequence(ctx context.Context, batchesData [][]byte) (
5557 hashes = append (hashes , hash .Bytes ()... )
5658 }
5759
58- return hashes , nil
60+ currentHash := common.Hash {}.Bytes ()
61+ for _ , batchData := range batchesData {
62+ types := []string {
63+ "bytes32" ,
64+ "bytes32" ,
65+ }
66+ values := []interface {}{
67+ currentHash ,
68+ crypto .Keccak256 (batchData ),
69+ }
70+ currentHash = solsha3 .SoliditySHA3 (types , values )
71+ }
72+
73+ sig , err := d .ethdaClient .SignBatchHash (common .BytesToHash (currentHash ))
74+ if err != nil {
75+ return nil , err
76+ }
77+
78+ return append (sig , hashes ... ), nil
5979}
6080
6181func (d * EthdaBackend ) GetSequence (ctx context.Context , batchHashes []common.Hash , dataAvailabilityMessage []byte ) ([][]byte , error ) {
@@ -64,8 +84,8 @@ func (d *EthdaBackend) GetSequence(ctx context.Context, batchHashes []common.Has
6484 }
6585
6686 var data [][]byte
67- for i := 0 ; i < len (dataAvailabilityMessage )/ common .HashLength ; i ++ {
68- start := common .HashLength * i
87+ for i := 0 ; i < ( len (dataAvailabilityMessage ) - crypto . SignatureLength )/ common .HashLength ; i ++ {
88+ start := common .HashLength * i + crypto . SignatureLength
6989 hash := common .BytesToHash (dataAvailabilityMessage [start : start + common .HashLength ])
7090
7191 r , err := d .ethdaClient .GetBlob (hash )
0 commit comments