Skip to content

Commit

Permalink
Merge pull request #10825 from filecoin-project/10682-read-perm-for-s…
Browse files Browse the repository at this point in the history
…ubscribe-and-filter-methods

Make (un)subscribe and filter RPC methods require only read perm
  • Loading branch information
magik6k authored May 9, 2023
2 parents ea7bbbc + 6574213 commit 07e5abb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,23 +829,23 @@ type FullNode interface {

// Polling method for a filter, returns event logs which occurred since last poll.
// (requires write perm since timestamp of last filter execution will be written)
EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:write
EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:read

// Returns event logs matching filter with given id.
// (requires write perm since timestamp of last filter execution will be written)
EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:write
EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:read

// Installs a persistent filter based on given filter spec.
EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) //perm:write
EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) //perm:read

// Installs a persistent filter to notify when a new block arrives.
EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:write
EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:read

// Installs a persistent filter to notify when new messages arrive in the message pool.
EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:write
EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:read

// Uninstalls a filter with given id.
EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) //perm:write
EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) //perm:read

// Subscribe to different event types using websockets
// eventTypes is one or more of:
Expand All @@ -854,10 +854,10 @@ type FullNode interface {
// - logs: notify new event logs that match a criteria
// params contains additional parameters used with the log event type
// The client will receive a stream of EthSubscriptionResponse values until EthUnsubscribe is called.
EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error) //perm:write
EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error) //perm:read

// Unsubscribe from a websocket subscription
EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) //perm:write
EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) //perm:read

// Returns the client version
Web3ClientVersion(ctx context.Context) (string, error) //perm:read
Expand Down
16 changes: 8 additions & 8 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions documentation/en/api-v1-unstable-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,7 @@ Polling method for a filter, returns event logs which occurred since last poll.
(requires write perm since timestamp of last filter execution will be written)


Perms: write
Perms: read

Inputs:
```json
Expand All @@ -2619,7 +2619,7 @@ Returns event logs matching filter with given id.
(requires write perm since timestamp of last filter execution will be written)


Perms: write
Perms: read

Inputs:
```json
Expand Down Expand Up @@ -2990,7 +2990,7 @@ Response: `"0x0"`
Installs a persistent filter to notify when a new block arrives.


Perms: write
Perms: read

Inputs: `null`

Expand All @@ -3000,7 +3000,7 @@ Response: `"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"`
Installs a persistent filter based on given filter spec.


Perms: write
Perms: read

Inputs:
```json
Expand All @@ -3021,7 +3021,7 @@ Response: `"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"`
Installs a persistent filter to notify when new messages arrive in the message pool.


Perms: write
Perms: read

Inputs: `null`

Expand Down Expand Up @@ -3060,7 +3060,7 @@ params contains additional parameters used with the log event type
The client will receive a stream of EthSubscriptionResponse values until EthUnsubscribe is called.


Perms: write
Perms: read

Inputs:
```json
Expand All @@ -3075,7 +3075,7 @@ Response: `"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"`
Uninstalls a filter with given id.


Perms: write
Perms: read

Inputs:
```json
Expand All @@ -3090,7 +3090,7 @@ Response: `true`
Unsubscribe from a websocket subscription


Perms: write
Perms: read

Inputs:
```json
Expand Down

0 comments on commit 07e5abb

Please sign in to comment.