-
Notifications
You must be signed in to change notification settings - Fork 45
ci: update devnet to 0.4.2 and refactor: remove deprecated txn types references (v0, v1, v2) #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
To view this pull requests documentation preview, visit the following URL: docs.page/focustree/starknet.dart~558 Documentation is deployed and generated using docs.page. |
WalkthroughUnifies StarkNet flows to v3 transaction shapes and resource-bounds gas fields, removes legacy v0/v1 variants, bumps devnet/Starkli and RPC versions, updates devnet artifacts and docs, and migrates tests and provider models to the v3 fee/serialization format. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant Account
participant Provider
participant Signer
App->>Account: request invoke/declare/deploy (v3)
Account->>Provider: getEstimateMaxFeeFor...Tx(calls, v3)
Provider-->>Account: FeeEstimations {l1/l2 gas + prices, overallFee}
Account->>Signer: signTransactionsV3(calls, resourceBounds, tip, modes)
Signer-->>Account: signature
Account->>Provider: send BroadcastedTxnV3(resourceBounds, modes, signature)
alt Nonce error
Account->>Account: retry with incremented nonce
Account->>Provider: resend BroadcastedTxnV3
end
Provider-->>App: tx_hash
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 13
🔭 Outside diff range comments (4)
docs/how-to-contribute.mdx (1)
127-134
: Update version references for Starknet Devnet and JSON RPCThe repo still contains stale version numbers that need to be aligned with this PR’s bump to Devnet 0.4.2 and RPC 0.8.0:
• docs/how-to-contribute.mdx (lines 129, 133)
• docs/index.mdx (line 17)
• packages/starknet/lib/src/static_config.dart (line 35)Please apply the following diffs:
--- docs/how-to-contribute.mdx @@ -126,7 +126,7 @@ - [Cairo Compiler Version](https://github.com/starkware-libs/cairo/releases): `2.6.2` - [Scarb](https://github.com/software-mansion/scarb/releases): `2.6.2` - [Starknet Devnet](https://github.com/0xSpaceShard/starknet-devnet-rs/releases): `0.1.2` +- [Starknet Devnet](https://github.com/0xSpaceShard/starknet-devnet-rs/releases): `0.4.2` - [Starkli](https://github.com/xJonathanLEI/starkli/releases): `0.4.2` - [Sierra](https://docs.starknet.io/documentation/starknet_versions/version_notes/): `1.5.0` - [Starknet](https://docs.starknet.io/documentation/starknet_versions/version_notes/): `0.13.1.1` @@ -130,7 +130,7 @@ - [Sierra](https://docs.starknet.io/documentation/starknet_versions/version_notes/): `1.5.0` - [Starknet](https://docs.starknet.io/documentation/starknet_versions/version_notes/): `0.13.1.1` - [Starknet RPC](https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json): `0.7.1` +- [Starknet RPC](https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json): `0.8.0`--- docs/index.mdx @@ -14,7 +14,7 @@ ## Quickstart - **Supported JSON RPC version:** 0.7.1 +- **Supported JSON RPC version:** 0.8.0--- packages/starknet/lib/src/static_config.dart @@ -32,7 +32,7 @@ /// Endpoint configuration for static environments. class StaticConfig { - // from starknet-devnet 0.1.2 + // from starknet-devnet 0.4.2 static const devnetUrl = 'http://127.0.0.1:5050/'; // ... }packages/starknet/test/argent/argent_test.dart (1)
255-271
: OutsideExecution 'caller' should be the deployed account, not account9Using account9 as the caller in the OutsideExecution message is inconsistent with the session key (which is bound to the newly deployed account) and can invalidate the signature/authorization. Use the freshly deployed account’s address instead.
Apply this diff:
- final message = OutsideExecutionMessageV2( - caller: account9.accountAddress.toHexString(), + final message = OutsideExecutionMessageV2( + caller: accountAddress.toHexString(), nonce: Felt.fromInt(timestamp).toHexString(), executeAfter: '0x1', executeBefore: '0x195882b23b3', calls: [packages/starknet/lib/src/presets/udc.g.dart (1)
50-53
: Compile error: throwing Exception type instead of an instance
error: (error) => throw Exception,
attempts to throw the Exception type, not an instance. It must beException(error)
or similar.Apply this diff:
- error: (error) => throw Exception, + error: (error) => throw Exception(error),packages/starknet/lib/src/account/signer/base_account_signer.dart (1)
183-183
: Parameter contractAddress is shadowed by local variableThe method parameter
contractAddress
at line 183 is immediately overwritten by a local variable with the same name at line 195. This shadowing makes the parameter useless and could be confusing.Remove the unused parameter since the contract address is computed internally:
Future<List<Felt>> signDeployAccountTransactionV3({ - required Felt contractAddress, required Map<String, ResourceBounds> resourceBounds, required Felt tip, required List<Felt> paymasterData,
♻️ Duplicate comments (3)
packages/avnu_provider/test/integration/provider_test.dart (2)
361-363
: Second switch to JSON-RPC v0_8 endpoint: consistent with the migration.Mirrors the earlier update; good to keep unit tests aligned with integration tests.
425-425
: Duplicate: reuse the shared constant for maxGasTokenAmount here too.Apply the same change as above to keep both tests in sync and ease future updates.
- final maxGasTokenAmount = '0xFC3F02C221B000'; + const maxGasTokenAmount = kTestMaxGasTokenAmount;packages/starknet/lib/src/account.dart (1)
249-250
: Duplicate zero resource bounds initializationSame issue as in
getEstimateMaxFeeForDeclareTx
- initializing resource bounds with all zeros.
🧹 Nitpick comments (15)
packages/avnu_provider/test/integration/provider_test.dart (1)
73-75
: Hardcoding maxGasTokenAmount may cause flaky tests; consider centralizing and clarifying units.Fixed gas budgets can drift with network conditions. At minimum, reuse a shared constant and update the nearby comment to reflect “maxGasTokenAmount” (not “maxFee”) to avoid confusion.
Apply this diff to reuse a shared constant at this site:
- final maxGasTokenAmount = "0xFC3F02C221B000"; + const maxGasTokenAmount = kTestMaxGasTokenAmount;Add this top-level test constant (outside this range), e.g. near other test constants:
// For tests only: max gas token budget as hex string (denominated in the gas token's base units). const kTestMaxGasTokenAmount = '0xFC3F02C221B000';Nit: adjust the comment immediately above to reflect reality (outside this range):
// We set a fixed maxGasTokenAmount (hex string) for testing.
Verification to reduce flakiness:
- Confirm the value is sufficient on Sepolia for the approve() path with the chosen gas token and current network conditions.
- Ensure the value matches the token’s decimals (this is base-unit amount, not human-readable).
docs/packages/starknet-provider.mdx (1)
12-14
: Docs table aligned to v3-only flow, but cross-doc RPC version mismatch to resolveThe simplification to v3-only for invoke/declare/deploy_account looks correct and matches the PR intent to remove deprecated v0/v1/v2 references. However:
- This page shows “Supported JSON RPC methods — Version: 0.8.1”, while docs/index.mdx still says “Supported JSON RPC version: 0.7.1”.
- Launch config (.vscode/launch.json) points to /rpc/v0_8.
Please align the stated JSON-RPC version across docs to avoid confusion (prefer 0.8.1 everywhere if that’s the target). Also, given prior guidance to retain v0 in AccountSupportedTxVersion in code paths (see retrieved learnings), confirm that the codebase’s enum still honors that requirement or document that the policy has changed.
.vscode/launch.json (1)
9-9
: Bumped RPC endpoint to v0_8; ensure consistency with docs/spec versionsEndpoint update to v0_8 is good. Please verify:
- docs/index.mdx currently claims JSON-RPC 0.7.1; provider docs use 0.8.1. Align these with v0_8 to avoid confusion.
- If test assumptions depend on specVersion-specific behavior, consider parameterizing this via an env like STARKNET_SPEC_VERSION to make upgrades less error-prone.
.env.devnet (2)
14-15
: Reorder keys to satisfy dotenv-linter UnorderedKey ruleSwapping these lines removes the linter warning without affecting behavior.
Apply this diff:
-STARKNET_DEVNET_VERSION=0.4.2 -STARKLI_VERSION=0.4.2 +STARKLI_VERSION=0.4.2 +STARKNET_DEVNET_VERSION=0.4.2
25-25
: Optional: remove quotes to satisfy dotenv-linter QuoteCharacter warningBoth quoted and unquoted work in bash and most dotenv loaders; if you want a clean linter run, drop the quotes.
Apply this diff:
-ACCOUNT_CLASS_HASH="0x05b4b537eaa2399e3aa99c4e2e0208ebd6c71bc1467938cd52c798c601e43564" +ACCOUNT_CLASS_HASH=0x05b4b537eaa2399e3aa99c4e2e0208ebd6c71bc1467938cd52c798c601e43564packages/starknet/lib/src/static_config.dart (1)
35-38
: Update stale comment to reflect devnet 0.4.2The inline comment still mentions 0.1.2.
Apply this diff:
-// from starknet-devnet 0.1.2 +// from starknet-devnet 0.4.2packages/starknet/lib/src/contract/erc20.dart (2)
59-67
: RenamemaxFee
to reflect V3 resource-bounds semantics.This variable holds V3 gas/resource bounds, not a legacy max fee. Rename for clarity and to avoid confusion with removed max_fee semantics.
Apply this diff:
- final maxFee = await account.getEstimateMaxFeeForInvokeTx( + final feeEstimation = await account.getEstimateMaxFeeForInvokeTx( functionCalls: [ FunctionCall( contractAddress: address, entryPointSelector: getSelectorByName("transfer"), calldata: [recipient, value.low, value.high], ), ], ); @@ - l1GasConsumed: maxFee.l1GasConsumed, - l1GasPrice: maxFee.l1GasPrice, - l2GasConsumed: maxFee.l2GasConsumed, - l2GasPrice: maxFee.l2GasPrice, - l1DataGasConsumed: maxFee.l1DataGasConsumed, - l1DataGasPrice: maxFee.l1DataGasPrice, + l1GasConsumed: feeEstimation.l1GasConsumed, + l1GasPrice: feeEstimation.l1GasPrice, + l2GasConsumed: feeEstimation.l2GasConsumed, + l2GasPrice: feeEstimation.l2GasPrice, + l1DataGasConsumed: feeEstimation.l1DataGasConsumed, + l1DataGasPrice: feeEstimation.l1DataGasPrice,- final maxFee = await account.getEstimateMaxFeeForInvokeTx( + final feeEstimation = await account.getEstimateMaxFeeForInvokeTx( functionCalls: [ FunctionCall( contractAddress: address, entryPointSelector: getSelectorByName("transferFrom"), calldata: [from, to, value.low, value.high], ), ], ); @@ - l1GasConsumed: maxFee.l1GasConsumed, - l1GasPrice: maxFee.l1GasPrice, - l2GasConsumed: maxFee.l2GasConsumed, - l2GasPrice: maxFee.l2GasPrice, - l1DataGasConsumed: maxFee.l1DataGasConsumed, - l1DataGasPrice: maxFee.l1DataGasPrice, + l1GasConsumed: feeEstimation.l1GasConsumed, + l1GasPrice: feeEstimation.l1GasPrice, + l2GasConsumed: feeEstimation.l2GasConsumed, + l2GasPrice: feeEstimation.l2GasPrice, + l1DataGasConsumed: feeEstimation.l1DataGasConsumed, + l1DataGasPrice: feeEstimation.l1DataGasPrice,- final maxFee = await account.getEstimateMaxFeeForInvokeTx( + final feeEstimation = await account.getEstimateMaxFeeForInvokeTx( functionCalls: [ FunctionCall( contractAddress: address, entryPointSelector: getSelectorByName("approve"), calldata: [spender, amount.low, amount.high], ), ], ); @@ - l1GasConsumed: maxFee.l1GasConsumed, - l1GasPrice: maxFee.l1GasPrice, - l2GasConsumed: maxFee.l2GasConsumed, - l2GasPrice: maxFee.l2GasPrice, - l1DataGasConsumed: maxFee.l1DataGasConsumed, - l1DataGasPrice: maxFee.l1DataGasPrice, + l1GasConsumed: feeEstimation.l1GasConsumed, + l1GasPrice: feeEstimation.l1GasPrice, + l2GasConsumed: feeEstimation.l2GasConsumed, + l2GasPrice: feeEstimation.l2GasPrice, + l1DataGasConsumed: feeEstimation.l1DataGasConsumed, + l1DataGasPrice: feeEstimation.l1DataGasPrice,Also applies to: 71-77, 91-99, 103-109, 124-132, 136-142
59-67
: DRY the estimate-and-execute pattern into a helper (optional).Same pattern appears in transfer/transferFrom/approve. A small helper improves readability and reduces risk of divergence.
You can add this method inside ERC20 and call it from transfer/transferFrom/approve:
Future<String> _invokeWithEstimatedFee({ required String selector, required List<Felt> calldata, }) async { final feeEstimation = await account.getEstimateMaxFeeForInvokeTx( functionCalls: [ FunctionCall( contractAddress: address, entryPointSelector: getSelectorByName(selector), calldata: calldata, ), ], ); final InvokeTransactionResponse trx = await execute( selector: selector, calldata: calldata, l1GasConsumed: feeEstimation.l1GasConsumed, l1GasPrice: feeEstimation.l1GasPrice, l2GasConsumed: feeEstimation.l2GasConsumed, l2GasPrice: feeEstimation.l2GasPrice, l1DataGasConsumed: feeEstimation.l1DataGasConsumed, l1DataGasPrice: feeEstimation.l1DataGasPrice, ); return trx.when( result: (r) => r.transaction_hash, error: (e) => throw Exception("Error $selector (${e.code}): ${e.message}"), ); }Example usage:
- transfer: return _invokeWithEstimatedFee(selector: "transfer", calldata: [recipient, value.low, value.high]);
- transferFrom: return _invokeWithEstimatedFee(selector: "transferFrom", calldata: [from, to, value.low, value.high]);
- approve: return _invokeWithEstimatedFee(selector: "approve", calldata: [spender, amount.low, amount.high]);
Also applies to: 91-99, 124-132
packages/wallet_kit/lib/services/wallet_service.dart (1)
104-104
: Optional: also set V3 explicitly in sendEth’s temporary funding account.For consistency and to avoid reliance on defaults, set V3 in sendEth.
Outside this hunk, update the temporary account in sendEth:
final fundingAccount = s.Account( provider: provider, signer: signer, accountAddress: s.Felt.fromHexString(account.address), chainId: chainId, supportedTxVersion: s.AccountSupportedTxVersion.v3, );packages/starknet/test/argent/argent_test.dart (2)
274-289
: Rename “maxFee” to “feeEstimate” to avoid confusion and align with the v3 gas-based modelThe variable holds a FeeEstimations object (with gas fields), not a legacy max fee. Rename for clarity and update references where it’s passed to execute.
Apply these diffs:
- // we set a max fee to avoid raising an exception during fee estimation - final maxFee = await account9.getEstimateMaxFeeForInvokeTx( + // Preflight fee estimation for v3 gas-based execution + final feeEstimate = await account9.getEstimateMaxFeeForInvokeTx( functionCalls: [- l1GasConsumed: maxFee.l1GasConsumed, - l1GasPrice: maxFee.l1GasPrice, - l1DataGasConsumed: maxFee.l1DataGasConsumed, - l1DataGasPrice: maxFee.l1DataGasPrice, - l2GasConsumed: maxFee.l2GasConsumed, - l2GasPrice: maxFee.l2GasPrice, + l1GasConsumed: feeEstimate.l1GasConsumed, + l1GasPrice: feeEstimate.l1GasPrice, + l1DataGasConsumed: feeEstimate.l1DataGasConsumed, + l1DataGasPrice: feeEstimate.l1DataGasPrice, + l2GasConsumed: feeEstimate.l2GasConsumed, + l2GasPrice: feeEstimate.l2GasPrice,Also applies to: 304-310
397-415
: Fix outdated comment and improve clarity of the failure expectationThe first comment suggests “setting a max fee to avoid raising an exception,” which contradicts the intent of asserting that fee estimation fails due to an expired session key. Update the comments to reflect the preflight failure expectation.
Apply this diff:
- // we set a max fee to avoid raising an exception during fee estimation - // expect maxfee fails because the session key is expired + // Expect fee estimation to fail because the session key is expiredpackages/starknet/lib/src/contract/contract.dart (1)
53-68
: Document the new gas parameters in the execute() methodAdd a short doc note that the six gas-related parameters correspond to v3-style fee modeling and are expected to come from a preflight fee estimation.
Example snippet (outside selected lines; for reference):
/// Execute contract given [selector] with [calldata]. /// For v3 transactions, pass gas-related parameters obtained from a preflight fee estimation: /// [l1GasConsumed], [l1GasPrice], [l1DataGasConsumed], [l1DataGasPrice], [l2GasConsumed], [l2GasPrice].packages/ark_project/lib/src/ark_starknet.dart (1)
23-37
: Deprecate or remove the unused “maxFee” parameters from public methodsThe methods still accept Felt? maxFee but don’t use it anymore after migrating to preflight fee estimation with gas fields. Keeping it confuses API consumers.
Follow-up suggestion (outside selected lines): either remove the maxFee parameter from:
- createListing
- cancelOrder
- createOffer
- fulfillListing
- fulfillOffer
or mark it deprecated:
@Deprecated('No longer used. Use preflight fee estimation and gas fields instead.') Felt? maxFee,If you want, I can provide a PR-wide mechanical change to update all call sites accordingly.
packages/starknet/test/account_test.dart (1)
157-157
: Nit: Rename variable to avoid conflating FeeEstimations with “maxFee”
maxFee.overallFee
is semantically a FeeEstimations value; consider renamingmaxFee
→feeEstimate
for clarity.Example:
- var maxFee = await account0.getEstimateMaxFeeForDeployAccountTx( + var feeEstimate = await account0.getEstimateMaxFeeForDeployAccountTx( ... - low: maxFee.overallFee, + low: feeEstimate.overallFee,packages/starknet/lib/src/account.dart (1)
705-710
: Consider extracting the zero-check condition to improve readabilityThe condition checking if all resource bounds are zero is quite long and could be extracted to a helper method for better readability.
+ static bool _isZeroResourceBounds(Felt l1GasConsumed, Felt l1GasPrice, + Felt l1DataGasConsumed, Felt l1DataGasPrice, + Felt l2GasConsumed, Felt l2GasPrice) { + return l1GasConsumed == Felt.zero && + l1GasPrice == Felt.zero && + l1DataGasConsumed == Felt.zero && + l1DataGasPrice == Felt.zero && + l2GasConsumed == Felt.zero && + l2GasPrice == Felt.zero; + } // If all the resource bounds are zero, we need to estimate the fee - if (l1GasConsumed == Felt.zero && - l1GasPrice == Felt.zero && - l1DataGasConsumed == Felt.zero && - l1DataGasPrice == Felt.zero && - l2GasConsumed == Felt.zero && - l2GasPrice == Felt.zero) { + if (_isZeroResourceBounds(l1GasConsumed, l1GasPrice, + l1DataGasConsumed, l1DataGasPrice, + l2GasConsumed, l2GasPrice)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
♻️ Duplicate comments (1)
packages/starknet/lib/src/account.dart (1)
248-254
: Avoid zeroed resource bounds during deploy-account fee estimationSeeding resourceBounds with all zeros can lead to meaningless fee estimates or signature mismatch if later adjusted. Prefer provider.defaultResourceBoundsMapping() here too, consistent with invoke/declare paths.
- final resourceBounds = _getResourceBounds( - Felt.zero, Felt.zero, Felt.zero, Felt.zero, Felt.zero, Felt.zero); + final resourceBounds = await provider.defaultResourceBoundsMapping();
🧹 Nitpick comments (2)
packages/starknet_provider/lib/src/model/estimate_fee.dart (1)
125-132
: Prefer a typed switch ontype
and throwUnsupportedError
for unknown valuesThis reduces repeated map indexing, makes the intent clearer, and uses a more specific error type than a generic Exception.
Apply this diff:
- factory BroadcastedTxn.fromJson(Map<String, Object?> json) => json['type'] == - 'DECLARE' - ? BroadcastedDeclareTxnV3.fromJson(json) - : json['type'] == 'DEPLOY_ACCOUNT' - ? BroadcastedDeployAccountTxnV3.fromJson(json) - : json['type'] == 'INVOKE' - ? BroadcastedInvokeTxnV3.fromJson(json) - : throw Exception('Invalid transaction type: ${json['type']}'); + factory BroadcastedTxn.fromJson(Map<String, Object?> json) { + final type = json['type'] as String?; + switch (type) { + case 'DECLARE': + return BroadcastedDeclareTxnV3.fromJson(json); + case 'DEPLOY_ACCOUNT': + return BroadcastedDeployAccountTxnV3.fromJson(json); + case 'INVOKE': + return BroadcastedInvokeTxnV3.fromJson(json); + default: + throw UnsupportedError('Unknown BroadcastedTxn type: $type'); + } + }packages/starknet/lib/src/account.dart (1)
356-364
: Over-scaling: multiplying both gas consumed and gas price inflates estimatesApplying the feeMultiplier to both “amount” and “price per unit” over-amplifies the bounds (quadratic effect on cost potential). Typically you scale either the amounts or overallFee. Recommend scaling maxAmount fields (consumed) and leave prices unchanged, or just scale overallFee and keep raw measured gas figures.
- l1GasConsumed: fee.l1GasConsumed * Felt.fromDouble(feeMultiplier), - l1GasPrice: fee.l1GasPrice * Felt.fromDouble(feeMultiplier), - l1DataGasConsumed: fee.l1DataGasConsumed * Felt.fromDouble(feeMultiplier), - l1DataGasPrice: fee.l1DataGasPrice * Felt.fromDouble(feeMultiplier), - l2GasConsumed: fee.l2GasConsumed * Felt.fromDouble(feeMultiplier), - l2GasPrice: fee.l2GasPrice * Felt.fromDouble(feeMultiplier), + l1GasConsumed: fee.l1GasConsumed * Felt.fromDouble(feeMultiplier), + l1GasPrice: fee.l1GasPrice, + l1DataGasConsumed: fee.l1DataGasConsumed * Felt.fromDouble(feeMultiplier), + l1DataGasPrice: fee.l1DataGasPrice, + l2GasConsumed: fee.l2GasConsumed * Felt.fromDouble(feeMultiplier), + l2GasPrice: fee.l2GasPrice,Alternatively, keep all raw fee fields and only inflate overallFee.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
docs/examples/starknet-counter.mdx
(1 hunks)docs/index.mdx
(1 hunks)packages/ark_project/lib/src/ark_starknet.dart
(15 hunks)packages/starknet/lib/src/account.dart
(15 hunks)packages/starknet_provider/lib/src/model/estimate_fee.dart
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- docs/index.mdx
- docs/examples/starknet-counter.mdx
🧰 Additional context used
🧠 Learnings (33)
📓 Common learnings
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:103-122
Timestamp: 2024-11-21T18:27:07.722Z
Learning: In the file `packages/starknet_provider/lib/src/model/estimate_fee.dart`, for version 3 invoke transactions (`BroadcastedInvokeTxnV3`), the `maxFee` field is not required.
📚 Learning: 2024-11-21T18:27:07.722Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:103-122
Timestamp: 2024-11-21T18:27:07.722Z
Learning: In the file `packages/starknet_provider/lib/src/model/estimate_fee.dart`, for version 3 invoke transactions (`BroadcastedInvokeTxnV3`), the `maxFee` field is not required.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-25T19:15:32.489Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:0-0
Timestamp: 2024-10-25T19:15:32.489Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, the `max_fee` field in `DeclareTransactionV2` is of type `String` instead of `Felt` because the devnet only supports a 16-byte length for this field, so we can't send this field as a `Felt` (it's too long).
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2025-04-23T08:24:11.775Z
Learnt from: ptisserand
PR: focustree/starknet.dart#505
File: packages/starknet/test/argent/argent_test.dart:389-390
Timestamp: 2025-04-23T08:24:11.775Z
Learning: In the starknet.dart library, `defaultMaxFee` is defined in `packages/starknet/lib/src/static_config.dart` with a value of 0.001 ETH (converted to Felt format) and is available to files that import the Starknet package without requiring an explicit import of the static_config module.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2025-04-23T08:24:11.775Z
Learnt from: ptisserand
PR: focustree/starknet.dart#505
File: packages/starknet/test/argent/argent_test.dart:389-390
Timestamp: 2025-04-23T08:24:11.775Z
Learning: In the starknet.dart library, `defaultMaxFee` is exported from the `static_config` module and is available to files that import the Starknet package without requiring an explicit import of the static_config module.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-11-21T18:27:17.609Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:156-176
Timestamp: 2024-11-21T18:27:17.609Z
Learning: In Dart's `estimate_fee.dart` file, the `BroadcastedDeclareTxnV3` class for version 3 declare transactions does not require a `maxFee` field, as `maxFee` is not required in version 3 declare transactions.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-26T14:44:41.090Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:341-343
Timestamp: 2024-10-26T14:44:41.090Z
Learning: In the Dart file `packages/starknet/lib/src/signer.dart`, within the `Signer` class's `signDeclareTransactionV3` method, the values of `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` are hardcoded and are intended for future use.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-11-21T23:07:45.157Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:83-104
Timestamp: 2024-11-21T23:07:45.157Z
Learning: In `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, for the `InvokeTransactionV3` class in Dart, when running in the devnet environment, the `tip` and `resourceBounds` fields must be hex strings instead of `Felt` because `Felt` is not supported in these fields by the devnet.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-25T17:58:31.306Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/account.dart:396-397
Timestamp: 2024-10-25T17:58:31.306Z
Learning: The `signDeclareTransactionV2` function in `packages/starknet/lib/src/account.dart` is a legacy function and should not be modified.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-11-21T23:08:45.593Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:83-104
Timestamp: 2024-11-21T23:08:45.593Z
Learning: In `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, for the `InvokeTransactionV3` class in Dart, data availability modes `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` are used as strings 'L1' and 'L2', and enums are not required at this point.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-25T21:45:05.224Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:58-60
Timestamp: 2024-10-25T21:45:05.224Z
Learning: In the `signInvokeTransactionsV3` function in `packages/starknet/lib/src/signer.dart`, it's acceptable for `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` to default to `'L2'` without additional validation when unexpected values are provided.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-12-16T16:05:56.413Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#423
File: packages/starknet/lib/src/account.dart:17-19
Timestamp: 2024-12-16T16:05:56.413Z
Learning: In the Dart file `packages/starknet/lib/src/account.dart`, the `AccountSupportedTxVersion` enum should continue to include the `v0` variant, as retaining support for transaction version 0 is required at this time according to the maintainer's preference.
Applied to files:
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-12-17T15:14:26.521Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#423
File: packages/starknet_provider/lib/src/model/deploy_account_transaction.dart:64-64
Timestamp: 2024-12-17T15:14:26.521Z
Learning: In `packages/starknet_provider/lib/src/model/deploy_account_transaction.dart`, the `ResourceBounds` class is imported through the `starknet` package, so an explicit import from 'declare_transaction.dart' is not necessary.
Applied to files:
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-11-21T23:14:56.972Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:41-48
Timestamp: 2024-11-21T23:14:56.972Z
Learning: In the file `packages/starknet/lib/src/signer.dart`, when gas bounds computation logic is repeated across methods `signInvokeTransactionsV3`, `signDeclareTransactionV3`, and `signDeployAccountTransactionV3`, the team prefers to keep the logic within each method rather than refactoring into a shared helper method.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:53:21.313Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/signer.dart:193-271
Timestamp: 2024-10-22T20:53:21.313Z
Learning: The `signDeclareTransactionV3` method is tested in `packages/starknet/test/account_test.dart`.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:40:51.049Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:320-332
Timestamp: 2024-10-26T14:40:51.049Z
Learning: In the `signDeclareTransactionV3` function in `packages/starknet/lib/src/signer.dart`, the `resourceBounds` values `'l1_gas'` and `'l2_gas'` are validated in the calling function.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:31:58.467Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/test/account_test.dart:124-133
Timestamp: 2024-10-22T20:31:58.467Z
Learning: In `packages/starknet/test/account_test.dart`, within the `declare` method tests, the resource bounds values are intended to be specified as hex strings rather than `BigInt` values.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:23:43.886Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:37-46
Timestamp: 2024-10-28T19:23:43.886Z
Learning: In the Dart file `packages/starknet/lib/src/signer.dart`, the `signInvokeTransactionsV3` function includes `resourceBounds` validation to ensure correctness when used by different callers in the future, even if this validation might currently be redundant.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:39:12.257Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/test/account_test.dart:0-0
Timestamp: 2024-10-22T20:39:12.257Z
Learning: In `packages/starknet/test/account_test.dart`, when declaring `ResourceBounds`, `maxAmount` and `maxPricePerUnit` are intentionally passed as hex strings.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:25:12.812Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/test/account_test.dart:124-133
Timestamp: 2024-10-28T19:25:12.812Z
Learning: In `packages/starknet/test/account_test.dart`, it's acceptable to duplicate resource bounds configuration in test cases for better understanding.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T15:03:55.718Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/account.dart:382-411
Timestamp: 2024-10-26T15:03:55.718Z
Learning: Error handling for parsing resource bounds in the `declare` method of the `Account` class has already been addressed in a previous pull request dependency.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:39:43.845Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:198-201
Timestamp: 2024-10-26T14:39:43.845Z
Learning: In `packages/starknet/lib/src/signer.dart`, the `resourceBounds` parameter passed to `signTransactions` is already validated in the caller function to ensure it contains the required keys before being passed to `signInvokeTransactionsV3`.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:59:26.758Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:103-106
Timestamp: 2024-10-26T14:59:26.758Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, within the `ResourceBounds` class, the fields `maxAmount` and `maxPricePerUnit` must remain as `String` type because they need to be sent as strings to the target host.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-29T18:18:05.278Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/contract/contract.dart:69-70
Timestamp: 2024-10-29T18:18:05.278Z
Learning: Validation of `resourceBounds` in `Contract.execute(...)` in `packages/starknet/lib/src/contract/contract.dart` is performed in other functions, so additional validation in `Contract.execute` is not necessary.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:10:45.088Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:193-206
Timestamp: 2024-11-21T23:10:45.088Z
Learning: In `packages/starknet/lib/src/signer.dart`, when function parameters in methods like `signTransactions` are initialized with default values in the method signature, they cannot be null at runtime, so force unwrapping such parameters is acceptable.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:26:41.551Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:64-65
Timestamp: 2024-10-22T20:26:41.551Z
Learning: In `DeclareTransactionV2`, the `max_fee` field is of type `String` because the target RPC host doesn't support the `Felt` data type due to its length.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T18:25:36.194Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:204-223
Timestamp: 2024-11-21T18:25:36.194Z
Learning: In v3 deploy account transactions (`BroadcastedDeployAccountTxnV3`), `maxFee` is not required.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:17:23.604Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:402-423
Timestamp: 2024-11-21T23:17:23.604Z
Learning: In the `signDeployAccountTransactionV3` method in `packages/starknet/lib/src/signer.dart`, overwriting the `contractAddress` parameter within the method is acceptable in this codebase.
Applied to files:
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-28T19:20:40.540Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:88-88
Timestamp: 2024-10-28T19:20:40.540Z
Learning: In `InvokeTransactionV3` class in `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, the `tip` field is defined as a `String` because the development environment doesn't support a `Felt` type for this field.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-25T17:56:59.390Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/account.dart:344-344
Timestamp: 2024-10-25T17:56:59.390Z
Learning: In the `declare` method in `packages/starknet/lib/src/account.dart`, `compiledContract` will always be of type `CompiledContract`, so explicit type checks before casting are unnecessary.
Applied to files:
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-26T15:39:54.600Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/invoke_transaction.freezed.dart:26-31
Timestamp: 2024-10-26T15:39:54.600Z
Learning: In the `starknet_provider/lib/src/model/invoke_transaction.freezed.dart` file and other files with the `.freezed.dart` extension, the code is automatically generated by the `freezed` package and should not be manually modified.
Applied to files:
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-10-22T19:40:06.263Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:90-90
Timestamp: 2024-10-22T19:40:06.263Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, the `tip` field in `DeclareTransactionV3` should remain a `String` because the target node doesn't support a `Felt` type for this field.
Applied to files:
packages/starknet_provider/lib/src/model/estimate_fee.dart
📚 Learning: 2024-11-21T18:01:29.801Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/block_number.freezed.dart:73-74
Timestamp: 2024-11-21T18:01:29.801Z
Learning: The file `packages/starknet_provider/lib/src/model/block_number.freezed.dart` is auto-generated and should not be modified directly.
Applied to files:
packages/starknet_provider/lib/src/model/estimate_fee.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: analyze
- GitHub Check: test-integration
- GitHub Check: lint
🔇 Additional comments (8)
packages/starknet_provider/lib/src/model/estimate_fee.dart (2)
125-131
: Correct mapping to 'DEPLOY_ACCOUNT' and removal of silent fallback looks goodAligns with RPC v3 and the PR goal to drop legacy types. Good to see unknown types no longer default to a deploy-account txn.
125-132
: Please manually verify removal of legacy transaction typesI wasn’t able to conclusively confirm that all occurrences of the legacy
"DEPLOY"
type (excluding"DEPLOY_ACCOUNT"
) or anyV0/V1/V2
-suffixed BroadcastedTxn identifiers have been removed. Please run local searches over your Dart files to ensure no stragglers remain:# Find any "DEPLOY" type literals (excluding DEPLOY_ACCOUNT) grep -R --include="*.dart" '"type"\s*:\s*"DEPLOY"' -C2 . # Find any Broadcasted/Invoke/Declare/Deploy(Account)/Txn identifiers with V0/V1/V2 grep -R --include="*.dart" -E '\b(?:Broadcasted|Invoke|Declare|Deploy(?:Account)?|Txn)\w*V[0-2]\b' -C2 .If you spot any matches, update or remove them to fully eliminate deprecated transaction types.
packages/starknet/lib/src/account.dart (6)
21-27
: Keep v0 in AccountSupportedTxVersion enum — aligns with maintainer’s preferenceRetaining v0 (even deprecated) is consistent with prior guidance to keep v0 available for now.
31-49
: FeeEstimations v3 fields look consistent with gas/resource boundsThe shape aligns with v3 (l1/l2 gas and overallFee). No issues spotted here.
71-72
: Default supportedTxVersion changed to v3 — verify downstream impactSwitching the default to v3 is OK, but please verify external callers that relied on previous defaults (e.g., tests, presets) continue to function without passing this explicitly.
Would you like a quick script to scan for Account() constructions without supportedTxVersion specified to assess the blast radius?
101-113
: Defaults for tip/modes and resource bounds fetch are sensible
- Using provider.defaultResourceBoundsMapping() is good and consistent with v3 flows.
- Defaulting modes to 'L1' and initializing optional arrays is fine.
135-148
: BroadcastedInvokeTxnV3 build is v3-correct (no maxFee, tip as hex)Calldata uses non-legacy format and tip is hex-encoded. This matches provider expectations for v3 invoke.
792-815
: Sorry, I couldn't retrieve the imports fromaccount.dart
. Please verify that the file path is correct or search manually for theResourceBounds
import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (5)
packages/wallet_kit/lib/widgets/nft_details.dart (4)
115-117
: Same issue: incomplete gas field setThe cancelOrder call has the same problem - only price fields are provided.
148-150
: Same issue: incomplete gas field setThe fulfillListing call has the same problem - only price fields are provided.
176-178
: Same issue: incomplete gas field setThe createOffer call has the same problem - only price fields are provided.
212-214
: Same issue: incomplete gas field setThe fulfillOffer call has the same problem - only price fields are provided.
packages/starknet/lib/src/account.dart (1)
248-249
: Fix potentially incorrect resource bounds initializationAs identified in past reviews, initializing resource bounds with all zeros may produce meaningless fee estimates. Consider using the provider's default resource bounds mapping instead.
🧹 Nitpick comments (1)
packages/ark_project/lib/src/ark_starknet.dart (1)
82-83
: Consider using consistent fee values across all Ark methodsYou're passing only gas price parameters to the Ark starknet methods, but not gas consumed parameters. This could lead to unexpected behavior since the ArkStarknet implementation expects all six gas parameters. Consider either:
- Passing all six gas parameters consistently
- Or letting all default to zero and rely on the automatic fee estimation
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/ark_project/lib/src/ark_starknet.dart
(15 hunks)packages/starknet/lib/src/account.dart
(15 hunks)packages/starknet/tool/declare_contract0.dart
(1 hunks)packages/wallet_kit/lib/widgets/nft_details.dart
(5 hunks)
🧰 Additional context used
🧠 Learnings (42)
📓 Common learnings
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:103-122
Timestamp: 2024-11-21T18:27:07.722Z
Learning: In the file `packages/starknet_provider/lib/src/model/estimate_fee.dart`, for version 3 invoke transactions (`BroadcastedInvokeTxnV3`), the `maxFee` field is not required.
📚 Learning: 2024-10-25T17:56:59.390Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/account.dart:344-344
Timestamp: 2024-10-25T17:56:59.390Z
Learning: In the `declare` method in `packages/starknet/lib/src/account.dart`, `compiledContract` will always be of type `CompiledContract`, so explicit type checks before casting are unnecessary.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-25T17:58:31.306Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/account.dart:396-397
Timestamp: 2024-10-25T17:58:31.306Z
Learning: The `signDeclareTransactionV2` function in `packages/starknet/lib/src/account.dart` is a legacy function and should not be modified.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T15:05:20.368Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/contract/model/compiled_class_hash.dart:27-28
Timestamp: 2024-10-26T15:05:20.368Z
Learning: In the file `packages/starknet/lib/src/contract/model/compiled_class_hash.dart`, the formula used in the `hash` method of `BytecodeLeaf` comes from the original source and should not be changed.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T15:07:09.798Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/contract/model/compiled_class_hash.dart:43-51
Timestamp: 2024-10-26T15:07:09.798Z
Learning: In the file `packages/starknet/lib/src/contract/model/compiled_class_hash.dart`, the formula used in the `hash` method of `BytecodeSegmentedNode` comes from an official implementation and should not be changed.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T15:08:10.453Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/contract/model/compiled_class_hash.dart:184-190
Timestamp: 2024-10-26T15:08:10.453Z
Learning: In the file `packages/starknet/lib/src/contract/model/compiled_class_hash.dart`, the structure and placement of classes, including `_BytecodeSegmentStructureResult`, come from the original source and should not be changed.
Applied to files:
packages/starknet/tool/declare_contract0.dart
📚 Learning: 2024-10-22T19:44:12.938Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/contract/model/compiled_class_hash.dart:132-135
Timestamp: 2024-10-22T19:44:12.938Z
Learning: In the file `packages/starknet/lib/src/contract/model/compiled_class_hash.dart`, the formula used in the `_createBytecodeSegmentStructureInner` function comes from an official implementation and should not be changed.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:17:23.604Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:402-423
Timestamp: 2024-11-21T23:17:23.604Z
Learning: In the `signDeployAccountTransactionV3` method in `packages/starknet/lib/src/signer.dart`, overwriting the `contractAddress` parameter within the method is acceptable in this codebase.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-12-17T15:14:26.521Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#423
File: packages/starknet_provider/lib/src/model/deploy_account_transaction.dart:64-64
Timestamp: 2024-12-17T15:14:26.521Z
Learning: In `packages/starknet_provider/lib/src/model/deploy_account_transaction.dart`, the `ResourceBounds` class is imported through the `starknet` package, so an explicit import from 'declare_transaction.dart' is not necessary.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:53:21.313Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/signer.dart:193-271
Timestamp: 2024-10-22T20:53:21.313Z
Learning: The `signDeclareTransactionV3` method is tested in `packages/starknet/test/account_test.dart`.
Applied to files:
packages/starknet/tool/declare_contract0.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-25T17:56:17.827Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/contract/model/compiled_contract.dart:0-0
Timestamp: 2024-10-25T17:56:17.827Z
Learning: In the `CASMCompiledContract.classHash()` method within `packages/starknet/lib/src/contract/model/compiled_contract.dart`, the `compilerVersion` input will always follow the expected format, so additional validation is unnecessary.
Applied to files:
packages/starknet/tool/declare_contract0.dart
📚 Learning: 2024-11-21T18:27:07.722Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:103-122
Timestamp: 2024-11-21T18:27:07.722Z
Learning: In the file `packages/starknet_provider/lib/src/model/estimate_fee.dart`, for version 3 invoke transactions (`BroadcastedInvokeTxnV3`), the `maxFee` field is not required.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2025-04-23T08:24:11.775Z
Learnt from: ptisserand
PR: focustree/starknet.dart#505
File: packages/starknet/test/argent/argent_test.dart:389-390
Timestamp: 2025-04-23T08:24:11.775Z
Learning: In the starknet.dart library, `defaultMaxFee` is defined in `packages/starknet/lib/src/static_config.dart` with a value of 0.001 ETH (converted to Felt format) and is available to files that import the Starknet package without requiring an explicit import of the static_config module.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-25T19:15:32.489Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:0-0
Timestamp: 2024-10-25T19:15:32.489Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, the `max_fee` field in `DeclareTransactionV2` is of type `String` instead of `Felt` because the devnet only supports a 16-byte length for this field, so we can't send this field as a `Felt` (it's too long).
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:44:41.090Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:341-343
Timestamp: 2024-10-26T14:44:41.090Z
Learning: In the Dart file `packages/starknet/lib/src/signer.dart`, within the `Signer` class's `signDeclareTransactionV3` method, the values of `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` are hardcoded and are intended for future use.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-25T21:45:05.224Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:58-60
Timestamp: 2024-10-25T21:45:05.224Z
Learning: In the `signInvokeTransactionsV3` function in `packages/starknet/lib/src/signer.dart`, it's acceptable for `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` to default to `'L2'` without additional validation when unexpected values are provided.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:08:45.593Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:83-104
Timestamp: 2024-11-21T23:08:45.593Z
Learning: In `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, for the `InvokeTransactionV3` class in Dart, data availability modes `feeDataAvailabilityMode` and `nonceDataAvailabilityMode` are used as strings 'L1' and 'L2', and enums are not required at this point.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:40:51.049Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:320-332
Timestamp: 2024-10-26T14:40:51.049Z
Learning: In the `signDeclareTransactionV3` function in `packages/starknet/lib/src/signer.dart`, the `resourceBounds` values `'l1_gas'` and `'l2_gas'` are validated in the calling function.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2025-04-23T08:24:11.775Z
Learnt from: ptisserand
PR: focustree/starknet.dart#505
File: packages/starknet/test/argent/argent_test.dart:389-390
Timestamp: 2025-04-23T08:24:11.775Z
Learning: In the starknet.dart library, `defaultMaxFee` is exported from the `static_config` module and is available to files that import the Starknet package without requiring an explicit import of the static_config module.
Applied to files:
packages/wallet_kit/lib/widgets/nft_details.dart
packages/ark_project/lib/src/ark_starknet.dart
📚 Learning: 2024-11-21T18:27:17.609Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:156-176
Timestamp: 2024-11-21T18:27:17.609Z
Learning: In Dart's `estimate_fee.dart` file, the `BroadcastedDeclareTxnV3` class for version 3 declare transactions does not require a `maxFee` field, as `maxFee` is not required in version 3 declare transactions.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:07:45.157Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:83-104
Timestamp: 2024-11-21T23:07:45.157Z
Learning: In `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, for the `InvokeTransactionV3` class in Dart, when running in the devnet environment, the `tip` and `resourceBounds` fields must be hex strings instead of `Felt` because `Felt` is not supported in these fields by the devnet.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:10:45.088Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:193-206
Timestamp: 2024-11-21T23:10:45.088Z
Learning: In `packages/starknet/lib/src/signer.dart`, when function parameters in methods like `signTransactions` are initialized with default values in the method signature, they cannot be null at runtime, so force unwrapping such parameters is acceptable.
Applied to files:
packages/ark_project/lib/src/ark_starknet.dart
packages/starknet/lib/src/account.dart
📚 Learning: 2024-12-16T16:05:56.413Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#423
File: packages/starknet/lib/src/account.dart:17-19
Timestamp: 2024-12-16T16:05:56.413Z
Learning: In the Dart file `packages/starknet/lib/src/account.dart`, the `AccountSupportedTxVersion` enum should continue to include the `v0` variant, as retaining support for transaction version 0 is required at this time according to the maintainer's preference.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T23:14:56.972Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet/lib/src/signer.dart:41-48
Timestamp: 2024-11-21T23:14:56.972Z
Learning: In the file `packages/starknet/lib/src/signer.dart`, when gas bounds computation logic is repeated across methods `signInvokeTransactionsV3`, `signDeclareTransactionV3`, and `signDeployAccountTransactionV3`, the team prefers to keep the logic within each method rather than refactoring into a shared helper method.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:23:43.886Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:37-46
Timestamp: 2024-10-28T19:23:43.886Z
Learning: In the Dart file `packages/starknet/lib/src/signer.dart`, the `signInvokeTransactionsV3` function includes `resourceBounds` validation to ensure correctness when used by different callers in the future, even if this validation might currently be redundant.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:39:12.257Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/test/account_test.dart:0-0
Timestamp: 2024-10-22T20:39:12.257Z
Learning: In `packages/starknet/test/account_test.dart`, when declaring `ResourceBounds`, `maxAmount` and `maxPricePerUnit` are intentionally passed as hex strings.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:25:12.812Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/test/account_test.dart:124-133
Timestamp: 2024-10-28T19:25:12.812Z
Learning: In `packages/starknet/test/account_test.dart`, it's acceptable to duplicate resource bounds configuration in test cases for better understanding.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:31:58.467Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/test/account_test.dart:124-133
Timestamp: 2024-10-22T20:31:58.467Z
Learning: In `packages/starknet/test/account_test.dart`, within the `declare` method tests, the resource bounds values are intended to be specified as hex strings rather than `BigInt` values.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T15:03:55.718Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/account.dart:382-411
Timestamp: 2024-10-26T15:03:55.718Z
Learning: Error handling for parsing resource bounds in the `declare` method of the `Account` class has already been addressed in a previous pull request dependency.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:39:43.845Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/signer.dart:198-201
Timestamp: 2024-10-26T14:39:43.845Z
Learning: In `packages/starknet/lib/src/signer.dart`, the `resourceBounds` parameter passed to `signTransactions` is already validated in the caller function to ensure it contains the required keys before being passed to `signInvokeTransactionsV3`.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:59:26.758Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:103-106
Timestamp: 2024-10-26T14:59:26.758Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, within the `ResourceBounds` class, the fields `maxAmount` and `maxPricePerUnit` must remain as `String` type because they need to be sent as strings to the target host.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-29T18:18:05.278Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/contract/contract.dart:69-70
Timestamp: 2024-10-29T18:18:05.278Z
Learning: Validation of `resourceBounds` in `Contract.execute(...)` in `packages/starknet/lib/src/contract/contract.dart` is performed in other functions, so additional validation in `Contract.execute` is not necessary.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T19:35:08.342Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/types/felt.dart:42-48
Timestamp: 2024-10-22T19:35:08.342Z
Learning: In `packages/starknet/lib/src/types/felt.dart`, in the `Felt` class, the subtraction operator `operator -(Felt other)` should throw an error if the result is negative, rather than performing modular subtraction.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T19:40:06.263Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:90-90
Timestamp: 2024-10-22T19:40:06.263Z
Learning: In `packages/starknet_provider/lib/src/model/declare_transaction.dart`, the `tip` field in `DeclareTransactionV3` should remain a `String` because the target node doesn't support a `Felt` type for this field.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-12-16T15:57:37.287Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#423
File: packages/starknet/lib/src/types/felt.dart:16-22
Timestamp: 2024-12-16T15:57:37.287Z
Learning: In the `Felt` class (`packages/starknet/lib/src/types/felt.dart`), the constructor validates that `_bigInt` is less than the prime field modulus, so additional checks in the operator overloads (like `<<`) are unnecessary.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:20:40.540Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/invoke_transaction.dart:88-88
Timestamp: 2024-10-28T19:20:40.540Z
Learning: In `InvokeTransactionV3` class in `packages/starknet_provider/lib/src/model/invoke_transaction.dart`, the `tip` field is defined as a `String` because the development environment doesn't support a `Felt` type for this field.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T19:33:42.319Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet/lib/src/types/felt.dart:15-22
Timestamp: 2024-10-22T19:33:42.319Z
Learning: In the `Felt` class (`packages/starknet/lib/src/types/felt.dart`), when implementing operators like `<<` and `>>`, if the result exceeds `prime`, an error should be thrown instead of performing modular reduction.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:15:23.925Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/lib/src/account.dart:221-235
Timestamp: 2024-10-28T19:15:23.925Z
Learning: In `packages/starknet/lib/src/account.dart`, try-catch clauses are used to handle null values instead of explicit null checks.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-28T19:27:13.737Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet/test/types/felt_test.dart:12-29
Timestamp: 2024-10-28T19:27:13.737Z
Learning: In `packages/starknet/test/types/felt_test.dart`, for the `Felt` class operator tests, the current test cases are sufficient, and additional error condition tests are not necessary.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-22T20:26:41.551Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:64-65
Timestamp: 2024-10-22T20:26:41.551Z
Learning: In `DeclareTransactionV2`, the `max_fee` field is of type `String` because the target RPC host doesn't support the `Felt` data type due to its length.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-11-21T18:25:36.194Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#417
File: packages/starknet_provider/lib/src/model/estimate_fee.dart:204-223
Timestamp: 2024-11-21T18:25:36.194Z
Learning: In v3 deploy account transactions (`BroadcastedDeployAccountTxnV3`), `maxFee` is not required.
Applied to files:
packages/starknet/lib/src/account.dart
📚 Learning: 2024-10-26T14:58:32.673Z
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: packages/starknet_provider/lib/src/model/declare_transaction.dart:91-91
Timestamp: 2024-10-26T14:58:32.673Z
Learning: In `declare_transaction.dart`, the `resourceBounds` map currently only supports 2 hardcoded types, but this may change in the future.
Applied to files:
packages/starknet/lib/src/account.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: analyze
- GitHub Check: lint
- GitHub Check: test-integration
🔇 Additional comments (9)
packages/ark_project/lib/src/ark_starknet.dart (5)
87-125
: Good implementation of the fee estimation patternThe implementation correctly handles the gas field coalescing and conditionally estimates fees when all parameters are zero. The pattern of checking all six gas fields and calling
getEstimateMaxFeeForInvokeTx
with the appropriate function calls is well-structured.
193-226
: Consistent null coalescing pattern applied correctlyThe implementation maintains consistency with the createListing method - properly coalescing null values and checking all six gas fields before estimation.
323-361
: Proper gas field handling in createOfferThe null coalescing and fee estimation logic follows the same robust pattern as other methods, ensuring consistent behavior across the API.
441-479
: Well-structured fee estimation for fulfillListingThe implementation correctly handles the approval and fulfillment flow with proper gas field management.
556-593
: Consistent implementation for fulfillOfferThe method follows the established pattern with proper null coalescing and fee estimation for the NFT approval and order fulfillment flow.
packages/starknet/lib/src/account.dart (3)
24-25
: Good deprecation notice for v1 transactionsThe deprecation of v1 transactions aligns well with the migration to v3 transaction format throughout the codebase.
31-49
: Well-structured FeeEstimations refactorThe new structure with separate L1/L2 gas consumed and price fields provides more granular control over fee estimation, which aligns with the v3 transaction format requirements.
793-814
: Clean resource bounds mapping implementationThe
_getResourceBounds
method correctly maps the gas parameters to the expected resource bounds structure with L1 gas, L1 data gas, and L2 gas categories.packages/starknet/tool/declare_contract0.dart (1)
19-22
: Correct usage of the updated declare APIThe addition of the
compiledClassHash
parameter aligns with the v3 declare transaction requirements. The implementation correctly passes the class hash computed from the compiled contract.
Closes issue #446 and issue #546 and issue #557
Summary by CodeRabbit
New Features
Refactor
Documentation
Tests
Chores