Skip to content
Snippets Groups Projects
Select Git revision
  • a1307555a5b9d4b69e66d4a8b00456a105e8855b
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
41 results

upgrade-substrate.md

Blame
    • Benjamin Gallois's avatar
      31a25023
      Upgrade to Polkadot v0.9.42 (!172) · 31a25023
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * allow clippy needless_pass_by_ref_mut
      
      * fix clippy
      
      °_°
      
      * fix provider behavior
      
      * fix build errors
      
      * change behavior of going below ED
      
      * fix provider initialization
      
      * add mock epoch change
      
      * add session number test
      
      * add session number test
      
      * WIP fix tests
      
      * fix time-based ud test
      
      * update metadata
      
      * FIX apply all fix from flash branch
      
      * partial fix clippy
      
      other suggestions are not legit
      
      * fix metadata and end2end test
      
      * fix build tests
      
      * fix build and clippy
      
      * remove benchmark of upgrade_accounts
      
      this happens in substrate dependency
      I also updated other packages because why not :D
      and I removed a useless implementation in mock
      but the test do not compile with feature runtime benchmarks anyway
      
      * test_total_issuance_vs_monetary_mass
      
      * proofreading comment
      
      * fix total issuance differently
      
      this actually fixes total issuance at genesis
      instead of creating duplicate account data
      
      * fix test scenario
      
      the thing tested here was not the ability to call the function,
      but the impossibility of deleting the account
      
      * add comment to explain test
      
      * fix providers and sufficients counts
      
      * fix initial balance
      
      * fix initial TotalIssuance
      
      * fix clippy warnings and optimization
      
      * fix xtask
      
      * update docs
      
      * add DustHandle
      
      * fix pallets config
      
      * fix tests
      
      * fix pallet_balance genesis config
      
      * wip: fix end2end-test
      
      * fix manual and instant sealing
      
      * fix live-tests
      
      * fix offences after rebase
      
      * generate all weights
      
      * add rust toolchain file
      
      * fix benchmarks
      
      Pallet balances benchmarks need https://github.com/duniter/substrate/commit/c36ab4f32454318a47777b24b6533c44121fc10b because pallet duniter-account add another provider.
      
      * fix babe-worker
      
      * fix subxt dependency
      
      * fix ImplicitCallIndex and Weight::from_ref_time deprecation
      
      * fix consensus_babe dependency
      
      * regenerate weights
      
      Regenerate all weights except for pallet-balance failing on one extrinsic
      
      * workaround pallet_duniter_account
      
      Workaround to be able to pass https://github.com/paritytech/substrate/blob/6ef184e33f6ce0f56999ae84b212ea6148c0624d/frame/balances/src/benchmarking.rs#L271 in the benchmark.
      ExtraFlags is private and Default is always new_logic not suitable for the benchmark.
      
      * wip fix node errors
      
      * wip fix runtime errors
      
      * fix pallet-duniter-account errors
      
      * fix pallet-balance errors
      
      * fix pallet-identity errors
      
      * fix pallet-duniter-account errors
      
      * upgrade Cargo files
      
      * update docs
      31a25023
      History
      Upgrade to Polkadot v0.9.42 (!172)
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * allow clippy needless_pass_by_ref_mut
      
      * fix clippy
      
      °_°
      
      * fix provider behavior
      
      * fix build errors
      
      * change behavior of going below ED
      
      * fix provider initialization
      
      * add mock epoch change
      
      * add session number test
      
      * add session number test
      
      * WIP fix tests
      
      * fix time-based ud test
      
      * update metadata
      
      * FIX apply all fix from flash branch
      
      * partial fix clippy
      
      other suggestions are not legit
      
      * fix metadata and end2end test
      
      * fix build tests
      
      * fix build and clippy
      
      * remove benchmark of upgrade_accounts
      
      this happens in substrate dependency
      I also updated other packages because why not :D
      and I removed a useless implementation in mock
      but the test do not compile with feature runtime benchmarks anyway
      
      * test_total_issuance_vs_monetary_mass
      
      * proofreading comment
      
      * fix total issuance differently
      
      this actually fixes total issuance at genesis
      instead of creating duplicate account data
      
      * fix test scenario
      
      the thing tested here was not the ability to call the function,
      but the impossibility of deleting the account
      
      * add comment to explain test
      
      * fix providers and sufficients counts
      
      * fix initial balance
      
      * fix initial TotalIssuance
      
      * fix clippy warnings and optimization
      
      * fix xtask
      
      * update docs
      
      * add DustHandle
      
      * fix pallets config
      
      * fix tests
      
      * fix pallet_balance genesis config
      
      * wip: fix end2end-test
      
      * fix manual and instant sealing
      
      * fix live-tests
      
      * fix offences after rebase
      
      * generate all weights
      
      * add rust toolchain file
      
      * fix benchmarks
      
      Pallet balances benchmarks need https://github.com/duniter/substrate/commit/c36ab4f32454318a47777b24b6533c44121fc10b because pallet duniter-account add another provider.
      
      * fix babe-worker
      
      * fix subxt dependency
      
      * fix ImplicitCallIndex and Weight::from_ref_time deprecation
      
      * fix consensus_babe dependency
      
      * regenerate weights
      
      Regenerate all weights except for pallet-balance failing on one extrinsic
      
      * workaround pallet_duniter_account
      
      Workaround to be able to pass https://github.com/paritytech/substrate/blob/6ef184e33f6ce0f56999ae84b212ea6148c0624d/frame/balances/src/benchmarking.rs#L271 in the benchmark.
      ExtraFlags is private and Default is always new_logic not suitable for the benchmark.
      
      * wip fix node errors
      
      * wip fix runtime errors
      
      * fix pallet-duniter-account errors
      
      * fix pallet-balance errors
      
      * fix pallet-identity errors
      
      * fix pallet-duniter-account errors
      
      * upgrade Cargo files
      
      * update docs
    message-controllers.js 17.02 KiB
    angular.module('cesium.es.message.controllers', ['cesium.es.services', 'cesium.es.message.controllers'])
    
      .config(function($stateProvider) {
        'ngInject';
    
        $stateProvider
    
          .state('app.user_message', {
            url: "/user/message?type",
            views: {
              'menuContent': {
                templateUrl: "plugins/es/templates/message/list.html",
                controller: 'ESMessageListCtrl'
              }
            }
          })
    
          .state('app.user_new_message', {
            cache: false,
            url: "/user/message/new?pubkey&uid",
            views: {
              'menuContent': {
                templateUrl: "plugins/es/templates/message/compose.html",
                controller: 'ESMessageComposeCtrl'
              }
            }
          })
    
          .state('app.user_view_message', {
            cache: false,
            url: "/user/message/view/:type/:id",
            views: {
              'menuContent': {
                templateUrl: "plugins/es/templates/message/view_message.html",
                controller: 'ESMessageViewCtrl'
              }
            }
          })
    
        ;
      })
    
      .controller('ESMessageListCtrl', ESMessageListController)
    
      .controller('ESMessageComposeCtrl', ESMessageComposeController)
    
      .controller('ESMessageComposeModalCtrl', ESMessageComposeModalController)
    
      .controller('ESMessageViewCtrl', ESMessageViewController)
    
      .controller('PopoverMessageCtrl', PopoverMessageController)
    
    ;
    
    function ESMessageListController($scope, $rootScope, $state, $timeout, $translate, $ionicHistory, $ionicPopover,
                                     esModals, UIUtils, esMessage) {
      'ngInject';
    
      $scope.loading = true;
      $scope.messages = [];
    
      $scope.$on('$ionicView.enter', function(e, state) {
    
        $scope.loadWallet({minData: true})
          .then(function() {
            if (!$scope.entered) {
              $scope.entered = true;
              $scope.type = state.stateParams && state.stateParams.type || 'inbox';
              $scope.load();
            }
    
            $scope.showFab('fab-add-message-record');
          })
          .catch(function(err) {
            if ('CANCELLED' === err) {
              $ionicHistory.nextViewOptions({
                historyRoot: true
              });
              $state.go('app.home');
            }
        });
      });
    
      $scope.load = function(size, offset) {
        var options  = {};
        options.from = offset || 0;
        options.size = size || 20;
        options.type = $scope.type;
    
        $scope.loading = true;
        return esMessage.load($rootScope.walletData.keypair, options)
          .then(function(messages) {
            $scope.messages = messages;
    
            UIUtils.loading.hide();
            $scope.loading = false;
    
            if (messages.length > 0) {
              // Set Motion
              $timeout(function() {
                UIUtils.motion.ripple({
                  startVelocity: 3000
                });
                // Set Ink
                UIUtils.ink();
              });
            }
          })
          .catch(function(err) {
            UIUtils.onError('MESSAGE.ERROR.LOAD_MESSAGES_FAILED')(err);
            $scope.messages = [];
            $scope.loading = false;
          });
      };
    
      $scope.setType = function(type) {
        $scope.type = type;
        $scope.load();
      };
    
      $scope.markAllAsRead = function() {
        $scope.hideActionsPopover();
        if (!$scope.messages || !$scope.messages.length) return;
    
        UIUtils.alert.confirm('MESSAGE.CONFIRM.MARK_ALL_AS_READ')
          .then(function(confirm) {
            if (confirm) {
              esMessage.markAllAsRead()
                .then(function () {
                  _.forEach($scope.messages, function(msg){
                    msg.read = true;
                  });
                })
                .catch(UIUtils.onError('MESSAGE.ERROR.MARK_ALL_AS_READ_FAILED'));
            }
          });
      };
    
      $scope.delete = function(index) {
        var message = $scope.messages[index];
        if (!message) return;
    
        UIUtils.alert.confirm('MESSAGE.CONFIRM.REMOVE')
          .then(function(confirm) {
            if (confirm) {
              esMessage.remove(message.id, $scope.type)
                .then(function () {
                  $scope.messages.splice(index,1); // remove from messages array
                  UIUtils.toast.show('MESSAGE.INFO.MESSAGE_REMOVED');
                })
                .catch(UIUtils.onError('MESSAGE.ERROR.REMOVE_MESSAGE_FAILED'));
            }
          });
      };
    
      $scope.deleteAll = function() {
        $scope.hideActionsPopover();
        if (!$scope.messages || !$scope.messages.length) return;
    
        UIUtils.alert.confirm('MESSAGE.CONFIRM.REMOVE_ALL')
          .then(function(confirm) {
            if (confirm) {
              esMessage.removeAll($scope.type)
                .then(function () {
                  $scope.messages.splice(0,$scope.messages.length); // reset array
                  UIUtils.toast.show('MESSAGE.INFO.All_MESSAGE_REMOVED');
                })
                .catch(UIUtils.onError('MESSAGE.ERROR.REMOVE_All_MESSAGES_FAILED'));
            }
          });
      };
    
      /* -- Modals -- */
    
      $scope.showNewMessageModal = function(parameters) {
        return $scope.loadWallet({minData: true})
          .then(function() {
            UIUtils.loading.hide();
            return esModals.showMessageCompose(parameters)
              .then(function(sent) {
                if (sent) UIUtils.toast.show('MESSAGE.INFO.MESSAGE_SENT');
              });
          });
      };
    
      $scope.showReplyModal = function(index) {
        var message = $scope.messages[index];
        if (!message) return;
    
        $translate('MESSAGE.REPLY_TITLE_PREFIX')
          .then(function (prefix) {
            var content = message.content ? message.content.replace(/^/g, ' > ') : null;
            content = content ? content.replace(/\n/g, '\n > ') : null;
            content = content ? content +'\n' : null;
            return esModals.showMessageCompose({
              destPub: message.issuer,
              destUid: message.name||message.uid,
              title: prefix + message.title,
              content: content,
              isReply: true
            });
          })
          .then(function(sent) {
            if (sent) UIUtils.toast.show('MESSAGE.INFO.MESSAGE_SENT');
          });
      };
    
      /* -- Popover -- */
    
      $scope.showActionsPopover = function(event) {
        if (!$scope.actionsPopover) {
          $ionicPopover.fromTemplateUrl('plugins/es/templates/message/popover_actions.html', {
            scope: $scope
          }).then(function(popover) {
            $scope.actionsPopover = popover;
            //Cleanup the popover when we're done with it!
            $scope.$on('$destroy', function() {
              $scope.actionsPopover.remove();
            });
            $scope.actionsPopover.show(event);
          });
        }
        else {
          $scope.actionsPopover.show(event);
        }
      };
    
      $scope.hideActionsPopover = function() {
        if ($scope.actionsPopover) {
          $scope.actionsPopover.hide();
        }
      };
    
    
      // for DEV only
      /*$timeout(function() {
        $scope.showNewMessageModal();
       }, 900);
       */
    }
    
    
    function ESMessageComposeController($scope,  $ionicHistory, Modals, UIUtils, CryptoUtils, csWallet, esHttp, esMessage) {
      'ngInject';
    
      ESMessageComposeModalController.call(this, $scope, Modals, UIUtils, CryptoUtils, csWallet, esHttp, esMessage);
    
      $scope.$on('$ionicView.enter', function(e, state) {
        if (!!state.stateParams && !!state.stateParams.pubkey) {
          $scope.formData.destPub = state.stateParams.pubkey;
          if (!!$state.stateParams.uid) {
            $scope.destUid = state.stateParams.uid;
            $scope.destPub = '';
          }
          else {
            $scope.destUid = '';
            $scope.destPub = $scope.formData.destPub;
          }
        }
    
        $scope.loadWallet({minData: true})
          .then(function() {
            UIUtils.loading.hide();
          })
          .catch(function(err){
            if (err === 'CANCELLED') {
              $ionicHistory.nextViewOptions({
                historyRoot: true
              });
              $state.go('app.home');
            }
          });
      });
    
      $scope.cancel = function() {
        $ionicHistory.goBack();
      };
    
      $scope.setForm = function(form) {
        $scope.form = form;
      };
    
    }
    
    function ESMessageComposeModalController($scope, Modals, UIUtils, CryptoUtils, csWallet, esHttp, esMessage, parameters) {
      'ngInject';
    
      $scope.formData = {
        title: parameters ? parameters.title : null,
        content: parameters ? parameters.content : null,
        destPub: parameters ? parameters.destPub : null
      };
      $scope.destUid = parameters ? parameters.destUid : null;
      $scope.destPub = (parameters && !parameters.destUid) ? parameters.destPub : null;
      $scope.isResponse = parameters ? parameters.isResponse : false;
    
      $scope.doSend = function(forceNoContent) {
        $scope.form.$submitted=true;
        if(!$scope.form.$valid) {
          return;
        }
    
        // Ask user confirmation if no content
        if (!forceNoContent && (!$scope.formData.content || !$scope.formData.content.trim().length)) {
          return UIUtils.alert.confirm('MESSAGE.COMPOSE.CONTENT_CONFIRMATION')
            .then(function(confirm) {
              if (confirm) {
                $scope.doSend(true);
              }
            });
        }
    
        UIUtils.loading.show();
        var data = {
          issuer: csWallet.data.pubkey,
          recipient: $scope.formData.destPub,
          title: $scope.formData.title,
          content: $scope.formData.content,
          time: esHttp.date.now(),
          nonce: CryptoUtils.util.random_nonce()
        };
    
        esMessage.send(data, csWallet.data.keypair)
          .then(function(id) {
            $scope.id=id;
            UIUtils.loading.hide();
            $scope.closeModal(true);
          })
          .catch(UIUtils.onError('MESSAGE.ERROR.SEND_MSG_FAILED'));
      };
    
      /* -- Modals -- */
    
      $scope.showWotLookupModal = function() {
        Modals.showWotLookup()
          .then(function(result){
            if (result) {
              if (result.uid) {
                $scope.destUid = result.uid;
                $scope.destPub = '';
              }
              else {
                $scope.destUid = '';
                $scope.destPub = result.pubkey;
              }
              $scope.formData.destPub = result.pubkey;
              // TODO focus on title field
              //$focus('');
            }
          });
      };
    
      $scope.cancel = function() {
        $scope.closeModal();
      };
    
    
      // TODO : for DEV only
      /*$timeout(function() {
        $scope.formData.destPub = 'G2CBgZBPLe6FSFUgpx2Jf1Aqsgta6iib3vmDRA1yLiqU';
        $scope.formData.title = 'test';
        $scope.formData.content = 'test';
        $scope.destPub = $scope.formData.destPub;
    
        $timeout(function() {
          //$scope.doSend();
        }, 800);
      }, 100);
      */
    }
    
    
    function ESMessageViewController($scope, $state, $timeout, $translate, $ionicHistory, UIUtils, esModals, esMessage, esUser) {
      'ngInject';
    
      $scope.formData = {};
      $scope.id = null;
      $scope.loading = true;
    
      $scope.$on('$ionicView.enter', function (e, state) {
        if (state.stateParams && state.stateParams.id) { // Load by id
          if ($scope.loading) { // prevent reload if same id
            $scope.type = state.stateParams.type || 'inbox';
    
            $scope.load(state.stateParams.id, $scope.type)
              .then(function(message) {
                $scope.loading = false;
                UIUtils.loading.hide();
                if (!message) return;
    
                $scope.id = message.id;
                $scope.formData = message;
                $scope.canDelete = true;
                $timeout(function () {
                  UIUtils.motion.fadeSlideIn({
                    selector: '.view-message .animate-fade-slide-in .item',
                    startVelocity: 3000
                  });
                });
                // Mark as read
                if (!message.read) {
                  $timeout(function() {
                    // Message has NOT changed
                    if ($scope.id === message.id) {
                      esMessage.markAsRead(message, $scope.type)
                        .then(function() {
                          console.debug("[message] marked as read");
                        })
                        .catch(UIUtils.onError('MESSAGE.ERROR.MARK_AS_READ_FAILED'));
                    }
                  }, 2000); // 2s
                }
              });
          }
    
          $scope.showFab('fab-view-message-reply');
        }
        else {
          $state.go('app.user_message');
        }
      });
    
      $scope.load = function(id, type) {
        type = type || 'inbox';
    
        return $scope.loadWallet({minData: true})
          .then(function() {
            return esMessage.get({type: type, id: id});
          })
          .catch(UIUtils.onError('MESSAGE.ERROR.LOAD_MESSAGE_FAILED'))
          .then(function(message) {
            if (!message.valid) {
              return UIUtils.alert.error(!$scope.isUserPubkey(message.recipient) ? 'MESSAGE.ERROR.USER_NOT_RECIPIENT' : 'MESSAGE.ERROR.NOT_AUTHENTICATED_MESSAGE',
                'MESSAGE.ERROR.MESSAGE_NOT_READABLE')
                .then(function () {
                  $state.go('app.user_message', {type: type});
                });
            }
            return message;
          });
      };
    
      $scope.delete = function() {
        if ($scope.actionsPopover) {
          $scope.actionsPopover.hide();
        }
    
        UIUtils.alert.confirm('MESSAGE.CONFIRM.REMOVE')
          .then(function(confirm) {
            if (confirm) {
              esMessage.remove($scope.id, $scope.type)
                .then(function () {
                  $ionicHistory.nextViewOptions({
                    historyRoot: true
                  });
                  $state.go('app.user_message', {type: $scope.type});
                  UIUtils.toast.show('MESSAGE.INFO.MESSAGE_REMOVED');
                })
                .catch(UIUtils.onError('MESSAGE.ERROR.REMOVE_MESSAGE_FAILED'));
            }
          });
      };
    
      /* -- Modals -- */
    
      $scope.showReplyModal = function() {
        var recipientField = ($scope.type == 'inbox') ? 'issuer' : 'recipient';
        $translate('MESSAGE.REPLY_TITLE_PREFIX')
          .then(function (prefix) {
            var content = $scope.formData.content ? $scope.formData.content.replace(/^/g, ' > ') : null;
            content = content ? content.replace(/\n/g, '\n > ') : null;
            content = content ? content +'\n' : null;
            return esModals.showMessageCompose({
                destPub: $scope.formData[recipientField],
                destUid: $scope.formData.name||$scope.formData.uid,
                title: prefix + $scope.formData.title,
                content: content,
                isReply: true
              });
          })
          .then(function(sent) {
            if (sent) {
              UIUtils.toast.show('MESSAGE.INFO.MESSAGE_SENT')
                .then(function() {
                  $ionicHistory.goBack();
                });
            }
          })
        ;
      };
    }
    
    function PopoverMessageController($scope, $timeout, UIUtils, $state, csWallet, esNotification, esMessage, esModals) {
      'ngInject';
    
      var defaultSearchLimit = 40;
    
      $scope.search = {
        loading : true,
        results: null,
        hasMore : false,
        loadingMore : false,
        limit: defaultSearchLimit
      };
    
      $scope.load = function(from, size) {
        var options = {};
        options.from = from || 0;
        options.size = size || defaultSearchLimit;
        return esMessage.notifications.load(options)
          .then(function(notifications) {
            if (!from) {
              $scope.search.results = notifications;
            }
            else {
              $scope.search.results = $scope.search.results.concat(notifications);
            }
            $scope.search.loading = false;
            $scope.search.hasMore = ($scope.search.results && $scope.search.results.length >= $scope.search.limit);
            $scope.updateView();
          })
          .catch(function(err) {
            $scope.search.loading = false;
            if (!from) {
              $scope.search.results = [];
            }
            $scope.search.hasMore = false;
            UIUtils.onError('MESSAGE.ERROR.LOAD_NOTIFICATIONS_FAILED')(err);
          });
      };
    
      $scope.updateView = function() {
    
        // Set Motion and Ink
        $timeout(function() {
          UIUtils.ink({selector: '.popover-popover .item.ink'});
        }, 100);
      };
    
      $scope.showMore = function() {
        $scope.search.limit = $scope.search.limit || defaultSearchLimit;
        $scope.search.limit = $scope.search.limit * 2;
        if ($scope.search.limit < defaultSearchLimit) {
          $scope.search.limit = defaultSearchLimit;
        }
        $scope.search.loadingMore = true;
        $scope.load(
          $scope.search.results.length, // from
          $scope.search.limit)
          .then(function() {
            $scope.search.loadingMore = false;
            $scope.$broadcast('scroll.infiniteScrollComplete');
          });
      };
    
      $scope.onNewNotification = function(notification) {
        if (!$scope.search.loading && !$scope.search.loadingMore &&  notification.isMessage) {
          console.debug("[popover] detected new message (from notification service)");
    
          if (notification.reference) {
            console.log("[popover] new message has a reference !");
          }
          $scope.search.results.splice(0,0,notification);
          $scope.updateView();
        }
      };
    
      $scope.select = function(notification) {
        if (!notification.read) notification.read = true;
        $state.go('app.user_view_message', {id: notification.id});
        $scope.closePopover(notification);
      };
    
      $scope.resetData = function() {
        if ($scope.search.loading) return;
        console.debug("[ES] [messages] Resetting data (settings or account may have changed)");
        $scope.search.hasMore = false;
        $scope.search.results = [];
        $scope.search.loading = true;
        delete $scope.search.limit;
      };
    
      csWallet.api.data.on.logout($scope, $scope.resetData);
    
      /* -- Modals -- */
    
      $scope.showNewMessageModal = function(parameters) {
        $scope.closePopover();
        return esModals.showMessageCompose(parameters)
          .then(function(sent) {
            if (sent) UIUtils.toast.show('MESSAGE.INFO.MESSAGE_SENT');
          });
      };
    
      esNotification.api.data.on.new($scope, $scope.onNewNotification);
    
      /* -- default popover action -- */
      if ($scope.search.loading) {
        $scope.load();
      }
    
    }