feat: allow zero to be recorded in configured stream#157
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds an owner-gated per-stream Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client SDK
participant Gateway as Gateway / Node
participant Contract as Contract Actions
participant Postgres as Postgres
Client->>Gateway: deployStream(streamId, type, allowZeros=true, synchronous?)
Gateway->>Contract: execute deploy_stream({ $stream_id, $stream_type, $allow_zeros: true })
Contract->>Postgres: insert stream + metadata (allow_zeros = true)
Contract-->>Gateway: tx receipt / status
Gateway-->>Client: GenericResponse { status, data?.tx_hash }
Client->>Gateway: action.setAllowZeros(stream, true)
Gateway->>Contract: invoke set_allow_zeros($stream_id, $value)
Contract->>Postgres: insert/update allow_zeros metadata row
Contract-->>Gateway: tx receipt
Gateway-->>Client: GenericResponse { status, data?.tx_hash }
Client->>Gateway: action.getAllowZeros(stream)
Gateway->>Contract: query get_allow_zeros($stream_id)
alt row exists
Contract->>Postgres: return allow_zeros row
Contract-->>Gateway: { allow_zeros: true/false }
else no row
Contract-->>Gateway: empty -> default false
end
Gateway-->>Client: boolean
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 32 minutes and 21 seconds.Comment |
Time Submission Status
You can submit time with the command. Example: See available commands to help comply with our Guidelines. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/api-reference.md`:
- Around line 69-70: The `allowZeros` description ends with a sentence fragment;
change the fragment to a full sentence such as "This setting can be toggled
later via `action.setAllowZeros`." Update the `allowZeros?: boolean` doc string
so it reads smoothly and includes the complete sentence referencing `allowZeros`
and `action.setAllowZeros`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cfac12c8-64d4-4368-8d61-d084f266b4ec
📒 Files selected for processing (6)
docs/api-reference.mdsrc/client/client.tssrc/contracts-api/action.test.tssrc/contracts-api/action.tssrc/contracts-api/contractValues.tssrc/contracts-api/deployStream.ts
|
@holdex pr submit-time 4h |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/api-reference.md`:
- Line 63: The docs show client.deployStream returning Promise<DeploymentResult>
but the implementation of deployStream returns
Promise<Types.GenericResponse<Types.TxReceipt>>; update the API reference to
match the actual contract by changing the documented return type to
Promise<Types.GenericResponse<Types.TxReceipt>> (or document both if
DeploymentResult is an alias) and ensure the text around deployStream explains
the GenericResponse wrapper and TxReceipt payload so consumers know how to
access the tx receipt from the response.
In `@tests/integration/history.test.ts`:
- Around line 12-29: The test currently falls back to hardcoded
endpoint/chainId/privateKey, which can hit mainnet silently; in beforeAll update
the logic so that endpoint and chainId are required from env (throw or fail the
test if they are missing) and handle privateKey by either requiring it as well
or, if the suite is intended to be read-only, generate a fresh wallet per run by
calling new Wallet() without a seed; update the NodeTNClient creation to use the
validated endpoint/chainId and the generated or provided Wallet (refer to
variables endpoint, chainId, privateKey, Wallet, NodeTNClient and the beforeAll
block) so tests fail fast on misconfiguration or use a non-deterministic wallet.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 857aa165-d7d7-48d4-b996-ebfc72e358c9
📒 Files selected for processing (3)
docs/api-reference.mdtests/integration/erc20Bridge.test.tstests/integration/history.test.ts
✅ Files skipped from review due to trivial changes (1)
- tests/integration/erc20Bridge.test.ts
resolves: https://github.com/truflation/website/issues/3757
Summary by CodeRabbit
New Features
Documentation
Tests
Chores