-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Improvements required by standard and PSBT dependencies #195
Conversation
… a part of contract state
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #195 +/- ##
========================================
- Coverage 17.3% 16.6% -0.7%
========================================
Files 31 32 +1
Lines 3491 3677 +186
========================================
+ Hits 604 609 +5
- Misses 2887 3068 +181
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4b1860f
to
19d4611
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.
Just looking for some clarification on a few items
src/contract/bundle.rs
Outdated
@@ -104,14 +120,28 @@ impl TransitionBundle { | |||
} | |||
|
|||
impl TransitionBundle { | |||
pub fn validate(&self) -> bool { | |||
pub fn validate(&self) -> Result<ContractId, BundleError> { | |||
let mut contract_id = None; | |||
let mut used_inputs = bset! {}; | |||
for item in self.values() { |
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 just want to call attention to the contents of this loop and confirm it's written as it should be... It seems strangely implemented.
src/contract/seal.rs
Outdated
impl SealDefinition<GenesisSeal> { | ||
pub fn transmutate(self) -> SealDefinition<GraphSeal> { | ||
impl Xchain<GenesisSeal> { | ||
pub fn transmutate(self) -> Xchain<GraphSeal> { |
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 does transmutate do? Is it supposed to swap across chains? If so, this might be wrong
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.
No, not across chains. Across forms of seals (genesis/extension vs transition).
In transitions the seal may point to a witness tx, which txid is not known. Thus we use special TxPtr
enum covering this case. In genesis/extension there is no witness tx and txid of the seal is always known, that is why we use Txid
type. The first type of seals is called GraphSeal
, the other GenesisSeal
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.
Interesting, good to know
@@ -52,6 +52,22 @@ impl InstructionSet for RgbIsa { | |||
bset! {"RGB"} | |||
} | |||
|
|||
fn src_regs(&self) -> HashSet<Reg> { |
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.
Can you add some docs to this file? It's not obvious to me what the does.
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.
Sure. It returns set of registers whose values are used as inputs. It is very helpful both for printing execution logs (showing inputs and outputs for each opcode) - but also needed for the future static analyzers and code optimizers (if two instructions share no inputs/outputs they are commutative, meaning they can go in any order/parallelized in execution).
It comes from the trait in AluVM
where it has doc comment, so it should be seen here in docs.rs
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.
Cool, I'll look for it there when it's published
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.
ACK
A bunch of improvements which appeared from my work on v0.11 in the depending libraries (not touching the validation code)