Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EdenOS Release 0.2.24 #656

Merged
merged 66 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
15edd8b
contract auth
tbfleming Nov 4, 2021
b7257c2
contract auth
tbfleming Nov 4, 2021
4716d5a
contract auth
tbfleming Nov 4, 2021
83dcd2c
contract auth
tbfleming Nov 4, 2021
e77b07e
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 5, 2021
2cfac49
contract auth
tbfleming Nov 5, 2021
5459062
contract auth
tbfleming Nov 5, 2021
03ecc68
contract auth
tbfleming Nov 5, 2021
301177f
contract auth
tbfleming Nov 6, 2021
a4462a6
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 6, 2021
c390977
contract auth
tbfleming Nov 6, 2021
108cd32
contract auth
tbfleming Nov 9, 2021
37041ba
contract auth
tbfleming Nov 9, 2021
520a764
contract auth
tbfleming Nov 9, 2021
f45c09d
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 10, 2021
4813981
contract auth
tbfleming Nov 10, 2021
97a1508
cleanup
tbfleming Nov 10, 2021
5677922
cleanup
tbfleming Nov 10, 2021
8e4b859
cleanup
tbfleming Nov 10, 2021
684d629
cleanup
tbfleming Nov 10, 2021
ce4b250
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 11, 2021
09fc987
Disable malfunctioning expiration for now
tbfleming Nov 11, 2021
5af07e8
Merge pull request #605 from eoscommunity/disable-uchain-expiration
tbfleming Nov 11, 2021
76c617c
force box build
tbfleming Nov 11, 2021
cb29a3a
Reset opt-in status when the election is rescheduled.
swatanabe Nov 12, 2021
b1ec81a
sessions
tbfleming Nov 12, 2021
45c22d8
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 15, 2021
479bbde
sessions
tbfleming Nov 15, 2021
cc96be9
Ephemeral chain instructions (#608)
sparkplug0025 Nov 17, 2021
5c508c0
Add induction check on donate and fix microchain (#609)
sparkplug0025 Nov 18, 2021
0bff7cd
Componentize Election UI (#610)
brandonfancher Nov 18, 2021
aa1c8bc
address feedback
tbfleming Nov 18, 2021
6417a5b
Elections test runner: start election with current time.
brandonfancher Nov 18, 2021
bc92b0b
Remove debug print
swatanabe Nov 19, 2021
9656552
Fix condition in electopt
swatanabe Nov 19, 2021
1d51787
Nav profile: member data from box query.
brandonfancher Nov 18, 2021
853d01a
My delegation: remove AA/AH dependency and make work with ephemeral c…
brandonfancher Nov 18, 2021
d44b1c6
Get ongoing elections UI working with ephmeral chain - no AA/AH depen…
brandonfancher Nov 18, 2021
bac9fff
Create new Member model and apply to simple component.
brandonfancher Nov 19, 2021
1da616e
Update participating property name on Member.
brandonfancher Nov 22, 2021
251d1b1
Member detail page and inductions use new Member model.
brandonfancher Nov 22, 2021
3ff60f6
bug fix
tbfleming Nov 24, 2021
869a544
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 24, 2021
08ff926
address feedback
tbfleming Nov 24, 2021
b46a8b9
switch crypto key data to unsigned
tbfleming Nov 24, 2021
e028ee6
extensible auth
tbfleming Nov 25, 2021
9b8b5ec
Add Eden `execsession` server signature to box (#615)
sparkplug0025 Nov 29, 2021
95747e5
Rename MemberData to MemberNFT. Make MemberChips compatible with Memb…
brandonfancher Nov 23, 2021
9760cc7
Box queries return Member instead of MemberNFT.
brandonfancher Nov 24, 2021
6b57db8
Move MemberNFT interface to nfts/interfaces. Organize.
brandonfancher Nov 24, 2021
0a7c729
Merge remote-tracking branch 'origin/main' into contract-auth
tbfleming Nov 30, 2021
fea0b76
no_auth
tbfleming Nov 30, 2021
c58bb0a
contract auth
tbfleming Nov 30, 2021
baf61ee
Merge pull request #598 from eoscommunity/contract-auth
tbfleming Dec 2, 2021
4c7b183
Tracks `setencpubkey` on microchain (#621)
sparkplug0025 Dec 3, 2021
61e1de7
Merge pull request #607 from eoscommunity/opt-reset
swatanabe Dec 14, 2021
0f2a599
Enable LTO for wasm build
swatanabe Dec 14, 2021
400da24
Move lto to eden
swatanabe Dec 14, 2021
517b31a
Merge pull request #647 from eoscommunity/lto
swatanabe Dec 14, 2021
96fcf1e
micro chain: auto opt out on reschedule
tbfleming Dec 14, 2021
cef3c48
Add Signing session transactions example page (#625)
sparkplug0025 Dec 15, 2021
0de0fde
Handle new ElectionState variant structs (#652)
sparkplug0025 Dec 16, 2021
f06e717
Merge pull request #649 from eoscommunity/micro-chain-auto-opt-out
tbfleming Dec 16, 2021
2f09067
Add local session key sequence control (#653)
sparkplug0025 Dec 20, 2021
0fd878a
Update call to AH Auctions API to fix members lists.
brandonfancher Jan 5, 2022
5fedc5b
Touch build.yml to retrigger jobs.
brandonfancher Jan 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
cp eden-micro-chain.wasm ../product_cache
cp eden.abi ../product_cache
cp eden.wasm ../product_cache
cp run-full-election.wasm ../product_cache
cp run-elections.wasm ../product_cache
cp run-genesis.wasm ../product_cache
cp token.abi ../product_cache
cp token.wasm ../product_cache
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
product_cache/token.abi
product_cache/token.wasm
product_cache/run-genesis.wasm
product_cache/run-full-election.wasm
product_cache/run-elections.wasm

build-micro-chain:
name: Build Micro Chain
Expand Down Expand Up @@ -353,6 +353,7 @@ jobs:
- "tsconfig.build.json"
- "tsconfig.json"
- "yarn.lock"
- "scripts/eden_chain_runner.sh"

- "packages/**"
- "contracts/**"
Expand All @@ -364,7 +365,7 @@ jobs:
name: Eden Microchain
path: build

- name: Download Ephemeral Chain Runners
- name: Download Ephemeral Eden Chain Runners
if: steps.filter.outputs.src == 'true'
uses: actions/download-artifact@v2
with:
Expand Down
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,64 @@ wget https://nodejs.org/dist/v14.16.0/node-v14.16.0-linux-x64.tar.xz
tar xf node-v14.16.0-linux-x64.tar.xz
npm i -g yarn
```

### Running Eden with Ephemeral Chains Locally

Ephemeral chains are instances of the EOS blockchain spawned by `nodeos` locally, with manipulated data from our chain runners, eg: [Basic Genesis Runner](contracts/eden/tests/run-genesis.cpp) or [Full Election Runner](contracts/eden/tests/run-full-election.cpp). By running a ephemeral chain you are in full control of the blockchain, giving you more flexibility to test the Eden contracts.

#### Get the executables

You will need to build the repo locally by following the below **build** steps. If you don't have a proper C++ environment setup you can download it from our current [main branch artifacts](https://github.com/eoscommunity/Eden/actions/workflows/build.yml?query=branch%3Amain).

If you built locally, you can skip these steps.

**Downloading the executables**

- Open our [main branch builds](https://github.com/eoscommunity/Eden/actions/workflows/build.yml?query=branch%3Amain).
- Click in the most recent successful one
- Scroll down to the artifacts section
- Download the following files:
- Eden Microchain
- Ephemeral Eden Chains Runners
- clsdk
- From the root of this repo, run the following commands:

```sh
mkdir build
# unzip all of the above artifact files in this build folder
cd build
tar -xvf clsdk-ubuntu-20-04.tar.gz clsdk/bin
cp ../scripts/eden_chain_runner.sh ./
```

Now you have all the files needed for running the ephemeral chain inside the `build` folder.

If you are on a Linux machine compatible with Ubuntu arch you can spin it up by just running: `./eden_chain_runner.sh run-genesis.wasm 1`

Otherwise you can spin it up with the following docker command:

```sh
docker run --name eden-genesis \
-v "$(pwd)":/app \
-w /app \
-p 8080:8080 -p 8888:8888 \
-d -it ghcr.io/eoscommunity/eden-builder:sub-chain \
bash ./eden_chain_runner.sh run-genesis.wasm 1
```

To see if the chain is running successfully you can execute `cleos get info` or watch the nodeos logs: `tail -fn +1 eden-runner.log`

With the ephemeral chain running you can just spin up our local environment with:

```sh
yarn
NODE_ENV=test yarn build --stream
NODE_ENV=test yarn start --stream
open http://localhost:3000
```

**Re-running ephemeral chains**

Running the above commands again will just setup a brand new chain! Just watch out to kill nodeos and unlock your keos wallet if built locally or remove your docker container. Also don't forget to restart the `yarn` environment because the blocks state needs to be refreshed.

In the above instructions we ran a simple genesis case with 3 inducted members, but you can also try `run-full-election.wasm` to see a community with more than 100 members with chief delegates already elected.
4 changes: 3 additions & 1 deletion contracts/eden/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ add_executable(eden
src/actions/migrate.cpp
src/actions/encrypt.cpp
src/actions/tables.cpp
src/actions/sessions.cpp
src/eden.cpp
src/events.cpp
src/accounts.cpp
Expand All @@ -32,6 +33,7 @@ add_executable(eden
src/encrypt.cpp
)
target_include_directories(eden PUBLIC include ../token/include PRIVATE ../../external/atomicassets-contract/include)
target_compile_options(eden PUBLIC -flto)
target_link_libraries(eden eosio-contract)
set_target_properties(eden PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ROOT_BINARY_DIR})

Expand Down Expand Up @@ -62,7 +64,7 @@ eden_tester_test(test-eden)

# Chain Runners
add_test_eden("run-genesis" "")
add_test_eden("run-full-election" "")
add_test_eden("run-elections" "")

file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/tests/data ${ROOT_BINARY_DIR}/eden-test-data SYMBOLIC)

Expand Down
106 changes: 76 additions & 30 deletions contracts/eden/include/eden.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

#include <constants.hpp>
#include <eden-atomicassets.hpp>
#include <eden_dispatcher.hpp>
#include <encrypt.hpp>
#include <eosio/asset.hpp>
#include <eosio/bytes.hpp>
#include <eosio/eosio.hpp>
#include <inductions.hpp>
#include <sessions.hpp>
#include <string>
#include <vector>

Expand Down Expand Up @@ -40,6 +42,9 @@ namespace eden
extern const char* peacetreaty_clause;
extern const char* bylaws_clause;

// Placeholder; the ABI generator redefines this
using verb = std::variant<int>;

#ifdef ENABLE_SET_TABLE_ROWS
using table_variant = boost::mp11::mp_append<account_variant,
auction_variant,
Expand Down Expand Up @@ -74,6 +79,17 @@ namespace eden
const eosio::asset& quantity,
std::string memo);

void newsession(eosio::name eden_account,
const eosio::public_key& key,
eosio::block_timestamp expiration,
const std::string& description);

void delsession(const eosio::not_in_abi<session_info>& current_session,
eosio::name eden_account,
const eosio::public_key& key);

void run(eosio::ignore<run_auth> auth, eosio::ignore<std::vector<verb>> verbs);

void withdraw(eosio::name owner, const eosio::asset& quantity);

void donate(eosio::name payer, const eosio::asset& quantity);
Expand All @@ -95,21 +111,33 @@ namespace eden

void clearall();

void inductinit(uint64_t id,
void inductinit(const eosio::not_in_abi<session_info>& current_session,
uint64_t id,
eosio::name inviter,
eosio::name invitee,
std::vector<eosio::name> witnesses);

void inductprofil(uint64_t id, new_member_profile new_member_profile);
void inductprofil(const eosio::not_in_abi<session_info>& current_session,
uint64_t id,
new_member_profile new_member_profile);

void inductvideo(eosio::name account, uint64_t id, std::string video);
void inductvideo(const eosio::not_in_abi<session_info>& current_session,
eosio::name account,
uint64_t id,
std::string video);

void inductendors(eosio::name account, uint64_t id, eosio::checksum256 induction_data_hash);
void inductendors(const eosio::not_in_abi<session_info>& current_session,
eosio::name account,
uint64_t id,
eosio::checksum256 induction_data_hash);

void inductdonate(eosio::name payer, uint64_t id, const eosio::asset& quantity);

void inductcancel(eosio::name account, uint64_t id);
void inductmeetin(eosio::name account,
void inductcancel(const eosio::not_in_abi<session_info>& current_session,
eosio::name account,
uint64_t id);
void inductmeetin(const eosio::not_in_abi<session_info>& current_session,
eosio::name account,
uint64_t id,
const std::vector<encrypted_key>& keys,
const eosio::bytes& data,
Expand All @@ -127,16 +155,25 @@ namespace eden
const std::string& election_time,
uint32_t round_duration_sec);

void electopt(eosio::name member, bool participating);
void electopt(const eosio::not_in_abi<session_info>& current_session,
eosio::name member,
bool participating);

void electseed(const eosio::bytes& btc_header);
void electmeeting(eosio::name account,
void electmeeting(const eosio::not_in_abi<session_info>& current_session,
eosio::name account,
uint8_t round,
const std::vector<encrypted_key>& keys,
const eosio::bytes& data,
const std::optional<eosio::bytes>& old_data);
void electvote(uint8_t round, eosio::name voter, eosio::name candidate);
void electvideo(uint8_t round, eosio::name voter, const std::string& video);
void electvote(const eosio::not_in_abi<session_info>& current_session,
uint8_t round,
eosio::name voter,
eosio::name candidate);
void electvideo(const eosio::not_in_abi<session_info>& current_session,
uint8_t round,
eosio::name voter,
const std::string& video);
void electprocess(uint32_t max_steps);

void distribute(uint32_t max_steps);
Expand Down Expand Up @@ -188,9 +225,12 @@ namespace eden
eosio::ignore<std::vector<eosio::asset>>);
};

EOSIO_ACTIONS(
EDEN_ACTIONS(
eden,
"eden.gm"_n,
action(newsession, eden_account, key, expiration, description),
eden_verb(delsession, 0, eden_account, key),
action(run, auth, verbs),
action(withdraw, owner, quantity, ricardian_contract(withdraw_ricardian)),
action(donate, owner, quantity),
action(fundtransfer, from, distribution_time, rank, to, amount, memo),
Expand All @@ -211,35 +251,41 @@ namespace eden
action(addtogenesis, account, expiration),
action(gensetexpire, id, new_expiration),
action(clearall, ricardian_contract(clearall_ricardian)),
action(inductinit,
id,
inviter,
invitee,
witnesses,
ricardian_contract(inductinit_ricardian)),
action(inductmeetin, account, id, keys, data, old_data),
action(inductprofil, id, new_member_profile, ricardian_contract(inductprofil_ricardian)),
action(inductvideo, account, id, video, ricardian_contract(inductvideo_ricardian)),
action(inductendors,
account,
id,
induction_data_hash,
ricardian_contract(inductendors_ricardian)),
eden_verb(inductinit,
10,
id,
inviter,
invitee,
witnesses,
ricardian_contract(inductinit_ricardian)),
eden_verb(inductmeetin, 1, account, id, keys, data, old_data),
eden_verb(inductprofil,
2,
id,
new_member_profile,
ricardian_contract(inductprofil_ricardian)),
eden_verb(inductvideo, 3, account, id, video, ricardian_contract(inductvideo_ricardian)),
eden_verb(inductendors,
4,
account,
id,
induction_data_hash,
ricardian_contract(inductendors_ricardian)),
action(setencpubkey, account, key),
action(electsettime, election_time),
action(electconfig, day, time, round_duration),
action(electopt, member, participating),
eden_verb(electopt, 5, member, participating),
action(electseed, btc_header),
action(electmeeting, account, round, keys, data, old_data),
action(electvote, round, voter, candidate),
action(electvideo, round, voter, video),
eden_verb(electmeeting, 6, account, round, keys, data, old_data),
eden_verb(electvote, 7, round, voter, candidate),
eden_verb(electvideo, 8, round, voter, video),
action(electprocess, max_steps),
action(bylawspropose, proposer, bylaws),
action(bylawsapprove, approver, bylaws_hash),
action(bylawsratify, approver, bylaws_hash),
action(distribute, max_steps),
action(inductdonate, payer, id, quantity, ricardian_contract(inductdonate_ricardian)),
action(inductcancel, account, id, ricardian_contract(inductcancel_ricardian)),
eden_verb(inductcancel, 9, account, id, ricardian_contract(inductcancel_ricardian)),
action(inducted, inductee, ricardian_contract(inducted_ricardian)),
action(resign, account),
action(gc, limit, ricardian_contract(gc_ricardian)),
Expand Down
20 changes: 20 additions & 0 deletions contracts/eden/include/eden_abi_generator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#define EOSIO_ABIGEN_ITEMeden_verbs(ns, variant_name, missing_struct_name) \
([&] { \
gen.def.structs.push_back(eosio::struct_def{missing_struct_name}); \
eosio::variant_def vdef{variant_name}; \
ns::for_each_verb([&](uint32_t index, const char* name, const auto&) { \
if (index >= vdef.types.size()) \
vdef.types.resize(index + 1, missing_struct_name); \
vdef.types[index] = name; \
}); \
auto& variants = gen.def.variants.value; \
auto it = std::find_if(variants.begin(), variants.end(), \
[&](auto& d) { return d.name == variant_name; }); \
if (it != variants.end()) \
*it = std::move(vdef); \
else \
variants.push_back(std::move(vdef)); \
})(); \
, 1
Loading