-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support RPC 0.8.0 #530
base: main
Are you sure you want to change the base?
Support RPC 0.8.0 #530
Conversation
…ructured-error-trace
/** | ||
* Get merkle paths in one of the state tries. | ||
* | ||
* Get merkle paths in one of the state tries: global state, classes, individual contract. | ||
* | ||
* @param classHashes list of class hashes for which we want to prove membership | ||
* @param contractAddresses list of contract addresses for which we want to prove membership | ||
* @param contractsStorageKeys list of contract address and storage keys pairs | ||
* | ||
* @throws RequestFailedException | ||
*/ | ||
fun getStorageProof(classHashes: List<Felt>? = null, contractAddresses: List<Felt>? = null, contractsStorageKeys: List<ContractStorageKey>? = null): Request<StorageProof> | ||
|
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.
note: It's a bit exceptional situation, due to the fact that creating overloads would cause a conflict, e.g. for
fun getStorageProof(classHashes: List<Felt>, contractsStorageKeys: List<ContractStorageKey>): Request<StorageProof>
and
fun getStorageProof(contractAddresses: List<Felt>, contractsStorageKeys: List<ContractStorageKey>): Request<StorageProof>
(compiler won't know which method to use, contractAddresses
and classHashes
are of the same type). So unfortunately we need to add default values here.
note: This PR is still wip.
|
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.
I like where this is going 👍🏻 Waiting for the tests
lib/src/main/kotlin/com/swmansion/starknet/account/StandardAccount.kt
Outdated
Show resolved
Hide resolved
lib/src/main/kotlin/com/swmansion/starknet/data/types/Responses.kt
Outdated
Show resolved
Hide resolved
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<NodeHashToNodeMappingItem.MerkleNode> { | ||
val jsonElement = element.jsonObject | ||
val binaryNodeKeys = NodeHashToNodeMappingItem.BinaryNode.serializer().descriptor.elementNames.toSet() | ||
val edgeNodeKeys = NodeHashToNodeMappingItem.EdgeNode.serializer().descriptor.elementNames.toSet() | ||
|
||
return when (jsonElement.keys) { | ||
binaryNodeKeys -> NodeHashToNodeMappingItem.BinaryNode.serializer() | ||
edgeNodeKeys -> NodeHashToNodeMappingItem.EdgeNode.serializer() | ||
else -> throw IllegalArgumentException("Invalid MerkleNode JSON object: $jsonElement") | ||
} | ||
} | ||
} |
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.
note: We could potentially give an error with more meaningful message (saying which fields are missing and if it's binary/edge node). However, in case of json with keys that belong both to binary and edge node
e.g.
{
"left": ...,
"path": ...
}
we can't clearly decide which type it is intended to be (binary/edge). I'm not fully sure if such logic is worth introducing.
A simple improvement would be to display required keys for binary/edge nodes.
Describe your changes
Support RPC 0.8.0.
starknet_getStorageProof
StorageProof
,GlobalRoots
,ContractsProof
,ContractLeafData
,NodeHashToNodeMappingItem
,BinaryNode
,EdgeNode
,ContractStorageKey
data classesgetStorageProof
method inProvider
andJsonRpcProvider
starknet_getMessagesStatus
MessageStatusList
,MessageStatus
data classesgetMessagesStatus
method inProvider
andJsonRpcProvider
Account
,StandardAccount
:signDeployAccountV3
andexecuteV3
have nowresourceBounds
param instead ofl1ResourceBounds
InvokeParamsV3
,DeclareParamsV3
,DeployAccountParamsV3
:l1ResourceBounds
param toresourceBounds
in constructorEstimateFeeResponse
:gasConsumed
tol1GasConsumed
gasPrice
tol1GasPrice
dataGasPrice
tol1DataGasPrice
dataGasConsumed
tol1DataGasConsumed
l2GasConsumed
,l2GasPrice
fieldsComputationResources
and updateExecutionResources
InnerCallExecutionResources
l1Gas
inResourceBoundsMapping
computationResources
toexecutionResources
inFunctionInvocation
and change its type toInnerCallExecutionResources
instead ofComputationResources
ResourceBoundsMapping.ZERO
failureReason
toGetTransactionStatusResponse
Linked issues
Closes #519
Breaking changes
resourceBounds
instead ofl1ResourceBounds
paramComputationResources
has been removed;ExecutionResources
andEstimateFeeResponse
have been updated