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

optimize contract #40

Merged
merged 14 commits into from
Oct 26, 2023
Merged

optimize contract #40

merged 14 commits into from
Oct 26, 2023

Conversation

encody
Copy link
Contributor

@encody encody commented Oct 5, 2023

#28

@encody encody self-assigned this Oct 5, 2023
@encody encody linked an issue Oct 5, 2023 that may be closed by this pull request
@encody
Copy link
Contributor Author

encody commented Oct 5, 2023

Requires explicit borsh dependency because the version included in near-sdk does not allow us to remove std feature flag.

@dndll
Copy link
Collaborator

dndll commented Oct 11, 2023

Looks great for contract storage costs, Do we know exactly how much gas this will reduce the calls by? Would be nice to take some call from throwawaykey.testnet and give it a test to ensure this actually does do better gas-cost-wise. The other part of this would involve touching da-rpc to serialise the data with borsh before we send it over.

@encody
Copy link
Contributor Author

encody commented Oct 12, 2023

NEAR smart contracts cannot be built on Rust versions newer than 1.69 (you get a deserialization error from the node).

@dndll
Copy link
Collaborator

dndll commented Oct 12, 2023

NEAR smart contracts cannot be built on Rust versions newer than 1.69 (you get a deserialization error from the node).

This was fixed actually. It just doesn't work for sandboxes-rs. I've been building and deploying with this environment for as long as I've been working on the project. (I think the issue is only instantiation)

@encody
Copy link
Contributor Author

encody commented Oct 12, 2023

@dndll Ah, workspaces just fixed it, but released under a different name for some reason (workspaces -> near-workspaces). https://crates.io/crates/near-workspaces

@encody
Copy link
Contributor Author

encody commented Oct 12, 2023

I did some simple tests locally.

Test Gas cost
main branch (1 blob) 5.8 TGas
this branch (1 blob) 5.3 TGas
main branch (100 blobs) 15.1 TGas
this branch (100 blobs) 6.0 TGas

@encody encody marked this pull request as ready for review October 17, 2023 16:24
@encody encody requested a review from firatNEAR October 19, 2023 13:40
Copy link
Contributor

@firatNEAR firatNEAR left a comment

Choose a reason for hiding this comment

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

LGTM, but would be good if @dndll takes another look.

@dndll
Copy link
Collaborator

dndll commented Oct 23, 2023

This is great, but we are still missing the modifications to the rust client, right now this update would break such.

Copy link
Collaborator

@dndll dndll left a comment

Choose a reason for hiding this comment

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

Please could you update the da-rpc client to support this change to the submit API? (it should be incredibly simple)

@firatNEAR
Copy link
Contributor

firatNEAR commented Oct 25, 2023

@encody could we get this PR in soon? Is there anything that we can do to help? We are looking to audit the contract as soon as possible after this change is in.

Copy link
Collaborator

@dndll dndll left a comment

Choose a reason for hiding this comment

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

new changes look good!

@dndll
Copy link
Collaborator

dndll commented Oct 25, 2023

This test that is failing is because it used to be serialised with json and now not. Let's just put an ignore marker on that test since we don't have integration tests and this is a chicken and egg scenario

@dndll dndll merged commit 339e083 into main Oct 26, 2023
3 checks passed
@dndll dndll deleted the encody/28-optimize-contract branch October 26, 2023 12:14
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.

Optimise gas calls for contract layer
3 participants