-
Notifications
You must be signed in to change notification settings - Fork 17
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
Request counter #531
Request counter #531
Conversation
@@ -49,7 +49,8 @@ pub enum ProtocolContractState { | |||
#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] | |||
pub struct MpcContract { | |||
protocol_state: ProtocolContractState, | |||
pending_requests: TreeMap<[u8; 32], Option<(String, String)>>, | |||
pending_requests: LookupMap<[u8; 32], Option<(String, String)>>, | |||
request_counter: u32, |
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.
this will break contract I'm guessing? since when it was initialzed it did not have this field.
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.
It depends on how borsh deserialization works, I have not tested it. I belive it should be initialized on the first sign
call.
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.
here's an example of how we can migrate state: https://github.com/near/near-sdk-rs/blob/1408127feefb37e7f84eba25984af18af46cd91d/examples/test-contract/src/lib.rs#L20
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.
so we need a new function similar to clean
but ignores the state
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.
Let me try deploying an old contract and then redeploy to this one to see if it works
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.
yep. I got this error ```
kind: {
ExecutionError: 'Smart contract panicked: panicked at /Users/xiangyiz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/near-sdk-5.0.0-alpha.2/src/environment/env.rs:921:46:\n' +
'Cannot deserialize the contract state.: Custom { kind: InvalidData, error: "Unexpected length of input" }'
},
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.
all 3 contracts migrated
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.
k, migration function deleted
Terraform Feature Environment (dev-531)Terraform Initialization ⚙️
|
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.
We should move to versioned contracts so this process is a lot easier: #545
Terraform Feature Environment Destroy (dev-531)Terraform Initialization ⚙️
|
No description provided.