Skip to content

Commit

Permalink
Merge branch 'main' into ci/ramin/integration-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin authored Jan 22, 2024
2 parents 7a6f797 + 2294805 commit ef672e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions api/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,15 @@ func TestAuthedRPC(t *testing.T) {
// 2. Test method with write-level permissions
expectedResp := &state.TxResponse{}
if tt.perm > 2 {
server.State.EXPECT().SubmitTx(gomock.Any(), gomock.Any()).Return(expectedResp, nil)
txResp, err := rpcClient.State.SubmitTx(ctx, []byte{})
server.State.EXPECT().Delegate(gomock.Any(), gomock.Any(),
gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedResp, nil)
txResp, err := rpcClient.State.Delegate(ctx,
state.ValAddress{}, state.Int{}, state.Int{}, 0)
require.NoError(t, err)
require.Equal(t, expectedResp, txResp)
} else {
_, err := rpcClient.State.SubmitTx(ctx, []byte{})
_, err := rpcClient.State.Delegate(ctx,
state.ValAddress{}, state.Int{}, state.Int{}, 0)
require.Error(t, err)
require.ErrorContains(t, err, "missing permission")
}
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type API struct {
fee state.Int,
gasLimit uint64,
) (*state.TxResponse, error) `perm:"write"`
SubmitTx func(ctx context.Context, tx state.Tx) (*state.TxResponse, error) `perm:"write"`
SubmitTx func(ctx context.Context, tx state.Tx) (*state.TxResponse, error) `perm:"read"`
SubmitPayForBlob func(
ctx context.Context,
fee state.Int,
Expand Down

0 comments on commit ef672e2

Please sign in to comment.