-
Notifications
You must be signed in to change notification settings - Fork 14
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
Byzcoin roster changes #42
Conversation
It implements the roster change with only the support of removals and without any access rights control.
@nkcr The PR seems huge because I split the transaction abstraction and the task abstraction (equivalent to an instruction in cothority) so a lot of code moving around. Most of the new code is the task implementations for DARC, contracts and the roster. |
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.
looks really nice 👍
It seems that some structs miss their - implements ...
comment. I didn't mark them all.
require.Equal(t, tx.GetID(), instance.GetKey()) | ||
require.Equal(t, tx.GetID(), instance.GetArcID()) | ||
require.IsType(t, (*darc.AccessControlProto)(nil), instance.GetValue()) | ||
require.Equal(t, 19, roster.Len()) |
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 think it's important to comment that kind of expected result in the test, as it can greatly help understanding the system.
// Fingerprinter is an interface to perform fingerprinting on object. | ||
type Fingerprinter interface { | ||
// Fingerprint writes itself to the writer in a deterministic way. | ||
Fingerprint(io.Writer, ProtoMarshaler) 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.
Fingerprint: maybe add it to the terminologies? (as we already have footprint, that would be good)
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.
Good point I forgot to change footprint to fingerprint which seems to be more used.
internal/testing/fake/mod.go
Outdated
if c == nil { | ||
return true | ||
} | ||
return c.Value <= 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.
if c == nil { | |
return true | |
} | |
return c.Value <= 0 | |
return c == nil || c.Value <= 0 |
map<string, Expression> rules = 1; | ||
} | ||
|
||
message Task { |
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.
A new terminology ?
) | ||
|
||
// clientTask is the client task of a transaction that will allow an authorized | ||
// identity to create or update a DARC. |
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.
- implements ...
return nil | ||
} | ||
|
||
// serverTask is the server task for a DARC transaction. |
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.
- implements ...
return nil | ||
} | ||
|
||
type taskFactory 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.
- implements ...
?
latest, err := ldgr.bc.GetBlock() | ||
if err != nil { | ||
return nil, xerrors.Errorf("couldn't read latest block: %v", err) | ||
return nil, err |
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 removing those error wrappings?
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.
Oh that's because I removed the GetInstance which does not really makes sense anymore and I usually write the errors alongside the tests but the tests will come in the next PR (complete rewrite of the function).
ledger/byzcoin/task.go
Outdated
"golang.org/x/xerrors" | ||
) | ||
|
||
// taskFactory is an task factory that can process several types of tasks. |
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.
// taskFactory is an task factory that can process several types of tasks. | |
// taskFactory is a task factory that can process several types of tasks. |
ledger/inventory/mod.go
Outdated
@@ -12,7 +12,8 @@ type Page interface { | |||
// the integrity. | |||
GetFootprint() []byte | |||
|
|||
// Read returns the value stored at the given key. | |||
// Read returns the value stored at the given key. If the key does not | |||
// exist, it should a nil value without 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.
// exist, it should a nil value without error. | |
// exist, it should return a nil value without error. |
64140cc
to
fe8530c
Compare
Byzcoin roster changes
This PR refactors the transactions in Byzcoin to allow multiple kinds to take advantage of the polymorphism. It then partially implements the roster transactions.
Coming: Byzcoin unit tests and full roster change support.