Skip to content
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

Serialize contract with borsh #734

Merged
merged 4 commits into from
Jul 27, 2024
Merged

Conversation

volovyks
Copy link
Collaborator

No description provided.

@volovyks volovyks requested a review from ChaoticTempest July 26, 2024 14:10
@volovyks
Copy link
Collaborator Author

@ChaoticTempest it is failing with status: Failure(ActionError(ActionError { index: Some(0), kind: FunctionCallError(ExecutionError("Smart contract panicked: panicked at contract/src/lib.rs:215:1:\nFailed to deserialize input from JSON.: Error(\"expected value\", line: 1, column: 1)")) })),.
Seams like I can not convince it that we are using borsh.

@volovyks
Copy link
Collaborator Author

We can choose another approach, read it as env::input(), not a function parameter.

CLI example.

Example from sputnik.
Thanks @gagdiez

I have not looked yet, but Illya suggested taking a look at the Aurora contract.

@ChaoticTempest
Copy link
Member

@volovyks so I tested how much gas a 4mb payload (the limit of a transaction) would take. It's about 93TGas, so we at least have 200TGas to use for the rest of the function which is just storing the contract code anyways.

It doesn't have to be this efficient quite yet plus this is just an interface the node will be using so we can change it at will

@ChaoticTempest
Copy link
Member

also, not sure why the multichain-contract test is not running. It should be listening into the the files changes under chain-signature/contract/**

@ChaoticTempest ChaoticTempest marked this pull request as ready for review July 27, 2024 02:15
@ChaoticTempest ChaoticTempest force-pushed the serhii/borsh_contract branch 5 times, most recently from 60c32bf to 3660d89 Compare July 27, 2024 02:28
Copy link

Terraform Feature Environment Destroy (dev-734)

Terraform Initialization ⚙️success

Terraform Destroy success

Show Destroy Plan


No changes. No objects need to be destroyed.

Either you have not created any objects yet or the existing objects were
already deleted outside of Terraform.

Destroy complete! Resources: 0 destroyed.

Pusher: @ChaoticTempest, Action: pull_request, Working Directory: ``, Workflow: Terraform Feature Env (Destroy)

@ChaoticTempest ChaoticTempest force-pushed the serhii/borsh_contract branch from 3660d89 to ba883b6 Compare July 27, 2024 02:32
@ChaoticTempest
Copy link
Member

huh the multichain contract workflow was disabled for some reason

@ChaoticTempest ChaoticTempest force-pushed the serhii/borsh_contract branch from ba883b6 to a0af8e5 Compare July 27, 2024 02:37
@ChaoticTempest ChaoticTempest merged commit 037e0a7 into develop Jul 27, 2024
4 checks passed
@ChaoticTempest ChaoticTempest deleted the serhii/borsh_contract branch July 27, 2024 02:49
Copy link

Terraform Feature Environment Destroy (dev-734)

Terraform Initialization ⚙️success

Terraform Destroy success

Show Destroy Plan


No changes. No objects need to be destroyed.

Either you have not created any objects yet or the existing objects were
already deleted outside of Terraform.

Destroy complete! Resources: 0 destroyed.

Pusher: @ChaoticTempest, Action: pull_request, Working Directory: ``, Workflow: Terraform Feature Env (Destroy)

.args_json(serde_json::json!({
"code": &new_wasm,
}))
.args_borsh((current_contract(),))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChaoticTempest how do additional brackets help here? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Borsh serialization expects an iterable list of args. Adding (T,) makes it into a tuple type that is iterable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants