Skip to content

Conversation

@adecaro
Copy link
Contributor

@adecaro adecaro commented Aug 29, 2022

This PR introduces the following capabilities:

  • Allow an auditor to check if an input or an output contains an HTLC script.
  • If an input or output contains an HTLC script, the Auditor should be able to extract the script and learn about the conditions.

As a bonus, this PR also improves on the validation of the HTLC script.

Signed-off-by: Angelo De Caro adc@zurich.ibm.com

@adecaro adecaro marked this pull request as draft August 29, 2022 14:18
@adecaro adecaro marked this pull request as ready for review September 16, 2022 07:19
@adecaro adecaro requested a review from KElkhiyaoui September 16, 2022 11:03
@adecaro adecaro self-assigned this Sep 16, 2022
@adecaro adecaro requested a review from HagarMeir September 17, 2022 13:55
@adecaro adecaro added the enhancement New feature or request label Sep 17, 2022
if !output.IsHTLC() {
continue
}
// check script details, for example make sure the deadline has not passed
Copy link
Contributor

Choose a reason for hiding this comment

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

AcceptCashView is only used to accept when there is an issue (according to latest topology) and so this code is never used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aha, good catch. It is during Lock. We have already stuff there. I will update.

}
// check script details, for example make sure the deadline has not passed
script, err := output.Script()
assert.NoError(err, "cannot get htlc script from input")
Copy link
Contributor

Choose a reason for hiding this comment

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

from output

if !output.IsHTLC() {
continue
}
// check script details, for example make sure the deadline has not passed
Copy link
Contributor

Choose a reason for hiding this comment

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

script.Validate checks more than just the deadline

"time"

"github.com/pkg/errors"

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove empty line and run go imports

script := &Script{}
err = json.Unmarshal(owner.Identity, script)
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a description to this error

script := &Script{}
err = json.Unmarshal(owner.Identity, script)
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a description to this error

// - The recipient must be set
// - The deadline must be after the passed time reference
// - HashInfo must be Available
func (s Script) Validate(timeReference time.Time) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

func (s *Script)

adecaro and others added 9 commits September 19, 2022 09:50
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
- finalizing integration test checks

Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
…izing integration test checks

Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
…izing integration test checks

Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
…izing integration test checks

Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
@adecaro adecaro removed the request for review from KElkhiyaoui September 19, 2022 09:49
@adecaro adecaro merged commit 8f2b40d into main Sep 19, 2022
@adecaro adecaro deleted the f-audit-ext branch September 19, 2022 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants