366 Matching Annotations
  1. Jul 2020
    1. When a Certificate is created, a corresponding CertificateRequest resource is created by cert-manager containing the encoded x509 certificate request, Issuer reference, and other options based upon the specification of the Certificate resource.

      这里 Certificate 更像是一种声明或者说意图,需要 Issuer 的进一步处理,才能得到我们想象中的 certificate key pair

      CertificateRequest is created by cert-manager containing:

      • encoded x509 certificate request
      • issuer ref
      • other options
    1. generated labels
      {
          app_name="ddex-api"
          instance="100.96.17.155:9091"
          job="ddex-metrics"
          key="v3/POST-buildOrder"
          le="10"
          namespace="production"
          node_name="nodes-c507"
          pod_name="ddex-api-5cb9b89f58-7fnbc"
          ready="true"
      }   0
      
    2. an endpoint you can scrape is called an instance, usually corresponding to a single process. A collection of instances with the same purpose, a process replicated for scalability or reliability for example, is called a job.

      怪异的名字

      • instance: 被扒的那个进程
      • job: 同性质的 instance 的集合

      比如 api 服务,在k8s 中以 deployment 部署,scale 为 5。

      则 api-1... api-5 是一个个的 instance,而这五个pod,是一个job

  2. Jun 2020
    1. 这篇好啊,特别是这张对应代码的图,对Heap & Stack 的作用展示的很清晰

    1. via limin

      also heavily mentioned in book: k8s operator


      alternative for kubebuilder? this one get more starts

  3. May 2020
    1. As circuit breaking applies to “real” mesh destinations in a load balancing pool, you configure circuit breaker thresholds in destination rules, with the settings applying to each individual host in the service.

      还是没懂这个怎么就放在 DestinationRules 上了,前面都是配置在 VirtualService

      另外这个 circuit breaker 的规则是在每一个 host 上生效,如果一个服务有多个 pods,会每个 pod 去连一遍么,还是单个失败了,就直接短路

    2. Istio failure recovery features are completely transparent to the application

      ? 怎么个透明法?

    3. You don’t need to add a service entry for every external service that you want your mesh services to use. By default, Istio configures the Envoy proxies to passthrough requests to unknown services.

      未知的服务 Envoy 会放行,所以并不需要每个外部服务都做配置?

    1. MARK

    2. Exercise: Loop over the string using the %q format on each byte. What does the output tell you?]

      ?

      '½''²''=''¼'' ''â''\u008c''\u0098'
      
    1. Some resources in the v1 API contain fields called phase, and associated message, reason, and other status fields. The pattern of using phase is deprecated

      phase is deprecated, use conditions instead...

    2. Conditions represent the latest available observations of an object's state.

      status.conditions

    3. PUT expects the whole object to be specified. Therefore, if a field is omitted it is assumed that the client wants to clear that field's value. The PUT verb does not accept partial updates.

      PUT 是覆盖式的

    4. The PUT and POST verbs on objects MUST ignore the "status" values, to avoid accidentally overwriting the status in read-modify-write scenarios. A /status subresource MUST be provided to enable system components to update statuses of resources they manage.

      ?

    1. For example a client may acquire the lock, get blocked in some operation for longer than the lock validity time (the time at which the key will expire), and later remove the lock, that was already acquired by some other client.

      即使加上后面的乐观锁检查,

      这种设计下,还是有corner case:

      当 原先持有锁的 A因为某些原因暂停了一段时间,导致自己失去了锁,等它醒来之后锁已经被 B 获取,而 A 还以为自己有锁,这时会出现一个短暂的时间段,A 和 B 都认为自己有锁,BOOM!


      反驳的文章也提到了这一点,解决的办法是使用乐观锁,例如数据库里记录增加 version 字段

      https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html#making-the-lock-safe-with-fencing

      不过这时候,例如数据库有乐观锁的支持,那也不需要靠redis 来提供分布式锁的支持了。

    2. split brain conditions

      ?

    1. a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree generalizes the binary search tree, allowing for nodes with more than two children.

      key word:

      • self-balancing
      • generalize BST by allowing more than 2 children
    1. InnoDB 中用于存储数据的文件总共有两个部分,一是系统表空间文件

      二呢?。。。

    2. 默认情况下,表空间中的页大小都为 16KB

      一个 page 挺小的啊,16k,只能存几行记录

    1. To control the cascading deletion policy, set the propagationPolicy field on the deleteOptions argument when deleting an Object. Possible values include “Orphan”, “Foreground”, or “Background”.

      删除 owner 时,可以指定级联删除的策略,包括:

      • Orphan - 不删除 dependents
      • Foreground - 先删除 dependents, 完事儿后再删除 owner
      • background - 先删除 owner,之后处理 dependents
    1. Indexer: An indexer provides indexing functionality over objects.

      还是不太懂这个 Indexer 是干啥的,哪儿能用到

    1. 192.77 Sai / ETH 的价格

      3456.79 个 Sai 换成了 17.9 个 ETH


      0xb4 的地址剩余 10Sai ,看看 Sai 关停后处理流程是啥

    1. 文章不错不过对面试帮助不大,因为面试要涉及的几个概念,文章都没太讲到:

      • mark-sweep
      • tri-color
      • write barrier
    2. While the Marking work is happening on P1, application work can continue concurrently on P2, P3 and P4.

      GC runs with user app

    3. The only way to do that is for the collector to watch and wait for each goroutine to make a function call.

      make a function call?

    1. expose the service using an Ingress resource that will be handled by istio-ingressgateway.

      感觉这个 Ingress 没啥作用,和 Istio 的 Gateway 有重复

    2. Istio as a secure Kubernetes Ingress controller

      Istio now is the controller of our k8s Ingress

    1. using the given private key

      ?

      CA 是自己又一个私钥,用来签其他的证书,而 selfsigned 就是自己提供私钥自己签。

    2. SelfSigned

      没懂这个是用来干啥的

    1. The relevant extension for Extended Validation (EV) is Certificate Policies. Certificate sellers will refuse to issue wildcard certificates with EV, because cabforum.org, the regulatory body governing the issuance of EV SSL Certificates decided this is a big no no. EV certificates can, however, have as much SubjectAltName as you wish.

      ? 在说啥。。。

    2. C=PT, ST=Lisboa, L=Lisboa, O=Example Org, CN=*.example.org

      entity

    3. C=PT, ST=Lisboa, L=Lisboa, O=Sz CA, OU=SZ CA

      Issuer

  4. cert-manager.io cert-manager.io
    1. Take note of the index keys used for each field as these are required in order for cert-manager to find the certificate and key.

      这儿意思是说 secret 的 fields 是固定的,必须是:

      • tls.crt
      • tls.key

      ?

    1. isCA: false

      certificate as CA?

      啥意思,证书可以作为 CA 去签其他证书?

    1. acme-crt-secret

      refed issuer will try to obtain a certificate key pair for domains, and stored in this secret: acme-crt-sercret, with keys of:

      • tls.key
      • tls.crt
    1. Unlike the previous sections, the Istio default ingress gateway will not work out of the box because it is only preconfigured to support one secure host

      只支持一个 TLS 域名的时候不需要修改 istio-ingressgateway 是因为它做了预配置以支持一个 TLS Host

    2. Redeploy istio-ingressgateway with the new certificate

      Gateway 支持多个证书时,File Mount 的方法需要重新部署 istio-ingressgateway ,这是它的最大缺点

      重新部署是因为需要把新证书 mount 到 istio-ingressgateway 的文件系统

    1. Design goals

      design goals 里,这两点明白意思

      • 第一点: 对开发者尽量透明
      • 第三点:尽量多平台都可用(感觉没意义,除了k8s,提到的几个其他平台真的有人用?)

      剩下的:

      • 第二点:Extensibility
      • 第四点:Policy Uniformity

      不懂在说啥。。。

    2. Traffic in Istio is categorized as data plane traffic and control plane traffic.

      traffic in Istio:

      • data plane traffic: biz logic traffic
      • control plane traffic: config & control msg between Istio components
    1. Great article on Demystifying Istio's Sidecar istio-proxy

    2. We did briefly mention that it is done by setting up the iptable rules within the pod namespace, which in turn is done by the istio-init container.

      粗略的说,通过修改 pod 的 iptable rules 来使 sidecar proxy 完成进出流量的截取,而 iptables 的修改是通过 init-container 来完成的。

      那更进一步的细节呢?见下文

    3. An admission controller is a piece of code that intercepts requests to the Kubernetes API server prior to persistence of the object, but after the request is authenticated and authorized.

      admission controller 会拦截发往 k8s API Server 的请求,拦截的时机在

      • 请求被 auth & authz 之后
      • 持久化 k8s 对象之前
    4. two types of admission webhooks, validating admission Webhook and mutating admission webhook

      2 types of admission webhooks:

      • validating admission webhook
      • mutating admission webhook
    1. The static_resources block contains definitions for clusters and listeners that aren’t dynamically managed. A cluster is a named group of hosts/ports, over which Envoy will load balance traffic, and listeners are named network locations that clients can connect to.
      static_resources:
          listerners: []  #  A cluster is a named group of hosts/ports, over which Envoy will load balance traffic
          clusters:[]  # listeners are named network locations that clients can connect to
      
    1. In other words, the Gateway resource must reside in the same namespace as the gateway workload instance.

      Gateway 必须和 Istio 的 proxy 配置在同一个 namespace 中?也就是 Gateway 必须配置在 istio-system 中?

      貌似并不是这样

    2. One or more labels that indicate a specific set of pods/VMs on which this gateway configuration should be applied.

      Istio 的 Gateway 和 k8s 原生的 Ingress 一样,其实都是一种对真正的 Proxy 的配置

      • k8s 里 Ingress 可以配置 Nginx / kong
      • istio 里 Gateway 配置 istio 自己实现的 代理
    3. While Istio will configure the proxy to listen on these ports, it is the responsibility of the user to ensure that external traffic to these ports are allowed into the mesh.

      ?

    4. The gateway will be applied to the proxy running on a pod with labels app: my-gateway-controller.

      Gateway

      spec.selector

    1. Share u with the json.Unmarshal function.

      &u, address of pointer u?

    2. Here is an example of a stack that is replaced several times because of growth.

      没太看懂

    3. Escape analysis is the process that the compiler uses to determine the placement of values that are created by your program.

      Escape Analysis: 编译器用来决定内存的分配位置,stack or heap

    1. Pointer variables are not special because they are variables like any other variable. They have a memory allocation and they hold a value.

      指针变量并不特殊,也需要对应的分配内存,有对应的值

    2. This is what the stack looks like after the function call to increment:

      这个图还蛮好的,帮助理解 stack、值、值的指针

      pointer 让跨 栈帧 的内存共享成为可能

      传递的是 Pointer, &count

    3. Variables serve the purpose of assigning a name to a specific memory location for better code readability

      变量是内存地址的一个代号,方便代码的阅读

    1. 基本了解了 逃逸分析 是干什么的:编译器通过确定变量是分配在 heap 还是 stack 上。

      不过行文感觉比较随意

    1. Since a thread cannot both be executing code and be blocked on a syscall

      why not

      意思是说一个线程在因为 系统调用被block之后,不能去执行其他代码?

  5. Apr 2020
    1. https://weibo.cn/comment/IFCnq887F?uid=1088413295&rl=0&gid=10001#cmtfrm

      在不获取手机麦克风权限的情况下,通过陀螺仪传感器数据的神经网络算法,就可以从声波振动中提取出讲话者的语音。

    1. 采用DH算法后,Premaster secret不需要传递,双方只要交换各自的参数,就可以算出这个随机数。

      不明觉厉

    1. Mapping a single virtual service to multiple “real” services is particularly useful in facilitating turning a monolithic application into a composite service built out of distinct microservices without requiring the consumers of the service to adapt to the transition.

      把一个 胖服务逐渐分拆?

    2. By contrast, container orchestration platforms like Kubernetes only support traffic distribution based on instance scaling, which quickly becomes complex.

      instance scaling 指的什么?pod 的伸缩?

    3. it’s far from all that Istio can do
      1. A/B testing
      2. new load balancing policy
      3. ...
    1. while replace directives in modules other than the main module are ignored when building the main module.

      这个怎么理解?

  6. Mar 2020
    1. You'll often hear experienced Go programmers talk about the "slice header" because that really is what's stored in a slice variable.

      sliceHeader

    1. Metric types

      4 metric types:

      • counter, keep increasing
      • gauge, can up & down
      • histogram,
      • summary ?
    1. Samples

      一个 sample 就是一个数据点,包括:

      • 对应的时间

      一条 time serial 由多个 samples 组成

  7. Feb 2020
    1. Authentication strategies

      strategies:

      • x509 client certs
      • static token file
      • bootstrap tokens
      • static password file
      • service account tokens
      • OpenID Connect Tokens
      • Webhook Token Authentication
      • Authenticating Proxy
    1. Requeue when we either see a running job (done automatically) or it’s time for the next scheduled run.

      没太懂这个 Requeue 是怎么工作的

    2. Reconcile

      when this will be called?

    3. 重点

    1. don’t need to try again

      don't need to reconcile this cronjob object again?

    2. A reconciler takes the name of an object, and returns whether or not we need to try again

      try again what?

    1. except to mark that we want a status subresource, so that we behave like built-in kubernetes types

      what subresource?

    1. That little +kubebuilder:object:root comment is called a marker. We’ll see more of them in a bit, but know that they act as extra metadata, telling controller-tools (our code and YAML generator) extra information. This particular one tells the object generator that this type represents a Kind. Then, the object generator generates an implementation of the runtime.Object interface for us, which is the standard interface that all types representing Kinds must implement.

      about the mysterious marker:

      +kubebuilder:object:root

    1. A resource is simply a use of a Kind in the API.

      多数时候,Kind 和 resource 是一对一的,例如:

      pods resource 和 Pod Kind

      但有时候,一个 Kind 对应多个 resources,例如:

      Scale Kind 对应多个 scale subresources:deployments/scale and replicasets/scale

  8. Jan 2020
    1. extension points

      so what is Extension Points...

    2. Kubernetes is designed to be automated by writing client programs

      ? 怎么就 automated 了?

    1. base search domain

      for None-FQDN

    2. A records

      对于普通的 Service, A 记录对应的形式是 svc-name.namesapce.svc.cluster-domain.example, 指向 service 的 cluster ip

      headless service 没有 cluster ip,指向的直接是 service 匡选 pods 对应的 IPs


      svc.cluster-domain.example 是什么东西?

    1. Virtual IPs and service proxies

      不懂下面几小节和 Virtual IPs and service proxies 的关系

      • User space proxy mode
      • iptables proxy mode
      • IPVS proxy mode

      可能是说 kueb-proxy 使用这几种模式来支持 Service

    2. ServiceTypes

      4:

      1. ClusterIP
      2. NodePort
      3. LoadBalancer
      4. ExternalName
    3. A cluster-aware DNS server, such as CoreDNS, watches the Kubernetes API for new Services and creates a set of DNS records for each one.

      一些 cluster-ware 的 DNS 服务,例如 CoreDNS,会通过 k8s API 来监视 Service 的变动,并对应的生成 DNS 记录

    4. Kubernetes supports 2 primary modes of finding a Service - environment variables and DNS.

      2 primary modes of finding a Service:

      • ENV variables
      • DNS
    5. User space proxy mode

      ... 都是高科技。。

    1. 介个实例教程还挺好,总算大致了解 Stateful Set 的 特点/存在理由 了

    2. Pod initialization

      我自己看见的几个值得注意的点:

      1. init-container 里,根据 pod name 中的序号,对 xx-0 使用 master 配置,其他的使用 slave 配置
      2. initContainers 里 clone-mysql 干啥的没搞懂
      3. containers 里的第一个 pod:mysql 比较普通
      4. 第二个 xtrabackup, 不知道干啥的

      2: 检查如果是 slave pod 第一次启动,则从前一个 pod 同步数据,已加速之后和 master 的同步

    1. MVCC

      Multi-Version Concurrency Control: MVCC

    2. 在可重复读中,该sql第一次读取到数据后,就将这些数据加锁,其它事务无法修改这些数据,就可以实现可重复读了

      和上面例子有冲突

      B 确实修改了 A 读出来的数据,并没有被锁挡住

      why?

    3. 事务B也就一直拿不到该行锁,wait直到超时。

      如果这儿 B 事务是读呢?

      是怎么保证 B 不会读到尚未提交的修改的?

    1. Because slices are multiword structures, not pointers, the slicing operation does not need to allocate memory, not even for the slice header, which can usually be kept on the stack

      ?

      stack 不算 memory?

  9. Dec 2019
    1. 按照我个人的理解,在事务处理的ACID属性中,一致性是最基本的属性,其它的三个属性都为了保证一致性而存在的。

      原子性和隔离是为了保证一致性

    1. 隔离级别的实现
      • 时间戳
      • 多版本 & 快照隔离 (?)
    2. ACID
      • A - Atomicity - 原子性
      • C - Consistency - 一致性, 数据库的约束在事务执行前后都得以保全
      • I - Isolation - 隔离性 - 多个事务并发的情况下,各个事务之间如果访问资源有交叉,这些交叉资源之间相互影响的一个保证(隔离的程度)
      • D - durability - 持久性 - 除了显而易见的指数据在磁盘上的保存,还指事务提交之后,即使未写入数据库(例如因为断电),也能保证重启后数据能够提交(通过 redo log)
    3. 例如 PostgreSQL 会为每一条记录保留两个字段;读时间戳中包括了所有访问该记录的事务中的最大时间戳,而记录行的写时间戳中保存了将记录改到当前值的事务的时间戳。

      看起来 PG 和 MySQL 这儿是个很大的不同点呀

    4. Next-Key 这一块儿没讲清楚

    5. InnoDB 不仅会在范围 (21, 30] 上加 Next-Key 锁,还会在这条记录后面的范围 (30, 40] 加间隙锁

      所以这儿的 (21, 30] 的 Next-Key 锁和 (30,40] 的间隙锁,有什么区别?

    6. 意向锁其实不会阻塞全表扫描之外的任何请求,它们的主要目的是为了表示是否有人请求锁定表中的某一行数据

    7. 不可重复读的原因就是,在 READ COMMITED 的隔离级别下,存储引擎不会在查询记录时添加行锁,锁定 id = 3 这条记录。

      🔒,行锁

    8. 第 4、5 步就是在事务提交时执行的

      如果事务提交后,

      • 如果第五步出错,可以通过 redo 第四步的 redo log 来恢复
      • 但是如果第四步出现错误,会怎么办?
    9. 重做日志由两部分组成,一是内存中的重做日志缓冲区,因为重做日志缓冲区在内存中,所以它是易失的,另一个就是在磁盘上的重做日志文件,它是持久的。

      redo log:

      • in memory
      • on disk
    10. 重做日志(redo log)

      前面保证事务的是 undo log

      这儿保证持久性的是 redo log

    11. 一旦事务被提交,那么数据一定会被写入到数据库中并持久存储起来

      反过来也是在说 事务提交 和 数据被写入数据库(或者说写到磁盘) 不是同一件事

  10. Nov 2019
  11. Oct 2019
    1. To learn why a Funding Rate is needed in the Perpetual Futures Market, please review the section detailing the market.

      ? where

    1. 抵押金

      币安有 抵押金 和 保证金 的概念

      这个例子里,抵押金多 41.3K,而保证金少 8.7k

      但是清算时,是考虑抵押金的,不知道这么分,有啥用处。。。

    2. 爆仓价格
      • 强行价格对应 Liquidation Price,对应亏光保证金的价格
      • 爆仓价格对应:Bankruptcy Price,对应亏光保证金 + 抵押金的价格
    3. 情景3:用户的头寸为100 BTC, 名义价值为1,000,000 USDT
    4. 强行价格: 10,000 - 41,300/20 = 9,587

      强行价格: 10,000 - 41,300/20 = 9,587

      应该除以 100

    5. 强行价格: 10,000 - 49,800/5 = 40

      Liquidation Price: 10000 - 49800/5 = 40

      即清算价格

      BTC 当前价格: 10K,

      当抵押金亏完, 只剩下保证金时:200 时,这时保证金率降到 0.4%,即到达清算线。

      而保证金现在有 49.8 K (= 50k - 用作保证金的200)

      五枚BTC 每枚亏 49.8k / 5,可以亏光,即价格跌到:10k - 49.8/5 = 40刀,会启动清算

    6. 账户抵押金下降到维持保证金

      抵押金 保证金 啥区别?

    1. Let’s follow the 3rd scenario from the 20x leverage (default) case in the previous section.

      https://www.binance.com/cn/support/articles/360033162192

      情景3:用户的头寸为100 BTC, 名义价值为1,000,000 USDT

    1. margin 的比例是当前仓位减掉负债后,占仓位价值的比例,还是比较直观的,其实就是当前仓位的净资产就是保证金,我们对这个保证金占仓位价值的比例有一个要求,或者反过来就是当前债务的占比有一个要求,不能超过多少

      文中的例子:

      初始保证金

      • 初始保证金 50%,则仓位 10k 时,对应 5k 保证金,5k 借款
      • 初始保证金 65%,则仓位 10k 时,对应 6.5k 保证金,3.5k 借款

        # 维持保证金

      股价跌倒一半后,仓位只有 5k,其中债务不变:

      • initial margin 50% 对应债务 5k,保证金 0k,比例为零,这时整个仓位只够刚好还债,真实情况中,早已经在这之前执行清算
      • initial margin 65% 对应债务 3.5k,保证金 1.5k,保证金比例 = 1.5 / 5 = 30% ,如果 maintenance margin 为 30%,则这时再跌一点点,就将执行清算
    2. imagine the maintenance margin is 30 percent

      (Total - Debt) / Total >= 30%

    1. Different DeFi projects have taken different approaches to implementing this oracle, but they can generally all be classified in one of five ways

      5 ways of price oracle

  12. Jul 2019
    1. Here is the extended code for getting a node in the Merkle Patricia trie:

      todo

    2. first nibble

      [1] [2] [_3_extension_orleaf] [_4_path_len_event_orodd]

    3. [ f, 1, c, b, 8, 10]

      leaf node with odd path: 0xf1cb8

      should prefixed with: 0x3

      -> 0x 3f 1c b8

    4. [ 0, f, 1, c, b, 8, 10]

      leaf node with even path: 0x0f1cb8

      should prefixed with: 0x20

      -> 0x20 0f 1c b8

    5. [ 1, 2, 3, 4, 5, ...]

      odd extension node with path: 0x12345<br> should prefix with nibble: 0x1

      -> 0x11 23 45

    6. [ 0, 1, 2, 3, 4, 5, ...]

      extension node with even path: 0x012345<br> with prefix: 0x00

      -> 0x00 01 23 45

    7. a kilobyte of extra space to store one level per character

      why 1k per level?

      (16+1) slots * 256bits per slot?

    1. This middleware is executed after router processes the request

      and before handler process the request(?)

    2. Handler is processed in the end after all middleware are finished executing.

      middleware first, handler second

  13. Jun 2019
    1. key world: merkle proof

    2. The state in Ethereum essentially consists of a key-value map, where the keys are addresses and the values are account declarations, listing the balance, nonce, code and storage for each account (where the storage is itself a tree).

      state in eth: a k-v map

      • key: address
      • value: account infos: balance, nonce, code & storage (which itself is another tree)
    3. So what is the benefit of this strange kind of hashing algorithm? Why not just concatenate all the chunks together into a single big chunk and use a regular hashing algorithm on that? The answer is that it allows for a neat mechanism known as Merkle proofs:

      Reason why Merkle Tree

    1. For example, summing two numbers costs 3 gas. Multiplying them costs 5 gas. Storing a 256bit word into the blockchain costs 20000 gas, which means storing 1kb of data costs 640000 gas.

      computation is cheap, storing is expensive

      • add: 3gas
      • mul: 5gas
      • storing 32 bytes: 2w
  14. May 2019
    1. For more on objects and prototypes see Object.prototype. For an explanation of object prototypes and the object prototype chains see Inheritance and the prototype chain.

      todo if need to know more about prototype and prototype chain

    2. We have introduced another keyword: new. new is strongly related to this. It creates a brand new empty object, and then calls the function specified, with this set to that new object.

      difference between calling function directly and using the key word: new is all about the meaning of this:

      • directly call: this is the obj current func called upon
      • new: this is a newly created empty object
    3. Person.prototype is an object shared by all instances of Person

      Person() is a function, function is object

      Person.prototype is an object shared by all instances created by the function: Person()

    4. constructor functions

      functions that designed to be called with keyword new:

      constructor functions

    1. A type switch is a construct that permits several type assertions in series.

      好用

    1. An empty interface may hold values of any type

      cool

    2. the empty interface

      like Object in Java

    3. An interface value

      没太懂这个 interface value 有什么特别的


      知道了,注意这里变量 i 的类型是 interface I, 而非具体的 struct T 或 type F


      interface value 是 value:一个值,这个值的类型是满足某个 interface 的具体类型

      比如 T{"Hello"} 这个值,它的类型是满足 interface M 的具体类型: T

    4. Every type implements at least zero methods.

      tricky

  15. Apr 2019
    1. Closing a Short Position means a trader is buying Shares of an Outcome they are short on

      ?

    2. two ways: by selling the Shares they hold to another trader in exchange for Ether, or by Settling their Shares with Augur’s smart contracts.

      2 ways:

      1. settle with another trader before finalized, burn Complete set, get back ETH
      2. settle with augur contract if market finalized, give winning Share, get back ETH
    1. Create Complete Set

      这儿 Alice 和 Bob 赔率上是达成了一致的,即 8:2

      注意 Bob 这儿是想以 0.2 的价格买 B,和想以 0.8 的价格买 A 的 Alice 刚好能够凑成 Complete Set

      只不过 Bob 这儿只想买半个 Share,所以是 Partial Fill

    2. Direct Trade

      Share 可以直接转移和买卖,看来 Share 很可能也是一种 ERC20

      不知道是每个 Market 专属的,还是整个 Augur 通用的。

    3. Note that Bob could have also wanted to sell 1 SHARE of A for 0.8 ETH, which would have been a “Ask Outcome A, 1 SHARE for 0.8 ETH”. This would have had created the same result as shown above, even though he has no SHARES.

      "Sell 1 Share of Yes for 0.8ETH" is the same as:

      "Buy 1 Share of No for 0.2ETH"

      以上两个动作分别记做 Action-Y 和 Action-N

      两者都是在对事件押注,Action-Y 表示说我觉得事件发生的概率是 0.8,即不发生的概率是 0.2

      这儿所谓的 is the same, 是不是指的:

      当没有 Share of Yes 的时候,我想 sell Yes, 其实不是在卖Yes,而系统实际上是在买 No ?


      本质是在一个达成共识的赔率上,做两边的下注。<br> 而在一个达成共识的赔率上,到底下注哪边,其本质反映的是我心理预期的概率和实际赔率的不一致。

      如果我心理的概率和赔率完全一致,比如硬币正反面对赌,赔率是 1:1,那么我还参加这个赌局,就是完全碰运气而已了。

      但是如果正反的赔率是1:2,我肯定买正面,因为我心理预期的概率是1:1,当前赔率和预期发生了偏离,我觉得有利可图,于是买正面。


      所以 Augur 里的 Complete Set,指的是一个在达成共识的赔率上形成了对手方的对赌。

      上面到底是买 Yes,还是卖 No,其实是不同的事情,是在同一赔率下,我觉得 Yes 实际的概率会更大,于是 Action-Y,这时,为了形成有效赌局,我需要一个人来买该赔率下的另一边,也即是等一个觉的 No 的概率大于赔率所示的另一人来下注。

  16. Mar 2018
    1. 代码设计模式

      skipped for now, worth reading in future

  17. Oct 2017
  18. www.silhouette.rocks www.silhouette.rocks
    1. provider is a service that handles the authentication of an identity

      authorization?

  19. www.silhouette.rocks www.silhouette.rocks
    1. // As the body of request can't be parsed twice in Play we should force // to parse empty body for UserAwareAction

      ?