Skip to content

Commit

Permalink
removed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Jul 17, 2024
1 parent f5001d9 commit 5937df6
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 12,813 deletions.
272 changes: 0 additions & 272 deletions core/block_validator_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion core/blockarchiver/block_archiver_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *BlockArchiverService) getBlockByNumber(number uint64) (*types.Body, *ty
c.requestLock.AddRange(start, end)
defer c.requestLock.RemoveRange(start, end)

blocks, err := c.client.GetBlocksByRange(number)
blocks, err := c.client.GetBundleBlocksByBlockNum(number)
if err != nil {
return nil, nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion core/blockarchiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func (c *Client) GetBundleBlocksRange(blockNum uint64) (uint64, uint64, error) {
return startSlot, endSlot, nil
}

func (c *Client) GetBlocksByRange(blockNum uint64) ([]*Block, error) {
// GetBundleBlocksByBlockNum returns the bundle blocks by block number that within the range
func (c *Client) GetBundleBlocksByBlockNum(blockNum uint64) ([]*Block, error) {
payload := preparePayload("eth_getBundledBlockByNumber", []interface{}{Int64ToHex(int64(blockNum))})
body, err := c.postRequest(payload)
if err != nil {
Expand All @@ -133,6 +134,7 @@ func (c *Client) GetBlocksByRange(blockNum uint64) ([]*Block, error) {
return getBlocksResp.Result, nil
}

// postRequest sends a POST request to the block archiver service
func (c *Client) postRequest(payload map[string]interface{}) ([]byte, error) {
// Encode payload to JSON
payloadBytes, err := json.Marshal(payload)
Expand Down Expand Up @@ -162,6 +164,7 @@ func (c *Client) postRequest(payload map[string]interface{}) ([]byte, error) {
return body, nil
}

// preparePayload prepares the payload for the request
func preparePayload(method string, params []interface{}) map[string]interface{} {
return map[string]interface{}{
"jsonrpc": "2.0",
Expand Down
1 change: 0 additions & 1 deletion core/blockarchiver/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func convertBlock(block *Block) (*GeneralBlock, error) {
ts, err := HexToUint64(block.Timestamp)
if err != nil {
return nil, err

}
nonce, err := HexToUint64(block.Nonce)
if err != nil {
Expand Down
Loading

0 comments on commit 5937df6

Please sign in to comment.