Skip to content

Instantly share code, notes, and snippets.

@goral09
goral09 / execution_engine.proto
Created December 11, 2018 11:28
Protobuf message definitions
message Deploy {
bytes pk = 1; // public key of the deployer
int64 timestamp = 2;
bytes session_code = 3;
bytes payment_code = 4;
int64 gas_limit = 5;
int64 gas_price = 6;
int64 nonce = 7;
bytes deploy_sig = 8; // signature over (hash(session code), timestamp)
@goral09
goral09 / rchain-registry.md
Created October 6, 2018 15:39
RChain registry interaction
new register(`rho:registry:insertArbitrary`), out(`rho:io:stdout`), myContract, ret in {
  contract myContract(arg1, arg2) = { out!(("These are the args: ", arg1, arg2)) } |
  register!(bundle+{*myContract}, *ret) |
  for (@urn <- ret) {
    out!(("My contract is located at this URN: ", urn))
  }
}

To look up the contract at the id in a different deployment:

@goral09
goral09 / gist:a58bc4b91b788a9e189212aaedd1d700
Created October 4, 2018 15:09
failure-log-4/10/2018-core1307
Here is a content of my log
root@rnode-bob:~# rnode run
14:09:08.405 [main] INFO c.r.n.configuration.Configuration$ - Using configuration file: /root/.rnode/rnode.toml
14:09:09.268 [main] INFO c.r.n.configuration.Configuration$ - Starting with profile default
14:09:09.973 [node-io-8] INFO c.r.node.configuration.Configuration - flag --host was not provided, guessing your external IP address
14:09:10.175 [node-io-8] INFO c.r.node.configuration.Configuration - guessed 206.189.213.135 from source: AmazonAWS service
Using data_dir: /root/.rnode
14:09:15.304 [node-io-8] INFO coop.rchain.node.NodeRuntime - RChain Node 0.6.4 (a8ef56d0678c18adede05b735d603dd72fc1f8df)
14:09:15.305 [node-io-8] INFO coop.rchain.node.NodeRuntime - Starting node that will bootstrap from rnode://f4f20286feebc89d36d11b9e6ad726b6dd3d1490@52.119.8.51?protocol=40400&discovery=40404
Running with gitlab-runner 10.7.2 (b5e03c94)
 on vbox3-preloaded-ubuntu1804 55564875
Using VirtualBox version 5.2.12r122591 executor...
Restoring VM from snapshot...
Starting VM...
Waiting VM to become responsive...
Starting SSH command...
section_start:1538582896:prepare_script
Running on base-ubuntu1804 via gitlab-runner-virtualbox3.pyr8.io...
section_end:1538582897:prepare_script
org.lmdbjava.Txn$NotReadyException: Transaction is not in ready state
at org.lmdbjava.Txn.checkReady(Txn.java:195)
at org.lmdbjava.Txn.abort(Txn.java:77)
at coop.rchain.rspace.LMDBOps.withTxn(LMDBOps.scala:50)
at coop.rchain.rspace.LMDBOps.withTxn$(LMDBOps.scala:42)
at coop.rchain.rspace.LMDBStore.withTxn(LMDBStore.scala:27)
at coop.rchain.rspace.LMDBStore.withTxn(LMDBStore.scala:27)
at coop.rchain.rspace.spaces.FineGrainedReplayRSpace.storeDatum$1(FineGrainedReplayRSpace.scala:232)
at coop.rchain.rspace.spaces.FineGrainedReplayRSpace.$anonfun$lockedProduce$14(FineGrainedReplayRSpace.scala:310)
at coop.rchain.rspace.LMDBOps.withTxn(LMDBOps.scala:44)
@goral09
goral09 / rholang-mode.el
Last active April 18, 2018 19:56
Rholang syntax highlight
(defvar rholang-constants
'("true"
"false"
"Nil"
))
(defvar rholang-keywords
'("contract"
"matches"
"with"

Keybase proof

I hereby claim:

To claim this, I am signing this object:

sealed abstract class StSource[A] {
type S
def init: S
def emit(s: S): (A, S)
}
object StSource {
type Aux[S0, A] = StSource[A] { type S = S0 }
def apply[A, S0](i: S0)(f: S0 => (A, S0)): Aux[S0, A] =
new StSource[A] {
def mdropFirstE[T0](xs: MList { type T = T0 })
: MList { type T = T0 } =
xs.uncons match {
case None => MNil()
case Some(ml) => ml.tail
}
def pdropFirst[T](xs: PList[T]): PList[T] = xs match {
case PNil() => PNil()
case PCons(_, t) => t
class Animal(name: String, size: Int)
object Animal {
def apply(name: String, size: Int) = new Animal(name, size)
def unapply(a: Animal): Option[(String, Int)] = Option((a.name, a.size))
}
def myHumorToday: Animal = Animal("Dog", scala.util.Random.nextInt(50))
def depsOnMyHumor(a: Animal) = a match {
case myHumorToday => "you got lucky boy!"