Skip to content

Commit

Permalink
Added update_snapshot ext (#633)
Browse files Browse the repository at this point in the history
## Describe your changes
1. Added update_snapshot ext.
2. Made submit_snapshot ext feeless.
3. Updated spec_version to 282.
  • Loading branch information
serhii-temchenko committed Feb 9, 2023
2 parents cf5775d + bccc722 commit a1b31bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ jobs:
- name: Run Cargo Trampulin
uses: actions-rs/tarpaulin@v0.1
with:
args: '--exclude polkadex-node node-polkadex-runtime --workspace --timeout 180'
version: '0.22.0'
args: '--avoid-cfg-tarpaulin --exclude polkadex-node node-polkadex-runtime --workspace --timeout 180'
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
Expand Down
12 changes: 10 additions & 2 deletions pallets/ocex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,14 @@ pub mod pallet {
})
}

//TODO: Benchmark set_snapshot
#[pallet::weight(<T as Config>::WeightInfo::submit_snapshot())]
pub fn set_snapshot(origin: OriginFor<T>, new_snapshot_id: u32) -> DispatchResult {
T::GovernanceOrigin::ensure_origin(origin)?;
<SnapshotNonce<T>>::put(new_snapshot_id);
Ok(())
}

/// Extrinsic used by enclave to submit balance snapshot and withdrawal requests
#[pallet::weight(<T as Config>::WeightInfo::submit_snapshot())]
pub fn submit_snapshot(
Expand All @@ -749,7 +757,7 @@ pub mod pallet {
SnapshotAccLimit,
>,
signature: T::Signature,
) -> DispatchResult {
) -> DispatchResultWithPostInfo {
let _ = ensure_signed(origin)?;
ensure!(
<RegisteredEnclaves<T>>::contains_key(&snapshot.enclave_id),
Expand Down Expand Up @@ -799,7 +807,7 @@ pub mod pallet {
snapshot.fees = Default::default();
<Snapshots<T>>::insert(current_snapshot_nonce, snapshot.clone());
<SnapshotNonce<T>>::put(current_snapshot_nonce);
Ok(())
Ok(Pays::No.into())
}

// FIXME Only for testing will be removed before mainnet launch
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 280,
spec_version: 282,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down

0 comments on commit a1b31bd

Please sign in to comment.