-
Notifications
You must be signed in to change notification settings - Fork 115
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
epochtime refactor #1889
epochtime refactor #1889
Conversation
|
} | ||
|
||
// TxDoTick is a transaction for triggering a tick. | ||
type TxDoTick struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ change from epochtime mock: you no longer specify how far to move forward
do we want that? with this it'll take multiple ticks to change committees
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably might make sense to add it back (performance wise) as otherwise it might take a lot of transactions to do enough ticks to trigger an epoch transition 👍 (also it's only used for debug/tests)
} | ||
|
||
// QueryGetTickResponse is a response to QueryGetTick. | ||
type QueryGetTickResponse struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ change from epochtime mock: no longer pass a height parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it's needed/was used
|
||
const ( | ||
// Mock ticker state. | ||
stateCurrentTick = "ticker_mock/current" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ change from epochtime mock: what has previously been two keys is now unified into a single state item that expresses both the current tick and the are-we-going-to-tick info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes a bit simplified. It had to be 2 states before as the next tick could be any number
) | ||
|
||
const ( | ||
cfgBackend = "epochtime.backend" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @peterjgilbert for runtime-ethereum effects, where epochtime.backend is the only change to e2e test
This needs to be equal to the greatest common denominator of all of the scheduling intervals.
Likewise, this should be done at a rate equal to the greatest common denominator of all of the scheduling intervals, to avoid a node disappearing mid-interval.
Might be slightly more complicated. What happens when say, the advance interval is > 1. Do all intervening epoch changes get triggered? Right now this isn't needed but it might be for correct functionality. That said the primary place where this thing is required for the Go tests. The e2e migration test can likely be rewritten to remove the dependence on this backend.
Specify a to-be-removed interval with the new semantics, and call that an epoch, and incrementally transition things over. |
While I'm here thinking about this, the interval(s) should likely be a consensus parameter rather than something passed in as a flag. |
df9fa93
to
689e2cd
Compare
Codecov Report
@@ Coverage Diff @@
## master #1889 +/- ##
==========================================
- Coverage 54.97% 54.58% -0.39%
==========================================
Files 235 232 -3
Lines 22067 21777 -290
==========================================
- Hits 12131 11888 -243
+ Misses 8637 8586 -51
- Partials 1299 1303 +4
Continue to review full report at Codecov.
|
f8faed7
to
507c75c
Compare
507c75c
to
2759d5e
Compare
2759d5e
to
0667695
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review in progress
# EKIDEN_VALIDATOR_SOCKET | ||
# EKIDEN_CLIENT_SOCKET | ||
# EKIDEN_ENTITY_PRIVATE_KEY | ||
# | ||
# Optional named arguments: | ||
# | ||
# epochtime_backend - epochtime backend (default: tendermint) | ||
# ekiden_ticker_settable - settable ticker (default: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# ekiden_ticker_settable - settable ticker (default: 1) | |
# ekiden_ticker_settable - use settable ticker instead of interval ticker (default: 1) |
${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ | ||
--metrics.mode none \ | ||
--storage.backend cachingclient \ | ||
--storage.cachingclient.file ${data_dir}/storage-cache \ | ||
--consensus.backend tendermint \ | ||
--tendermint.abci.epoch_interval 5 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ so overall 25 height per epoch now, down from 30
require.NoError(nerr, "GetEpoch") | ||
if epoch != newEpoch { | ||
// After epoch changed, do one more tick. | ||
err = backend.DoTick(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this?
@@ -785,40 +787,57 @@ func (s *ApplicationState) CheckTxTree() *iavl.MutableTree { | |||
return s.checkTxTree | |||
} | |||
|
|||
// GetEpoch returns the current scheduling epoch. | |||
func (s *ApplicationState) GetEpoch(timeSource ticker.Backend) (scheduler.EpochTime, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would this look like when there are multiple epoch intervals for different committee types? additional parameter maybe?
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &dbgPB.SetEpochResponse{}, nil | ||
// TODO: make it not get stuck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮 should we do that?
if epochtime.EpochTime(node.Expiration) < epoch { | ||
if node.Expiration == 0 { | ||
// If Expiration == 0, register for next epoch. | ||
node.Expiration = uint64(epoch) + 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what led to this change?
@@ -76,5 +76,5 @@ require ( | |||
golang.org/x/text v0.3.2 // indirect | |||
google.golang.org/appengine v1.4.0 // indirect | |||
google.golang.org/genproto v0.0.0-20190611190212-a7e196e89fd3 // indirect | |||
google.golang.org/grpc v1.21.1 | |||
google.golang.org/grpc v1.22.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@@ -550,3 +554,4 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | |||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | |||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | |||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | |||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ apparently this is Staticcheck https://github.com/dominikh/go-tools
"github.com/oasislabs/ekiden/go/registry/api" | ||
schedulerApi "github.com/oasislabs/ekiden/go/scheduler/api" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imported as scheduler
elsewhere, and it seems scheduler scheduler.Backend
works okay... hm
@@ -151,10 +154,9 @@ func (r *Registration) registerNode(epoch epochtime.EpochTime) error { | |||
} | |||
identityPublic := r.identity.NodeSigner.Public() | |||
nodeDesc := node.Node{ | |||
ID: identityPublic, | |||
EntityID: r.entitySigner.Public(), | |||
Expiration: uint64(epoch) + 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove the field then?
What's the plan with this PR? |
Closing this one as it will probably be easier to start this from scratch now with all the changes happening in mean time - also the approach will likely be different. |
Fixes: #1793
Done:
TODO:
Proposed service changes: