This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module sample.test.enrollment; | |
| import std.algorithm; | |
| import std.stdio; | |
| public static immutable uint ValidatorCycle = 1008; // freezing period / 2 | |
| void getRange1 (ulong last_block_height) | |
| { | |
| const min_height = max(long(0), long(last_block_height) - ValidatorCycle); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /******************************************************************************* | |
| Contains utilities to be used by tests to easily set up test environments | |
| Since our business code is decoupled from our network code, | |
| thanks to the `vibe.web.rest` generator, we can fairly naturally make | |
| unittests for network behavior. | |
| By using the `localrest` library, we assign each node to a thread and use | |
| an RPC-style approach to call functions. | |
| This is non-deterministic, but models a real-life behaviour better. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module agora.test.Hackathon2; | |
| version (unittest): | |
| import agora.common.Amount; | |
| import agora.common.Hash; | |
| import agora.consensus.data.Block; | |
| import agora.consensus.data.Enrollment; | |
| import agora.consensus.data.Transaction; | |
| import agora.consensus.Genesis; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | unittest | |
| { | |
| import core.time : MonoTime; | |
| import std.stdio; | |
| auto network = makeTestNetwork(TestConf.init); | |
| network.start(); | |
| scope(exit) network.shutdown(); | |
| //scope(failure) network.printLogs(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ??:? @trusted void agora.consensus.protocol.Nominator.Nominator.nominate(ulong, agora.consensus.data.ConsensusData.ConsensusData) [0x10f302414] | |
| ??:? @safe void agora.consensus.protocol.Nominator.Nominator.tryNominate() [0x10f2c70a8] | |
| ??:? @safe void agora.node.Validator.Validator.onAcceptedTransaction() [0x10f297399] | |
| ??:? @safe void agora.node.FullNode.FullNode.putTransaction(agora.consensus.data.Transaction.Transaction) [0x10f27f73e] | |
| ??:? void geod24.LocalRest.RemoteAPI!(agora.test.Base.TestAPI, agora.test.Base.Serializer).RemoteAPI.handleCommand(geod24.LocalRest.Command, agora.test.Base.TestAPI, geod24.LocalRest.FilterAPI) [0x10f29ad02] | |
| ??:? void geod24.LocalRest.RemoteAPI!(agora.test.Base.TestAPI, agora.test.Base.Serializer).RemoteAPI.spawned!(agora.test.Base.TestValidatorNode).spawned(geod24.concurrency.Tid, immutable(char)[], int, agora.common.Config.Config, shared(geod24.Registry.Registry)*, immutable(agora.consensus.data.Block.Block)[]).runNode().handle!(geod24.LocalRest.Command).handle(geod24.LocalRest | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000511979524325EF6BA4EA147BFED70C95CF14B8779861B7D0091166840DBA3681F9146E4B9FA057DD775C3C08A85B0076BC4CC8B20E4A9263737770AB73B550C60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031A6A570ECE481B65833AF081D9B0CF95E46E7C58DE73202DBB74FD91DEFEF5F3C1BFC31CAD66AB915E6076DA8C9BD0172627F0063767277BBDE7733C05660B21506976087D2F697576A3CA0EBA5873BEC9F9B57B91F5997843B96D6B5C4486FB8B8C8922751BCD13623DF54095C3DEC572D16F731AA799F7B211AE2103E205FBFDF003FD4BB34DCC7442B0F65C12E8475B8AE08C0975C4F5EEB1223DB9D7003480E825690863FE6E4483982DEFDD883019EABD5E1DA027AE377EA338B1E17289E7480C4A942955C3307C96AA5017F33041F6F44650298CD37A711E878C67ACEC77A74C827418AA6529195CD75FDA9448223B291155CC1EB717246D25F2B1F3DFA6F1869B716AF03251410B4132BE5F476A89962E504D794C576829C9B46233EF18D0A7326DF32947EA768E4A9068F9D0EF811246B18E2A5D9F347EEF93 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | unittest | |
| { | |
| import agora.common.Serializer; | |
| import std.stdio; | |
| import std.format; | |
| KeyPair[] validator = [ | |
| WK.Keys[0], | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [nodemon] 2.0.4 | |
| [nodemon] to restart at any time, enter `rs` | |
| [nodemon] watching path(s): src/**/* | |
| [nodemon] watching extensions: ts,json | |
| [nodemon] starting `ts-node src/main.ts` | |
| Express server listening at 3836 | |
| [Object: null prototype] { | |
| '{"header":{"prev_block":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","height":{"value":0},"merkle_root":"0xc650b573ab70777363924a0eb2c84cbc76005ba8083c5c77dd57a09f4b6e14f98136ba0d84661109d0b7619877b814cf950cd7fe7b14eaa46bef254352791951","validators":{"_storage":[]},"signature":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","enrollments":[{"utxo_key":"0x210b66053c73e7bd7b27673706f0272617d09b8cda76605e91ab66ad1cc3bfc1f3f5fede91fd74bb2d2073de587c6ee495cfb0d981f03a83651b48ce0e576a1a","random_seed":"0xfb05e20321ae11b2f799a71a736fd172c5dec39540f53d6213cd1b7522898c8bfb86445c6b6db9437899f5917bb5f9c9be7358ba0ec | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import vibe.core.core; | |
| import vibe.core.log; | |
| import vibe.http.router; | |
| import vibe.http.server; | |
| import vibe.web.rest; | |
| import vibe.data.json; | |
| import std.uri; | |
| public struct TestBlock | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import std.stdio; | |
| import vibe.core.core; | |
| public struct TestBlock | |
| { | |
| string data; | |
| } | |
| void pushBlock1 () @safe | 
OlderNewer