generated from rollkit/template-da-repo
-
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.
Merge pull request #5 from rollkit/tux/init
mock: init
- Loading branch information
Showing
8 changed files
with
390 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mock-da |
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,81 @@ | ||
# Mock DA | ||
|
||
Mock DA implements the [go-da][go-da] interface over a mock Data Availability service. | ||
|
||
It is intended to be used for testing DA layers without having to set up the actual services. | ||
|
||
## Usage | ||
|
||
```sh | ||
make build | ||
./mock-da | ||
``` | ||
|
||
should output | ||
|
||
```sh | ||
2024/04/11 12:23:34 Listening on: localhost:7980 | ||
``` | ||
|
||
Which exposes the [go-da] interface over JSONRPC and can be accessed with an HTTP client like [xh][xh]: | ||
|
||
### MaxBlobSize | ||
|
||
```sh | ||
xh http://127.0.0.1:7980 id=1 method=da.MaxBlobSize | jq | ||
``` | ||
|
||
output: | ||
|
||
```sh | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": 1974272, | ||
"id": "1" | ||
} | ||
``` | ||
|
||
#### Submit | ||
|
||
```sh | ||
xh http://127.0.0.1:7980 id=1 method=da.Submit 'params[][]=SGVsbG8gd28ybGQh' 'params[]:=-2' 'params[]=AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=' | jq | ||
``` | ||
|
||
output: | ||
|
||
```sh | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
"AQAAAAAAAADfgz5/IP20UeF81iRRzDBu/qC8eXr9DUyplrfXod3VOA==" | ||
], | ||
"id": "1" | ||
} | ||
``` | ||
|
||
#### Get | ||
|
||
```sh | ||
xh http://127.0.0.1:7980 id=1 method=da.Get 'params[][]=AQAAAAAAAADfgz5/IP20UeF81iRRzDBu/qC8eXr9DUyplrfXod3VOA==' 'params[]=AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=' | ||
``` | ||
|
||
output: | ||
|
||
```sh | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
"SGVsbG8gd28ybGQh" | ||
], | ||
"id": "1" | ||
} | ||
``` | ||
|
||
## References | ||
|
||
[1] [go-da][go-da] | ||
|
||
[2] [xh][xh] | ||
|
||
[go-da]: https://github.com/rollkit/go-da | ||
[xh]: https://github.com/ducaale/xh |
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,43 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"net/url" | ||
"os" | ||
"os/signal" | ||
"syscall" | ||
|
||
proxy "github.com/rollkit/go-da/proxy/jsonrpc" | ||
goDATest "github.com/rollkit/go-da/test" | ||
) | ||
|
||
const ( | ||
// MockDAAddress is the mock address for the gRPC server | ||
MockDAAddress = "grpc://localhost:7980" | ||
) | ||
|
||
func main() { | ||
var ( | ||
host string | ||
port string | ||
) | ||
addr, _ := url.Parse(MockDAAddress) | ||
flag.StringVar(&port, "port", addr.Port(), "listening port") | ||
flag.StringVar(&host, "host", addr.Hostname(), "listening address") | ||
flag.Parse() | ||
|
||
srv := proxy.NewServer(host, port, goDATest.NewDummyDA()) | ||
log.Printf("Listening on: %s:%s", host, port) | ||
if err := srv.Start(context.Background()); err != nil { | ||
log.Fatal("error while serving:", err) | ||
} | ||
|
||
interrupt := make(chan os.Signal, 1) | ||
signal.Notify(interrupt, os.Interrupt, syscall.SIGINT) | ||
<-interrupt | ||
fmt.Println("\nCtrl+C pressed. Exiting...") | ||
os.Exit(0) | ||
} |
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,112 @@ | ||
# Celestia Node/Core/App Errors | ||
|
||
Exhaustive list of errors returned by celestia node/core/app when trying to submit a PFB transaction. There might be a few duplicates because some errors like `sdkerrors` are wrapped in celestia-app. | ||
|
||
## celestia-node | ||
|
||
- `SubmitPayForBlob` - `state: no blobs provided` | ||
- `SubmitPayForBlob` - `parsing insufficient min gas price error` | ||
- `SubmitPayForBlob` - `sdkErrors.ABCIError` | ||
- `SubmitPayForBlob` - `failed to submit blobs after %d attempts: %w` | ||
|
||
## celestia-app | ||
|
||
- `ErrReservedNamespace` - `cannot use reserved namespace IDs` | ||
- `ErrInvalidNamespaceLen` - `invalid namespace length` | ||
- `ErrInvalidDataSize` - `data must be multiple of shareSize` | ||
- `ErrBlobSizeMismatch` - `actual blob size differs from that specified in the MsgPayForBlob` | ||
- `ErrCommittedSquareSizeNotPowOf2` - `committed to invalid square size: must be power of two` | ||
- `ErrCalculateCommitment` - `unexpected error calculating commitment for share` | ||
- `ErrInvalidShareCommitment` - `invalid commitment for share` | ||
- `ErrParitySharesNamespace` - `cannot use parity shares namespace ID` | ||
- `ErrTailPaddingNamespace` - `cannot use tail padding namespace ID` | ||
- `ErrTxNamespace` - `cannot use transaction namespace ID` | ||
- `ErrInvalidShareCommitments` - `invalid share commitments: all relevant square sizes must be committed to` | ||
- `ErrUnsupportedShareVersion` - `unsupported share version` | ||
- `ErrZeroBlobSize` - `cannot use zero blob size` | ||
- `ErrMismatchedNumberOfPFBorBlob` - `mismatched number of blobs per MsgPayForBlob` | ||
- `ErrNoPFB` - `no MsgPayForBlobs found in blob transaction` | ||
- `ErrNamespaceMismatch` - `namespace of blob and its respective MsgPayForBlobs differ` | ||
- `ErrProtoParsing` - `failure to parse a transaction from its protobuf representation` | ||
- `ErrMultipleMsgsInBlobTx` - `not yet supported: multiple sdk.Msgs found in BlobTx` | ||
- `ErrMismatchedNumberOfPFBComponent` - `number of each component in a MsgPayForBlobs must be identical` | ||
- `ErrNoBlobs` - `no blobs provided` | ||
- `ErrNoNamespaces` - `no namespaces provided` | ||
- `ErrNoShareVersions` - `no share versions provided` | ||
- `ErrNoBlobSizes` - `no blob sizes provided` | ||
- `ErrNoShareCommitments` - `no share commitments provided` | ||
- `ErrInvalidNamespace` - `invalid namespace` | ||
- `ErrInvalidNamespaceVersion` - `invalid namespace version` | ||
- `ErrTotalBlobSizeTooLarge` - `total blob size too large` | ||
- `AnteHandle` - `errors.Wrap(sdkerrors.ErrInsufficientFee, "not enough gas to pay for blobs")` | ||
- `checkTxFeeWithValidatorMinGasPrices` - `errors.Wrap(sdkerror.ErrTxDecode, "Tx must be a FeeTx")` | ||
- `ValidateBlobs` - `namespace version %d is too large` | ||
- `ParseInsufficientMinGasPrice` - `parsing insufficient min gas price error` | ||
- `ParseInsufficientMinGasPrice` - `unexpected case: required gas price is zero` | ||
|
||
## celestia-core | ||
|
||
- `BroadcastTxCommit` - `ErrTimedOutWaitingForTx` - `timed out waiting for tx to be included in a block` | ||
- `BroadcastTxCommit` - `max_subscription_clients %d reached` | ||
- `BroadcastTxCommit` - `max_subscriptions_per_client %d reached` | ||
- `BroadcastTxCommit` - `failed to subscribe to tx: %w` | ||
- `BroadcastTxCommit` - `error on broadcastTxCommit: %v` | ||
- `BroadcastTxCommit` - `deliverTxSub was cancelled (reason: %s)` | ||
- `PreCheck` - `tx size is too big` | ||
- `CheckTx` - `ErrTxTooLarge` - `Tx too large. Max size is %d, but got %d` | ||
- `CheckTx` - `ErrPreCheck` - cosmos-sdk errors, see below | ||
- `CheckTx` - `ErrTxInCache` - `tx already exists in cache` | ||
- `CheckTx` - `ErrMempoolIsFull` - `mempool is full: number of txs %d (max: %d), total txs bytes %d (max: %d)` | ||
- `CheckTx` - `mem.proxyAppConn.Error()` - `proxyAppConn may error if tx buffer is full` | ||
- `PostCheck` - `gas wanted %d is negative` | ||
- `PostCheck` - `gas wanted %d is greater than max gas` | ||
- `TryAddNewTx` - `ErrTxInMempool` - `tx already exists in mempool` | ||
- `TryAddNewTx` - `ErrTxAlreadyRejected` - `tx was previously rejected` | ||
- `TryAddNewTx` - `ErrPreCheck` | ||
- `TryAddNewTx` - `mem.proxyAppConn.Error()` | ||
- `TryAddNewTx` - `application rejected transaction with code %d (Log: %s)` | ||
- `TryAddNewTx` - `rejected bad transaction after post check: %w` | ||
|
||
## cosmos-sdk | ||
|
||
- `ErrTxDecode` - `tx parse error` | ||
- `ErrInvalidSequence` - `invalid sequence` | ||
- `ErrUnauthorized` - `unauthorized` | ||
- `ErrInsufficientFunds` - `insufficient funds` | ||
- `ErrUnknownRequest` - `unknown request` | ||
- `ErrInvalidAddress` - `invalid address` | ||
- `ErrInvalidPubKey` - `invalid pubkey` | ||
- `ErrUnknownAddress` - `unknown address` | ||
- `ErrInvalidCoins` - `invalid coins` | ||
- `ErrOutOfGas` - `out of gas` | ||
- `ErrMemoTooLarge` - `memo too large` | ||
- `ErrInsufficientFee` - `insufficient fee` | ||
- `ErrTooManySignatures` - `maximum number of signatures exceeded` | ||
- `ErrNoSignatures` - `no signatures supplied` | ||
- `ErrJSONMarshal` - `failed to marshal JSON bytes` | ||
- `ErrJSONUnmarshal` - `failed to unmarshal JSON bytes` | ||
- `ErrInvalidRequest` - `invalid request` | ||
- `ErrTxInMempoolCache` - `tx already in mempool` | ||
- `ErrMempoolIsFull` - `mempool is full` | ||
- `ErrTxTooLarge` - `tx too large` | ||
- `ErrKeyNotFound` - `key not found` | ||
- `ErrWrongPassword` - `invalid account password` | ||
- `ErrorInvalidSigner` - `tx intended signer does not match the given signer` | ||
- `ErrorInvalidGasAdjustment` - `invalid gas adjustment` | ||
- `ErrInvalidHeight` - `invalid height` | ||
- `ErrInvalidVersion` - `invalid version` | ||
- `ErrInvalidChainID` - `invalid chain-id` | ||
- `ErrInvalidType` - `invalid type` | ||
- `ErrTxTimeoutHeight` - `tx timeout height` | ||
- `ErrUnknownExtensionOptions` - `unknown extension options` | ||
- `ErrWrongSequence` - `incorrect account sequence` | ||
- `ErrPackAny` - `failed packing protobuf message to Any` | ||
- `ErrUnpackAny` - `failed unpacking protobuf message from Any` | ||
- `ErrLogic` - `internal logic error` | ||
- `ErrConflict` - `conflict` | ||
- `ErrNotSupported` - `feature not supported` | ||
- `ErrNotFound` - `not found` | ||
- `ErrIO` - `Internal IO error` | ||
- `ErrAppConfig` - `error in app.toml` | ||
- `ErrInvalidGasLimit` - `invalid gas limit` | ||
- `ErrPanic` - errorsmod.ErrPanic |
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 |
---|---|---|
@@ -1,3 +1,22 @@ | ||
module github.com/rollkit/template-da-repo | ||
|
||
go 1.21.0 | ||
go 1.21.1 | ||
|
||
require github.com/rollkit/go-da v0.5.0 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/filecoin-project/go-jsonrpc v0.3.1 // indirect | ||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect | ||
github.com/google/uuid v1.3.1 // indirect | ||
github.com/gorilla/websocket v1.4.2 // indirect | ||
github.com/ipfs/go-log/v2 v2.0.8 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/stretchr/testify v1.9.0 // indirect | ||
go.opencensus.io v0.22.3 // indirect | ||
go.uber.org/atomic v1.7.0 // indirect | ||
go.uber.org/multierr v1.6.0 // indirect | ||
go.uber.org/zap v1.19.1 // indirect | ||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.