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

decentralization #43

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

decentralization #43

wants to merge 7 commits into from

Conversation

danielvo11
Copy link
Contributor

Change Description

Documentation Additions

  • Documentation Additions

Pushing The Code

Unit Test Coverage

@danielvo11 danielvo11 marked this pull request as ready for review August 14, 2024 05:13
src/orng.cpp Outdated
for (auto resolver : job_resolvers) {
auto resolver_node_itr = node_table.require_find(resolver.value, "Can not find resolver node to update job count");
node_table.modify(resolver_node_itr, same_payer, [&](auto& n) {
n.job_count += 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update this record when resolver submit the seed instead of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@porkchop What do you think? Should we count number of seed node has been submit for reward or just succeed job?

Also should we count failed job for node reward?

src/orng.cpp Outdated
uint64_t sig_val{job_it->signing_value};

auto current_epoch_itr = resolveepoch();
auto resolvers = current_epoch_itr->resolvers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am wonder in the epoch race condition happen, there might be a case that resolvers come from 2 different epochs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolvers come from 2 different epochs?

I'm not really understand, can you elaborate this?

Each time only one epoch active with specific choose random resolvers. In any cases that epoch can not pick resolvers (not enough active not ping) then that epoch will be skip.

} else {
// if previous epoch can not resolve job, clear previous seeds and submit again in this epoch
resolver_seeds.clear();
resolver_seeds.push_back({ resolver, rv_hash});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we update last_resolve_epoch for this job_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


vector<JobSeed> resolver_seeds = job_it->resolver_seeds;
if (job_it->last_resolve_epoch == epoch.id) {
auto lower = std::lower_bound(resolver_seeds.begin(), resolver_seeds.end(), resolver,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if the job_id already has final_hash but new resolver try to submit new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not verify signature.");

epoch_seed_itr->signature = signature;
epoch_signature_table.set(epoch_signature, get_self());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just wonder what if the last resolve change the public-key this time? it will change the signature as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will don't allow to change the updated public key, they only able to update next public key. The action for node to update key here https://github.com/worldwide-asset-exchange/wax-orng/blob/decentralization/src/orng.cpp#L498


check(job_it->final_hash != checksum256(), "Job has not been resolved yet");

action(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if it throws error in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oracle will catch that error here https://monica.thh.io/wax/wax-rng-oracle/-/blob/decentralize/lib/poller.js#L210.

And then after max retry time, it will report job fail execution using action jobsfail.

After collect enough fail execution from all resolvers, that job will be deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants