您正在查看: EOS-新手问答 分类下的文章

EOS 部署合约出现 deadline ? exceeded by ?us

测试环境

OS: Ubuntu 18.04 server
EOS: v2.0.1
合约:v1.9.1

部署系统合约时出现以下错误

error 2020-02-07T03:05:55.178 cleos     main.cpp:4042                 main                 ] Failed with error: deadline 2020-02-07T03:05:55.175 exceeded by 43us  (2)
deadline 2020-02-07T03:05:55.175 exceeded by 43us

跟下代码(跳转github

#define FC_CHECK_DEADLINE( DEADLINE, ... ) \
  FC_MULTILINE_MACRO_BEGIN \
    if( DEADLINE < fc::time_point::maximum() && DEADLINE < fc::time_point::now() ) { \
       auto log_mgs = FC_LOG_MESSAGE( error, "deadline ${d} exceeded by ${t}us ", \
             FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("d", DEADLINE)("t", fc::time_point::now() - DEADLINE) ); \
       auto msg = log_mgs.get_limited_message(); \
       throw timeout_exception( std::move( log_mgs ), timeout_exception_code, "timeout_exception", std::move( msg ) ); \
    } \
  FC_MULTILINE_MACRO_END

跟踪宏的调用 (跳转github

string exception::to_string( log_level ll   )const
   {
      const auto deadline = fc::time_point::now() + format_time_limit;
      std::stringstream ss;
      try {
         ss << my->_what;
         try {
            ss << " (" << variant( my->_code ).as_string() << ")\n";
         } catch( std::bad_alloc& ) {
            throw;
         } catch( ... ) {
            ss << "<- exception in to_string.\n";
         }
         for( auto itr = my->_elog.begin(); itr != my->_elog.end(); ++itr ) {
            try {
               FC_CHECK_DEADLINE(deadline);

查看 main.cpp:4042跳转github

if (!print_recognized_errors(e, verbose)) {
         // Error is not recognized
         if (!print_help_text(e) || verbose) {
            elog("Failed with error: ${e}", ("e", verbose ? e.to_detail_string() : e.to_string()));
         }
      }

发现该异常,为解析异常错误导致的解析超时错误,并非当时真实的错误。
继续查找 https://github.com/EOSIO/eos/issues/8443

2.0和1.8.9包括新的选项http-max-response-time-ms,该选项有助于减轻api节点的滥用。它允许您指定处理请求的时间限制。当前,这意味着将响应转换为json所需的时间受到限制,这是大多数api请求中最耗时的部分。我们将默认值设为30毫秒,以匹配默认的max-transaction-time。对于大块,30ms可能不足以让您的节点转换为json。当然取决于硬件等。随时随地将它放置在任何级别,您可以满足任何一个处理请求的要求。

解决方法

http-max-response-time-ms参数修改为30毫秒

http-max-response-time-ms = 30

参考

https://github.com/EOSIO/eos/issues/8443
https://github.com/EOSIO/eos/releases/tag/v1.8.9

EOS v2.0.x 打deb 包

测试系统

os: ubuntu 18.04 server
eos: v2.0.1

打包

编译完EOS后,切换到打包脚本目录

./scripts/eosio_build.sh -s EOS
cd ./build/packages

并执行打包操作

./generate_package.sh deb

如果是WSL 打包的话会报

dpkg-deb: error: control directory has bad permissions 777 (must be >=0755 and <=0775)

报错是因为当前打包的目录权限为777,需要修改为 0755到0775之间的某个权限。
由于WSL 默认是没有开启chmod的,所以需要先开启,才能修改目录权限。

WSL 启用chmod

新建配置文件

sudo vi /etc/wsl.conf

内容如下

[automount]
enabled = true
root = /mnt/
options = "metadata"

关闭所有bash,重新打开即可。

修改打包目录权限

chmod 775 eosio/* -R

再次执行打包即可

./generate_package.sh deb

【Ubuntu】Ubuntu 18.04 LTS 更换国内源——解决终端下载速度慢的问题

最近装了ubuntu18.04 LTS,下载软件有点慢,网上搜了下解决方案,大致是两种:一、把/etc/apt/sources.list文件里的源更换一下,改成阿里云或者其它的镜像的文件;二、更换software&updates里的select best server。

一、更换/etc/apt/sources.list文件里的源

1. 备份源列表

Ubuntu配置的默认源并不是国内的服务器,下载更新软件都比较慢。首先备份源列表文件sources.list:

# 首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2. 打开sources.list文件修改

选择合适的源,替换原文件的内容,保存编辑好的文件, 以阿里云更新服务器为例(可以分别测试阿里云、清华、中科大、163源的速度,选择最快的):

# 打开sources.list文件
sudo gedit /etc/apt/sources.list

编辑/etc/apt/sources.list文件, 在文件最前面添加阿里云镜像源:

#  阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. 刷新列表

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

下载速度瞬间就起飞了。

4. 其他源

中科大源:

#  中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源:

# 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华源:

# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

转载自:https://zhuanlan.zhihu.com/p/61228593

WSL 编译EOS报 set: -i: invalid option

windows10 Linux子系统(Ubuntu 18.04)编译EOS报错如下

surou@DESKTOP-444S803:/mnt/c/github/eos$ ./scripts/eosio_build.sh
EOSIO Version: 1.8.6
Sat Jan  4 05:50:58 UTC 2020
User: surou
Current branch: develop
./scripts/eosio_build.sh: line 129: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

原因是子系统的系统名不是Ubuntu

( [[ ! $NAME == "Ubuntu" ]] && [[ ! $ARCH == "Darwin" ]] ) && set -i # Ubuntu doesn't support interactive mode since it uses dash + Some folks are having this issue on Darwin; colors aren't supported yet anyway

查看子系统的Name

surou@DESKTOP-444S803:/mnt/c/github/eos$ echo $NAME
DESKTOP-444S803

所以编译时设置下环境变量即可
编辑环境变量配置文件

vim ~/.bashrc

将下面参数添加到文件尾部

export NAME=Ubuntu
export VERSION_ID=18.04

备注:如果安装1.8.x的EOS,且没配置过环境变量的话,可以一起加上

export PATH=$PATH:/home/surou(当前用户名)/eosio/1.8/bin

然后刷新环境变量

source ~/.bashrc

然后再次执行

surou@DESKTOP-444S803:/mnt/c/github/eos$ ./scripts/eosio_build.sh

curl is not working on Ubuntu 18.04 LTS

解决办法

sudo apt remove -y libcurl4
sudo apt install -y libcurl4 curl

参考

https://askubuntu.com/questions/1029273/curl-is-not-working-on-ubuntu-18-04-lts