-
Notifications
You must be signed in to change notification settings - Fork 632
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
feat: draft implementation of NEP-366 (fork) #8385
Conversation
This is a draft implementation of NEP-366 (near/NEPs#366) Not done yet: * Need to implement DelegateAction for implicit accounts (nonce problem) * Need new error codes for DelegateAction * Implement Fees for DelegateAction * Add tests
* Removed published_id * Added sender_id to DelegateAction * All things are verified when action is processing except verification of DelegateAction count in the transaction and verification wheher DelegateAction contains the nested ones * Added block_hash, nonce, public_key fields to DelegateAction * Gas is refunded to Transaction signer, deposit is refund to Receipt predecessor (because publisher_id has been removed) Need to be done: 1. `block_hash` isn't verified because there is not access to Store from `runtime' 2. Need to apply recommendation to `action_array_serde`: https://near.zulipchat.com/#narrow/stream/295302-general/topic/recursive.20types.20in.20borsh-rs/near/305181116 3. Need to add unit tests
* Handle a nested DelegateAction while the parent one is deserialized
1. Charge the inner actions' `send_fee` on Relayer shard and prepaid the `send_fee` for Sender shard 2. Burn the inner actions' `send_fee` on Sender shard (when DelegateAction is processed)
The feature flag enables DelegateAction support
This test fails if "protocol_feature_delegate_action" is disabled. Therefore another version of this test has been added which works on stable build.
Cause: runtime::config_store::tests::test_json_unchanged fails The following command created the snapshots: `cargo insta test --accept -p near-primitives -- test_json_unchanged`
- Update PROTOCOL_VERSION - Update ProtocolFeature::DelegateAction version number
Instead of relying on deserialization failing, remove the new action completely from non-nightly code. This should give us more confidence to merge this PR into nearcore.
@mm-near I have added a ton of While this can look a bit messy, I think it simplifies the PR a lot in terms of risks. Most code is now trivially ok to merge because it is only active in nightly. Ssuch as the PTAL if there is anything left you want resolved before we merge this. |
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.
Looks good - thanks !
BTW - there is a small compilation error when compiling with feature enabled (cargo build -p neard --features protocol_feature_nep366_delegate_action)
Fixed, thanks! |
A fork of near#7497 Nearcore code owners currently don't have permissions to change the original PR, so we will add the necessary changes here before merging. This is also merged with the current master.
A fork of #7497
Nearcore code owners currently don't have permissions to change the
original PR, so we will add the necessary changes here before merging.
This is also merged with the current master.
Original authors that came up with the implementation and design:
@e-uleyskiy
@fadeevab
See also NEP-366