-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from 0xPolygon/backfill-updates
Backfill fixes
- Loading branch information
Showing
13 changed files
with
329 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package sequencer | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/0xPolygon/cdk-data-availability/rpc" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// GetData returns batch data from the trusted sequencer | ||
func GetData(url string, batchNum uint64) (*SeqBatch, error) { | ||
response, err := rpc.JSONRPCCall(url, "zkevm_getBatchByNumber", batchNum, true) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if response.Error != nil { | ||
return nil, fmt.Errorf("%d - %s", response.Error.Code, response.Error.Message) | ||
} | ||
var result SeqBatch | ||
err = json.Unmarshal(response.Result, &result) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &result, nil | ||
} | ||
|
||
// SeqBatch structure | ||
type SeqBatch struct { | ||
Number rpc.ArgUint64 `json:"number"` | ||
AccInputHash common.Hash `json:"accInputHash"` | ||
BatchL2Data rpc.ArgBytes `json:"batchL2Data"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package sequencer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.