-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scaffolding to support Arbitrum Nitro EVM stacks.
preparatory work to support Arbitrum Nitro RPC nodes
- Loading branch information
Showing
6 changed files
with
67 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package jsonrpc | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"log/slog" | ||
"time" | ||
|
||
"github.com/duneanalytics/blockchain-ingester/models" | ||
) | ||
|
||
type ArbitrumNitroClient struct { | ||
rpcClient | ||
} | ||
|
||
var _ BlockchainClient = &ArbitrumNitroClient{} | ||
|
||
func NewArbitrumNitroClient(log *slog.Logger, cfg Config) (*ArbitrumNitroClient, error) { | ||
rpcClient, err := newClient(log.With("module", "jsonrpc"), cfg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &ArbitrumNitroClient{*rpcClient}, nil | ||
} | ||
|
||
// BlockByNumber returns the block with the given blockNumber. | ||
// it uses 3 different methods to get the block: | ||
// 1. eth_getBlockByNumber | ||
// 2. debug_traceBlockByNumber with tracer "callTracer" | ||
// TODO: this method should be optional | ||
// 2. call to eth_getTransactionReceipt for each Tx present in the Block | ||
// | ||
// We encode the payload in NDJSON, and use a header line to indicate how many Tx are present in the block | ||
func (c *ArbitrumNitroClient) BlockByNumber(_ context.Context, blockNumber int64) (models.RPCBlock, error) { | ||
tStart := time.Now() | ||
defer func() { | ||
c.log.Debug("BlockByNumber", "blockNumber", blockNumber, "duration", time.Since(tStart)) | ||
}() | ||
// TODO: lets not implement this yet | ||
return models.RPCBlock{ | ||
BlockNumber: blockNumber, | ||
Error: errors.New("not implemented"), | ||
}, errors.New("not implemented") | ||
} |
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
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